mirror of
https://github.com/Swiftgram/Telegram-iOS.git
synced 2025-12-23 22:55:00 +00:00
Various improvements
This commit is contained in:
@@ -6,10 +6,12 @@ import SwiftSignalKit
|
||||
public struct WebBrowserException: Codable, Equatable {
|
||||
public let domain: String
|
||||
public let title: String
|
||||
public let icon: TelegramMediaImage?
|
||||
|
||||
public init(domain: String, title: String) {
|
||||
public init(domain: String, title: String, icon: TelegramMediaImage?) {
|
||||
self.domain = domain
|
||||
self.title = title
|
||||
self.icon = icon
|
||||
}
|
||||
|
||||
public init(from decoder: Decoder) throws {
|
||||
@@ -17,6 +19,7 @@ public struct WebBrowserException: Codable, Equatable {
|
||||
|
||||
self.domain = try container.decode(String.self, forKey: "domain")
|
||||
self.title = try container.decode(String.self, forKey: "title")
|
||||
self.icon = try container.decodeIfPresent(TelegramMediaImage.self, forKey: "icon")
|
||||
}
|
||||
|
||||
public func encode(to encoder: Encoder) throws {
|
||||
@@ -24,6 +27,11 @@ public struct WebBrowserException: Codable, Equatable {
|
||||
|
||||
try container.encode(self.domain, forKey: "domain")
|
||||
try container.encode(self.title, forKey: "title")
|
||||
if let icon = self.icon {
|
||||
try container.encode(icon, forKey: "icon")
|
||||
} else {
|
||||
try container.encodeNil(forKey: "icon")
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
|
||||
Reference in New Issue
Block a user