commit 01543f2188998257d2ee77953d667e73f4608c59
parent cabcf33f6024890acb1abf536f95067f9a9c4198
Author: Michael Camilleri <[email protected]>
Date: Thu, 2 Jul 2026 22:37:48 +0900
Adopt CKRecordNameZoneWideShare and inline the name-seed scope
Two small sync clean-ups with no behaviour change:
- ShareController's zone-wide share record name is now assigned from
CKRecordNameZoneWideShare rather than a hardcoded
`"cloudkit.zoneshare"` string, matching FriendController and
PlayerRoster, which already use the constant.
- seedOwnNameDecision only ever wrote at shared scope, so its scope
parameter is gone; the single enqueueNameDecision call now passes
DatabaseScope.shared.rawValue with a comment explaining why — the seed
always lands in the friend's inbox, a zone the friend owns.
Co-Authored-By: Claude Fable 5 <[email protected]>
Diffstat:
2 files changed, 6 insertions(+), 6 deletions(-)
diff --git a/Crossmate/Sync/FriendController.swift b/Crossmate/Sync/FriendController.swift
@@ -149,8 +149,7 @@ final class FriendController {
private func seedOwnNameDecision(
localAuthorID: String,
localDisplayName: String?,
- zoneID: CKRecordZone.ID,
- scope: Int16
+ zoneID: CKRecordZone.ID
) async {
let name = (localDisplayName ?? "")
.trimmingCharacters(in: .whitespacesAndNewlines)
@@ -160,7 +159,9 @@ final class FriendController {
name: name,
version: NameVersionStore.current(authorID: localAuthorID),
zoneID: zoneID,
- scope: scope
+ // The seed is only ever written into the friend's inbox (our
+ // outbox), a zone the friend owns.
+ scope: DatabaseScope.shared.rawValue
)
}
@@ -231,8 +232,7 @@ final class FriendController {
await seedOwnNameDecision(
localAuthorID: localAuthorID,
localDisplayName: localDisplayName,
- zoneID: outboxZoneID,
- scope: 1
+ zoneID: outboxZoneID
)
}
// Publish our per-pair invite encryption key into the outbox so the
diff --git a/Crossmate/Sync/ShareController.swift b/Crossmate/Sync/ShareController.swift
@@ -7,7 +7,7 @@ import Foundation
/// existing shares on re-present, and letting participants leave a shared game.
@MainActor
final class ShareController {
- private static let zoneWideShareRecordName = "cloudkit.zoneshare"
+ private static let zoneWideShareRecordName = CKRecordNameZoneWideShare
static let maximumPeoplePerPuzzle = 3
private static var maximumInviteesPerPuzzle: Int { maximumPeoplePerPuzzle - 1 }
private static let ticketPayloadField = "payload"