mirror of
https://github.com/Swiftgram/Telegram-iOS.git
synced 2025-08-30 17:31:58 +00:00
Merge branch 'master' of https://gitlab.com/peter-iakovlev/telegramcore
This commit is contained in:
commit
d9e87e686f
@ -1221,10 +1221,14 @@ public class Account {
|
||||
|
||||
public func resetStateManagement() {
|
||||
self.stateManager.reset()
|
||||
self.contactSyncManager.beginSync(importableContacts: self.importableContacts.get())
|
||||
self.restartContactManagement()
|
||||
self.managedStickerPacksDisposable.set(manageStickerPacks(network: self.network, postbox: self.postbox).start())
|
||||
}
|
||||
|
||||
public func restartContactManagement() {
|
||||
self.contactSyncManager.beginSync(importableContacts: self.importableContacts.get())
|
||||
}
|
||||
|
||||
public func peerInputActivities(peerId: PeerId) -> Signal<[(PeerId, PeerInputActivity)], NoError> {
|
||||
return self.peerInputActivityManager.activities(peerId: peerId)
|
||||
|> map { activities in
|
||||
|
@ -167,17 +167,31 @@ public func deleteContactPeerInteractively(account: Account, peerId: PeerId) ->
|
||||
|> switchToLatest
|
||||
}
|
||||
|
||||
public func deleteAllContacts(postbox: Postbox, network: Network) -> Signal<Void, NoError> {
|
||||
return postbox.transaction { transaction -> [Api.InputUser] in
|
||||
public func deleteAllContacts(account: Account) -> Signal<Never, NoError> {
|
||||
return account.postbox.transaction { transaction -> [Api.InputUser] in
|
||||
return transaction.getContactPeerIds().compactMap(transaction.getPeer).compactMap({ apiInputUser($0) }).compactMap({ $0 })
|
||||
}
|
||||
|> mapToSignal { users -> Signal<Void, NoError> in
|
||||
return network.request(Api.functions.contacts.deleteContacts(id: users))
|
||||
|> mapToSignal { users -> Signal<Never, NoError> in
|
||||
let deleteContacts = account.network.request(Api.functions.contacts.deleteContacts(id: users))
|
||||
|> `catch` { _ -> Signal<Api.Bool, NoError> in
|
||||
return .single(.boolFalse)
|
||||
}
|
||||
|> mapToSignal { _ -> Signal<Void, NoError> in
|
||||
return .complete()
|
||||
let deleteImported = account.network.request(Api.functions.contacts.resetSaved())
|
||||
|> `catch` { _ -> Signal<Api.Bool, NoError> in
|
||||
return .single(.boolFalse)
|
||||
}
|
||||
return combineLatest(deleteContacts, deleteImported)
|
||||
|> mapToSignal { _ -> Signal<Never, NoError> in
|
||||
return account.postbox.transaction { transaction -> Void in
|
||||
transaction.replaceContactPeerIds(Set())
|
||||
transaction.clearDeviceContactImportInfoIdentifiers()
|
||||
}
|
||||
|> mapToSignal { _ -> Signal<Void, NoError> in
|
||||
account.restartContactManagement()
|
||||
|
||||
return .complete()
|
||||
}
|
||||
|> ignoreValues
|
||||
}
|
||||
}
|
||||
}
|
||||
|
@ -11,7 +11,7 @@ public final class NotificationExceptionsList: Equatable {
|
||||
public let peers: [PeerId: Peer]
|
||||
public let settings: [PeerId: TelegramPeerNotificationSettings]
|
||||
|
||||
init(peers: [PeerId: Peer], settings: [PeerId: TelegramPeerNotificationSettings]) {
|
||||
public init(peers: [PeerId: Peer], settings: [PeerId: TelegramPeerNotificationSettings]) {
|
||||
self.peers = peers
|
||||
self.settings = settings
|
||||
}
|
||||
|
Loading…
x
Reference in New Issue
Block a user