mirror of
https://gitlab.opencode.de/bwi/bundesmessenger/clients/bundesmessenger-ios.git
synced 2026-04-17 23:18:27 +02:00
Feature/7555 migration part 3
This commit is contained in:
committed by
SDE GitLab
parent
4515ab49e4
commit
585f4a852d
@@ -9,18 +9,20 @@ import Foundation
|
||||
import KeychainAccess
|
||||
|
||||
/// Extension on Keychain to get/set booleans
|
||||
#if !S_BUM_APP
|
||||
extension Keychain {
|
||||
|
||||
public func set(_ value: Bool, key: String, ignoringAttributeSynchronizable: Bool = true) throws {
|
||||
try set(value.description, key: key, ignoringAttributeSynchronizable: ignoringAttributeSynchronizable)
|
||||
}
|
||||
|
||||
public func getBool(_ key: String, ignoringAttributeSynchronizable: Bool = true) throws -> Bool? {
|
||||
guard let value = try getString(key, ignoringAttributeSynchronizable: ignoringAttributeSynchronizable) else {
|
||||
return nil
|
||||
}
|
||||
guard value == true.description || value == false.description else { return nil }
|
||||
return value == true.description
|
||||
}
|
||||
|
||||
}
|
||||
|
||||
public func set(_ value: Bool, key: String, ignoringAttributeSynchronizable: Bool = true) throws {
|
||||
try set(value.description, key: key, ignoringAttributeSynchronizable: ignoringAttributeSynchronizable)
|
||||
}
|
||||
|
||||
public func getBool(_ key: String, ignoringAttributeSynchronizable: Bool = true) throws -> Bool? {
|
||||
guard let value = try getString(key, ignoringAttributeSynchronizable: ignoringAttributeSynchronizable) else {
|
||||
return nil
|
||||
}
|
||||
guard value == true.description || value == false.description else { return nil }
|
||||
return value == true.description
|
||||
}
|
||||
|
||||
}
|
||||
#endif
|
||||
|
||||
Reference in New Issue
Block a user