Skip to content

Commit 8112d11

Browse files
committedJul 4, 2022
Account deletion fixes
1 parent 0f38ee9 commit 8112d11

File tree

1 file changed

+10
-2
lines changed

1 file changed

+10
-2
lines changed
 

‎submodules/SettingsUI/Sources/DeleteAccountDataController.swift

Lines changed: 10 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -458,12 +458,13 @@ func deleteAccountDataController(context: AccountContext, mode: DeleteAccountDat
458458
return updated
459459
}
460460

461+
secondaryActionDisabled = false
461462
presentControllerImpl?(textAlertController(context: context, title: nil, text: presentationData.strings.Login_UnknownError, actions: [TextAlertAction(type: .defaultAction, title: presentationData.strings.Common_OK, action: {})]))
462463
}, completed: {
463464
dismissImpl?()
464465

465466
let presentGlobalController = context.sharedContext.presentGlobalController
466-
let _ = logoutFromAccount(id: accountId, accountManager: accountManager, alreadyLoggedOutRemotely: true).start(completed: {
467+
let _ = logoutFromAccount(id: accountId, accountManager: accountManager, alreadyLoggedOutRemotely: false).start(completed: {
467468
Queue.mainQueue().after(0.1) {
468469
presentGlobalController(UndoOverlayController(presentationData: presentationData, content: .info(title: nil, text: presentationData.strings.DeleteAccount_Success), elevatedLayout: false, animateInAsReplacement: false, action: { _ in return false }), nil)
469470
}
@@ -488,7 +489,11 @@ func deleteAccountDataController(context: AccountContext, mode: DeleteAccountDat
488489
var phoneNumber: String?
489490
controller?.forEachItemNode { itemNode in
490491
if let itemNode = itemNode as? DeleteAccountPhoneItemNode {
491-
phoneNumber = itemNode.phoneNumber
492+
var phoneValue = itemNode.phoneNumber
493+
if phoneValue.hasPrefix("+939998") {
494+
phoneValue = phoneValue.replacingOccurrences(of: "+939998", with: "+9998")
495+
}
496+
phoneNumber = phoneValue
492497
}
493498
}
494499

@@ -501,6 +506,7 @@ func deleteAccountDataController(context: AccountContext, mode: DeleteAccountDat
501506
phone = "+\(phone)"
502507
}
503508
if phone != phoneNumber {
509+
secondaryActionDisabled = false
504510
presentControllerImpl?(textAlertController(context: context, title: nil, text: presentationData.strings.DeleteAccount_InvalidPhoneNumberError, actions: [TextAlertAction(type: .defaultAction, title: presentationData.strings.Common_OK, action: {})]))
505511
return
506512
}
@@ -519,6 +525,8 @@ func deleteAccountDataController(context: AccountContext, mode: DeleteAccountDat
519525

520526
let _ = (context.engine.auth.requestTwoStepVerifiationSettings(password: state.password)
521527
|> deliverOnMainQueue).start(error: { error in
528+
secondaryActionDisabled = false
529+
522530
updateState { current in
523531
var updated = current
524532
updated.isLoading = false

0 commit comments

Comments
 (0)
Please sign in to comment.