New issue
Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.
By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.
Already on GitHub? Sign in to your account
Settings Sync: Set Modified Date on settings import #1616
base: bjtitus/settings-sync/up-next-setting
Are you sure you want to change the base?
Settings Sync: Set Modified Date on settings import #1616
Conversation
# Conflicts: # podcasts/DataManager+Import.swift
This ensures it doesn't match the server value, which would end up overwriting it.
self.update(\.$autoPlayEnabled, value: UserDefaults.standard.bool(forKey: Constants.UserDefaults.autoplay)) | ||
self.update(\.$notifications, value: UserDefaults.standard.bool(forKey: Constants.UserDefaults.pushEnabled)) | ||
self.update(\.$appBadge, value: Int32(UserDefaults.standard.integer(forKey: Constants.UserDefaults.appBadge))) | ||
let date = Date(timeIntervalSince1970: 1) |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Maybe Date.distantPast
will be more clear here.
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
@SergioEstevao I don't think we can use that as per:
By defaulting to 1 second after, the setting is stored by the server. A default epoch date is effectively a "null" value and will not replace the default value.
This would probably result in the setting being discarded by the server.
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
So any reference date will be discarded is this what this means: A default epoch date
?
podcasts/DataManager+Import.swift
Outdated
@@ -5,37 +5,38 @@ extension DataManager { | |||
func importPodcastSettings() { | |||
let podcasts = allPodcasts(includeUnsubscribed: true) | |||
|
|||
let date = Date(timeIntervalSince1970: 1) |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Same as above: Date.distantPast
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Working good, just a small comment about the way the date is set.
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
@bjtitus this is really not working for me. I'm gonna send you a video in a DM.
self.update(\.$autoPlayEnabled, value: UserDefaults.standard.bool(forKey: Constants.UserDefaults.autoplay)) | ||
self.update(\.$notifications, value: UserDefaults.standard.bool(forKey: Constants.UserDefaults.pushEnabled)) | ||
self.update(\.$appBadge, value: Int32(UserDefaults.standard.integer(forKey: Constants.UserDefaults.appBadge))) | ||
let date = Date(timeIntervalSince1970: 1) |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Just double checking if this could be changed to 1 millisecond or should we adjust on Android to 1 second?
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
I'll get this updated today. I still need to double check the comparisons to make sure the precision is working.
podcasts/DataManager+Import.swift
Outdated
@@ -5,40 +5,42 @@ extension DataManager { | |||
func importPodcastSettings() { | |||
let podcasts = allPodcasts(includeUnsubscribed: true) | |||
|
|||
let date = Date(timeIntervalSince1970: 1) |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Same as #1616 (comment)
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
@bjtitus the Up Next setting is now persisting correctly, but I still have issues with the Settings under Appearance.
Set the Modified Date on all imported settings to 1 second after the epoch date.
To test
shouldEnableSyncedSettings
inFeatureFlag.swift
tofalse
newSettingsStorage
andsettingsSync
feature flagsshouldEnableSyncedSettings
inFeatureFlag.swift
back to its original implementation or set totrue
Checklist
CHANGELOG.md
if necessary.