TF-2384 Handle NSE to get plain notification in iOS
Signed-off-by: dab246 <tdvu@linagora.com> (cherry picked from commit 364f32a14b9888f73a3a103b8b5e1bc9b31e148e)
This commit is contained in:
@@ -0,0 +1,39 @@
|
||||
import Foundation
|
||||
|
||||
struct KeychainSharingSession: Codable {
|
||||
let accountId: String
|
||||
let userName: String
|
||||
let authenticationType: AuthenticationType
|
||||
let apiUrl: String
|
||||
let emailState: String?
|
||||
let tokenOIDC: TokenOidc?
|
||||
let basicAuth: String?
|
||||
}
|
||||
|
||||
extension KeychainSharingSession {
|
||||
func updateEmailState(newState: String) -> KeychainSharingSession {
|
||||
return KeychainSharingSession(
|
||||
accountId: self.accountId,
|
||||
userName: self.userName,
|
||||
authenticationType: self.authenticationType,
|
||||
apiUrl: self.apiUrl,
|
||||
emailState: newState,
|
||||
tokenOIDC: self.tokenOIDC,
|
||||
basicAuth: self.basicAuth
|
||||
)
|
||||
}
|
||||
|
||||
func toData() -> Data? {
|
||||
if let encodedData = try? JSONEncoder().encode(self) {
|
||||
return encodedData
|
||||
}
|
||||
return nil
|
||||
}
|
||||
|
||||
func toJson() -> String? {
|
||||
if let data = toData(), let jsonString = String(data: data, encoding: .utf8) {
|
||||
return jsonString
|
||||
}
|
||||
return nil
|
||||
}
|
||||
}
|
||||
Reference in New Issue
Block a user