mirror of
https://github.com/yattee/yattee.git
synced 2026-10-30 16:37:17 +00:00
Use production CloudKit environment for Xcode builds
Development-signed builds now opt into the Production CloudKit environment via com.apple.developer.icloud-container-environment, driven by a CLOUDKIT_ENV build setting. A new Debug-CKDev configuration and "Yattee (CloudKit Dev)" scheme switch to the Development environment for schema work. The DEV badge and banner in iCloud settings now reflect the actual environment (YatteeCloudKitEnvironment Info.plist key) instead of #if DEBUG, and the sync engine logs the environment at startup.
This commit is contained in:
@@ -12,6 +12,17 @@ enum AppIdentifiers {
|
||||
"iCloud.\(bundleIdentifier)"
|
||||
}
|
||||
|
||||
/// CloudKit environment this build is signed for ("Development" or "Production"),
|
||||
/// from the `CLOUDKIT_ENV` build setting. Debug builds use Production unless
|
||||
/// built with the Debug-CKDev configuration ("Yattee (CloudKit Dev)" scheme).
|
||||
static var iCloudEnvironment: String {
|
||||
Bundle.main.object(forInfoDictionaryKey: "YatteeCloudKitEnvironment") as? String ?? "Production"
|
||||
}
|
||||
|
||||
static var isCloudKitDevelopmentEnvironment: Bool {
|
||||
iCloudEnvironment == "Development"
|
||||
}
|
||||
|
||||
// MARK: - Background Tasks
|
||||
|
||||
static var backgroundFeedRefresh: String {
|
||||
|
||||
@@ -37,6 +37,8 @@
|
||||
<array>
|
||||
<string>stream.yattee.app.activity</string>
|
||||
</array>
|
||||
<key>YatteeCloudKitEnvironment</key>
|
||||
<string>$(CLOUDKIT_ENV)</string>
|
||||
<key>UIBackgroundModes</key>
|
||||
<array>
|
||||
<string>audio</string>
|
||||
|
||||
@@ -46,6 +46,8 @@
|
||||
<array>
|
||||
<string>stream.yattee.app.activity</string>
|
||||
</array>
|
||||
<key>YatteeCloudKitEnvironment</key>
|
||||
<string>$(CLOUDKIT_ENV)</string>
|
||||
<key>UIBackgroundModes</key>
|
||||
<array>
|
||||
<string>audio</string>
|
||||
|
||||
@@ -13673,7 +13673,6 @@
|
||||
}
|
||||
},
|
||||
"settings.icloud.dev.badge" : {
|
||||
"extractionState" : "stale",
|
||||
"localizations" : {
|
||||
"en" : {
|
||||
"stringUnit" : {
|
||||
@@ -13684,7 +13683,6 @@
|
||||
}
|
||||
},
|
||||
"settings.icloud.dev.footer" : {
|
||||
"extractionState" : "stale",
|
||||
"localizations" : {
|
||||
"en" : {
|
||||
"stringUnit" : {
|
||||
@@ -13695,7 +13693,6 @@
|
||||
}
|
||||
},
|
||||
"settings.icloud.dev.title" : {
|
||||
"extractionState" : "stale",
|
||||
"localizations" : {
|
||||
"en" : {
|
||||
"stringUnit" : {
|
||||
|
||||
@@ -311,6 +311,7 @@ final class CloudKitSyncEngine: @unchecked Sendable {
|
||||
self.container = container
|
||||
self.database = database
|
||||
self.zoneManager = CloudKitZoneManager(database: database)
|
||||
LoggingService.shared.logCloudKit("CloudKit environment: \(AppIdentifiers.iCloudEnvironment)")
|
||||
} else {
|
||||
LoggingService.shared.logCloudKit("iCloud container entitlement missing (re-signed build) - CloudKit sync unavailable")
|
||||
self.container = nil
|
||||
|
||||
@@ -167,15 +167,15 @@ struct SettingsView: View {
|
||||
} label: {
|
||||
HStack {
|
||||
Label(String(localized: "settings.icloud.title"), systemImage: "icloud")
|
||||
#if DEBUG
|
||||
Spacer()
|
||||
Text(String(localized: "settings.icloud.dev.badge"))
|
||||
.font(.caption2.bold())
|
||||
.foregroundStyle(.white)
|
||||
.padding(.horizontal, 6)
|
||||
.padding(.vertical, 2)
|
||||
.background(.orange, in: Capsule())
|
||||
#endif
|
||||
if AppIdentifiers.isCloudKitDevelopmentEnvironment {
|
||||
Spacer()
|
||||
Text(String(localized: "settings.icloud.dev.badge"))
|
||||
.font(.caption2.bold())
|
||||
.foregroundStyle(.white)
|
||||
.padding(.horizontal, 6)
|
||||
.padding(.vertical, 2)
|
||||
.background(.orange, in: Capsule())
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
@@ -287,15 +287,15 @@ struct SettingsView: View {
|
||||
} label: {
|
||||
HStack {
|
||||
Label(String(localized: "settings.icloud.title"), systemImage: "icloud")
|
||||
#if DEBUG
|
||||
Spacer()
|
||||
Text(String(localized: "settings.icloud.dev.badge"))
|
||||
.font(.caption2.bold())
|
||||
.foregroundStyle(.white)
|
||||
.padding(.horizontal, 6)
|
||||
.padding(.vertical, 2)
|
||||
.background(.orange, in: Capsule())
|
||||
#endif
|
||||
if AppIdentifiers.isCloudKitDevelopmentEnvironment {
|
||||
Spacer()
|
||||
Text(String(localized: "settings.icloud.dev.badge"))
|
||||
.font(.caption2.bold())
|
||||
.foregroundStyle(.white)
|
||||
.padding(.horizontal, 6)
|
||||
.padding(.vertical, 2)
|
||||
.background(.orange, in: Capsule())
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
|
||||
@@ -50,13 +50,13 @@ struct iCloudSettingsView: View {
|
||||
|
||||
var body: some View {
|
||||
SettingsFormContainer {
|
||||
#if DEBUG
|
||||
SettingsFormSection(footer: "settings.icloud.dev.footer") {
|
||||
Label(String(localized: "settings.icloud.dev.title"), systemImage: "hammer.fill")
|
||||
.foregroundStyle(.orange)
|
||||
.font(.subheadline)
|
||||
if AppIdentifiers.isCloudKitDevelopmentEnvironment {
|
||||
SettingsFormSection(footer: "settings.icloud.dev.footer") {
|
||||
Label(String(localized: "settings.icloud.dev.title"), systemImage: "hammer.fill")
|
||||
.foregroundStyle(.orange)
|
||||
.font(.subheadline)
|
||||
}
|
||||
}
|
||||
#endif
|
||||
|
||||
if cloudKitSync?.isCloudKitAvailable == false {
|
||||
SettingsFormSection(footer: "settings.icloud.unavailable.footer") {
|
||||
|
||||
@@ -4,6 +4,8 @@
|
||||
<dict>
|
||||
<key>com.apple.developer.aps-environment</key>
|
||||
<string>production</string>
|
||||
<key>com.apple.developer.icloud-container-environment</key>
|
||||
<string>$(CLOUDKIT_ENV)</string>
|
||||
<key>com.apple.developer.icloud-container-identifiers</key>
|
||||
<array>
|
||||
<string>iCloud.$(CFBundleIdentifier)</string>
|
||||
|
||||
@@ -4,6 +4,8 @@
|
||||
<dict>
|
||||
<key>aps-environment</key>
|
||||
<string>development</string>
|
||||
<key>com.apple.developer.icloud-container-environment</key>
|
||||
<string>$(CLOUDKIT_ENV)</string>
|
||||
<key>com.apple.developer.icloud-container-identifiers</key>
|
||||
<array>
|
||||
<string>iCloud.$(CFBundleIdentifier)</string>
|
||||
|
||||
Reference in New Issue
Block a user