mirror of
https://github.com/Swiftgram/Telegram-iOS.git
synced 2025-12-23 06:35:51 +00:00
Autoarchive suggestion
This commit is contained in:
@@ -129,6 +129,10 @@ public class ChatListControllerImpl: TelegramBaseController, ChatListController,
|
||||
private var suggestLocalizationDisposable = MetaDisposable()
|
||||
private var didSuggestLocalization = false
|
||||
|
||||
private let suggestAutoarchiveDisposable = MetaDisposable()
|
||||
private let dismissAutoarchiveDisposable = MetaDisposable()
|
||||
private var didSuggestAutoarchive = false
|
||||
|
||||
private var presentationData: PresentationData
|
||||
private let presentationDataValue = Promise<PresentationData>()
|
||||
private var presentationDataDisposable: Disposable?
|
||||
@@ -478,6 +482,8 @@ public class ChatListControllerImpl: TelegramBaseController, ChatListController,
|
||||
self.badgeIconDisposable?.dispose()
|
||||
self.passcodeLockTooltipDisposable.dispose()
|
||||
self.suggestLocalizationDisposable.dispose()
|
||||
self.suggestAutoarchiveDisposable.dispose()
|
||||
self.dismissAutoarchiveDisposable.dispose()
|
||||
self.presentationDataDisposable?.dispose()
|
||||
self.stateDisposable.dispose()
|
||||
self.filterDisposable.dispose()
|
||||
@@ -1150,6 +1156,35 @@ public class ChatListControllerImpl: TelegramBaseController, ChatListController,
|
||||
_ = markSuggestedLocalizationAsSeenInteractively(postbox: strongSelf.context.account.postbox, languageCode: suggestedLocalization.languageCode).start()
|
||||
}
|
||||
}))
|
||||
|
||||
self.suggestAutoarchiveDisposable.set((getServerProvidedSuggestions(postbox: self.context.account.postbox)
|
||||
|> deliverOnMainQueue).start(next: { [weak self] values in
|
||||
guard let strongSelf = self else {
|
||||
return
|
||||
}
|
||||
if strongSelf.didSuggestAutoarchive {
|
||||
return
|
||||
}
|
||||
if !values.contains(.autoarchivePopular) {
|
||||
return
|
||||
}
|
||||
strongSelf.didSuggestAutoarchive = true
|
||||
strongSelf.present(standardTextAlertController(theme: AlertControllerTheme(presentationData: strongSelf.presentationData), title: strongSelf.presentationData.strings.ChatList_AutoarchiveSuggestion_Title, text: strongSelf.presentationData.strings.ChatList_AutoarchiveSuggestion_Text, actions: [
|
||||
TextAlertAction(type: .genericAction, title: strongSelf.presentationData.strings.Common_Cancel, action: {
|
||||
guard let strongSelf = self else {
|
||||
return
|
||||
}
|
||||
strongSelf.dismissAutoarchiveDisposable.set(dismissServerProvidedSuggestion(account: strongSelf.context.account, suggestion: .autoarchivePopular).start())
|
||||
}),
|
||||
TextAlertAction(type: .defaultAction, title: strongSelf.presentationData.strings.ChatList_AutoarchiveSuggestion_OpenSettings, action: {
|
||||
guard let strongSelf = self else {
|
||||
return
|
||||
}
|
||||
strongSelf.dismissAutoarchiveDisposable.set(dismissServerProvidedSuggestion(account: strongSelf.context.account, suggestion: .autoarchivePopular).start())
|
||||
strongSelf.push(strongSelf.context.sharedContext.makePrivacyAndSecurityController(context: strongSelf.context))
|
||||
})
|
||||
], actionLayout: .vertical, parseMarkdown: true), in: .window(.root))
|
||||
}))
|
||||
}
|
||||
|
||||
self.chatListDisplayNode.containerNode.addedVisibleChatsWithPeerIds = { [weak self] peerIds in
|
||||
|
||||
Reference in New Issue
Block a user