From 90909a98163727fdab98554e2ee7b1cb13262977 Mon Sep 17 00:00:00 2001 From: Oscar Mira Date: Sun, 6 Feb 2022 21:30:14 +0100 Subject: [PATCH] All downhill from here --- .gitignore | 8 + .gitmodules | 12 + LICENSE | 674 ++++++++++++++++++ build.gradle | 28 + demo/android/build.gradle | 91 +++ demo/android/proguard-rules.pro | 21 + .../1.json | 179 +++++ .../monero/demo/ExampleInstrumentedTest.kt | 24 + demo/android/src/main/AndroidManifest.xml | 29 + .../kotlin/im/molly/monero/demo/AppModule.kt | 51 ++ .../im/molly/monero/demo/MainActivity.kt | 71 ++ .../im/molly/monero/demo/MainApplication.kt | 23 + .../im/molly/monero/demo/common/Result.kt | 21 + .../im/molly/monero/demo/data/AppDatabase.kt | 26 + .../molly/monero/demo/data/MoneroSdkClient.kt | 44 ++ .../monero/demo/data/RemoteNodeRepository.kt | 30 + .../monero/demo/data/WalletDataFileStorage.kt | 59 ++ .../monero/demo/data/WalletDataSource.kt | 39 + .../monero/demo/data/WalletRepository.kt | 67 ++ .../monero/demo/data/dao/RemoteNodeDao.kt | 45 ++ .../molly/monero/demo/data/dao/WalletDao.kt | 35 + .../demo/data/entity/PopulatedWallet.kt | 25 + .../demo/data/entity/RemoteNodeEntity.kt | 49 ++ .../monero/demo/data/entity/WalletEntity.kt | 32 + .../demo/data/entity/WalletRemoteNodeXRef.kt | 36 + .../monero/demo/data/model/RemoteNode.kt | 18 + .../monero/demo/data/model/Transaction.kt | 9 + .../monero/demo/data/model/WalletConfig.kt | 11 + .../molly/monero/demo/service/SyncService.kt | 62 ++ .../monero/demo/ui/AddWalletViewModel.kt | 58 ++ .../molly/monero/demo/ui/AddWalletWizard.kt | 230 ++++++ .../kotlin/im/molly/monero/demo/ui/DemoApp.kt | 89 +++ .../im/molly/monero/demo/ui/DemoAppState.kt | 52 ++ .../monero/demo/ui/EditRemoteNodeDialog.kt | 151 ++++ .../im/molly/monero/demo/ui/HistoryScreen.kt | 20 + .../im/molly/monero/demo/ui/HomeScreen.kt | 76 ++ .../im/molly/monero/demo/ui/HomeViewModel.kt | 36 + .../im/molly/monero/demo/ui/RemoteNodeList.kt | 133 ++++ .../im/molly/monero/demo/ui/SettingsScreen.kt | 82 +++ .../molly/monero/demo/ui/SettingsViewModel.kt | 41 ++ .../im/molly/monero/demo/ui/WalletCard.kt | 50 ++ .../im/molly/monero/demo/ui/WalletCardList.kt | 19 + .../im/molly/monero/demo/ui/WalletScreen.kt | 0 .../molly/monero/demo/ui/WalletViewModel.kt | 69 ++ .../monero/demo/ui/component/RadioButtons.kt | 48 ++ .../monero/demo/ui/component/SelectListBox.kt | 63 ++ .../molly/monero/demo/ui/component/Toolbar.kt | 29 + .../demo/ui/navigation/HistoryNavigation.kt | 19 + .../demo/ui/navigation/HomeNavigation.kt | 23 + .../monero/demo/ui/navigation/NavGraph.kt | 39 + .../demo/ui/navigation/SettingsNavigation.kt | 56 ++ .../demo/ui/navigation/TopLevelDestination.kt | 28 + .../demo/ui/navigation/WalletNavigation.kt | 59 ++ .../im/molly/monero/demo/ui/theme/Color.kt | 11 + .../im/molly/monero/demo/ui/theme/Icon.kt | 19 + .../im/molly/monero/demo/ui/theme/Theme.kt | 61 ++ .../im/molly/monero/demo/ui/theme/Type.kt | 34 + .../drawable-v24/ic_launcher_foreground.xml | 30 + .../res/drawable/ic_launcher_background.xml | 170 +++++ .../res/mipmap-anydpi-v26/ic_launcher.xml | 5 + .../mipmap-anydpi-v26/ic_launcher_round.xml | 5 + .../src/main/res/mipmap-hdpi/ic_launcher.webp | Bin 0 -> 1404 bytes .../res/mipmap-hdpi/ic_launcher_round.webp | Bin 0 -> 2898 bytes .../src/main/res/mipmap-mdpi/ic_launcher.webp | Bin 0 -> 982 bytes .../res/mipmap-mdpi/ic_launcher_round.webp | Bin 0 -> 1772 bytes .../main/res/mipmap-xhdpi/ic_launcher.webp | Bin 0 -> 1900 bytes .../res/mipmap-xhdpi/ic_launcher_round.webp | Bin 0 -> 3918 bytes .../main/res/mipmap-xxhdpi/ic_launcher.webp | Bin 0 -> 2884 bytes .../res/mipmap-xxhdpi/ic_launcher_round.webp | Bin 0 -> 5914 bytes .../main/res/mipmap-xxxhdpi/ic_launcher.webp | Bin 0 -> 3844 bytes .../res/mipmap-xxxhdpi/ic_launcher_round.webp | Bin 0 -> 7778 bytes demo/android/src/main/res/values/colors.xml | 10 + demo/android/src/main/res/values/strings.xml | 30 + demo/android/src/main/res/values/themes.xml | 5 + .../im/molly/monero/demo/ExampleUnitTest.kt | 17 + gradle.properties | 4 + gradle/wrapper/gradle-wrapper.jar | Bin 0 -> 60756 bytes gradle/wrapper/gradle-wrapper.properties | 6 + gradlew | 240 +++++++ gradlew.bat | 91 +++ lib/android/build.gradle | 135 ++++ lib/android/consumer-rules.pro | 0 lib/android/proguard-rules.pro | 26 + .../kotlin/im/molly/monero/HexFormat.kt | 9 + .../molly/monero/SecretKeyParcelableTest.kt | 24 + .../molly/monero/WalletNativeServiceTest.kt | 27 + .../im/molly/monero/WalletNativeTest.kt | 58 ++ lib/android/src/main/AndroidManifest.xml | 14 + .../aidl/im/molly/monero/HttpResponse.aidl | 3 + .../im/molly/monero/IBalanceListener.aidl | 8 + .../im/molly/monero/IRefreshCallback.aidl | 5 + .../im/molly/monero/IRemoteNodeClient.aidl | 9 + .../main/aidl/im/molly/monero/IWallet.aidl | 16 + .../aidl/im/molly/monero/IWalletClient.aidl | 8 + .../aidl/im/molly/monero/IWalletService.aidl | 14 + .../molly/monero/IWalletServiceListener.aidl | 5 + .../main/aidl/im/molly/monero/OwnedTxOut.aidl | 3 + .../aidl/im/molly/monero/PublicAddress.aidl | 3 + .../main/aidl/im/molly/monero/RemoteNode.aidl | 3 + .../main/aidl/im/molly/monero/SecretKey.aidl | 3 + .../aidl/im/molly/monero/WalletConfig.aidl | 3 + lib/android/src/main/cpp/CMakeLists.txt | 70 ++ lib/android/src/main/cpp/boost/CMakeLists.txt | 95 +++ .../boost/user-config/boost_arm64-v8a.jam.in | 27 + .../user-config/boost_armeabi-v7a.jam.in | 28 + .../cpp/boost/user-config/boost_x86_64.jam.in | 27 + .../src/main/cpp/boringssl/CMakeLists.txt | 9 + .../src/main/cpp/cmake/toolchain.cmake | 35 + lib/android/src/main/cpp/common.h | 56 ++ lib/android/src/main/cpp/eraser.h | 38 + lib/android/src/main/cpp/fd.h | 71 ++ lib/android/src/main/cpp/http_client.cc | 118 +++ lib/android/src/main/cpp/http_client.h | 80 +++ lib/android/src/main/cpp/jni_cache.cc | 52 ++ lib/android/src/main/cpp/jni_cache.h | 26 + lib/android/src/main/cpp/jni_loader.cc | 21 + lib/android/src/main/cpp/jvm.cc | 246 +++++++ lib/android/src/main/cpp/jvm.h | 318 +++++++++ .../src/main/cpp/libsodium/CMakeLists.txt | 35 + lib/android/src/main/cpp/logging.cc | 93 +++ lib/android/src/main/cpp/logging.h | 50 ++ .../src/main/cpp/monero/CMakeLists.txt | 30 + .../cpp/monero/easylogging/CMakeLists.txt | 10 + .../src/main/cpp/monero/lmdb/CMakeLists.txt | 8 + .../main/cpp/monero/randomx/CMakeLists.txt | 8 + .../main/cpp/monero/wallet_api/CMakeLists.txt | 178 +++++ .../cpp/monero/wallet_api/boringssl_compat.h | 4 + .../cpp/monero/wallet_api/i18n_override.cc | 5 + .../cpp/monero/wallet_api/mlog_override.cc | 43 ++ .../monero/wallet_api/perf_timer_override.cc | 26 + .../src/main/cpp/unbound/CMakeLists.txt | 43 ++ lib/android/src/main/cpp/wallet.cc | 381 ++++++++++ lib/android/src/main/cpp/wallet.h | 125 ++++ .../src/main/kotlin/im/molly/monero/Amount.kt | 35 + .../main/kotlin/im/molly/monero/Balance.kt | 22 + .../kotlin/im/molly/monero/CalledByNative.kt | 9 + .../kotlin/im/molly/monero/ContextUtils.kt | 23 + .../kotlin/im/molly/monero/HttpResponse.kt | 14 + .../src/main/kotlin/im/molly/monero/Ledger.kt | 25 + .../main/kotlin/im/molly/monero/Logging.kt | 99 +++ .../kotlin/im/molly/monero/MoneroNetwork.kt | 18 + .../kotlin/im/molly/monero/MoneroWallet.kt | 58 ++ .../src/main/kotlin/im/molly/monero/Native.kt | 17 + .../main/kotlin/im/molly/monero/OwnedTxOut.kt | 62 ++ .../kotlin/im/molly/monero/PublicAddress.kt | 19 + .../main/kotlin/im/molly/monero/PublicKey.kt | 3 + .../main/kotlin/im/molly/monero/RemoteNode.kt | 31 + .../im/molly/monero/RemoteNodeClient.kt | 108 +++ .../kotlin/im/molly/monero/RemoteNodeState.kt | 9 + .../main/kotlin/im/molly/monero/SecretKey.kt | 80 +++ .../kotlin/im/molly/monero/WalletClient.kt | 121 ++++ .../kotlin/im/molly/monero/WalletConfig.kt | 9 + .../kotlin/im/molly/monero/WalletNative.kt | 172 +++++ .../kotlin/im/molly/monero/WalletService.kt | 99 +++ lib/android/src/main/proto/ledger.proto | 21 + .../kotlin/im/molly/monero/SecretKeyTest.kt | 64 ++ settings.gradle | 23 + vendor/boringssl | 1 + vendor/libsodium | 1 + vendor/monero | 1 + vendor/unbound | 1 + 161 files changed, 7904 insertions(+) create mode 100644 .gitignore create mode 100644 .gitmodules create mode 100644 LICENSE create mode 100644 build.gradle create mode 100644 demo/android/build.gradle create mode 100644 demo/android/proguard-rules.pro create mode 100644 demo/android/schemas/im.molly.monero.demo.data.AppDatabase/1.json create mode 100644 demo/android/src/androidTest/kotlin/im/molly/monero/demo/ExampleInstrumentedTest.kt create mode 100644 demo/android/src/main/AndroidManifest.xml create mode 100644 demo/android/src/main/kotlin/im/molly/monero/demo/AppModule.kt create mode 100644 demo/android/src/main/kotlin/im/molly/monero/demo/MainActivity.kt create mode 100644 demo/android/src/main/kotlin/im/molly/monero/demo/MainApplication.kt create mode 100644 demo/android/src/main/kotlin/im/molly/monero/demo/common/Result.kt create mode 100644 demo/android/src/main/kotlin/im/molly/monero/demo/data/AppDatabase.kt create mode 100644 demo/android/src/main/kotlin/im/molly/monero/demo/data/MoneroSdkClient.kt create mode 100644 demo/android/src/main/kotlin/im/molly/monero/demo/data/RemoteNodeRepository.kt create mode 100644 demo/android/src/main/kotlin/im/molly/monero/demo/data/WalletDataFileStorage.kt create mode 100644 demo/android/src/main/kotlin/im/molly/monero/demo/data/WalletDataSource.kt create mode 100644 demo/android/src/main/kotlin/im/molly/monero/demo/data/WalletRepository.kt create mode 100644 demo/android/src/main/kotlin/im/molly/monero/demo/data/dao/RemoteNodeDao.kt create mode 100644 demo/android/src/main/kotlin/im/molly/monero/demo/data/dao/WalletDao.kt create mode 100644 demo/android/src/main/kotlin/im/molly/monero/demo/data/entity/PopulatedWallet.kt create mode 100644 demo/android/src/main/kotlin/im/molly/monero/demo/data/entity/RemoteNodeEntity.kt create mode 100644 demo/android/src/main/kotlin/im/molly/monero/demo/data/entity/WalletEntity.kt create mode 100644 demo/android/src/main/kotlin/im/molly/monero/demo/data/entity/WalletRemoteNodeXRef.kt create mode 100644 demo/android/src/main/kotlin/im/molly/monero/demo/data/model/RemoteNode.kt create mode 100644 demo/android/src/main/kotlin/im/molly/monero/demo/data/model/Transaction.kt create mode 100644 demo/android/src/main/kotlin/im/molly/monero/demo/data/model/WalletConfig.kt create mode 100644 demo/android/src/main/kotlin/im/molly/monero/demo/service/SyncService.kt create mode 100644 demo/android/src/main/kotlin/im/molly/monero/demo/ui/AddWalletViewModel.kt create mode 100644 demo/android/src/main/kotlin/im/molly/monero/demo/ui/AddWalletWizard.kt create mode 100644 demo/android/src/main/kotlin/im/molly/monero/demo/ui/DemoApp.kt create mode 100644 demo/android/src/main/kotlin/im/molly/monero/demo/ui/DemoAppState.kt create mode 100644 demo/android/src/main/kotlin/im/molly/monero/demo/ui/EditRemoteNodeDialog.kt create mode 100644 demo/android/src/main/kotlin/im/molly/monero/demo/ui/HistoryScreen.kt create mode 100644 demo/android/src/main/kotlin/im/molly/monero/demo/ui/HomeScreen.kt create mode 100644 demo/android/src/main/kotlin/im/molly/monero/demo/ui/HomeViewModel.kt create mode 100644 demo/android/src/main/kotlin/im/molly/monero/demo/ui/RemoteNodeList.kt create mode 100644 demo/android/src/main/kotlin/im/molly/monero/demo/ui/SettingsScreen.kt create mode 100644 demo/android/src/main/kotlin/im/molly/monero/demo/ui/SettingsViewModel.kt create mode 100644 demo/android/src/main/kotlin/im/molly/monero/demo/ui/WalletCard.kt create mode 100644 demo/android/src/main/kotlin/im/molly/monero/demo/ui/WalletCardList.kt create mode 100644 demo/android/src/main/kotlin/im/molly/monero/demo/ui/WalletScreen.kt create mode 100644 demo/android/src/main/kotlin/im/molly/monero/demo/ui/WalletViewModel.kt create mode 100644 demo/android/src/main/kotlin/im/molly/monero/demo/ui/component/RadioButtons.kt create mode 100644 demo/android/src/main/kotlin/im/molly/monero/demo/ui/component/SelectListBox.kt create mode 100644 demo/android/src/main/kotlin/im/molly/monero/demo/ui/component/Toolbar.kt create mode 100644 demo/android/src/main/kotlin/im/molly/monero/demo/ui/navigation/HistoryNavigation.kt create mode 100644 demo/android/src/main/kotlin/im/molly/monero/demo/ui/navigation/HomeNavigation.kt create mode 100644 demo/android/src/main/kotlin/im/molly/monero/demo/ui/navigation/NavGraph.kt create mode 100644 demo/android/src/main/kotlin/im/molly/monero/demo/ui/navigation/SettingsNavigation.kt create mode 100644 demo/android/src/main/kotlin/im/molly/monero/demo/ui/navigation/TopLevelDestination.kt create mode 100644 demo/android/src/main/kotlin/im/molly/monero/demo/ui/navigation/WalletNavigation.kt create mode 100644 demo/android/src/main/kotlin/im/molly/monero/demo/ui/theme/Color.kt create mode 100644 demo/android/src/main/kotlin/im/molly/monero/demo/ui/theme/Icon.kt create mode 100644 demo/android/src/main/kotlin/im/molly/monero/demo/ui/theme/Theme.kt create mode 100644 demo/android/src/main/kotlin/im/molly/monero/demo/ui/theme/Type.kt create mode 100644 demo/android/src/main/res/drawable-v24/ic_launcher_foreground.xml create mode 100644 demo/android/src/main/res/drawable/ic_launcher_background.xml create mode 100644 demo/android/src/main/res/mipmap-anydpi-v26/ic_launcher.xml create mode 100644 demo/android/src/main/res/mipmap-anydpi-v26/ic_launcher_round.xml create mode 100644 demo/android/src/main/res/mipmap-hdpi/ic_launcher.webp create mode 100644 demo/android/src/main/res/mipmap-hdpi/ic_launcher_round.webp create mode 100644 demo/android/src/main/res/mipmap-mdpi/ic_launcher.webp create mode 100644 demo/android/src/main/res/mipmap-mdpi/ic_launcher_round.webp create mode 100644 demo/android/src/main/res/mipmap-xhdpi/ic_launcher.webp create mode 100644 demo/android/src/main/res/mipmap-xhdpi/ic_launcher_round.webp create mode 100644 demo/android/src/main/res/mipmap-xxhdpi/ic_launcher.webp create mode 100644 demo/android/src/main/res/mipmap-xxhdpi/ic_launcher_round.webp create mode 100644 demo/android/src/main/res/mipmap-xxxhdpi/ic_launcher.webp create mode 100644 demo/android/src/main/res/mipmap-xxxhdpi/ic_launcher_round.webp create mode 100644 demo/android/src/main/res/values/colors.xml create mode 100644 demo/android/src/main/res/values/strings.xml create mode 100644 demo/android/src/main/res/values/themes.xml create mode 100644 demo/android/src/test/kotlin/im/molly/monero/demo/ExampleUnitTest.kt create mode 100644 gradle.properties create mode 100644 gradle/wrapper/gradle-wrapper.jar create mode 100644 gradle/wrapper/gradle-wrapper.properties create mode 100755 gradlew create mode 100644 gradlew.bat create mode 100644 lib/android/build.gradle create mode 100644 lib/android/consumer-rules.pro create mode 100644 lib/android/proguard-rules.pro create mode 100644 lib/android/src/androidTest/kotlin/im/molly/monero/HexFormat.kt create mode 100644 lib/android/src/androidTest/kotlin/im/molly/monero/SecretKeyParcelableTest.kt create mode 100644 lib/android/src/androidTest/kotlin/im/molly/monero/WalletNativeServiceTest.kt create mode 100644 lib/android/src/androidTest/kotlin/im/molly/monero/WalletNativeTest.kt create mode 100644 lib/android/src/main/AndroidManifest.xml create mode 100644 lib/android/src/main/aidl/im/molly/monero/HttpResponse.aidl create mode 100644 lib/android/src/main/aidl/im/molly/monero/IBalanceListener.aidl create mode 100644 lib/android/src/main/aidl/im/molly/monero/IRefreshCallback.aidl create mode 100644 lib/android/src/main/aidl/im/molly/monero/IRemoteNodeClient.aidl create mode 100644 lib/android/src/main/aidl/im/molly/monero/IWallet.aidl create mode 100644 lib/android/src/main/aidl/im/molly/monero/IWalletClient.aidl create mode 100644 lib/android/src/main/aidl/im/molly/monero/IWalletService.aidl create mode 100644 lib/android/src/main/aidl/im/molly/monero/IWalletServiceListener.aidl create mode 100644 lib/android/src/main/aidl/im/molly/monero/OwnedTxOut.aidl create mode 100644 lib/android/src/main/aidl/im/molly/monero/PublicAddress.aidl create mode 100644 lib/android/src/main/aidl/im/molly/monero/RemoteNode.aidl create mode 100644 lib/android/src/main/aidl/im/molly/monero/SecretKey.aidl create mode 100644 lib/android/src/main/aidl/im/molly/monero/WalletConfig.aidl create mode 100644 lib/android/src/main/cpp/CMakeLists.txt create mode 100644 lib/android/src/main/cpp/boost/CMakeLists.txt create mode 100644 lib/android/src/main/cpp/boost/user-config/boost_arm64-v8a.jam.in create mode 100644 lib/android/src/main/cpp/boost/user-config/boost_armeabi-v7a.jam.in create mode 100644 lib/android/src/main/cpp/boost/user-config/boost_x86_64.jam.in create mode 100644 lib/android/src/main/cpp/boringssl/CMakeLists.txt create mode 100644 lib/android/src/main/cpp/cmake/toolchain.cmake create mode 100644 lib/android/src/main/cpp/common.h create mode 100644 lib/android/src/main/cpp/eraser.h create mode 100644 lib/android/src/main/cpp/fd.h create mode 100644 lib/android/src/main/cpp/http_client.cc create mode 100644 lib/android/src/main/cpp/http_client.h create mode 100644 lib/android/src/main/cpp/jni_cache.cc create mode 100644 lib/android/src/main/cpp/jni_cache.h create mode 100644 lib/android/src/main/cpp/jni_loader.cc create mode 100644 lib/android/src/main/cpp/jvm.cc create mode 100644 lib/android/src/main/cpp/jvm.h create mode 100644 lib/android/src/main/cpp/libsodium/CMakeLists.txt create mode 100644 lib/android/src/main/cpp/logging.cc create mode 100644 lib/android/src/main/cpp/logging.h create mode 100644 lib/android/src/main/cpp/monero/CMakeLists.txt create mode 100644 lib/android/src/main/cpp/monero/easylogging/CMakeLists.txt create mode 100644 lib/android/src/main/cpp/monero/lmdb/CMakeLists.txt create mode 100644 lib/android/src/main/cpp/monero/randomx/CMakeLists.txt create mode 100644 lib/android/src/main/cpp/monero/wallet_api/CMakeLists.txt create mode 100644 lib/android/src/main/cpp/monero/wallet_api/boringssl_compat.h create mode 100644 lib/android/src/main/cpp/monero/wallet_api/i18n_override.cc create mode 100644 lib/android/src/main/cpp/monero/wallet_api/mlog_override.cc create mode 100644 lib/android/src/main/cpp/monero/wallet_api/perf_timer_override.cc create mode 100644 lib/android/src/main/cpp/unbound/CMakeLists.txt create mode 100644 lib/android/src/main/cpp/wallet.cc create mode 100644 lib/android/src/main/cpp/wallet.h create mode 100644 lib/android/src/main/kotlin/im/molly/monero/Amount.kt create mode 100644 lib/android/src/main/kotlin/im/molly/monero/Balance.kt create mode 100644 lib/android/src/main/kotlin/im/molly/monero/CalledByNative.kt create mode 100644 lib/android/src/main/kotlin/im/molly/monero/ContextUtils.kt create mode 100644 lib/android/src/main/kotlin/im/molly/monero/HttpResponse.kt create mode 100644 lib/android/src/main/kotlin/im/molly/monero/Ledger.kt create mode 100644 lib/android/src/main/kotlin/im/molly/monero/Logging.kt create mode 100644 lib/android/src/main/kotlin/im/molly/monero/MoneroNetwork.kt create mode 100644 lib/android/src/main/kotlin/im/molly/monero/MoneroWallet.kt create mode 100644 lib/android/src/main/kotlin/im/molly/monero/Native.kt create mode 100644 lib/android/src/main/kotlin/im/molly/monero/OwnedTxOut.kt create mode 100644 lib/android/src/main/kotlin/im/molly/monero/PublicAddress.kt create mode 100644 lib/android/src/main/kotlin/im/molly/monero/PublicKey.kt create mode 100644 lib/android/src/main/kotlin/im/molly/monero/RemoteNode.kt create mode 100644 lib/android/src/main/kotlin/im/molly/monero/RemoteNodeClient.kt create mode 100644 lib/android/src/main/kotlin/im/molly/monero/RemoteNodeState.kt create mode 100644 lib/android/src/main/kotlin/im/molly/monero/SecretKey.kt create mode 100644 lib/android/src/main/kotlin/im/molly/monero/WalletClient.kt create mode 100644 lib/android/src/main/kotlin/im/molly/monero/WalletConfig.kt create mode 100644 lib/android/src/main/kotlin/im/molly/monero/WalletNative.kt create mode 100644 lib/android/src/main/kotlin/im/molly/monero/WalletService.kt create mode 100644 lib/android/src/main/proto/ledger.proto create mode 100644 lib/android/src/test/kotlin/im/molly/monero/SecretKeyTest.kt create mode 100644 settings.gradle create mode 160000 vendor/boringssl create mode 160000 vendor/libsodium create mode 160000 vendor/monero create mode 160000 vendor/unbound diff --git a/.gitignore b/.gitignore new file mode 100644 index 0000000..eea0b3a --- /dev/null +++ b/.gitignore @@ -0,0 +1,8 @@ +*.iml +.gradle +.idea +build +captures +.externalNativeBuild +.cxx +local.properties diff --git a/.gitmodules b/.gitmodules new file mode 100644 index 0000000..6c4aa54 --- /dev/null +++ b/.gitmodules @@ -0,0 +1,12 @@ +[submodule "vendor/monero"] + path = vendor/monero + url = https://github.com/mollyim/monero.git +[submodule "vendor/boringssl"] + path = vendor/boringssl + url = https://boringssl.googlesource.com/boringssl +[submodule "vendor/unbound"] + path = vendor/unbound + url = https://github.com/NLnetLabs/unbound.git +[submodule "vendor/libsodium"] + path = vendor/libsodium + url = https://github.com/jedisct1/libsodium.git diff --git a/LICENSE b/LICENSE new file mode 100644 index 0000000..e600086 --- /dev/null +++ b/LICENSE @@ -0,0 +1,674 @@ + GNU GENERAL PUBLIC LICENSE + Version 3, 29 June 2007 + + Copyright (C) 2007 Free Software Foundation, Inc. + Everyone is permitted to copy and distribute verbatim copies + of this license document, but changing it is not allowed. + + Preamble + + The GNU General Public License is a free, copyleft license for +software and other kinds of works. + + The licenses for most software and other practical works are designed +to take away your freedom to share and change the works. By contrast, +the GNU General Public License is intended to guarantee your freedom to +share and change all versions of a program--to make sure it remains free +software for all its users. We, the Free Software Foundation, use the +GNU General Public License for most of our software; it applies also to +any other work released this way by its authors. You can apply it to +your programs, too. + + When we speak of free software, we are referring to freedom, not +price. Our General Public Licenses are designed to make sure that you +have the freedom to distribute copies of free software (and charge for +them if you wish), that you receive source code or can get it if you +want it, that you can change the software or use pieces of it in new +free programs, and that you know you can do these things. + + To protect your rights, we need to prevent others from denying you +these rights or asking you to surrender the rights. Therefore, you have +certain responsibilities if you distribute copies of the software, or if +you modify it: responsibilities to respect the freedom of others. + + For example, if you distribute copies of such a program, whether +gratis or for a fee, you must pass on to the recipients the same +freedoms that you received. You must make sure that they, too, receive +or can get the source code. And you must show them these terms so they +know their rights. + + Developers that use the GNU GPL protect your rights with two steps: +(1) assert copyright on the software, and (2) offer you this License +giving you legal permission to copy, distribute and/or modify it. + + For the developers' and authors' protection, the GPL clearly explains +that there is no warranty for this free software. For both users' and +authors' sake, the GPL requires that modified versions be marked as +changed, so that their problems will not be attributed erroneously to +authors of previous versions. + + Some devices are designed to deny users access to install or run +modified versions of the software inside them, although the manufacturer +can do so. This is fundamentally incompatible with the aim of +protecting users' freedom to change the software. The systematic +pattern of such abuse occurs in the area of products for individuals to +use, which is precisely where it is most unacceptable. Therefore, we +have designed this version of the GPL to prohibit the practice for those +products. If such problems arise substantially in other domains, we +stand ready to extend this provision to those domains in future versions +of the GPL, as needed to protect the freedom of users. + + Finally, every program is threatened constantly by software patents. +States should not allow patents to restrict development and use of +software on general-purpose computers, but in those that do, we wish to +avoid the special danger that patents applied to a free program could +make it effectively proprietary. To prevent this, the GPL assures that +patents cannot be used to render the program non-free. + + The precise terms and conditions for copying, distribution and +modification follow. + + TERMS AND CONDITIONS + + 0. Definitions. + + "This License" refers to version 3 of the GNU General Public License. + + "Copyright" also means copyright-like laws that apply to other kinds of +works, such as semiconductor masks. + + "The Program" refers to any copyrightable work licensed under this +License. Each licensee is addressed as "you". "Licensees" and +"recipients" may be individuals or organizations. + + To "modify" a work means to copy from or adapt all or part of the work +in a fashion requiring copyright permission, other than the making of an +exact copy. The resulting work is called a "modified version" of the +earlier work or a work "based on" the earlier work. + + A "covered work" means either the unmodified Program or a work based +on the Program. + + To "propagate" a work means to do anything with it that, without +permission, would make you directly or secondarily liable for +infringement under applicable copyright law, except executing it on a +computer or modifying a private copy. Propagation includes copying, +distribution (with or without modification), making available to the +public, and in some countries other activities as well. + + To "convey" a work means any kind of propagation that enables other +parties to make or receive copies. Mere interaction with a user through +a computer network, with no transfer of a copy, is not conveying. + + An interactive user interface displays "Appropriate Legal Notices" +to the extent that it includes a convenient and prominently visible +feature that (1) displays an appropriate copyright notice, and (2) +tells the user that there is no warranty for the work (except to the +extent that warranties are provided), that licensees may convey the +work under this License, and how to view a copy of this License. If +the interface presents a list of user commands or options, such as a +menu, a prominent item in the list meets this criterion. + + 1. Source Code. + + The "source code" for a work means the preferred form of the work +for making modifications to it. "Object code" means any non-source +form of a work. + + A "Standard Interface" means an interface that either is an official +standard defined by a recognized standards body, or, in the case of +interfaces specified for a particular programming language, one that +is widely used among developers working in that language. + + The "System Libraries" of an executable work include anything, other +than the work as a whole, that (a) is included in the normal form of +packaging a Major Component, but which is not part of that Major +Component, and (b) serves only to enable use of the work with that +Major Component, or to implement a Standard Interface for which an +implementation is available to the public in source code form. A +"Major Component", in this context, means a major essential component +(kernel, window system, and so on) of the specific operating system +(if any) on which the executable work runs, or a compiler used to +produce the work, or an object code interpreter used to run it. + + The "Corresponding Source" for a work in object code form means all +the source code needed to generate, install, and (for an executable +work) run the object code and to modify the work, including scripts to +control those activities. However, it does not include the work's +System Libraries, or general-purpose tools or generally available free +programs which are used unmodified in performing those activities but +which are not part of the work. For example, Corresponding Source +includes interface definition files associated with source files for +the work, and the source code for shared libraries and dynamically +linked subprograms that the work is specifically designed to require, +such as by intimate data communication or control flow between those +subprograms and other parts of the work. + + The Corresponding Source need not include anything that users +can regenerate automatically from other parts of the Corresponding +Source. + + The Corresponding Source for a work in source code form is that +same work. + + 2. Basic Permissions. + + All rights granted under this License are granted for the term of +copyright on the Program, and are irrevocable provided the stated +conditions are met. This License explicitly affirms your unlimited +permission to run the unmodified Program. The output from running a +covered work is covered by this License only if the output, given its +content, constitutes a covered work. This License acknowledges your +rights of fair use or other equivalent, as provided by copyright law. + + You may make, run and propagate covered works that you do not +convey, without conditions so long as your license otherwise remains +in force. You may convey covered works to others for the sole purpose +of having them make modifications exclusively for you, or provide you +with facilities for running those works, provided that you comply with +the terms of this License in conveying all material for which you do +not control copyright. Those thus making or running the covered works +for you must do so exclusively on your behalf, under your direction +and control, on terms that prohibit them from making any copies of +your copyrighted material outside their relationship with you. + + Conveying under any other circumstances is permitted solely under +the conditions stated below. Sublicensing is not allowed; section 10 +makes it unnecessary. + + 3. Protecting Users' Legal Rights From Anti-Circumvention Law. + + No covered work shall be deemed part of an effective technological +measure under any applicable law fulfilling obligations under article +11 of the WIPO copyright treaty adopted on 20 December 1996, or +similar laws prohibiting or restricting circumvention of such +measures. + + When you convey a covered work, you waive any legal power to forbid +circumvention of technological measures to the extent such circumvention +is effected by exercising rights under this License with respect to +the covered work, and you disclaim any intention to limit operation or +modification of the work as a means of enforcing, against the work's +users, your or third parties' legal rights to forbid circumvention of +technological measures. + + 4. Conveying Verbatim Copies. + + You may convey verbatim copies of the Program's source code as you +receive it, in any medium, provided that you conspicuously and +appropriately publish on each copy an appropriate copyright notice; +keep intact all notices stating that this License and any +non-permissive terms added in accord with section 7 apply to the code; +keep intact all notices of the absence of any warranty; and give all +recipients a copy of this License along with the Program. + + You may charge any price or no price for each copy that you convey, +and you may offer support or warranty protection for a fee. + + 5. Conveying Modified Source Versions. + + You may convey a work based on the Program, or the modifications to +produce it from the Program, in the form of source code under the +terms of section 4, provided that you also meet all of these conditions: + + a) The work must carry prominent notices stating that you modified + it, and giving a relevant date. + + b) The work must carry prominent notices stating that it is + released under this License and any conditions added under section + 7. This requirement modifies the requirement in section 4 to + "keep intact all notices". + + c) You must license the entire work, as a whole, under this + License to anyone who comes into possession of a copy. This + License will therefore apply, along with any applicable section 7 + additional terms, to the whole of the work, and all its parts, + regardless of how they are packaged. This License gives no + permission to license the work in any other way, but it does not + invalidate such permission if you have separately received it. + + d) If the work has interactive user interfaces, each must display + Appropriate Legal Notices; however, if the Program has interactive + interfaces that do not display Appropriate Legal Notices, your + work need not make them do so. + + A compilation of a covered work with other separate and independent +works, which are not by their nature extensions of the covered work, +and which are not combined with it such as to form a larger program, +in or on a volume of a storage or distribution medium, is called an +"aggregate" if the compilation and its resulting copyright are not +used to limit the access or legal rights of the compilation's users +beyond what the individual works permit. Inclusion of a covered work +in an aggregate does not cause this License to apply to the other +parts of the aggregate. + + 6. Conveying Non-Source Forms. + + You may convey a covered work in object code form under the terms +of sections 4 and 5, provided that you also convey the +machine-readable Corresponding Source under the terms of this License, +in one of these ways: + + a) Convey the object code in, or embodied in, a physical product + (including a physical distribution medium), accompanied by the + Corresponding Source fixed on a durable physical medium + customarily used for software interchange. + + b) Convey the object code in, or embodied in, a physical product + (including a physical distribution medium), accompanied by a + written offer, valid for at least three years and valid for as + long as you offer spare parts or customer support for that product + model, to give anyone who possesses the object code either (1) a + copy of the Corresponding Source for all the software in the + product that is covered by this License, on a durable physical + medium customarily used for software interchange, for a price no + more than your reasonable cost of physically performing this + conveying of source, or (2) access to copy the + Corresponding Source from a network server at no charge. + + c) Convey individual copies of the object code with a copy of the + written offer to provide the Corresponding Source. This + alternative is allowed only occasionally and noncommercially, and + only if you received the object code with such an offer, in accord + with subsection 6b. + + d) Convey the object code by offering access from a designated + place (gratis or for a charge), and offer equivalent access to the + Corresponding Source in the same way through the same place at no + further charge. You need not require recipients to copy the + Corresponding Source along with the object code. If the place to + copy the object code is a network server, the Corresponding Source + may be on a different server (operated by you or a third party) + that supports equivalent copying facilities, provided you maintain + clear directions next to the object code saying where to find the + Corresponding Source. Regardless of what server hosts the + Corresponding Source, you remain obligated to ensure that it is + available for as long as needed to satisfy these requirements. + + e) Convey the object code using peer-to-peer transmission, provided + you inform other peers where the object code and Corresponding + Source of the work are being offered to the general public at no + charge under subsection 6d. + + A separable portion of the object code, whose source code is excluded +from the Corresponding Source as a System Library, need not be +included in conveying the object code work. + + A "User Product" is either (1) a "consumer product", which means any +tangible personal property which is normally used for personal, family, +or household purposes, or (2) anything designed or sold for incorporation +into a dwelling. In determining whether a product is a consumer product, +doubtful cases shall be resolved in favor of coverage. For a particular +product received by a particular user, "normally used" refers to a +typical or common use of that class of product, regardless of the status +of the particular user or of the way in which the particular user +actually uses, or expects or is expected to use, the product. A product +is a consumer product regardless of whether the product has substantial +commercial, industrial or non-consumer uses, unless such uses represent +the only significant mode of use of the product. + + "Installation Information" for a User Product means any methods, +procedures, authorization keys, or other information required to install +and execute modified versions of a covered work in that User Product from +a modified version of its Corresponding Source. The information must +suffice to ensure that the continued functioning of the modified object +code is in no case prevented or interfered with solely because +modification has been made. + + If you convey an object code work under this section in, or with, or +specifically for use in, a User Product, and the conveying occurs as +part of a transaction in which the right of possession and use of the +User Product is transferred to the recipient in perpetuity or for a +fixed term (regardless of how the transaction is characterized), the +Corresponding Source conveyed under this section must be accompanied +by the Installation Information. But this requirement does not apply +if neither you nor any third party retains the ability to install +modified object code on the User Product (for example, the work has +been installed in ROM). + + The requirement to provide Installation Information does not include a +requirement to continue to provide support service, warranty, or updates +for a work that has been modified or installed by the recipient, or for +the User Product in which it has been modified or installed. Access to a +network may be denied when the modification itself materially and +adversely affects the operation of the network or violates the rules and +protocols for communication across the network. + + Corresponding Source conveyed, and Installation Information provided, +in accord with this section must be in a format that is publicly +documented (and with an implementation available to the public in +source code form), and must require no special password or key for +unpacking, reading or copying. + + 7. Additional Terms. + + "Additional permissions" are terms that supplement the terms of this +License by making exceptions from one or more of its conditions. +Additional permissions that are applicable to the entire Program shall +be treated as though they were included in this License, to the extent +that they are valid under applicable law. If additional permissions +apply only to part of the Program, that part may be used separately +under those permissions, but the entire Program remains governed by +this License without regard to the additional permissions. + + When you convey a copy of a covered work, you may at your option +remove any additional permissions from that copy, or from any part of +it. (Additional permissions may be written to require their own +removal in certain cases when you modify the work.) You may place +additional permissions on material, added by you to a covered work, +for which you have or can give appropriate copyright permission. + + Notwithstanding any other provision of this License, for material you +add to a covered work, you may (if authorized by the copyright holders of +that material) supplement the terms of this License with terms: + + a) Disclaiming warranty or limiting liability differently from the + terms of sections 15 and 16 of this License; or + + b) Requiring preservation of specified reasonable legal notices or + author attributions in that material or in the Appropriate Legal + Notices displayed by works containing it; or + + c) Prohibiting misrepresentation of the origin of that material, or + requiring that modified versions of such material be marked in + reasonable ways as different from the original version; or + + d) Limiting the use for publicity purposes of names of licensors or + authors of the material; or + + e) Declining to grant rights under trademark law for use of some + trade names, trademarks, or service marks; or + + f) Requiring indemnification of licensors and authors of that + material by anyone who conveys the material (or modified versions of + it) with contractual assumptions of liability to the recipient, for + any liability that these contractual assumptions directly impose on + those licensors and authors. + + All other non-permissive additional terms are considered "further +restrictions" within the meaning of section 10. If the Program as you +received it, or any part of it, contains a notice stating that it is +governed by this License along with a term that is a further +restriction, you may remove that term. If a license document contains +a further restriction but permits relicensing or conveying under this +License, you may add to a covered work material governed by the terms +of that license document, provided that the further restriction does +not survive such relicensing or conveying. + + If you add terms to a covered work in accord with this section, you +must place, in the relevant source files, a statement of the +additional terms that apply to those files, or a notice indicating +where to find the applicable terms. + + Additional terms, permissive or non-permissive, may be stated in the +form of a separately written license, or stated as exceptions; +the above requirements apply either way. + + 8. Termination. + + You may not propagate or modify a covered work except as expressly +provided under this License. Any attempt otherwise to propagate or +modify it is void, and will automatically terminate your rights under +this License (including any patent licenses granted under the third +paragraph of section 11). + + However, if you cease all violation of this License, then your +license from a particular copyright holder is reinstated (a) +provisionally, unless and until the copyright holder explicitly and +finally terminates your license, and (b) permanently, if the copyright +holder fails to notify you of the violation by some reasonable means +prior to 60 days after the cessation. + + Moreover, your license from a particular copyright holder is +reinstated permanently if the copyright holder notifies you of the +violation by some reasonable means, this is the first time you have +received notice of violation of this License (for any work) from that +copyright holder, and you cure the violation prior to 30 days after +your receipt of the notice. + + Termination of your rights under this section does not terminate the +licenses of parties who have received copies or rights from you under +this License. If your rights have been terminated and not permanently +reinstated, you do not qualify to receive new licenses for the same +material under section 10. + + 9. Acceptance Not Required for Having Copies. + + You are not required to accept this License in order to receive or +run a copy of the Program. Ancillary propagation of a covered work +occurring solely as a consequence of using peer-to-peer transmission +to receive a copy likewise does not require acceptance. However, +nothing other than this License grants you permission to propagate or +modify any covered work. These actions infringe copyright if you do +not accept this License. Therefore, by modifying or propagating a +covered work, you indicate your acceptance of this License to do so. + + 10. Automatic Licensing of Downstream Recipients. + + Each time you convey a covered work, the recipient automatically +receives a license from the original licensors, to run, modify and +propagate that work, subject to this License. You are not responsible +for enforcing compliance by third parties with this License. + + An "entity transaction" is a transaction transferring control of an +organization, or substantially all assets of one, or subdividing an +organization, or merging organizations. If propagation of a covered +work results from an entity transaction, each party to that +transaction who receives a copy of the work also receives whatever +licenses to the work the party's predecessor in interest had or could +give under the previous paragraph, plus a right to possession of the +Corresponding Source of the work from the predecessor in interest, if +the predecessor has it or can get it with reasonable efforts. + + You may not impose any further restrictions on the exercise of the +rights granted or affirmed under this License. For example, you may +not impose a license fee, royalty, or other charge for exercise of +rights granted under this License, and you may not initiate litigation +(including a cross-claim or counterclaim in a lawsuit) alleging that +any patent claim is infringed by making, using, selling, offering for +sale, or importing the Program or any portion of it. + + 11. Patents. + + A "contributor" is a copyright holder who authorizes use under this +License of the Program or a work on which the Program is based. The +work thus licensed is called the contributor's "contributor version". + + A contributor's "essential patent claims" are all patent claims +owned or controlled by the contributor, whether already acquired or +hereafter acquired, that would be infringed by some manner, permitted +by this License, of making, using, or selling its contributor version, +but do not include claims that would be infringed only as a +consequence of further modification of the contributor version. For +purposes of this definition, "control" includes the right to grant +patent sublicenses in a manner consistent with the requirements of +this License. + + Each contributor grants you a non-exclusive, worldwide, royalty-free +patent license under the contributor's essential patent claims, to +make, use, sell, offer for sale, import and otherwise run, modify and +propagate the contents of its contributor version. + + In the following three paragraphs, a "patent license" is any express +agreement or commitment, however denominated, not to enforce a patent +(such as an express permission to practice a patent or covenant not to +sue for patent infringement). To "grant" such a patent license to a +party means to make such an agreement or commitment not to enforce a +patent against the party. + + If you convey a covered work, knowingly relying on a patent license, +and the Corresponding Source of the work is not available for anyone +to copy, free of charge and under the terms of this License, through a +publicly available network server or other readily accessible means, +then you must either (1) cause the Corresponding Source to be so +available, or (2) arrange to deprive yourself of the benefit of the +patent license for this particular work, or (3) arrange, in a manner +consistent with the requirements of this License, to extend the patent +license to downstream recipients. "Knowingly relying" means you have +actual knowledge that, but for the patent license, your conveying the +covered work in a country, or your recipient's use of the covered work +in a country, would infringe one or more identifiable patents in that +country that you have reason to believe are valid. + + If, pursuant to or in connection with a single transaction or +arrangement, you convey, or propagate by procuring conveyance of, a +covered work, and grant a patent license to some of the parties +receiving the covered work authorizing them to use, propagate, modify +or convey a specific copy of the covered work, then the patent license +you grant is automatically extended to all recipients of the covered +work and works based on it. + + A patent license is "discriminatory" if it does not include within +the scope of its coverage, prohibits the exercise of, or is +conditioned on the non-exercise of one or more of the rights that are +specifically granted under this License. You may not convey a covered +work if you are a party to an arrangement with a third party that is +in the business of distributing software, under which you make payment +to the third party based on the extent of your activity of conveying +the work, and under which the third party grants, to any of the +parties who would receive the covered work from you, a discriminatory +patent license (a) in connection with copies of the covered work +conveyed by you (or copies made from those copies), or (b) primarily +for and in connection with specific products or compilations that +contain the covered work, unless you entered into that arrangement, +or that patent license was granted, prior to 28 March 2007. + + Nothing in this License shall be construed as excluding or limiting +any implied license or other defenses to infringement that may +otherwise be available to you under applicable patent law. + + 12. No Surrender of Others' Freedom. + + If conditions are imposed on you (whether by court order, agreement or +otherwise) that contradict the conditions of this License, they do not +excuse you from the conditions of this License. If you cannot convey a +covered work so as to satisfy simultaneously your obligations under this +License and any other pertinent obligations, then as a consequence you may +not convey it at all. For example, if you agree to terms that obligate you +to collect a royalty for further conveying from those to whom you convey +the Program, the only way you could satisfy both those terms and this +License would be to refrain entirely from conveying the Program. + + 13. Use with the GNU Affero General Public License. + + Notwithstanding any other provision of this License, you have +permission to link or combine any covered work with a work licensed +under version 3 of the GNU Affero General Public License into a single +combined work, and to convey the resulting work. The terms of this +License will continue to apply to the part which is the covered work, +but the special requirements of the GNU Affero General Public License, +section 13, concerning interaction through a network will apply to the +combination as such. + + 14. Revised Versions of this License. + + The Free Software Foundation may publish revised and/or new versions of +the GNU General Public License from time to time. Such new versions will +be similar in spirit to the present version, but may differ in detail to +address new problems or concerns. + + Each version is given a distinguishing version number. If the +Program specifies that a certain numbered version of the GNU General +Public License "or any later version" applies to it, you have the +option of following the terms and conditions either of that numbered +version or of any later version published by the Free Software +Foundation. If the Program does not specify a version number of the +GNU General Public License, you may choose any version ever published +by the Free Software Foundation. + + If the Program specifies that a proxy can decide which future +versions of the GNU General Public License can be used, that proxy's +public statement of acceptance of a version permanently authorizes you +to choose that version for the Program. + + Later license versions may give you additional or different +permissions. However, no additional obligations are imposed on any +author or copyright holder as a result of your choosing to follow a +later version. + + 15. Disclaimer of Warranty. + + THERE IS NO WARRANTY FOR THE PROGRAM, TO THE EXTENT PERMITTED BY +APPLICABLE LAW. EXCEPT WHEN OTHERWISE STATED IN WRITING THE COPYRIGHT +HOLDERS AND/OR OTHER PARTIES PROVIDE THE PROGRAM "AS IS" WITHOUT WARRANTY +OF ANY KIND, EITHER EXPRESSED OR IMPLIED, INCLUDING, BUT NOT LIMITED TO, +THE IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR +PURPOSE. THE ENTIRE RISK AS TO THE QUALITY AND PERFORMANCE OF THE PROGRAM +IS WITH YOU. SHOULD THE PROGRAM PROVE DEFECTIVE, YOU ASSUME THE COST OF +ALL NECESSARY SERVICING, REPAIR OR CORRECTION. + + 16. Limitation of Liability. + + IN NO EVENT UNLESS REQUIRED BY APPLICABLE LAW OR AGREED TO IN WRITING +WILL ANY COPYRIGHT HOLDER, OR ANY OTHER PARTY WHO MODIFIES AND/OR CONVEYS +THE PROGRAM AS PERMITTED ABOVE, BE LIABLE TO YOU FOR DAMAGES, INCLUDING ANY +GENERAL, SPECIAL, INCIDENTAL OR CONSEQUENTIAL DAMAGES ARISING OUT OF THE +USE OR INABILITY TO USE THE PROGRAM (INCLUDING BUT NOT LIMITED TO LOSS OF +DATA OR DATA BEING RENDERED INACCURATE OR LOSSES SUSTAINED BY YOU OR THIRD +PARTIES OR A FAILURE OF THE PROGRAM TO OPERATE WITH ANY OTHER PROGRAMS), +EVEN IF SUCH HOLDER OR OTHER PARTY HAS BEEN ADVISED OF THE POSSIBILITY OF +SUCH DAMAGES. + + 17. Interpretation of Sections 15 and 16. + + If the disclaimer of warranty and limitation of liability provided +above cannot be given local legal effect according to their terms, +reviewing courts shall apply local law that most closely approximates +an absolute waiver of all civil liability in connection with the +Program, unless a warranty or assumption of liability accompanies a +copy of the Program in return for a fee. + + END OF TERMS AND CONDITIONS + + How to Apply These Terms to Your New Programs + + If you develop a new program, and you want it to be of the greatest +possible use to the public, the best way to achieve this is to make it +free software which everyone can redistribute and change under these terms. + + To do so, attach the following notices to the program. It is safest +to attach them to the start of each source file to most effectively +state the exclusion of warranty; and each file should have at least +the "copyright" line and a pointer to where the full notice is found. + + + Copyright (C) + + This program is free software: you can redistribute it and/or modify + it under the terms of the GNU General Public License as published by + the Free Software Foundation, either version 3 of the License, or + (at your option) any later version. + + This program is distributed in the hope that it will be useful, + but WITHOUT ANY WARRANTY; without even the implied warranty of + MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the + GNU General Public License for more details. + + You should have received a copy of the GNU General Public License + along with this program. If not, see . + +Also add information on how to contact you by electronic and paper mail. + + If the program does terminal interaction, make it output a short +notice like this when it starts in an interactive mode: + + Copyright (C) + This program comes with ABSOLUTELY NO WARRANTY; for details type `show w'. + This is free software, and you are welcome to redistribute it + under certain conditions; type `show c' for details. + +The hypothetical commands `show w' and `show c' should show the appropriate +parts of the General Public License. Of course, your program's commands +might be different; for a GUI interface, you would use an "about box". + + You should also get your employer (if you work as a programmer) or school, +if any, to sign a "copyright disclaimer" for the program, if necessary. +For more information on this, and how to apply and follow the GNU GPL, see +. + + The GNU General Public License does not permit incorporating your program +into proprietary programs. If your program is a subroutine library, you +may consider it more useful to permit linking proprietary applications with +the library. If this is what you want to do, use the GNU Lesser General +Public License instead of this License. But first, please read +. diff --git a/build.gradle b/build.gradle new file mode 100644 index 0000000..559fa07 --- /dev/null +++ b/build.gradle @@ -0,0 +1,28 @@ +plugins { + id('com.android.application') version '7.4.0' apply false + id('com.android.library') version '7.4.0' apply false + id('org.jetbrains.kotlin.android') version '1.8.0' apply false + id('org.jetbrains.kotlin.plugin.parcelize') version '1.8.0' apply false + id('com.google.devtools.ksp') version '1.8.0-1.0.9' apply false + id('com.google.protobuf') version '0.8.19' apply false +} + +wrapper { + distributionType = Wrapper.DistributionType.ALL +} + +allprojects { + group = 'im.molly' + + ext { + gitVersion = gitVersion() + } +} + +task clean(type: Delete) { + delete rootProject.buildDir +} + +static def gitVersion() { + return 'git describe --tags --always --first-parent'.execute().text.trim() +} diff --git a/demo/android/build.gradle b/demo/android/build.gradle new file mode 100644 index 0000000..adc5966 --- /dev/null +++ b/demo/android/build.gradle @@ -0,0 +1,91 @@ +apply plugin: 'com.android.application' +apply plugin: 'org.jetbrains.kotlin.android' +apply plugin: 'com.google.devtools.ksp' + +ext { + composeVersion = '1.4.0-alpha04' + composeCompilerVersion = '1.4.0' + lifecycleVersion = '2.6.0-alpha04' + roomVersion = '2.5.0' +} + +android { + compileSdk 33 + + defaultConfig { + applicationId "im.molly.monero.demo" + minSdk 26 + targetSdk 33 + versionCode 1 + versionName "1.0" + + testInstrumentationRunner "androidx.test.runner.AndroidJUnitRunner" + vectorDrawables { + useSupportLibrary true + } + + ksp { + arg("room.schemaLocation", "$projectDir/schemas") + } + } + + buildTypes { + release { + minifyEnabled false + proguardFiles getDefaultProguardFile('proguard-android-optimize.txt'), 'proguard-rules.pro' + } + } + + compileOptions { + sourceCompatibility JavaVersion.VERSION_1_8 + targetCompatibility JavaVersion.VERSION_1_8 + } + + kotlinOptions { + jvmTarget = '1.8' + } + + buildFeatures { + compose true + } + + composeOptions { + kotlinCompilerExtensionVersion composeCompilerVersion + } + + packagingOptions { + resources { + excludes += '/META-INF/{AL2.0,LGPL2.1}' + } + } +} + +dependencies { + implementation "androidx.core:core-ktx:1.9.0" + implementation "androidx.compose.ui:ui:$composeVersion" + implementation "androidx.compose.material3:material3:1.1.0-alpha04" + implementation "androidx.compose.ui:ui-tooling-preview:$composeVersion" + implementation "com.google.accompanist:accompanist-systemuicontroller:0.28.0" + implementation "androidx.lifecycle:lifecycle-viewmodel-compose:$lifecycleVersion" + implementation "androidx.lifecycle:lifecycle-runtime-compose:$lifecycleVersion" + implementation "androidx.activity:activity-compose:1.6.1" + + implementation "androidx.room:room-runtime:$roomVersion" + implementation "androidx.room:room-ktx:$roomVersion" + implementation "androidx.navigation:navigation-runtime-ktx:2.5.3" + implementation "androidx.navigation:navigation-compose:2.5.3" + implementation 'androidx.lifecycle:lifecycle-service:2.5.1' + implementation 'androidx.lifecycle:lifecycle-process:2.5.1' + ksp "androidx.room:room-compiler:$roomVersion" + + implementation project(':lib') + + testImplementation "junit:junit:4.13.2" + + androidTestImplementation "androidx.test.ext:junit:1.1.5" + androidTestImplementation "androidx.test.espresso:espresso-core:3.5.1" + androidTestImplementation "androidx.compose.ui:ui-test-junit4:$composeVersion" + + debugImplementation "androidx.compose.ui:ui-tooling:$composeVersion" + debugImplementation "androidx.compose.ui:ui-test-manifest:$composeVersion" +} diff --git a/demo/android/proguard-rules.pro b/demo/android/proguard-rules.pro new file mode 100644 index 0000000..481bb43 --- /dev/null +++ b/demo/android/proguard-rules.pro @@ -0,0 +1,21 @@ +# Add project specific ProGuard rules here. +# You can control the set of applied configuration files using the +# proguardFiles setting in build.gradle. +# +# For more details, see +# http://developer.android.com/guide/developing/tools/proguard.html + +# If your project uses WebView with JS, uncomment the following +# and specify the fully qualified class name to the JavaScript interface +# class: +#-keepclassmembers class fqcn.of.javascript.interface.for.webview { +# public *; +#} + +# Uncomment this to preserve the line number information for +# debugging stack traces. +#-keepattributes SourceFile,LineNumberTable + +# If you keep the line number information, uncomment this to +# hide the original source file name. +#-renamesourcefileattribute SourceFile \ No newline at end of file diff --git a/demo/android/schemas/im.molly.monero.demo.data.AppDatabase/1.json b/demo/android/schemas/im.molly.monero.demo.data.AppDatabase/1.json new file mode 100644 index 0000000..427bb1a --- /dev/null +++ b/demo/android/schemas/im.molly.monero.demo.data.AppDatabase/1.json @@ -0,0 +1,179 @@ +{ + "formatVersion": 1, + "database": { + "version": 1, + "identityHash": "8e728fa24771d06bb2988df1356e07ec", + "entities": [ + { + "tableName": "wallets", + "createSql": "CREATE TABLE IF NOT EXISTS `${TABLE_NAME}` (`id` INTEGER PRIMARY KEY AUTOINCREMENT NOT NULL, `public_address` TEXT NOT NULL, `name` TEXT NOT NULL)", + "fields": [ + { + "fieldPath": "id", + "columnName": "id", + "affinity": "INTEGER", + "notNull": true + }, + { + "fieldPath": "publicAddress", + "columnName": "public_address", + "affinity": "TEXT", + "notNull": true + }, + { + "fieldPath": "name", + "columnName": "name", + "affinity": "TEXT", + "notNull": true + } + ], + "primaryKey": { + "autoGenerate": true, + "columnNames": [ + "id" + ] + }, + "indices": [ + { + "name": "index_wallets_public_address", + "unique": true, + "columnNames": [ + "public_address" + ], + "orders": [], + "createSql": "CREATE UNIQUE INDEX IF NOT EXISTS `index_wallets_public_address` ON `${TABLE_NAME}` (`public_address`)" + } + ], + "foreignKeys": [] + }, + { + "tableName": "remote_nodes", + "createSql": "CREATE TABLE IF NOT EXISTS `${TABLE_NAME}` (`id` INTEGER PRIMARY KEY AUTOINCREMENT NOT NULL, `net_type` INTEGER NOT NULL, `uri` TEXT NOT NULL, `user` TEXT NOT NULL, `pwd` TEXT NOT NULL)", + "fields": [ + { + "fieldPath": "id", + "columnName": "id", + "affinity": "INTEGER", + "notNull": true + }, + { + "fieldPath": "networkId", + "columnName": "net_type", + "affinity": "INTEGER", + "notNull": true + }, + { + "fieldPath": "uri", + "columnName": "uri", + "affinity": "TEXT", + "notNull": true + }, + { + "fieldPath": "username", + "columnName": "user", + "affinity": "TEXT", + "notNull": true + }, + { + "fieldPath": "password", + "columnName": "pwd", + "affinity": "TEXT", + "notNull": true + } + ], + "primaryKey": { + "autoGenerate": true, + "columnNames": [ + "id" + ] + }, + "indices": [ + { + "name": "index_remote_nodes_net_type", + "unique": false, + "columnNames": [ + "net_type" + ], + "orders": [], + "createSql": "CREATE INDEX IF NOT EXISTS `index_remote_nodes_net_type` ON `${TABLE_NAME}` (`net_type`)" + } + ], + "foreignKeys": [] + }, + { + "tableName": "wallet_remote_nodes", + "createSql": "CREATE TABLE IF NOT EXISTS `${TABLE_NAME}` (`wallet_id` INTEGER NOT NULL, `remote_node_id` INTEGER NOT NULL, PRIMARY KEY(`wallet_id`, `remote_node_id`), FOREIGN KEY(`wallet_id`) REFERENCES `wallets`(`id`) ON UPDATE NO ACTION ON DELETE CASCADE , FOREIGN KEY(`remote_node_id`) REFERENCES `remote_nodes`(`id`) ON UPDATE NO ACTION ON DELETE CASCADE )", + "fields": [ + { + "fieldPath": "walletId", + "columnName": "wallet_id", + "affinity": "INTEGER", + "notNull": true + }, + { + "fieldPath": "remoteNodeId", + "columnName": "remote_node_id", + "affinity": "INTEGER", + "notNull": true + } + ], + "primaryKey": { + "autoGenerate": false, + "columnNames": [ + "wallet_id", + "remote_node_id" + ] + }, + "indices": [ + { + "name": "index_wallet_remote_nodes_wallet_id", + "unique": false, + "columnNames": [ + "wallet_id" + ], + "orders": [], + "createSql": "CREATE INDEX IF NOT EXISTS `index_wallet_remote_nodes_wallet_id` ON `${TABLE_NAME}` (`wallet_id`)" + }, + { + "name": "index_wallet_remote_nodes_remote_node_id", + "unique": false, + "columnNames": [ + "remote_node_id" + ], + "orders": [], + "createSql": "CREATE INDEX IF NOT EXISTS `index_wallet_remote_nodes_remote_node_id` ON `${TABLE_NAME}` (`remote_node_id`)" + } + ], + "foreignKeys": [ + { + "table": "wallets", + "onDelete": "CASCADE", + "onUpdate": "NO ACTION", + "columns": [ + "wallet_id" + ], + "referencedColumns": [ + "id" + ] + }, + { + "table": "remote_nodes", + "onDelete": "CASCADE", + "onUpdate": "NO ACTION", + "columns": [ + "remote_node_id" + ], + "referencedColumns": [ + "id" + ] + } + ] + } + ], + "views": [], + "setupQueries": [ + "CREATE TABLE IF NOT EXISTS room_master_table (id INTEGER PRIMARY KEY,identity_hash TEXT)", + "INSERT OR REPLACE INTO room_master_table (id,identity_hash) VALUES(42, '8e728fa24771d06bb2988df1356e07ec')" + ] + } +} \ No newline at end of file diff --git a/demo/android/src/androidTest/kotlin/im/molly/monero/demo/ExampleInstrumentedTest.kt b/demo/android/src/androidTest/kotlin/im/molly/monero/demo/ExampleInstrumentedTest.kt new file mode 100644 index 0000000..b13a977 --- /dev/null +++ b/demo/android/src/androidTest/kotlin/im/molly/monero/demo/ExampleInstrumentedTest.kt @@ -0,0 +1,24 @@ +package im.molly.monero.demo + +import androidx.test.platform.app.InstrumentationRegistry +import androidx.test.ext.junit.runners.AndroidJUnit4 + +import org.junit.Test +import org.junit.runner.RunWith + +import org.junit.Assert.* + +/** + * Instrumented test, which will execute on an Android device. + * + * See [testing documentation](http://d.android.com/tools/testing). + */ +@RunWith(AndroidJUnit4::class) +class ExampleInstrumentedTest { + @Test + fun useAppContext() { + // Context of the app under test. + val appContext = InstrumentationRegistry.getInstrumentation().targetContext + assertEquals("im.molly.monero.demo", appContext.packageName) + } +} \ No newline at end of file diff --git a/demo/android/src/main/AndroidManifest.xml b/demo/android/src/main/AndroidManifest.xml new file mode 100644 index 0000000..55c1678 --- /dev/null +++ b/demo/android/src/main/AndroidManifest.xml @@ -0,0 +1,29 @@ + + + + + + + + + + + + + + + diff --git a/demo/android/src/main/kotlin/im/molly/monero/demo/AppModule.kt b/demo/android/src/main/kotlin/im/molly/monero/demo/AppModule.kt new file mode 100644 index 0000000..e0d1382 --- /dev/null +++ b/demo/android/src/main/kotlin/im/molly/monero/demo/AppModule.kt @@ -0,0 +1,51 @@ +package im.molly.monero.demo + +import android.app.Application +import androidx.room.Room +import im.molly.monero.demo.data.* +import okhttp3.OkHttpClient + +/** + * Naive container of global instances. + * + * A complex app should use Koin or Hilt for dependencies. + */ +object AppModule { + lateinit var application: Application + + private val applicationScope = kotlinx.coroutines.MainScope() + + private val database: AppDatabase by lazy { + Room.databaseBuilder( + application, AppDatabase::class.java, "monero-demo.db" + ).build() + } + + private val walletHttpClient: OkHttpClient by lazy { + OkHttpClient.Builder().build() + } + + private val walletDataSource: WalletDataSource by lazy { + WalletDataSource(database.walletDao()) + } + + private val walletDataFileStorage: WalletDataFileStorage by lazy { + AppWalletDataFileStorage(application) + } + + private val moneroSdkClient: MoneroSdkClient by lazy { + MoneroSdkClient(application, walletDataFileStorage, walletHttpClient) + } + + val remoteNodeRepository: RemoteNodeRepository by lazy { + RemoteNodeRepository(database.remoteNodeDao()) + } + + val walletRepository: WalletRepository by lazy { + WalletRepository(moneroSdkClient, walletDataSource, applicationScope) + } + + fun provide(application: Application) { + this.application = application + } +} diff --git a/demo/android/src/main/kotlin/im/molly/monero/demo/MainActivity.kt b/demo/android/src/main/kotlin/im/molly/monero/demo/MainActivity.kt new file mode 100644 index 0000000..f23fd9d --- /dev/null +++ b/demo/android/src/main/kotlin/im/molly/monero/demo/MainActivity.kt @@ -0,0 +1,71 @@ +package im.molly.monero.demo + +import android.content.ComponentName +import android.content.Context +import android.content.Intent +import android.content.ServiceConnection +import android.os.Bundle +import android.os.IBinder +import android.os.StrictMode +import android.os.StrictMode.VmPolicy +import androidx.activity.ComponentActivity +import androidx.activity.compose.setContent +import androidx.compose.foundation.isSystemInDarkTheme +import androidx.compose.runtime.DisposableEffect +import androidx.compose.ui.graphics.Color +import androidx.core.view.WindowCompat +import com.google.accompanist.systemuicontroller.rememberSystemUiController +import im.molly.monero.demo.service.SyncService +import im.molly.monero.demo.ui.DemoApp +import im.molly.monero.demo.ui.theme.AppTheme +import kotlinx.coroutines.ExperimentalCoroutinesApi +import kotlinx.coroutines.suspendCancellableCoroutine + + +class MainActivity : ComponentActivity() { + override fun onCreate(savedInstanceState: Bundle?) { + super.onCreate(savedInstanceState) + + WindowCompat.setDecorFitsSystemWindows(window, false) + + setContent { + val systemUiController = rememberSystemUiController() + val darkTheme = isSystemInDarkTheme() + + DisposableEffect(systemUiController, darkTheme) { + systemUiController.setSystemBarsColor( + color = Color.Transparent, + darkIcons = !darkTheme, + ) + + onDispose {} + } + + AppTheme( + darkTheme = darkTheme, + ) { + DemoApp() + } + } + } + + @OptIn(ExperimentalCoroutinesApi::class) + suspend fun connectToSyncService(): SyncService.LocalBinder = + suspendCancellableCoroutine { continuation -> + val connection = object : ServiceConnection { + override fun onServiceConnected(name: ComponentName?, service: IBinder?) { + val binder = service as SyncService.LocalBinder + continuation.resume(binder) { + unbindService(this) + } + } + + override fun onServiceDisconnected(name: ComponentName?) { + } + } + + Intent(this@MainActivity, SyncService::class.java).also { intent -> + bindService(intent, connection, Context.BIND_AUTO_CREATE) + } + } +} diff --git a/demo/android/src/main/kotlin/im/molly/monero/demo/MainApplication.kt b/demo/android/src/main/kotlin/im/molly/monero/demo/MainApplication.kt new file mode 100644 index 0000000..b16f790 --- /dev/null +++ b/demo/android/src/main/kotlin/im/molly/monero/demo/MainApplication.kt @@ -0,0 +1,23 @@ +package im.molly.monero.demo + +import android.app.Application +import android.os.StrictMode +import im.molly.monero.demo.service.SyncService +import im.molly.monero.isIsolatedProcess + +class MainApplication : Application() { + + override fun onCreate() { + super.onCreate() + StrictMode.setVmPolicy( + StrictMode.VmPolicy.Builder(StrictMode.getVmPolicy()) + .detectLeakedClosableObjects() + .build() + ) + if (isIsolatedProcess()) { + return + } + AppModule.provide(this) + SyncService.start(this) + } +} diff --git a/demo/android/src/main/kotlin/im/molly/monero/demo/common/Result.kt b/demo/android/src/main/kotlin/im/molly/monero/demo/common/Result.kt new file mode 100644 index 0000000..9aaf8fa --- /dev/null +++ b/demo/android/src/main/kotlin/im/molly/monero/demo/common/Result.kt @@ -0,0 +1,21 @@ +package im.molly.monero.demo.common + +import kotlinx.coroutines.flow.Flow +import kotlinx.coroutines.flow.catch +import kotlinx.coroutines.flow.map +import kotlinx.coroutines.flow.onStart + +sealed interface Result { + data class Success(val data: T) : Result + data class Error(val exception: Throwable? = null) : Result + object Loading : Result +} + +fun Flow.asResult(): Flow> { + return this + .map> { + Result.Success(it) + } + .onStart { emit(Result.Loading) } + .catch { emit(Result.Error(it)) } +} diff --git a/demo/android/src/main/kotlin/im/molly/monero/demo/data/AppDatabase.kt b/demo/android/src/main/kotlin/im/molly/monero/demo/data/AppDatabase.kt new file mode 100644 index 0000000..bc51389 --- /dev/null +++ b/demo/android/src/main/kotlin/im/molly/monero/demo/data/AppDatabase.kt @@ -0,0 +1,26 @@ +package im.molly.monero.demo.data + +import androidx.room.Database +import androidx.room.RoomDatabase +import im.molly.monero.demo.data.dao.RemoteNodeDao +import im.molly.monero.demo.data.dao.WalletDao +import im.molly.monero.demo.data.entity.RemoteNodeEntity +import im.molly.monero.demo.data.entity.WalletEntity +import im.molly.monero.demo.data.entity.WalletRemoteNodeXRef + +private const val DATABASE_VERSION = 1 + +@Database( + entities = [ + WalletEntity::class, + RemoteNodeEntity::class, + WalletRemoteNodeXRef::class, +// TransactionEntity::class, + ], + version = DATABASE_VERSION, + exportSchema = true, +) +abstract class AppDatabase : RoomDatabase() { + abstract fun remoteNodeDao(): RemoteNodeDao + abstract fun walletDao(): WalletDao +} diff --git a/demo/android/src/main/kotlin/im/molly/monero/demo/data/MoneroSdkClient.kt b/demo/android/src/main/kotlin/im/molly/monero/demo/data/MoneroSdkClient.kt new file mode 100644 index 0000000..1e8c1ed --- /dev/null +++ b/demo/android/src/main/kotlin/im/molly/monero/demo/data/MoneroSdkClient.kt @@ -0,0 +1,44 @@ +package im.molly.monero.demo.data + +import android.content.Context +import im.molly.monero.* +import kotlinx.coroutines.CoroutineDispatcher +import kotlinx.coroutines.Dispatchers +import kotlinx.coroutines.withContext +import okhttp3.OkHttpClient + +class MoneroSdkClient( + private val context: Context, + private val walletDataFileStorage: WalletDataFileStorage, + private val httpClient: OkHttpClient, + private val ioDispatcher: CoroutineDispatcher = Dispatchers.IO, +) { + suspend fun createWallet(moneroNetwork: MoneroNetwork): MoneroWallet = + withContext(ioDispatcher) { + val walletClient = WalletClient.forNetwork( + context = context, + network = moneroNetwork, + ) + val wallet = walletClient.createNewWallet() + walletDataFileStorage.tryWriteData(wallet.publicAddress, false) { output -> + walletClient.saveWallet(wallet, output) + } + wallet + } + + suspend fun openWallet( + publicAddress: String, + remoteNodeSelector: RemoteNodeSelector?, + ): MoneroWallet = + withContext(ioDispatcher) { + val walletClient = WalletClient.forNetwork( + context = context, + network = MoneroNetwork.of(publicAddress), + nodeSelector = remoteNodeSelector, + httpClient = httpClient, + ) + walletDataFileStorage.readData(publicAddress).use { input -> + walletClient.openWallet(input) + } + } +} diff --git a/demo/android/src/main/kotlin/im/molly/monero/demo/data/RemoteNodeRepository.kt b/demo/android/src/main/kotlin/im/molly/monero/demo/data/RemoteNodeRepository.kt new file mode 100644 index 0000000..60b3c1c --- /dev/null +++ b/demo/android/src/main/kotlin/im/molly/monero/demo/data/RemoteNodeRepository.kt @@ -0,0 +1,30 @@ +package im.molly.monero.demo.data + +import im.molly.monero.demo.data.dao.RemoteNodeDao +import im.molly.monero.demo.data.entity.* +import im.molly.monero.demo.data.model.RemoteNode +import kotlinx.coroutines.flow.Flow +import kotlinx.coroutines.flow.map + +class RemoteNodeRepository( + private val remoteNodeDao: RemoteNodeDao, +) { + fun getRemoteNode(remoteNodeId: Long): Flow = + remoteNodeDao.findById(remoteNodeId).map { it.asExternalModel() } + + fun getRemoteNodes(remoteNodeIds: List): Flow> = + remoteNodeDao.findByIds(remoteNodeIds).map { it.map(RemoteNodeEntity::asExternalModel) } + + fun getAllRemoteNodes(filterNetworkIds: Set = emptySet()): Flow> = + if (filterNetworkIds.isEmpty()) { + remoteNodeDao.findAll() + } else { + remoteNodeDao.findByNetworkIds(filterNetworkIds) + }.map { it.map(RemoteNodeEntity::asExternalModel) } + + suspend fun addOrUpdateRemoteNode(remoteNode: RemoteNode) = + remoteNodeDao.upsert(remoteNode.asEntity()) + + suspend fun deleteRemoteNode(remoteNode: RemoteNode) = + remoteNodeDao.delete(remoteNode.asEntity()) +} diff --git a/demo/android/src/main/kotlin/im/molly/monero/demo/data/WalletDataFileStorage.kt b/demo/android/src/main/kotlin/im/molly/monero/demo/data/WalletDataFileStorage.kt new file mode 100644 index 0000000..d7a0165 --- /dev/null +++ b/demo/android/src/main/kotlin/im/molly/monero/demo/data/WalletDataFileStorage.kt @@ -0,0 +1,59 @@ +package im.molly.monero.demo.data + +import android.content.Context +import android.util.AtomicFile +import java.io.File +import java.io.FileInputStream +import java.io.FileOutputStream +import java.io.IOException + +interface WalletDataFileStorage { + fun tryWriteData( + publicAddress: String, + canOverwrite: Boolean = true, + block: (FileOutputStream) -> Unit, + ) + + fun readData(publicAddress: String): FileInputStream +} + +class AppWalletDataFileStorage(context: Context) : WalletDataFileStorage { + private val filesDir = context.filesDir + + override fun tryWriteData( + publicAddress: String, + canOverwrite: Boolean, + block: (FileOutputStream) -> Unit, + ) { + val file = getBackingFile(publicAddress) + if (!(canOverwrite || file.baseFile.createNewFile())) { + throw IOException("Data file already exists: ${file.baseFile.path}") + } + val output = file.startWrite() + try { + block(output) + file.finishWrite(output) + } catch (ioe: IOException) { + file.failWrite(output) + throw ioe + } + } + + override fun readData(publicAddress: String): FileInputStream { + val file = getBackingFile(publicAddress) + return file.openRead() + } + + private fun getBackingFile(publicAddress: String): AtomicFile { + val uniqueFilename = publicAddress.substring(0, 11) + ".wallet" + return AtomicFile(File(getOrCreateWalletDataDir(), uniqueFilename)) + } + + private fun getOrCreateWalletDataDir(): File { + val walletDataDir = File(filesDir, "wallet_data") + if (walletDataDir.exists() || walletDataDir.mkdir()) { + return walletDataDir + } + throw IOException("Cannot create wallet data directory: ${walletDataDir.path}") + } +} diff --git a/demo/android/src/main/kotlin/im/molly/monero/demo/data/WalletDataSource.kt b/demo/android/src/main/kotlin/im/molly/monero/demo/data/WalletDataSource.kt new file mode 100644 index 0000000..0b85dcc --- /dev/null +++ b/demo/android/src/main/kotlin/im/molly/monero/demo/data/WalletDataSource.kt @@ -0,0 +1,39 @@ +package im.molly.monero.demo.data + +import im.molly.monero.demo.data.dao.WalletDao +import im.molly.monero.demo.data.entity.WalletEntity +import im.molly.monero.demo.data.entity.WalletRemoteNodeXRef +import im.molly.monero.demo.data.entity.asExternalModel +import im.molly.monero.demo.data.model.WalletConfig +import kotlinx.coroutines.flow.Flow +import kotlinx.coroutines.flow.map + +class WalletDataSource( + private val walletDao: WalletDao, +) { + fun getWalletIdList(): Flow> = walletDao.findAllIds() + + fun loadWalletConfig(walletId: Long): Flow = + walletDao.findById(walletId).map { it.asExternalModel() } + + suspend fun storeWalletConfig( + publicAddress: String, + name: String, + remoteNodeIds: List, + ): Long { + val walletId = walletDao.insert( + WalletEntity( + publicAddress = publicAddress, + name = name, + ) + ) + val walletRemoteNodeXRef = remoteNodeIds.map { remoteNodeId -> + WalletRemoteNodeXRef( + walletId = walletId, + remoteNodeId = remoteNodeId + ) + } + walletDao.insertRemoteNodeXRefEntities(walletRemoteNodeXRef) + return walletId + } +} diff --git a/demo/android/src/main/kotlin/im/molly/monero/demo/data/WalletRepository.kt b/demo/android/src/main/kotlin/im/molly/monero/demo/data/WalletRepository.kt new file mode 100644 index 0000000..55a9b77 --- /dev/null +++ b/demo/android/src/main/kotlin/im/molly/monero/demo/data/WalletRepository.kt @@ -0,0 +1,67 @@ +package im.molly.monero.demo.data + +import im.molly.monero.* +import kotlinx.coroutines.* +import kotlinx.coroutines.flow.Flow +import kotlinx.coroutines.flow.emitAll +import kotlinx.coroutines.flow.first +import kotlinx.coroutines.flow.flow +import java.io.IOException +import java.util.concurrent.ConcurrentHashMap + +class WalletRepository( + private val moneroSdkClient: MoneroSdkClient, + private val walletDataSource: WalletDataSource, + private val externalScope: CoroutineScope, +) { + private val walletIdMap = ConcurrentHashMap>() + + suspend fun getWallet(walletId: Long): MoneroWallet { + return walletIdMap.computeIfAbsent(walletId) { + externalScope.async { + val config = getWalletConfig(walletId).first() + val wallet = moneroSdkClient.openWallet( + publicAddress = config.publicAddress, + remoteNodeSelector = object : RemoteNodeSelector { + override fun select(): RemoteNode? { + return config.remoteNodes.firstOrNull()?.let { + RemoteNode( + uri = it.uri, + username = it.username, + password = it.password, + ) + } + } + + override fun connectFailed(remoteNode: RemoteNode, ioe: IOException) { + TODO("Not yet implemented") + } + } + ) + wallet + } + }.await() + } + + fun getWalletIdList() = walletDataSource.getWalletIdList() + + fun getWalletConfig(walletId: Long) = walletDataSource.loadWalletConfig(walletId) + + fun getLedger(walletId: Long): Flow = flow { + emitAll(getWallet(walletId).ledger()) + } + + suspend fun addWallet( + moneroNetwork: MoneroNetwork, + name: String, + remoteNodeIds: List, + ): Pair { + val wallet = moneroSdkClient.createWallet(moneroNetwork) + val walletId = walletDataSource.storeWalletConfig( + publicAddress = wallet.publicAddress, + name = name, + remoteNodeIds = remoteNodeIds, + ) + return walletId to wallet + } +} diff --git a/demo/android/src/main/kotlin/im/molly/monero/demo/data/dao/RemoteNodeDao.kt b/demo/android/src/main/kotlin/im/molly/monero/demo/data/dao/RemoteNodeDao.kt new file mode 100644 index 0000000..6e5bb1e --- /dev/null +++ b/demo/android/src/main/kotlin/im/molly/monero/demo/data/dao/RemoteNodeDao.kt @@ -0,0 +1,45 @@ +package im.molly.monero.demo.data.dao + +import androidx.room.* +import im.molly.monero.demo.data.entity.RemoteNodeEntity +import kotlinx.coroutines.flow.Flow + +@Dao +interface RemoteNodeDao { + @Query( + value = """ + SELECT * FROM remote_nodes + """ + ) + fun findAll(): Flow> + + @Query( + value = """ + SELECT * FROM remote_nodes + WHERE id = :id + """ + ) + fun findById(id: Long): Flow + + @Query( + value = """ + SELECT * FROM remote_nodes + WHERE id IN (:ids) + """ + ) + fun findByIds(ids: List): Flow> + + @Query( + value = """ + SELECT * FROM remote_nodes + WHERE net_type IN (:networkIds) + """ + ) + fun findByNetworkIds(networkIds: Set): Flow> + + @Upsert + suspend fun upsert(vararg remoteNodes: RemoteNodeEntity) + + @Delete + suspend fun delete(vararg remoteNodes: RemoteNodeEntity) +} diff --git a/demo/android/src/main/kotlin/im/molly/monero/demo/data/dao/WalletDao.kt b/demo/android/src/main/kotlin/im/molly/monero/demo/data/dao/WalletDao.kt new file mode 100644 index 0000000..3b8477f --- /dev/null +++ b/demo/android/src/main/kotlin/im/molly/monero/demo/data/dao/WalletDao.kt @@ -0,0 +1,35 @@ +package im.molly.monero.demo.data.dao + +import androidx.room.* +import im.molly.monero.demo.data.entity.PopulatedWallet +import im.molly.monero.demo.data.entity.WalletEntity +import im.molly.monero.demo.data.entity.WalletRemoteNodeXRef +import kotlinx.coroutines.flow.Flow + +@Dao +interface WalletDao { + @Transaction + @Query( + value = """ + SELECT * FROM wallets + WHERE id = :id + """ + ) + fun findById(id: Long): Flow + + @Query( + value = """ + SELECT id FROM wallets + """ + ) + fun findAllIds(): Flow> + + @Insert(onConflict = OnConflictStrategy.ABORT) + suspend fun insert(wallet: WalletEntity): Long + + @Insert(onConflict = OnConflictStrategy.ABORT) + suspend fun insertRemoteNodeXRefEntities(walletRemoteNodeXRefs: List) + + @Delete + suspend fun delete(wallet: WalletEntity) +} diff --git a/demo/android/src/main/kotlin/im/molly/monero/demo/data/entity/PopulatedWallet.kt b/demo/android/src/main/kotlin/im/molly/monero/demo/data/entity/PopulatedWallet.kt new file mode 100644 index 0000000..9f545c8 --- /dev/null +++ b/demo/android/src/main/kotlin/im/molly/monero/demo/data/entity/PopulatedWallet.kt @@ -0,0 +1,25 @@ +package im.molly.monero.demo.data.entity + +import androidx.room.Embedded +import androidx.room.Junction +import androidx.room.Relation + +data class PopulatedWallet( + @Embedded + val wallet: WalletEntity, + + @Relation( + parentColumn = "id", + entityColumn = "id", + associateBy = Junction( + value = WalletRemoteNodeXRef::class, + parentColumn = "wallet_id", + entityColumn = "remote_node_id", + ) + ) + val remoteNodes: Set, +) + +fun PopulatedWallet.asExternalModel() = wallet.asExternalModel().copy( + remoteNodes = remoteNodes.map(RemoteNodeEntity::asExternalModel).toSet() +) diff --git a/demo/android/src/main/kotlin/im/molly/monero/demo/data/entity/RemoteNodeEntity.kt b/demo/android/src/main/kotlin/im/molly/monero/demo/data/entity/RemoteNodeEntity.kt new file mode 100644 index 0000000..641ce24 --- /dev/null +++ b/demo/android/src/main/kotlin/im/molly/monero/demo/data/entity/RemoteNodeEntity.kt @@ -0,0 +1,49 @@ +package im.molly.monero.demo.data.entity + +import android.net.Uri +import androidx.room.ColumnInfo +import androidx.room.Entity +import androidx.room.Index +import androidx.room.PrimaryKey +import im.molly.monero.MoneroNetwork +import im.molly.monero.demo.data.model.RemoteNode + +@Entity( + tableName = "remote_nodes", + indices = [ + Index("net_type") + ] +) +data class RemoteNodeEntity( + @PrimaryKey(autoGenerate = true) + @ColumnInfo(name = "id") + val id: Long = 0, + + @ColumnInfo(name = "net_type") + val networkId: Int, + + @ColumnInfo(name = "uri") + val uri: String, + + @ColumnInfo(name = "user") + val username: String, + + @ColumnInfo(name = "pwd") + val password: String, +) + +fun RemoteNodeEntity.asExternalModel() = RemoteNode( + id = id, + network = MoneroNetwork.fromId(networkId), + uri = Uri.parse(uri), + username = username, + password = password, +) + +fun RemoteNode.asEntity() = RemoteNodeEntity( + id = id ?: 0, + networkId = network.id, + uri = uri.toString(), + username = username, + password = password, +) diff --git a/demo/android/src/main/kotlin/im/molly/monero/demo/data/entity/WalletEntity.kt b/demo/android/src/main/kotlin/im/molly/monero/demo/data/entity/WalletEntity.kt new file mode 100644 index 0000000..c58792f --- /dev/null +++ b/demo/android/src/main/kotlin/im/molly/monero/demo/data/entity/WalletEntity.kt @@ -0,0 +1,32 @@ +package im.molly.monero.demo.data.entity + +import androidx.room.ColumnInfo +import androidx.room.Entity +import androidx.room.Index +import androidx.room.PrimaryKey +import im.molly.monero.demo.data.model.WalletConfig + +@Entity( + tableName = "wallets", + indices = [ + Index(value = ["public_address"], unique = true) + ], +) +data class WalletEntity( + @PrimaryKey(autoGenerate = true) + @ColumnInfo(name = "id") + val id: Long = 0, + + @ColumnInfo(name = "public_address") + val publicAddress: String, + + @ColumnInfo(name = "name") + val name: String = "", +) + +fun WalletEntity.asExternalModel() = WalletConfig( + id = id, + publicAddress = publicAddress, + name = name, + remoteNodes = setOf(), +) diff --git a/demo/android/src/main/kotlin/im/molly/monero/demo/data/entity/WalletRemoteNodeXRef.kt b/demo/android/src/main/kotlin/im/molly/monero/demo/data/entity/WalletRemoteNodeXRef.kt new file mode 100644 index 0000000..832adbb --- /dev/null +++ b/demo/android/src/main/kotlin/im/molly/monero/demo/data/entity/WalletRemoteNodeXRef.kt @@ -0,0 +1,36 @@ +package im.molly.monero.demo.data.entity + +import androidx.room.ColumnInfo +import androidx.room.Entity +import androidx.room.ForeignKey +import androidx.room.Index + +@Entity( + tableName = "wallet_remote_nodes", + primaryKeys = ["wallet_id", "remote_node_id"], + foreignKeys = [ + ForeignKey( + entity = WalletEntity::class, + parentColumns = ["id"], + childColumns = ["wallet_id"], + onDelete = ForeignKey.CASCADE + ), + ForeignKey( + entity = RemoteNodeEntity::class, + parentColumns = ["id"], + childColumns = ["remote_node_id"], + onDelete = ForeignKey.CASCADE + ), + ], + indices = [ + Index(value = ["wallet_id"]), + Index(value = ["remote_node_id"]), + ], +) +data class WalletRemoteNodeXRef( + @ColumnInfo(name = "wallet_id") + val walletId: Long, + + @ColumnInfo(name = "remote_node_id") + val remoteNodeId: Long, +) diff --git a/demo/android/src/main/kotlin/im/molly/monero/demo/data/model/RemoteNode.kt b/demo/android/src/main/kotlin/im/molly/monero/demo/data/model/RemoteNode.kt new file mode 100644 index 0000000..afc850a --- /dev/null +++ b/demo/android/src/main/kotlin/im/molly/monero/demo/data/model/RemoteNode.kt @@ -0,0 +1,18 @@ +package im.molly.monero.demo.data.model + +import android.net.Uri +import im.molly.monero.MoneroNetwork + +data class RemoteNode( + val id: Long? = null, + val network: MoneroNetwork, + val uri: Uri, + val username: String = "", + val password: String = "", +) { + companion object { + val EMPTY = RemoteNode(network = DefaultMoneroNetwork, uri = Uri.EMPTY) + } +} + +val DefaultMoneroNetwork = MoneroNetwork.Mainnet diff --git a/demo/android/src/main/kotlin/im/molly/monero/demo/data/model/Transaction.kt b/demo/android/src/main/kotlin/im/molly/monero/demo/data/model/Transaction.kt new file mode 100644 index 0000000..adc746a --- /dev/null +++ b/demo/android/src/main/kotlin/im/molly/monero/demo/data/model/Transaction.kt @@ -0,0 +1,9 @@ +package im.molly.monero.demo.data.model + +import androidx.room.Entity +import androidx.room.PrimaryKey + +@Entity +data class Transaction( + @PrimaryKey val uid: Int, +) diff --git a/demo/android/src/main/kotlin/im/molly/monero/demo/data/model/WalletConfig.kt b/demo/android/src/main/kotlin/im/molly/monero/demo/data/model/WalletConfig.kt new file mode 100644 index 0000000..2b8d596 --- /dev/null +++ b/demo/android/src/main/kotlin/im/molly/monero/demo/data/model/WalletConfig.kt @@ -0,0 +1,11 @@ +package im.molly.monero.demo.data.model + +import im.molly.monero.MoneroNetwork + +data class WalletConfig( + val id: Long, + val publicAddress: String, + val network: MoneroNetwork = MoneroNetwork.of(publicAddress), + val name: String, + val remoteNodes: Set, +) diff --git a/demo/android/src/main/kotlin/im/molly/monero/demo/service/SyncService.kt b/demo/android/src/main/kotlin/im/molly/monero/demo/service/SyncService.kt new file mode 100644 index 0000000..4b89041 --- /dev/null +++ b/demo/android/src/main/kotlin/im/molly/monero/demo/service/SyncService.kt @@ -0,0 +1,62 @@ +package im.molly.monero.demo.service + +import android.content.Context +import android.content.Intent +import android.os.Binder +import android.os.IBinder +import androidx.lifecycle.LifecycleService +import androidx.lifecycle.lifecycleScope +import im.molly.monero.demo.AppModule +import im.molly.monero.demo.data.WalletRepository +import kotlinx.coroutines.delay +import kotlinx.coroutines.isActive +import kotlinx.coroutines.launch +import kotlin.time.Duration.Companion.seconds + +class SyncService( + private val walletRepository: WalletRepository = AppModule.walletRepository, +) : LifecycleService() { + private val binder: IBinder = LocalBinder() + + inner class LocalBinder : Binder() { + val service: SyncService + get() = this@SyncService + } + + override fun onBind(intent: Intent): IBinder { + super.onBind(intent) + return binder + } + + override fun onCreate() { + super.onCreate() + + lifecycleScope.launch { + val syncedWalletIds = mutableSetOf() + walletRepository.getWalletIdList().collect { + val idSet = it.toSet() + val toSync = idSet subtract syncedWalletIds + toSync.forEach { walletId -> + val wallet = walletRepository.getWallet(walletId) + lifecycleScope.launch { + while (isActive) { + val result = wallet.awaitRefresh(); + if (result.isError()) { + break; + } + delay(10.seconds) + } + } + } + syncedWalletIds.addAll(toSync) + } + } + } + + companion object { + fun start(context: Context) { + val intent = Intent(context, SyncService::class.java) + context.startService(intent) + } + } +} diff --git a/demo/android/src/main/kotlin/im/molly/monero/demo/ui/AddWalletViewModel.kt b/demo/android/src/main/kotlin/im/molly/monero/demo/ui/AddWalletViewModel.kt new file mode 100644 index 0000000..dfd477b --- /dev/null +++ b/demo/android/src/main/kotlin/im/molly/monero/demo/ui/AddWalletViewModel.kt @@ -0,0 +1,58 @@ +package im.molly.monero.demo.ui + +import androidx.compose.runtime.* +import androidx.lifecycle.ViewModel +import androidx.lifecycle.viewModelScope +import im.molly.monero.MoneroNetwork +import im.molly.monero.demo.AppModule +import im.molly.monero.demo.data.RemoteNodeRepository +import im.molly.monero.demo.data.WalletRepository +import im.molly.monero.demo.data.model.DefaultMoneroNetwork +import im.molly.monero.demo.data.model.RemoteNode +import kotlinx.coroutines.ExperimentalCoroutinesApi +import kotlinx.coroutines.flow.* +import kotlinx.coroutines.flow.SharingStarted.Companion.WhileSubscribed +import kotlinx.coroutines.launch + +@OptIn(ExperimentalCoroutinesApi::class) +class AddWalletViewModel( + private val remoteNodeRepository: RemoteNodeRepository = AppModule.remoteNodeRepository, + private val walletRepository: WalletRepository = AppModule.walletRepository, +) : ViewModel() { + + var network by mutableStateOf(DefaultMoneroNetwork) + private set + + var walletName by mutableStateOf("") + private set + + val currentRemoteNodes: StateFlow> = + snapshotFlow { network } + .flatMapLatest { + remoteNodeRepository.getAllRemoteNodes( + filterNetworkIds = setOf(network.id), + ) + } + .stateIn( + scope = viewModelScope, + started = WhileSubscribed(5000), + initialValue = listOf(RemoteNode.EMPTY), + ) + + val selectedRemoteNodes = mutableStateMapOf() + + private fun getSelectedRemoteNodeIds() = + selectedRemoteNodes.filterValues { checked -> checked }.keys.filterNotNull() + + fun toggleSelectedNetwork(network: MoneroNetwork) { + this.network = network + } + + fun updateWalletName(name: String) { + this.walletName = name + } + + fun createWallet() = viewModelScope.launch { + walletRepository.addWallet(network, walletName, getSelectedRemoteNodeIds()) + } +} diff --git a/demo/android/src/main/kotlin/im/molly/monero/demo/ui/AddWalletWizard.kt b/demo/android/src/main/kotlin/im/molly/monero/demo/ui/AddWalletWizard.kt new file mode 100644 index 0000000..f35c0a0 --- /dev/null +++ b/demo/android/src/main/kotlin/im/molly/monero/demo/ui/AddWalletWizard.kt @@ -0,0 +1,230 @@ +package im.molly.monero.demo.ui + +import androidx.compose.foundation.layout.* +import androidx.compose.foundation.rememberScrollState +import androidx.compose.foundation.verticalScroll +import androidx.compose.material3.* +import androidx.compose.runtime.* +import androidx.compose.ui.Alignment +import androidx.compose.ui.Modifier +import androidx.compose.ui.platform.LocalContext +import androidx.compose.ui.res.stringResource +import androidx.compose.ui.tooling.preview.Preview +import androidx.compose.ui.unit.dp +import androidx.lifecycle.compose.collectAsStateWithLifecycle +import androidx.lifecycle.viewmodel.compose.viewModel +import im.molly.monero.MoneroNetwork +import im.molly.monero.demo.R +import im.molly.monero.demo.data.model.DefaultMoneroNetwork +import im.molly.monero.demo.data.model.RemoteNode +import im.molly.monero.demo.ui.component.SelectListBox +import im.molly.monero.demo.ui.component.Toolbar +import im.molly.monero.demo.ui.theme.AppIcons +import im.molly.monero.demo.ui.theme.AppTheme + +@Composable +fun AddWalletFirstStepRoute( + onBackClick: () -> Unit, + onNavigateToCreateWallet: () -> Unit, + onNavigateToRestoreWallet: () -> Unit, + modifier: Modifier = Modifier, +) { + FirstStepScreen( + onBackClick = onBackClick, + onCreateClick = onNavigateToCreateWallet, + onRestoreClick = onNavigateToRestoreWallet, + modifier = modifier, + ) +} + +@OptIn(ExperimentalMaterial3Api::class) +@Composable +private fun FirstStepScreen( + onBackClick: () -> Unit, + onCreateClick: () -> Unit, + onRestoreClick: () -> Unit, + modifier: Modifier = Modifier, +) { + Scaffold( + topBar = { + Toolbar( + titleRes = R.string.add_wallet, + navigationIcon = { + IconButton(onClick = onBackClick) { + Icon( + imageVector = AppIcons.ArrowBack, + contentDescription = stringResource(R.string.back), + ) + } + } + ) + } + ) { padding -> + Column( + modifier = modifier + .fillMaxSize() + .padding(padding), + verticalArrangement = Arrangement.Center, + horizontalAlignment = Alignment.CenterHorizontally, + ) { + Button( + onClick = onCreateClick, + ) { + Text(stringResource(R.string.create_a_new_wallet)) + } + OutlinedButton( + onClick = {}, // TODO: onRestoreClick, + modifier = Modifier.padding(top = 8.dp), + ) { + Text(stringResource(R.string.i_already_have_a_wallet)) + } + } + } +} + +@Composable +fun AddWalletSecondStepRoute( + showRestoreOptions: Boolean, + onBackClick: () -> Unit, + modifier: Modifier = Modifier, + onNavigateToHome: () -> Unit, + viewModel: AddWalletViewModel = viewModel(), +) { + val remoteNodes by viewModel.currentRemoteNodes.collectAsStateWithLifecycle() + + SecondStepScreen( + showRestoreOptions = showRestoreOptions, + modifier = modifier, + onBackClick = onBackClick, + onCreateClick = { + viewModel.createWallet() + onNavigateToHome() + }, + walletName = viewModel.walletName, + network = viewModel.network, + onWalletNameChanged = { name -> viewModel.updateWalletName(name) }, + onNetworkChanged = { network -> viewModel.toggleSelectedNetwork(network) }, + remoteNodes = remoteNodes, + selectedRemoteNodeIds = viewModel.selectedRemoteNodes, + ) +} + +@OptIn(ExperimentalMaterial3Api::class) +@Composable +private fun SecondStepScreen( + showRestoreOptions: Boolean, + modifier: Modifier = Modifier, + onBackClick: () -> Unit, + onCreateClick: () -> Unit, + walletName: String, + network: MoneroNetwork, + onWalletNameChanged: (String) -> Unit, + onNetworkChanged: (MoneroNetwork) -> Unit, + remoteNodes: List, + selectedRemoteNodeIds: MutableMap = mutableMapOf(), +) { + Scaffold( + topBar = { + val title = if (showRestoreOptions) R.string.restore_wallet else R.string.new_wallet + Toolbar( + titleRes = title, + navigationIcon = { + IconButton(onClick = onBackClick) { + Icon( + imageVector = AppIcons.ArrowBack, + contentDescription = stringResource(R.string.back), + ) + } + } + ) + } + ) { padding -> + Column( + modifier = modifier + .padding(padding) + .verticalScroll(rememberScrollState()), + ) { + OutlinedTextField( + value = walletName, + label = { Text(stringResource(R.string.wallet_name)) }, + onValueChange = onWalletNameChanged, + singleLine = true, + modifier = Modifier + .fillMaxWidth() + .padding(start = 16.dp, end = 16.dp), + ) + SelectListBox( + labelRes = R.string.network, + options = MoneroNetwork.values().map { it.name }, + selectedOption = network.name, + onOptionClick = { + onNetworkChanged(MoneroNetwork.valueOf(it)) + }, + modifier = Modifier + .fillMaxWidth() + .padding(16.dp), + ) + Text( + text = stringResource(R.string.remote_node_selection), + style = MaterialTheme.typography.titleMedium, + modifier = Modifier + .padding(16.dp), + ) + MultiSelectRemoteNodeList( + remoteNodes = remoteNodes, + selectedIds = selectedRemoteNodeIds, + modifier = Modifier + .padding(start = 16.dp), + ) + Column( + modifier = Modifier + .fillMaxWidth(), + horizontalAlignment = Alignment.CenterHorizontally, + ) { + Button( + onClick = onCreateClick, + modifier = Modifier + .padding(16.dp), + ) { + Text(stringResource(R.string.finish)) + } + } + } + } +} + +@Preview +@Composable +private fun CreateWalletScreenPreview() { + AppTheme { + SecondStepScreen( + showRestoreOptions = false, + onBackClick = {}, + onCreateClick = {}, + walletName = "Personal", + network = DefaultMoneroNetwork, + onWalletNameChanged = {}, + onNetworkChanged = {}, + remoteNodes = listOf(RemoteNode.EMPTY), + selectedRemoteNodeIds = mutableMapOf(), + ) + } +} + +@Preview +@Composable +private fun RestoreWalletScreenPreview() { + AppTheme { + SecondStepScreen( + showRestoreOptions = true, + onBackClick = {}, + onCreateClick = {}, + walletName = "Personal", + network = DefaultMoneroNetwork, + onWalletNameChanged = {}, + onNetworkChanged = {}, + remoteNodes = listOf(RemoteNode.EMPTY), + selectedRemoteNodeIds = mutableMapOf(), + ) + } +} diff --git a/demo/android/src/main/kotlin/im/molly/monero/demo/ui/DemoApp.kt b/demo/android/src/main/kotlin/im/molly/monero/demo/ui/DemoApp.kt new file mode 100644 index 0000000..7f44155 --- /dev/null +++ b/demo/android/src/main/kotlin/im/molly/monero/demo/ui/DemoApp.kt @@ -0,0 +1,89 @@ +package im.molly.monero.demo.ui + +import androidx.compose.foundation.layout.* +import androidx.compose.material3.* +import androidx.compose.runtime.Composable +import androidx.compose.ui.Modifier +import androidx.compose.ui.res.stringResource +import androidx.navigation.NavDestination +import androidx.navigation.NavDestination.Companion.hierarchy +import im.molly.monero.demo.ui.navigation.* + +@OptIn(ExperimentalMaterial3Api::class, ExperimentalLayoutApi::class) +@Composable +fun DemoApp( + appState: DemoAppState = rememberDemoAppState(), +) { + Background { + Scaffold( + bottomBar = { + BottomBar( + destinations = appState.topLevelDestinations, + onNavigateToDestination = appState::navigateToTopLevelDestination, + currentDestination = appState.currentDestination, + modifier = Modifier, + ) + }, + ) { padding -> + Row( + Modifier + .fillMaxSize() + .padding(padding) + .consumeWindowInsets(padding) + .windowInsetsPadding( + WindowInsets.safeDrawing.only(WindowInsetsSides.Horizontal) + ) + ) { + Column(Modifier.fillMaxSize()) { + NavGraph( + navController = appState.navController, + onBackClick = appState::onBackClick, + ) + } + } + } + } +} + +@Composable +private fun Background( + modifier: Modifier = Modifier, + content: @Composable () -> Unit, +) { + Surface( + modifier = modifier.fillMaxSize(), + ) { + content() + } +} + +@Composable +private fun BottomBar( + destinations: List, + onNavigateToDestination: (TopLevelDestination) -> Unit, + currentDestination: NavDestination?, + modifier: Modifier = Modifier, +) { + NavigationBar( + modifier = modifier, + ) { + destinations.forEach { destination -> + val selected = currentDestination.isTopLevelDestinationInHierarchy(destination) + val icon = if (selected) destination.selectedIcon else destination.unselectedIcon + val text = stringResource(destination.iconTextRes) + NavigationBarItem( + onClick = { onNavigateToDestination(destination) }, + selected = selected, + icon = { Icon(imageVector = icon, contentDescription = text) }, + label = { Text(text) }, + alwaysShowLabel = true, + ) + } + } +} + +private fun NavDestination?.isTopLevelDestinationInHierarchy(destination: TopLevelDestination): Boolean { + return this?.hierarchy?.any { + it.route?.startsWith(destination.name, true) ?: false + } ?: false +} diff --git a/demo/android/src/main/kotlin/im/molly/monero/demo/ui/DemoAppState.kt b/demo/android/src/main/kotlin/im/molly/monero/demo/ui/DemoAppState.kt new file mode 100644 index 0000000..855e5ec --- /dev/null +++ b/demo/android/src/main/kotlin/im/molly/monero/demo/ui/DemoAppState.kt @@ -0,0 +1,52 @@ +package im.molly.monero.demo.ui + +import androidx.compose.runtime.Composable +import androidx.compose.runtime.Stable +import androidx.compose.runtime.remember +import androidx.navigation.NavDestination +import androidx.navigation.NavGraph.Companion.findStartDestination +import androidx.navigation.NavHostController +import androidx.navigation.compose.currentBackStackEntryAsState +import androidx.navigation.compose.rememberNavController +import androidx.navigation.navOptions +import im.molly.monero.demo.ui.navigation.* + +@Composable +fun rememberDemoAppState( + navController: NavHostController = rememberNavController(), +): DemoAppState { + return remember(navController) { + DemoAppState(navController) + } +} + +@Stable +class DemoAppState( + val navController: NavHostController, +) { + val currentDestination: NavDestination? + @Composable get() = navController + .currentBackStackEntryAsState().value?.destination + + val topLevelDestinations = TopLevelDestination.values().asList() + + fun navigateToTopLevelDestination(topLevelDestination: TopLevelDestination) { + val topLevelNavOptions = navOptions { + popUpTo(navController.graph.findStartDestination().id) { + saveState = true + } + launchSingleTop = true + restoreState = true + } + + when (topLevelDestination) { + TopLevelDestination.HOME -> navController.navigateToHome(topLevelNavOptions) + TopLevelDestination.HISTORY -> navController.navigateToHistory(topLevelNavOptions) + TopLevelDestination.SETTINGS -> navController.navigateToSettings(topLevelNavOptions) + } + } + + fun onBackClick() { + navController.popBackStack() + } +} diff --git a/demo/android/src/main/kotlin/im/molly/monero/demo/ui/EditRemoteNodeDialog.kt b/demo/android/src/main/kotlin/im/molly/monero/demo/ui/EditRemoteNodeDialog.kt new file mode 100644 index 0000000..a30f9b1 --- /dev/null +++ b/demo/android/src/main/kotlin/im/molly/monero/demo/ui/EditRemoteNodeDialog.kt @@ -0,0 +1,151 @@ +package im.molly.monero.demo.ui + +import android.net.Uri +import androidx.compose.foundation.layout.Column +import androidx.compose.foundation.layout.padding +import androidx.compose.foundation.rememberScrollState +import androidx.compose.foundation.text.KeyboardOptions +import androidx.compose.foundation.verticalScroll +import androidx.compose.material3.* +import androidx.compose.runtime.* +import androidx.compose.ui.Modifier +import androidx.compose.ui.res.stringResource +import androidx.compose.ui.text.input.KeyboardType +import androidx.compose.ui.text.input.PasswordVisualTransformation +import androidx.compose.ui.tooling.preview.Preview +import androidx.compose.ui.unit.dp +import androidx.lifecycle.viewmodel.compose.viewModel +import im.molly.monero.MoneroNetwork +import im.molly.monero.demo.R +import im.molly.monero.demo.data.model.RemoteNode +import im.molly.monero.demo.ui.component.SelectListBox +import im.molly.monero.demo.ui.theme.AppTheme +import kotlinx.coroutines.flow.first + +@Composable +fun EditRemoteNodeRoute( + remoteNodeId: Long?, + onBackClick: () -> Unit, + viewModel: SettingsViewModel = viewModel(), +) { + var remoteNode by remember { mutableStateOf(RemoteNode.EMPTY) } + + remoteNodeId?.let { + LaunchedEffect(it) { + remoteNode = viewModel.remoteNode(it).first() + } + } + + EditRemoteNodeDialog( + remoteNode = remoteNode, + showError = !viewModel.isRemoteNodeCorrect(remoteNode), + onRemoteNodeChange = { remoteNode = it }, + onSaveRequest = { + viewModel.saveRemoteNodeDetails(remoteNode) + onBackClick() + }, + onDismissRequest = onBackClick, + ) +} + +@OptIn(ExperimentalMaterial3Api::class) +@Composable +private fun EditRemoteNodeDialog( + remoteNode: RemoteNode, + showError: Boolean, + onRemoteNodeChange: (RemoteNode) -> Unit, + onSaveRequest: () -> Unit, + onDismissRequest: () -> Unit, +) { + AlertDialog( + onDismissRequest = onDismissRequest, + text = { + Column( + Modifier.verticalScroll(rememberScrollState()), + ) { + Text( + text = stringResource(R.string.enter_your_monero_node_information_below), + modifier = Modifier.padding(vertical = 16.dp), + ) + SelectListBox( + labelRes = R.string.network, + options = MoneroNetwork.values().map { it.name }, + selectedOption = remoteNode.network.name, + onOptionClick = { + onRemoteNodeChange(remoteNode.copy(network = MoneroNetwork.valueOf(it))) + } + ) + Column { + OutlinedTextField( + value = remoteNode.uri.toString(), + onValueChange = { input -> + onRemoteNodeChange(remoteNode.copy(uri = Uri.parse(input))) + }, + label = { + Text(stringResource(R.string.url)) + }, + singleLine = true, + keyboardOptions = KeyboardOptions(keyboardType = KeyboardType.Uri), + isError = showError, + ) + Text( + text = stringResource(R.string.protocol_is_required_http_or_https), + style = MaterialTheme.typography.bodySmall, + modifier = Modifier.padding(start = 16.dp, bottom = 16.dp), + ) + } + OutlinedTextField( + value = remoteNode.username, + onValueChange = { input -> + onRemoteNodeChange(remoteNode.copy(username = input)) + }, + label = { + Text(stringResource(R.string.username)) + }, + singleLine = true, + ) + OutlinedTextField( + value = remoteNode.password, + onValueChange = { input -> + onRemoteNodeChange(remoteNode.copy(password = input)) + }, + label = { + Text(stringResource(R.string.password)) + }, + singleLine = true, + keyboardOptions = KeyboardOptions(keyboardType = KeyboardType.Password), + visualTransformation = PasswordVisualTransformation(), + ) + } + }, + confirmButton = { + TextButton( + onClick = onSaveRequest, + enabled = !showError, + ) { + Text(stringResource(R.string.save)) + } + }, + dismissButton = { + TextButton( + onClick = onDismissRequest, + ) { + Text(stringResource(android.R.string.cancel)) + } + }, + ) +} + +@Preview +@Composable +private fun EditRemoteNodeDialogPreview() { + AppTheme { + EditRemoteNodeDialog( + remoteNode = RemoteNode.EMPTY, + showError = false, + onRemoteNodeChange = {}, + onSaveRequest = {}, + onDismissRequest = {}, + ) + } +} diff --git a/demo/android/src/main/kotlin/im/molly/monero/demo/ui/HistoryScreen.kt b/demo/android/src/main/kotlin/im/molly/monero/demo/ui/HistoryScreen.kt new file mode 100644 index 0000000..e0f240e --- /dev/null +++ b/demo/android/src/main/kotlin/im/molly/monero/demo/ui/HistoryScreen.kt @@ -0,0 +1,20 @@ +package im.molly.monero.demo.ui + +import androidx.compose.runtime.Composable +import androidx.compose.ui.Modifier + +@Composable +fun HistoryRoute( + modifier: Modifier = Modifier, +) { + HistoryScreen( + modifier = modifier, + ) +} + +@Composable +private fun HistoryScreen( + modifier: Modifier = Modifier, +) { + +} diff --git a/demo/android/src/main/kotlin/im/molly/monero/demo/ui/HomeScreen.kt b/demo/android/src/main/kotlin/im/molly/monero/demo/ui/HomeScreen.kt new file mode 100644 index 0000000..710e46d --- /dev/null +++ b/demo/android/src/main/kotlin/im/molly/monero/demo/ui/HomeScreen.kt @@ -0,0 +1,76 @@ +package im.molly.monero.demo.ui + +import androidx.compose.foundation.layout.fillMaxSize +import androidx.compose.foundation.layout.padding +import androidx.compose.foundation.lazy.LazyColumn +import androidx.compose.foundation.lazy.LazyListScope +import androidx.compose.foundation.lazy.rememberLazyListState +import androidx.compose.material3.* +import androidx.compose.runtime.Composable +import androidx.compose.runtime.getValue +import androidx.compose.ui.Modifier +import androidx.compose.ui.input.nestedscroll.nestedScroll +import androidx.compose.ui.res.stringResource +import androidx.lifecycle.compose.collectAsStateWithLifecycle +import androidx.lifecycle.viewmodel.compose.viewModel +import im.molly.monero.demo.R +import im.molly.monero.demo.ui.component.Toolbar + +@Composable +fun HomeRoute( + navigateToAddWalletWizard: () -> Unit, + viewModel: HomeViewModel = viewModel(), +) { + val walletListUiState: WalletListUiState by viewModel.walletListUiState.collectAsStateWithLifecycle() + + HomeScreen( + walletListUiState = walletListUiState, + onAddWalletClick = navigateToAddWalletWizard, + ) +} + +@OptIn(ExperimentalMaterial3Api::class) +@Composable +private fun HomeScreen( + walletListUiState: WalletListUiState, + onAddWalletClick: () -> Unit, +) { + val scrollBehavior = TopAppBarDefaults.enterAlwaysScrollBehavior() + Scaffold( + modifier = Modifier.nestedScroll(scrollBehavior.nestedScrollConnection), + topBar = { + Toolbar( + titleRes = R.string.monero_wallets, + scrollBehavior = scrollBehavior, + ) + }, + floatingActionButton = { + ExtendedFloatingActionButton(onClick = onAddWalletClick) { + Text(stringResource(R.string.add_wallet)) + } + }, + ) { padding -> + val listState = rememberLazyListState() + LazyColumn( + state = listState, + modifier = Modifier + .fillMaxSize() + .padding(padding)) + { + walletCards(walletListUiState) + } + } +} + +private fun LazyListScope.walletCards( + walletListUiState: WalletListUiState, +) { + when (walletListUiState) { + WalletListUiState.Loading -> item { + Text(text = "Loading wallet list...") // TODO + } + is WalletListUiState.Success -> { + walletCardsItems(walletListUiState.ids) + } + } +} diff --git a/demo/android/src/main/kotlin/im/molly/monero/demo/ui/HomeViewModel.kt b/demo/android/src/main/kotlin/im/molly/monero/demo/ui/HomeViewModel.kt new file mode 100644 index 0000000..219bde4 --- /dev/null +++ b/demo/android/src/main/kotlin/im/molly/monero/demo/ui/HomeViewModel.kt @@ -0,0 +1,36 @@ +package im.molly.monero.demo.ui + +import androidx.lifecycle.ViewModel +import androidx.lifecycle.viewModelScope +import im.molly.monero.demo.AppModule +import im.molly.monero.demo.data.WalletRepository +import kotlinx.coroutines.flow.* + +class HomeViewModel( + private val walletRepository: WalletRepository = AppModule.walletRepository, +) : ViewModel() { + + val walletListUiState: StateFlow = walletRepository.getWalletIdList() + .map { WalletListUiState.Success(it) } + .stateIn( + scope = viewModelScope, + started = SharingStarted.WhileSubscribed(5_000), + initialValue = WalletListUiState.Loading, + ) + +} + +sealed interface HomeUiState { + object Loading : HomeUiState + +// data class Ready( +// val wallets: List +// ) : HomeUiState + + object Empty : HomeUiState +} + +sealed interface WalletListUiState { + data class Success(val ids: List) : WalletListUiState + object Loading : WalletListUiState +} diff --git a/demo/android/src/main/kotlin/im/molly/monero/demo/ui/RemoteNodeList.kt b/demo/android/src/main/kotlin/im/molly/monero/demo/ui/RemoteNodeList.kt new file mode 100644 index 0000000..798117e --- /dev/null +++ b/demo/android/src/main/kotlin/im/molly/monero/demo/ui/RemoteNodeList.kt @@ -0,0 +1,133 @@ +package im.molly.monero.demo.ui + +import android.net.Uri +import androidx.compose.foundation.layout.Column +import androidx.compose.foundation.layout.Row +import androidx.compose.material3.* +import androidx.compose.runtime.* +import androidx.compose.ui.Modifier +import androidx.compose.ui.res.stringResource +import androidx.compose.ui.tooling.preview.Preview +import im.molly.monero.demo.R +import im.molly.monero.demo.data.model.RemoteNode +import im.molly.monero.demo.ui.theme.AppIcons + +@Composable +fun MultiSelectRemoteNodeList( + remoteNodes: List, + selectedIds: MutableMap, + modifier: Modifier = Modifier, +) { + Column( + modifier = modifier, + ) { + remoteNodes.forEach { remoteNode -> + RemoteNodeItem( + remoteNode, + checked = selectedIds[remoteNode.id] ?: false, + showCheckbox = true, + onCheckedChange = { checked -> + selectedIds[remoteNode.id] = checked + }, + ) + } + } +} + +@Composable +fun RemoteNodeEditableList( + remoteNodes: List, + onEditRemoteNode: (RemoteNode) -> Unit, + onDeleteRemoteNode: (RemoteNode) -> Unit, + modifier: Modifier = Modifier, +) { + Column( + modifier = modifier, + ) { + remoteNodes.forEach { remoteNode -> + RemoteNodeItem( + remoteNode, + showMenu = true, + onEditClick = onEditRemoteNode, + onDeleteClick = onDeleteRemoteNode, + ) + } + } +} + +@OptIn(ExperimentalMaterial3Api::class) +@Composable +private fun RemoteNodeItem( + remoteNode: RemoteNode, + checked: Boolean = false, + showCheckbox: Boolean = false, + showMenu: Boolean = false, + onCheckedChange: (Boolean) -> Unit = {}, + onEditClick: (RemoteNode) -> Unit = {}, + onDeleteClick: (RemoteNode) -> Unit = {}, +) { + ListItem( + headlineText = { Text(remoteNode.uri.toString()) }, + overlineText = { Text(remoteNode.network.name.uppercase()) }, + trailingContent = { + Row { + if (showCheckbox) { + Checkbox( + checked = checked, + onCheckedChange = onCheckedChange, + ) + } + if (showMenu) { + KebabMenu( + onEditClick = { onEditClick(remoteNode) }, + onDeleteClick = { onDeleteClick(remoteNode) }, + ) + } + } + }, + ) +} + +@Composable +private fun KebabMenu( + onEditClick: () -> Unit, + onDeleteClick: () -> Unit, +) { + var expanded by remember { mutableStateOf(false) } + + IconButton(onClick = { expanded = true }) { + Icon( + imageVector = AppIcons.MoreVert, + contentDescription = stringResource(R.string.open_menu), + ) + } + DropdownMenu( + expanded = expanded, + onDismissRequest = { expanded = false }, + ) { + DropdownMenuItem( + text = { Text(stringResource(R.string.edit)) }, + onClick = { + onEditClick() + expanded = false + }, + ) + DropdownMenuItem( + text = { Text(stringResource(R.string.delete)) }, + onClick = { + onDeleteClick() + expanded = false + }, + ) + } +} + +@Preview +@Composable +private fun MultiSelectRemoteNodeListPreview() { + val aNode = RemoteNode.EMPTY.copy(uri = Uri.parse("http://node.monero")) + MultiSelectRemoteNodeList( + remoteNodes = listOf(aNode), + selectedIds = mutableMapOf(), + ) +} diff --git a/demo/android/src/main/kotlin/im/molly/monero/demo/ui/SettingsScreen.kt b/demo/android/src/main/kotlin/im/molly/monero/demo/ui/SettingsScreen.kt new file mode 100644 index 0000000..cb65784 --- /dev/null +++ b/demo/android/src/main/kotlin/im/molly/monero/demo/ui/SettingsScreen.kt @@ -0,0 +1,82 @@ +package im.molly.monero.demo.ui + +import androidx.annotation.StringRes +import androidx.compose.foundation.layout.Column +import androidx.compose.foundation.layout.padding +import androidx.compose.foundation.rememberScrollState +import androidx.compose.foundation.verticalScroll +import androidx.compose.material3.* +import androidx.compose.runtime.Composable +import androidx.compose.runtime.getValue +import androidx.compose.ui.Modifier +import androidx.compose.ui.res.stringResource +import androidx.compose.ui.tooling.preview.Preview +import androidx.compose.ui.unit.dp +import androidx.lifecycle.compose.collectAsStateWithLifecycle +import androidx.lifecycle.viewmodel.compose.viewModel +import im.molly.monero.demo.R +import im.molly.monero.demo.data.model.RemoteNode +import im.molly.monero.demo.ui.theme.AppTheme + +@Composable +fun SettingsRoute( + modifier: Modifier = Modifier, + viewModel: SettingsViewModel = viewModel(), + navigateToEditRemoteNode: (Long?) -> Unit, +) { + val remoteNodes by viewModel.remoteNodes.collectAsStateWithLifecycle() + + SettingsScreen( + remoteNodes = remoteNodes, + modifier = modifier, + onAddRemoteNode = { navigateToEditRemoteNode(RemoteNode.EMPTY.id) }, + onEditRemoteNode = { navigateToEditRemoteNode(it.id) }, + onDeleteRemoteNode = { viewModel.forgetRemoteNodeDetails(it) }, + ) +} + +@Composable +private fun SettingsScreen( + remoteNodes: List, + modifier: Modifier = Modifier, + onAddRemoteNode: () -> Unit = {}, + onEditRemoteNode: (RemoteNode) -> Unit = {}, + onDeleteRemoteNode: (RemoteNode) -> Unit = {}, +) { + Column( + modifier = modifier + .verticalScroll(rememberScrollState()) + .padding(all = 24.dp) + ) { + Divider() + SettingsSectionTitle(R.string.remote_nodes) + TextButton(onClick = onAddRemoteNode) { + Text(stringResource(R.string.add_remote_node)) + } + RemoteNodeEditableList( + remoteNodes = remoteNodes, + onEditRemoteNode = onEditRemoteNode, + onDeleteRemoteNode = onDeleteRemoteNode, + ) +// Divider() + } +} + +@Composable +private fun SettingsSectionTitle(@StringRes titleRes: Int) { + Text( + text = stringResource(titleRes), + style = MaterialTheme.typography.titleMedium, + modifier = Modifier.padding(top = 16.dp, bottom = 8.dp) + ) +} + +@Preview +@Composable +private fun SettingsScreenPreview() { + AppTheme { + SettingsScreen( + remoteNodes = emptyList(), + ) + } +} diff --git a/demo/android/src/main/kotlin/im/molly/monero/demo/ui/SettingsViewModel.kt b/demo/android/src/main/kotlin/im/molly/monero/demo/ui/SettingsViewModel.kt new file mode 100644 index 0000000..1bd7836 --- /dev/null +++ b/demo/android/src/main/kotlin/im/molly/monero/demo/ui/SettingsViewModel.kt @@ -0,0 +1,41 @@ +package im.molly.monero.demo.ui + +import androidx.lifecycle.ViewModel +import androidx.lifecycle.viewModelScope +import im.molly.monero.demo.AppModule +import im.molly.monero.demo.data.RemoteNodeRepository +import im.molly.monero.demo.data.model.RemoteNode +import kotlinx.coroutines.flow.* +import kotlinx.coroutines.launch + +class SettingsViewModel( + private val remoteNodeRepository: RemoteNodeRepository = AppModule.remoteNodeRepository, +) : ViewModel() { + + val remoteNodes: StateFlow> = + remoteNodeRepository.getAllRemoteNodes() + .stateIn( + scope = viewModelScope, + started = SharingStarted.WhileSubscribed(5000), + initialValue = listOf(RemoteNode.EMPTY), + ) + + fun remoteNode(remoteNodeId: Long): Flow = + remoteNodeRepository.getRemoteNode(remoteNodeId) + + fun isRemoteNodeCorrect(remoteNode: RemoteNode): Boolean { + return remoteNode.uri.host?.isEmpty() == false + } + + fun saveRemoteNodeDetails(remoteNode: RemoteNode) { + viewModelScope.launch { + remoteNodeRepository.addOrUpdateRemoteNode(remoteNode) + } + } + + fun forgetRemoteNodeDetails(remoteNode: RemoteNode) { + viewModelScope.launch { + remoteNodeRepository.deleteRemoteNode(remoteNode) + } + } +} diff --git a/demo/android/src/main/kotlin/im/molly/monero/demo/ui/WalletCard.kt b/demo/android/src/main/kotlin/im/molly/monero/demo/ui/WalletCard.kt new file mode 100644 index 0000000..e36b6f6 --- /dev/null +++ b/demo/android/src/main/kotlin/im/molly/monero/demo/ui/WalletCard.kt @@ -0,0 +1,50 @@ +package im.molly.monero.demo.ui + +import androidx.compose.foundation.layout.Column +import androidx.compose.foundation.layout.Row +import androidx.compose.foundation.layout.padding +import androidx.compose.material3.Card +import androidx.compose.material3.Text +import androidx.compose.runtime.Composable +import androidx.compose.runtime.getValue +import androidx.compose.ui.Modifier +import androidx.compose.ui.unit.dp +import androidx.lifecycle.compose.collectAsStateWithLifecycle +import androidx.lifecycle.viewmodel.compose.viewModel + +@Composable +fun WalletCard( + walletId: Long, + modifier: Modifier = Modifier, + viewModel: WalletViewModel = viewModel( + factory = WalletViewModel.factory(walletId), + key = walletId.toString(), + ), +) { + val walletUiState: WalletUiState by viewModel.walletUiState.collectAsStateWithLifecycle() + + Card( + modifier = modifier + .padding(8.dp) + ) { + Column { + when (walletUiState) { + WalletUiState.Error -> { + Text(text = "Error") // TODO + } + WalletUiState.Loading -> { + Text(text = "Loading wallet...") // TODO + } + is WalletUiState.Success -> { + val state = walletUiState as WalletUiState.Success + Row { + Text(text = "Name: ${state.config.name}") + } + Row { + Text(text = "Ledger: ${state.ledger}") + } + } + } + } + } +} diff --git a/demo/android/src/main/kotlin/im/molly/monero/demo/ui/WalletCardList.kt b/demo/android/src/main/kotlin/im/molly/monero/demo/ui/WalletCardList.kt new file mode 100644 index 0000000..e22a789 --- /dev/null +++ b/demo/android/src/main/kotlin/im/molly/monero/demo/ui/WalletCardList.kt @@ -0,0 +1,19 @@ +package im.molly.monero.demo.ui + +import androidx.compose.foundation.lazy.LazyListScope +import androidx.compose.foundation.lazy.items +import androidx.compose.ui.Modifier + +fun LazyListScope.walletCardsItems( + items: List, + itemModifier: Modifier = Modifier, +) = items( + items = items, + key = { it }, + itemContent = { + WalletCard( + walletId = it, + modifier = itemModifier, + ) + }, +) diff --git a/demo/android/src/main/kotlin/im/molly/monero/demo/ui/WalletScreen.kt b/demo/android/src/main/kotlin/im/molly/monero/demo/ui/WalletScreen.kt new file mode 100644 index 0000000..e69de29 diff --git a/demo/android/src/main/kotlin/im/molly/monero/demo/ui/WalletViewModel.kt b/demo/android/src/main/kotlin/im/molly/monero/demo/ui/WalletViewModel.kt new file mode 100644 index 0000000..a3b985c --- /dev/null +++ b/demo/android/src/main/kotlin/im/molly/monero/demo/ui/WalletViewModel.kt @@ -0,0 +1,69 @@ +package im.molly.monero.demo.ui + +import androidx.lifecycle.ViewModel +import androidx.lifecycle.viewModelScope +import androidx.lifecycle.viewmodel.initializer +import androidx.lifecycle.viewmodel.viewModelFactory +import im.molly.monero.Ledger +import im.molly.monero.demo.AppModule +import im.molly.monero.demo.common.Result +import im.molly.monero.demo.common.asResult +import im.molly.monero.demo.data.WalletRepository +import im.molly.monero.demo.data.model.WalletConfig +import kotlinx.coroutines.flow.* + +class WalletViewModel( + private val walletId: Long, + private val walletRepository: WalletRepository = AppModule.walletRepository, +) : ViewModel() { + + val walletUiState: StateFlow = walletUiState( + walletId = walletId, + walletRepository = walletRepository, + ).stateIn( + scope = viewModelScope, + started = SharingStarted.WhileSubscribed(5_000), + initialValue = WalletUiState.Loading + ) + + companion object { + fun factory(walletId: Long) = viewModelFactory { + initializer { + WalletViewModel(walletId) + } + } + } +} + +private fun walletUiState( + walletId: Long, + walletRepository: WalletRepository, +): Flow { + return combine( + walletRepository.getWalletConfig(walletId), + walletRepository.getLedger(walletId), + ::Pair, + ).asResult().map { result -> + when (result) { + is Result.Success -> { + WalletUiState.Success(result.data.first, result.data.second) + } + is Result.Loading -> { + WalletUiState.Loading + } + is Result.Error -> { + WalletUiState.Error + } + } + } +} + +sealed interface WalletUiState { + data class Success( + val config: WalletConfig, + val ledger: Ledger, + ) : WalletUiState + + object Error : WalletUiState + object Loading : WalletUiState +} diff --git a/demo/android/src/main/kotlin/im/molly/monero/demo/ui/component/RadioButtons.kt b/demo/android/src/main/kotlin/im/molly/monero/demo/ui/component/RadioButtons.kt new file mode 100644 index 0000000..9773912 --- /dev/null +++ b/demo/android/src/main/kotlin/im/molly/monero/demo/ui/component/RadioButtons.kt @@ -0,0 +1,48 @@ +package im.molly.monero.demo.ui.component + +import androidx.compose.foundation.layout.* +import androidx.compose.foundation.selection.selectable +import androidx.compose.foundation.selection.selectableGroup +import androidx.compose.material3.MaterialTheme +import androidx.compose.material3.RadioButton +import androidx.compose.material3.Text +import androidx.compose.runtime.Composable +import androidx.compose.ui.Alignment +import androidx.compose.ui.Modifier +import androidx.compose.ui.semantics.Role +import androidx.compose.ui.unit.dp + +@Composable +fun RadioButtons( + radioOptions: List, + selectedOption: String, + onOptionSelected: (String) -> Unit, + modifier: Modifier = Modifier, +) { + Column(modifier.selectableGroup()) { + radioOptions.forEach { text -> + Row( + Modifier + .fillMaxWidth() + .height(56.dp) + .selectable( + selected = (text == selectedOption), + onClick = { onOptionSelected(text) }, + role = Role.RadioButton, + ) + .padding(horizontal = 16.dp), + verticalAlignment = Alignment.CenterVertically, + ) { + RadioButton( + selected = (text == selectedOption), + onClick = null, + ) + Text( + text = text, + style = MaterialTheme.typography.bodyLarge, + modifier = Modifier.padding(start = 16.dp), + ) + } + } + } +} diff --git a/demo/android/src/main/kotlin/im/molly/monero/demo/ui/component/SelectListBox.kt b/demo/android/src/main/kotlin/im/molly/monero/demo/ui/component/SelectListBox.kt new file mode 100644 index 0000000..7a22935 --- /dev/null +++ b/demo/android/src/main/kotlin/im/molly/monero/demo/ui/component/SelectListBox.kt @@ -0,0 +1,63 @@ +package im.molly.monero.demo.ui.component + +import androidx.annotation.StringRes +import androidx.compose.foundation.layout.fillMaxWidth +import androidx.compose.material3.* +import androidx.compose.runtime.* +import androidx.compose.ui.Modifier +import androidx.compose.ui.res.stringResource + +@OptIn(ExperimentalMaterial3Api::class) +@Composable +fun SelectListBox( + @StringRes labelRes: Int, + options: List, + selectedOption: String, + onOptionClick: (String) -> Unit, + modifier: Modifier = Modifier, +) { + var expanded by remember { mutableStateOf(false) } + + ExposedDropdownMenuBox( + expanded = expanded, + onExpandedChange = { + expanded = !expanded + }, + modifier = modifier, + ) { + OutlinedTextField( + readOnly = true, + value = selectedOption, + onValueChange = { }, + modifier = Modifier + .fillMaxWidth() + .menuAnchor(), + label = { Text(stringResource(labelRes)) }, + trailingIcon = { + ExposedDropdownMenuDefaults.TrailingIcon( + expanded = expanded + ) + }, + colors = ExposedDropdownMenuDefaults.outlinedTextFieldColors(), + ) + DropdownMenu( + expanded = expanded, + onDismissRequest = { + expanded = false + }, + modifier = Modifier.exposedDropdownSize(), + ) { + options.forEach { selectionOption -> + DropdownMenuItem( + text = { + Text(selectionOption) + }, + onClick = { + onOptionClick(selectionOption) + expanded = false + }, + ) + } + } + } +} diff --git a/demo/android/src/main/kotlin/im/molly/monero/demo/ui/component/Toolbar.kt b/demo/android/src/main/kotlin/im/molly/monero/demo/ui/component/Toolbar.kt new file mode 100644 index 0000000..2ec41bb --- /dev/null +++ b/demo/android/src/main/kotlin/im/molly/monero/demo/ui/component/Toolbar.kt @@ -0,0 +1,29 @@ +package im.molly.monero.demo.ui.component + +import androidx.annotation.StringRes +import androidx.compose.foundation.layout.RowScope +import androidx.compose.material3.CenterAlignedTopAppBar +import androidx.compose.material3.ExperimentalMaterial3Api +import androidx.compose.material3.Text +import androidx.compose.material3.TopAppBarScrollBehavior +import androidx.compose.runtime.Composable +import androidx.compose.ui.Modifier +import androidx.compose.ui.res.stringResource + +@OptIn(ExperimentalMaterial3Api::class) +@Composable +fun Toolbar( + @StringRes titleRes: Int, + modifier: Modifier = Modifier, + navigationIcon: @Composable () -> Unit = {}, + actions: @Composable RowScope.() -> Unit = {}, + scrollBehavior: TopAppBarScrollBehavior? = null, +) { + CenterAlignedTopAppBar( + title = { Text(stringResource(id = titleRes), ) }, + modifier = modifier, + navigationIcon = navigationIcon, + actions = actions, + scrollBehavior = scrollBehavior, + ) +} diff --git a/demo/android/src/main/kotlin/im/molly/monero/demo/ui/navigation/HistoryNavigation.kt b/demo/android/src/main/kotlin/im/molly/monero/demo/ui/navigation/HistoryNavigation.kt new file mode 100644 index 0000000..1138225 --- /dev/null +++ b/demo/android/src/main/kotlin/im/molly/monero/demo/ui/navigation/HistoryNavigation.kt @@ -0,0 +1,19 @@ +package im.molly.monero.demo.ui.navigation + +import androidx.navigation.NavController +import androidx.navigation.NavGraphBuilder +import androidx.navigation.NavOptions +import androidx.navigation.compose.composable +import im.molly.monero.demo.ui.HistoryRoute + +const val historyNavRoute = "history" + +fun NavController.navigateToHistory(navOptions: NavOptions? = null) { + navigate(historyNavRoute, navOptions) +} + +fun NavGraphBuilder.historyScreen() { + composable(route = historyNavRoute) { + HistoryRoute() + } +} diff --git a/demo/android/src/main/kotlin/im/molly/monero/demo/ui/navigation/HomeNavigation.kt b/demo/android/src/main/kotlin/im/molly/monero/demo/ui/navigation/HomeNavigation.kt new file mode 100644 index 0000000..3f4d8e2 --- /dev/null +++ b/demo/android/src/main/kotlin/im/molly/monero/demo/ui/navigation/HomeNavigation.kt @@ -0,0 +1,23 @@ +package im.molly.monero.demo.ui.navigation + +import androidx.navigation.NavController +import androidx.navigation.NavGraphBuilder +import androidx.navigation.NavOptions +import androidx.navigation.compose.composable +import im.molly.monero.demo.ui.HomeRoute + +const val homeNavRoute = "home" + +fun NavController.navigateToHome(navOptions: NavOptions? = null) { + navigate(homeNavRoute, navOptions) +} + +fun NavGraphBuilder.homeScreen( + navigateToAddWalletWizard: () -> Unit, +) { + composable(route = homeNavRoute) { + HomeRoute( + navigateToAddWalletWizard = navigateToAddWalletWizard, + ) + } +} diff --git a/demo/android/src/main/kotlin/im/molly/monero/demo/ui/navigation/NavGraph.kt b/demo/android/src/main/kotlin/im/molly/monero/demo/ui/navigation/NavGraph.kt new file mode 100644 index 0000000..3fc176b --- /dev/null +++ b/demo/android/src/main/kotlin/im/molly/monero/demo/ui/navigation/NavGraph.kt @@ -0,0 +1,39 @@ +package im.molly.monero.demo.ui.navigation + +import androidx.compose.runtime.Composable +import androidx.compose.ui.Modifier +import androidx.navigation.NavHostController +import androidx.navigation.compose.NavHost + +@Composable +fun NavGraph( + navController: NavHostController, + onBackClick: () -> Unit, + modifier: Modifier = Modifier, + startDestination: String = homeNavRoute, +) { + NavHost( + navController, + startDestination, + modifier, + ) { + homeScreen( + navigateToAddWalletWizard = { + navController.navigateToAddWalletWizardGraph() + }, + ) + historyScreen() + settingsScreen( + navigateToEditRemoteNode = { remoteNodeId -> + navController.navigateToEditRemoteNode(remoteNodeId) + }, + ) + editRemoteNodeDialog( + onBackClick = onBackClick, + ) + addWalletWizardGraph( + navController = navController, + onBackClick = onBackClick, + ) + } +} diff --git a/demo/android/src/main/kotlin/im/molly/monero/demo/ui/navigation/SettingsNavigation.kt b/demo/android/src/main/kotlin/im/molly/monero/demo/ui/navigation/SettingsNavigation.kt new file mode 100644 index 0000000..51bea16 --- /dev/null +++ b/demo/android/src/main/kotlin/im/molly/monero/demo/ui/navigation/SettingsNavigation.kt @@ -0,0 +1,56 @@ +package im.molly.monero.demo.ui.navigation + +import androidx.navigation.* +import androidx.navigation.compose.composable +import androidx.navigation.compose.dialog +import im.molly.monero.demo.ui.EditRemoteNodeRoute +import im.molly.monero.demo.ui.SettingsRoute + +const val settingsNavRoute = "settings" +const val settingsRemoteNodeNavRoute = "$settingsNavRoute/remote_node" + +private const val idArg = "id" + +fun NavController.navigateToSettings(navOptions: NavOptions? = null) { + navigate(settingsNavRoute, navOptions) +} + +fun NavController.navigateToEditRemoteNode(remoteNodeId: Long?) { + val route = if (remoteNodeId != null) { + "$settingsRemoteNodeNavRoute?$idArg=$remoteNodeId" + } else { + settingsRemoteNodeNavRoute + } + this.navigate(route) +} + +fun NavGraphBuilder.settingsScreen( + navigateToEditRemoteNode: (Long?) -> Unit, +) { + composable(route = settingsNavRoute) { + SettingsRoute( + navigateToEditRemoteNode = navigateToEditRemoteNode, + ) + } +} + +fun NavGraphBuilder.editRemoteNodeDialog( + onBackClick: () -> Unit, +) { + dialog( + route = "$settingsRemoteNodeNavRoute?$idArg={$idArg}", + arguments = listOf( + navArgument(idArg) { + type = NavType.StringType + nullable = true + } + ) + ) { + val arguments = requireNotNull(it.arguments) + val remoteNodeId = arguments.getString(idArg)?.toLongOrNull() + EditRemoteNodeRoute( + remoteNodeId = remoteNodeId, + onBackClick = onBackClick, + ) + } +} diff --git a/demo/android/src/main/kotlin/im/molly/monero/demo/ui/navigation/TopLevelDestination.kt b/demo/android/src/main/kotlin/im/molly/monero/demo/ui/navigation/TopLevelDestination.kt new file mode 100644 index 0000000..3c3bf67 --- /dev/null +++ b/demo/android/src/main/kotlin/im/molly/monero/demo/ui/navigation/TopLevelDestination.kt @@ -0,0 +1,28 @@ +package im.molly.monero.demo.ui.navigation + +import androidx.annotation.StringRes +import androidx.compose.ui.graphics.vector.ImageVector +import im.molly.monero.demo.R +import im.molly.monero.demo.ui.theme.AppIcons + +enum class TopLevelDestination( + val selectedIcon: ImageVector, + val unselectedIcon: ImageVector, + @StringRes val iconTextRes: Int, +) { + HOME( + selectedIcon = AppIcons.Home, + unselectedIcon = AppIcons.HomeOutlined, + iconTextRes = R.string.home, + ), + HISTORY( + selectedIcon = AppIcons.History, + unselectedIcon = AppIcons.HistoryOutlined, + iconTextRes = R.string.history, + ), + SETTINGS( + selectedIcon = AppIcons.History, + unselectedIcon = AppIcons.HistoryOutlined, + iconTextRes = R.string.settings, + ) +} diff --git a/demo/android/src/main/kotlin/im/molly/monero/demo/ui/navigation/WalletNavigation.kt b/demo/android/src/main/kotlin/im/molly/monero/demo/ui/navigation/WalletNavigation.kt new file mode 100644 index 0000000..d1dea43 --- /dev/null +++ b/demo/android/src/main/kotlin/im/molly/monero/demo/ui/navigation/WalletNavigation.kt @@ -0,0 +1,59 @@ +package im.molly.monero.demo.ui.navigation + +import androidx.navigation.* +import androidx.navigation.compose.composable +import im.molly.monero.demo.ui.AddWalletFirstStepRoute +import im.molly.monero.demo.ui.AddWalletSecondStepRoute + +const val addWalletWizardNavRoute = "home/add_wallet_wizard" + +private const val startNavRoute = "$addWalletWizardNavRoute/start" +private const val createNavRoute = "$addWalletWizardNavRoute/create" +private const val restoreNavRoute = "$addWalletWizardNavRoute/restore" + +fun NavController.navigateToAddWalletWizardGraph(navOptions: NavOptions? = null) { + navigate(addWalletWizardNavRoute, navOptions) +} + +fun NavController.navigateToAddWalletSecondStep(restoreWallet: Boolean) { + when (restoreWallet) { + true -> navigate(restoreNavRoute) + false -> navigate(createNavRoute) + } +} + +fun NavGraphBuilder.addWalletWizardGraph( + navController: NavHostController, + onBackClick: () -> Unit, +) { + navigation( + route = addWalletWizardNavRoute, + startDestination = startNavRoute, + ) { + composable(route = startNavRoute) { + AddWalletFirstStepRoute( + onBackClick = onBackClick, + onNavigateToCreateWallet = { + navController.navigateToAddWalletSecondStep(restoreWallet = false) + }, + onNavigateToRestoreWallet = { + navController.navigateToAddWalletSecondStep(restoreWallet = true) + }, + ) + } + composable(route = createNavRoute) { + AddWalletSecondStepRoute( + showRestoreOptions = false, + onBackClick = onBackClick, + onNavigateToHome = { navController.navigateToHome() }, + ) + } + composable(route = restoreNavRoute) { + AddWalletSecondStepRoute( + showRestoreOptions = true, + onBackClick = onBackClick, + onNavigateToHome = { navController.navigateToHome() }, + ) + } + } +} diff --git a/demo/android/src/main/kotlin/im/molly/monero/demo/ui/theme/Color.kt b/demo/android/src/main/kotlin/im/molly/monero/demo/ui/theme/Color.kt new file mode 100644 index 0000000..2a7ab9e --- /dev/null +++ b/demo/android/src/main/kotlin/im/molly/monero/demo/ui/theme/Color.kt @@ -0,0 +1,11 @@ +package im.molly.monero.demo.ui.theme + +import androidx.compose.ui.graphics.Color + +val Purple80 = Color(0xFFD0BCFF) +val PurpleGrey80 = Color(0xFFCCC2DC) +val Pink80 = Color(0xFFEFB8C8) + +val Purple40 = Color(0xFF6650a4) +val PurpleGrey40 = Color(0xFF625b71) +val Pink40 = Color(0xFF7D5260) \ No newline at end of file diff --git a/demo/android/src/main/kotlin/im/molly/monero/demo/ui/theme/Icon.kt b/demo/android/src/main/kotlin/im/molly/monero/demo/ui/theme/Icon.kt new file mode 100644 index 0000000..55ccdd2 --- /dev/null +++ b/demo/android/src/main/kotlin/im/molly/monero/demo/ui/theme/Icon.kt @@ -0,0 +1,19 @@ +package im.molly.monero.demo.ui.theme + +import androidx.compose.material.icons.Icons +import androidx.compose.material.icons.filled.* +import androidx.compose.material.icons.outlined.Home +import androidx.compose.material.icons.outlined.List +import androidx.compose.material.icons.outlined.Settings + +object AppIcons { + val ArrowBack = Icons.Filled.ArrowBack + val MoreVert = Icons.Filled.MoreVert + val Home = Icons.Filled.Home + val HomeOutlined = Icons.Outlined.Home + val History = Icons.Filled.List + val HistoryOutlined = Icons.Outlined.List + val Settings = Icons.Filled.Settings + val SettingsOutlined = Icons.Outlined.Settings + val AddWallet = Icons.Filled.Add +} diff --git a/demo/android/src/main/kotlin/im/molly/monero/demo/ui/theme/Theme.kt b/demo/android/src/main/kotlin/im/molly/monero/demo/ui/theme/Theme.kt new file mode 100644 index 0000000..2afc0d7 --- /dev/null +++ b/demo/android/src/main/kotlin/im/molly/monero/demo/ui/theme/Theme.kt @@ -0,0 +1,61 @@ +package im.molly.monero.demo.ui.theme + +import android.os.Build +import androidx.compose.foundation.isSystemInDarkTheme +import androidx.compose.material3.MaterialTheme +import androidx.compose.material3.darkColorScheme +import androidx.compose.material3.dynamicDarkColorScheme +import androidx.compose.material3.dynamicLightColorScheme +import androidx.compose.material3.lightColorScheme +import androidx.compose.runtime.Composable +import androidx.compose.ui.platform.LocalContext + +private val DarkColorScheme = darkColorScheme( + primary = Purple80, + secondary = PurpleGrey80, + tertiary = Pink80 +) + +private val LightColorScheme = lightColorScheme( + primary = Purple40, + secondary = PurpleGrey40, + tertiary = Pink40, + + /* Other default colors to override + surface = Color(0xFFFFFBFE), + onPrimary = Color.White, + onSecondary = Color.White, + onTertiary = Color.White, + onBackground = Color(0xFF1C1B1F), + onSurface = Color(0xFF1C1B1F), + */ +) + +@Composable +fun AppTheme( + darkTheme: Boolean = isSystemInDarkTheme(), + // Dynamic color is available on Android 12+ + dynamicColor: Boolean = true, + content: @Composable () -> Unit +) { + val colorScheme = pickColorScheme(dynamicColor, darkTheme) + + MaterialTheme( + colorScheme = colorScheme, + typography = Typography, + content = content + ) +} + +@Composable +private fun pickColorScheme( + dynamicColor: Boolean, + darkTheme: Boolean +) = when { + dynamicColor && Build.VERSION.SDK_INT >= 31 -> { + val context = LocalContext.current + if (darkTheme) dynamicDarkColorScheme(context) else dynamicLightColorScheme(context) + } + darkTheme -> DarkColorScheme + else -> LightColorScheme +} diff --git a/demo/android/src/main/kotlin/im/molly/monero/demo/ui/theme/Type.kt b/demo/android/src/main/kotlin/im/molly/monero/demo/ui/theme/Type.kt new file mode 100644 index 0000000..7455a68 --- /dev/null +++ b/demo/android/src/main/kotlin/im/molly/monero/demo/ui/theme/Type.kt @@ -0,0 +1,34 @@ +package im.molly.monero.demo.ui.theme + +import androidx.compose.material3.Typography +import androidx.compose.ui.text.TextStyle +import androidx.compose.ui.text.font.FontFamily +import androidx.compose.ui.text.font.FontWeight +import androidx.compose.ui.unit.sp + +// Set of Material typography styles to start with +val Typography = Typography( + bodyLarge = TextStyle( + fontFamily = FontFamily.Default, + fontWeight = FontWeight.Normal, + fontSize = 16.sp, + lineHeight = 24.sp, + letterSpacing = 0.5.sp + ) + /* Other default text styles to override + titleLarge = TextStyle( + fontFamily = FontFamily.Default, + fontWeight = FontWeight.Normal, + fontSize = 22.sp, + lineHeight = 28.sp, + letterSpacing = 0.sp + ), + labelSmall = TextStyle( + fontFamily = FontFamily.Default, + fontWeight = FontWeight.Medium, + fontSize = 11.sp, + lineHeight = 16.sp, + letterSpacing = 0.5.sp + ) + */ +) diff --git a/demo/android/src/main/res/drawable-v24/ic_launcher_foreground.xml b/demo/android/src/main/res/drawable-v24/ic_launcher_foreground.xml new file mode 100644 index 0000000..2b068d1 --- /dev/null +++ b/demo/android/src/main/res/drawable-v24/ic_launcher_foreground.xml @@ -0,0 +1,30 @@ + + + + + + + + + + + \ No newline at end of file diff --git a/demo/android/src/main/res/drawable/ic_launcher_background.xml b/demo/android/src/main/res/drawable/ic_launcher_background.xml new file mode 100644 index 0000000..07d5da9 --- /dev/null +++ b/demo/android/src/main/res/drawable/ic_launcher_background.xml @@ -0,0 +1,170 @@ + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + diff --git a/demo/android/src/main/res/mipmap-anydpi-v26/ic_launcher.xml b/demo/android/src/main/res/mipmap-anydpi-v26/ic_launcher.xml new file mode 100644 index 0000000..eca70cf --- /dev/null +++ b/demo/android/src/main/res/mipmap-anydpi-v26/ic_launcher.xml @@ -0,0 +1,5 @@ + + + + + \ No newline at end of file diff --git a/demo/android/src/main/res/mipmap-anydpi-v26/ic_launcher_round.xml b/demo/android/src/main/res/mipmap-anydpi-v26/ic_launcher_round.xml new file mode 100644 index 0000000..eca70cf --- /dev/null +++ b/demo/android/src/main/res/mipmap-anydpi-v26/ic_launcher_round.xml @@ -0,0 +1,5 @@ + + + + + \ No newline at end of file diff --git a/demo/android/src/main/res/mipmap-hdpi/ic_launcher.webp b/demo/android/src/main/res/mipmap-hdpi/ic_launcher.webp new file mode 100644 index 0000000000000000000000000000000000000000..c209e78ecd372343283f4157dcfd918ec5165bb3 GIT binary patch literal 1404 zcmV-?1%vuhNk&F=1pok7MM6+kP&il$0000G0000-002h-06|PpNX!5L00Dqw+t%{r zzW2vH!KF=w&cMnnN@{whkTw+#mAh0SV?YL=)3MimFYCWp#fpdtz~8$hD5VPuQgtcN zXl<@<#Cme5f5yr2h%@8TWh?)bSK`O z^Z@d={gn7J{iyxL_y_%J|L>ep{dUxUP8a{byupH&!UNR*OutO~0{*T4q5R6@ApLF! z5{w?Z150gC7#>(VHFJZ-^6O@PYp{t!jH(_Z*nzTK4 zkc{fLE4Q3|mA2`CWQ3{8;gxGizgM!zccbdQoOLZc8hThi-IhN90RFT|zlxh3Ty&VG z?Fe{#9RrRnxzsu|Lg2ddugg7k%>0JeD+{XZ7>Z~{=|M+sh1MF7~ zz>To~`~LVQe1nNoR-gEzkpe{Ak^7{{ZBk2i_<+`Bq<^GB!RYG+z)h;Y3+<{zlMUYd zrd*W4w&jZ0%kBuDZ1EW&KLpyR7r2=}fF2%0VwHM4pUs}ZI2egi#DRMYZPek*^H9YK zay4Iy3WXFG(F14xYsoDA|KXgGc5%2DhmQ1gFCkrgHBm!lXG8I5h*uf{rn48Z!_@ z4Bk6TJAB2CKYqPjiX&mWoW>OPFGd$wqroa($ne7EUK;#3VYkXaew%Kh^3OrMhtjYN?XEoY`tRPQsAkH-DSL^QqyN0>^ zmC>{#F14jz4GeW{pJoRpLFa_*GI{?T93^rX7SPQgT@LbLqpNA}<@2wH;q493)G=1Y z#-sCiRNX~qf3KgiFzB3I>4Z%AfS(3$`-aMIBU+6?gbgDb!)L~A)je+;fR0jWLL-Fu z4)P{c7{B4Hp91&%??2$v9iRSFnuckHUm}or9seH6 z>%NbT+5*@L5(I9j@06@(!{ZI?U0=pKn8uwIg&L{JV14+8s2hnvbRrU|hZCd}IJu7*;;ECgO%8_*W Kmw_-CKmY()leWbG literal 0 HcmV?d00001 diff --git a/demo/android/src/main/res/mipmap-hdpi/ic_launcher_round.webp b/demo/android/src/main/res/mipmap-hdpi/ic_launcher_round.webp new file mode 100644 index 0000000000000000000000000000000000000000..b2dfe3d1ba5cf3ee31b3ecc1ced89044a1f3b7a9 GIT binary patch literal 2898 zcmV-Y3$650Nk&FW3jhFDMM6+kP&il$0000G0000-002h-06|PpNWB9900E$G+qN-D z+81ABX7q?;bwx%xBg?kcwr$(C-Tex-ZCkHUw(Y9#+`E5-zuONG5fgw~E2WDng@Bc@ z24xy+R1n%~6xI#u9vJ8zREI)sb<&Il(016}Z~V1n^PU3-_H17A*Bf^o)&{_uBv}Py zulRfeE8g(g6HFhk_?o_;0@tz?1I+l+Y#Q*;RVC?(ud`_cU-~n|AX-b`JHrOIqn(-t&rOg-o`#C zh0LPxmbOAEb;zHTu!R3LDh1QO zZTf-|lJNUxi-PpcbRjw3n~n-pG;$+dIF6eqM5+L();B2O2tQ~|p{PlpNcvDbd1l%c zLtXn%lu(3!aNK!V#+HNn_D3lp z2%l+hK-nsj|Bi9;V*WIcQRTt5j90A<=am+cc`J zTYIN|PsYAhJ|=&h*4wI4ebv-C=Be#u>}%m;a{IGmJDU`0snWS&$9zdrT(z8#{OZ_Y zxwJx!ZClUi%YJjD6Xz@OP8{ieyJB=tn?>zaI-4JN;rr`JQbb%y5h2O-?_V@7pG_+y z(lqAsqYr!NyVb0C^|uclHaeecG)Sz;WV?rtoqOdAAN{j%?Uo%owya(F&qps@Id|Of zo@~Y-(YmfB+chv^%*3g4k3R0WqvuYUIA+8^SGJ{2Bl$X&X&v02>+0$4?di(34{pt* zG=f#yMs@Y|b&=HyH3k4yP&goF2LJ#tBLJNNDo6lG06r}ghC-pC4Q*=x3;|+W04zte zAl>l4kzUBQFYF(E`KJy?ZXd1tnfbH+Z~SMmA21KokJNs#eqcXWKUIC>{TuoKe^vhF z);H)o`t9j~`$h1D`#bxe@E`oE`cM9w(@)5Bp8BNukIwM>wZHfd0S;5bcXA*5KT3bj zc&_~`&{z7u{Et!Z_k78H75gXf4g8<_ul!H$eVspPeU3j&&Au=2R*Zp#M9$9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dd_9wO=4zO8ritN*NPk_9avYrsF(!4))tm{Ga#OY z(r{0buexOzu7+rw8E08Gxd`LTOID{*AC1m*6Nw@osfB%0oBF5sf<~wH1kL;sd zo)k6^VyRFU`)dt*iX^9&QtWbo6yE8XXH?`ztvpiOLgI3R+=MOBQ9=rMVgi<*CU%+d1PQQ0a1U=&b0vkF207%xU0ssI2 literal 0 HcmV?d00001 diff --git a/demo/android/src/main/res/mipmap-mdpi/ic_launcher.webp b/demo/android/src/main/res/mipmap-mdpi/ic_launcher.webp new file mode 100644 index 0000000000000000000000000000000000000000..4f0f1d64e58ba64d180ce43ee13bf9a17835fbca GIT binary patch literal 982 zcmV;{11bDcNk&G_0{{S5MM6+kP&il$0000G0000l001ul06|PpNU8t;00Dqo+t#w^ z^1csucXz7-Qrhzl9HuHB%l>&>1tG2^vb*E&k^T3$FG1eQZ51g$uv4V+kI`0<^1Z@N zk?Jjh$olyC%l>)Xq;7!>{iBj&BjJ`P&$fsCfpve_epJOBkTF?nu-B7D!hO=2ZR}

C%4 zc_9eOXvPbC4kzU8YowIA8cW~Uv|eB&yYwAObSwL2vY~UYI7NXPvf3b+c^?wcs~_t{ ze_m66-0)^{JdOMKPwjpQ@Sna!*?$wTZ~su*tNv7o!gXT!GRgivP}ec?5>l1!7<(rT zds|8x(qGc673zrvYIz;J23FG{9nHMnAuP}NpAED^laz3mAN1sy+NXK)!6v1FxQ;lh zOBLA>$~P3r4b*NcqR;y6pwyhZ3_PiDb|%n1gGjl3ZU}ujInlP{eks-#oA6>rh&g+!f`hv#_%JrgYPu z(U^&XLW^QX7F9Z*SRPpQl{B%x)_AMp^}_v~?j7 zapvHMKxSf*Mtyx8I}-<*UGn3)oHd(nn=)BZ`d$lDBwq_GL($_TPaS{UeevT(AJ`p0 z9%+hQb6z)U9qjbuXjg|dExCLjpS8$VKQ55VsIC%@{N5t{NsW)=hNGI`J=x97_kbz@ E0Of=7!TQj4N+cqN`nQhxvX7dAV-`K|Ub$-q+H-5I?Tx0g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!C9cmziu1^nHA z`#`0c>@PnQ9CJKgC5NjJD8HM3|KC(g5nnCq$n0Gsu_DXk36@ql%npEye|?%RmG)

FJ$wK}0tWNB{uH;AM~i literal 0 HcmV?d00001 diff --git a/demo/android/src/main/res/mipmap-xhdpi/ic_launcher.webp b/demo/android/src/main/res/mipmap-xhdpi/ic_launcher.webp new file mode 100644 index 0000000000000000000000000000000000000000..948a3070fe34c611c42c0d3ad3013a0dce358be0 GIT binary patch literal 1900 zcmV-y2b1_xNk&Fw2LJ$9MM6+kP&il$0000G0001A003VA06|PpNH75a00DqwTbm-~ zullQTcXxO9ki!OCRx^i?oR|n!<8G0=kI^!JSjFi-LL*`V;ET0H2IXfU0*i>o6o6Gy zRq6Ap5(_{XLdXcL-MzlN`ugSdZY_`jXhcENAu)N_0?GhF))9R;E`!bo9p?g?SRgw_ zEXHhFG$0{qYOqhdX<(wE4N@es3VIo$%il%6xP9gjiBri+2pI6aY4 zJbgh-Ud|V%3O!IcHKQx1FQH(_*TK;1>FQWbt^$K1zNn^cczkBs=QHCYZ8b&l!UV{K z{L0$KCf_&KR^}&2Fe|L&?1I7~pBENnCtCuH3sjcx6$c zwqkNkru);ie``q+_QI;IYLD9OV0ZxkuyBz|5<$1BH|vtey$> z5oto4=l-R-Aaq`Dk0}o9N0VrkqW_#;!u{!bJLDq%0092{Ghe=F;(kn} z+sQ@1=UlX30+2nWjkL$B^b!H2^QYO@iFc0{(-~yXj2TWz?VG{v`Jg zg}WyYnwGgn>{HFaG7E~pt=)sOO}*yd(UU-D(E&x{xKEl6OcU?pl)K%#U$dn1mDF19 zSw@l8G!GNFB3c3VVK0?uyqN&utT-D5%NM4g-3@Sii9tSXKtwce~uF zS&Jn746EW^wV~8zdQ1XC28~kXu8+Yo9p!<8h&(Q({J*4DBglPdpe4M_mD8AguZFn~ ztiuO~{6Bx?SfO~_ZV(GIboeR9~hAym{{fV|VM=77MxDrbW6`ujX z<3HF(>Zr;#*uCvC*bpoSr~C$h?_%nXps@A)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hdpi/ic_launcher_round.webp new file mode 100644 index 0000000000000000000000000000000000000000..1b9a6956b3acdc11f40ce2bb3f6efbd845cc243f GIT binary patch literal 3918 zcmV-U53%r4Nk&FS4*&pHMM6+kP&il$0000G0001A003VA06|PpNSy@$00HoY|G(*G z+qV7x14$dSO^Re!iqt-AAIE9iwr$(CZQJL$blA4B`>;C3fBY6Q8_YSjb2%a=fc}4E zrSzssacq<^nmW|Rs93PJni30R<8w<(bK_$LO4L?!_OxLl$}K$MUEllnMK|rg=f3;y z*?;3j|Nh>)p0JQ3A~rf(MibH2r+)3cyV1qF&;8m{w-S*y+0mM){KTK^M5}ksc`qX3 zy>rf^b>~l>SSHds8(I@hz3&PD@LmEs4&prkT=BjsBCXTMhN$_)+kvnl0bLKW5rEsj z*d#KXGDB4P&>etx0X+`R19yC=LS)j!mgs5M0L~+o-T~Jl!p!AJxnGAhV%~rhYUL4hlWhgES3Kb5oA&X z{}?3OBSS-{!v$nCIGj->(-TAG)8LR{htr41^gxsT8yqt2@DEG6Yl`Uma3Nd4;YUoW zTbkYl3CMU5ypMF3EIkYmWL|*BknM`0+Kq6CpvO(y$#j94e+q{vI{Zp8cV_6RK!`&C zob$*5Q|$IZ09dW=L!V zw@#2wviu|<#3lgGE8GEhcx+zBt`} zOwP8j9X%^f7i_bth4PiJ$LYtFJSCN$3xwDN;8mr*B;CJwBP2G0TMq0uNt7S^DO_wE zepk!Wrn#Z#03j{`c*Rf~y3o7?J}w?tEELRUR2cgxB*Y{LzA#pxHgf}q?u5idu>077 zd^=p)`nA}6e`|@`p?u}YU66PP_MA}Zqqe!c{nK&z%Jwq1N4e_q<#4g^xaz=ao;u|6 zwpRcW2Lax=ZGbx=Q*HhlJ`Ns#Y*r0*%!T?P*TTiX;rb)$CGLz=rSUum$)3Qyv{BL2 zO*=OI2|%(Yz~`pNEOnLp>+?T@glq-DujlIp?hdJeZ7ctP4_OKx|5@EOps3rr(pWzg zK4d3&oN-X2qN(d_MkfwB4I)_)!I_6nj2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sck3`oG!uMS}|eAwVXv>}qxwq?QY%QJ0}r@^;fhuUA9W z*BVl>TGo&N004@xSiwDUXUvp51sVmqO3m)=B55aPwf@0=e}cN+$-BdKxY`YrT_4)0 z_d10#i44Q*rFr8MC>*)v$EJvz``(pb{e&*6k+b zsMz%($|1+8hn8c2?P(l@;Rb&CsZeYoCI3?2!LqjbwPXW3z4G$Qfj=cT5Yb%vY0(AX oeb?AaKtwrnc|$|zzw9vfvn^aJJ!zd)XFXqqy0000001=f@-~a#s literal 0 HcmV?d00001 diff --git a/demo/android/src/main/res/values/colors.xml b/demo/android/src/main/res/values/colors.xml new file mode 100644 index 0000000..f8c6127 --- /dev/null +++ b/demo/android/src/main/res/values/colors.xml @@ -0,0 +1,10 @@ + + + #FFBB86FC + #FF6200EE + #FF3700B3 + #FF03DAC5 + #FF018786 + #FF000000 + #FFFFFFFF + \ No newline at end of file diff --git a/demo/android/src/main/res/values/strings.xml b/demo/android/src/main/res/values/strings.xml new file mode 100644 index 0000000..3ca3a1b --- /dev/null +++ b/demo/android/src/main/res/values/strings.xml @@ -0,0 +1,30 @@ + + Monero SDK Demo + Home + History + Monero wallets + Create a new wallet + I already have a wallet + Back + Finish + New wallet + Restore wallet + Settings + Add remote node + Edit + Open menu + Delete + Save + Description + URL + Password + Username + Monero node + Enter your Monero node information below. + Protocol is required (http:// or https://) + Network + Remote nodes + Add wallet + Wallet name + Remote node selection + \ No newline at end of file diff --git a/demo/android/src/main/res/values/themes.xml b/demo/android/src/main/res/values/themes.xml new file mode 100644 index 0000000..f8dcc51 --- /dev/null +++ b/demo/android/src/main/res/values/themes.xml @@ -0,0 +1,5 @@ + + + +