From e48962361a71888cb1c25d75204359ab2a660686 Mon Sep 17 00:00:00 2001 From: Matthew Fosse Date: Thu, 18 Apr 2024 11:10:32 -0700 Subject: [PATCH] script updates and new run-android script (#1396) --- configure_cake_wallet.sh | 12 +----------- run-android.sh | 30 ++++++++++++++++++++++++++++++ 2 files changed, 31 insertions(+), 11 deletions(-) create mode 100755 run-android.sh diff --git a/configure_cake_wallet.sh b/configure_cake_wallet.sh index cc55e8fcc..837a002e9 100755 --- a/configure_cake_wallet.sh +++ b/configure_cake_wallet.sh @@ -23,14 +23,4 @@ source ./app_env.sh cakewallet ./app_config.sh cd ../.. && flutter pub get flutter packages pub run tool/generate_localization.dart -cd cw_core && flutter pub get && flutter packages pub run build_runner build --delete-conflicting-outputs && cd .. -cd cw_evm && flutter pub get && flutter packages pub run build_runner build --delete-conflicting-outputs && cd .. -cd cw_monero && flutter pub get && flutter packages pub run build_runner build --delete-conflicting-outputs && cd .. -cd cw_bitcoin && flutter pub get && flutter packages pub run build_runner build --delete-conflicting-outputs && cd .. -cd cw_haven && flutter pub get && flutter packages pub run build_runner build --delete-conflicting-outputs && cd .. -cd cw_nano && flutter pub get && flutter packages pub run build_runner build --delete-conflicting-outputs && cd .. -cd cw_bitcoin_cash && flutter pub get && flutter packages pub run build_runner build --delete-conflicting-outputs && cd .. -cd cw_solana && flutter pub get && flutter packages pub run build_runner build --delete-conflicting-outputs && cd .. -cd cw_ethereum && flutter pub get && cd .. -cd cw_polygon && flutter pub get && cd .. -flutter packages pub run build_runner build --delete-conflicting-outputs +./model_generator.sh diff --git a/run-android.sh b/run-android.sh new file mode 100755 index 000000000..dd694267a --- /dev/null +++ b/run-android.sh @@ -0,0 +1,30 @@ +#!/bin/bash + +# Get the current git branch +get_current_branch() { + if git rev-parse --git-dir > /dev/null 2>&1; then + branch=$(git rev-parse --abbrev-ref HEAD) + echo "$branch" + else + echo "Error: Not a git repository." + return 1 + fi +} + +# Update the app.properties file +update_app_properties() { + local branch=$1 + local file_path="./android/app.properties" + + sed -i "s/^id=.*/id=com.cakewallet.$branch/" "$file_path" + sed -i "s/^name=.*/name=$branch-Cake Wallet/" "$file_path" +} + +# only update app.properties if getting the current branch was successful +current_branch=$(get_current_branch) +if [[ $? -eq 0 ]]; then + update_app_properties "$current_branch" +fi + +# run the app +flutter run \ No newline at end of file