mirror of
https://github.com/Swiftgram/Telegram-iOS.git
synced 2025-08-31 09:52:04 +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() {
|
public func resetStateManagement() {
|
||||||
self.stateManager.reset()
|
self.stateManager.reset()
|
||||||
self.contactSyncManager.beginSync(importableContacts: self.importableContacts.get())
|
self.restartContactManagement()
|
||||||
self.managedStickerPacksDisposable.set(manageStickerPacks(network: self.network, postbox: self.postbox).start())
|
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> {
|
public func peerInputActivities(peerId: PeerId) -> Signal<[(PeerId, PeerInputActivity)], NoError> {
|
||||||
return self.peerInputActivityManager.activities(peerId: peerId)
|
return self.peerInputActivityManager.activities(peerId: peerId)
|
||||||
|> map { activities in
|
|> map { activities in
|
||||||
|
@ -167,18 +167,32 @@ public func deleteContactPeerInteractively(account: Account, peerId: PeerId) ->
|
|||||||
|> switchToLatest
|
|> switchToLatest
|
||||||
}
|
}
|
||||||
|
|
||||||
public func deleteAllContacts(postbox: Postbox, network: Network) -> Signal<Void, NoError> {
|
public func deleteAllContacts(account: Account) -> Signal<Never, NoError> {
|
||||||
return postbox.transaction { transaction -> [Api.InputUser] in
|
return account.postbox.transaction { transaction -> [Api.InputUser] in
|
||||||
return transaction.getContactPeerIds().compactMap(transaction.getPeer).compactMap({ apiInputUser($0) }).compactMap({ $0 })
|
return transaction.getContactPeerIds().compactMap(transaction.getPeer).compactMap({ apiInputUser($0) }).compactMap({ $0 })
|
||||||
}
|
}
|
||||||
|> mapToSignal { users -> Signal<Void, NoError> in
|
|> mapToSignal { users -> Signal<Never, NoError> in
|
||||||
return network.request(Api.functions.contacts.deleteContacts(id: users))
|
let deleteContacts = account.network.request(Api.functions.contacts.deleteContacts(id: users))
|
||||||
|> `catch` { _ -> Signal<Api.Bool, NoError> in
|
|> `catch` { _ -> Signal<Api.Bool, NoError> in
|
||||||
return .single(.boolFalse)
|
return .single(.boolFalse)
|
||||||
}
|
}
|
||||||
|
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
|
|> mapToSignal { _ -> Signal<Void, NoError> in
|
||||||
|
account.restartContactManagement()
|
||||||
|
|
||||||
return .complete()
|
return .complete()
|
||||||
}
|
}
|
||||||
|
|> ignoreValues
|
||||||
|
}
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
|
@ -11,7 +11,7 @@ public final class NotificationExceptionsList: Equatable {
|
|||||||
public let peers: [PeerId: Peer]
|
public let peers: [PeerId: Peer]
|
||||||
public let settings: [PeerId: TelegramPeerNotificationSettings]
|
public let settings: [PeerId: TelegramPeerNotificationSettings]
|
||||||
|
|
||||||
init(peers: [PeerId: Peer], settings: [PeerId: TelegramPeerNotificationSettings]) {
|
public init(peers: [PeerId: Peer], settings: [PeerId: TelegramPeerNotificationSettings]) {
|
||||||
self.peers = peers
|
self.peers = peers
|
||||||
self.settings = settings
|
self.settings = settings
|
||||||
}
|
}
|
||||||
|
Loading…
x
Reference in New Issue
Block a user