diff --git a/ElementX.xcodeproj/project.pbxproj b/ElementX.xcodeproj/project.pbxproj index b1265e02b..9dfbe7f0c 100644 --- a/ElementX.xcodeproj/project.pbxproj +++ b/ElementX.xcodeproj/project.pbxproj @@ -9880,6 +9880,7 @@ GCC_WARN_UNUSED_FUNCTION = YES; GCC_WARN_UNUSED_VARIABLE = YES; IPHONEOS_DEPLOYMENT_TARGET = 18.5; + IS_NIGHTLY_BUILD = NO; KEYCHAIN_ACCESS_GROUP_IDENTIFIER = "$(DEVELOPMENT_TEAM).$(BASE_BUNDLE_IDENTIFIER)"; MACOSX_DEPLOYMENT_TARGET = 14.5; MARKETING_VERSION = 26.07.3; @@ -9960,6 +9961,7 @@ GCC_WARN_UNUSED_FUNCTION = YES; GCC_WARN_UNUSED_VARIABLE = YES; IPHONEOS_DEPLOYMENT_TARGET = 18.5; + IS_NIGHTLY_BUILD = NO; KEYCHAIN_ACCESS_GROUP_IDENTIFIER = "$(DEVELOPMENT_TEAM).$(BASE_BUNDLE_IDENTIFIER)"; MACOSX_DEPLOYMENT_TARGET = 14.5; MARKETING_VERSION = 26.07.3; diff --git a/ElementX/Sources/Application/Settings/AppSettings.swift b/ElementX/Sources/Application/Settings/AppSettings.swift index f01de0f1a..ac0e107d0 100644 --- a/ElementX/Sources/Application/Settings/AppSettings.swift +++ b/ElementX/Sources/Application/Settings/AppSettings.swift @@ -40,11 +40,10 @@ nonisolated enum AppBuildType { #if DEBUG return .debug #else - switch InfoPlistReader.main.baseBundleIdentifier { - case "io.element.elementx.nightly": - return .nightly - default: - return .release + if InfoPlistReader.main.isNightlyBuild { + .nightly + } else { + .release } #endif } diff --git a/ElementX/Sources/Other/InfoPlistReader.swift b/ElementX/Sources/Other/InfoPlistReader.swift index e11d5041e..9d54ab7b0 100644 --- a/ElementX/Sources/Other/InfoPlistReader.swift +++ b/ElementX/Sources/Other/InfoPlistReader.swift @@ -16,6 +16,7 @@ nonisolated struct InfoPlistReader { static let bundleShortVersion = "CFBundleShortVersionString" static let bundleDisplayName = "CFBundleDisplayName" static let productionAppName = "productionAppName" + static let isNightlyBuild = "isNightlyBuild" static let utExportedTypeDeclarationsKey = "UTExportedTypeDeclarations" static let utTypeIdentifierKey = "UTTypeIdentifier" static let utDescriptionKey = "UTTypeDescription" @@ -93,6 +94,11 @@ nonisolated struct InfoPlistReader { infoPlistValue(forKey: Keys.productionAppName) } + /// Whether or not the build is from the Nightly stream. + var isNightlyBuild: Bool { + infoPlistValue(forKey: Keys.isNightlyBuild) + } + // MARK: - Custom App Scheme var appScheme: String { @@ -144,7 +150,7 @@ nonisolated struct InfoPlistReader { @_disfavoredOverload // Make sure optional types default to the optional version below. private func infoPlistValue(forKey key: String) -> T { guard let result = bundle.object(forInfoDictionaryKey: key) as? T else { - fatalError("Add \(key) into your target's Info.plst") + fatalError("Add \(key) into your target's Info.plist") } return result } @@ -153,6 +159,11 @@ nonisolated struct InfoPlistReader { bundle.object(forInfoDictionaryKey: key) as? T } + private func infoPlistValue(forKey key: String) -> Bool { + // Build setting values are stored as strings ("YES"/"NO")… + (infoPlistValue(forKey: key) as NSString).boolValue + } + private func customSchemeForName(_ name: String) -> String { let urlTypes: [[String: Any]] = infoPlistValue(forKey: Keys.bundleURLTypes) diff --git a/ElementX/Sources/Services/BugReport/BugReportService.swift b/ElementX/Sources/Services/BugReport/BugReportService.swift index 54d03e919..60d767767 100644 --- a/ElementX/Sources/Services/BugReport/BugReportService.swift +++ b/ElementX/Sources/Services/BugReport/BugReportService.swift @@ -88,7 +88,7 @@ class BugReportService: NSObject, BugReportServiceProtocol { params.append(contentsOf: defaultParams) - if InfoPlistReader.main.baseBundleIdentifier == "io.element.elementx.nightly" { + if AppBuildType.current == .nightly { bugReport.githubLabels.append("Nightly") } diff --git a/ElementX/SupportingFiles/Info.plist b/ElementX/SupportingFiles/Info.plist index 81247db2a..0c956f384 100644 --- a/ElementX/SupportingFiles/Info.plist +++ b/ElementX/SupportingFiles/Info.plist @@ -122,6 +122,8 @@ $(CLASSIC_APP_KEYCHAIN_ACCESS_GROUP_IDENTIFIER) classicAppKeychainServiceIdentifier $(CLASSIC_APP_KEYCHAIN_SERVICE_IDENTIFIER) + isNightlyBuild + $(IS_NIGHTLY_BUILD) keychainAccessGroupIdentifier $(KEYCHAIN_ACCESS_GROUP_IDENTIFIER) productionAppName diff --git a/ElementX/SupportingFiles/target.yml b/ElementX/SupportingFiles/target.yml index 4f401cd15..69cb8c068 100644 --- a/ElementX/SupportingFiles/target.yml +++ b/ElementX/SupportingFiles/target.yml @@ -77,6 +77,7 @@ targets: classicAppKeychainAccessGroupIdentifier: $(CLASSIC_APP_KEYCHAIN_ACCESS_GROUP_IDENTIFIER) classicAppDeepLinkURL: $(CLASSIC_APP_DEEP_LINK_URL) productionAppName: $(PRODUCTION_APP_NAME) + isNightlyBuild: $(IS_NIGHTLY_BUILD) ITSAppUsesNonExemptEncryption: false NSUserActivityTypes: [ INSendMessageIntent, diff --git a/Enterprise b/Enterprise index 08f254401..adc11832e 160000 --- a/Enterprise +++ b/Enterprise @@ -1 +1 @@ -Subproject commit 08f25440187a87981f120ddd6ff66a1195478596 +Subproject commit adc11832e95482a245e7709aefd2aebeade7d625 diff --git a/NSE/SupportingFiles/Info.plist b/NSE/SupportingFiles/Info.plist index 69fe3c8fb..8c9f6c64a 100644 --- a/NSE/SupportingFiles/Info.plist +++ b/NSE/SupportingFiles/Info.plist @@ -31,6 +31,8 @@ $(APP_GROUP_IDENTIFIER) baseBundleIdentifier $(BASE_BUNDLE_IDENTIFIER) + isNightlyBuild + $(IS_NIGHTLY_BUILD) keychainAccessGroupIdentifier $(KEYCHAIN_ACCESS_GROUP_IDENTIFIER) productionAppName diff --git a/NSE/SupportingFiles/target.yml b/NSE/SupportingFiles/target.yml index bc2367edb..5053b1fc9 100644 --- a/NSE/SupportingFiles/target.yml +++ b/NSE/SupportingFiles/target.yml @@ -54,6 +54,7 @@ targets: baseBundleIdentifier: $(BASE_BUNDLE_IDENTIFIER) keychainAccessGroupIdentifier: $(KEYCHAIN_ACCESS_GROUP_IDENTIFIER) productionAppName: $(PRODUCTION_APP_NAME) + isNightlyBuild: $(IS_NIGHTLY_BUILD) NSExtension: NSExtensionPointIdentifier: com.apple.usernotifications.service NSExtensionPrincipalClass: $(PRODUCT_MODULE_NAME).NotificationServiceExtension diff --git a/ShareExtension/SupportingFiles/Info.plist b/ShareExtension/SupportingFiles/Info.plist index 1121f1686..6af769e45 100644 --- a/ShareExtension/SupportingFiles/Info.plist +++ b/ShareExtension/SupportingFiles/Info.plist @@ -51,6 +51,8 @@ $(APP_GROUP_IDENTIFIER) baseBundleIdentifier $(BASE_BUNDLE_IDENTIFIER) + isNightlyBuild + $(IS_NIGHTLY_BUILD) keychainAccessGroupIdentifier $(KEYCHAIN_ACCESS_GROUP_IDENTIFIER) productionAppName diff --git a/ShareExtension/SupportingFiles/target.yml b/ShareExtension/SupportingFiles/target.yml index 4e36b6248..e75f6d43b 100644 --- a/ShareExtension/SupportingFiles/target.yml +++ b/ShareExtension/SupportingFiles/target.yml @@ -49,6 +49,7 @@ targets: baseBundleIdentifier: $(BASE_BUNDLE_IDENTIFIER) keychainAccessGroupIdentifier: $(KEYCHAIN_ACCESS_GROUP_IDENTIFIER) productionAppName: $(PRODUCTION_APP_NAME) + isNightlyBuild: $(IS_NIGHTLY_BUILD) NSExtension: NSExtensionPointIdentifier: com.apple.share-services NSExtensionPrincipalClass: $(PRODUCT_MODULE_NAME).ShareExtensionViewController diff --git a/Tools/Sources/Commands/AppIconBanner.swift b/Tools/Sources/Commands/AppIconBanner.swift index bd9666d6a..2ab5724c9 100644 --- a/Tools/Sources/Commands/AppIconBanner.swift +++ b/Tools/Sources/Commands/AppIconBanner.swift @@ -7,8 +7,8 @@ struct AppIconBanner: AsyncParsableCommand { @Argument(help: "Path to the input image.") var path: String - @Option(help: "Text for the banner.") - var bannerText: String + @Option(help: "The build number appended to the app's version.") + var buildNumber: Int @MainActor func run() async throws { @@ -19,6 +19,9 @@ struct AppIconBanner: AsyncParsableCommand { throw ValidationError("Could not load the image at \(pathURL).") } + let version = try CI.readMarketingVersion() + let bannerText = "\(version) (\(buildNumber))" + let renderer = ImageRenderer(content: BannerImage(image: image, text: bannerText)) diff --git a/Tools/Sources/Commands/CI/ConfigureNightly.swift b/Tools/Sources/Commands/CI/ConfigureNightly.swift index 4f236057e..5fcf936c4 100644 --- a/Tools/Sources/Commands/CI/ConfigureNightly.swift +++ b/Tools/Sources/Commands/CI/ConfigureNightly.swift @@ -19,8 +19,7 @@ struct ConfigureNightly: AsyncParsableCommand { try await CI.run(.name("swift"), ["run", "pipeline", "update-foss-secrets"]) try await CI.run(.name("xcodegen")) - let releaseVersion = try CI.readMarketingVersion() - try await generateAppIconBanner(version: releaseVersion, buildNumber: buildNumber) + try await generateAppIconBanner(buildNumber: buildNumber) } /// Adds the Nightly variant include path to `project.yml` if it isn't already present. @@ -41,9 +40,8 @@ struct ConfigureNightly: AsyncParsableCommand { } /// Generates the app icon banner with version and build number. - private func generateAppIconBanner(version: String, buildNumber: String) async throws { - let bannerText = "\(version) (\(buildNumber))" + private func generateAppIconBanner(buildNumber: String) async throws { let iconPath = "Variants/Nightly/Resources/NightlyAppIcon.icon/Assets/Version.png" - try await AppIconBanner.parse([iconPath, "--banner-text", bannerText]).run() + try await AppIconBanner.parse([iconPath, "--build-number", buildNumber]).run() } } diff --git a/Variants/Nightly/nightly.yml b/Variants/Nightly/nightly.yml index 572f79c44..6595e156e 100644 --- a/Variants/Nightly/nightly.yml +++ b/Variants/Nightly/nightly.yml @@ -1,6 +1,7 @@ settings: APP_GROUP_IDENTIFIER: group.io.element.nightly BASE_BUNDLE_IDENTIFIER: io.element.elementx.nightly + IS_NIGHTLY_BUILD: true targets: ElementX: @@ -8,4 +9,4 @@ targets: base: ASSETCATALOG_COMPILER_APPICON_NAME: NightlyAppIcon sources: - - path: Resources \ No newline at end of file + - path: Resources diff --git a/app.yml b/app.yml index 51507a82e..29b3f567d 100644 --- a/app.yml +++ b/app.yml @@ -5,6 +5,7 @@ settings: BASE_BUNDLE_IDENTIFIER: io.element.elementx ASSETCATALOG_COMPILER_GLOBAL_ACCENT_COLOR_NAME: "colors/accent-color" DEVELOPMENT_TEAM: 7J4U792NQT + IS_NIGHTLY_BUILD: false # Optional configuration to load accounts from Element Classic. CLASSIC_APP_GROUP_IDENTIFIER: group.im.vector diff --git a/ci_scripts/ci_post_clone.sh b/ci_scripts/ci_post_clone.sh index 3c130726f..2b6cbb447 100755 --- a/ci_scripts/ci_post_clone.sh +++ b/ci_scripts/ci_post_clone.sh @@ -12,6 +12,9 @@ if [ "$CI_WORKFLOW" = "Nightly" ]; then elif [ "$CI_WORKFLOW" = "Element Pro" ]; then # Xcode Cloud automatically fetches the submodules. swift run pipeline configure-element-pro +elif [ "$CI_WORKFLOW" = "Element Pro Nightly" ]; then + # Xcode Cloud automatically fetches the submodules. + swift run pipeline configure-element-pro-nightly --build-number $CI_BUILD_NUMBER else swift run tools ci configure-production fi