From 46e25b248ad6ccbe5d198e4f31b303a92bbe73ff Mon Sep 17 00:00:00 2001 From: Karin Berg Date: Sun, 1 Dec 2024 12:51:43 +0100 Subject: [PATCH 01/19] Add example launch json --- recipients_app/.vscode/launch.json.example | 56 ++++++++++++++++++++++ 1 file changed, 56 insertions(+) create mode 100644 recipients_app/.vscode/launch.json.example diff --git a/recipients_app/.vscode/launch.json.example b/recipients_app/.vscode/launch.json.example new file mode 100644 index 000000000..c641439f4 --- /dev/null +++ b/recipients_app/.vscode/launch.json.example @@ -0,0 +1,56 @@ +{ + // Use IntelliSense to learn about possible attributes. + // Hover to view descriptions of existing attributes. + // For more information, visit: https://go.microsoft.com/fwlink/?linkid=830387 + + // This is our example launch config. Set the prefered flavor, SURVEY_BASE_URL and SENTRY_URL + "version": "0.2.0", + "configurations": [ + { + "name": "stage_recipients_app (debug mode)", + "request": "launch", + "type": "dart", + "flutterMode": "debug", + "program": "lib/main.dart", + "args": [ + "--flavor", + "stage", + "--dart-define", + "SURVEY_BASE_URL=staging.socialincome.org", + "--dart-define", + "SENTRY_URL=FILL IN SENTRY URL", + + ], + }, + { + "name": "stage_recipients_app (profile mode)", + "request": "launch", + "type": "dart", + "flutterMode": "profile", + "program": "lib/main.dart", + "args": [ + "--flavor", + "stage", + "--dart-define", + "SURVEY_BASE_URL=staging.socialincome.org", + "--dart-define", + "SENTRY_URL=FILL IN SENTRY URL", + ], + }, + { + "name": "stage_recipients_app (release mode)", + "request": "launch", + "type": "dart", + "flutterMode": "release", + "program": "lib/main.dart", + "args": [ + "--flavor", + "stage", + "--dart-define", + "SURVEY_BASE_URL=staging.socialincome.org", + "--dart-define", + "SENTRY_URL=FILL IN SENTRY URL", + ], + } + ] +} From f35e5a47d76cc62550fbbc95ee569bed3e6c2856 Mon Sep 17 00:00:00 2001 From: Karin Berg Date: Sun, 1 Dec 2024 12:52:11 +0100 Subject: [PATCH 02/19] add asdf version file --- recipients_app/.tool-versions | 1 + 1 file changed, 1 insertion(+) create mode 100644 recipients_app/.tool-versions diff --git a/recipients_app/.tool-versions b/recipients_app/.tool-versions new file mode 100644 index 000000000..f6e159696 --- /dev/null +++ b/recipients_app/.tool-versions @@ -0,0 +1 @@ +flutter 3.19.6 From d5ece5fff6d85573ac963860b61a10982d751155 Mon Sep 17 00:00:00 2001 From: Karin Berg Date: Sun, 1 Dec 2024 18:11:34 +0100 Subject: [PATCH 03/19] Add clean_build.sh file --- recipients_app/clean_build.sh | 6 ++++++ 1 file changed, 6 insertions(+) create mode 100755 recipients_app/clean_build.sh diff --git a/recipients_app/clean_build.sh b/recipients_app/clean_build.sh new file mode 100755 index 000000000..1b4e818ca --- /dev/null +++ b/recipients_app/clean_build.sh @@ -0,0 +1,6 @@ +#!/bin/zsh + +flutter clean +flutter pub get +dart run build_runner build --delete-conflicting-outputs +flutter gen-l10n \ No newline at end of file From 4b6cf391b641cc3b79864eeee9b3e60c2eb28933 Mon Sep 17 00:00:00 2001 From: Karin Berg Date: Sun, 1 Dec 2024 18:12:18 +0100 Subject: [PATCH 04/19] Add information about needed tools to build the app --- recipients_app/README.md | 83 +++++++++++++++++++++++++++++++++------- 1 file changed, 70 insertions(+), 13 deletions(-) diff --git a/recipients_app/README.md b/recipients_app/README.md index bf0673022..e18e5dcb3 100644 --- a/recipients_app/README.md +++ b/recipients_app/README.md @@ -2,24 +2,83 @@ Mobile App for Recipients of a Social Income. -## Basic Setup - -For the basic setup, please refer to the main [README](../README.md) - -## Getting Started - -Open `recipients_app` project folder in your development environment of -choice. Building flavor should work seamlessly for Android Studio and VS +## Tools needed for building the app on a Apple Silicon Mac + +- [Homebrew](https://brew.sh/de/) +- Flutter 3.19.6, Dart 3.3.4 +- Java JDK 17 +- Android Studio LadyBug or later +- Latest vsCode +- Xcode 16.1 + +## Configure the Apple Silicon Mac environment to build our app +- Install [Homebrew](https://brew.sh/de/) + ``` + /bin/bash -c "$(curl -fsSL https://raw.githubusercontent.com/Homebrew/install/HEAD/install.sh)" + ``` +- Install Android Studio LadyBug or later + - Set ANDROID_HOME and deprecated ANDROID_SDK_ROOT. Add the following lines in your USER's HOME directory in your .zshrc file: + ``` + export ANDROID_HOME="/Users/karinberg/Development/Android/SDK" + export ANDROID_SDK_ROOT="$ANDROID_HOME" # ANDROID_SDK_ROOT is deprecated, but still in use + export PATH="$PATH:$ANDROID_HOME/emulator:$ANDROID_HOME/tools:$ANDROID_HOME/tools/bin:$ANDROID_HOME/platform-tools" + ```` + - Restart your terminal so that these changes take effect +- Install Java 17 via Homebrew `brew install openjdk@17` + - Homebrew is telling you to execute a symlink command, so that the system Java wrappers can find this JDK. Please do this. + - Additionally in your USER's HOME directory in the file '.zshrc', add the lines to set the JAVA_HOME environment variable to Java 17 and add Java to the PATH environment variable + ``` + export JAVA_HOME=$(/usr/libexec/java_home -v17) + export PATH="$PATH:$JAVA_HOME/bin" + ``` + - Restart your terminal so that these changes take effect +- Install Flutter 3.19.6 + - Tell Flutter to not use the Java JDK from Android Studio via `flutter config --jdk-dir $JAVA_HOME` + - Restart your terminal and IDE so that these changes take effect +- Install vsCode + - Install Flutter extension +- Install Xcode 16.1 + - Set is as default via `sudo xcode-select -s Xcode.app` + - To agree to the Xcode license from the command line, you can use the following command: `sudo xcodebuild -license accept` + + ## Optionally: Use the version manager [asdf](https://asdf-vm.com/) + - Install [asdf](https://asdf-vm.com/) via Homebrew with `brew install asdf` + - Install flutter plugin for asdf via `asdf plugin-add flutter` + - Add the following lines in your .zshrc file: + ``` + export FLUTTER_ROOT="$(asdf where flutter)" + ### asdf stuff ############ + source $(brew --prefix asdf)/libexec/asdf.sh + export ASDF_NODEJS_LEGACY_FILE_DYNAMIC_STRATEGY=latest_available + # This is optional. It installs tools defined in .tool-versions on terminal start + asdf install + ########################### + ``` + +## Build and run the app the first time with vsCode +- Checkout main branch: `git clone https://github.com/socialincome-san/public.git ./social-income/` +- Copy file `./.vscode/launch.json.example` and rename it to `./.vscode/launch.json` + - Replace the value "FILL IN SENTRY URL" after "SENTRY_URL=" with the real Sentry url to be able to use Sentry + - Decide which flavor and backend environment you what to use and change it if necessary. +- Open `recipients_app` project folder in vsCode +- Open an terminal inside of vsCode and check `flutter --version` is listing the right flutter version (See above or pubspec.yaml). +- Run `./clean_build.sh` +- Choose in vsCode the device to deploy on (iOS Simulator, Android emulator, real Android or iOS device) +- Run the launch configuration "stage_recipients_app (debug mode)" to deploy and run the app on the selected devive in debug mode +- Happy testing!! + +## Available app flavors + + Building flavor should work seamlessly for Android Studio and VS Code with predefined build configs. We have three build flavors: - `dev` -> Connecting with Firebase Emulators (Firestore and Auth) - `stage` -> Connecting with staging online firebase project -- `prod` -> Connecting with production online firebase project and need - real Firebase configuration json / plist file +- `prod` -> Connecting with production online firebase project and need real Firebase configuration json / plist file (not in the repo) -For development use `dev` flavor. +For development use the `dev` or `stage` flavor. As Firebase emulators work on your local host machine the easiest way to run app is on the Android emulator. Real devices need some additional @@ -35,9 +94,7 @@ setup. ``` dart run build_runner watch --delete-conflicting-outputs ``` - or - ``` dart run build_runner build --delete-conflicting-outputs ``` From d6d7257d3dd01104efb556ac3e620a1b235353fd Mon Sep 17 00:00:00 2001 From: Karin Berg Date: Sun, 1 Dec 2024 18:25:38 +0100 Subject: [PATCH 05/19] Add some other useful information to the README.md --- recipients_app/README.md | 22 ++++++++++++++----- .../docu/app_release_guides/releasing.md | 1 + 2 files changed, 17 insertions(+), 6 deletions(-) diff --git a/recipients_app/README.md b/recipients_app/README.md index e18e5dcb3..83f6d59ff 100644 --- a/recipients_app/README.md +++ b/recipients_app/README.md @@ -3,7 +3,6 @@ Mobile App for Recipients of a Social Income. ## Tools needed for building the app on a Apple Silicon Mac - - [Homebrew](https://brew.sh/de/) - Flutter 3.19.6, Dart 3.3.4 - Java JDK 17 @@ -16,7 +15,7 @@ Mobile App for Recipients of a Social Income. ``` /bin/bash -c "$(curl -fsSL https://raw.githubusercontent.com/Homebrew/install/HEAD/install.sh)" ``` -- Install Android Studio LadyBug or later +- Install Android Studio - Set ANDROID_HOME and deprecated ANDROID_SDK_ROOT. Add the following lines in your USER's HOME directory in your .zshrc file: ``` export ANDROID_HOME="/Users/karinberg/Development/Android/SDK" @@ -32,12 +31,12 @@ Mobile App for Recipients of a Social Income. export PATH="$PATH:$JAVA_HOME/bin" ``` - Restart your terminal so that these changes take effect -- Install Flutter 3.19.6 +- Install Flutter - Tell Flutter to not use the Java JDK from Android Studio via `flutter config --jdk-dir $JAVA_HOME` - Restart your terminal and IDE so that these changes take effect - Install vsCode - Install Flutter extension -- Install Xcode 16.1 +- Install Xcode - Set is as default via `sudo xcode-select -s Xcode.app` - To agree to the Xcode license from the command line, you can use the following command: `sudo xcodebuild -license accept` @@ -89,7 +88,8 @@ setup. 1. Github for issue related discussion 2. Everything else on [Slack](https://social-income.slack.com/home) -## Rebuilding JSON Serialization +## How tos +### Rebuilding JSON Serialization ``` dart run build_runner watch --delete-conflicting-outputs @@ -99,7 +99,7 @@ or dart run build_runner build --delete-conflicting-outputs ``` -## Rebuilding Translations +### Rebuilding Translations Translations are stored in lib/l10n/app_en.arb. To rebuild the translations after you changed something run: @@ -112,6 +112,16 @@ To use a translated string in the code use: `AppLocalizations.of(context).helloWorld` and import: `import 'package:flutter_gen/gen_l10n/app_localizations.dart';` +### Upgrade flutter version +If you upgrade the flutter version, you have to change the following locations as well: +- pubspec.yaml + - Under 'environment' adjust the 'sdk' and 'flutter' versions +- .tool-versions (version file for version manager ASDF) + - If you use 'asdf' run the comman `asdf local flutter x.y.z` #Replace x.y.z with the new Flutter version. + - Otherwise just update the version number in the file +- README.md + - Find all places in the README.md which mentions the Flutter version number + ## Testing ### Manually diff --git a/recipients_app/docu/app_release_guides/releasing.md b/recipients_app/docu/app_release_guides/releasing.md index b1d9ee46a..17fe67dde 100644 --- a/recipients_app/docu/app_release_guides/releasing.md +++ b/recipients_app/docu/app_release_guides/releasing.md @@ -1,6 +1,7 @@ # How to release the apps 1. Increment app version and build number in pubspec.yaml + - Open 'pubspec.yaml' and increase 'version' with the desired app version and the version code by incrementing the '+' part by 1. Incrementing the version code is a must have for a new prod version. Otherwise the stores will not accept the new app. 1. Run CodeMagic Build "iOS Staging (Firebase App Distribution)" 1. Run CodeMagic Build "Android Staging (Firebase App Distribution)" 1. Test the app on the Staging environment. See From 1dff6d3d7093f581246e82eeb5df580662da80dd Mon Sep 17 00:00:00 2001 From: Karin Berg Date: Sun, 1 Dec 2024 18:29:23 +0100 Subject: [PATCH 06/19] Small changes --- recipients_app/README.md | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/recipients_app/README.md b/recipients_app/README.md index 83f6d59ff..a4b078545 100644 --- a/recipients_app/README.md +++ b/recipients_app/README.md @@ -32,7 +32,7 @@ Mobile App for Recipients of a Social Income. ``` - Restart your terminal so that these changes take effect - Install Flutter - - Tell Flutter to not use the Java JDK from Android Studio via `flutter config --jdk-dir $JAVA_HOME` + - Tell Flutter to use our Java 17 JDK and not the one bundle with Android Studio via `flutter config --jdk-dir $JAVA_HOME`. Otherwise you will get the error "Unsupported class file major version 65” when building the app for Android. - Restart your terminal and IDE so that these changes take effect - Install vsCode - Install Flutter extension From 11e5fd0ebcafb740f756056102db91b2a9bafb83 Mon Sep 17 00:00:00 2001 From: KarinBerg Date: Sun, 1 Dec 2024 17:34:41 +0000 Subject: [PATCH 07/19] Prettified Code! --- recipients_app/README.md | 101 +++++++++++------- .../docu/app_release_guides/releasing.md | 5 +- 2 files changed, 69 insertions(+), 37 deletions(-) diff --git a/recipients_app/README.md b/recipients_app/README.md index a4b078545..6f1746387 100644 --- a/recipients_app/README.md +++ b/recipients_app/README.md @@ -3,79 +3,100 @@ Mobile App for Recipients of a Social Income. ## Tools needed for building the app on a Apple Silicon Mac + - [Homebrew](https://brew.sh/de/) - Flutter 3.19.6, Dart 3.3.4 -- Java JDK 17 +- Java JDK 17 - Android Studio LadyBug or later - Latest vsCode - Xcode 16.1 ## Configure the Apple Silicon Mac environment to build our app -- Install [Homebrew](https://brew.sh/de/) + +- Install [Homebrew](https://brew.sh/de/) ``` /bin/bash -c "$(curl -fsSL https://raw.githubusercontent.com/Homebrew/install/HEAD/install.sh)" ``` - Install Android Studio - - Set ANDROID_HOME and deprecated ANDROID_SDK_ROOT. Add the following lines in your USER's HOME directory in your .zshrc file: + - Set ANDROID_HOME and deprecated ANDROID_SDK_ROOT. Add the following + lines in your USER's HOME directory in your .zshrc file: ``` export ANDROID_HOME="/Users/karinberg/Development/Android/SDK" export ANDROID_SDK_ROOT="$ANDROID_HOME" # ANDROID_SDK_ROOT is deprecated, but still in use export PATH="$PATH:$ANDROID_HOME/emulator:$ANDROID_HOME/tools:$ANDROID_HOME/tools/bin:$ANDROID_HOME/platform-tools" - ```` + ``` - Restart your terminal so that these changes take effect - Install Java 17 via Homebrew `brew install openjdk@17` - - Homebrew is telling you to execute a symlink command, so that the system Java wrappers can find this JDK. Please do this. - - Additionally in your USER's HOME directory in the file '.zshrc', add the lines to set the JAVA_HOME environment variable to Java 17 and add Java to the PATH environment variable + - Homebrew is telling you to execute a symlink command, so that the + system Java wrappers can find this JDK. Please do this. + - Additionally in your USER's HOME directory in the file '.zshrc', add + the lines to set the JAVA_HOME environment variable to Java 17 and + add Java to the PATH environment variable ``` export JAVA_HOME=$(/usr/libexec/java_home -v17) export PATH="$PATH:$JAVA_HOME/bin" ``` - Restart your terminal so that these changes take effect - Install Flutter - - Tell Flutter to use our Java 17 JDK and not the one bundle with Android Studio via `flutter config --jdk-dir $JAVA_HOME`. Otherwise you will get the error "Unsupported class file major version 65” when building the app for Android. + - Tell Flutter to use our Java 17 JDK and not the one bundle with + Android Studio via `flutter config --jdk-dir $JAVA_HOME`. Otherwise + you will get the error "Unsupported class file major version 65” + when building the app for Android. - Restart your terminal and IDE so that these changes take effect - Install vsCode - Install Flutter extension - Install Xcode - Set is as default via `sudo xcode-select -s Xcode.app` - - To agree to the Xcode license from the command line, you can use the following command: `sudo xcodebuild -license accept` + - To agree to the Xcode license from the command line, you can use the + following command: `sudo xcodebuild -license accept` + +## Optionally: Use the version manager [asdf](https://asdf-vm.com/) + +- Install [asdf](https://asdf-vm.com/) via Homebrew with + `brew install asdf` +- Install flutter plugin for asdf via `asdf plugin-add flutter` +- Add the following lines in your .zshrc file: + ``` + export FLUTTER_ROOT="$(asdf where flutter)" + ### asdf stuff ############ + source $(brew --prefix asdf)/libexec/asdf.sh + export ASDF_NODEJS_LEGACY_FILE_DYNAMIC_STRATEGY=latest_available + # This is optional. It installs tools defined in .tool-versions on terminal start + asdf install + ########################### + ``` - ## Optionally: Use the version manager [asdf](https://asdf-vm.com/) - - Install [asdf](https://asdf-vm.com/) via Homebrew with `brew install asdf` - - Install flutter plugin for asdf via `asdf plugin-add flutter` - - Add the following lines in your .zshrc file: - ``` - export FLUTTER_ROOT="$(asdf where flutter)" - ### asdf stuff ############ - source $(brew --prefix asdf)/libexec/asdf.sh - export ASDF_NODEJS_LEGACY_FILE_DYNAMIC_STRATEGY=latest_available - # This is optional. It installs tools defined in .tool-versions on terminal start - asdf install - ########################### - ``` - ## Build and run the app the first time with vsCode -- Checkout main branch: `git clone https://github.com/socialincome-san/public.git ./social-income/` -- Copy file `./.vscode/launch.json.example` and rename it to `./.vscode/launch.json` - - Replace the value "FILL IN SENTRY URL" after "SENTRY_URL=" with the real Sentry url to be able to use Sentry - - Decide which flavor and backend environment you what to use and change it if necessary. + +- Checkout main branch: + `git clone https://github.com/socialincome-san/public.git ./social-income/` +- Copy file `./.vscode/launch.json.example` and rename it to + `./.vscode/launch.json` + - Replace the value "FILL IN SENTRY URL" after "SENTRY_URL=" with the + real Sentry url to be able to use Sentry + - Decide which flavor and backend environment you what to use and + change it if necessary. - Open `recipients_app` project folder in vsCode -- Open an terminal inside of vsCode and check `flutter --version` is listing the right flutter version (See above or pubspec.yaml). +- Open an terminal inside of vsCode and check `flutter --version` is + listing the right flutter version (See above or pubspec.yaml). - Run `./clean_build.sh` -- Choose in vsCode the device to deploy on (iOS Simulator, Android emulator, real Android or iOS device) -- Run the launch configuration "stage_recipients_app (debug mode)" to deploy and run the app on the selected devive in debug mode +- Choose in vsCode the device to deploy on (iOS Simulator, Android + emulator, real Android or iOS device) +- Run the launch configuration "stage_recipients_app (debug mode)" to + deploy and run the app on the selected devive in debug mode - Happy testing!! ## Available app flavors - Building flavor should work seamlessly for Android Studio and VS -Code with predefined build configs. +Building flavor should work seamlessly for Android Studio and VS Code +with predefined build configs. We have three build flavors: - `dev` -> Connecting with Firebase Emulators (Firestore and Auth) - `stage` -> Connecting with staging online firebase project -- `prod` -> Connecting with production online firebase project and need real Firebase configuration json / plist file (not in the repo) +- `prod` -> Connecting with production online firebase project and need + real Firebase configuration json / plist file (not in the repo) For development use the `dev` or `stage` flavor. @@ -89,12 +110,15 @@ setup. 2. Everything else on [Slack](https://social-income.slack.com/home) ## How tos + ### Rebuilding JSON Serialization ``` dart run build_runner watch --delete-conflicting-outputs ``` + or + ``` dart run build_runner build --delete-conflicting-outputs ``` @@ -113,14 +137,19 @@ To use a translated string in the code use: `import 'package:flutter_gen/gen_l10n/app_localizations.dart';` ### Upgrade flutter version -If you upgrade the flutter version, you have to change the following locations as well: + +If you upgrade the flutter version, you have to change the following +locations as well: + - pubspec.yaml - Under 'environment' adjust the 'sdk' and 'flutter' versions -- .tool-versions (version file for version manager ASDF) - - If you use 'asdf' run the comman `asdf local flutter x.y.z` #Replace x.y.z with the new Flutter version. +- .tool-versions (version file for version manager ASDF) + - If you use 'asdf' run the comman `asdf local flutter x.y.z` #Replace + x.y.z with the new Flutter version. - Otherwise just update the version number in the file - README.md - - Find all places in the README.md which mentions the Flutter version number + - Find all places in the README.md which mentions the Flutter version + number ## Testing diff --git a/recipients_app/docu/app_release_guides/releasing.md b/recipients_app/docu/app_release_guides/releasing.md index 17fe67dde..ea3f628fa 100644 --- a/recipients_app/docu/app_release_guides/releasing.md +++ b/recipients_app/docu/app_release_guides/releasing.md @@ -1,7 +1,10 @@ # How to release the apps 1. Increment app version and build number in pubspec.yaml - - Open 'pubspec.yaml' and increase 'version' with the desired app version and the version code by incrementing the '+' part by 1. Incrementing the version code is a must have for a new prod version. Otherwise the stores will not accept the new app. + - Open 'pubspec.yaml' and increase 'version' with the desired app + version and the version code by incrementing the '+' part by 1. + Incrementing the version code is a must have for a new prod + version. Otherwise the stores will not accept the new app. 1. Run CodeMagic Build "iOS Staging (Firebase App Distribution)" 1. Run CodeMagic Build "Android Staging (Firebase App Distribution)" 1. Test the app on the Staging environment. See From bfbbd1362a7e9eb7ff36354b7fb19735231c6ba6 Mon Sep 17 00:00:00 2001 From: Karin Berg Date: Sun, 1 Dec 2024 18:38:43 +0100 Subject: [PATCH 08/19] Update recipients_app/clean_build.sh Co-authored-by: coderabbitai[bot] <136622811+coderabbitai[bot]@users.noreply.github.com> --- recipients_app/clean_build.sh | 22 +++++++++++++++++++++- 1 file changed, 21 insertions(+), 1 deletion(-) diff --git a/recipients_app/clean_build.sh b/recipients_app/clean_build.sh index 1b4e818ca..90ad81b95 100755 --- a/recipients_app/clean_build.sh +++ b/recipients_app/clean_build.sh @@ -1,6 +1,26 @@ #!/bin/zsh +#!/bin/zsh + +# Exit on error +set -e + +# Check if Flutter is installed +if ! command -v flutter &> /dev/null; then + echo "Error: Flutter is not installed" + exit 1 +fi + +echo "Cleaning Flutter build..." flutter clean + +echo "Getting dependencies..." flutter pub get + +echo "Running build runner..." dart run build_runner build --delete-conflicting-outputs -flutter gen-l10n \ No newline at end of file + +echo "Generating localizations..." +flutter gen-l10n + +echo "Build completed successfully!" \ No newline at end of file From 3bfed1860df7cffd61d1fa2ed92dd56f1b0be7cc Mon Sep 17 00:00:00 2001 From: Karin Berg Date: Sun, 1 Dec 2024 18:45:06 +0100 Subject: [PATCH 09/19] Fix spelling mistakes and improve format --- recipients_app/README.md | 16 ++++++++-------- 1 file changed, 8 insertions(+), 8 deletions(-) diff --git a/recipients_app/README.md b/recipients_app/README.md index 6f1746387..d291592cd 100644 --- a/recipients_app/README.md +++ b/recipients_app/README.md @@ -2,7 +2,7 @@ Mobile App for Recipients of a Social Income. -## Tools needed for building the app on a Apple Silicon Mac +## Tools needed for building the app on an Apple Silicon Mac - [Homebrew](https://brew.sh/de/) - Flutter 3.19.6, Dart 3.3.4 @@ -14,13 +14,13 @@ Mobile App for Recipients of a Social Income. ## Configure the Apple Silicon Mac environment to build our app - Install [Homebrew](https://brew.sh/de/) - ``` + ```shell /bin/bash -c "$(curl -fsSL https://raw.githubusercontent.com/Homebrew/install/HEAD/install.sh)" ``` - Install Android Studio - Set ANDROID_HOME and deprecated ANDROID_SDK_ROOT. Add the following lines in your USER's HOME directory in your .zshrc file: - ``` + ```shell export ANDROID_HOME="/Users/karinberg/Development/Android/SDK" export ANDROID_SDK_ROOT="$ANDROID_HOME" # ANDROID_SDK_ROOT is deprecated, but still in use export PATH="$PATH:$ANDROID_HOME/emulator:$ANDROID_HOME/tools:$ANDROID_HOME/tools/bin:$ANDROID_HOME/platform-tools" @@ -32,14 +32,14 @@ Mobile App for Recipients of a Social Income. - Additionally in your USER's HOME directory in the file '.zshrc', add the lines to set the JAVA_HOME environment variable to Java 17 and add Java to the PATH environment variable - ``` + ```shell export JAVA_HOME=$(/usr/libexec/java_home -v17) export PATH="$PATH:$JAVA_HOME/bin" ``` - Restart your terminal so that these changes take effect - Install Flutter - Tell Flutter to use our Java 17 JDK and not the one bundle with - Android Studio via `flutter config --jdk-dir $JAVA_HOME`. Otherwise + Android Studio via `flutter config --jdk-dir $JAVA_HOME`. Otherwise, you will get the error "Unsupported class file major version 65” when building the app for Android. - Restart your terminal and IDE so that these changes take effect @@ -56,7 +56,7 @@ Mobile App for Recipients of a Social Income. `brew install asdf` - Install flutter plugin for asdf via `asdf plugin-add flutter` - Add the following lines in your .zshrc file: - ``` + ```shell export FLUTTER_ROOT="$(asdf where flutter)" ### asdf stuff ############ source $(brew --prefix asdf)/libexec/asdf.sh @@ -77,7 +77,7 @@ Mobile App for Recipients of a Social Income. - Decide which flavor and backend environment you what to use and change it if necessary. - Open `recipients_app` project folder in vsCode -- Open an terminal inside of vsCode and check `flutter --version` is +- Open a terminal inside of vsCode and check `flutter --version` is listing the right flutter version (See above or pubspec.yaml). - Run `./clean_build.sh` - Choose in vsCode the device to deploy on (iOS Simulator, Android @@ -98,7 +98,7 @@ We have three build flavors: - `prod` -> Connecting with production online firebase project and need real Firebase configuration json / plist file (not in the repo) -For development use the `dev` or `stage` flavor. +For development, use the `dev` or `stage` flavor. As Firebase emulators work on your local host machine the easiest way to run app is on the Android emulator. Real devices need some additional From e9aba49c45950a869d45ec3f73af4cd087806b9b Mon Sep 17 00:00:00 2001 From: Karin Berg Date: Sun, 1 Dec 2024 18:49:25 +0100 Subject: [PATCH 10/19] Remove double shebang and make the script executable --- recipients_app/clean_build.sh | 2 -- 1 file changed, 2 deletions(-) diff --git a/recipients_app/clean_build.sh b/recipients_app/clean_build.sh index 90ad81b95..eecfce7bc 100755 --- a/recipients_app/clean_build.sh +++ b/recipients_app/clean_build.sh @@ -1,7 +1,5 @@ #!/bin/zsh -#!/bin/zsh - # Exit on error set -e From 7a225152581c4705bb143047b48534229312046b Mon Sep 17 00:00:00 2001 From: Karin Berg Date: Sun, 1 Dec 2024 18:49:49 +0100 Subject: [PATCH 11/19] Improve README.md --- recipients_app/README.md | 1 + 1 file changed, 1 insertion(+) diff --git a/recipients_app/README.md b/recipients_app/README.md index d291592cd..1539c1a30 100644 --- a/recipients_app/README.md +++ b/recipients_app/README.md @@ -79,6 +79,7 @@ Mobile App for Recipients of a Social Income. - Open `recipients_app` project folder in vsCode - Open a terminal inside of vsCode and check `flutter --version` is listing the right flutter version (See above or pubspec.yaml). +- Add executable permissions to the script clean_build.sh via `chmod +x clean_build.sh` - Run `./clean_build.sh` - Choose in vsCode the device to deploy on (iOS Simulator, Android emulator, real Android or iOS device) From a91c841959d29e8806b00605b467659961062311 Mon Sep 17 00:00:00 2001 From: KarinBerg Date: Sun, 1 Dec 2024 17:52:07 +0000 Subject: [PATCH 12/19] Prettified Code! --- recipients_app/README.md | 3 ++- 1 file changed, 2 insertions(+), 1 deletion(-) diff --git a/recipients_app/README.md b/recipients_app/README.md index 1539c1a30..a720a848b 100644 --- a/recipients_app/README.md +++ b/recipients_app/README.md @@ -79,7 +79,8 @@ Mobile App for Recipients of a Social Income. - Open `recipients_app` project folder in vsCode - Open a terminal inside of vsCode and check `flutter --version` is listing the right flutter version (See above or pubspec.yaml). -- Add executable permissions to the script clean_build.sh via `chmod +x clean_build.sh` +- Add executable permissions to the script clean_build.sh via + `chmod +x clean_build.sh` - Run `./clean_build.sh` - Choose in vsCode the device to deploy on (iOS Simulator, Android emulator, real Android or iOS device) From ab3e7cd6ebd16ea3836a70068385a232fc26456c Mon Sep 17 00:00:00 2001 From: Karin Berg Date: Sun, 1 Dec 2024 18:53:10 +0100 Subject: [PATCH 13/19] Fix ANDROID_HOME value --- recipients_app/README.md | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/recipients_app/README.md b/recipients_app/README.md index 1539c1a30..a8b9c09b0 100644 --- a/recipients_app/README.md +++ b/recipients_app/README.md @@ -21,7 +21,7 @@ Mobile App for Recipients of a Social Income. - Set ANDROID_HOME and deprecated ANDROID_SDK_ROOT. Add the following lines in your USER's HOME directory in your .zshrc file: ```shell - export ANDROID_HOME="/Users/karinberg/Development/Android/SDK" + export ANDROID_HOME="YOUR PATH TO YOUR ANDROID SDK" export ANDROID_SDK_ROOT="$ANDROID_HOME" # ANDROID_SDK_ROOT is deprecated, but still in use export PATH="$PATH:$ANDROID_HOME/emulator:$ANDROID_HOME/tools:$ANDROID_HOME/tools/bin:$ANDROID_HOME/platform-tools" ``` From 40d39cd89535578601487706309917c64c947fc6 Mon Sep 17 00:00:00 2001 From: Karin Berg Date: Sun, 1 Dec 2024 18:59:12 +0100 Subject: [PATCH 14/19] Fix spelling mistake --- recipients_app/README.md | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/recipients_app/README.md b/recipients_app/README.md index d9084e1b9..51408f53d 100644 --- a/recipients_app/README.md +++ b/recipients_app/README.md @@ -74,7 +74,7 @@ Mobile App for Recipients of a Social Income. `./.vscode/launch.json` - Replace the value "FILL IN SENTRY URL" after "SENTRY_URL=" with the real Sentry url to be able to use Sentry - - Decide which flavor and backend environment you what to use and + - Decide which flavor and backend environment you want to use and change it if necessary. - Open `recipients_app` project folder in vsCode - Open a terminal inside of vsCode and check `flutter --version` is From 8708986eb3911c71e0b65383627561ead126cc39 Mon Sep 17 00:00:00 2001 From: Karin Berg Date: Sun, 1 Dec 2024 19:05:28 +0100 Subject: [PATCH 15/19] Add suggested "Verify Flutter version" mechanism in clean_build.sh --- recipients_app/README.md | 1 + recipients_app/clean_build.sh | 10 ++++++++++ 2 files changed, 11 insertions(+) diff --git a/recipients_app/README.md b/recipients_app/README.md index 51408f53d..df06cccfa 100644 --- a/recipients_app/README.md +++ b/recipients_app/README.md @@ -149,6 +149,7 @@ locations as well: - If you use 'asdf' run the comman `asdf local flutter x.y.z` #Replace x.y.z with the new Flutter version. - Otherwise just update the version number in the file +- Adjust variable 'REQUIRED_VERSION' in 'clean_build.sh' - README.md - Find all places in the README.md which mentions the Flutter version number diff --git a/recipients_app/clean_build.sh b/recipients_app/clean_build.sh index eecfce7bc..6afeee605 100755 --- a/recipients_app/clean_build.sh +++ b/recipients_app/clean_build.sh @@ -4,11 +4,21 @@ set -e # Check if Flutter is installed +echo "Verify Flutter is installed..." if ! command -v flutter &> /dev/null; then echo "Error: Flutter is not installed" exit 1 fi +# Verify Flutter version +echo "Verify Flutter version..." +REQUIRED_VERSION="3.19.6" +CURRENT_VERSION=$(flutter --version | head -n 1 | awk '{print $2}') +if [ "$CURRENT_VERSION" != "$REQUIRED_VERSION" ]; then + echo "Error: Flutter version $REQUIRED_VERSION is required (current: $CURRENT_VERSION)" + exit 1 +fi + echo "Cleaning Flutter build..." flutter clean From 385cae67acf18a9e13c416103a308293c10f8520 Mon Sep 17 00:00:00 2001 From: Karin Berg Date: Sun, 1 Dec 2024 19:09:08 +0100 Subject: [PATCH 16/19] Add example for app versioning --- recipients_app/docu/app_release_guides/releasing.md | 9 +++++---- 1 file changed, 5 insertions(+), 4 deletions(-) diff --git a/recipients_app/docu/app_release_guides/releasing.md b/recipients_app/docu/app_release_guides/releasing.md index ea3f628fa..e790b55bb 100644 --- a/recipients_app/docu/app_release_guides/releasing.md +++ b/recipients_app/docu/app_release_guides/releasing.md @@ -1,10 +1,11 @@ # How to release the apps 1. Increment app version and build number in pubspec.yaml - - Open 'pubspec.yaml' and increase 'version' with the desired app - version and the version code by incrementing the '+' part by 1. - Incrementing the version code is a must have for a new prod - version. Otherwise the stores will not accept the new app. + - Open 'pubspec.yaml' and increase 'version' with the desired app version and the version code by incrementing the '+' part by 1. Incrementing the version code is a must-have for a new prod version. Otherwise, the stores will not accept the new app. + + Example: + Current: version: 1.1.0+12 + New: version: 1.1.1+13 1. Run CodeMagic Build "iOS Staging (Firebase App Distribution)" 1. Run CodeMagic Build "Android Staging (Firebase App Distribution)" 1. Test the app on the Staging environment. See From 485f69743306155241be858888f4e46f3d4aee74 Mon Sep 17 00:00:00 2001 From: KarinBerg Date: Sun, 1 Dec 2024 18:11:25 +0000 Subject: [PATCH 17/19] Prettified Code! --- recipients_app/docu/app_release_guides/releasing.md | 13 ++++++++----- 1 file changed, 8 insertions(+), 5 deletions(-) diff --git a/recipients_app/docu/app_release_guides/releasing.md b/recipients_app/docu/app_release_guides/releasing.md index e790b55bb..d710bfbba 100644 --- a/recipients_app/docu/app_release_guides/releasing.md +++ b/recipients_app/docu/app_release_guides/releasing.md @@ -1,11 +1,14 @@ # How to release the apps 1. Increment app version and build number in pubspec.yaml - - Open 'pubspec.yaml' and increase 'version' with the desired app version and the version code by incrementing the '+' part by 1. Incrementing the version code is a must-have for a new prod version. Otherwise, the stores will not accept the new app. - - Example: - Current: version: 1.1.0+12 - New: version: 1.1.1+13 + + - Open 'pubspec.yaml' and increase 'version' with the desired app + version and the version code by incrementing the '+' part by 1. + Incrementing the version code is a must-have for a new prod + version. Otherwise, the stores will not accept the new app. + + Example: Current: version: 1.1.0+12 New: version: 1.1.1+13 + 1. Run CodeMagic Build "iOS Staging (Firebase App Distribution)" 1. Run CodeMagic Build "Android Staging (Firebase App Distribution)" 1. Test the app on the Staging environment. See From ca48f85307e380ab4a2c47a390a9bb4d470a00e5 Mon Sep 17 00:00:00 2001 From: Karin Berg Date: Sun, 1 Dec 2024 19:16:14 +0100 Subject: [PATCH 18/19] Optimizing "Sentry" docu --- recipients_app/README.md | 3 ++- 1 file changed, 2 insertions(+), 1 deletion(-) diff --git a/recipients_app/README.md b/recipients_app/README.md index df06cccfa..dffb5c5b6 100644 --- a/recipients_app/README.md +++ b/recipients_app/README.md @@ -73,7 +73,8 @@ Mobile App for Recipients of a Social Income. - Copy file `./.vscode/launch.json.example` and rename it to `./.vscode/launch.json` - Replace the value "FILL IN SENTRY URL" after "SENTRY_URL=" with the - real Sentry url to be able to use Sentry + real Sentry url to be able to use Sentry. If you do not prive a Sentry Url, no issues will be reported to Sentry but you can still run the app. + To get the real Sentry url see [here](https://social-income.sentry.io/settings/projects/si-mobileapp/keys/) under "DSN". - Decide which flavor and backend environment you want to use and change it if necessary. - Open `recipients_app` project folder in vsCode From 2de6ec471fc608ece87f9eddae9fada95060d199 Mon Sep 17 00:00:00 2001 From: KarinBerg Date: Sun, 1 Dec 2024 18:19:21 +0000 Subject: [PATCH 19/19] Prettified Code! --- recipients_app/README.md | 7 +++++-- 1 file changed, 5 insertions(+), 2 deletions(-) diff --git a/recipients_app/README.md b/recipients_app/README.md index dffb5c5b6..78ae1f0f2 100644 --- a/recipients_app/README.md +++ b/recipients_app/README.md @@ -73,8 +73,11 @@ Mobile App for Recipients of a Social Income. - Copy file `./.vscode/launch.json.example` and rename it to `./.vscode/launch.json` - Replace the value "FILL IN SENTRY URL" after "SENTRY_URL=" with the - real Sentry url to be able to use Sentry. If you do not prive a Sentry Url, no issues will be reported to Sentry but you can still run the app. - To get the real Sentry url see [here](https://social-income.sentry.io/settings/projects/si-mobileapp/keys/) under "DSN". + real Sentry url to be able to use Sentry. If you do not prive a + Sentry Url, no issues will be reported to Sentry but you can still + run the app. To get the real Sentry url see + [here](https://social-income.sentry.io/settings/projects/si-mobileapp/keys/) + under "DSN". - Decide which flavor and backend environment you want to use and change it if necessary. - Open `recipients_app` project folder in vsCode