mirror of
https://github.com/Swiftgram/Telegram-iOS.git
synced 2025-10-09 03:20:48 +00:00
- prem required error for secret chat
- better struct for privacy settings
This commit is contained in:
parent
6ceba731ac
commit
08e2e0b123
@ -107,21 +107,21 @@ public enum SelectivePrivacySettings: Equatable {
|
|||||||
}
|
}
|
||||||
|
|
||||||
public struct AccountPrivacySettings: Equatable {
|
public struct AccountPrivacySettings: Equatable {
|
||||||
public let presence: SelectivePrivacySettings
|
public var presence: SelectivePrivacySettings
|
||||||
public let groupInvitations: SelectivePrivacySettings
|
public var groupInvitations: SelectivePrivacySettings
|
||||||
public let voiceCalls: SelectivePrivacySettings
|
public var voiceCalls: SelectivePrivacySettings
|
||||||
public let voiceCallsP2P: SelectivePrivacySettings
|
public var voiceCallsP2P: SelectivePrivacySettings
|
||||||
public let profilePhoto: SelectivePrivacySettings
|
public var profilePhoto: SelectivePrivacySettings
|
||||||
public let forwards: SelectivePrivacySettings
|
public var forwards: SelectivePrivacySettings
|
||||||
public let phoneNumber: SelectivePrivacySettings
|
public var phoneNumber: SelectivePrivacySettings
|
||||||
public let phoneDiscoveryEnabled: Bool
|
public var phoneDiscoveryEnabled: Bool
|
||||||
public let voiceMessages: SelectivePrivacySettings
|
public var voiceMessages: SelectivePrivacySettings
|
||||||
public let bio: SelectivePrivacySettings
|
public var bio: SelectivePrivacySettings
|
||||||
public let birthday: SelectivePrivacySettings
|
public var birthday: SelectivePrivacySettings
|
||||||
|
|
||||||
public let globalSettings: GlobalPrivacySettings
|
public var globalSettings: GlobalPrivacySettings
|
||||||
public let accountRemovalTimeout: Int32
|
public var accountRemovalTimeout: Int32
|
||||||
public let messageAutoremoveTimeout: Int32?
|
public var messageAutoremoveTimeout: Int32?
|
||||||
|
|
||||||
public init(presence: SelectivePrivacySettings, groupInvitations: SelectivePrivacySettings, voiceCalls: SelectivePrivacySettings, voiceCallsP2P: SelectivePrivacySettings, profilePhoto: SelectivePrivacySettings, forwards: SelectivePrivacySettings, phoneNumber: SelectivePrivacySettings, phoneDiscoveryEnabled: Bool, voiceMessages: SelectivePrivacySettings, bio: SelectivePrivacySettings, birthday: SelectivePrivacySettings, globalSettings: GlobalPrivacySettings, accountRemovalTimeout: Int32, messageAutoremoveTimeout: Int32?) {
|
public init(presence: SelectivePrivacySettings, groupInvitations: SelectivePrivacySettings, voiceCalls: SelectivePrivacySettings, voiceCallsP2P: SelectivePrivacySettings, profilePhoto: SelectivePrivacySettings, forwards: SelectivePrivacySettings, phoneNumber: SelectivePrivacySettings, phoneDiscoveryEnabled: Bool, voiceMessages: SelectivePrivacySettings, bio: SelectivePrivacySettings, birthday: SelectivePrivacySettings, globalSettings: GlobalPrivacySettings, accountRemovalTimeout: Int32, messageAutoremoveTimeout: Int32?) {
|
||||||
self.presence = presence
|
self.presence = presence
|
||||||
|
@ -7,6 +7,7 @@ import MtProtoKit
|
|||||||
public enum CreateSecretChatError {
|
public enum CreateSecretChatError {
|
||||||
case generic
|
case generic
|
||||||
case limitExceeded
|
case limitExceeded
|
||||||
|
case premiumRequired(EnginePeer)
|
||||||
}
|
}
|
||||||
|
|
||||||
func _internal_createSecretChat(account: Account, peerId: PeerId) -> Signal<PeerId, CreateSecretChatError> {
|
func _internal_createSecretChat(account: Account, peerId: PeerId) -> Signal<PeerId, CreateSecretChatError> {
|
||||||
@ -34,6 +35,8 @@ func _internal_createSecretChat(account: Account, peerId: PeerId) -> Signal<Peer
|
|||||||
|> mapError { error -> CreateSecretChatError in
|
|> mapError { error -> CreateSecretChatError in
|
||||||
if error.errorDescription.hasPrefix("FLOOD_WAIT_") {
|
if error.errorDescription.hasPrefix("FLOOD_WAIT_") {
|
||||||
return .limitExceeded
|
return .limitExceeded
|
||||||
|
} else if error.errorDescription.hasPrefix("PRIVACY_PREMIUM_REQUIRED") {
|
||||||
|
return .premiumRequired(.init(peer))
|
||||||
} else {
|
} else {
|
||||||
return .generic
|
return .generic
|
||||||
}
|
}
|
||||||
|
Loading…
x
Reference in New Issue
Block a user