Skip to content
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension


Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
5 changes: 0 additions & 5 deletions .github/actions/asa-go-setup/action.yml
Original file line number Diff line number Diff line change
Expand Up @@ -37,8 +37,3 @@ runs:
working-directory: ./mobile/asa-go
shell: bash
run: yarn install

- name: Build
working-directory: ./mobile/asa-go
shell: bash
run: yarn build
18 changes: 12 additions & 6 deletions .github/workflows/asa_go_android_build.yml
Original file line number Diff line number Diff line change
@@ -1,7 +1,7 @@
name: Build ASA Go Android

env:
appBuildVersion: "1.0.2"
appBuildVersion: "1.0.3"

on:
workflow_dispatch:
Expand All @@ -20,6 +20,7 @@ jobs:
"KEY_ALIAS"
"SIGNING_STORE_PASSWORD"
"SIGNING_KEY_PASSWORD"
"GOOGLE_SERVICES_JSON"
"VITE_BASEMAP_TILE_URL"
"VITE_BASEMAP_STYLE_URL"
)
Expand All @@ -34,6 +35,7 @@ jobs:
KEY_ALIAS: ${{ secrets.ANDROID_KEY_ALIAS }}
SIGNING_STORE_PASSWORD: ${{ secrets.ANDROID_SIGNING_STORE_PASSWORD }}
SIGNING_KEY_PASSWORD: ${{ secrets.ANDROID_SIGNING_KEY_PASSWORD }}
GOOGLE_SERVICES_JSON: ${{ secrets.GOOGLE_SERVICES_JSON }}
VITE_BASEMAP_TILE_URL: ${{ secrets.VITE_BASEMAP_TILE_URL }}
VITE_BASEMAP_STYLE_URL: ${{ secrets.VITE_BASEMAP_STYLE_URL }}

Expand Down Expand Up @@ -71,11 +73,15 @@ jobs:
echo "VITE_BASEMAP_TILE_URL=${VITE_BASEMAP_TILE_URL}" >> .env.production
echo "VITE_BASEMAP_STYLE_URL=${VITE_BASEMAP_STYLE_URL}" >> .env.production

- name: Create google-services.json
env:
GOOGLE_SERVICES_JSON: ${{ secrets.GOOGLE_SERVICES_JSON }}
run: |
echo "$GOOGLE_SERVICES_JSON" | base64 -d > ./mobile/asa-go/android/app/src/prod/google-services.json

- name: Build Capacitor and Sync
working-directory: ./mobile/asa-go
run: |
yarn build:prod
yarn cap sync android
run: yarn cap:sync:android:prod

- name: Set up Java
uses: actions/setup-java@v5
Expand Down Expand Up @@ -104,11 +110,11 @@ jobs:
ANDROID_SIGNING_STORE_PASSWORD: ${{ secrets.ANDROID_SIGNING_STORE_PASSWORD }}
ANDROID_SIGNING_KEY_PASSWORD: ${{ secrets.ANDROID_SIGNING_KEY_PASSWORD }}
run: |
./gradlew bundleRelease
./gradlew bundleProdRelease

- uses: actions/upload-artifact@v7
with:
name: ASA-Go-AAB
path: mobile/asa-go/android/app/build/outputs/bundle/release/*.aab
path: mobile/asa-go/android/app/build/outputs/bundle/prodRelease/*.aab
retention-days: 1
if-no-files-found: error
6 changes: 3 additions & 3 deletions .github/workflows/asa_go_integration.yml
Original file line number Diff line number Diff line change
Expand Up @@ -46,7 +46,7 @@ jobs:
uses: ./.github/actions/asa-go-setup
- name: Sync Capacitor iOS
working-directory: ./mobile/asa-go
run: yarn cap sync ios
run: yarn cap:sync:ios:prod
- name: Use Xcode latest stable
uses: maxim-lobanov/setup-xcode@60606e260d2fc5762a71e64e74b2174e8ea3c8bd
with:
Expand Down Expand Up @@ -80,10 +80,10 @@ jobs:
- name: Create google-services.json
env:
GOOGLE_SERVICES_JSON: ${{ secrets.GOOGLE_SERVICES_JSON }}
run: echo "$GOOGLE_SERVICES_JSON" | base64 -d > ./mobile/asa-go/android/app/google-services.json
run: echo "$GOOGLE_SERVICES_JSON" | base64 -d > ./mobile/asa-go/android/app/src/prod/google-services.json
- name: Sync Capacitor Android
working-directory: ./mobile/asa-go
run: yarn cap sync android
run: yarn cap:sync:android:prod
- name: Set up Java
uses: actions/setup-java@v5
with:
Expand Down
15 changes: 11 additions & 4 deletions .github/workflows/asa_go_ios_build_deploy.yml
Original file line number Diff line number Diff line change
Expand Up @@ -2,7 +2,7 @@ name: Publish ASA Go iOS

env:
appBuildNumber: ${{ github.run_number }}
appBuildVersion: "1.0.2"
appBuildVersion: "1.0.3"

permissions:
contents: read
Expand All @@ -21,6 +21,7 @@ jobs:
"CERTIFICATE"
"KEYCHAIN_PASSWD"
"PROVISIONING_PROFILE"
"GOOGLE_SERVICES_PLIST"
"VITE_BASEMAP_TILE_URL"
"VITE_BASEMAP_STYLE_URL"
)
Expand All @@ -34,6 +35,7 @@ jobs:
CERTIFICATE: ${{ secrets.APPLE_APP_STORE_BUILD_CERTIFICATE_BASE64 }}
KEYCHAIN_PASSWD: ${{ secrets.APPLE_APP_STORE_BUILD_CERTIFICATE_PASSWD }}
PROVISIONING_PROFILE: ${{ secrets.IOS_PROVISION_PROFILE_BASE64 }}
GOOGLE_SERVICES_PLIST: ${{ secrets.GOOGLE_SERVICES_PLIST }}
VITE_BASEMAP_TILE_URL: ${{ secrets.VITE_BASEMAP_TILE_URL }}
VITE_BASEMAP_STYLE_URL: ${{ secrets.VITE_BASEMAP_STYLE_URL }}
build-and-publish:
Expand Down Expand Up @@ -69,11 +71,16 @@ jobs:
echo "VITE_BASEMAP_TILE_URL=${VITE_BASEMAP_TILE_URL}" >>.env.production
echo "VITE_BASEMAP_STYLE_URL=${VITE_BASEMAP_STYLE_URL}" >>.env.production

- name: Build Capacitor and Sync
- name: Copy GoogleService-Info.plist
env:
GOOGLE_SERVICES_PLIST: ${{ secrets.GOOGLE_SERVICES_PLIST }}
working-directory: ./mobile/asa-go
run: |
yarn build:prod
yarn cap sync ios
echo "$GOOGLE_SERVICES_PLIST" | base64 --decode > ./ios/App/App/Firebase/Prod/GoogleService-Info.plist

- name: Build Capacitor and Sync
working-directory: ./mobile/asa-go
run: yarn cap:sync:ios:prod
- name: Setup iOS Signing
env:
BUILD_CERTIFICATE_BASE64: ${{ secrets.APPLE_APP_STORE_BUILD_CERTIFICATE_BASE64 }}
Expand Down
131 changes: 131 additions & 0 deletions mobile/asa-go/Notifications.md
Original file line number Diff line number Diff line change
@@ -0,0 +1,131 @@
# Notifications

Short reference for the ASA Go mobile notification setup.

## iOS app IDs

We have two iOS app variants:

- Prod bundle ID: `ca.bc.gov.asago`
- Dev bundle ID: `ca.bc.gov.asago.dev`

These bundle IDs must match the Firebase iOS app registration exactly.

## Android app IDs

We also have two Android app variants:

- Prod application ID: `ca.bc.gov.asago`
- Dev application ID: `ca.bc.gov.asago.dev`

These application IDs must match the Firebase Android app registration exactly.

## Firebase dev vs prod

Current mapping:

- Prod plist `BUNDLE_ID`: `ca.bc.gov.asago`
- Dev plist `BUNDLE_ID`: `ca.bc.gov.asago.dev`

If the wrong plist is used, Firebase Messaging will not be configured for the installed app correctly.

The same rule applies on Android: if the wrong `google-services.json` is used, Firebase Messaging will not be configured for the installed app correctly.

## GoogleService-Info.plist

`GoogleService-Info.plist` is the iOS Firebase app config file.

It tells the app which Firebase project/app to talk to, including:

- Firebase project ID
- iOS app ID
- sender ID
- API key
- expected iOS bundle ID

It is required locally in the iOS project.

## google-services.json

`google-services.json` is the Android Firebase app config file.

It tells the Android app which Firebase project/app to talk to, including:

- Firebase project ID
- Android app ID
- sender ID
- API key
- expected Android application ID

It is required locally in the Android project.

## Google Play App Signing

When distributing via the Play Store, Google re-signs your APK with their own App Signing Key rather than your local upload key. Firebase needs the SHA-1 of this key registered to validate the app's identity when requesting FCM tokens.
To get it: Play Console -> Test and release -> App Integrity -> App signing → copy the SHA-1 and add it to the app in Firebase Console under Project Settings.

## APNs auth key

The APNs auth key is the Apple push key used by Firebase to send iOS notifications through APNs.

Important points:

- It is only uploaded in Firebase Console.
- It can be used for both development and production APNs delivery.

Because we have separate Firebase setups for dev and prod, make sure the Firebase project used by each app has APNs configured.

## What lives where

We use different Firebase app configs for prod and dev on both platforms.

- Prod Firebase plist: `ios/App/App/Firebase/Prod/GoogleService-Info.plist`
- Dev Firebase plist: `ios/App/App/Firebase/Dev/GoogleService-Info.plist`
- Prod Android config: `android/app/src/prod/google-services.json`
- Dev Android config: `android/app/src/dev/google-services.json`

In the app folder:

- iOS bundle IDs
- Android application IDs / flavors
- Xcode targets/schemes (`ASA Go` and `ASA Go Dev`)
- `GoogleService-Info.plist`
- `google-services.json`
- Capacitor config

In Firebase Console:

- APNs auth key upload for iOS
- Android SHA-1 upload for Android
- Firebase app registration for each bundle ID

## Why we use separate app IDs

This repo uses separate app IDs for dev and prod instead of trying to inject only Firebase config into one app identity.

This lets dev and prod be installed on the same device at the same time. It also keeps dev push notifications separate from
prod and makes the Firebase app registration clearer, because each app variant has its own app ID.

On iOS, the current implementation uses separate Xcode targets and separate `Info.plist` files for those app identities.

## Running dev vs prod

`capacitor.config.ts` switches between dev and prod using `APP_ENV`.

Examples:

```bash
APP_ENV=dev yarn cap:sync:ios:dev
APP_ENV=prod yarn cap:sync:ios:prod
```

For live reload:

```bash
APP_ENV=dev ionic capacitor run ios -l --external
APP_ENV=prod ionic capacitor run ios -l --external
APP_ENV=dev ionic capacitor run android -l --external
APP_ENV=prod ionic capacitor run android -l --external
```

On iOS, `APP_ENV=dev` selects the `ASA Go Dev` scheme and `APP_ENV=prod` selects `ASA Go`.
46 changes: 37 additions & 9 deletions mobile/asa-go/README.md
Original file line number Diff line number Diff line change
Expand Up @@ -2,6 +2,8 @@

Capacitor app using react/vite.

For iOS & Android Firebase push notification setup details, see [Notifications.md](Notifications.md).

## Building

The keycloak plugin must be built before installing asa-go dependencies, as asa-go resolves it as a local path dependency.
Expand All @@ -26,8 +28,13 @@ yarn build

1. Make sure xcode is installed with `xcode-select --install`
2. Go to `mobile/asa-go`
3. Run `yarn cap sync ios` to synchronize app with iOS platform (handles `pod install`)
4. Build and run with live reload: `ionic cap run ios -l --external`
3. Run `APP_ENV=dev yarn cap:sync:ios:dev` or `APP_ENV=prod yarn cap:sync:ios:prod`
4. List available devices/simulators with `ionic capacitor run ios --list`
5. Build and run with live reload:
- `APP_ENV=dev ionic capacitor run ios -l --external`
- `APP_ENV=prod ionic capacitor run ios -l --external`

`APP_ENV=dev` selects the `ASA Go Dev` iOS scheme and `APP_ENV=prod` selects `ASA Go`.

### Building/Running Android

Expand All @@ -36,14 +43,20 @@ yarn build
- With Jetbrains Toolbox it should be `/Users/<user>/Library/Android/sdk/`
- Set `$ANDROID_HOME` to the path of the Android SDK
3. Go to `mobile/asa-go`
4. Run `yarn cap sync android` to synchronize app with Android platform
5. Build and run with live reload: `ionic cap run android -l --external`
4. Run `APP_ENV=dev yarn cap:sync:android:dev` or `APP_ENV=prod yarn cap:sync:android:prod`
5. If you are building from Android Studio, open the [`android`](/Users/breedwar/projects/other/wps/mobile/asa-go/android) project and choose the matching build variant in the `Build Variants` tool window:
- `devDebug` or `devRelease` after a dev sync
- `prodDebug` or `prodRelease` after a prod sync
6. Build and run with live reload: `APP_ENV=dev ionic capacitor run android -l --external` or `APP_ENV=prod ionic capacitor run android -l --external`

If the selected Android Studio build variant does not match the last `cap sync` flavor, you can end up with mismatched native config and web assets.

To build a debug APK directly:

```bash
cd mobile/asa-go/android
./gradlew assembleDebug
./gradlew assembleDevDebug
./gradlew assembleProdDebug
```

#### Running on a physical Android device against your local API
Expand Down Expand Up @@ -73,9 +86,24 @@ pmtiles extract https://build.protomaps.com/20250326.pmtiles bc_basemap_20250326

### Distributing

Bump `appBuildVersion` appropriately via semvar, in `.github/workflows/asa_go_build_deploy.yml`.
Run: `gh workflow run "Publish ASA Go"`
This will build and publish the app that is on the `main` branch.
Bump `appBuildVersion` appropriately in:

- `.github/workflows/asa_go_android_build.yml`
- `.github/workflows/asa_go_ios_build_deploy.yml`

Run the Android build workflow:

```bash
gh workflow run "Build ASA Go Android" --ref <branch-name>
```

Run the iOS build/deploy workflow:

```bash
gh workflow run "Publish ASA Go iOS" --ref <branch-name>
```

These workflows build the app from the specified branch.

## CI Workflows

Expand All @@ -91,7 +119,7 @@ All three jobs use the shared composite action `.github/actions/asa-go-setup`, w

1. Sets up Node.js 20
2. Caches and installs `mobile/keycloak` node_modules, then runs `yarn build`
3. Caches and installs `mobile/asa-go` node_modules, then runs `yarn build`
3. Caches and installs `mobile/asa-go` node_modules

### Android Release Build (`.github/workflows/asa_go_android_build.yml`)

Expand Down
Loading
Loading