From 23a9114cfcab606ceafcd66cc6fe0f803496e361 Mon Sep 17 00:00:00 2001 From: h3p Date: Fri, 17 Apr 2026 10:49:50 +0200 Subject: [PATCH] fix(release): disable updater for app store distribution --- Neon Vision Editor.xcodeproj/project.pbxproj | 8 ++--- .../xcschemes/Neon Vision Editor.xcscheme | 7 ++++ .../Core/ReleaseRuntimePolicy.swift | 34 +++++++++++++++---- 3 files changed, 38 insertions(+), 11 deletions(-) diff --git a/Neon Vision Editor.xcodeproj/project.pbxproj b/Neon Vision Editor.xcodeproj/project.pbxproj index ce4650a..dd07662 100644 --- a/Neon Vision Editor.xcodeproj/project.pbxproj +++ b/Neon Vision Editor.xcodeproj/project.pbxproj @@ -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; diff --git a/Neon Vision Editor.xcodeproj/xcshareddata/xcschemes/Neon Vision Editor.xcscheme b/Neon Vision Editor.xcodeproj/xcshareddata/xcschemes/Neon Vision Editor.xcscheme index 9470b91..3adb501 100644 --- a/Neon Vision Editor.xcodeproj/xcshareddata/xcschemes/Neon Vision Editor.xcscheme +++ b/Neon Vision Editor.xcodeproj/xcshareddata/xcschemes/Neon Vision Editor.xcscheme @@ -65,6 +65,13 @@ ReferencedContainer = "container:Neon Vision Editor.xcodeproj"> + + + + diff --git a/Neon Vision Editor/Core/ReleaseRuntimePolicy.swift b/Neon Vision Editor/Core/ReleaseRuntimePolicy.swift index f4877cc..537f82b 100644 --- a/Neon Vision Editor/Core/ReleaseRuntimePolicy.swift +++ b/Neon Vision Editor/Core/ReleaseRuntimePolicy.swift @@ -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