From 10ca00038709bdbee9443f3b8733b7251b62aa3e Mon Sep 17 00:00:00 2001 From: Arkadiusz Fal Date: Tue, 14 Jul 2026 23:50:04 +0200 Subject: [PATCH] Fix conflict resolver field names for recent channels and playlists The recent-channel resolver copied avatarURLString/providerName and the recent-playlist resolver copied authorID/providerName - fields that do not exist in the records the mapper writes - while missing the real ones (thumbnailURLString, subscriberCount, isVerified, videoCount). As a result, when the local side won a conflict, those fields silently kept the older server values. Also drop the notificationsEnabled preservation in the subscription resolver: the subscription mapper never writes that field since notification preferences moved to their own record type. --- .../CloudKit/CloudKitConflictResolver.swift | 18 +++++------------- 1 file changed, 5 insertions(+), 13 deletions(-) diff --git a/Yattee/Services/CloudKit/CloudKitConflictResolver.swift b/Yattee/Services/CloudKit/CloudKitConflictResolver.swift index c428ba4d..3989eef3 100644 --- a/Yattee/Services/CloudKit/CloudKitConflictResolver.swift +++ b/Yattee/Services/CloudKit/CloudKitConflictResolver.swift @@ -16,7 +16,6 @@ actor CloudKitConflictResolver { /// /// Strategy: /// - Keep record with most recent `lastUpdatedAt` - /// - EXCEPT: always preserve local `notificationsEnabled` preference func resolveSubscriptionConflict( local: CKRecord, server: CKRecord @@ -39,13 +38,7 @@ actor CloudKitConflictResolver { resolved["lastUpdatedAt"] = local["lastUpdatedAt"] resolved["providerName"] = local["providerName"] } - - // But always preserve local notification preference - // (user's device-specific setting should not be overwritten by other devices) - if let localNotifications = local["notificationsEnabled"] { - resolved["notificationsEnabled"] = localNotifications - } - + return resolved } @@ -273,8 +266,9 @@ actor CloudKitConflictResolver { // If local is newer, copy its fields to server record if localVisited > serverVisited { resolved["name"] = local["name"] - resolved["avatarURLString"] = local["avatarURLString"] - resolved["providerName"] = local["providerName"] + resolved["thumbnailURLString"] = local["thumbnailURLString"] + resolved["subscriberCount"] = local["subscriberCount"] + resolved["isVerified"] = local["isVerified"] resolved["visitedAt"] = local["visitedAt"] } @@ -302,10 +296,8 @@ actor CloudKitConflictResolver { if localVisited > serverVisited { resolved["title"] = local["title"] resolved["authorName"] = local["authorName"] - resolved["authorID"] = local["authorID"] - resolved["thumbnailURLString"] = local["thumbnailURLString"] resolved["videoCount"] = local["videoCount"] - resolved["providerName"] = local["providerName"] + resolved["thumbnailURLString"] = local["thumbnailURLString"] resolved["visitedAt"] = local["visitedAt"] }