From 5553d5c9cbdcde8ff427b2ebb46cfddbbb07992a Mon Sep 17 00:00:00 2001 From: OmarHatem Date: Tue, 10 Dec 2024 11:52:04 +0200 Subject: [PATCH 1/3] potential fix for cached jks --- .github/workflows/cache_dependencies.yml | 6 +--- .github/workflows/pr_test_build_android.yml | 31 +++++++++------------ 2 files changed, 14 insertions(+), 23 deletions(-) diff --git a/.github/workflows/cache_dependencies.yml b/.github/workflows/cache_dependencies.yml index 014afdcad7..cb2afa3962 100644 --- a/.github/workflows/cache_dependencies.yml +++ b/.github/workflows/cache_dependencies.yml @@ -70,15 +70,11 @@ jobs: source ./app_env.sh cakewallet ./build_monero_all.sh - - name: Set up cache path - id: cache-path - run: echo "cache-file-path=/opt/android/cake_wallet/android/app/key.jks" >> $GITHUB_ENV - - name: Cache Keystore id: cache-keystore uses: actions/cache@v3 with: - path: ${{ env.cache-file-path }} + path: /opt/android/cake_wallet/android/app key: keystore - if: ${{ steps.cache-keystore.outputs.cache-hit != 'true' }} diff --git a/.github/workflows/pr_test_build_android.yml b/.github/workflows/pr_test_build_android.yml index d128d2a1ab..1b1566abaf 100644 --- a/.github/workflows/pr_test_build_android.yml +++ b/.github/workflows/pr_test_build_android.yml @@ -61,6 +61,19 @@ jobs: sudo apt update sudo apt-get install -y curl unzip automake build-essential file pkg-config git python libtool libtinfo5 cmake clang + - name: Cache Keystore + id: cache-keystore + uses: actions/cache@v3 + with: + path: /opt/android/cake_wallet/android/app + key: keystore + + - if: ${{ steps.cache-keystore.outputs.cache-hit != 'true' }} + name: Generate KeyStore + run: | + cd /opt/android/cake_wallet/android/app + keytool -genkey -v -keystore key.jks -keyalg RSA -keysize 2048 -validity 10000 -alias testKey -noprompt -dname "CN=CakeWallet, OU=CakeWallet, O=CakeWallet, L=Florida, S=America, C=USA" -storepass $STORE_PASS -keypass $KEY_PASS + - name: Execute Build and Setup Commands run: | sudo mkdir -p /opt/android @@ -115,24 +128,6 @@ jobs: cd /opt/android/cake_wallet/scripts/android/ ./build_mwebd.sh --dont-install - - - name: Set up cache path - id: cache-path - run: echo "cache-file-path=/opt/android/cake_wallet/android/app/key.jks" >> $GITHUB_ENV - - - name: Cache Keystore - id: cache-keystore - uses: actions/cache@v3 - with: - path: ${{ env.cache-file-path }} - key: keystore - - - if: ${{ steps.cache-keystore.outputs.cache-hit != 'true' }} - name: Generate KeyStore - run: | - cd /opt/android/cake_wallet/android/app - keytool -genkey -v -keystore key.jks -keyalg RSA -keysize 2048 -validity 10000 -alias testKey -noprompt -dname "CN=CakeWallet, OU=CakeWallet, O=CakeWallet, L=Florida, S=America, C=USA" -storepass $STORE_PASS -keypass $KEY_PASS - - name: Generate key properties run: | cd /opt/android/cake_wallet From 35cf4a716ff99f22d91e7180fc7a3c402a750b86 Mon Sep 17 00:00:00 2001 From: OmarHatem Date: Tue, 10 Dec 2024 14:06:56 +0200 Subject: [PATCH 2/3] separate CI steps more clearly Add more info to error reports --- .github/workflows/pr_test_build_android.yml | 11 ++++++++--- .../setup_2fa/setup_2fa_enter_code_page.dart | 5 +++-- lib/utils/exception_handler.dart | 14 ++++++++++++++ 3 files changed, 25 insertions(+), 5 deletions(-) diff --git a/.github/workflows/pr_test_build_android.yml b/.github/workflows/pr_test_build_android.yml index 1b1566abaf..f6d2033319 100644 --- a/.github/workflows/pr_test_build_android.yml +++ b/.github/workflows/pr_test_build_android.yml @@ -61,6 +61,14 @@ jobs: sudo apt update sudo apt-get install -y curl unzip automake build-essential file pkg-config git python libtool libtinfo5 cmake clang + + - name: Clone Repo + run: | + sudo mkdir -p /opt/android + sudo chown $USER /opt/android + cd /opt/android + git clone https://github.com/cake-tech/cake_wallet.git --branch ${{ env.BRANCH_NAME }} + - name: Cache Keystore id: cache-keystore uses: actions/cache@v3 @@ -76,12 +84,9 @@ jobs: - name: Execute Build and Setup Commands run: | - sudo mkdir -p /opt/android - sudo chown $USER /opt/android cd /opt/android -y curl --proto '=https' --tlsv1.2 -sSf https://sh.rustup.rs | sh cargo install cargo-ndk - git clone https://github.com/cake-tech/cake_wallet.git --branch ${{ env.BRANCH_NAME }} cd cake_wallet/scripts/android/ ./install_ndk.sh source ./app_env.sh cakewallet diff --git a/lib/src/screens/setup_2fa/setup_2fa_enter_code_page.dart b/lib/src/screens/setup_2fa/setup_2fa_enter_code_page.dart index fad86e94d5..64e8f3aab2 100644 --- a/lib/src/screens/setup_2fa/setup_2fa_enter_code_page.dart +++ b/lib/src/screens/setup_2fa/setup_2fa_enter_code_page.dart @@ -198,8 +198,9 @@ class TOTPEnterCode extends BasePage { }, ); if (isForSetup && result) { - Navigator.pushReplacementNamed( - context, Routes.modify2FAPage); + if (context.mounted) { + Navigator.pushReplacementNamed(context, Routes.modify2FAPage); + } } }, diff --git a/lib/utils/exception_handler.dart b/lib/utils/exception_handler.dart index f7fc3684e5..d79dfe314f 100644 --- a/lib/utils/exception_handler.dart +++ b/lib/utils/exception_handler.dart @@ -1,9 +1,11 @@ import 'dart:io'; +import 'package:cake_wallet/di.dart'; import 'package:cake_wallet/entities/preferences_key.dart'; import 'package:cake_wallet/generated/i18n.dart'; import 'package:cake_wallet/main.dart'; import 'package:cake_wallet/src/widgets/alert_with_two_actions.dart'; +import 'package:cake_wallet/store/app_store.dart'; import 'package:cake_wallet/utils/show_bar.dart'; import 'package:cake_wallet/utils/show_pop_up.dart'; import 'package:cw_core/root_dir.dart'; @@ -29,9 +31,21 @@ class ExceptionHandler { _file = File('${appDocDir.path}/error.txt'); } + String? walletType; + CustomTrace? programInfo; + + try { + walletType = getIt.get().wallet?.type.name; + + programInfo = CustomTrace(stackTrace ?? StackTrace.current); + } catch (_) {} + final exception = { "${DateTime.now()}": { "Error": "$error\n\n", + "WalletType": "$walletType\n\n", + "VerboseLog": + "${programInfo?.fileName}#${programInfo?.lineNumber}:${programInfo?.columnNumber} ${programInfo?.callerFunctionName}\n\n", "Library": "$library\n\n", "StackTrace": stackTrace.toString(), } From ed600f9b8b064edc6f09f4ba6c7fa7c370e3211e Mon Sep 17 00:00:00 2001 From: OmarHatem Date: Tue, 10 Dec 2024 15:26:06 +0200 Subject: [PATCH 3/3] disable cache key for now --- .github/workflows/pr_test_build_android.yml | 18 +++++++++--------- 1 file changed, 9 insertions(+), 9 deletions(-) diff --git a/.github/workflows/pr_test_build_android.yml b/.github/workflows/pr_test_build_android.yml index f6d2033319..2b605c775a 100644 --- a/.github/workflows/pr_test_build_android.yml +++ b/.github/workflows/pr_test_build_android.yml @@ -69,15 +69,15 @@ jobs: cd /opt/android git clone https://github.com/cake-tech/cake_wallet.git --branch ${{ env.BRANCH_NAME }} - - name: Cache Keystore - id: cache-keystore - uses: actions/cache@v3 - with: - path: /opt/android/cake_wallet/android/app - key: keystore - - - if: ${{ steps.cache-keystore.outputs.cache-hit != 'true' }} - name: Generate KeyStore +# - name: Cache Keystore +# id: cache-keystore +# uses: actions/cache@v3 +# with: +# path: /opt/android/cake_wallet/android/app +# key: keystore +# +# - if: ${{ steps.cache-keystore.outputs.cache-hit != 'true' }} + - name: Generate KeyStore run: | cd /opt/android/cake_wallet/android/app keytool -genkey -v -keystore key.jks -keyalg RSA -keysize 2048 -validity 10000 -alias testKey -noprompt -dname "CN=CakeWallet, OU=CakeWallet, O=CakeWallet, L=Florida, S=America, C=USA" -storepass $STORE_PASS -keypass $KEY_PASS