mirror of
https://github.com/TelegramMessenger/Telegram-iOS.git
synced 2026-07-06 03:33:41 +02:00
Conference users from blockchain
This commit is contained in:
parent
7593cc2724
commit
4a97994bff
3 changed files with 105 additions and 27 deletions
|
|
@ -4,41 +4,30 @@ import SwiftSignalKit
|
|||
|
||||
public struct CallListSettings: Codable, Equatable {
|
||||
public var _showTab: Bool?
|
||||
public var defaultShowTab: Bool?
|
||||
|
||||
public static var defaultSettings: CallListSettings {
|
||||
return CallListSettings(showTab: false)
|
||||
return CallListSettings(showTab: nil)
|
||||
}
|
||||
|
||||
public var showTab: Bool {
|
||||
get {
|
||||
if let value = self._showTab {
|
||||
return value
|
||||
} else if let defaultValue = self.defaultShowTab {
|
||||
return defaultValue
|
||||
} else {
|
||||
return CallListSettings.defaultSettings.showTab
|
||||
return true
|
||||
}
|
||||
} set {
|
||||
self._showTab = newValue
|
||||
}
|
||||
}
|
||||
|
||||
public init(showTab: Bool) {
|
||||
public init(showTab: Bool?) {
|
||||
self._showTab = showTab
|
||||
}
|
||||
|
||||
public init(showTab: Bool?, defaultShowTab: Bool?) {
|
||||
self._showTab = showTab
|
||||
self.defaultShowTab = defaultShowTab
|
||||
}
|
||||
|
||||
public init(from decoder: Decoder) throws {
|
||||
let container = try decoder.container(keyedBy: StringCodingKey.self)
|
||||
|
||||
if let alternativeDefaultValue = try container.decodeIfPresent(Int32.self, forKey: "defaultShowTab") {
|
||||
self.defaultShowTab = alternativeDefaultValue != 0
|
||||
}
|
||||
if let value = try container.decodeIfPresent(Int32.self, forKey: "showTab") {
|
||||
self._showTab = value != 0
|
||||
}
|
||||
|
|
@ -47,11 +36,6 @@ public struct CallListSettings: Codable, Equatable {
|
|||
public func encode(to encoder: Encoder) throws {
|
||||
var container = encoder.container(keyedBy: StringCodingKey.self)
|
||||
|
||||
if let defaultShowTab = self.defaultShowTab {
|
||||
try container.encode((defaultShowTab ? 1 : 0) as Int32, forKey: "defaultShowTab")
|
||||
} else {
|
||||
try container.encodeNil(forKey: "defaultShowTab")
|
||||
}
|
||||
if let showTab = self._showTab {
|
||||
try container.encode((showTab ? 1 : 0) as Int32, forKey: "showTab")
|
||||
} else {
|
||||
|
|
@ -60,11 +44,11 @@ public struct CallListSettings: Codable, Equatable {
|
|||
}
|
||||
|
||||
public static func ==(lhs: CallListSettings, rhs: CallListSettings) -> Bool {
|
||||
return lhs._showTab == rhs._showTab && lhs.defaultShowTab == rhs.defaultShowTab
|
||||
return lhs._showTab == rhs._showTab
|
||||
}
|
||||
|
||||
public func withUpdatedShowTab(_ showTab: Bool) -> CallListSettings {
|
||||
return CallListSettings(showTab: showTab, defaultShowTab: self.defaultShowTab)
|
||||
return CallListSettings(showTab: showTab)
|
||||
}
|
||||
}
|
||||
|
||||
|
|
|
|||
Loading…
Add table
Add a link
Reference in a new issue