Compare commits
1 Commits
| Author | SHA1 | Date | |
|---|---|---|---|
| dcb9174408 |
Binary file not shown.
@@ -4,12 +4,13 @@ android {
|
||||
namespace = "io.ionic.starter"
|
||||
compileSdk = rootProject.ext.compileSdkVersion
|
||||
defaultConfig {
|
||||
applicationId "io.longtime.app"
|
||||
applicationId "com.habitmode.llemba.com"
|
||||
minSdkVersion rootProject.ext.minSdkVersion
|
||||
targetSdkVersion rootProject.ext.targetSdkVersion
|
||||
versionCode 1
|
||||
versionName "1.0"
|
||||
testInstrumentationRunner "androidx.test.runner.AndroidJUnitRunner"
|
||||
manifestPlaceholders = [googleMapsApiKey: System.getenv("VITE_GOOGLE_MAPS_KEY") ?: ""]
|
||||
aaptOptions {
|
||||
// Files and dirs to omit from the packaged assets dir, modified to accommodate modern web apps.
|
||||
// Default: https://android.googlesource.com/platform/frameworks/base/+/282e181b58cf72b6ca770dc7ca5f91f135444502/tools/aapt/AaptAssets.cpp#61
|
||||
|
||||
@@ -25,11 +25,15 @@
|
||||
<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.longtime.app" />
|
||||
<data android:scheme="io.flavorstudio.app" />
|
||||
</intent-filter>
|
||||
|
||||
</activity>
|
||||
|
||||
<meta-data
|
||||
android:name="com.google.android.geo.API_KEY"
|
||||
android:value="${googleMapsApiKey}" />
|
||||
|
||||
<provider
|
||||
android:name="androidx.core.content.FileProvider"
|
||||
android:authorities="${applicationId}.fileprovider"
|
||||
|
||||
@@ -1,7 +1,7 @@
|
||||
<?xml version='1.0' encoding='utf-8'?>
|
||||
<resources>
|
||||
<string name="app_name">Longtime</string>
|
||||
<string name="title_activity_main">Longtime</string>
|
||||
<string name="app_name">FlavorStudio</string>
|
||||
<string name="title_activity_main">FlavorStudio</string>
|
||||
<string name="package_name">io.ionic.starter</string>
|
||||
<string name="custom_url_scheme">io.ionic.starter</string>
|
||||
</resources>
|
||||
|
||||
+2
-2
@@ -1,8 +1,8 @@
|
||||
import type { CapacitorConfig } from '@capacitor/cli';
|
||||
|
||||
const config: CapacitorConfig = {
|
||||
appId: 'io.longtime.app',
|
||||
appName: 'Longtime',
|
||||
appId: 'com.habitmode.llemba.com',
|
||||
appName: 'FlavorStudio',
|
||||
webDir: 'dist',
|
||||
plugins: {
|
||||
FirebaseAuthentication: {
|
||||
|
||||
+136
-33
@@ -11,10 +11,29 @@ workflows:
|
||||
- $HOME/.gradle/caches
|
||||
- $HOME/.gradle/wrapper
|
||||
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
|
||||
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
|
||||
# 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
|
||||
script: npm install --legacy-peer-deps
|
||||
script: rm -f package-lock.json && npm install --legacy-peer-deps
|
||||
- name: Build web assets
|
||||
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
|
||||
script: |
|
||||
if [ -n "$GOOGLE_SERVICES_JSON" ]; then
|
||||
@@ -27,6 +46,8 @@ workflows:
|
||||
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
|
||||
# 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
|
||||
script: npx cap sync android
|
||||
- name: Set up debug keystore
|
||||
@@ -34,6 +55,13 @@ workflows:
|
||||
if [ -n "$CM_DEBUG_KEYSTORE" ]; then
|
||||
echo "$CM_DEBUG_KEYSTORE" | base64 --decode > /tmp/debug-keystore.p12
|
||||
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
|
||||
script: |
|
||||
cd android
|
||||
@@ -47,6 +75,21 @@ workflows:
|
||||
else
|
||||
./gradlew assembleDebug --no-daemon
|
||||
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:
|
||||
- android/app/build/outputs/apk/debug/app-debug.apk
|
||||
|
||||
@@ -62,8 +105,18 @@ workflows:
|
||||
- $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: npm install --legacy-peer-deps
|
||||
script: rm -f package-lock.json && npm install --legacy-peer-deps
|
||||
- name: Build web assets
|
||||
script: npm run build
|
||||
- name: Write Firebase config
|
||||
@@ -99,8 +152,18 @@ workflows:
|
||||
- $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: npm install --legacy-peer-deps
|
||||
script: rm -f package-lock.json && npm install --legacy-peer-deps
|
||||
- name: Build web assets
|
||||
script: npm run build
|
||||
- name: Write Firebase config
|
||||
@@ -136,8 +199,18 @@ workflows:
|
||||
- $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: npm install --legacy-peer-deps
|
||||
script: rm -f package-lock.json && npm install --legacy-peer-deps
|
||||
- name: Build web assets
|
||||
script: npm run build
|
||||
- name: Write Firebase config
|
||||
@@ -174,28 +247,39 @@ workflows:
|
||||
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: npm install --legacy-peer-deps
|
||||
script: rm -f package-lock.json && npm install --legacy-peer-deps
|
||||
- name: Build web assets
|
||||
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
|
||||
script: npx cap sync ios
|
||||
# Decode Firebase plist to disk so it is present during the second sync.
|
||||
- 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
|
||||
# Second sync ensures CapApp-SPM/Package.swift is consistent after the plist write.
|
||||
- name: Capacitor sync
|
||||
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
|
||||
script: |
|
||||
keychain initialize
|
||||
@@ -220,11 +304,23 @@ workflows:
|
||||
echo "No signing credentials configured — build will fail at signing"
|
||||
exit 1
|
||||
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
|
||||
script: |
|
||||
xcode-project build-ipa \
|
||||
--project ios/App/App.xcodeproj \
|
||||
--scheme App
|
||||
--workspace ios/App/App.xcworkspace \
|
||||
--scheme App \
|
||||
--no-show-build-settings \
|
||||
--disable-xcpretty
|
||||
artifacts:
|
||||
- build/ios/ipa/*.ipa
|
||||
|
||||
@@ -236,28 +332,31 @@ workflows:
|
||||
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: npm install --legacy-peer-deps
|
||||
script: rm -f package-lock.json && npm install --legacy-peer-deps
|
||||
- name: Build web assets
|
||||
script: npm run build
|
||||
- name: Write Firebase config
|
||||
- name: Capacitor sync
|
||||
script: npx cap sync ios
|
||||
- name: Configure Xcode project
|
||||
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: Configure Xcode project
|
||||
script: ruby configure_xcode.rb
|
||||
- name: Set up signing
|
||||
script: |
|
||||
keychain initialize
|
||||
@@ -279,12 +378,16 @@ workflows:
|
||||
echo "$CM_PROVISIONING_PROFILE" | base64 --decode > "$HOME/Library/MobileDevice/Provisioning Profiles/profile.mobileprovision"
|
||||
xcode-project use-profiles
|
||||
fi
|
||||
# See ios-debug Build IPA comments for --workspace, --no-show-build-settings,
|
||||
# and --disable-xcpretty rationale — same reasons apply here.
|
||||
- name: Build IPA
|
||||
script: |
|
||||
xcode-project build-ipa \
|
||||
--project ios/App/App.xcodeproj \
|
||||
--workspace ios/App/App.xcworkspace \
|
||||
--scheme App \
|
||||
--config Release
|
||||
--config Release \
|
||||
--no-show-build-settings \
|
||||
--disable-xcpretty
|
||||
- name: Publish
|
||||
script: |
|
||||
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"
|
||||
@@ -26,7 +26,6 @@
|
||||
504EC30E1FED79650016851F /* Assets.xcassets */ = {isa = PBXFileReference; lastKnownFileType = folder.assetcatalog; path = Assets.xcassets; sourceTree = "<group>"; };
|
||||
504EC3111FED79650016851F /* Base */ = {isa = PBXFileReference; lastKnownFileType = file.storyboard; name = Base; path = Base.lproj/LaunchScreen.storyboard; sourceTree = "<group>"; };
|
||||
504EC3131FED79650016851F /* Info.plist */ = {isa = PBXFileReference; lastKnownFileType = text.plist.xml; path = Info.plist; sourceTree = "<group>"; };
|
||||
1A4EB3C21FED79650016851F /* App.entitlements */ = {isa = PBXFileReference; lastKnownFileType = text.plist.entitlements; path = App.entitlements; sourceTree = "<group>"; };
|
||||
50B271D01FEDC1A000F3C39B /* public */ = {isa = PBXFileReference; lastKnownFileType = folder; path = public; sourceTree = "<group>"; };
|
||||
958DCC722DB07C7200EA8C5F /* debug.xcconfig */ = {isa = PBXFileReference; lastKnownFileType = text.xcconfig; name = debug.xcconfig; path = ../debug.xcconfig; sourceTree = SOURCE_ROOT; };
|
||||
/* End PBXFileReference section */
|
||||
@@ -69,7 +68,6 @@
|
||||
504EC30E1FED79650016851F /* Assets.xcassets */,
|
||||
504EC3101FED79650016851F /* LaunchScreen.storyboard */,
|
||||
504EC3131FED79650016851F /* Info.plist */,
|
||||
1A4EB3C21FED79650016851F /* App.entitlements */,
|
||||
2FAD9762203C412B000D30F8 /* config.xml */,
|
||||
50B271D01FEDC1A000F3C39B /* public */,
|
||||
);
|
||||
@@ -297,7 +295,6 @@
|
||||
baseConfigurationReference = 958DCC722DB07C7200EA8C5F /* debug.xcconfig */;
|
||||
buildSettings = {
|
||||
ASSETCATALOG_COMPILER_APPICON_NAME = AppIcon;
|
||||
CODE_SIGN_ENTITLEMENTS = App/App.entitlements;
|
||||
CODE_SIGN_STYLE = Automatic;
|
||||
CURRENT_PROJECT_VERSION = 1;
|
||||
INFOPLIST_FILE = App/Info.plist;
|
||||
@@ -308,7 +305,7 @@
|
||||
);
|
||||
MARKETING_VERSION = 1.0;
|
||||
OTHER_SWIFT_FLAGS = "$(inherited) \"-D\" \"COCOAPODS\" \"-DDEBUG\"";
|
||||
PRODUCT_BUNDLE_IDENTIFIER = io.longtime.app;
|
||||
PRODUCT_BUNDLE_IDENTIFIER = io.flavorstudio.app;
|
||||
PRODUCT_NAME = "$(TARGET_NAME)";
|
||||
SWIFT_ACTIVE_COMPILATION_CONDITIONS = DEBUG;
|
||||
SWIFT_VERSION = 5.0;
|
||||
@@ -320,7 +317,6 @@
|
||||
isa = XCBuildConfiguration;
|
||||
buildSettings = {
|
||||
ASSETCATALOG_COMPILER_APPICON_NAME = AppIcon;
|
||||
CODE_SIGN_ENTITLEMENTS = App/App.entitlements;
|
||||
CODE_SIGN_STYLE = Automatic;
|
||||
CURRENT_PROJECT_VERSION = 1;
|
||||
INFOPLIST_FILE = App/Info.plist;
|
||||
@@ -330,7 +326,7 @@
|
||||
"@executable_path/Frameworks",
|
||||
);
|
||||
MARKETING_VERSION = 1.0;
|
||||
PRODUCT_BUNDLE_IDENTIFIER = io.longtime.app;
|
||||
PRODUCT_BUNDLE_IDENTIFIER = io.flavorstudio.app;
|
||||
PRODUCT_NAME = "$(TARGET_NAME)";
|
||||
SWIFT_ACTIVE_COMPILATION_CONDITIONS = "";
|
||||
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>
|
||||
<string>en</string>
|
||||
<key>CFBundleDisplayName</key>
|
||||
<string>Longtime</string>
|
||||
<string>FlavorStudio</string>
|
||||
<key>CFBundleExecutable</key>
|
||||
<string>$(EXECUTABLE_NAME)</string>
|
||||
<key>CFBundleIdentifier</key>
|
||||
@@ -51,10 +51,10 @@
|
||||
<array>
|
||||
<dict>
|
||||
<key>CFBundleURLName</key>
|
||||
<string>io.longtime.app</string>
|
||||
<string>io.flavorstudio.app</string>
|
||||
<key>CFBundleURLSchemes</key>
|
||||
<array>
|
||||
<string>io.longtime.app</string>
|
||||
<string>io.flavorstudio.app</string>
|
||||
</array>
|
||||
</dict>
|
||||
</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
|
||||
+5
-3
@@ -10,6 +10,7 @@
|
||||
"lint": "eslint"
|
||||
},
|
||||
"dependencies": {
|
||||
"@capacitor-firebase/authentication": "^8.0.0",
|
||||
"@capacitor/android": "8.3.4",
|
||||
"@capacitor/app": "8.1.0",
|
||||
"@capacitor/core": "8.3.4",
|
||||
@@ -20,15 +21,16 @@
|
||||
"@capacitor/push-notifications": "^8.1.1",
|
||||
"@capacitor/status-bar": "8.0.2",
|
||||
"@ionic/pwa-elements": "^3.0.0",
|
||||
"@ionic/react": "^8.5.0",
|
||||
"@ionic/react-router": "^8.5.0",
|
||||
"@ionic/react": "8.8.7",
|
||||
"@ionic/react-router": "8.8.7",
|
||||
"@supabase/supabase-js": "^2.0.0",
|
||||
"firebase": "^11.0.0",
|
||||
"ionicons": "^7.4.0",
|
||||
"katex": "^0.16.0",
|
||||
"react": "18.2.0",
|
||||
"react-dom": "18.2.0",
|
||||
"react-hook-form": "^7.54.0",
|
||||
"react-katex": "^3.0.1",
|
||||
"@supabase/supabase-js": "^2.0.0",
|
||||
"react-router": "^5.3.4",
|
||||
"react-router-dom": "^5.3.4",
|
||||
"zod": "^3.24.0",
|
||||
|
||||
+20
-18
@@ -1,29 +1,31 @@
|
||||
import React from "react";
|
||||
import { Redirect, Route } from "react-router-dom";
|
||||
import { IonApp, IonRouterOutlet } from "@ionic/react";
|
||||
import { IonReactRouter } from "@ionic/react-router";
|
||||
import React from 'react';
|
||||
import { Redirect, Route } from 'react-router-dom';
|
||||
import { IonApp, IonRouterOutlet } from '@ionic/react';
|
||||
import { IonReactRouter } from '@ionic/react-router';
|
||||
|
||||
import "@ionic/react/css/core.css";
|
||||
import "@ionic/react/css/normalize.css";
|
||||
import "@ionic/react/css/structure.css";
|
||||
import "@ionic/react/css/typography.css";
|
||||
import "@ionic/react/css/padding.css";
|
||||
import "@ionic/react/css/float-elements.css";
|
||||
import "@ionic/react/css/text-alignment.css";
|
||||
import "@ionic/react/css/text-transformation.css";
|
||||
import "@ionic/react/css/flex-utils.css";
|
||||
import "@ionic/react/css/display.css";
|
||||
import '@ionic/react/css/core.css';
|
||||
import '@ionic/react/css/normalize.css';
|
||||
import '@ionic/react/css/structure.css';
|
||||
import '@ionic/react/css/typography.css';
|
||||
import '@ionic/react/css/padding.css';
|
||||
import '@ionic/react/css/float-elements.css';
|
||||
import '@ionic/react/css/text-alignment.css';
|
||||
import '@ionic/react/css/text-transformation.css';
|
||||
import '@ionic/react/css/flex-utils.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 = () => (
|
||||
<IonApp>
|
||||
<IonReactRouter>
|
||||
<IonRouterOutlet>
|
||||
<IonRouterOutlet animated={true}>
|
||||
<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>
|
||||
</IonReactRouter>
|
||||
</IonApp>
|
||||
|
||||
@@ -1,7 +0,0 @@
|
||||
const Hello = () => (
|
||||
<div>
|
||||
<p>Hello</p>
|
||||
</div>
|
||||
);
|
||||
|
||||
export default Hello;
|
||||
@@ -43,14 +43,8 @@ window.addEventListener('message', (e) => {
|
||||
|
||||
// Re-apply after React Fast Refresh so insets survive soft HMR cycles.
|
||||
if (import.meta.hot) {
|
||||
import.meta.hot.on('vite:beforeUpdate', () => {
|
||||
const c = (window as any).Ionic?.config;
|
||||
if (c) c.animated = false;
|
||||
});
|
||||
import.meta.hot.on('vite:afterUpdate', () => {
|
||||
_applyInsets(sessionStorage.getItem('__apsuite_sat'), sessionStorage.getItem('__apsuite_sab'));
|
||||
const c = (window as any).Ionic?.config;
|
||||
if (c) c.animated = true;
|
||||
});
|
||||
}
|
||||
|
||||
|
||||
@@ -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
-14
@@ -1,24 +1,682 @@
|
||||
import React from 'react';
|
||||
import React, { useEffect, useRef, useState } from 'react';
|
||||
import {
|
||||
IonButton,
|
||||
IonContent,
|
||||
IonHeader,
|
||||
IonIcon,
|
||||
IonPage,
|
||||
IonTitle,
|
||||
IonToolbar,
|
||||
IonSpinner,
|
||||
useIonViewDidEnter,
|
||||
useIonViewWillLeave,
|
||||
} from '@ionic/react';
|
||||
import Hello from '../components/Hello';
|
||||
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 = () => (
|
||||
<IonPage>
|
||||
<IonHeader>
|
||||
<IonToolbar>
|
||||
<IonTitle>Home</IonTitle>
|
||||
</IonToolbar>
|
||||
</IonHeader>
|
||||
<IonContent className="ion-padding">
|
||||
<Hello />
|
||||
const DEFAULT_CENTER = { lat: 37.7749, lng: -122.4194 };
|
||||
const HOME_MARKER: Marker = {
|
||||
coordinate: DEFAULT_CENTER,
|
||||
title: 'San Francisco',
|
||||
snippet: 'Start searching for nearby places',
|
||||
};
|
||||
|
||||
type PlaceSuggestion = {
|
||||
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>
|
||||
</IonPage>
|
||||
);
|
||||
};
|
||||
|
||||
export default Home;
|
||||
|
||||
+2
-2
@@ -2,6 +2,6 @@ import { createClient } from '@supabase/supabase-js';
|
||||
import type { Database } from './database.types';
|
||||
|
||||
export const supabase = createClient<Database>(
|
||||
'https://gsltltsypffowdpfdhkf.supabase.co',
|
||||
'eyJhbGciOiJIUzI1NiIsInR5cCI6IkpXVCJ9.eyJpc3MiOiJzdXBhYmFzZSIsInJlZiI6ImdzbHRsdHN5cGZmb3dkcGZkaGtmIiwicm9sZSI6ImFub24iLCJpYXQiOjE3Nzk1Njg0MTIsImV4cCI6MjA5NTE0NDQxMn0.XH2adPZPr9p0fQwP3mXDP6wIS41DByW7ZAPSMA0_TYI',
|
||||
'https://twfddmesszhmlsvdgrcv.supabase.co',
|
||||
'eyJhbGciOiJIUzI1NiIsInR5cCI6IkpXVCJ9.eyJpc3MiOiJzdXBhYmFzZSIsInJlZiI6InR3ZmRkbWVzc3pobWxzdmRncmN2Iiwicm9sZSI6ImFub24iLCJpYXQiOjE3Nzk1Njg0NDQsImV4cCI6MjA5NTE0NDQ0NH0.52RDOTgew7wQLK4dILj_Trxox7VLr7pv6dYX--UO10M',
|
||||
);
|
||||
|
||||
@@ -0,0 +1,18 @@
|
||||
ext {
|
||||
minSdkVersion = 24
|
||||
compileSdkVersion = 36
|
||||
targetSdkVersion = 36
|
||||
androidxActivityVersion = '1.11.0'
|
||||
androidxAppCompatVersion = '1.7.1'
|
||||
androidxCoordinatorLayoutVersion = '1.3.0'
|
||||
androidxCoreVersion = '1.17.0'
|
||||
androidxFragmentVersion = '1.8.9'
|
||||
coreSplashScreenVersion = '1.2.0'
|
||||
androidxWebkitVersion = '1.14.0'
|
||||
junitVersion = '4.13.2'
|
||||
androidxJunitVersion = '1.3.0'
|
||||
androidxEspressoCoreVersion = '3.7.0'
|
||||
cordovaAndroidVersion = '14.0.1'
|
||||
rgcfaIncludeGoogle = true
|
||||
androidxCredentialsVersion = '1.3.0'
|
||||
}
|
||||
+3
-1
@@ -21,7 +21,9 @@ export default defineConfig({
|
||||
port: 8100,
|
||||
allowedHosts: true,
|
||||
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 },
|
||||
|
||||
Reference in New Issue
Block a user