diff --git a/Config.xcconfig b/Config.xcconfig index 04c70065d..e0a30fc99 100644 --- a/Config.xcconfig +++ b/Config.xcconfig @@ -1,9 +1,13 @@ -#include? "LoopFollowConfigOverride.xcconfig" -#include? "../../LoopFollowConfigOverride.xcconfig" +//#include? "LoopFollowConfigOverride.xcconfig" +//#include? "../../LoopFollowConfigOverride.xcconfig" #include? "LoopFollowDisplayNameConfig.xcconfig" #include? "../../LoopFollowDisplayNameConfig.xcconfig" -unique_id = ${DEVELOPMENT_TEAM} +//Bundle Identifier must be formatted like: com.$(DEVELOPMENT_TEAM).LoopFollow +//$(DEVELOPMENT_TEAM) will be replaced by the TEAMID repository secret during build phase. +BUNDLE_IDENTIFIER = com.$(DEVELOPMENT_TEAM).LoopFollow +//BUNDLE_IDENTIFIER = com.$(DEVELOPMENT_TEAM).LoopFollow.Second +//BUNDLE_IDENTIFIER = com.$(DEVELOPMENT_TEAM).LoopFollow.Third //Version (DEFAULT) LOOP_FOLLOW_MARKETING_VERSION = 4.4.3 diff --git a/LoopFollow.xcodeproj/project.pbxproj b/LoopFollow.xcodeproj/project.pbxproj index 035544902..b3a984b6e 100644 --- a/LoopFollow.xcodeproj/project.pbxproj +++ b/LoopFollow.xcodeproj/project.pbxproj @@ -2400,7 +2400,7 @@ "$(inherited)", "@executable_path/Frameworks", ); - PRODUCT_BUNDLE_IDENTIFIER = "com.$(unique_id).LoopFollow$(app_suffix)"; + PRODUCT_BUNDLE_IDENTIFIER = "$(BUNDLE_IDENTIFIER)"; PRODUCT_NAME = "Loop Follow"; SUPPORTS_MACCATALYST = YES; SWIFT_VERSION = 5.0; @@ -2423,7 +2423,7 @@ "$(inherited)", "@executable_path/Frameworks", ); - PRODUCT_BUNDLE_IDENTIFIER = "com.$(unique_id).LoopFollow$(app_suffix)"; + PRODUCT_BUNDLE_IDENTIFIER = "$(BUNDLE_IDENTIFIER)"; PRODUCT_NAME = "Loop Follow"; SUPPORTS_MACCATALYST = YES; SWIFT_VERSION = 5.0; diff --git a/LoopFollow/Helpers/AppConstants.swift b/LoopFollow/Helpers/AppConstants.swift index e81ba159c..ee52e2bf4 100644 --- a/LoopFollow/Helpers/AppConstants.swift +++ b/LoopFollow/Helpers/AppConstants.swift @@ -5,7 +5,7 @@ import Foundation // Class that contains general constants used in different classes class AppConstants { - static let APP_GROUP_ID = "group.com.$(unique_id).LoopFollow" + static let APP_GROUP_ID = "group.$(BUNDLE_IDENTIFIER)" /// Extracts the app suffix from the bundle identifier /// Bundle identifier format: com.$(unique_id).LoopFollow$(app_suffix) diff --git a/LoopFollow/Info.plist b/LoopFollow/Info.plist index e76068f9a..d51dcefca 100644 --- a/LoopFollow/Info.plist +++ b/LoopFollow/Info.plist @@ -3,10 +3,10 @@ AppGroupIdentifier - group.com.$(unique_id).LoopFollow$(app_suffix) + group.$(BUNDLE_IDENTIFIER) BGTaskSchedulerPermittedIdentifiers - com.$(unique_id).LoopFollow$(app_suffix) + $(BUNDLE_IDENTIFIER) CFBundleDevelopmentRegion $(DEVELOPMENT_LANGUAGE) @@ -17,7 +17,7 @@ CFBundleGetInfoString CFBundleIdentifier - com.$(unique_id).LoopFollow$(app_suffix) + $(BUNDLE_IDENTIFIER) CFBundleInfoDictionaryVersion 6.0 CFBundleName diff --git a/fastlane/Fastfile b/fastlane/Fastfile index d81e60e5d..7041a1c7a 100644 --- a/fastlane/Fastfile +++ b/fastlane/Fastfile @@ -23,11 +23,37 @@ DEVICE_NAME = ENV["DEVICE_NAME"] DEVICE_ID = ENV["DEVICE_ID"] ENV["FASTLANE_XCODEBUILD_SETTINGS_TIMEOUT"] = "120" +# Define method to parse xcconfig file, and replace $(DEVELOPMENT_TEAM) with ENV["TEAMID"] +def parse_xcconfig_file(path) + xcconfig = {} + File.open(path).each_line do |line| + line.strip! + next if line.empty? || line.start_with?('//') + parts = line.split('=') + next if parts.length < 2 # Skip lines without '=' + key, value = parts.map(&:strip) + # Replace $(DEVELOPMENT_TEAM) with ENV["TEAMID"] + value = value.gsub('$(DEVELOPMENT_TEAM)', TEAMID) + xcconfig[key] = value + end + xcconfig + end + +# Path to config.xcconfig file +xcconfig_path = "#{GITHUB_WORKSPACE}/Config.xcconfig" + +# Load the variables from config.xcconfig +xcconfig = parse_xcconfig_file(xcconfig_path) + +# Access BUNDLE_IDENTIFIER from the xcconfig file after replacing $(DEVELOPMENT_TEAM) with ENV["TEAMID"] +ENV["BUNDLE_ID"] = xcconfig["BUNDLE_IDENTIFIER"] + platform :ios do desc "Build Loop Follow" lane :build_LoopFollow do setup_ci if ENV['CI'] - + BUNDLE_ID = ENV["BUNDLE_ID"] + update_project_team( path: "#{GITHUB_WORKSPACE}/LoopFollow.xcodeproj", teamid: "#{TEAMID}" @@ -40,7 +66,7 @@ platform :ios do ) previous_build_number = latest_testflight_build_number( - app_identifier: "com.#{TEAMID}.LoopFollow", + app_identifier: "#{BUNDLE_ID}", api_key: api_key, ) @@ -55,7 +81,7 @@ platform :ios do type: "appstore", git_basic_authorization: Base64.strict_encode64("#{GITHUB_REPOSITORY_OWNER}:#{GH_PAT}"), app_identifier: [ - "com.#{TEAMID}.LoopFollow" + "#{BUNDLE_ID}" ] ) @@ -65,7 +91,7 @@ platform :ios do update_code_signing_settings( path: "#{GITHUB_WORKSPACE}/LoopFollow.xcodeproj", - profile_name: mapping["com.#{TEAMID}.LoopFollow"], + profile_name: mapping["#{BUNDLE_ID}"], code_sign_identity: "iPhone Distribution", targets: ["LoopFollow"] ) @@ -105,7 +131,8 @@ platform :ios do lane :identifiers do setup_ci if ENV['CI'] ENV["MATCH_READONLY"] = false.to_s - + BUNDLE_ID = ENV["BUNDLE_ID"] + app_store_connect_api_key( key_id: "#{FASTLANE_KEY_ID}", issuer_id: "#{FASTLANE_ISSUER_ID}", @@ -124,7 +151,7 @@ platform :ios do end end - configure_bundle_id("LoopFollow", "com.#{TEAMID}.LoopFollow", [ + configure_bundle_id("LoopFollow", "#{BUNDLE_ID}", [ Spaceship::ConnectAPI::BundleIdCapability::Type::PUSH_NOTIFICATIONS ]) @@ -134,7 +161,8 @@ platform :ios do lane :certs do setup_ci if ENV['CI'] ENV["MATCH_READONLY"] = false.to_s - + BUNDLE_ID = ENV["BUNDLE_ID"] + app_store_connect_api_key( key_id: "#{FASTLANE_KEY_ID}", issuer_id: "#{FASTLANE_ISSUER_ID}", @@ -147,7 +175,7 @@ platform :ios do verbose: true, git_basic_authorization: Base64.strict_encode64("#{GITHUB_REPOSITORY_OWNER}:#{GH_PAT}"), app_identifier: [ - "com.#{TEAMID}.LoopFollow", + "#{BUNDLE_ID}", ] ) end @@ -156,6 +184,7 @@ platform :ios do lane :validate_secrets do setup_ci if ENV['CI'] ENV["MATCH_READONLY"] = true.to_s + BUNDLE_ID = ENV["BUNDLE_ID"] app_store_connect_api_key( key_id: "#{FASTLANE_KEY_ID}", @@ -167,7 +196,7 @@ platform :ios do bundle_id = Spaceship::ConnectAPI::BundleId.find(identifier) end - find_bundle_id("com.#{TEAMID}.loopkit.LoopFollow") + find_bundle_id("#{BUNDLE_ID}") match( type: "appstore",