File tree Expand file tree Collapse file tree 2 files changed +12
-1
lines changed
Server/Sources/PocketCastsServer/Public/Sync
Utils/Sources/PocketCastsUtils/Feature Flags Expand file tree Collapse file tree 2 files changed +12
-1
lines changed Original file line number Diff line number Diff line change @@ -132,7 +132,13 @@ class UpNextSyncTask: ApiBaseTask {
132132 // save the server last modified so we can send it back next time. For legacy compatibility this is stored as a string
133133 UserDefaults . standard. set ( " \( response. serverModified) " , forKey: ServerConstants . UserDefaults. upNextServerLastModified)
134134
135- clearSyncedData ( latestActionTime: latestActionTime)
135+ // For login syncs, clear all pending changes since we've applied server state
136+ // and any pending changes are stale. See: https://github.com/Automattic/pocket-casts-ios/issues/XXXX
137+ if SyncManager . syncReason == . login && FeatureFlag . clearPendingUpNextChangesOnLogin. enabled {
138+ clearSyncedData ( latestActionTime: Int64 . max)
139+ } else {
140+ clearSyncedData ( latestActionTime: latestActionTime)
141+ }
136142 } catch {
137143 FileLog . shared. addMessage ( " UpNextSyncTask: Failed to decode server data " )
138144 }
Original file line number Diff line number Diff line change @@ -286,6 +286,9 @@ public enum FeatureFlag: String, CaseIterable {
286286 /// Use WCSessionFileTransfer to send logs from watchOS to iPhone instead of sendMessage reply
287287 case watchLogFileTransfer
288288
289+ /// Clear all pending Up Next changes on login sync to prevent stale replace actions from being sent
290+ case clearPendingUpNextChangesOnLogin
291+
289292 public var enabled : Bool {
290293 if let overriddenValue = FeatureFlagOverrideStore ( ) . overriddenValue ( for: self ) {
291294 return overriddenValue
@@ -480,6 +483,8 @@ public enum FeatureFlag: String, CaseIterable {
480483 true
481484 case . watchLogFileTransfer:
482485 true
486+ case . clearPendingUpNextChangesOnLogin:
487+ false
483488 }
484489 }
485490
You can’t perform that action at this time.
0 commit comments