Compare commits
1 Commits
| Author | SHA1 | Date | |
|---|---|---|---|
| dcb9174408 |
Binary file not shown.
@@ -4,7 +4,7 @@ android {
|
|||||||
namespace = "io.ionic.starter"
|
namespace = "io.ionic.starter"
|
||||||
compileSdk = rootProject.ext.compileSdkVersion
|
compileSdk = rootProject.ext.compileSdkVersion
|
||||||
defaultConfig {
|
defaultConfig {
|
||||||
applicationId "io.ionic.starter"
|
applicationId "com.habitmode.llemba.com"
|
||||||
minSdkVersion rootProject.ext.minSdkVersion
|
minSdkVersion rootProject.ext.minSdkVersion
|
||||||
targetSdkVersion rootProject.ext.targetSdkVersion
|
targetSdkVersion rootProject.ext.targetSdkVersion
|
||||||
versionCode 1
|
versionCode 1
|
||||||
|
|||||||
@@ -21,6 +21,12 @@
|
|||||||
<action android:name="android.intent.action.MAIN" />
|
<action android:name="android.intent.action.MAIN" />
|
||||||
<category android:name="android.intent.category.LAUNCHER" />
|
<category android:name="android.intent.category.LAUNCHER" />
|
||||||
</intent-filter>
|
</intent-filter>
|
||||||
|
<intent-filter>
|
||||||
|
<action android:name="android.intent.action.VIEW" />
|
||||||
|
<category android:name="android.intent.category.DEFAULT" />
|
||||||
|
<category android:name="android.intent.category.BROWSABLE" />
|
||||||
|
<data android:scheme="io.flavorstudio.app" />
|
||||||
|
</intent-filter>
|
||||||
|
|
||||||
</activity>
|
</activity>
|
||||||
|
|
||||||
|
|||||||
@@ -1,7 +1,7 @@
|
|||||||
<?xml version='1.0' encoding='utf-8'?>
|
<?xml version='1.0' encoding='utf-8'?>
|
||||||
<resources>
|
<resources>
|
||||||
<string name="app_name">PowerSlap</string>
|
<string name="app_name">FlavorStudio</string>
|
||||||
<string name="title_activity_main">PowerSlap</string>
|
<string name="title_activity_main">FlavorStudio</string>
|
||||||
<string name="package_name">io.ionic.starter</string>
|
<string name="package_name">io.ionic.starter</string>
|
||||||
<string name="custom_url_scheme">io.ionic.starter</string>
|
<string name="custom_url_scheme">io.ionic.starter</string>
|
||||||
</resources>
|
</resources>
|
||||||
|
|||||||
+2
-2
@@ -1,8 +1,8 @@
|
|||||||
import type { CapacitorConfig } from '@capacitor/cli';
|
import type { CapacitorConfig } from '@capacitor/cli';
|
||||||
|
|
||||||
const config: CapacitorConfig = {
|
const config: CapacitorConfig = {
|
||||||
appId: 'io.powerslap.app',
|
appId: 'com.habitmode.llemba.com',
|
||||||
appName: 'PowerSlap',
|
appName: 'FlavorStudio',
|
||||||
webDir: 'dist',
|
webDir: 'dist',
|
||||||
plugins: {
|
plugins: {
|
||||||
FirebaseAuthentication: {
|
FirebaseAuthentication: {
|
||||||
|
|||||||
+66
-27
@@ -11,6 +11,9 @@ workflows:
|
|||||||
- $HOME/.gradle/caches
|
- $HOME/.gradle/caches
|
||||||
- $HOME/.gradle/wrapper
|
- $HOME/.gradle/wrapper
|
||||||
scripts:
|
scripts:
|
||||||
|
# Template ships with optional native plugins (maps, push, firebase auth) that most apps
|
||||||
|
# won't use. Keeping unused plugins in package.json adds SPM/Gradle deps and bloats the
|
||||||
|
# build. Strip any that have no import in src/ so only actually-used plugins are compiled.
|
||||||
- name: Strip unused scaffold packages
|
- name: Strip unused scaffold packages
|
||||||
script: |
|
script: |
|
||||||
for pkg in "@capacitor/google-maps" "@capacitor/push-notifications" "@capacitor-firebase/authentication"; do
|
for pkg in "@capacitor/google-maps" "@capacitor/push-notifications" "@capacitor-firebase/authentication"; do
|
||||||
@@ -21,10 +24,16 @@ workflows:
|
|||||||
echo "Keeping $pkg (used in src/)"
|
echo "Keeping $pkg (used in src/)"
|
||||||
fi
|
fi
|
||||||
done
|
done
|
||||||
|
# Delete package-lock.json (generated if user ever ran npm locally) so it doesn't
|
||||||
|
# conflict with yarn.lock. --legacy-peer-deps silences peer dep warnings from older
|
||||||
|
# Ionic/React packages that haven't updated their peerDependencies for React 18/19.
|
||||||
- name: Install dependencies
|
- name: Install dependencies
|
||||||
script: rm -f package-lock.json && npm install --legacy-peer-deps
|
script: rm -f package-lock.json && npm install --legacy-peer-deps
|
||||||
- name: Build web assets
|
- name: Build web assets
|
||||||
script: npm run build
|
script: npm run build
|
||||||
|
# Firebase config files are injected as base64 env vars by the Appcakes backend at
|
||||||
|
# build time. Decode them here so cap sync and Gradle can pick them up. Optional —
|
||||||
|
# builds without Firebase still succeed; native Firebase SDK just won't initialise.
|
||||||
- name: Write Firebase config
|
- name: Write Firebase config
|
||||||
script: |
|
script: |
|
||||||
if [ -n "$GOOGLE_SERVICES_JSON" ]; then
|
if [ -n "$GOOGLE_SERVICES_JSON" ]; then
|
||||||
@@ -37,6 +46,8 @@ workflows:
|
|||||||
echo "$GOOGLE_SERVICE_INFO_PLIST" | base64 --decode > ios/App/App/GoogleService-Info.plist
|
echo "$GOOGLE_SERVICE_INFO_PLIST" | base64 --decode > ios/App/App/GoogleService-Info.plist
|
||||||
echo "Wrote GoogleService-Info.plist ($(wc -c < ios/App/App/GoogleService-Info.plist) bytes)"
|
echo "Wrote GoogleService-Info.plist ($(wc -c < ios/App/App/GoogleService-Info.plist) bytes)"
|
||||||
fi
|
fi
|
||||||
|
# cap sync copies the built web assets (dist/) into android/app/src/main/assets/public/
|
||||||
|
# and updates Capacitor plugin registrations in MainActivity. Must run after npm build.
|
||||||
- name: Capacitor sync
|
- name: Capacitor sync
|
||||||
script: npx cap sync android
|
script: npx cap sync android
|
||||||
- name: Set up debug keystore
|
- name: Set up debug keystore
|
||||||
@@ -44,6 +55,13 @@ workflows:
|
|||||||
if [ -n "$CM_DEBUG_KEYSTORE" ]; then
|
if [ -n "$CM_DEBUG_KEYSTORE" ]; then
|
||||||
echo "$CM_DEBUG_KEYSTORE" | base64 --decode > /tmp/debug-keystore.p12
|
echo "$CM_DEBUG_KEYSTORE" | base64 --decode > /tmp/debug-keystore.p12
|
||||||
fi
|
fi
|
||||||
|
- name: Check native credentials
|
||||||
|
script: |
|
||||||
|
if [ -n "$VITE_GOOGLE_MAPS_KEY" ]; then
|
||||||
|
echo "VITE_GOOGLE_MAPS_KEY: set (length=${#VITE_GOOGLE_MAPS_KEY}, ends …${VITE_GOOGLE_MAPS_KEY: -4})"
|
||||||
|
else
|
||||||
|
echo "WARNING: VITE_GOOGLE_MAPS_KEY not set — Google Maps will not render"
|
||||||
|
fi
|
||||||
- name: Build debug APK
|
- name: Build debug APK
|
||||||
script: |
|
script: |
|
||||||
cd android
|
cd android
|
||||||
@@ -57,6 +75,21 @@ workflows:
|
|||||||
else
|
else
|
||||||
./gradlew assembleDebug --no-daemon
|
./gradlew assembleDebug --no-daemon
|
||||||
fi
|
fi
|
||||||
|
- name: Verify manifest substitution
|
||||||
|
script: |
|
||||||
|
MANIFEST="android/app/build/intermediates/merged_manifests/debug/AndroidManifest.xml"
|
||||||
|
if [ -f "$MANIFEST" ]; then
|
||||||
|
VAL=$(grep -A1 'geo.API_KEY' "$MANIFEST" | grep -o 'android:value="[^"]*"' | cut -d'"' -f2)
|
||||||
|
if [ -z "$VAL" ]; then
|
||||||
|
echo "WARNING: geo.API_KEY meta-data not found in merged manifest"
|
||||||
|
elif [ "$VAL" = '${googleMapsApiKey}' ]; then
|
||||||
|
echo "WARNING: geo.API_KEY placeholder was not substituted — key missing from build env"
|
||||||
|
else
|
||||||
|
echo "geo.API_KEY substituted OK (ends …${VAL: -4})"
|
||||||
|
fi
|
||||||
|
else
|
||||||
|
echo "Merged manifest not found at $MANIFEST"
|
||||||
|
fi
|
||||||
artifacts:
|
artifacts:
|
||||||
- android/app/build/outputs/apk/debug/app-debug.apk
|
- android/app/build/outputs/apk/debug/app-debug.apk
|
||||||
|
|
||||||
@@ -228,26 +261,25 @@ workflows:
|
|||||||
script: rm -f package-lock.json && npm install --legacy-peer-deps
|
script: rm -f package-lock.json && npm install --legacy-peer-deps
|
||||||
- name: Build web assets
|
- name: Build web assets
|
||||||
script: npm run build
|
script: npm run build
|
||||||
|
# First sync: regenerates CapApp-SPM/Package.swift with the correct plugin list.
|
||||||
|
# Note: this project uses Capacitor SPM (no CocoaPods/Podfile), so cap sync replaces
|
||||||
|
# pod install — it regenerates CapApp-SPM/Package.swift and copies web assets.
|
||||||
- name: Capacitor sync
|
- name: Capacitor sync
|
||||||
script: npx cap sync ios
|
script: npx cap sync ios
|
||||||
|
# Decode Firebase plist to disk so it is present during the second sync.
|
||||||
- name: Write Firebase config
|
- name: Write Firebase config
|
||||||
script: |
|
script: |
|
||||||
if [ -n "$GOOGLE_SERVICE_INFO_PLIST" ]; then
|
if [ -n "$GOOGLE_SERVICE_INFO_PLIST" ]; then
|
||||||
echo "$GOOGLE_SERVICE_INFO_PLIST" | base64 --decode > ios/App/App/GoogleService-Info.plist
|
echo "$GOOGLE_SERVICE_INFO_PLIST" | base64 --decode > ios/App/App/GoogleService-Info.plist
|
||||||
ruby -e "
|
|
||||||
require 'xcodeproj'
|
|
||||||
project = Xcodeproj::Project.open('ios/App/App.xcodeproj')
|
|
||||||
target = project.targets.find { |t| t.name == 'App' }
|
|
||||||
app_group = project.main_group['App']
|
|
||||||
unless app_group.files.find { |f| f.path == 'GoogleService-Info.plist' }
|
|
||||||
file_ref = app_group.new_reference('GoogleService-Info.plist')
|
|
||||||
target.resources_build_phase.add_file_reference(file_ref)
|
|
||||||
project.save
|
|
||||||
end
|
|
||||||
"
|
|
||||||
fi
|
fi
|
||||||
|
# Second sync ensures CapApp-SPM/Package.swift is consistent after the plist write.
|
||||||
- name: Capacitor sync
|
- name: Capacitor sync
|
||||||
script: npx cap sync ios
|
script: npx cap sync ios
|
||||||
|
# Run configure_xcode.rb after both syncs so its xcodeproj changes (plist file
|
||||||
|
# reference + SPM product linking) are not overwritten by a subsequent cap sync.
|
||||||
|
# configure_xcode.rb is stamped fresh from template on every build push.
|
||||||
|
- name: Configure Xcode project
|
||||||
|
script: ruby configure_xcode.rb
|
||||||
- name: Set up signing
|
- name: Set up signing
|
||||||
script: |
|
script: |
|
||||||
keychain initialize
|
keychain initialize
|
||||||
@@ -272,11 +304,23 @@ workflows:
|
|||||||
echo "No signing credentials configured — build will fail at signing"
|
echo "No signing credentials configured — build will fail at signing"
|
||||||
exit 1
|
exit 1
|
||||||
fi
|
fi
|
||||||
|
# --workspace: Capacitor SPM projects require workspace context for Xcode to resolve
|
||||||
|
# the CapApp-SPM local package. Using --project causes xcodebuild to fail on
|
||||||
|
# Xcode 26+ because SPM resolution requires workspace scope. App.xcworkspace is a
|
||||||
|
# static file committed to the template (not generated by cap sync) that wraps
|
||||||
|
# App.xcodeproj for this purpose.
|
||||||
|
# --no-show-build-settings: xcode-project runs xcodebuild -showBuildSettings as a
|
||||||
|
# pre-build diagnostic. Xcode 26 fails this step for SPM projects even with
|
||||||
|
# --workspace, so we skip it. The actual archive step still surfaces real errors.
|
||||||
|
# --disable-xcpretty: xcpretty reformats and filters xcodebuild output, swallowing
|
||||||
|
# the actual error lines when a build fails. Raw output makes failures debuggable.
|
||||||
- name: Build IPA
|
- name: Build IPA
|
||||||
script: |
|
script: |
|
||||||
xcode-project build-ipa \
|
xcode-project build-ipa \
|
||||||
--project ios/App/App.xcodeproj \
|
--workspace ios/App/App.xcworkspace \
|
||||||
--scheme App
|
--scheme App \
|
||||||
|
--no-show-build-settings \
|
||||||
|
--disable-xcpretty
|
||||||
artifacts:
|
artifacts:
|
||||||
- build/ios/ipa/*.ipa
|
- build/ios/ipa/*.ipa
|
||||||
|
|
||||||
@@ -304,24 +348,15 @@ workflows:
|
|||||||
script: npm run build
|
script: npm run build
|
||||||
- name: Capacitor sync
|
- name: Capacitor sync
|
||||||
script: npx cap sync ios
|
script: npx cap sync ios
|
||||||
- name: Write Firebase config
|
- name: Configure Xcode project
|
||||||
script: |
|
script: |
|
||||||
if [ -n "$GOOGLE_SERVICE_INFO_PLIST" ]; then
|
if [ -n "$GOOGLE_SERVICE_INFO_PLIST" ]; then
|
||||||
echo "$GOOGLE_SERVICE_INFO_PLIST" | base64 --decode > ios/App/App/GoogleService-Info.plist
|
echo "$GOOGLE_SERVICE_INFO_PLIST" | base64 --decode > ios/App/App/GoogleService-Info.plist
|
||||||
ruby -e "
|
|
||||||
require 'xcodeproj'
|
|
||||||
project = Xcodeproj::Project.open('ios/App/App.xcodeproj')
|
|
||||||
target = project.targets.find { |t| t.name == 'App' }
|
|
||||||
app_group = project.main_group['App']
|
|
||||||
unless app_group.files.find { |f| f.path == 'GoogleService-Info.plist' }
|
|
||||||
file_ref = app_group.new_reference('GoogleService-Info.plist')
|
|
||||||
target.resources_build_phase.add_file_reference(file_ref)
|
|
||||||
project.save
|
|
||||||
end
|
|
||||||
"
|
|
||||||
fi
|
fi
|
||||||
- name: Capacitor sync
|
- name: Capacitor sync
|
||||||
script: npx cap sync ios
|
script: npx cap sync ios
|
||||||
|
- name: Configure Xcode project
|
||||||
|
script: ruby configure_xcode.rb
|
||||||
- name: Set up signing
|
- name: Set up signing
|
||||||
script: |
|
script: |
|
||||||
keychain initialize
|
keychain initialize
|
||||||
@@ -343,12 +378,16 @@ workflows:
|
|||||||
echo "$CM_PROVISIONING_PROFILE" | base64 --decode > "$HOME/Library/MobileDevice/Provisioning Profiles/profile.mobileprovision"
|
echo "$CM_PROVISIONING_PROFILE" | base64 --decode > "$HOME/Library/MobileDevice/Provisioning Profiles/profile.mobileprovision"
|
||||||
xcode-project use-profiles
|
xcode-project use-profiles
|
||||||
fi
|
fi
|
||||||
|
# See ios-debug Build IPA comments for --workspace, --no-show-build-settings,
|
||||||
|
# and --disable-xcpretty rationale — same reasons apply here.
|
||||||
- name: Build IPA
|
- name: Build IPA
|
||||||
script: |
|
script: |
|
||||||
xcode-project build-ipa \
|
xcode-project build-ipa \
|
||||||
--project ios/App/App.xcodeproj \
|
--workspace ios/App/App.xcworkspace \
|
||||||
--scheme App \
|
--scheme App \
|
||||||
--config Release
|
--config Release \
|
||||||
|
--no-show-build-settings \
|
||||||
|
--disable-xcpretty
|
||||||
- name: Publish
|
- name: Publish
|
||||||
script: |
|
script: |
|
||||||
if [ "$SUBMIT_TO_TESTFLIGHT" = "true" ] || [ "$SUBMIT_TO_APP_STORE" = "true" ]; then
|
if [ "$SUBMIT_TO_TESTFLIGHT" = "true" ] || [ "$SUBMIT_TO_APP_STORE" = "true" ]; then
|
||||||
|
|||||||
@@ -0,0 +1,118 @@
|
|||||||
|
#!/usr/bin/env ruby
|
||||||
|
# configure_xcode.rb — stamped fresh from template on every build (see gitea.service.ts)
|
||||||
|
#
|
||||||
|
# 1. Adds GoogleService-Info.plist to the Xcode target if present (xcodeproj gem)
|
||||||
|
# 2. Scans Swift sources for Firebase imports and injects matching products into
|
||||||
|
# CapApp-SPM/Package.swift — the correct approach for Capacitor SPM projects
|
||||||
|
# where all native linking goes through CapApp-SPM, not App.xcodeproj directly.
|
||||||
|
|
||||||
|
require 'xcodeproj'
|
||||||
|
|
||||||
|
PROJECT_PATH = 'ios/App/App.xcodeproj'
|
||||||
|
TARGET_NAME = 'App'
|
||||||
|
PLIST_SRC = 'ios/App/App/GoogleService-Info.plist'
|
||||||
|
CAP_APP_SPM = 'ios/App/CapApp-SPM/Package.swift'
|
||||||
|
|
||||||
|
# ── 1. GoogleService-Info.plist ───────────────────────────────────────────────
|
||||||
|
if File.exist?(PLIST_SRC)
|
||||||
|
project = Xcodeproj::Project.open(PROJECT_PATH)
|
||||||
|
target = project.targets.find { |t| t.name == TARGET_NAME }
|
||||||
|
if target
|
||||||
|
app_group = project.main_group['App']
|
||||||
|
unless app_group&.files&.find { |f| f.path == 'GoogleService-Info.plist' }
|
||||||
|
file_ref = app_group.new_reference('GoogleService-Info.plist')
|
||||||
|
target.resources_build_phase.add_file_reference(file_ref)
|
||||||
|
project.save
|
||||||
|
puts "Added GoogleService-Info.plist to target"
|
||||||
|
end
|
||||||
|
end
|
||||||
|
end
|
||||||
|
|
||||||
|
# ── 2. Scan Swift sources for Firebase imports ────────────────────────────────
|
||||||
|
swift_files = Dir['ios/App/App/**/*.swift']
|
||||||
|
firebase_imports = swift_files
|
||||||
|
.flat_map { |f| File.readlines(f) rescue [] }
|
||||||
|
.grep(/^\s*import\s+Firebase\w+/)
|
||||||
|
.map { |l| l.strip.split(/\s+/).last }
|
||||||
|
.uniq
|
||||||
|
.sort
|
||||||
|
|
||||||
|
if firebase_imports.empty?
|
||||||
|
puts "No Firebase imports found — skipping CapApp-SPM update"
|
||||||
|
exit 0
|
||||||
|
end
|
||||||
|
|
||||||
|
puts "Firebase imports detected: #{firebase_imports.join(', ')}"
|
||||||
|
|
||||||
|
unless File.exist?(CAP_APP_SPM)
|
||||||
|
warn "WARNING: #{CAP_APP_SPM} not found — was cap sync run?"
|
||||||
|
exit 0
|
||||||
|
end
|
||||||
|
|
||||||
|
# ── 3. Detect firebase-ios-sdk URL and version from node_modules ──────────────
|
||||||
|
# Read from the ACTUAL node_modules on this build machine (populated by npm install)
|
||||||
|
# so the version we inject matches what @capacitor-firebase/* already resolved.
|
||||||
|
firebase_url = nil
|
||||||
|
firebase_version = nil
|
||||||
|
|
||||||
|
Dir['node_modules/@capacitor-firebase/**/Package.swift',
|
||||||
|
'node_modules/@capacitor/push-notifications/**/Package.swift'].each do |f|
|
||||||
|
content = File.read(f) rescue next
|
||||||
|
url_m = content.match(/\.package\(url:\s*"(https:\/\/github\.com\/firebase\/firebase-ios-sdk[^"]*)"/)
|
||||||
|
ver_m = content.match(/firebase-ios-sdk[^)]+from:\s*"(\d+)\.(\d+)\.(\d+)"/)
|
||||||
|
next unless url_m && ver_m
|
||||||
|
|
||||||
|
firebase_url = url_m[1]
|
||||||
|
major = ver_m[1].to_i
|
||||||
|
firebase_version = "#{major}.0.0"
|
||||||
|
puts "Detected firebase-ios-sdk from #{f}: url=#{firebase_url} → using from: \"#{firebase_version}\""
|
||||||
|
break
|
||||||
|
end
|
||||||
|
|
||||||
|
# Fallback — should rarely be needed
|
||||||
|
unless firebase_url
|
||||||
|
firebase_url = 'https://github.com/firebase/firebase-ios-sdk.git'
|
||||||
|
firebase_version = '11.0.0'
|
||||||
|
puts "Could not detect firebase-ios-sdk version from node_modules — using fallback #{firebase_version}"
|
||||||
|
end
|
||||||
|
|
||||||
|
firebase_pkg = 'firebase-ios-sdk'
|
||||||
|
|
||||||
|
lines = File.read(CAP_APP_SPM).split("\n")
|
||||||
|
|
||||||
|
# ── 4. Inject firebase-ios-sdk as a direct package dependency if missing ──────
|
||||||
|
# Normalise URL check to handle both with and without .git suffix
|
||||||
|
firebase_url_base = firebase_url.sub(/\.git$/, '')
|
||||||
|
unless lines.any? { |l| l.include?(firebase_url_base) }
|
||||||
|
last_pkg_idx = lines.rindex { |l| l.include?('.package(') }
|
||||||
|
if last_pkg_idx
|
||||||
|
lines[last_pkg_idx] = lines[last_pkg_idx].rstrip
|
||||||
|
lines[last_pkg_idx] += ',' unless lines[last_pkg_idx].end_with?(',')
|
||||||
|
lines.insert(last_pkg_idx + 1,
|
||||||
|
" .package(url: \"#{firebase_url}\", from: \"#{firebase_version}\")")
|
||||||
|
puts "Added #{firebase_pkg} to CapApp-SPM package dependencies"
|
||||||
|
else
|
||||||
|
warn "WARNING: no .package( line found in #{CAP_APP_SPM} — cannot inject dependency"
|
||||||
|
end
|
||||||
|
end
|
||||||
|
|
||||||
|
# ── 5. Inject each detected product into the target dependencies if missing ───
|
||||||
|
firebase_imports.each do |product|
|
||||||
|
next if product == 'Firebase' # umbrella import — not a linkable SPM product
|
||||||
|
|
||||||
|
product_str = ".product(name: \"#{product}\", package: \"#{firebase_pkg}\")"
|
||||||
|
next if lines.any? { |l| l.include?(product_str) }
|
||||||
|
|
||||||
|
last_prod_idx = lines.rindex { |l| l.include?('.product(') }
|
||||||
|
if last_prod_idx
|
||||||
|
lines[last_prod_idx] = lines[last_prod_idx].rstrip
|
||||||
|
lines[last_prod_idx] += ',' unless lines[last_prod_idx].end_with?(',')
|
||||||
|
lines.insert(last_prod_idx + 1, " #{product_str}")
|
||||||
|
puts "Added #{product} to CapApp-SPM target dependencies"
|
||||||
|
else
|
||||||
|
warn "WARNING: no .product( line found in #{CAP_APP_SPM} — cannot inject #{product}"
|
||||||
|
end
|
||||||
|
end
|
||||||
|
|
||||||
|
File.write(CAP_APP_SPM, lines.join("\n"))
|
||||||
|
puts "CapApp-SPM/Package.swift updated"
|
||||||
@@ -305,7 +305,7 @@
|
|||||||
);
|
);
|
||||||
MARKETING_VERSION = 1.0;
|
MARKETING_VERSION = 1.0;
|
||||||
OTHER_SWIFT_FLAGS = "$(inherited) \"-D\" \"COCOAPODS\" \"-DDEBUG\"";
|
OTHER_SWIFT_FLAGS = "$(inherited) \"-D\" \"COCOAPODS\" \"-DDEBUG\"";
|
||||||
PRODUCT_BUNDLE_IDENTIFIER = io.powerslap.app;
|
PRODUCT_BUNDLE_IDENTIFIER = io.flavorstudio.app;
|
||||||
PRODUCT_NAME = "$(TARGET_NAME)";
|
PRODUCT_NAME = "$(TARGET_NAME)";
|
||||||
SWIFT_ACTIVE_COMPILATION_CONDITIONS = DEBUG;
|
SWIFT_ACTIVE_COMPILATION_CONDITIONS = DEBUG;
|
||||||
SWIFT_VERSION = 5.0;
|
SWIFT_VERSION = 5.0;
|
||||||
@@ -326,7 +326,7 @@
|
|||||||
"@executable_path/Frameworks",
|
"@executable_path/Frameworks",
|
||||||
);
|
);
|
||||||
MARKETING_VERSION = 1.0;
|
MARKETING_VERSION = 1.0;
|
||||||
PRODUCT_BUNDLE_IDENTIFIER = io.powerslap.app;
|
PRODUCT_BUNDLE_IDENTIFIER = io.flavorstudio.app;
|
||||||
PRODUCT_NAME = "$(TARGET_NAME)";
|
PRODUCT_NAME = "$(TARGET_NAME)";
|
||||||
SWIFT_ACTIVE_COMPILATION_CONDITIONS = "";
|
SWIFT_ACTIVE_COMPILATION_CONDITIONS = "";
|
||||||
SWIFT_VERSION = 5.0;
|
SWIFT_VERSION = 5.0;
|
||||||
|
|||||||
@@ -0,0 +1,7 @@
|
|||||||
|
<?xml version="1.0" encoding="UTF-8"?>
|
||||||
|
<Workspace
|
||||||
|
version = "1.0">
|
||||||
|
<FileRef
|
||||||
|
location = "group:App.xcodeproj">
|
||||||
|
</FileRef>
|
||||||
|
</Workspace>
|
||||||
@@ -0,0 +1,8 @@
|
|||||||
|
<?xml version="1.0" encoding="UTF-8"?>
|
||||||
|
<!DOCTYPE plist PUBLIC "-//Apple//DTD PLIST 1.0//EN" "http://www.apple.com/DTDs/PropertyList-1.0.dtd">
|
||||||
|
<plist version="1.0">
|
||||||
|
<dict>
|
||||||
|
<key>IDEDidComputeMac32BitWarning</key>
|
||||||
|
<true/>
|
||||||
|
</dict>
|
||||||
|
</plist>
|
||||||
@@ -7,7 +7,7 @@
|
|||||||
<key>CFBundleDevelopmentRegion</key>
|
<key>CFBundleDevelopmentRegion</key>
|
||||||
<string>en</string>
|
<string>en</string>
|
||||||
<key>CFBundleDisplayName</key>
|
<key>CFBundleDisplayName</key>
|
||||||
<string>PowerSlap</string>
|
<string>FlavorStudio</string>
|
||||||
<key>CFBundleExecutable</key>
|
<key>CFBundleExecutable</key>
|
||||||
<string>$(EXECUTABLE_NAME)</string>
|
<string>$(EXECUTABLE_NAME)</string>
|
||||||
<key>CFBundleIdentifier</key>
|
<key>CFBundleIdentifier</key>
|
||||||
@@ -51,10 +51,10 @@
|
|||||||
<array>
|
<array>
|
||||||
<dict>
|
<dict>
|
||||||
<key>CFBundleURLName</key>
|
<key>CFBundleURLName</key>
|
||||||
<string>io.powerslap.app</string>
|
<string>io.flavorstudio.app</string>
|
||||||
<key>CFBundleURLSchemes</key>
|
<key>CFBundleURLSchemes</key>
|
||||||
<array>
|
<array>
|
||||||
<string>io.powerslap.app</string>
|
<string>io.flavorstudio.app</string>
|
||||||
</array>
|
</array>
|
||||||
</dict>
|
</dict>
|
||||||
</array>
|
</array>
|
||||||
|
|||||||
@@ -0,0 +1,363 @@
|
|||||||
|
workflows:
|
||||||
|
android-debug:
|
||||||
|
name: Android – Debug APK
|
||||||
|
max_build_duration: 45
|
||||||
|
instance_type: mac_mini_m2
|
||||||
|
environment:
|
||||||
|
node: 22
|
||||||
|
java: 21
|
||||||
|
cache:
|
||||||
|
cache_paths:
|
||||||
|
- $HOME/.gradle/caches
|
||||||
|
- $HOME/.gradle/wrapper
|
||||||
|
scripts:
|
||||||
|
- name: Strip unused scaffold packages
|
||||||
|
script: |
|
||||||
|
for pkg in "@capacitor/google-maps" "@capacitor/push-notifications" "@capacitor-firebase/authentication"; do
|
||||||
|
if ! grep -rq "$pkg" src/; then
|
||||||
|
node -e "const fs=require('fs'),p=JSON.parse(fs.readFileSync('package.json','utf8'));delete p.dependencies['${pkg}'];fs.writeFileSync('package.json',JSON.stringify(p,null,2));"
|
||||||
|
echo "Stripped $pkg (not used in src/)"
|
||||||
|
else
|
||||||
|
echo "Keeping $pkg (used in src/)"
|
||||||
|
fi
|
||||||
|
done
|
||||||
|
- name: Install dependencies
|
||||||
|
script: rm -f package-lock.json && npm install --legacy-peer-deps
|
||||||
|
- name: Build web assets
|
||||||
|
script: npm run build
|
||||||
|
- name: Write Firebase config
|
||||||
|
script: |
|
||||||
|
if [ -n "$GOOGLE_SERVICES_JSON" ]; then
|
||||||
|
echo "$GOOGLE_SERVICES_JSON" | base64 --decode > android/app/google-services.json
|
||||||
|
echo "Wrote google-services.json ($(wc -c < android/app/google-services.json) bytes)"
|
||||||
|
else
|
||||||
|
echo "GOOGLE_SERVICES_JSON is empty — skipping"
|
||||||
|
fi
|
||||||
|
if [ -n "$GOOGLE_SERVICE_INFO_PLIST" ]; then
|
||||||
|
echo "$GOOGLE_SERVICE_INFO_PLIST" | base64 --decode > ios/App/App/GoogleService-Info.plist
|
||||||
|
echo "Wrote GoogleService-Info.plist ($(wc -c < ios/App/App/GoogleService-Info.plist) bytes)"
|
||||||
|
fi
|
||||||
|
- name: Capacitor sync
|
||||||
|
script: npx cap sync android
|
||||||
|
- name: Set up debug keystore
|
||||||
|
script: |
|
||||||
|
if [ -n "$CM_DEBUG_KEYSTORE" ]; then
|
||||||
|
echo "$CM_DEBUG_KEYSTORE" | base64 --decode > /tmp/debug-keystore.p12
|
||||||
|
fi
|
||||||
|
- name: Build debug APK
|
||||||
|
script: |
|
||||||
|
cd android
|
||||||
|
if [ -n "$CM_DEBUG_KEYSTORE" ]; then
|
||||||
|
./gradlew assembleDebug \
|
||||||
|
-Pandroid.injected.signing.store.file=/tmp/debug-keystore.p12 \
|
||||||
|
-Pandroid.injected.signing.store.password=$CM_DEBUG_KEYSTORE_PASSWORD \
|
||||||
|
-Pandroid.injected.signing.key.alias=debug \
|
||||||
|
-Pandroid.injected.signing.key.password=$CM_DEBUG_KEYSTORE_PASSWORD \
|
||||||
|
--no-daemon
|
||||||
|
else
|
||||||
|
./gradlew assembleDebug --no-daemon
|
||||||
|
fi
|
||||||
|
artifacts:
|
||||||
|
- android/app/build/outputs/apk/debug/app-debug.apk
|
||||||
|
|
||||||
|
android-release-apk:
|
||||||
|
name: Android – Release APK
|
||||||
|
max_build_duration: 45
|
||||||
|
instance_type: mac_mini_m2
|
||||||
|
environment:
|
||||||
|
node: 22
|
||||||
|
java: 21
|
||||||
|
cache:
|
||||||
|
cache_paths:
|
||||||
|
- $HOME/.gradle/caches
|
||||||
|
- $HOME/.gradle/wrapper
|
||||||
|
scripts:
|
||||||
|
- name: Strip unused scaffold packages
|
||||||
|
script: |
|
||||||
|
for pkg in "@capacitor/google-maps" "@capacitor/push-notifications" "@capacitor-firebase/authentication"; do
|
||||||
|
if ! grep -rq "$pkg" src/; then
|
||||||
|
node -e "const fs=require('fs'),p=JSON.parse(fs.readFileSync('package.json','utf8'));delete p.dependencies['${pkg}'];fs.writeFileSync('package.json',JSON.stringify(p,null,2));"
|
||||||
|
echo "Stripped $pkg (not used in src/)"
|
||||||
|
else
|
||||||
|
echo "Keeping $pkg (used in src/)"
|
||||||
|
fi
|
||||||
|
done
|
||||||
|
- name: Install dependencies
|
||||||
|
script: rm -f package-lock.json && npm install --legacy-peer-deps
|
||||||
|
- name: Build web assets
|
||||||
|
script: npm run build
|
||||||
|
- name: Write Firebase config
|
||||||
|
script: |
|
||||||
|
if [ -n "$GOOGLE_SERVICES_JSON" ]; then
|
||||||
|
echo "$GOOGLE_SERVICES_JSON" | base64 --decode > android/app/google-services.json
|
||||||
|
fi
|
||||||
|
- name: Capacitor sync
|
||||||
|
script: npx cap sync android
|
||||||
|
- name: Set up keystore
|
||||||
|
script: echo "$CM_KEYSTORE" | base64 --decode > /tmp/keystore.jks
|
||||||
|
- name: Build Release APK
|
||||||
|
script: |
|
||||||
|
cd android
|
||||||
|
./gradlew assembleRelease \
|
||||||
|
-Pandroid.injected.signing.store.file=/tmp/keystore.jks \
|
||||||
|
-Pandroid.injected.signing.store.password=$CM_KEYSTORE_PASSWORD \
|
||||||
|
-Pandroid.injected.signing.key.alias=$CM_KEY_ALIAS \
|
||||||
|
-Pandroid.injected.signing.key.password=$CM_KEY_PASSWORD \
|
||||||
|
--no-daemon
|
||||||
|
artifacts:
|
||||||
|
- android/app/build/outputs/apk/release/app-release.apk
|
||||||
|
|
||||||
|
android-release-aab:
|
||||||
|
name: Android – Release AAB
|
||||||
|
max_build_duration: 45
|
||||||
|
instance_type: mac_mini_m2
|
||||||
|
environment:
|
||||||
|
node: 22
|
||||||
|
java: 21
|
||||||
|
cache:
|
||||||
|
cache_paths:
|
||||||
|
- $HOME/.gradle/caches
|
||||||
|
- $HOME/.gradle/wrapper
|
||||||
|
scripts:
|
||||||
|
- name: Strip unused scaffold packages
|
||||||
|
script: |
|
||||||
|
for pkg in "@capacitor/google-maps" "@capacitor/push-notifications" "@capacitor-firebase/authentication"; do
|
||||||
|
if ! grep -rq "$pkg" src/; then
|
||||||
|
node -e "const fs=require('fs'),p=JSON.parse(fs.readFileSync('package.json','utf8'));delete p.dependencies['${pkg}'];fs.writeFileSync('package.json',JSON.stringify(p,null,2));"
|
||||||
|
echo "Stripped $pkg (not used in src/)"
|
||||||
|
else
|
||||||
|
echo "Keeping $pkg (used in src/)"
|
||||||
|
fi
|
||||||
|
done
|
||||||
|
- name: Install dependencies
|
||||||
|
script: rm -f package-lock.json && npm install --legacy-peer-deps
|
||||||
|
- name: Build web assets
|
||||||
|
script: npm run build
|
||||||
|
- name: Write Firebase config
|
||||||
|
script: |
|
||||||
|
if [ -n "$GOOGLE_SERVICES_JSON" ]; then
|
||||||
|
echo "$GOOGLE_SERVICES_JSON" | base64 --decode > android/app/google-services.json
|
||||||
|
fi
|
||||||
|
- name: Capacitor sync
|
||||||
|
script: npx cap sync android
|
||||||
|
- name: Set up keystore
|
||||||
|
script: echo "$CM_KEYSTORE" | base64 --decode > /tmp/keystore.jks
|
||||||
|
- name: Build Release AAB
|
||||||
|
script: |
|
||||||
|
cd android
|
||||||
|
./gradlew bundleRelease \
|
||||||
|
-Pandroid.injected.signing.store.file=/tmp/keystore.jks \
|
||||||
|
-Pandroid.injected.signing.store.password=$CM_KEYSTORE_PASSWORD \
|
||||||
|
-Pandroid.injected.signing.key.alias=$CM_KEY_ALIAS \
|
||||||
|
-Pandroid.injected.signing.key.password=$CM_KEY_PASSWORD \
|
||||||
|
--no-daemon
|
||||||
|
artifacts:
|
||||||
|
- android/app/build/outputs/bundle/release/app-release.aab
|
||||||
|
|
||||||
|
android-release:
|
||||||
|
name: Android – Publish to Google Play
|
||||||
|
max_build_duration: 60
|
||||||
|
instance_type: mac_mini_m2
|
||||||
|
environment:
|
||||||
|
node: 22
|
||||||
|
java: 21
|
||||||
|
cache:
|
||||||
|
cache_paths:
|
||||||
|
- $HOME/.gradle/caches
|
||||||
|
- $HOME/.gradle/wrapper
|
||||||
|
scripts:
|
||||||
|
- name: Strip unused scaffold packages
|
||||||
|
script: |
|
||||||
|
for pkg in "@capacitor/google-maps" "@capacitor/push-notifications" "@capacitor-firebase/authentication"; do
|
||||||
|
if ! grep -rq "$pkg" src/; then
|
||||||
|
node -e "const fs=require('fs'),p=JSON.parse(fs.readFileSync('package.json','utf8'));delete p.dependencies['${pkg}'];fs.writeFileSync('package.json',JSON.stringify(p,null,2));"
|
||||||
|
echo "Stripped $pkg (not used in src/)"
|
||||||
|
else
|
||||||
|
echo "Keeping $pkg (used in src/)"
|
||||||
|
fi
|
||||||
|
done
|
||||||
|
- name: Install dependencies
|
||||||
|
script: rm -f package-lock.json && npm install --legacy-peer-deps
|
||||||
|
- name: Build web assets
|
||||||
|
script: npm run build
|
||||||
|
- name: Write Firebase config
|
||||||
|
script: |
|
||||||
|
if [ -n "$GOOGLE_SERVICES_JSON" ]; then
|
||||||
|
echo "$GOOGLE_SERVICES_JSON" | base64 --decode > android/app/google-services.json
|
||||||
|
fi
|
||||||
|
- name: Capacitor sync
|
||||||
|
script: npx cap sync android
|
||||||
|
- name: Set up keystore
|
||||||
|
script: echo "$CM_KEYSTORE" | base64 --decode > /tmp/keystore.jks
|
||||||
|
- name: Build Release AAB
|
||||||
|
script: |
|
||||||
|
cd android
|
||||||
|
./gradlew bundleRelease \
|
||||||
|
-Pandroid.injected.signing.store.file=/tmp/keystore.jks \
|
||||||
|
-Pandroid.injected.signing.store.password=$CM_KEYSTORE_PASSWORD \
|
||||||
|
-Pandroid.injected.signing.key.alias=$CM_KEY_ALIAS \
|
||||||
|
-Pandroid.injected.signing.key.password=$CM_KEY_PASSWORD \
|
||||||
|
--no-daemon
|
||||||
|
publishing:
|
||||||
|
google_play:
|
||||||
|
credentials: $GOOGLE_PLAY_SERVICE_ACCOUNT_CREDENTIALS
|
||||||
|
track: $GOOGLE_PLAY_TRACK
|
||||||
|
submit_as_draft: false
|
||||||
|
artifacts:
|
||||||
|
- android/app/build/outputs/bundle/release/app-release.aab
|
||||||
|
|
||||||
|
ios-debug:
|
||||||
|
name: iOS – Debug IPA
|
||||||
|
max_build_duration: 60
|
||||||
|
instance_type: mac_mini_m2
|
||||||
|
environment:
|
||||||
|
node: 22
|
||||||
|
xcode: latest
|
||||||
|
scripts:
|
||||||
|
- name: Strip unused scaffold packages
|
||||||
|
script: |
|
||||||
|
for pkg in "@capacitor/google-maps" "@capacitor/push-notifications" "@capacitor-firebase/authentication"; do
|
||||||
|
if ! grep -rq "$pkg" src/; then
|
||||||
|
node -e "const fs=require('fs'),p=JSON.parse(fs.readFileSync('package.json','utf8'));delete p.dependencies['${pkg}'];fs.writeFileSync('package.json',JSON.stringify(p,null,2));"
|
||||||
|
echo "Stripped $pkg (not used in src/)"
|
||||||
|
else
|
||||||
|
echo "Keeping $pkg (used in src/)"
|
||||||
|
fi
|
||||||
|
done
|
||||||
|
- name: Install dependencies
|
||||||
|
script: rm -f package-lock.json && npm install --legacy-peer-deps
|
||||||
|
- name: Build web assets
|
||||||
|
script: npm run build
|
||||||
|
- name: Capacitor sync
|
||||||
|
script: npx cap sync ios
|
||||||
|
- name: Write Firebase config
|
||||||
|
script: |
|
||||||
|
if [ -n "$GOOGLE_SERVICE_INFO_PLIST" ]; then
|
||||||
|
echo "$GOOGLE_SERVICE_INFO_PLIST" | base64 --decode > ios/App/App/GoogleService-Info.plist
|
||||||
|
ruby -e "
|
||||||
|
require 'xcodeproj'
|
||||||
|
project = Xcodeproj::Project.open('ios/App/App.xcodeproj')
|
||||||
|
target = project.targets.find { |t| t.name == 'App' }
|
||||||
|
app_group = project.main_group['App']
|
||||||
|
unless app_group.files.find { |f| f.path == 'GoogleService-Info.plist' }
|
||||||
|
file_ref = app_group.new_reference('GoogleService-Info.plist')
|
||||||
|
target.resources_build_phase.add_file_reference(file_ref)
|
||||||
|
project.save
|
||||||
|
end
|
||||||
|
"
|
||||||
|
fi
|
||||||
|
- name: Capacitor sync
|
||||||
|
script: npx cap sync ios
|
||||||
|
- name: Set up signing
|
||||||
|
script: |
|
||||||
|
keychain initialize
|
||||||
|
if [ -n "$APP_STORE_CONNECT_PRIVATE_KEY" ]; then
|
||||||
|
app-store-connect fetch-signing-files \
|
||||||
|
$(xcode-project detect-bundle-id) \
|
||||||
|
--type IOS_APP_DEVELOPMENT \
|
||||||
|
--certificate-key=@env:APP_STORE_CONNECT_PRIVATE_KEY \
|
||||||
|
--issuer-id=$APP_STORE_CONNECT_ISSUER_ID \
|
||||||
|
--key-id=$APP_STORE_CONNECT_KEY_IDENTIFIER \
|
||||||
|
--create
|
||||||
|
xcode-project use-profiles
|
||||||
|
elif [ -n "$CM_CERTIFICATE" ]; then
|
||||||
|
echo "$CM_CERTIFICATE" | base64 --decode > /tmp/cert.p12
|
||||||
|
keychain add-certificates \
|
||||||
|
--certificate /tmp/cert.p12 \
|
||||||
|
--certificate-password "$CM_CERTIFICATE_PASSWORD"
|
||||||
|
mkdir -p "$HOME/Library/MobileDevice/Provisioning Profiles"
|
||||||
|
echo "$CM_PROVISIONING_PROFILE" | base64 --decode > "$HOME/Library/MobileDevice/Provisioning Profiles/profile.mobileprovision"
|
||||||
|
xcode-project use-profiles
|
||||||
|
else
|
||||||
|
echo "No signing credentials configured — build will fail at signing"
|
||||||
|
exit 1
|
||||||
|
fi
|
||||||
|
- name: Build IPA
|
||||||
|
script: |
|
||||||
|
xcode-project build-ipa \
|
||||||
|
--workspace ios/App/App.xcworkspace \
|
||||||
|
--scheme App
|
||||||
|
artifacts:
|
||||||
|
- build/ios/ipa/*.ipa
|
||||||
|
|
||||||
|
ios-release:
|
||||||
|
name: iOS – Release IPA
|
||||||
|
max_build_duration: 90
|
||||||
|
instance_type: mac_mini_m2
|
||||||
|
environment:
|
||||||
|
node: 22
|
||||||
|
xcode: latest
|
||||||
|
scripts:
|
||||||
|
- name: Strip unused scaffold packages
|
||||||
|
script: |
|
||||||
|
for pkg in "@capacitor/google-maps" "@capacitor/push-notifications" "@capacitor-firebase/authentication"; do
|
||||||
|
if ! grep -rq "$pkg" src/; then
|
||||||
|
node -e "const fs=require('fs'),p=JSON.parse(fs.readFileSync('package.json','utf8'));delete p.dependencies['${pkg}'];fs.writeFileSync('package.json',JSON.stringify(p,null,2));"
|
||||||
|
echo "Stripped $pkg (not used in src/)"
|
||||||
|
else
|
||||||
|
echo "Keeping $pkg (used in src/)"
|
||||||
|
fi
|
||||||
|
done
|
||||||
|
- name: Install dependencies
|
||||||
|
script: rm -f package-lock.json && npm install --legacy-peer-deps
|
||||||
|
- name: Build web assets
|
||||||
|
script: npm run build
|
||||||
|
- name: Capacitor sync
|
||||||
|
script: npx cap sync ios
|
||||||
|
- name: Write Firebase config
|
||||||
|
script: |
|
||||||
|
if [ -n "$GOOGLE_SERVICE_INFO_PLIST" ]; then
|
||||||
|
echo "$GOOGLE_SERVICE_INFO_PLIST" | base64 --decode > ios/App/App/GoogleService-Info.plist
|
||||||
|
ruby -e "
|
||||||
|
require 'xcodeproj'
|
||||||
|
project = Xcodeproj::Project.open('ios/App/App.xcodeproj')
|
||||||
|
target = project.targets.find { |t| t.name == 'App' }
|
||||||
|
app_group = project.main_group['App']
|
||||||
|
unless app_group.files.find { |f| f.path == 'GoogleService-Info.plist' }
|
||||||
|
file_ref = app_group.new_reference('GoogleService-Info.plist')
|
||||||
|
target.resources_build_phase.add_file_reference(file_ref)
|
||||||
|
project.save
|
||||||
|
end
|
||||||
|
"
|
||||||
|
fi
|
||||||
|
- name: Capacitor sync
|
||||||
|
script: npx cap sync ios
|
||||||
|
- name: Set up signing
|
||||||
|
script: |
|
||||||
|
keychain initialize
|
||||||
|
if [ -n "$APP_STORE_CONNECT_PRIVATE_KEY" ]; then
|
||||||
|
app-store-connect fetch-signing-files \
|
||||||
|
$(xcode-project detect-bundle-id) \
|
||||||
|
--type IOS_APP_STORE \
|
||||||
|
--certificate-key=@env:APP_STORE_CONNECT_PRIVATE_KEY \
|
||||||
|
--issuer-id=$APP_STORE_CONNECT_ISSUER_ID \
|
||||||
|
--key-id=$APP_STORE_CONNECT_KEY_IDENTIFIER \
|
||||||
|
--create
|
||||||
|
xcode-project use-profiles
|
||||||
|
else
|
||||||
|
echo "$CM_CERTIFICATE" | base64 --decode > /tmp/cert.p12
|
||||||
|
keychain add-certificates \
|
||||||
|
--certificate /tmp/cert.p12 \
|
||||||
|
--certificate-password "$CM_CERTIFICATE_PASSWORD"
|
||||||
|
mkdir -p "$HOME/Library/MobileDevice/Provisioning Profiles"
|
||||||
|
echo "$CM_PROVISIONING_PROFILE" | base64 --decode > "$HOME/Library/MobileDevice/Provisioning Profiles/profile.mobileprovision"
|
||||||
|
xcode-project use-profiles
|
||||||
|
fi
|
||||||
|
- name: Build IPA
|
||||||
|
script: |
|
||||||
|
xcode-project build-ipa \
|
||||||
|
--workspace ios/App/App.xcworkspace \
|
||||||
|
--scheme App \
|
||||||
|
--config Release
|
||||||
|
- name: Publish
|
||||||
|
script: |
|
||||||
|
if [ "$SUBMIT_TO_TESTFLIGHT" = "true" ] || [ "$SUBMIT_TO_APP_STORE" = "true" ]; then
|
||||||
|
app-store-connect publish \
|
||||||
|
--certificate-key=@env:APP_STORE_CONNECT_PRIVATE_KEY \
|
||||||
|
--issuer-id=$APP_STORE_CONNECT_ISSUER_ID \
|
||||||
|
--key-id=$APP_STORE_CONNECT_KEY_IDENTIFIER \
|
||||||
|
--submit-to-testflight=$SUBMIT_TO_TESTFLIGHT \
|
||||||
|
--submit-to-app-store=$SUBMIT_TO_APP_STORE
|
||||||
|
fi
|
||||||
|
artifacts:
|
||||||
|
- build/ios/ipa/*.ipa
|
||||||
+3
-3
@@ -10,7 +10,7 @@
|
|||||||
"lint": "eslint"
|
"lint": "eslint"
|
||||||
},
|
},
|
||||||
"dependencies": {
|
"dependencies": {
|
||||||
"@capacitor-firebase/authentication": "^7.0.0",
|
"@capacitor-firebase/authentication": "^8.0.0",
|
||||||
"@capacitor/android": "8.3.4",
|
"@capacitor/android": "8.3.4",
|
||||||
"@capacitor/app": "8.1.0",
|
"@capacitor/app": "8.1.0",
|
||||||
"@capacitor/core": "8.3.4",
|
"@capacitor/core": "8.3.4",
|
||||||
@@ -21,8 +21,8 @@
|
|||||||
"@capacitor/push-notifications": "^8.1.1",
|
"@capacitor/push-notifications": "^8.1.1",
|
||||||
"@capacitor/status-bar": "8.0.2",
|
"@capacitor/status-bar": "8.0.2",
|
||||||
"@ionic/pwa-elements": "^3.0.0",
|
"@ionic/pwa-elements": "^3.0.0",
|
||||||
"@ionic/react": "^8.5.0",
|
"@ionic/react": "8.8.7",
|
||||||
"@ionic/react-router": "^8.5.0",
|
"@ionic/react-router": "8.8.7",
|
||||||
"@supabase/supabase-js": "^2.0.0",
|
"@supabase/supabase-js": "^2.0.0",
|
||||||
"firebase": "^11.0.0",
|
"firebase": "^11.0.0",
|
||||||
"ionicons": "^7.4.0",
|
"ionicons": "^7.4.0",
|
||||||
|
|||||||
+20
-18
@@ -1,29 +1,31 @@
|
|||||||
import React from "react";
|
import React from 'react';
|
||||||
import { Redirect, Route } from "react-router-dom";
|
import { Redirect, Route } from 'react-router-dom';
|
||||||
import { IonApp, IonRouterOutlet } from "@ionic/react";
|
import { IonApp, IonRouterOutlet } from '@ionic/react';
|
||||||
import { IonReactRouter } from "@ionic/react-router";
|
import { IonReactRouter } from '@ionic/react-router';
|
||||||
|
|
||||||
import "@ionic/react/css/core.css";
|
import '@ionic/react/css/core.css';
|
||||||
import "@ionic/react/css/normalize.css";
|
import '@ionic/react/css/normalize.css';
|
||||||
import "@ionic/react/css/structure.css";
|
import '@ionic/react/css/structure.css';
|
||||||
import "@ionic/react/css/typography.css";
|
import '@ionic/react/css/typography.css';
|
||||||
import "@ionic/react/css/padding.css";
|
import '@ionic/react/css/padding.css';
|
||||||
import "@ionic/react/css/float-elements.css";
|
import '@ionic/react/css/float-elements.css';
|
||||||
import "@ionic/react/css/text-alignment.css";
|
import '@ionic/react/css/text-alignment.css';
|
||||||
import "@ionic/react/css/text-transformation.css";
|
import '@ionic/react/css/text-transformation.css';
|
||||||
import "@ionic/react/css/flex-utils.css";
|
import '@ionic/react/css/flex-utils.css';
|
||||||
import "@ionic/react/css/display.css";
|
import '@ionic/react/css/display.css';
|
||||||
|
|
||||||
import "./theme/variables.css";
|
import './theme/variables.css';
|
||||||
|
|
||||||
import Home from "./pages/Home";
|
import Home from './pages/Home';
|
||||||
|
import HelloWorld from './pages/HelloWorld';
|
||||||
|
|
||||||
const App: React.FC = () => (
|
const App: React.FC = () => (
|
||||||
<IonApp>
|
<IonApp>
|
||||||
<IonReactRouter>
|
<IonReactRouter>
|
||||||
<IonRouterOutlet>
|
<IonRouterOutlet animated={true}>
|
||||||
<Route path="/home" component={Home} exact />
|
<Route path="/home" component={Home} exact />
|
||||||
<Redirect exact from="/" to="/home" />
|
<Route path="/hello-world" component={HelloWorld} exact />
|
||||||
|
<Route exact path="/" render={() => <Redirect to="/home" />} />
|
||||||
</IonRouterOutlet>
|
</IonRouterOutlet>
|
||||||
</IonReactRouter>
|
</IonReactRouter>
|
||||||
</IonApp>
|
</IonApp>
|
||||||
|
|||||||
@@ -0,0 +1,90 @@
|
|||||||
|
import React from 'react';
|
||||||
|
import {
|
||||||
|
IonButton,
|
||||||
|
IonButtons,
|
||||||
|
IonContent,
|
||||||
|
IonHeader,
|
||||||
|
IonIcon,
|
||||||
|
IonPage,
|
||||||
|
IonTitle,
|
||||||
|
IonToolbar,
|
||||||
|
} from '@ionic/react';
|
||||||
|
import { chevronBackOutline, globeOutline } from 'ionicons/icons';
|
||||||
|
import { useHistory } from 'react-router-dom';
|
||||||
|
|
||||||
|
const HelloWorld: React.FC = () => {
|
||||||
|
const history = useHistory();
|
||||||
|
|
||||||
|
return (
|
||||||
|
<IonPage>
|
||||||
|
<IonHeader>
|
||||||
|
<IonToolbar>
|
||||||
|
<IonButtons slot="start">
|
||||||
|
<IonButton aria-label="Back" onClick={() => history.goBack()}>
|
||||||
|
<IonIcon icon={chevronBackOutline} slot="icon-only" />
|
||||||
|
</IonButton>
|
||||||
|
</IonButtons>
|
||||||
|
<IonTitle>Hello World</IonTitle>
|
||||||
|
</IonToolbar>
|
||||||
|
</IonHeader>
|
||||||
|
<IonContent
|
||||||
|
className="ion-padding"
|
||||||
|
style={
|
||||||
|
{ '--background': 'var(--ion-color-light)' } as React.CSSProperties
|
||||||
|
}
|
||||||
|
>
|
||||||
|
<div
|
||||||
|
style={{
|
||||||
|
minHeight: '70vh',
|
||||||
|
display: 'flex',
|
||||||
|
flexDirection: 'column',
|
||||||
|
alignItems: 'center',
|
||||||
|
justifyContent: 'center',
|
||||||
|
textAlign: 'center',
|
||||||
|
gap: 16,
|
||||||
|
}}
|
||||||
|
>
|
||||||
|
<div
|
||||||
|
style={{
|
||||||
|
width: 72,
|
||||||
|
height: 72,
|
||||||
|
borderRadius: 24,
|
||||||
|
background: 'rgba(var(--ion-color-primary-rgb), 0.12)',
|
||||||
|
display: 'flex',
|
||||||
|
alignItems: 'center',
|
||||||
|
justifyContent: 'center',
|
||||||
|
}}
|
||||||
|
>
|
||||||
|
<IonIcon
|
||||||
|
icon={globeOutline}
|
||||||
|
style={{ fontSize: 36, color: 'var(--ion-color-primary)' }}
|
||||||
|
/>
|
||||||
|
</div>
|
||||||
|
<div>
|
||||||
|
<h1
|
||||||
|
style={{
|
||||||
|
margin: '0 0 8px',
|
||||||
|
fontSize: 28,
|
||||||
|
fontWeight: 700,
|
||||||
|
color: 'var(--ion-color-dark)',
|
||||||
|
}}
|
||||||
|
>
|
||||||
|
Hello, world!
|
||||||
|
</h1>
|
||||||
|
<p
|
||||||
|
style={{
|
||||||
|
margin: 0,
|
||||||
|
color: 'var(--ion-color-medium)',
|
||||||
|
lineHeight: 1.5,
|
||||||
|
}}
|
||||||
|
>
|
||||||
|
You made it to the new page.
|
||||||
|
</p>
|
||||||
|
</div>
|
||||||
|
</div>
|
||||||
|
</IonContent>
|
||||||
|
</IonPage>
|
||||||
|
);
|
||||||
|
};
|
||||||
|
|
||||||
|
export default HelloWorld;
|
||||||
+672
-13
@@ -1,23 +1,682 @@
|
|||||||
import React from 'react';
|
import React, { useEffect, useRef, useState } from 'react';
|
||||||
import {
|
import {
|
||||||
|
IonButton,
|
||||||
IonContent,
|
IonContent,
|
||||||
IonHeader,
|
IonIcon,
|
||||||
IonPage,
|
IonPage,
|
||||||
IonTitle,
|
IonSpinner,
|
||||||
IonToolbar,
|
useIonViewDidEnter,
|
||||||
|
useIonViewWillLeave,
|
||||||
} from '@ionic/react';
|
} from '@ionic/react';
|
||||||
|
import { GoogleMap } from '@capacitor/google-maps';
|
||||||
|
import type {
|
||||||
|
GoogleMap as GoogleMapInstance,
|
||||||
|
Marker,
|
||||||
|
} from '@capacitor/google-maps';
|
||||||
|
import {
|
||||||
|
closeOutline,
|
||||||
|
locateOutline,
|
||||||
|
mapOutline,
|
||||||
|
searchOutline,
|
||||||
|
} from 'ionicons/icons';
|
||||||
|
import { supabase } from '../supabase';
|
||||||
|
|
||||||
const Home: React.FC = () => (
|
const DEFAULT_CENTER = { lat: 37.7749, lng: -122.4194 };
|
||||||
<IonPage>
|
const HOME_MARKER: Marker = {
|
||||||
<IonHeader>
|
coordinate: DEFAULT_CENTER,
|
||||||
<IonToolbar>
|
title: 'San Francisco',
|
||||||
<IonTitle>Home</IonTitle>
|
snippet: 'Start searching for nearby places',
|
||||||
</IonToolbar>
|
};
|
||||||
</IonHeader>
|
|
||||||
<IonContent className="ion-padding">
|
type PlaceSuggestion = {
|
||||||
<p>Welcome! Start building your app here.</p>
|
placeId: string;
|
||||||
|
text: string;
|
||||||
|
mainText: string;
|
||||||
|
secondaryText: string;
|
||||||
|
};
|
||||||
|
|
||||||
|
type Coordinate = {
|
||||||
|
lat: number;
|
||||||
|
lng: number;
|
||||||
|
};
|
||||||
|
|
||||||
|
type SelectedPlace = {
|
||||||
|
placeId: string;
|
||||||
|
name: string;
|
||||||
|
address: string;
|
||||||
|
coordinate: Coordinate;
|
||||||
|
photoUrl?: string | null;
|
||||||
|
};
|
||||||
|
|
||||||
|
const getErrorDetails = (error: unknown) => {
|
||||||
|
if (error instanceof Error) {
|
||||||
|
return error.message;
|
||||||
|
}
|
||||||
|
|
||||||
|
if (typeof error === 'string') {
|
||||||
|
return error;
|
||||||
|
}
|
||||||
|
|
||||||
|
try {
|
||||||
|
return JSON.stringify(error);
|
||||||
|
} catch {
|
||||||
|
return 'Unknown error';
|
||||||
|
}
|
||||||
|
};
|
||||||
|
|
||||||
|
const waitForFrame = () =>
|
||||||
|
new Promise<void>((resolve) => {
|
||||||
|
requestAnimationFrame(() => resolve());
|
||||||
|
});
|
||||||
|
|
||||||
|
const wait = (ms: number) =>
|
||||||
|
new Promise<void>((resolve) => {
|
||||||
|
window.setTimeout(resolve, ms);
|
||||||
|
});
|
||||||
|
|
||||||
|
const createSessionToken = () => {
|
||||||
|
if (typeof crypto !== 'undefined' && 'randomUUID' in crypto) {
|
||||||
|
return crypto.randomUUID();
|
||||||
|
}
|
||||||
|
|
||||||
|
return `${Date.now()}-${Math.random().toString(36).slice(2)}`;
|
||||||
|
};
|
||||||
|
|
||||||
|
const Home: React.FC = () => {
|
||||||
|
const mapContainerRef = useRef<HTMLDivElement>(null);
|
||||||
|
const mapRef = useRef<GoogleMapInstance | null>(null);
|
||||||
|
const mapIdRef = useRef(`home-map-${createSessionToken()}`);
|
||||||
|
const markerIdsRef = useRef<string[]>([]);
|
||||||
|
const isActiveRef = useRef(false);
|
||||||
|
const searchRequestRef = useRef(0);
|
||||||
|
const sessionTokenRef = useRef(createSessionToken());
|
||||||
|
const selectedPlaceRef = useRef<SelectedPlace | null>(null);
|
||||||
|
const suppressNextSearchRef = useRef(false);
|
||||||
|
|
||||||
|
const [mapError, setMapError] = useState<string | null>(null);
|
||||||
|
const [query, setQuery] = useState('');
|
||||||
|
const [suggestions, setSuggestions] = useState<PlaceSuggestion[]>([]);
|
||||||
|
const [showSuggestions, setShowSuggestions] = useState(false);
|
||||||
|
const [searchLoading, setSearchLoading] = useState(false);
|
||||||
|
const [detailsLoading, setDetailsLoading] = useState(false);
|
||||||
|
const [selectedPlace, setSelectedPlace] = useState<SelectedPlace | null>(
|
||||||
|
null
|
||||||
|
);
|
||||||
|
|
||||||
|
const clearMarkers = async (map: GoogleMapInstance) => {
|
||||||
|
const markerIds = markerIdsRef.current;
|
||||||
|
if (markerIds.length === 0) return;
|
||||||
|
|
||||||
|
markerIdsRef.current = [];
|
||||||
|
|
||||||
|
try {
|
||||||
|
await map.removeMarkers(markerIds);
|
||||||
|
} catch (error) {
|
||||||
|
console.warn('Failed to remove Google Map markers', error);
|
||||||
|
}
|
||||||
|
};
|
||||||
|
|
||||||
|
const addMarkerSafely = async (map: GoogleMapInstance, marker: Marker) => {
|
||||||
|
await waitForFrame();
|
||||||
|
await wait(250);
|
||||||
|
|
||||||
|
if (!isActiveRef.current || mapRef.current !== map) return;
|
||||||
|
|
||||||
|
try {
|
||||||
|
await clearMarkers(map);
|
||||||
|
const markerId = await map.addMarker(marker);
|
||||||
|
markerIdsRef.current = [markerId];
|
||||||
|
setMapError(null);
|
||||||
|
} catch (firstError) {
|
||||||
|
const firstDetails = getErrorDetails(firstError);
|
||||||
|
console.warn('First Google Map marker attempt failed', firstError);
|
||||||
|
|
||||||
|
await wait(500);
|
||||||
|
|
||||||
|
if (!isActiveRef.current || mapRef.current !== map) return;
|
||||||
|
|
||||||
|
try {
|
||||||
|
await clearMarkers(map);
|
||||||
|
const markerId = await map.addMarker(marker);
|
||||||
|
markerIdsRef.current = [markerId];
|
||||||
|
setMapError(null);
|
||||||
|
} catch (retryError) {
|
||||||
|
const retryDetails = getErrorDetails(retryError);
|
||||||
|
console.error('Failed to add Google Map marker', retryError);
|
||||||
|
setMapError(
|
||||||
|
`Place selected, but the marker could not be added. First attempt: ${firstDetails}. Retry: ${retryDetails}`
|
||||||
|
);
|
||||||
|
}
|
||||||
|
}
|
||||||
|
};
|
||||||
|
|
||||||
|
useIonViewDidEnter(() => {
|
||||||
|
isActiveRef.current = true;
|
||||||
|
if (!mapContainerRef.current || mapRef.current) return;
|
||||||
|
|
||||||
|
const createMap = async () => {
|
||||||
|
const apiKey = import.meta.env.VITE_GOOGLE_MAPS_KEY as string;
|
||||||
|
if (!apiKey) {
|
||||||
|
setMapError(
|
||||||
|
'Google Maps API key is missing. Add VITE_GOOGLE_MAPS_KEY in Config to view the map.'
|
||||||
|
);
|
||||||
|
return;
|
||||||
|
}
|
||||||
|
|
||||||
|
try {
|
||||||
|
const map = await GoogleMap.create({
|
||||||
|
id: mapIdRef.current,
|
||||||
|
element: mapContainerRef.current!,
|
||||||
|
apiKey,
|
||||||
|
config: {
|
||||||
|
center: DEFAULT_CENTER,
|
||||||
|
zoom: 12,
|
||||||
|
disableDefaultUI: true,
|
||||||
|
mapTypeControl: false,
|
||||||
|
streetViewControl: false,
|
||||||
|
fullscreenControl: false,
|
||||||
|
} as unknown as {
|
||||||
|
center: typeof DEFAULT_CENTER;
|
||||||
|
zoom: number;
|
||||||
|
},
|
||||||
|
});
|
||||||
|
|
||||||
|
if (!isActiveRef.current) {
|
||||||
|
await map.destroy().catch((error) => {
|
||||||
|
console.warn('Failed to destroy inactive Google Map', error);
|
||||||
|
});
|
||||||
|
return;
|
||||||
|
}
|
||||||
|
|
||||||
|
mapRef.current = map;
|
||||||
|
setMapError(null);
|
||||||
|
await addMarkerSafely(map, HOME_MARKER);
|
||||||
|
} catch (error) {
|
||||||
|
const details = getErrorDetails(error);
|
||||||
|
console.error('Failed to load Google Map', error);
|
||||||
|
setMapError(`Unable to load the map: ${details}`);
|
||||||
|
}
|
||||||
|
};
|
||||||
|
|
||||||
|
createMap();
|
||||||
|
});
|
||||||
|
|
||||||
|
useIonViewWillLeave(() => {
|
||||||
|
isActiveRef.current = false;
|
||||||
|
searchRequestRef.current += 1;
|
||||||
|
|
||||||
|
const map = mapRef.current;
|
||||||
|
mapRef.current = null;
|
||||||
|
markerIdsRef.current = [];
|
||||||
|
|
||||||
|
if (!map) return;
|
||||||
|
|
||||||
|
map.destroy().catch((error) => {
|
||||||
|
console.warn('Failed to destroy Google Map', error);
|
||||||
|
});
|
||||||
|
});
|
||||||
|
|
||||||
|
useEffect(() => {
|
||||||
|
const trimmedQuery = query.trim();
|
||||||
|
|
||||||
|
if (suppressNextSearchRef.current) {
|
||||||
|
suppressNextSearchRef.current = false;
|
||||||
|
searchRequestRef.current += 1;
|
||||||
|
setSearchLoading(false);
|
||||||
|
return;
|
||||||
|
}
|
||||||
|
|
||||||
|
searchRequestRef.current += 1;
|
||||||
|
const requestId = searchRequestRef.current;
|
||||||
|
|
||||||
|
if (trimmedQuery.length < 2) {
|
||||||
|
setSuggestions([]);
|
||||||
|
setShowSuggestions(false);
|
||||||
|
setSearchLoading(false);
|
||||||
|
return;
|
||||||
|
}
|
||||||
|
|
||||||
|
setShowSuggestions(true);
|
||||||
|
setSearchLoading(true);
|
||||||
|
|
||||||
|
const timeout = window.setTimeout(async () => {
|
||||||
|
try {
|
||||||
|
const { data, error } = await supabase.functions.invoke<{
|
||||||
|
suggestions: PlaceSuggestion[];
|
||||||
|
error?: string;
|
||||||
|
}>('places-autocomplete', {
|
||||||
|
body: {
|
||||||
|
input: trimmedQuery,
|
||||||
|
sessionToken: sessionTokenRef.current,
|
||||||
|
latitude:
|
||||||
|
selectedPlaceRef.current?.coordinate.lat ?? DEFAULT_CENTER.lat,
|
||||||
|
longitude:
|
||||||
|
selectedPlaceRef.current?.coordinate.lng ?? DEFAULT_CENTER.lng,
|
||||||
|
},
|
||||||
|
});
|
||||||
|
|
||||||
|
if (requestId !== searchRequestRef.current) return;
|
||||||
|
|
||||||
|
if (error) {
|
||||||
|
throw error;
|
||||||
|
}
|
||||||
|
|
||||||
|
if (data?.error) {
|
||||||
|
throw new Error(data.error);
|
||||||
|
}
|
||||||
|
|
||||||
|
setSuggestions(data?.suggestions ?? []);
|
||||||
|
setShowSuggestions(true);
|
||||||
|
setMapError(null);
|
||||||
|
} catch (error) {
|
||||||
|
if (requestId !== searchRequestRef.current) return;
|
||||||
|
const details = getErrorDetails(error);
|
||||||
|
console.error('Places autocomplete failed', error);
|
||||||
|
setSuggestions([]);
|
||||||
|
setShowSuggestions(true);
|
||||||
|
setMapError(`Place search failed: ${details}`);
|
||||||
|
} finally {
|
||||||
|
if (requestId === searchRequestRef.current) {
|
||||||
|
setSearchLoading(false);
|
||||||
|
}
|
||||||
|
}
|
||||||
|
}, 350);
|
||||||
|
|
||||||
|
return () => {
|
||||||
|
window.clearTimeout(timeout);
|
||||||
|
};
|
||||||
|
}, [query]);
|
||||||
|
|
||||||
|
const recenterMap = async () => {
|
||||||
|
const map = mapRef.current;
|
||||||
|
if (!map) return;
|
||||||
|
|
||||||
|
const coordinate = selectedPlace?.coordinate ?? DEFAULT_CENTER;
|
||||||
|
|
||||||
|
try {
|
||||||
|
await map.setCamera({
|
||||||
|
coordinate,
|
||||||
|
zoom: selectedPlace ? 15 : 12,
|
||||||
|
animate: true,
|
||||||
|
});
|
||||||
|
setMapError(null);
|
||||||
|
} catch (error) {
|
||||||
|
const details = getErrorDetails(error);
|
||||||
|
console.error('Failed to recenter Google Map', error);
|
||||||
|
setMapError(`Map loaded, but recentering failed: ${details}`);
|
||||||
|
}
|
||||||
|
};
|
||||||
|
|
||||||
|
const selectSuggestion = async (suggestion: PlaceSuggestion) => {
|
||||||
|
const map = mapRef.current;
|
||||||
|
if (!map) return;
|
||||||
|
|
||||||
|
setDetailsLoading(true);
|
||||||
|
suppressNextSearchRef.current = true;
|
||||||
|
searchRequestRef.current += 1;
|
||||||
|
setQuery(suggestion.mainText || suggestion.text);
|
||||||
|
setSuggestions([]);
|
||||||
|
setShowSuggestions(false);
|
||||||
|
setSearchLoading(false);
|
||||||
|
|
||||||
|
try {
|
||||||
|
const { data, error } = await supabase.functions.invoke<{
|
||||||
|
place?: SelectedPlace;
|
||||||
|
error?: string;
|
||||||
|
}>('place-details', {
|
||||||
|
body: {
|
||||||
|
placeId: suggestion.placeId,
|
||||||
|
sessionToken: sessionTokenRef.current,
|
||||||
|
},
|
||||||
|
});
|
||||||
|
|
||||||
|
if (error) {
|
||||||
|
throw error;
|
||||||
|
}
|
||||||
|
|
||||||
|
if (data?.error) {
|
||||||
|
throw new Error(data.error);
|
||||||
|
}
|
||||||
|
|
||||||
|
if (!data?.place?.coordinate) {
|
||||||
|
throw new Error('Selected place does not include a map location.');
|
||||||
|
}
|
||||||
|
|
||||||
|
const place = data.place;
|
||||||
|
selectedPlaceRef.current = place;
|
||||||
|
setSelectedPlace(place);
|
||||||
|
sessionTokenRef.current = createSessionToken();
|
||||||
|
|
||||||
|
await map.setCamera({
|
||||||
|
coordinate: place.coordinate,
|
||||||
|
zoom: 15,
|
||||||
|
animate: true,
|
||||||
|
});
|
||||||
|
|
||||||
|
await addMarkerSafely(map, {
|
||||||
|
coordinate: place.coordinate,
|
||||||
|
title: place.name,
|
||||||
|
snippet: place.address,
|
||||||
|
});
|
||||||
|
} catch (error) {
|
||||||
|
const details = getErrorDetails(error);
|
||||||
|
console.error('Place selection failed', error);
|
||||||
|
setMapError(`Could not open that place: ${details}`);
|
||||||
|
} finally {
|
||||||
|
setDetailsLoading(false);
|
||||||
|
}
|
||||||
|
};
|
||||||
|
|
||||||
|
const clearSearch = () => {
|
||||||
|
searchRequestRef.current += 1;
|
||||||
|
suppressNextSearchRef.current = false;
|
||||||
|
setQuery('');
|
||||||
|
setSuggestions([]);
|
||||||
|
setShowSuggestions(false);
|
||||||
|
setSearchLoading(false);
|
||||||
|
};
|
||||||
|
|
||||||
|
return (
|
||||||
|
<IonPage style={{ background: 'transparent' }}>
|
||||||
|
<IonContent
|
||||||
|
fullscreen
|
||||||
|
style={{ '--background': 'transparent' } as React.CSSProperties}
|
||||||
|
>
|
||||||
|
<div
|
||||||
|
ref={mapContainerRef}
|
||||||
|
style={{
|
||||||
|
position: 'absolute',
|
||||||
|
inset: 0,
|
||||||
|
width: '100%',
|
||||||
|
height: '100%',
|
||||||
|
}}
|
||||||
|
/>
|
||||||
|
|
||||||
|
<div
|
||||||
|
slot="fixed"
|
||||||
|
style={{
|
||||||
|
left: 16,
|
||||||
|
right: 16,
|
||||||
|
top: 'calc(14px + var(--ion-safe-area-top))',
|
||||||
|
position: 'absolute',
|
||||||
|
zIndex: 10,
|
||||||
|
}}
|
||||||
|
>
|
||||||
|
<div
|
||||||
|
style={{
|
||||||
|
background: '#ffffff',
|
||||||
|
borderRadius: 22,
|
||||||
|
padding: '10px 12px',
|
||||||
|
display: 'flex',
|
||||||
|
alignItems: 'center',
|
||||||
|
gap: 10,
|
||||||
|
boxShadow: '0 10px 34px rgba(15, 23, 42, 0.18)',
|
||||||
|
}}
|
||||||
|
>
|
||||||
|
<IonIcon
|
||||||
|
icon={searchOutline}
|
||||||
|
style={{
|
||||||
|
fontSize: 22,
|
||||||
|
color: 'var(--ion-color-medium)',
|
||||||
|
flexShrink: 0,
|
||||||
|
}}
|
||||||
|
/>
|
||||||
|
<input
|
||||||
|
value={query}
|
||||||
|
onChange={(event) => {
|
||||||
|
suppressNextSearchRef.current = false;
|
||||||
|
setShowSuggestions(true);
|
||||||
|
setQuery(event.target.value);
|
||||||
|
}}
|
||||||
|
onFocus={() => {
|
||||||
|
if (suggestions.length > 0 || query.trim().length >= 2) {
|
||||||
|
setShowSuggestions(true);
|
||||||
|
}
|
||||||
|
}}
|
||||||
|
placeholder="Search places"
|
||||||
|
aria-label="Search places"
|
||||||
|
style={{
|
||||||
|
border: 0,
|
||||||
|
outline: 'none',
|
||||||
|
flex: 1,
|
||||||
|
minWidth: 0,
|
||||||
|
fontSize: 16,
|
||||||
|
color: 'var(--ion-color-dark)',
|
||||||
|
background: 'transparent',
|
||||||
|
}}
|
||||||
|
/>
|
||||||
|
{(searchLoading || detailsLoading) && (
|
||||||
|
<IonSpinner
|
||||||
|
name="crescent"
|
||||||
|
style={{ width: 20, height: 20, flexShrink: 0 }}
|
||||||
|
/>
|
||||||
|
)}
|
||||||
|
{query && !detailsLoading && (
|
||||||
|
<IonButton
|
||||||
|
fill="clear"
|
||||||
|
onClick={clearSearch}
|
||||||
|
aria-label="Clear search"
|
||||||
|
style={
|
||||||
|
{
|
||||||
|
'--border-radius': '999px',
|
||||||
|
'--padding-start': '6px',
|
||||||
|
'--padding-end': '6px',
|
||||||
|
width: 34,
|
||||||
|
height: 34,
|
||||||
|
flexShrink: 0,
|
||||||
|
} as React.CSSProperties
|
||||||
|
}
|
||||||
|
>
|
||||||
|
<IonIcon icon={closeOutline} slot="icon-only" />
|
||||||
|
</IonButton>
|
||||||
|
)}
|
||||||
|
</div>
|
||||||
|
|
||||||
|
{showSuggestions &&
|
||||||
|
query.trim().length >= 2 &&
|
||||||
|
!searchLoading &&
|
||||||
|
suggestions.length === 0 &&
|
||||||
|
!detailsLoading && (
|
||||||
|
<div
|
||||||
|
style={{
|
||||||
|
marginTop: 10,
|
||||||
|
background: '#ffffff',
|
||||||
|
borderRadius: 18,
|
||||||
|
padding: '14px 16px',
|
||||||
|
color: 'var(--ion-color-medium)',
|
||||||
|
fontSize: 14,
|
||||||
|
boxShadow: '0 10px 28px rgba(15, 23, 42, 0.14)',
|
||||||
|
}}
|
||||||
|
>
|
||||||
|
No places found.
|
||||||
|
</div>
|
||||||
|
)}
|
||||||
|
|
||||||
|
{showSuggestions && suggestions.length > 0 && (
|
||||||
|
<div
|
||||||
|
style={{
|
||||||
|
marginTop: 10,
|
||||||
|
background: '#ffffff',
|
||||||
|
borderRadius: 20,
|
||||||
|
overflow: 'hidden',
|
||||||
|
boxShadow: '0 10px 28px rgba(15, 23, 42, 0.14)',
|
||||||
|
}}
|
||||||
|
>
|
||||||
|
{suggestions.map((suggestion) => (
|
||||||
|
<button
|
||||||
|
key={suggestion.placeId}
|
||||||
|
type="button"
|
||||||
|
onClick={() => selectSuggestion(suggestion)}
|
||||||
|
style={{
|
||||||
|
width: '100%',
|
||||||
|
border: 0,
|
||||||
|
background: '#ffffff',
|
||||||
|
padding: '14px 16px',
|
||||||
|
display: 'flex',
|
||||||
|
gap: 12,
|
||||||
|
textAlign: 'left',
|
||||||
|
borderBottom: '1px solid rgba(15, 23, 42, 0.08)',
|
||||||
|
}}
|
||||||
|
>
|
||||||
|
<IonIcon
|
||||||
|
icon={mapOutline}
|
||||||
|
style={{
|
||||||
|
color: 'var(--ion-color-primary)',
|
||||||
|
fontSize: 20,
|
||||||
|
marginTop: 1,
|
||||||
|
flexShrink: 0,
|
||||||
|
}}
|
||||||
|
/>
|
||||||
|
<span style={{ minWidth: 0 }}>
|
||||||
|
<strong
|
||||||
|
style={{
|
||||||
|
display: 'block',
|
||||||
|
color: 'var(--ion-color-dark)',
|
||||||
|
fontSize: 14,
|
||||||
|
fontWeight: 700,
|
||||||
|
overflow: 'hidden',
|
||||||
|
textOverflow: 'ellipsis',
|
||||||
|
whiteSpace: 'nowrap',
|
||||||
|
}}
|
||||||
|
>
|
||||||
|
{suggestion.mainText || suggestion.text}
|
||||||
|
</strong>
|
||||||
|
{suggestion.secondaryText && (
|
||||||
|
<span
|
||||||
|
style={{
|
||||||
|
display: 'block',
|
||||||
|
marginTop: 3,
|
||||||
|
color: 'var(--ion-color-medium)',
|
||||||
|
fontSize: 12,
|
||||||
|
overflow: 'hidden',
|
||||||
|
textOverflow: 'ellipsis',
|
||||||
|
whiteSpace: 'nowrap',
|
||||||
|
}}
|
||||||
|
>
|
||||||
|
{suggestion.secondaryText}
|
||||||
|
</span>
|
||||||
|
)}
|
||||||
|
</span>
|
||||||
|
</button>
|
||||||
|
))}
|
||||||
|
</div>
|
||||||
|
)}
|
||||||
|
</div>
|
||||||
|
|
||||||
|
<div
|
||||||
|
slot="fixed"
|
||||||
|
style={{
|
||||||
|
left: 16,
|
||||||
|
right: 16,
|
||||||
|
bottom: 'calc(16px + var(--ion-safe-area-bottom))',
|
||||||
|
position: 'absolute',
|
||||||
|
zIndex: 9,
|
||||||
|
}}
|
||||||
|
>
|
||||||
|
<div
|
||||||
|
style={{
|
||||||
|
background: '#ffffff',
|
||||||
|
borderRadius: 24,
|
||||||
|
padding: 20,
|
||||||
|
display: 'flex',
|
||||||
|
alignItems: 'center',
|
||||||
|
gap: 16,
|
||||||
|
boxShadow: '0 -8px 32px rgba(15, 23, 42, 0.14)',
|
||||||
|
}}
|
||||||
|
>
|
||||||
|
<div
|
||||||
|
style={{
|
||||||
|
width: selectedPlace?.photoUrl ? 72 : 44,
|
||||||
|
height: selectedPlace?.photoUrl ? 72 : 44,
|
||||||
|
borderRadius: selectedPlace?.photoUrl ? 18 : 14,
|
||||||
|
background: 'rgba(var(--ion-color-primary-rgb), 0.12)',
|
||||||
|
display: 'flex',
|
||||||
|
alignItems: 'center',
|
||||||
|
justifyContent: 'center',
|
||||||
|
flexShrink: 0,
|
||||||
|
overflow: 'hidden',
|
||||||
|
}}
|
||||||
|
>
|
||||||
|
{selectedPlace?.photoUrl ? (
|
||||||
|
<img
|
||||||
|
src={selectedPlace.photoUrl}
|
||||||
|
alt={selectedPlace.name}
|
||||||
|
style={{
|
||||||
|
width: '100%',
|
||||||
|
height: '100%',
|
||||||
|
objectFit: 'cover',
|
||||||
|
display: 'block',
|
||||||
|
}}
|
||||||
|
/>
|
||||||
|
) : (
|
||||||
|
<IonIcon
|
||||||
|
icon={mapOutline}
|
||||||
|
style={{ fontSize: 22, color: 'var(--ion-color-primary)' }}
|
||||||
|
/>
|
||||||
|
)}
|
||||||
|
</div>
|
||||||
|
<div style={{ flex: 1, minWidth: 0 }}>
|
||||||
|
<h1
|
||||||
|
style={{
|
||||||
|
margin: '0 0 4px',
|
||||||
|
fontSize: 18,
|
||||||
|
fontWeight: 700,
|
||||||
|
color: 'var(--ion-color-dark)',
|
||||||
|
overflow: 'hidden',
|
||||||
|
textOverflow: 'ellipsis',
|
||||||
|
whiteSpace: 'nowrap',
|
||||||
|
}}
|
||||||
|
>
|
||||||
|
{selectedPlace?.name ?? 'Explore the map'}
|
||||||
|
</h1>
|
||||||
|
<p
|
||||||
|
style={{
|
||||||
|
margin: 0,
|
||||||
|
color: 'var(--ion-color-medium)',
|
||||||
|
fontSize: 13,
|
||||||
|
lineHeight: 1.4,
|
||||||
|
}}
|
||||||
|
>
|
||||||
|
{selectedPlace?.address ??
|
||||||
|
'Search for a place to drop a marker.'}
|
||||||
|
</p>
|
||||||
|
</div>
|
||||||
|
<IonButton
|
||||||
|
fill="clear"
|
||||||
|
onClick={recenterMap}
|
||||||
|
aria-label="Recenter map"
|
||||||
|
style={
|
||||||
|
{
|
||||||
|
'--border-radius': '999px',
|
||||||
|
'--padding-start': '10px',
|
||||||
|
'--padding-end': '10px',
|
||||||
|
flexShrink: 0,
|
||||||
|
} as React.CSSProperties
|
||||||
|
}
|
||||||
|
>
|
||||||
|
<IonIcon icon={locateOutline} slot="icon-only" />
|
||||||
|
</IonButton>
|
||||||
|
</div>
|
||||||
|
|
||||||
|
{mapError && (
|
||||||
|
<div
|
||||||
|
style={{
|
||||||
|
marginTop: 12,
|
||||||
|
background: '#ffffff',
|
||||||
|
borderRadius: 16,
|
||||||
|
padding: '12px 16px',
|
||||||
|
color: 'var(--ion-color-danger)',
|
||||||
|
fontSize: 13,
|
||||||
|
lineHeight: 1.4,
|
||||||
|
}}
|
||||||
|
>
|
||||||
|
{mapError}
|
||||||
|
</div>
|
||||||
|
)}
|
||||||
|
</div>
|
||||||
</IonContent>
|
</IonContent>
|
||||||
</IonPage>
|
</IonPage>
|
||||||
);
|
);
|
||||||
|
};
|
||||||
|
|
||||||
export default Home;
|
export default Home;
|
||||||
|
|||||||
@@ -0,0 +1,7 @@
|
|||||||
|
import { createClient } from '@supabase/supabase-js';
|
||||||
|
import type { Database } from './database.types';
|
||||||
|
|
||||||
|
export const supabase = createClient<Database>(
|
||||||
|
'https://twfddmesszhmlsvdgrcv.supabase.co',
|
||||||
|
'eyJhbGciOiJIUzI1NiIsInR5cCI6IkpXVCJ9.eyJpc3MiOiJzdXBhYmFzZSIsInJlZiI6InR3ZmRkbWVzc3pobWxzdmRncmN2Iiwicm9sZSI6ImFub24iLCJpYXQiOjE3Nzk1Njg0NDQsImV4cCI6MjA5NTE0NDQ0NH0.52RDOTgew7wQLK4dILj_Trxox7VLr7pv6dYX--UO10M',
|
||||||
|
);
|
||||||
+3
-1
@@ -21,7 +21,9 @@ export default defineConfig({
|
|||||||
port: 8100,
|
port: 8100,
|
||||||
allowedHosts: true,
|
allowedHosts: true,
|
||||||
hmr: {
|
hmr: {
|
||||||
clientPort: process.env.HMR_CLIENT_PORT ? parseInt(process.env.HMR_CLIENT_PORT) : undefined,
|
clientPort: process.env.HMR_CLIENT_PORT
|
||||||
|
? parseInt(process.env.HMR_CLIENT_PORT)
|
||||||
|
: undefined,
|
||||||
},
|
},
|
||||||
},
|
},
|
||||||
css: { devSourcemap: false },
|
css: { devSourcemap: false },
|
||||||
|
|||||||
@@ -216,16 +216,16 @@ __metadata:
|
|||||||
languageName: node
|
languageName: node
|
||||||
linkType: hard
|
linkType: hard
|
||||||
|
|
||||||
"@capacitor-firebase/authentication@npm:^7.0.0":
|
"@capacitor-firebase/authentication@npm:^8.0.0":
|
||||||
version: 7.5.0
|
version: 8.2.0
|
||||||
resolution: "@capacitor-firebase/authentication@npm:7.5.0"
|
resolution: "@capacitor-firebase/authentication@npm:8.2.0"
|
||||||
peerDependencies:
|
peerDependencies:
|
||||||
"@capacitor/core": ">=7.0.0"
|
"@capacitor/core": ">=8.0.0"
|
||||||
firebase: ^11.2.0
|
firebase: ^12.6.0
|
||||||
peerDependenciesMeta:
|
peerDependenciesMeta:
|
||||||
firebase:
|
firebase:
|
||||||
optional: true
|
optional: true
|
||||||
checksum: 10c0/aea4854cd6f8f2282bbbfb5cb0e30dc7152cd593a70c6792a1583fa085803f9330a77584f3ae66ee8c9b65b035374c2fe86545b191d57c0814778b6276306e1e
|
checksum: 10c0/497c8063e3145ee719dbeb206bd30d7e9581471a7dfa6e6bb3067e96c29468a8035430101abcb0c724bec936e30ca1863344723115ae0b3a9a317e192c0ef3d2
|
||||||
languageName: node
|
languageName: node
|
||||||
linkType: hard
|
linkType: hard
|
||||||
|
|
||||||
@@ -1108,17 +1108,6 @@ __metadata:
|
|||||||
languageName: node
|
languageName: node
|
||||||
linkType: hard
|
linkType: hard
|
||||||
|
|
||||||
"@ionic/core@npm:8.8.8":
|
|
||||||
version: 8.8.8
|
|
||||||
resolution: "@ionic/core@npm:8.8.8"
|
|
||||||
dependencies:
|
|
||||||
"@stencil/core": "npm:4.43.0"
|
|
||||||
ionicons: "npm:^8.0.13"
|
|
||||||
tslib: "npm:^2.1.0"
|
|
||||||
checksum: 10c0/fea32925aaebec558c1c3bb9c30f8c0806d3480a67936e63cdcce8846138688d9b6b5b853ebe771132f0f79efef16568b17d11495f7997ea325a265a7e7d7af3
|
|
||||||
languageName: node
|
|
||||||
linkType: hard
|
|
||||||
|
|
||||||
"@ionic/pwa-elements@npm:^3.0.0":
|
"@ionic/pwa-elements@npm:^3.0.0":
|
||||||
version: 3.4.0
|
version: 3.4.0
|
||||||
resolution: "@ionic/pwa-elements@npm:3.4.0"
|
resolution: "@ionic/pwa-elements@npm:3.4.0"
|
||||||
@@ -1126,36 +1115,22 @@ __metadata:
|
|||||||
languageName: node
|
languageName: node
|
||||||
linkType: hard
|
linkType: hard
|
||||||
|
|
||||||
"@ionic/react-router@npm:^8.5.0":
|
"@ionic/react-router@npm:8.8.7":
|
||||||
version: 8.8.8
|
version: 8.8.7
|
||||||
resolution: "@ionic/react-router@npm:8.8.8"
|
resolution: "@ionic/react-router@npm:8.8.7"
|
||||||
dependencies:
|
dependencies:
|
||||||
"@ionic/react": "npm:8.8.8"
|
"@ionic/react": "npm:8.8.7"
|
||||||
tslib: "npm:*"
|
tslib: "npm:*"
|
||||||
peerDependencies:
|
peerDependencies:
|
||||||
react: ">=16.8.6"
|
react: ">=16.8.6"
|
||||||
react-dom: ">=16.8.6"
|
react-dom: ">=16.8.6"
|
||||||
react-router: ^5.0.1
|
react-router: ^5.0.1
|
||||||
react-router-dom: ^5.0.1
|
react-router-dom: ^5.0.1
|
||||||
checksum: 10c0/be9555ec4dbfd0565cada39d42236eb0b9e2283a13f500b42d5c0c06d6198c17a7be385cfb2ce4f9e89236c71992c30169328b861943a3fe7344c672ad94ae0c
|
checksum: 10c0/302d6ad9c0d450cf6466ff18622aa7708af77c1c4a676d2ff39eca6add440fe96d36a157feae146c3da460c32e7799357320b3270740b050ab040a664b9f0ff2
|
||||||
languageName: node
|
languageName: node
|
||||||
linkType: hard
|
linkType: hard
|
||||||
|
|
||||||
"@ionic/react@npm:8.8.8":
|
"@ionic/react@npm:8.8.7":
|
||||||
version: 8.8.8
|
|
||||||
resolution: "@ionic/react@npm:8.8.8"
|
|
||||||
dependencies:
|
|
||||||
"@ionic/core": "npm:8.8.8"
|
|
||||||
ionicons: "npm:^8.0.13"
|
|
||||||
tslib: "npm:*"
|
|
||||||
peerDependencies:
|
|
||||||
react: ">=16.8.6"
|
|
||||||
react-dom: ">=16.8.6"
|
|
||||||
checksum: 10c0/b1b8888f487dc564735adde57ef3cd054e6c9bc38601f133823e69cb98d8e51c99c8902fe48fdd11ee5521ae58b322f110a1fbc8b8fd9bc62e27fc0b806bddd0
|
|
||||||
languageName: node
|
|
||||||
linkType: hard
|
|
||||||
|
|
||||||
"@ionic/react@npm:^8.5.0":
|
|
||||||
version: 8.8.7
|
version: 8.8.7
|
||||||
resolution: "@ionic/react@npm:8.8.7"
|
resolution: "@ionic/react@npm:8.8.7"
|
||||||
dependencies:
|
dependencies:
|
||||||
@@ -2032,7 +2007,7 @@ __metadata:
|
|||||||
version: 0.0.0-use.local
|
version: 0.0.0-use.local
|
||||||
resolution: "app@workspace:."
|
resolution: "app@workspace:."
|
||||||
dependencies:
|
dependencies:
|
||||||
"@capacitor-firebase/authentication": "npm:^7.0.0"
|
"@capacitor-firebase/authentication": "npm:^8.0.0"
|
||||||
"@capacitor/android": "npm:8.3.4"
|
"@capacitor/android": "npm:8.3.4"
|
||||||
"@capacitor/app": "npm:8.1.0"
|
"@capacitor/app": "npm:8.1.0"
|
||||||
"@capacitor/cli": "npm:8.3.4"
|
"@capacitor/cli": "npm:8.3.4"
|
||||||
@@ -2044,8 +2019,8 @@ __metadata:
|
|||||||
"@capacitor/push-notifications": "npm:^8.1.1"
|
"@capacitor/push-notifications": "npm:^8.1.1"
|
||||||
"@capacitor/status-bar": "npm:8.0.2"
|
"@capacitor/status-bar": "npm:8.0.2"
|
||||||
"@ionic/pwa-elements": "npm:^3.0.0"
|
"@ionic/pwa-elements": "npm:^3.0.0"
|
||||||
"@ionic/react": "npm:^8.5.0"
|
"@ionic/react": "npm:8.8.7"
|
||||||
"@ionic/react-router": "npm:^8.5.0"
|
"@ionic/react-router": "npm:8.8.7"
|
||||||
"@supabase/supabase-js": "npm:^2.0.0"
|
"@supabase/supabase-js": "npm:^2.0.0"
|
||||||
"@types/katex": "npm:^0.16.0"
|
"@types/katex": "npm:^0.16.0"
|
||||||
"@types/react": "npm:^19.0.0"
|
"@types/react": "npm:^19.0.0"
|
||||||
|
|||||||
Reference in New Issue
Block a user