mirror of
https://github.com/Swiftgram/Telegram-iOS.git
synced 2025-12-23 06:35:51 +00:00
Add account deletion logging
This commit is contained in:
@@ -7797,6 +7797,8 @@ Sorry for the inconvenience.";
|
|||||||
"DeleteAccount.ConfirmationAlertText" = "Deleting your account will permanently delete your data!\n\nIt is imposible to reverse this action!";
|
"DeleteAccount.ConfirmationAlertText" = "Deleting your account will permanently delete your data!\n\nIt is imposible to reverse this action!";
|
||||||
"DeleteAccount.ConfirmationAlertDelete" = "Delete My Account";
|
"DeleteAccount.ConfirmationAlertDelete" = "Delete My Account";
|
||||||
|
|
||||||
|
"DeleteAccount.Success" = "The account has been successfully deleted.";
|
||||||
|
|
||||||
"PeerInfo.GiftPremium" = "Gift Premium";
|
"PeerInfo.GiftPremium" = "Gift Premium";
|
||||||
|
|
||||||
"Premium.Gift.Title" = "Gift Telegram Premium";
|
"Premium.Gift.Title" = "Gift Telegram Premium";
|
||||||
|
|||||||
@@ -114,7 +114,12 @@ class InviteLinkHeaderItemNode: ListViewItemNode {
|
|||||||
|
|
||||||
return { item, params, neighbors in
|
return { item, params, neighbors in
|
||||||
let leftInset: CGFloat = 24.0 + params.leftInset
|
let leftInset: CGFloat = 24.0 + params.leftInset
|
||||||
let iconSize = CGSize(width: 140.0, height: 140.0)
|
let iconSize: CGSize
|
||||||
|
if params.width > params.availableHeight && params.width > 320.0 {
|
||||||
|
iconSize = CGSize(width: 140.0, height: 140.0)
|
||||||
|
} else {
|
||||||
|
iconSize = CGSize(width: 124.0, height: 124.0)
|
||||||
|
}
|
||||||
let topInset: CGFloat = iconSize.height - 4.0
|
let topInset: CGFloat = iconSize.height - 4.0
|
||||||
let spacing: CGFloat = 5.0
|
let spacing: CGFloat = 5.0
|
||||||
|
|
||||||
|
|||||||
@@ -15,6 +15,7 @@ import UrlHandling
|
|||||||
import InviteLinksUI
|
import InviteLinksUI
|
||||||
import CountrySelectionUI
|
import CountrySelectionUI
|
||||||
import PhoneInputNode
|
import PhoneInputNode
|
||||||
|
import UndoUI
|
||||||
|
|
||||||
private struct DeleteAccountDataArguments {
|
private struct DeleteAccountDataArguments {
|
||||||
let context: AccountContext
|
let context: AccountContext
|
||||||
@@ -289,6 +290,23 @@ func deleteAccountDataController(context: AccountContext, mode: DeleteAccountDat
|
|||||||
peers = .single([])
|
peers = .single([])
|
||||||
}
|
}
|
||||||
|
|
||||||
|
let cancelImpl = {
|
||||||
|
dismissImpl?()
|
||||||
|
|
||||||
|
switch mode {
|
||||||
|
case .peers:
|
||||||
|
addAppLogEvent(postbox: context.account.postbox, type: "deactivate.step_cloud_cancel")
|
||||||
|
case .groups:
|
||||||
|
addAppLogEvent(postbox: context.account.postbox, type: "deactivate.step_groups_cancel")
|
||||||
|
case .messages:
|
||||||
|
addAppLogEvent(postbox: context.account.postbox, type: "deactivate.step_messages_cancel")
|
||||||
|
case .phone:
|
||||||
|
addAppLogEvent(postbox: context.account.postbox, type: "deactivate.step_phone_cancel")
|
||||||
|
case .password:
|
||||||
|
addAppLogEvent(postbox: context.account.postbox, type: "deactivate.step_2fa_cancel")
|
||||||
|
}
|
||||||
|
}
|
||||||
|
|
||||||
let signal = combineLatest(queue: .mainQueue(),
|
let signal = combineLatest(queue: .mainQueue(),
|
||||||
context.sharedContext.presentationData,
|
context.sharedContext.presentationData,
|
||||||
peers,
|
peers,
|
||||||
@@ -296,7 +314,7 @@ func deleteAccountDataController(context: AccountContext, mode: DeleteAccountDat
|
|||||||
)
|
)
|
||||||
|> map { presentationData, peers, state -> (ItemListControllerState, (ItemListNodeState, Any)) in
|
|> map { presentationData, peers, state -> (ItemListControllerState, (ItemListNodeState, Any)) in
|
||||||
let leftNavigationButton = ItemListNavigationButton(content: .text(presentationData.strings.Common_Cancel), style: .regular, enabled: true, action: {
|
let leftNavigationButton = ItemListNavigationButton(content: .text(presentationData.strings.Common_Cancel), style: .regular, enabled: true, action: {
|
||||||
dismissImpl?()
|
cancelImpl()
|
||||||
})
|
})
|
||||||
|
|
||||||
var focusItemTag: DeleteAccountEntryTag?
|
var focusItemTag: DeleteAccountEntryTag?
|
||||||
@@ -319,7 +337,7 @@ func deleteAccountDataController(context: AccountContext, mode: DeleteAccountDat
|
|||||||
}
|
}
|
||||||
|
|
||||||
let footerItem = DeleteAccountFooterItem(theme: presentationData.theme, title: buttonTitle, secondaryTitle: presentationData.strings.DeleteAccount_Continue, action: {
|
let footerItem = DeleteAccountFooterItem(theme: presentationData.theme, title: buttonTitle, secondaryTitle: presentationData.strings.DeleteAccount_Continue, action: {
|
||||||
dismissImpl?()
|
cancelImpl()
|
||||||
}, secondaryAction: {
|
}, secondaryAction: {
|
||||||
proceedImpl?()
|
proceedImpl?()
|
||||||
})
|
})
|
||||||
@@ -414,7 +432,13 @@ func deleteAccountDataController(context: AccountContext, mode: DeleteAccountDat
|
|||||||
let controller = deleteAccountDataController(context: context, mode: nextMode, twoStepAuthData: twoStepAuthData)
|
let controller = deleteAccountDataController(context: context, mode: nextMode, twoStepAuthData: twoStepAuthData)
|
||||||
replaceTopControllerImpl?(controller)
|
replaceTopControllerImpl?(controller)
|
||||||
} else {
|
} else {
|
||||||
|
addAppLogEvent(postbox: context.account.postbox, type: "deactivate.step_confirmation_show")
|
||||||
|
|
||||||
presentControllerImpl?(textAlertController(context: context, title: presentationData.strings.DeleteAccount_ConfirmationAlertTitle, text: presentationData.strings.DeleteAccount_ConfirmationAlertText, actions: [TextAlertAction(type: .destructiveAction, title: presentationData.strings.DeleteAccount_ConfirmationAlertDelete, action: {
|
presentControllerImpl?(textAlertController(context: context, title: presentationData.strings.DeleteAccount_ConfirmationAlertTitle, text: presentationData.strings.DeleteAccount_ConfirmationAlertText, actions: [TextAlertAction(type: .destructiveAction, title: presentationData.strings.DeleteAccount_ConfirmationAlertDelete, action: {
|
||||||
|
addAppLogEvent(postbox: context.account.postbox, type: "deactivate.final")
|
||||||
|
|
||||||
|
invokeAppLogEventsSynchronization(postbox: context.account.postbox)
|
||||||
|
|
||||||
updateState { current in
|
updateState { current in
|
||||||
var updated = current
|
var updated = current
|
||||||
updated.isLoading = true
|
updated.isLoading = true
|
||||||
@@ -434,9 +458,17 @@ func deleteAccountDataController(context: AccountContext, mode: DeleteAccountDat
|
|||||||
presentControllerImpl?(textAlertController(context: context, title: nil, text: presentationData.strings.Login_UnknownError, actions: [TextAlertAction(type: .defaultAction, title: presentationData.strings.Common_OK, action: {})]))
|
presentControllerImpl?(textAlertController(context: context, title: nil, text: presentationData.strings.Login_UnknownError, actions: [TextAlertAction(type: .defaultAction, title: presentationData.strings.Common_OK, action: {})]))
|
||||||
}, completed: {
|
}, completed: {
|
||||||
dismissImpl?()
|
dismissImpl?()
|
||||||
let _ = logoutFromAccount(id: accountId, accountManager: accountManager, alreadyLoggedOutRemotely: true).start()
|
|
||||||
|
let presentGlobalController = context.sharedContext.presentGlobalController
|
||||||
|
let _ = logoutFromAccount(id: accountId, accountManager: accountManager, alreadyLoggedOutRemotely: true).start(completed: {
|
||||||
|
Queue.mainQueue().after(0.1) {
|
||||||
|
presentGlobalController(UndoOverlayController(presentationData: presentationData, content: .info(title: nil, text: presentationData.strings.DeleteAccount_Success), elevatedLayout: false, animateInAsReplacement: false, action: { _ in return false }), nil)
|
||||||
|
}
|
||||||
|
})
|
||||||
})
|
})
|
||||||
}), TextAlertAction(type: .defaultAction, title: presentationData.strings.Common_Cancel, action: {
|
}), TextAlertAction(type: .defaultAction, title: presentationData.strings.Common_Cancel, action: {
|
||||||
|
addAppLogEvent(postbox: context.account.postbox, type: "deactivate.step_confirmation_cancel")
|
||||||
|
|
||||||
dismissImpl?()
|
dismissImpl?()
|
||||||
})]))
|
})]))
|
||||||
}
|
}
|
||||||
@@ -517,6 +549,19 @@ func deleteAccountDataController(context: AccountContext, mode: DeleteAccountDat
|
|||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
|
switch mode {
|
||||||
|
case .peers:
|
||||||
|
addAppLogEvent(postbox: context.account.postbox, type: "deactivate.step_cloud_show")
|
||||||
|
case .groups:
|
||||||
|
addAppLogEvent(postbox: context.account.postbox, type: "deactivate.step_groups_show")
|
||||||
|
case .messages:
|
||||||
|
addAppLogEvent(postbox: context.account.postbox, type: "deactivate.step_messages_show")
|
||||||
|
case .phone:
|
||||||
|
addAppLogEvent(postbox: context.account.postbox, type: "deactivate.step_phone_show")
|
||||||
|
case .password:
|
||||||
|
addAppLogEvent(postbox: context.account.postbox, type: "deactivate.step_2fa_show")
|
||||||
|
}
|
||||||
|
|
||||||
return controller
|
return controller
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|||||||
@@ -180,6 +180,8 @@ public func deleteAccountOptionsController(context: AccountContext, navigationCo
|
|||||||
let supportPeerDisposable = MetaDisposable()
|
let supportPeerDisposable = MetaDisposable()
|
||||||
|
|
||||||
let arguments = DeleteAccountOptionsArguments(changePhoneNumber: {
|
let arguments = DeleteAccountOptionsArguments(changePhoneNumber: {
|
||||||
|
addAppLogEvent(postbox: context.account.postbox, type: "deactivate.options_phone_change_tap")
|
||||||
|
|
||||||
let _ = (context.engine.data.get(TelegramEngine.EngineData.Item.Peer.Peer(id: context.engine.account.peerId))
|
let _ = (context.engine.data.get(TelegramEngine.EngineData.Item.Peer.Peer(id: context.engine.account.peerId))
|
||||||
|> deliverOnMainQueue).start(next: { accountPeer in
|
|> deliverOnMainQueue).start(next: { accountPeer in
|
||||||
guard let accountPeer = accountPeer, case let .user(user) = accountPeer else {
|
guard let accountPeer = accountPeer, case let .user(user) = accountPeer else {
|
||||||
@@ -192,6 +194,8 @@ public func deleteAccountOptionsController(context: AccountContext, navigationCo
|
|||||||
dismissImpl?()
|
dismissImpl?()
|
||||||
})
|
})
|
||||||
}, addAccount: {
|
}, addAccount: {
|
||||||
|
addAppLogEvent(postbox: context.account.postbox, type: "deactivate.options_add_account_tap")
|
||||||
|
|
||||||
let _ = (activeAccountsAndPeers(context: context)
|
let _ = (activeAccountsAndPeers(context: context)
|
||||||
|> take(1)
|
|> take(1)
|
||||||
|> deliverOnMainQueue
|
|> deliverOnMainQueue
|
||||||
@@ -227,8 +231,12 @@ public func deleteAccountOptionsController(context: AccountContext, navigationCo
|
|||||||
}
|
}
|
||||||
})
|
})
|
||||||
}, setupPrivacy: {
|
}, setupPrivacy: {
|
||||||
|
addAppLogEvent(postbox: context.account.postbox, type: "deactivate.options_privacy_tap")
|
||||||
|
|
||||||
replaceTopControllerImpl?(makePrivacyAndSecurityController(context: context), false)
|
replaceTopControllerImpl?(makePrivacyAndSecurityController(context: context), false)
|
||||||
}, setupTwoStepAuth: {
|
}, setupTwoStepAuth: {
|
||||||
|
addAppLogEvent(postbox: context.account.postbox, type: "deactivate.options_2fa_tap")
|
||||||
|
|
||||||
if let data = twoStepAuthData {
|
if let data = twoStepAuthData {
|
||||||
switch data {
|
switch data {
|
||||||
case .set:
|
case .set:
|
||||||
@@ -252,6 +260,8 @@ public func deleteAccountOptionsController(context: AccountContext, navigationCo
|
|||||||
let controller = twoStepVerificationUnlockSettingsController(context: context, mode: .access(intro: false, data: twoStepAuthData.flatMap({ Signal<TwoStepVerificationUnlockSettingsControllerData, NoError>.single(.access(configuration: $0)) })))
|
let controller = twoStepVerificationUnlockSettingsController(context: context, mode: .access(intro: false, data: twoStepAuthData.flatMap({ Signal<TwoStepVerificationUnlockSettingsControllerData, NoError>.single(.access(configuration: $0)) })))
|
||||||
replaceTopControllerImpl?(controller, false)
|
replaceTopControllerImpl?(controller, false)
|
||||||
}, setPasscode: {
|
}, setPasscode: {
|
||||||
|
addAppLogEvent(postbox: context.account.postbox, type: "deactivate.options_passcode_tap")
|
||||||
|
|
||||||
let _ = passcodeOptionsAccessController(context: context, pushController: { controller in
|
let _ = passcodeOptionsAccessController(context: context, pushController: { controller in
|
||||||
replaceTopControllerImpl?(controller, false)
|
replaceTopControllerImpl?(controller, false)
|
||||||
}, completion: { _ in
|
}, completion: { _ in
|
||||||
@@ -263,11 +273,17 @@ public func deleteAccountOptionsController(context: AccountContext, navigationCo
|
|||||||
})
|
})
|
||||||
dismissImpl?()
|
dismissImpl?()
|
||||||
}, clearCache: {
|
}, clearCache: {
|
||||||
|
addAppLogEvent(postbox: context.account.postbox, type: "deactivate.options_clear_cache_tap")
|
||||||
|
|
||||||
pushControllerImpl?(storageUsageController(context: context))
|
pushControllerImpl?(storageUsageController(context: context))
|
||||||
dismissImpl?()
|
dismissImpl?()
|
||||||
}, clearSyncedContacts: {
|
}, clearSyncedContacts: {
|
||||||
|
addAppLogEvent(postbox: context.account.postbox, type: "deactivate.options_clear_contacts_tap")
|
||||||
|
|
||||||
replaceTopControllerImpl?(dataPrivacyController(context: context), false)
|
replaceTopControllerImpl?(dataPrivacyController(context: context), false)
|
||||||
}, deleteChats: {
|
}, deleteChats: {
|
||||||
|
addAppLogEvent(postbox: context.account.postbox, type: "deactivate.options_delete_chats_tap")
|
||||||
|
|
||||||
let presentationData = context.sharedContext.currentPresentationData.with { $0 }
|
let presentationData = context.sharedContext.currentPresentationData.with { $0 }
|
||||||
|
|
||||||
var faqUrl = presentationData.strings.DeleteAccount_DeleteMessagesURL
|
var faqUrl = presentationData.strings.DeleteAccount_DeleteMessagesURL
|
||||||
@@ -298,6 +314,8 @@ public func deleteAccountOptionsController(context: AccountContext, navigationCo
|
|||||||
|
|
||||||
openFaq(resolvedUrlPromise)
|
openFaq(resolvedUrlPromise)
|
||||||
}, contactSupport: { [weak navigationController] in
|
}, contactSupport: { [weak navigationController] in
|
||||||
|
addAppLogEvent(postbox: context.account.postbox, type: "deactivate.options_support_tap")
|
||||||
|
|
||||||
let presentationData = context.sharedContext.currentPresentationData.with { $0 }
|
let presentationData = context.sharedContext.currentPresentationData.with { $0 }
|
||||||
|
|
||||||
let supportPeer = Promise<PeerId?>()
|
let supportPeer = Promise<PeerId?>()
|
||||||
@@ -329,7 +347,7 @@ public func deleteAccountOptionsController(context: AccountContext, navigationCo
|
|||||||
})
|
})
|
||||||
}
|
}
|
||||||
|
|
||||||
presentControllerImpl?(textAlertController(context: context, title: nil, text: presentationData.strings.Settings_FAQ_Intro, actions: [
|
let alertController = textAlertController(context: context, title: nil, text: presentationData.strings.Settings_FAQ_Intro, actions: [
|
||||||
TextAlertAction(type: .genericAction, title: presentationData.strings.Settings_FAQ_Button, action: {
|
TextAlertAction(type: .genericAction, title: presentationData.strings.Settings_FAQ_Button, action: {
|
||||||
openFaq(resolvedUrlPromise)
|
openFaq(resolvedUrlPromise)
|
||||||
dismissImpl?()
|
dismissImpl?()
|
||||||
@@ -344,7 +362,11 @@ public func deleteAccountOptionsController(context: AccountContext, navigationCo
|
|||||||
}
|
}
|
||||||
}))
|
}))
|
||||||
})
|
})
|
||||||
]), nil)
|
])
|
||||||
|
alertController.dismissed = {
|
||||||
|
addAppLogEvent(postbox: context.account.postbox, type: "deactivate.options_support_cancel")
|
||||||
|
}
|
||||||
|
presentControllerImpl?(alertController, nil)
|
||||||
}, deleteAccount: {
|
}, deleteAccount: {
|
||||||
let controller = deleteAccountDataController(context: context, mode: .peers, twoStepAuthData: twoStepAuthData)
|
let controller = deleteAccountDataController(context: context, mode: .peers, twoStepAuthData: twoStepAuthData)
|
||||||
replaceTopControllerImpl?(controller, true)
|
replaceTopControllerImpl?(controller, true)
|
||||||
@@ -411,6 +433,8 @@ public func deleteAccountOptionsController(context: AccountContext, navigationCo
|
|||||||
dismissImpl = { [weak controller] in
|
dismissImpl = { [weak controller] in
|
||||||
let _ = controller?.dismiss()
|
let _ = controller?.dismiss()
|
||||||
}
|
}
|
||||||
|
|
||||||
|
addAppLogEvent(postbox: context.account.postbox, type: "deactivate.options_show")
|
||||||
|
|
||||||
return controller
|
return controller
|
||||||
}
|
}
|
||||||
|
|||||||
@@ -201,15 +201,7 @@ class DeleteAccountPeersItemNode: ListViewItemNode, ItemListItemNode {
|
|||||||
}
|
}
|
||||||
|
|
||||||
func asyncLayout() -> (_ item: DeleteAccountPeersItem, _ params: ListViewItemLayoutParams, _ neighbors: ItemListNeighbors) -> (ListViewItemNodeLayout, () -> Void) {
|
func asyncLayout() -> (_ item: DeleteAccountPeersItem, _ params: ListViewItemLayoutParams, _ neighbors: ItemListNeighbors) -> (ListViewItemNodeLayout, () -> Void) {
|
||||||
let currentItem = self.item
|
return { item, params, neighbors in
|
||||||
|
|
||||||
return { item, params, neighbors in
|
|
||||||
var themeUpdated = false
|
|
||||||
if currentItem?.theme !== item.theme {
|
|
||||||
themeUpdated = true
|
|
||||||
}
|
|
||||||
print(themeUpdated)
|
|
||||||
|
|
||||||
let contentSize: CGSize
|
let contentSize: CGSize
|
||||||
var insets: UIEdgeInsets
|
var insets: UIEdgeInsets
|
||||||
let separatorHeight = UIScreenPixel
|
let separatorHeight = UIScreenPixel
|
||||||
|
|||||||
@@ -424,7 +424,7 @@ public func themeSettingsController(context: AccountContext, focusOnItemTag: The
|
|||||||
}
|
}
|
||||||
|
|
||||||
let premiumConfiguration = PremiumConfiguration.with(appConfiguration: context.currentAppConfiguration.with { $0 })
|
let premiumConfiguration = PremiumConfiguration.with(appConfiguration: context.currentAppConfiguration.with { $0 })
|
||||||
if premiumConfiguration.isPremiumDisabled {
|
if premiumConfiguration.isPremiumDisabled || context.account.testingEnvironment {
|
||||||
appIcons = appIcons.filter { !$0.isPremium }
|
appIcons = appIcons.filter { !$0.isPremium }
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|||||||
Reference in New Issue
Block a user