Avoid race and duplication conditions between local and remote notifications (#848)

* added timestamp control of the local notification

* improved the code, and implemented the solution, just needs some testing

* sdk bump

* UserPreference init with initialValue instead of defaultValue

* pr suggestions

* changelog

* notifications sliding sync view added
This commit is contained in:
Mauro
2023-05-03 16:28:07 +02:00
committed by GitHub
parent 60c2692a26
commit 95492d7e10
15 changed files with 251 additions and 108 deletions
@@ -75,6 +75,17 @@ extension UserPreference {
convenience init<R: RawRepresentable>(key: R, defaultValue: T, storageType: StorageType) where R.RawValue == String {
self.init(key: key.rawValue, defaultValue: defaultValue, storageType: storageType)
}
/// Convenience initializer that also immediatelly stores the provided initialValue.
///
/// - Parameters:
/// - key: the raw representable key used to store the value, needs conform also to String
/// - initialValue: the initial value that will be stored, the initialValue is also used as defaultValue
/// - storageType: the storage type where the wrappedValue will be stored.
convenience init<R: RawRepresentable>(key: R, initialValue: T, storageType: StorageType) where R.RawValue == String {
self.init(key: key, defaultValue: initialValue, storageType: storageType)
wrappedValue = initialValue
}
convenience init(key: String, storageType: StorageType) where T: ExpressibleByNilLiteral {
self.init(key: key, defaultValue: nil, storageType: storageType)