diff --git a/ios/patching/001-social-app-ios-config.patch b/ios/patching/001-social-app-ios-config.patch index b16e999..b132480 100644 --- a/ios/patching/001-social-app-ios-config.patch +++ b/ios/patching/001-social-app-ios-config.patch @@ -14,7 +14,7 @@ index 246d8abd3..ed8f7b2b2 100644 // When testing local services, enter an ngrok (et al) domain here. It must use a standard HTTP/HTTPS port. ...(IS_DEV || IS_TESTFLIGHT ? [] : []), ] -@@ -33,27 +30,24 @@ module.exports = function (_config) { +@@ -33,27 +30,25 @@ module.exports = function (_config) { return { expo: { version: VERSION, @@ -37,6 +37,7 @@ index 246d8abd3..ed8f7b2b2 100644 supportsTablet: false, - bundleIdentifier: 'xyz.blueskyweb.app', + bundleIdentifier: 'ai.syui.at', ++ buildNumber: '__BUILD_NUMBER__', config: { usesNonExemptEncryption: false, }, diff --git a/ios/setup.zsh b/ios/setup.zsh index 43a204a..cff4f22 100755 --- a/ios/setup.zsh +++ b/ios/setup.zsh @@ -5,6 +5,15 @@ cd ${0:a:h} # iOS Social App Patch Setup Script # Usage: ./ios/setup.zsh [patch|reset] +# Cross-platform sed (macOS vs Linux) +function sediment() { + if [[ "$OSTYPE" == "darwin"* ]]; then + sed -i '' "$@" + else + sed -i "$@" + fi +} + # Arrays for patch management typeset -a FAILED_PATCHES @@ -114,6 +123,30 @@ function patch-apply() { apply-patch "${name}" "$target_dir" "$patching_dir/${patch_file}" } +# Generate build number from timestamp (YYMMDDHHMMSS) +function ios-generate-build-number() { + local build_number=$(date +%y%m%d%H%M%S) + local config_patch="$patching_dir/001-social-app-ios-config.patch" + + if [ -f "$config_patch" ]; then + # Replace placeholder with timestamp + sediment "s/__BUILD_NUMBER__/${build_number}/" "$config_patch" + echo "━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━" + echo "🔢 Build number: ${build_number}" + echo "" + fi +} + +# Restore placeholder after patching (for git cleanliness) +function ios-restore-build-placeholder() { + local config_patch="$patching_dir/001-social-app-ios-config.patch" + + if [ -f "$config_patch" ]; then + # Restore placeholder for next build + sediment "s/buildNumber: '[0-9]*'/buildNumber: '__BUILD_NUMBER__'/" "$config_patch" + fi +} + # Auto-apply patches from list function ios-patch-apply-all() { for filename in "${PATCH_FILES_IOS[@]}"; do @@ -166,7 +199,9 @@ ios-env case "$1" in patch) ios-setup-clone + ios-generate-build-number ios-patch-apply-all + ios-restore-build-placeholder ios-copy-new-files show-failed-patches exit @@ -177,7 +212,9 @@ case "$1" in ;; *) ios-setup-clone + ios-generate-build-number ios-patch-apply-all + ios-restore-build-placeholder ios-copy-new-files show-failed-patches ;;