fix(release): disable updater for app store distribution

This commit is contained in:
h3p 2026-04-17 10:49:50 +02:00
parent 6f00a27504
commit 23a9114cfc
No known key found for this signature in database
3 changed files with 38 additions and 11 deletions

View file

@ -3,7 +3,7 @@
archiveVersion = 1;
classes = {
};
objectVersion = 90;
objectVersion = 100;
objects = {
/* Begin PBXBuildFile section */
@ -155,7 +155,7 @@
minimizedProjectReferenceProxies = 1;
packageReferences = (
);
preferredProjectObjectVersion = 90;
preferredProjectObjectVersion = 100;
productRefGroup = 98EAE6342E5F15E80050E579 /* Products */;
projectDirPath = "";
projectRoot = "";
@ -362,7 +362,7 @@
CODE_SIGNING_ALLOWED = YES;
CODE_SIGN_IDENTITY = "Apple Development";
CODE_SIGN_STYLE = Automatic;
CURRENT_PROJECT_VERSION = 598;
CURRENT_PROJECT_VERSION = 599;
DEAD_CODE_STRIPPING = YES;
DEVELOPMENT_TEAM = CS727NF72U;
ENABLE_APP_SANDBOX = YES;
@ -445,7 +445,7 @@
CODE_SIGNING_ALLOWED = YES;
CODE_SIGN_IDENTITY = "Apple Development";
CODE_SIGN_STYLE = Automatic;
CURRENT_PROJECT_VERSION = 598;
CURRENT_PROJECT_VERSION = 599;
DEAD_CODE_STRIPPING = YES;
DEVELOPMENT_TEAM = CS727NF72U;
ENABLE_APP_SANDBOX = YES;

View file

@ -65,6 +65,13 @@
ReferencedContainer = "container:Neon Vision Editor.xcodeproj">
</BuildableReference>
</BuildableProductRunnable>
<AdditionalOptions>
<AdditionalOption
key = "APP_DISTRIBUTOR_ID_OVERRIDE"
value = "com.apple.AppStore"
isEnabled = "YES">
</AdditionalOption>
</AdditionalOptions>
<StoreKitConfigurationFileReference
identifier = "../../Neon Vision Editor/SupportOptional.storekit">
</StoreKitConfigurationFileReference>

View file

@ -18,17 +18,37 @@ enum ReleaseRuntimePolicy {
#if os(macOS)
static var isMacAppStoreDistribution: Bool {
// Treat both production and sandbox App Store receipts as App Store distribution.
if let appStoreReceiptURL = Bundle.main.appStoreReceiptURL,
FileManager.default.fileExists(atPath: appStoreReceiptURL.path) {
#if APP_STORE_BUILD
return true
#else
if isForcedAppStoreDistributionForCurrentProcess {
return true
}
let legacyReceiptURL = Bundle.main.bundleURL
let receiptDirectoryURL = Bundle.main.bundleURL
.appendingPathComponent("Contents", isDirectory: true)
.appendingPathComponent("_MASReceipt", isDirectory: true)
.appendingPathComponent("receipt", isDirectory: false)
return FileManager.default.fileExists(atPath: legacyReceiptURL.path)
let fileManager = FileManager.default
let receiptURL = receiptDirectoryURL.appendingPathComponent("receipt", isDirectory: false)
if fileManager.fileExists(atPath: receiptURL.path) {
return true
}
let sandboxReceiptURL = receiptDirectoryURL.appendingPathComponent("sandboxReceipt", isDirectory: false)
return fileManager.fileExists(atPath: sandboxReceiptURL.path)
#endif
}
private static var isForcedAppStoreDistributionForCurrentProcess: Bool {
let processInfo = ProcessInfo.processInfo
let environmentValue = processInfo.environment["APP_DISTRIBUTOR_ID_OVERRIDE"]
let argumentValue = processInfo.arguments
.first(where: { $0.hasPrefix("APP_DISTRIBUTOR_ID_OVERRIDE=") })?
.split(separator: "=", maxSplits: 1)
.last
.map(String.init)
let distributor = (environmentValue ?? argumentValue ?? "")
.trimmingCharacters(in: .whitespacesAndNewlines)
.lowercased()
return distributor == "com.apple.appstore"
}
#endif