Do we have a way to use Cley with RxSwift?
rlam3 opened this issue · comments
Do we have a way to use Cley with RxSwift?
Though I haven't personally tested Cely + reactive framework in an app, I don't see why they wouldn't work together.
What type of issues are you running into?
@initFabian I'd like to get your opinion on how to add the following Expirable protocol so I can manage tokens.
https://github.com/AndrewSB/Expirable
This will enable us see which token expired or is expiring soon. So far following your example I don't know where I am able to enable the Expirable protocol
struct AuthUser: CelyUser {
enum Property: CelyProperty {
case username = "username"
case email = "email"
case access_token = "access_token"
case refresh_token = "refresh_token"
func securely() -> Bool {
switch self {
case .access_token, .refresh_token:
return true
default:
return false
}
}
func persisted() -> Bool {
switch self {
case .access_token, .refresh_token:
return true
default:
return false
}
}
func save(_ value: Any) {
Cely.save(value, forKey: rawValue, securely: securely(), persisted: persisted())
}
func get() -> Any? {
return Cely.get(key: rawValue)
}
}
}
// MARK: - Save/Get User Properties
extension AuthUser {
static func save(_ value: Any, as property: Property) {
property.save(value)
}
static func save(_ data: [Property : Any]) {
data.forEach { property, value in
property.save(value)
}
}
static func get(_ property: Property) -> Any? {
return property.get()
}
}
Hey @rlam3 can you make a separate issue for the Expirable
?
I really do like the idea, I feel this feature falls within the scope of Cely, it just will need to be implemented differently. Open up a new issue and we can discuss it there.