mirror of
https://github.com/Swiftgram/Telegram-iOS.git
synced 2026-01-07 21:44:59 +00:00
Temp
This commit is contained in:
@@ -60,7 +60,7 @@ public struct GlobalNotificationSettingsSet: PostboxCoding, Equatable {
|
||||
}
|
||||
}
|
||||
|
||||
public struct GlobalNotificationSettings: PreferencesEntry, Equatable {
|
||||
public struct GlobalNotificationSettings: PreferencesEntry, Equatable, PostboxGlobalNotificationSettings {
|
||||
public var toBeSynchronized: GlobalNotificationSettingsSet?
|
||||
public var remote: GlobalNotificationSettingsSet
|
||||
|
||||
@@ -74,6 +74,44 @@ public struct GlobalNotificationSettings: PreferencesEntry, Equatable {
|
||||
}
|
||||
}
|
||||
|
||||
public func defaultIncludePeer(peer: Peer) -> Bool {
|
||||
let settings = self.effective
|
||||
if peer is TelegramUser || peer is TelegramSecretChat {
|
||||
return settings.privateChats.enabled
|
||||
} else if peer is TelegramGroup {
|
||||
return settings.groupChats.enabled
|
||||
} else if let channel = peer as? TelegramChannel {
|
||||
switch channel.info {
|
||||
case .group:
|
||||
return settings.groupChats.enabled
|
||||
case .broadcast:
|
||||
return settings.channels.enabled
|
||||
}
|
||||
} else {
|
||||
return false
|
||||
}
|
||||
}
|
||||
|
||||
public func isEqualInDefaultPeerInclusion(other: PostboxGlobalNotificationSettings) -> Bool {
|
||||
guard let other = other as? GlobalNotificationSettings else {
|
||||
return false
|
||||
}
|
||||
let settings = self.effective
|
||||
let otherSettings = other.effective
|
||||
|
||||
if settings.privateChats.enabled != otherSettings.privateChats.enabled {
|
||||
return false
|
||||
}
|
||||
if settings.groupChats.enabled != otherSettings.groupChats.enabled {
|
||||
return false
|
||||
}
|
||||
if settings.channels.enabled != otherSettings.channels.enabled {
|
||||
return false
|
||||
}
|
||||
|
||||
return true
|
||||
}
|
||||
|
||||
public init(toBeSynchronized: GlobalNotificationSettingsSet?, remote: GlobalNotificationSettingsSet) {
|
||||
self.toBeSynchronized = toBeSynchronized
|
||||
self.remote = remote
|
||||
|
||||
@@ -46,7 +46,7 @@ public let telegramPostboxSeedConfiguration: SeedConfiguration = {
|
||||
assertionFailure()
|
||||
return .nonContact
|
||||
}
|
||||
}, additionalChatListIndexNamespace: Namespaces.Message.Cloud, messageNamespacesRequiringGroupStatsValidation: [Namespaces.Message.Cloud], defaultMessageNamespaceReadStates: [Namespaces.Message.Local: .idBased(maxIncomingReadId: 0, maxOutgoingReadId: 0, maxKnownId: 0, count: 0, markedUnread: false)], chatMessagesNamespaces: Set([Namespaces.Message.Cloud, Namespaces.Message.Local, Namespaces.Message.SecretIncoming]))
|
||||
}, additionalChatListIndexNamespace: Namespaces.Message.Cloud, messageNamespacesRequiringGroupStatsValidation: [Namespaces.Message.Cloud], defaultMessageNamespaceReadStates: [Namespaces.Message.Local: .idBased(maxIncomingReadId: 0, maxOutgoingReadId: 0, maxKnownId: 0, count: 0, markedUnread: false)], chatMessagesNamespaces: Set([Namespaces.Message.Cloud, Namespaces.Message.Local, Namespaces.Message.SecretIncoming]), globalNotificationSettingsPreferencesKey: PreferencesKeys.globalNotifications, defaultGlobalNotificationSettings: GlobalNotificationSettings.defaultSettings)
|
||||
}()
|
||||
|
||||
public func accountTransaction<T>(rootPath: String, id: AccountRecordId, encryptionParameters: ValueBoxEncryptionParameters, transaction: @escaping (Transaction) -> T) -> Signal<T, NoError> {
|
||||
|
||||
@@ -145,14 +145,14 @@ public final class TelegramPeerNotificationSettings: PeerNotificationSettings, E
|
||||
return TelegramPeerNotificationSettings(muteState: .unmuted, messageSound: .default, displayPreviews: .default)
|
||||
}
|
||||
|
||||
public var isRemovedFromTotalUnreadCount: Bool {
|
||||
public func isRemovedFromTotalUnreadCount(`default`: Bool) -> Bool {
|
||||
switch self.muteState {
|
||||
case .unmuted:
|
||||
return false
|
||||
case .muted:
|
||||
return true
|
||||
case .default:
|
||||
return false
|
||||
return `default`
|
||||
}
|
||||
}
|
||||
|
||||
|
||||
Reference in New Issue
Block a user