Skip to content
Merged
Show file tree
Hide file tree
Changes from 5 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
97 changes: 97 additions & 0 deletions .github/workflows/store_deploy_android.yml
Original file line number Diff line number Diff line change
@@ -0,0 +1,97 @@
## Github Actions CI workflow to deploy to Internal testing in the Play Store
name: CI_STORE_DEPLOY_ANDROID

on:
# Run this workflow when any new code is pushed into the main branch
push:
branches:
- main
- master
- deploy-actions
Copy link

Copilot AI Aug 5, 2025

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

The 'deploy-actions' branch appears to be a temporary development branch. Consider removing it from the production workflow triggers to avoid unintended deployments from feature branches.

Suggested change
- deploy-actions

Copilot uses AI. Check for mistakes.

jobs:
store_deploy_android:

name: android store release
runs-on: ubuntu-latest
env:
# Setup env variables that will be used throughout the workflow
JAVA_VERSION: 17.0.12
FLUTTER_VERSION: 3.32.5
AAB_PATH: build/app/outputs/bundle/release/app-release.aab
Comment on lines +18 to +21
Copy link

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

⚠️ Potential issue

Suspicious Flutter version

3.32.5 does not match any released Flutter SDK tag (current stable < 4.0). The action will fail when it tries to fetch this version.

-      FLUTTER_VERSION: 3.32.5
+      # Pin to an existing stable tag (e.g. the version used by the repo)
+      FLUTTER_VERSION: 3.22.0

Verify against flutter --version in the project.

📝 Committable suggestion

‼️ IMPORTANT
Carefully review the code before committing. Ensure that it accurately replaces the highlighted code, contains no missing lines, and has no issues with indentation. Thoroughly test & benchmark the code to ensure it meets the requirements.

Suggested change
# Setup env variables that will be used throughout the workflow
JAVA_VERSION: 17.0.12
FLUTTER_VERSION: 3.32.5
AAB_PATH: build/app/outputs/bundle/release/app-release.aab
# Setup env variables that will be used throughout the workflow
JAVA_VERSION: 17.0.12
# Pin to an existing stable tag (e.g. the version used by the repo)
FLUTTER_VERSION: 3.22.0
AAB_PATH: build/app/outputs/bundle/release/app-release.aab
🤖 Prompt for AI Agents
In .github/workflows/store_deploy_android.yml around lines 18 to 21, the Flutter
version is set to 3.32.5, which is not a valid released Flutter SDK version and
will cause the action to fail. Check the actual Flutter version used in the
project by running `flutter --version` locally, then update the FLUTTER_VERSION
variable to match the correct stable version tag.

KEYSTORE_PATH: android/upload-keystore.jks
KEY_PROPS_PATH: android/key.properties
SERVICE_ACCOUNT_PATH: store_credentials.json
FIREBASE_OPTIONS_PATH: lib/firebase_options.dart
GOOGLE_SERVICES_ANDROID_PATH: android/app/google-services.json
steps:
# Checkout repository codebase
- name: Checkout the code
uses: actions/checkout@v3
Copy link

Copilot AI Aug 5, 2025

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Using actions/checkout@v3 is outdated. Consider upgrading to actions/checkout@v4 for better performance and security updates.

Suggested change
uses: actions/checkout@v3
uses: actions/checkout@v4

Copilot uses AI. Check for mistakes.

# Setup Java in the VM
- name: Setup Java to compile the Android project
uses: actions/setup-java@v2
Copy link

Copilot AI Aug 5, 2025

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Using actions/setup-java@v2 is deprecated. Consider upgrading to actions/setup-java@v4 for better performance and security updates.

Suggested change
uses: actions/setup-java@v2
uses: actions/setup-java@v4

Copilot uses AI. Check for mistakes.
with:
distribution: 'zulu'
java-version: ${{ env.JAVA_VERSION }}

# Setup Flutter in the VM
- name: Setup Flutter
uses: subosito/flutter-action@v2
with:
flutter-version: ${{ env.FLUTTER_VERSION }}

# Decode Android env variables
- name: Decode Android keystore
run: echo "${{ secrets.ANDROID_KEYSTORE }}" | base64 --decode > ${{ env.KEYSTORE_PATH }}

- name: Decode Android key properties
run: echo "${{ secrets.ANDROID_KEY_PROPERTIES }}" | base64 --decode > ${{ env.KEY_PROPS_PATH }}

# Decode Android release Service Account
- name: Decode Android Service Account
run: echo "${{ secrets.ANDROID_RELEASE_SERVICE_ACCOUNT }}" | base64 --decode > ${{ env.SERVICE_ACCOUNT_PATH }}

#Decode Google Services JSON for Android
- name: Decode Android Google Services JSON
run: echo "${{ secrets.GOOGLE_SERVICES_ANDROID }}" | base64 --decode > ${{ env.GOOGLE_SERVICES_ANDROID_PATH }}

# Decode Firebase Options Dart file
- name: Decode Firebase Options
run: echo "${{ secrets.FIREBASE_OPTIONS }}" | base64 --decode > ${{ env.FIREBASE_OPTIONS_PATH }}

- name: 📦 Install dependencies
run: flutter pub get

#Enable after Decoupling is completed
# - name: 🕵️ Analyze to check for bad Dart/Flutter practices
# run: flutter analyze

#Enable after Tests are written
# - name: 📉 Run all app tests
# run: flutter test

# Build Android Bundle release file
- name: Build aab
run: |
flutter build appbundle \
--release \
--dart-define=APPWRITE_BASE_DOMAIN=${{ secrets.APPWRITE_BASE_DOMAIN }} \
--dart-define=APPWRITE_PROJECT_ID=${{ secrets.APPWRITE_PROJECT_ID }}

Comment on lines +75 to +82
Copy link

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

🛠️ Refactor suggestion

Hard-fail build when secrets are absent

If a secret is undefined, flutter build will insert an empty string, producing the localhost fallback above. Add set -euo pipefail and explicit checks:

- run: |
+ run: |
     [[ -n "${{ secrets.APPWRITE_BASE_DOMAIN }}" ]] || { echo "Missing APPWRITE_BASE_DOMAIN"; exit 1; }
     [[ -n "${{ secrets.APPWRITE_PROJECT_ID }}" ]]   || { echo "Missing APPWRITE_PROJECT_ID"; exit 1; }
     flutter build appbundle \
🤖 Prompt for AI Agents
In .github/workflows/store_deploy_android.yml around lines 75 to 82, the flutter
build command uses secrets that may be undefined, causing fallback to localhost.
To fix this, add `set -euo pipefail` at the start of the run script and insert
explicit checks for the presence of APPWRITE_BASE_DOMAIN and APPWRITE_PROJECT_ID
secrets before running flutter build. If any secret is missing, output an error
message and exit with failure to prevent proceeding with empty values.

# Upload generated aab to project artifacts
- name: Upload generated aab to the artifacts
uses: actions/upload-artifact@master
Copy link

Copilot AI Aug 5, 2025

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Using actions/upload-artifact@master is not recommended as it references a moving target. Use a specific version tag like actions/upload-artifact@v4 for better stability and security.

Suggested change
uses: actions/upload-artifact@master
uses: actions/upload-artifact@v4

Copilot uses AI. Check for mistakes.
with:
name: aab-stores
path: ${{ env.AAB_PATH }}

# Deploy bundle to Google Play internal testing
- name: Deploy to Play Store (Internal testing)
uses: r0adkll/upload-google-play@v1
with:
serviceAccountJson: ${{ env.SERVICE_ACCOUNT_PATH }}
packageName: com.resonate.resonate
releaseFiles: ${{ env.AAB_PATH }}
track: internal
2 changes: 1 addition & 1 deletion ONBOARDING.md
Original file line number Diff line number Diff line change
Expand Up @@ -103,7 +103,7 @@ Now appwrite function pushing will start and just press 'a' char on keyboard to

### Connecting Frontend and Backend

You just need to update the baseDomain variable value in the constants.dart on client side based on how you are running the client side app
Now, on client side, based on how you are running the client side app you need to update the default value of the baseDomain variable in ```constants.dart``` or you can pass it in as an argument with ```flutter run``` using ```--dart-define=APPWRITE_BASE_DOMAIN=<Your baseDomain>```

| Platform | Base Domain |
| ----------------- | ----------------------------------------------------------------------------------------------------- |
Expand Down
1 change: 1 addition & 0 deletions android/.gitignore
Original file line number Diff line number Diff line change
Expand Up @@ -14,3 +14,4 @@ key.properties
app/google-services.json

/app/.cxx/
keys/
7 changes: 4 additions & 3 deletions lib/utils/constants.dart
Original file line number Diff line number Diff line change
@@ -1,9 +1,10 @@
// This file contains constants that are used throughout the app.

// Appwrite Project Constants
const String baseDomain = "192.168.29.24";
//const String baseDomain = "10.0.2.2";
const String appwriteProjectId = "resonate";
const String baseDomain =
String.fromEnvironment('APPWRITE_BASE_DOMAIN', defaultValue: 'localhost');
const String appwriteProjectId =
String.fromEnvironment('APPWRITE_PROJECT_ID', defaultValue: 'resonate');
Comment on lines +4 to +7
Copy link

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

⚠️ Potential issue

Environment-variable fallback may silently hit localhost in production

If APPWRITE_BASE_DOMAIN / APPWRITE_PROJECT_ID secrets are missing at build-time, the release build will connect to localhost / resonate, causing hard-to-debug prod outages.

-const String baseDomain =
-    String.fromEnvironment('APPWRITE_BASE_DOMAIN', defaultValue: 'localhost');
+const String baseDomain = String.fromEnvironment('APPWRITE_BASE_DOMAIN');
 
-const String appwriteProjectId =
-    String.fromEnvironment('APPWRITE_PROJECT_ID', defaultValue: 'resonate');
+const String appwriteProjectId = String.fromEnvironment('APPWRITE_PROJECT_ID');
+
+// Fail fast – throw if envs are absent in non-debug builds.
+void _ensureEnv() {
+  const bool _isDebug =
+      bool.fromEnvironment('dart.vm.product') == false; // true in debug/profile
+  if (!_isDebug && (baseDomain.isEmpty || appwriteProjectId.isEmpty)) {
+    throw StateError('Missing required compile-time env variables.');
+  }
+}
+// Call once on app start (e.g. in main()).
📝 Committable suggestion

‼️ IMPORTANT
Carefully review the code before committing. Ensure that it accurately replaces the highlighted code, contains no missing lines, and has no issues with indentation. Thoroughly test & benchmark the code to ensure it meets the requirements.

Suggested change
const String baseDomain =
String.fromEnvironment('APPWRITE_BASE_DOMAIN', defaultValue: 'localhost');
const String appwriteProjectId =
String.fromEnvironment('APPWRITE_PROJECT_ID', defaultValue: 'resonate');
const String baseDomain = String.fromEnvironment('APPWRITE_BASE_DOMAIN');
const String appwriteProjectId = String.fromEnvironment('APPWRITE_PROJECT_ID');
// Fail fast – throw if envs are absent in non-debug builds.
void _ensureEnv() {
const bool _isDebug =
bool.fromEnvironment('dart.vm.product') == false; // true in debug/profile
if (!_isDebug && (baseDomain.isEmpty || appwriteProjectId.isEmpty)) {
throw StateError('Missing required compile-time env variables.');
}
}
// Call once on app start (e.g. in main()).
🤖 Prompt for AI Agents
In lib/utils/constants.dart around lines 4 to 7, the current environment
variable fallbacks default to 'localhost' and 'resonate', which can cause
production builds to silently connect to incorrect values if the variables are
missing. Remove or modify the defaultValue parameters so that missing
environment variables cause a clear failure or warning at build time, preventing
silent fallback to unsafe defaults in production.

const String appwriteEndpoint = "http://$baseDomain:80/v1";
const String localhostLivekitEndpoint = "http://$baseDomain:7880";

Expand Down
2 changes: 1 addition & 1 deletion pubspec.yaml
Original file line number Diff line number Diff line change
Expand Up @@ -17,7 +17,7 @@ publish_to: 'none' # Remove this line if you wish to publish to pub.dev
# https://developer.apple.com/library/archive/documentation/General/Reference/InfoPlistKeyReference/Articles/CoreFoundationKeys.html
# In Windows, build-name is used as the major, minor, and patch parts
# of the product and file versions while build-number is used as the build suffix.
version: 1.0.1+2
version: 1.0.1+3

environment:
sdk: '>=3.2.4 <4.0.0'
Expand Down