From 643da68048ddb1dab0b6718050fb711ca1757c10 Mon Sep 17 00:00:00 2001 From: M Date: Wed, 12 May 2021 18:06:39 +0300 Subject: [PATCH 1/9] Minor bug fixes. 4.2.1. --- ios/Runner.xcodeproj/project.pbxproj | 12 ++++++------ .../bitcoin_mnemonic_is_incorrect_exception.dart | 2 +- lib/bitcoin/electrum_transaction_history.dart | 2 +- lib/entities/wallet_type.dart | 2 +- pubspec.yaml | 2 +- 5 files changed, 10 insertions(+), 10 deletions(-) diff --git a/ios/Runner.xcodeproj/project.pbxproj b/ios/Runner.xcodeproj/project.pbxproj index 79c69b9ed..27704e6a2 100644 --- a/ios/Runner.xcodeproj/project.pbxproj +++ b/ios/Runner.xcodeproj/project.pbxproj @@ -362,7 +362,7 @@ ASSETCATALOG_COMPILER_APPICON_NAME = AppIcon; CLANG_ENABLE_MODULES = YES; CODE_SIGN_ENTITLEMENTS = Runner/Runner.entitlements; - CURRENT_PROJECT_VERSION = 40; + CURRENT_PROJECT_VERSION = 41; DEVELOPMENT_TEAM = 32J6BB6VUS; ENABLE_BITCODE = NO; FRAMEWORK_SEARCH_PATHS = ( @@ -379,7 +379,7 @@ "$(inherited)", "$(PROJECT_DIR)/Flutter", ); - MARKETING_VERSION = 4.2.0; + MARKETING_VERSION = 4.2.1; PRODUCT_BUNDLE_IDENTIFIER = com.fotolockr.cakewallet; PRODUCT_NAME = "$(TARGET_NAME)"; SWIFT_OBJC_BRIDGING_HEADER = "Runner/Runner-Bridging-Header.h"; @@ -505,7 +505,7 @@ ASSETCATALOG_COMPILER_APPICON_NAME = AppIcon; CLANG_ENABLE_MODULES = YES; CODE_SIGN_ENTITLEMENTS = Runner/Runner.entitlements; - CURRENT_PROJECT_VERSION = 40; + CURRENT_PROJECT_VERSION = 41; DEVELOPMENT_TEAM = 32J6BB6VUS; ENABLE_BITCODE = NO; FRAMEWORK_SEARCH_PATHS = ( @@ -522,7 +522,7 @@ "$(inherited)", "$(PROJECT_DIR)/Flutter", ); - MARKETING_VERSION = 4.2.0; + MARKETING_VERSION = 4.2.1; PRODUCT_BUNDLE_IDENTIFIER = com.fotolockr.cakewallet; PRODUCT_NAME = "$(TARGET_NAME)"; SWIFT_OBJC_BRIDGING_HEADER = "Runner/Runner-Bridging-Header.h"; @@ -540,7 +540,7 @@ ASSETCATALOG_COMPILER_APPICON_NAME = AppIcon; CLANG_ENABLE_MODULES = YES; CODE_SIGN_ENTITLEMENTS = Runner/Runner.entitlements; - CURRENT_PROJECT_VERSION = 40; + CURRENT_PROJECT_VERSION = 41; DEVELOPMENT_TEAM = 32J6BB6VUS; ENABLE_BITCODE = NO; FRAMEWORK_SEARCH_PATHS = ( @@ -557,7 +557,7 @@ "$(inherited)", "$(PROJECT_DIR)/Flutter", ); - MARKETING_VERSION = 4.2.0; + MARKETING_VERSION = 4.2.1; PRODUCT_BUNDLE_IDENTIFIER = com.fotolockr.cakewallet; PRODUCT_NAME = "$(TARGET_NAME)"; SWIFT_OBJC_BRIDGING_HEADER = "Runner/Runner-Bridging-Header.h"; diff --git a/lib/bitcoin/bitcoin_mnemonic_is_incorrect_exception.dart b/lib/bitcoin/bitcoin_mnemonic_is_incorrect_exception.dart index 5171a4f05..8d0583ce5 100644 --- a/lib/bitcoin/bitcoin_mnemonic_is_incorrect_exception.dart +++ b/lib/bitcoin/bitcoin_mnemonic_is_incorrect_exception.dart @@ -1,5 +1,5 @@ class BitcoinMnemonicIsIncorrectException implements Exception { @override String toString() => - 'Bitcoin mnemonic has incorrect format. Mnemonic should contain 24 words separated by space.'; + 'Bitcoin mnemonic has incorrect format. Mnemonic should contain 12 or 24 words separated by space.'; } diff --git a/lib/bitcoin/electrum_transaction_history.dart b/lib/bitcoin/electrum_transaction_history.dart index 1d5e894c0..2aabf1304 100644 --- a/lib/bitcoin/electrum_transaction_history.dart +++ b/lib/bitcoin/electrum_transaction_history.dart @@ -35,7 +35,7 @@ abstract class ElectrumTransactionHistoryBase @override void addMany(Map transactions) => - this.transactions.addAll(transactions); + transactions.forEach((_, tx) => _updateOrInsert(tx)); @override Future save() async { diff --git a/lib/entities/wallet_type.dart b/lib/entities/wallet_type.dart index d59f336c0..b8a36e709 100644 --- a/lib/entities/wallet_type.dart +++ b/lib/entities/wallet_type.dart @@ -71,7 +71,7 @@ String walletTypeToDisplayName(WalletType type) { case WalletType.bitcoin: return 'Bitcoin (Electrum)'; case WalletType.litecoin: - return 'Litecoin'; + return 'Litecoin (Electrum)'; default: return ''; } diff --git a/pubspec.yaml b/pubspec.yaml index 27fb93b0d..136cf8610 100644 --- a/pubspec.yaml +++ b/pubspec.yaml @@ -11,7 +11,7 @@ description: Cake Wallet. # In iOS, build-name is used as CFBundleShortVersionString while build-number used as CFBundleVersion. # Read more about iOS versioning at # https://developer.apple.com/library/archive/documentation/General/Reference/InfoPlistKeyReference/Articles/CoreFoundationKeys.html -version: 4.2.0+49 +version: 4.2.1+50 environment: sdk: ">=2.7.0 <3.0.0" From 34ee2dd8e63812c93e462cdf388f713195fe7564 Mon Sep 17 00:00:00 2001 From: OleksandrSobol Date: Mon, 17 May 2021 21:22:49 +0300 Subject: [PATCH 2/9] CAKE-324 | added website and github links to support page --- assets/images/2.0x/github.png | Bin 0 -> 981 bytes assets/images/3.0x/github.png | Bin 0 -> 1539 bytes assets/images/github.png | Bin 0 -> 507 bytes lib/view_model/support_view_model.dart | 9 +++++++++ pubspec.lock | 6 +++--- pubspec.yaml | 2 +- 6 files changed, 13 insertions(+), 4 deletions(-) create mode 100644 assets/images/2.0x/github.png create mode 100644 assets/images/3.0x/github.png create mode 100644 assets/images/github.png diff --git a/assets/images/2.0x/github.png b/assets/images/2.0x/github.png new file mode 100644 index 0000000000000000000000000000000000000000..e80b428e5149bbb5fbd33821aad08889020dea45 GIT binary patch literal 981 zcmV;`11kK9P);I`wYyamtzvukU%ky@CA;vHyMyyx}VUL#{=F?D9AX%cCCmP#NV!_zt#`k6@2EYPa4@j`xUFtt73s$h57UhVTcJsKftf}GGnnBj!a zIjjp2=YP-BB?Nj7a}+_IVqFUn2g@N}nOd0TBILoiP&%kU`F|#4T40u2!tXqml}iVy z2}!fuS7Zmwa^I&+?3mPqrV914FwZ-mvNEYaO=yBp?+48D)u&9FTJ=k4xKOVc=7}^T zQ4{(s)Z>>h$sHmc<|6`XLOnvgQgRv0Qsq%(B6!tQDHqfd}?XK>OzqlDdF^y-uSQNS1xD zJEfqu7a$}hN&p^Ic^m68`AaElBG)52Jl1e$a|gkRH+E)h2N=!QM6HK`!IC1$wj~Trww-5WFM$4SnCIIfzd)^pklBpV@U3 zcyHOA6yJ%spF4CD;$)^E1@@9(Tn%yW#5tAU9$F;c3eu*w1?I zq;zHq%wg9t{O!o}S}TwhbMABRIrn*<^V}C` z2x1S!!~UZEMB_yNinfckiAE41RTyrHXs+li(HzmN(Z7wew58F07OfL~Bzi~mv1kyx z2{T0xh~9=VMpmsCJtjI8yC{o9{h~jRkHI>%L$pS8rD#v=0$d{c48<7BrH!KHqJ2<9 zW{6%xxd!Xhr=rtQ6UK{f75#^5jn=Ln*dI92Fj@2-;xSme_%uEi5i(o!9pW@vOW%sl zMnudLZAIKhYiU??4I+Sx@2?m;z~@D)MPI?V3S}CH{cRBSik@}+{{mD9pPWM&JFu5K z+A(~(0>f{n%w5Af_63;f-Y0rh^dam~$AD<6r$4$Pzd6SHrRZRk#JzA| z{S7HT=TXrL(P9{5?(J#MM8q`FLec%Ar$iH=;}y8a{4`2{w|3HEzXox#3dz&`Tm+&C zjCsYMKynJoH%+TzyyySC`wNRME`xue{u}-&R|T3h)*UE_^@`4^*g_j-Nm?1?ByE9l zopR+o=!{17ATG{_e(ZN5CB8N8cIerPxcEZ!yRz-o@UMqzj)&Pa(Oj`-5GQoXwV~f4 zezSj7)>hXq)rstOQKH3#QHn*mYPp4behy_063UL2upH;h0IfX;{Gno%crCtjJC#&ooKh}s)CC>OER=c3l%PZ zP2*(~ZtA8^JD1G$qN9~<-$zDxYirj8?zGQAoOHn?TD9kL8!|FAMQ0SJf+kEW6Z&o1 z9lDlILk@h9vQtj)F2n&{ssW@M|BuLNbNZo_9aDp-pc1Hq=`h7QX~(`2Il(fizXArp zj4%tSs|d+%guUQVqi*EL8;(wB(9K9T>?YB*$Z@~Y0X>7IFlG89f#O=2>-!Pij*i-k z2w8shNy4C*etHDv-L1Wl53Ex;ZuE195N@!RGCxgi*iz1{G(V@U4X^qN#Q<68_mb!y zgmIndIk*c3L&S3_WLde&(IJEU&X8+0bc1~oVcd*#M$xEH2mVb*r>qy5)z+>{^gaB8 zy$NB=M|#5~iTfrKQ6Myqs|KULqwOj18*d51n2vl6cM(e9u7m+B=xEElJ>Mt&!O}KM z$@~=LXSByr5)5Hnj%Af5p*GnC9C1MOoXnlxo`$dwWDodTnmeO%{!~%mLmcfG4Qsx4UlQ3 zyJ6Ba?an2C<}{gvFhUJSw`nONf;&Qk@DH5j{KIX(FF+U}hU2nwCL*K@>Ax1EEW@#Y zy6QAnBHU8E5BfsoG7QJCuCy23vcd>s0M#0fU)!+|HH4`nCI^z10kc}Sf?EWyCp_@_aS7nrSbxsmp3X@iU82UF}Z19f00cO!> pQS`eoMr>$kXlQ6?XlQ8g@;@rJG-cns(Xs#l002ovPDHLkV1lV?-PQmA literal 0 HcmV?d00001 diff --git a/assets/images/github.png b/assets/images/github.png new file mode 100644 index 0000000000000000000000000000000000000000..847a269a242cee04d869e807632877991a87021a GIT binary patch literal 507 zcmVVK~#7F<&`@~ z13?gme_tTtvr%dTR-%tldM2{OBPyg6ksOSHjJ z9&u_YuH%jvgQYx9{IqD4R~_*oYRu_ODFmm; zRXd`_p4_PB&u$TWg1d5J-J@$%D`L%XSG{5V*Qg+3EyN()G$Gb+Izu~xcXR=JErx2W zn2gzwahK>qGN}nGhVq9@<~254^Xb&6s^@7F{#1t5Nz9}C>XFv(4!b0kDUpe_3{yoGsQg4MO xILIURxyXrTf1LN!A%;-_sS!8*Wenio>KDkvo5-G#DXRbg002ovPDHLkV1j&q+57+i literal 0 HcmV?d00001 diff --git a/lib/view_model/support_view_model.dart b/lib/view_model/support_view_model.dart index 1f80f476d..08044232e 100644 --- a/lib/view_model/support_view_model.dart +++ b/lib/view_model/support_view_model.dart @@ -24,6 +24,15 @@ abstract class SupportViewModelBase with Store { title: 'Email', linkTitle: 'support@cakewallet.com', link: 'mailto:support@cakewallet.com'), + LinkListItem( + title: 'Website', + linkTitle: 'cakewallet.com', + link: 'https://cakewallet.com'), + LinkListItem( + title: 'GitHub', + icon: 'assets/images/github.png', + linkTitle: 'APK update', + link: 'https://github.com/cake-tech/cake_wallet/releases'), LinkListItem( title: 'Telegram', icon: 'assets/images/Telegram.png', diff --git a/pubspec.lock b/pubspec.lock index 3ff596074..207f4b18a 100644 --- a/pubspec.lock +++ b/pubspec.lock @@ -70,7 +70,7 @@ packages: path: "." ref: cake resolved-ref: "02fef082f20af13de00b4e64efb93a2c1e5e1cf2" - url: "git@github.com:cake-tech/bech32.git" + url: "https://github.com/cake-tech/bech32.git" source: git version: "0.2.0" bip32: @@ -92,8 +92,8 @@ packages: description: path: "." ref: cake - resolved-ref: b3ab2926c665f0e68b74a4a5f31059f7fcd817b7 - url: "git@github.com:cake-tech/bitcoin_flutter.git" + resolved-ref: cbabfd87b6ce3cae6051a3e86ddb56e7a934e188 + url: "https://github.com/cake-tech/bitcoin_flutter.git" source: git version: "2.0.2" boolean_selector: diff --git a/pubspec.yaml b/pubspec.yaml index 27fb93b0d..4d1b63ceb 100644 --- a/pubspec.yaml +++ b/pubspec.yaml @@ -67,7 +67,7 @@ dependencies: basic_utils: ^2.0.3 bitcoin_flutter: git: - url: git@github.com:cake-tech/bitcoin_flutter.git + url: https://github.com/cake-tech/bitcoin_flutter.git ref: cake get_it: ^6.0.0 connectivity: ^3.0.3 From 66e22c2d07bbcecc2853eee0bb28ab67974faf91 Mon Sep 17 00:00:00 2001 From: OleksandrSobol Date: Tue, 18 May 2021 19:14:42 +0300 Subject: [PATCH 3/9] CAKE-324 | fixed localization --- lib/view_model/support_view_model.dart | 2 +- res/values/strings_de.arb | 6 ++++-- res/values/strings_en.arb | 4 +++- res/values/strings_es.arb | 6 ++++-- res/values/strings_hi.arb | 6 ++++-- res/values/strings_hr.arb | 8 +++++--- res/values/strings_it.arb | 8 +++++--- res/values/strings_ja.arb | 6 ++++-- res/values/strings_ko.arb | 6 ++++-- res/values/strings_nl.arb | 6 ++++-- res/values/strings_pl.arb | 6 ++++-- res/values/strings_pt.arb | 6 ++++-- res/values/strings_ru.arb | 6 ++++-- res/values/strings_uk.arb | 6 ++++-- res/values/strings_zh.arb | 6 ++++-- 15 files changed, 58 insertions(+), 30 deletions(-) diff --git a/lib/view_model/support_view_model.dart b/lib/view_model/support_view_model.dart index 08044232e..1937b90ff 100644 --- a/lib/view_model/support_view_model.dart +++ b/lib/view_model/support_view_model.dart @@ -31,7 +31,7 @@ abstract class SupportViewModelBase with Store { LinkListItem( title: 'GitHub', icon: 'assets/images/github.png', - linkTitle: 'APK update', + linkTitle: S.current.apk_update, link: 'https://github.com/cake-tech/cake_wallet/releases'), LinkListItem( title: 'Telegram', diff --git a/res/values/strings_de.arb b/res/values/strings_de.arb index 27c705d97..ed3520d17 100644 --- a/res/values/strings_de.arb +++ b/res/values/strings_de.arb @@ -473,6 +473,8 @@ "buy_alert_content" : "Derzeit unterstützen wir nur den Kauf von Bitcoin. Um Bitcoin zu kaufen, erstellen Sie bitte Ihre Bitcoin-Brieftasche oder wechseln Sie zu dieser", - "outdated_electrum_wallet_desceription" : "New Bitcoin wallets created in Cake now have a 24-word seed. It is mandatory that you create a new Bitcoin wallet and transfer all of your funds to the new 24-word wallet, and stop using wallets with a 12-word seed. Please do this immediately to secure your funds.", - "understand" : "I understand" + "outdated_electrum_wallet_desceription" : "Neue Bitcoin-Geldbörsen, die in Cake erstellt wurden, haben jetzt einen Startwert von 24 Wörtern. Es ist obligatorisch, dass Sie eine neue Bitcoin-Brieftasche erstellen, Ihr gesamtes Geld in die neue 24-Wörter-Brieftasche überweisen und keine Brieftaschen mit einem 12-Wörter-Startwert mehr verwenden. Bitte tun Sie dies sofort, um Ihr Geld zu sichern.", + "understand" : "Ich verstehe", + + "apk_update" : "APK Update" } \ No newline at end of file diff --git a/res/values/strings_en.arb b/res/values/strings_en.arb index 78ab7ec06..65dee6dbe 100644 --- a/res/values/strings_en.arb +++ b/res/values/strings_en.arb @@ -474,5 +474,7 @@ "buy_alert_content" : "Currently we only support the purchase of Bitcoin. To buy Bitcoin, please create or switch to your Bitcoin wallet", "outdated_electrum_wallet_desceription" : "New Bitcoin wallets created in Cake now have a 24-word seed. It is mandatory that you create a new Bitcoin wallet and transfer all of your funds to the new 24-word wallet, and stop using wallets with a 12-word seed. Please do this immediately to secure your funds.", - "understand" : "I understand" + "understand" : "I understand", + + "apk_update" : "APK update" } \ No newline at end of file diff --git a/res/values/strings_es.arb b/res/values/strings_es.arb index 98ece5ce7..983146557 100644 --- a/res/values/strings_es.arb +++ b/res/values/strings_es.arb @@ -473,6 +473,8 @@ "buy_alert_content" : "Actualmente solo apoyamos la compra de Bitcoin. Para comprar Bitcoin, cree o cambie a su billetera Bitcoin", - "outdated_electrum_wallet_desceription" : "New Bitcoin wallets created in Cake now have a 24-word seed. It is mandatory that you create a new Bitcoin wallet and transfer all of your funds to the new 24-word wallet, and stop using wallets with a 12-word seed. Please do this immediately to secure your funds.", - "understand" : "I understand" + "outdated_electrum_wallet_desceription" : "Las nuevas carteras de Bitcoin creadas en Cake ahora tienen una semilla de 24 palabras. Es obligatorio que cree una nueva billetera de Bitcoin y transfiera todos sus fondos a la nueva billetera de 24 palabras, y deje de usar billeteras con una semilla de 12 palabras. Haga esto de inmediato para asegurar sus fondos.", + "understand" : "Entiendo", + + "apk_update" : "Actualización de APK" } \ No newline at end of file diff --git a/res/values/strings_hi.arb b/res/values/strings_hi.arb index 4f14f2a1a..889f21c3f 100644 --- a/res/values/strings_hi.arb +++ b/res/values/strings_hi.arb @@ -473,6 +473,8 @@ "buy_alert_content" : "वर्तमान में हम केवल बिटकॉइन की खरीद का समर्थन करते हैं। बिटकॉइन खरीदने के लिए, कृपया अपना बिटकॉइन वॉलेट बनाएं या स्विच करें", - "outdated_electrum_wallet_desceription" : "New Bitcoin wallets created in Cake now have a 24-word seed. It is mandatory that you create a new Bitcoin wallet and transfer all of your funds to the new 24-word wallet, and stop using wallets with a 12-word seed. Please do this immediately to secure your funds.", - "understand" : "I understand" + "outdated_electrum_wallet_desceription" : "केक में बनाए गए नए बिटकॉइन वॉलेट में अब 24-शब्द का बीज है। यह अनिवार्य है कि आप एक नया बिटकॉइन वॉलेट बनाएं और अपने सभी फंड को नए 24-शब्द वाले वॉलेट में स्थानांतरित करें, और 12-शब्द बीज वाले वॉलेट का उपयोग करना बंद करें। कृपया अपने धन को सुरक्षित करने के लिए इसे तुरंत करें।", + "understand" : "मुझे समझ", + + "apk_update" : "APK अद्यतन" } \ No newline at end of file diff --git a/res/values/strings_hr.arb b/res/values/strings_hr.arb index d449fca1b..681917b03 100644 --- a/res/values/strings_hr.arb +++ b/res/values/strings_hr.arb @@ -471,8 +471,10 @@ "submit_request" : "podnesi zahtjev", - "buy_alert_content" : "Currently we only support the purchase of Bitcoin. To buy Bitcoin, please create or switch to your Bitcoin wallet", + "buy_alert_content" : "Trenutno podržavamo samo kupnju Bitcoina. Da biste kupili Bitcoin, izradite ili prijeđite na svoj Bitcoin novčanik", - "outdated_electrum_wallet_desceription" : "New Bitcoin wallets created in Cake now have a 24-word seed. It is mandatory that you create a new Bitcoin wallet and transfer all of your funds to the new 24-word wallet, and stop using wallets with a 12-word seed. Please do this immediately to secure your funds.", - "understand" : "I understand" + "outdated_electrum_wallet_desceription" : "Novi Bitcoin novčanici stvoreni u Cakeu sada imaju sjeme od 24 riječi. Obavezno je stvoriti novi Bitcoin novčanik i prenijeti sva svoja sredstva u novi novčanik od 24 riječi te prestati koristiti novčanike s sjemenkom od 12 riječi. Učinite to odmah kako biste osigurali svoja sredstva.", + "understand" : "Razumijem", + + "apk_update" : "APK ažuriranje" } \ No newline at end of file diff --git a/res/values/strings_it.arb b/res/values/strings_it.arb index e8c4da26d..1b10a0137 100644 --- a/res/values/strings_it.arb +++ b/res/values/strings_it.arb @@ -471,8 +471,10 @@ "submit_request" : "invia una richiesta", - "buy_alert_content" : "Currently we only support the purchase of Bitcoin. To buy Bitcoin, please create or switch to your Bitcoin wallet", + "buy_alert_content" : "Attualmente supportiamo solo l'acquisto di Bitcoin. Per acquistare Bitcoin, crea o passa al tuo portafoglio Bitcoin", - "outdated_electrum_wallet_desceription" : "New Bitcoin wallets created in Cake now have a 24-word seed. It is mandatory that you create a new Bitcoin wallet and transfer all of your funds to the new 24-word wallet, and stop using wallets with a 12-word seed. Please do this immediately to secure your funds.", - "understand" : "I understand" + "outdated_electrum_wallet_desceription" : "I nuovi portafogli Bitcoin creati in Cake ora hanno un seme di 24 parole. È obbligatorio creare un nuovo portafoglio Bitcoin e trasferire tutti i fondi nel nuovo portafoglio di 24 parole e smettere di usare portafogli con un seme di 12 parole. Ti preghiamo di farlo immediatamente per proteggere i tuoi fondi.", + "understand" : "Capisco", + + "apk_update" : "Aggiornamento APK" } \ No newline at end of file diff --git a/res/values/strings_ja.arb b/res/values/strings_ja.arb index 797cfe2c2..7d78e9313 100644 --- a/res/values/strings_ja.arb +++ b/res/values/strings_ja.arb @@ -473,6 +473,8 @@ "buy_alert_content" : "現在、ビットコインの購入のみをサポートしています。 ビットコインを購入するには、ビットコインウォレットを作成するか切り替えてください", - "outdated_electrum_wallet_desceription" : "New Bitcoin wallets created in Cake now have a 24-word seed. It is mandatory that you create a new Bitcoin wallet and transfer all of your funds to the new 24-word wallet, and stop using wallets with a 12-word seed. Please do this immediately to secure your funds.", - "understand" : "I understand" + "outdated_electrum_wallet_desceription" : "Cakeで作成された新しいビットコインウォレットには、24ワードのシードがあります。 新しいビットコインウォレットを作成し、すべての資金を新しい24ワードのウォレットに転送し、12ワードのシードを持つウォレットの使用を停止することが必須です。 あなたの資金を確保するためにこれをすぐに行ってください。", + "understand" : "わかります", + + "apk_update" : "APKアップデート" } \ No newline at end of file diff --git a/res/values/strings_ko.arb b/res/values/strings_ko.arb index fddff1af5..3a10232a9 100644 --- a/res/values/strings_ko.arb +++ b/res/values/strings_ko.arb @@ -473,6 +473,8 @@ "buy_alert_content" : "현재 우리는 비트 코인 구매 만 지원합니다. 비트 코인을 구매하려면 비트 코인 지갑을 생성하거나 전환하십시오", - "outdated_electrum_wallet_desceription" : "New Bitcoin wallets created in Cake now have a 24-word seed. It is mandatory that you create a new Bitcoin wallet and transfer all of your funds to the new 24-word wallet, and stop using wallets with a 12-word seed. Please do this immediately to secure your funds.", - "understand" : "I understand" + "outdated_electrum_wallet_desceription" : "Cake에서 생성 된 새로운 비트 코인 지갑에는 이제 24 단어 시드가 있습니다. 새로운 비트 코인 지갑을 생성하고 모든 자금을 새로운 24 단어 지갑으로 이체하고 12 단어 시드가있는 지갑 사용을 중지해야합니다. 자금을 확보하려면 즉시이 작업을 수행하십시오.", + "understand" : "이해 했어요", + + "apk_update" : "APK 업데이트" } \ No newline at end of file diff --git a/res/values/strings_nl.arb b/res/values/strings_nl.arb index 8d4b4bf1c..76b084428 100644 --- a/res/values/strings_nl.arb +++ b/res/values/strings_nl.arb @@ -473,6 +473,8 @@ "buy_alert_content" : "Momenteel ondersteunen we alleen de aankoop van Bitcoin. Om Bitcoin te kopen, moet u uw Bitcoin-portemonnee aanmaken of naar uw Bitcoin-portemonnee overschakelen", - "outdated_electrum_wallet_desceription" : "New Bitcoin wallets created in Cake now have a 24-word seed. It is mandatory that you create a new Bitcoin wallet and transfer all of your funds to the new 24-word wallet, and stop using wallets with a 12-word seed. Please do this immediately to secure your funds.", - "understand" : "I understand" + "outdated_electrum_wallet_desceription" : "Nieuwe Bitcoin-portefeuilles die in Cake zijn gemaakt, hebben nu een zaadje van 24 woorden. Het is verplicht dat u een nieuwe Bitcoin-portemonnee maakt en al uw geld overmaakt naar de nieuwe portemonnee van 24 woorden, en stopt met het gebruik van wallets met een seed van 12 woorden. Doe dit onmiddellijk om uw geld veilig te stellen.", + "understand" : "Ik begrijp het", + + "apk_update" : "APK-update" } \ No newline at end of file diff --git a/res/values/strings_pl.arb b/res/values/strings_pl.arb index fca8328fc..5522713d7 100644 --- a/res/values/strings_pl.arb +++ b/res/values/strings_pl.arb @@ -473,6 +473,8 @@ "buy_alert_content" : "Obecnie obsługujemy tylko zakup Bitcoinów. Aby kupić Bitcoin, utwórz lub przełącz się na swój portfel Bitcoin", - "outdated_electrum_wallet_desceription" : "New Bitcoin wallets created in Cake now have a 24-word seed. It is mandatory that you create a new Bitcoin wallet and transfer all of your funds to the new 24-word wallet, and stop using wallets with a 12-word seed. Please do this immediately to secure your funds.", - "understand" : "I understand" + "outdated_electrum_wallet_desceription" : "Nowe portfele Bitcoin utworzone w Cake mają teraz ziarno składające się z 24 słów. Konieczne jest utworzenie nowego portfela Bitcoin i przeniesienie wszystkich środków do nowego portfela na 24 słowa oraz zaprzestanie korzystania z portfeli z zalążkiem na 12 słów. Zrób to natychmiast, aby zabezpieczyć swoje fundusze.", + "understand" : "Rozumiem", + + "apk_update" : "Aktualizacja APK" } \ No newline at end of file diff --git a/res/values/strings_pt.arb b/res/values/strings_pt.arb index 8aa08e69c..c5c976113 100644 --- a/res/values/strings_pt.arb +++ b/res/values/strings_pt.arb @@ -473,6 +473,8 @@ "buy_alert_content" : "Atualmente, apoiamos apenas a compra de Bitcoin. Para comprar Bitcoin, crie ou mude para sua carteira Bitcoin", - "outdated_electrum_wallet_desceription" : "New Bitcoin wallets created in Cake now have a 24-word seed. It is mandatory that you create a new Bitcoin wallet and transfer all of your funds to the new 24-word wallet, and stop using wallets with a 12-word seed. Please do this immediately to secure your funds.", - "understand" : "I understand" + "outdated_electrum_wallet_desceription" : "As novas carteiras Bitcoin criadas no Cake agora têm uma semente de 24 palavras. É obrigatório que você crie uma nova carteira Bitcoin e transfira todos os seus fundos para a nova carteira de 24 palavras, e pare de usar carteiras com semente de 12 palavras. Faça isso imediatamente para garantir seus fundos.", + "understand" : "Entendo", + + "apk_update" : "Atualização de APK" } \ No newline at end of file diff --git a/res/values/strings_ru.arb b/res/values/strings_ru.arb index 4fe26f13c..1377b4fc0 100644 --- a/res/values/strings_ru.arb +++ b/res/values/strings_ru.arb @@ -473,6 +473,8 @@ "buy_alert_content" : "В настоящее время мы поддерживаем только покупку Bitcoin. Чтобы купить Bitcoin, создайте или переключитесь на ваш Bitcoin кошелек", - "outdated_electrum_wallet_desceription" : "New Bitcoin wallets created in Cake now have a 24-word seed. It is mandatory that you create a new Bitcoin wallet and transfer all of your funds to the new 24-word wallet, and stop using wallets with a 12-word seed. Please do this immediately to secure your funds.", - "understand" : "I understand" + "outdated_electrum_wallet_desceription" : "Новые биткойн-кошельки, созданные в Cake, теперь содержат мнемоническую фразу из 24 слов. Вы обязательно должны создать новый биткойн-кошелек и перевести все свои средства в новый кошелек из 24 слов, а также прекратить использование кошельков с мнемонической фразой из 12 слов. Пожалуйста, сделайте это немедленно, чтобы обезопасить свои средства.", + "understand" : "Понятно", + + "apk_update" : "Обновление APK" } \ No newline at end of file diff --git a/res/values/strings_uk.arb b/res/values/strings_uk.arb index 69d02a27e..e0c1fcc55 100644 --- a/res/values/strings_uk.arb +++ b/res/values/strings_uk.arb @@ -473,6 +473,8 @@ "buy_alert_content" : "На даний час ми підтримуємо тільки покупку Bitcoin. Щоб купити Bitcoin, будь ласка, створіть або переключіться на ваш Bitcoin гаманець", - "outdated_electrum_wallet_desceription" : "New Bitcoin wallets created in Cake now have a 24-word seed. It is mandatory that you create a new Bitcoin wallet and transfer all of your funds to the new 24-word wallet, and stop using wallets with a 12-word seed. Please do this immediately to secure your funds.", - "understand" : "I understand" + "outdated_electrum_wallet_desceription" : "Нові біткойн-гаманці, створені в Cake, тепер містять мнемонічну фразу з 24 слів. Обов’язково стовріть новий біткойн-гаманець, переведіть всі кошти на новий гаманець із 24 слів і припиніть використання гаманців із мнемонічною фразою з 12 слів. Зробіть це негайно, щоб убезпечити свої кошти.", + "understand" : "Зрозуміло", + + "apk_update" : "Оновлення APK" } \ No newline at end of file diff --git a/res/values/strings_zh.arb b/res/values/strings_zh.arb index e0a96561c..ddb1efda3 100644 --- a/res/values/strings_zh.arb +++ b/res/values/strings_zh.arb @@ -470,6 +470,8 @@ "submit_request" : "提交请求", "buy_alert_content" : "目前,我們僅支持購買比特幣。 要購買比特幣,請創建或切換到您的比特幣錢包", - "outdated_electrum_wallet_desceription" : "New Bitcoin wallets created in Cake now have a 24-word seed. It is mandatory that you create a new Bitcoin wallet and transfer all of your funds to the new 24-word wallet, and stop using wallets with a 12-word seed. Please do this immediately to secure your funds.", - "understand" : "I understand" + "outdated_electrum_wallet_desceription" : "在Cake中創建的新比特幣錢包現在有一個24字的種子。 必須創建一個新的比特幣錢包,然後將所有資金轉移到新的24字錢包,並停止使用帶有12字種子的錢包。 請立即執行此操作以確保您的資金安全。", + "understand" : "我明白", + + "apk_update" : "APK更新" } \ No newline at end of file From 7be3288d5322eaf66022478420f4109723961435 Mon Sep 17 00:00:00 2001 From: OleksandrSobol Date: Wed, 2 Jun 2021 12:45:29 +0300 Subject: [PATCH 4/9] CAKE-324 | merged main branch into current --- res/values/strings_zh.arb | 1 + 1 file changed, 1 insertion(+) diff --git a/res/values/strings_zh.arb b/res/values/strings_zh.arb index 61e6ed893..5faa8c840 100644 --- a/res/values/strings_zh.arb +++ b/res/values/strings_zh.arb @@ -468,6 +468,7 @@ "confirmed" : "已确认", "unconfirmed" : "未经证实", "displayable" : "可显示", + "submit_request" : "提交请求", "buy_alert_content" : "目前,我们仅支持购买比特币。要购买比特币,请创建或切换到您的比特币钱包", From 8e62f2f81176282b8f8b1eba1461ca6b3e52d52e Mon Sep 17 00:00:00 2001 From: OleksandrSobol Date: Thu, 3 Jun 2021 18:38:41 +0300 Subject: [PATCH 5/9] CAKE-341 | fixed scrollbar for currency_picker.dart; applied receive currency list to exchange_template_page.dart --- lib/src/screens/exchange/exchange_template_page.dart | 2 +- lib/src/screens/exchange/widgets/currency_picker.dart | 2 ++ pubspec.lock | 6 +++--- 3 files changed, 6 insertions(+), 4 deletions(-) diff --git a/lib/src/screens/exchange/exchange_template_page.dart b/lib/src/screens/exchange/exchange_template_page.dart index 5437703ce..568e53cd5 100644 --- a/lib/src/screens/exchange/exchange_template_page.dart +++ b/lib/src/screens/exchange/exchange_template_page.dart @@ -176,7 +176,7 @@ class ExchangeTemplatePage extends BasePage { initialIsAddressEditable: exchangeViewModel.isReceiveAddressEnabled, isAmountEstimated: true, - currencies: CryptoCurrency.all, + currencies: exchangeViewModel.receiveCurrencies, onCurrencySelected: (currency) => exchangeViewModel.changeReceiveCurrency( currency: currency), diff --git a/lib/src/screens/exchange/widgets/currency_picker.dart b/lib/src/screens/exchange/widgets/currency_picker.dart index 5e22a17e8..59d53518e 100644 --- a/lib/src/screens/exchange/widgets/currency_picker.dart +++ b/lib/src/screens/exchange/widgets/currency_picker.dart @@ -45,6 +45,7 @@ class CurrencyPickerState extends State { color: Palette.darkBlueCraiola, ); final int crossAxisCount = 3; + final int maxNumberItemsInAlert = 12; final int itemsCount; final double backgroundHeight = 280; final double thumbHeight = 72; @@ -148,6 +149,7 @@ class CurrencyPickerState extends State { ); }) ), + if (itemsCount > maxNumberItemsInAlert) CakeScrollbar( backgroundHeight: backgroundHeight, thumbHeight: thumbHeight, diff --git a/pubspec.lock b/pubspec.lock index 3ff596074..207f4b18a 100644 --- a/pubspec.lock +++ b/pubspec.lock @@ -70,7 +70,7 @@ packages: path: "." ref: cake resolved-ref: "02fef082f20af13de00b4e64efb93a2c1e5e1cf2" - url: "git@github.com:cake-tech/bech32.git" + url: "https://github.com/cake-tech/bech32.git" source: git version: "0.2.0" bip32: @@ -92,8 +92,8 @@ packages: description: path: "." ref: cake - resolved-ref: b3ab2926c665f0e68b74a4a5f31059f7fcd817b7 - url: "git@github.com:cake-tech/bitcoin_flutter.git" + resolved-ref: cbabfd87b6ce3cae6051a3e86ddb56e7a934e188 + url: "https://github.com/cake-tech/bitcoin_flutter.git" source: git version: "2.0.2" boolean_selector: From b1cda209876ad78c4148cdb211abce9b2c55901e Mon Sep 17 00:00:00 2001 From: OleksandrSobol Date: Thu, 3 Jun 2021 20:59:12 +0300 Subject: [PATCH 6/9] CAKE-336 | updated local_auth package and fixed isAuthenticated() method in the biometric_auth.dart --- lib/entities/biometric_auth.dart | 2 +- pubspec.lock | 2 +- pubspec.yaml | 2 +- 3 files changed, 3 insertions(+), 3 deletions(-) diff --git a/lib/entities/biometric_auth.dart b/lib/entities/biometric_auth.dart index ab5d62445..10a05ebff 100644 --- a/lib/entities/biometric_auth.dart +++ b/lib/entities/biometric_auth.dart @@ -7,7 +7,7 @@ class BiometricAuth { Future isAuthenticated() async { try { - return await _localAuth.authenticateWithBiometrics( + return await _localAuth.authenticate( localizedReason: S.current.biometric_auth_reason, useErrorDialogs: true, stickyAuth: false); diff --git a/pubspec.lock b/pubspec.lock index 207f4b18a..a520abbe3 100644 --- a/pubspec.lock +++ b/pubspec.lock @@ -565,7 +565,7 @@ packages: name: local_auth url: "https://pub.dartlang.org" source: hosted - version: "1.1.1" + version: "1.1.6" logging: dependency: transitive description: diff --git a/pubspec.yaml b/pubspec.yaml index 4d1b63ceb..c3de221a9 100644 --- a/pubspec.yaml +++ b/pubspec.yaml @@ -49,7 +49,7 @@ dependencies: path: ./cw_monero hive: ^1.4.4+1 hive_flutter: ^0.3.1 - local_auth: ^1.1.1 + local_auth: ^1.1.6 package_info: ^2.0.0 devicelocale: ^0.4.1 auto_size_text: ^2.1.0 From ff6e4d58f700738e5e14fdcd3d00ff1f20d93de2 Mon Sep 17 00:00:00 2001 From: M Date: Fri, 4 Jun 2021 18:25:17 +0300 Subject: [PATCH 7/9] Added push notifications, FCM. --- .gitignore | 5 +- android/app/build.gradle | 6 ++ android/app/src/main/AndroidManifest.xml | 2 +- .../cakewallet/cake_wallet/Application.java | 21 ++++ android/build.gradle | 1 + ios/Podfile | 1 + ios/Podfile.lock | 99 ++++++++++++++++++- ios/Runner.xcodeproj/project.pbxproj | 7 ++ ios/Runner/AppDelegate.swift | 4 + ios/Runner/Info.plist | 5 + ios/Runner/Runner.entitlements | 5 +- lib/di.dart | 7 +- lib/entities/push_notifications_service.dart | 45 +++++++++ .../dashboard/widgets/balance_page.dart | 1 + lib/utils/show_bar.dart | 16 ++- .../dashboard/dashboard_view_model.dart | 15 ++- pubspec.lock | 34 ++++++- pubspec.yaml | 1 + 18 files changed, 259 insertions(+), 16 deletions(-) create mode 100644 android/app/src/main/java/com/cakewallet/cake_wallet/Application.java create mode 100644 lib/entities/push_notifications_service.dart diff --git a/.gitignore b/.gitignore index 0580d006c..b5c6f1e12 100644 --- a/.gitignore +++ b/.gitignore @@ -97,4 +97,7 @@ android/app/.cxx/** ios/Flutter/.last_build_id /lib/generated/** #**# -/**/#**# \ No newline at end of file +/**/#**# + +**/google-services.json +**/GoogleService-Info.plist \ No newline at end of file diff --git a/android/app/build.gradle b/android/app/build.gradle index 0c6a46dc4..ee68ec0db 100644 --- a/android/app/build.gradle +++ b/android/app/build.gradle @@ -24,6 +24,10 @@ if (flutterVersionName == null) { apply plugin: 'com.android.application' apply from: "$flutterRoot/packages/flutter_tools/gradle/flutter.gradle" +if (file("./google-services.json").exists()) { + apply plugin: 'com.google.gms.google-services' +} + def keystoreProperties = new Properties() def keystorePropertiesFile = rootProject.file('key.properties') if (keystorePropertiesFile.exists()) { @@ -83,4 +87,6 @@ dependencies { testImplementation 'junit:junit:4.12' androidTestImplementation 'androidx.test:runner:1.1.1' androidTestImplementation 'androidx.test.espresso:espresso-core:3.1.1' + implementation 'com.google.firebase:firebase-core:19.0.0' + implementation 'com.google.firebase:firebase-messaging:19.0.0' } diff --git a/android/app/src/main/AndroidManifest.xml b/android/app/src/main/AndroidManifest.xml index abf27576f..c53d1ea7b 100644 --- a/android/app/src/main/AndroidManifest.xml +++ b/android/app/src/main/AndroidManifest.xml @@ -7,6 +7,7 @@ - diff --git a/android/app/src/main/java/com/cakewallet/cake_wallet/Application.java b/android/app/src/main/java/com/cakewallet/cake_wallet/Application.java new file mode 100644 index 000000000..c3b51c14c --- /dev/null +++ b/android/app/src/main/java/com/cakewallet/cake_wallet/Application.java @@ -0,0 +1,21 @@ +package com.cakewallet.cake_wallet; + +import io.flutter.app.FlutterApplication; +import io.flutter.plugin.common.PluginRegistry; +import io.flutter.plugin.common.PluginRegistry.PluginRegistrantCallback; +import io.flutter.plugins.GeneratedPluginRegistrant; +import io.flutter.plugins.firebasemessaging.FlutterFirebaseMessagingService; +import io.flutter.plugins.firebasemessaging.FirebaseMessagingPlugin; + +public class Application extends FlutterApplication implements PluginRegistrantCallback { + @Override + public void onCreate() { + super.onCreate(); + FlutterFirebaseMessagingService.setPluginRegistrant(this); + } + + @Override + public void registerWith(PluginRegistry registry) { + FirebaseMessagingPlugin.registerWith(registry.registrarFor("io.flutter.plugins.firebasemessaging.FirebaseMessagingPlugin")); + } +} \ No newline at end of file diff --git a/android/build.gradle b/android/build.gradle index 0baed694d..0d11c6b94 100644 --- a/android/build.gradle +++ b/android/build.gradle @@ -6,6 +6,7 @@ buildscript { dependencies { classpath 'com.android.tools.build:gradle:3.5.4' + classpath 'com.google.gms:google-services:4.3.8' } } diff --git a/ios/Podfile b/ios/Podfile index e26de900c..3cfff7b1d 100644 --- a/ios/Podfile +++ b/ios/Podfile @@ -36,6 +36,7 @@ target 'Runner' do # Cake Wallet (Legacy) pod 'CryptoSwift' + pod 'Firebase/Messaging', '6.33.0' end post_install do |installer| diff --git a/ios/Podfile.lock b/ios/Podfile.lock index 879041cac..50f9b20d2 100644 --- a/ios/Podfile.lock +++ b/ios/Podfile.lock @@ -62,18 +62,84 @@ PODS: - file_picker (0.0.1): - DKImagePickerController/PhotoGallery - Flutter + - Firebase/CoreOnly (6.33.0): + - FirebaseCore (= 6.10.3) + - Firebase/Messaging (6.33.0): + - Firebase/CoreOnly + - FirebaseMessaging (~> 4.7.0) + - firebase_core (0.5.3): + - Firebase/CoreOnly (~> 6.33.0) + - Flutter + - firebase_messaging (7.0.3): + - Firebase/CoreOnly (~> 6.33.0) + - Firebase/Messaging (~> 6.33.0) + - firebase_core + - Flutter + - FirebaseCore (6.10.3): + - FirebaseCoreDiagnostics (~> 1.6) + - GoogleUtilities/Environment (~> 6.7) + - GoogleUtilities/Logger (~> 6.7) + - FirebaseCoreDiagnostics (1.7.0): + - GoogleDataTransport (~> 7.4) + - GoogleUtilities/Environment (~> 6.7) + - GoogleUtilities/Logger (~> 6.7) + - nanopb (~> 1.30906.0) + - FirebaseInstallations (1.7.0): + - FirebaseCore (~> 6.10) + - GoogleUtilities/Environment (~> 6.7) + - GoogleUtilities/UserDefaults (~> 6.7) + - PromisesObjC (~> 1.2) + - FirebaseInstanceID (4.8.0): + - FirebaseCore (~> 6.10) + - FirebaseInstallations (~> 1.6) + - GoogleUtilities/Environment (~> 6.7) + - GoogleUtilities/UserDefaults (~> 6.7) + - FirebaseMessaging (4.7.1): + - FirebaseCore (~> 6.10) + - FirebaseInstanceID (~> 4.7) + - GoogleUtilities/AppDelegateSwizzler (~> 6.7) + - GoogleUtilities/Environment (~> 6.7) + - GoogleUtilities/Reachability (~> 6.7) + - GoogleUtilities/UserDefaults (~> 6.7) + - Protobuf (>= 3.9.2, ~> 3.9) - Flutter (1.0.0) - flutter_secure_storage (3.3.1): - Flutter + - GoogleDataTransport (7.5.1): + - nanopb (~> 1.30906.0) + - GoogleUtilities/AppDelegateSwizzler (6.7.2): + - GoogleUtilities/Environment + - GoogleUtilities/Logger + - GoogleUtilities/Network + - GoogleUtilities/Environment (6.7.2): + - PromisesObjC (~> 1.2) + - GoogleUtilities/Logger (6.7.2): + - GoogleUtilities/Environment + - GoogleUtilities/Network (6.7.2): + - GoogleUtilities/Logger + - "GoogleUtilities/NSData+zlib" + - GoogleUtilities/Reachability + - "GoogleUtilities/NSData+zlib (6.7.2)" + - GoogleUtilities/Reachability (6.7.2): + - GoogleUtilities/Logger + - GoogleUtilities/UserDefaults (6.7.2): + - GoogleUtilities/Logger - local_auth (0.0.1): - Flutter - MTBBarcodeScanner (5.0.11) + - nanopb (1.30906.0): + - nanopb/decode (= 1.30906.0) + - nanopb/encode (= 1.30906.0) + - nanopb/decode (1.30906.0) + - nanopb/encode (1.30906.0) - package_info (0.0.1): - Flutter - path_provider (0.0.1): - Flutter - "permission_handler (5.1.0+2)": - Flutter + - PromisesObjC (1.2.12) + - Protobuf (3.17.0) - Reachability (3.2) - SDWebImage (5.9.1): - SDWebImage/Core (= 5.9.1) @@ -97,6 +163,9 @@ DEPENDENCIES: - devicelocale (from `.symlinks/plugins/devicelocale/ios`) - esys_flutter_share (from `.symlinks/plugins/esys_flutter_share/ios`) - file_picker (from `.symlinks/plugins/file_picker/ios`) + - Firebase/Messaging (= 6.33.0) + - firebase_core (from `.symlinks/plugins/firebase_core/ios`) + - firebase_messaging (from `.symlinks/plugins/firebase_messaging/ios`) - Flutter (from `Flutter`) - flutter_secure_storage (from `.symlinks/plugins/flutter_secure_storage/ios`) - local_auth (from `.symlinks/plugins/local_auth/ios`) @@ -113,7 +182,18 @@ SPEC REPOS: - CryptoSwift - DKImagePickerController - DKPhotoGallery + - Firebase + - FirebaseCore + - FirebaseCoreDiagnostics + - FirebaseInstallations + - FirebaseInstanceID + - FirebaseMessaging + - GoogleDataTransport + - GoogleUtilities - MTBBarcodeScanner + - nanopb + - PromisesObjC + - Protobuf - Reachability - SDWebImage - SwiftProtobuf @@ -132,6 +212,10 @@ EXTERNAL SOURCES: :path: ".symlinks/plugins/esys_flutter_share/ios" file_picker: :path: ".symlinks/plugins/file_picker/ios" + firebase_core: + :path: ".symlinks/plugins/firebase_core/ios" + firebase_messaging: + :path: ".symlinks/plugins/firebase_messaging/ios" Flutter: :path: Flutter flutter_secure_storage: @@ -163,13 +247,26 @@ SPEC CHECKSUMS: DKPhotoGallery: fdfad5125a9fdda9cc57df834d49df790dbb4179 esys_flutter_share: 403498dab005b36ce1f8d7aff377e81f0621b0b4 file_picker: 3e6c3790de664ccf9b882732d9db5eaf6b8d4eb1 + Firebase: 8db6f2d1b2c5e2984efba4949a145875a8f65fe5 + firebase_core: 5d6a02f3d85acd5f8321c2d6d62877626a670659 + firebase_messaging: 0aea2cd5885b65e19ede58ee3507f485c992cc75 + FirebaseCore: d889d9e12535b7f36ac8bfbf1713a0836a3012cd + FirebaseCoreDiagnostics: 770ac5958e1372ce67959ae4b4f31d8e127c3ac1 + FirebaseInstallations: 466c7b4d1f58fe16707693091da253726a731ed2 + FirebaseInstanceID: bd3ffc24367f901a43c063b36c640b345a4a5dd1 + FirebaseMessaging: 5eca4ef173de76253352511aafef774caa1cba2a Flutter: 434fef37c0980e73bb6479ef766c45957d4b510c flutter_secure_storage: 7953c38a04c3fdbb00571bcd87d8e3b5ceb9daec + GoogleDataTransport: f56af7caa4ed338dc8e138a5d7c5973e66440833 + GoogleUtilities: 7f2f5a07f888cdb145101d6042bc4422f57e70b3 local_auth: 25938960984c3a7f6e3253e3f8d962fdd16852bd MTBBarcodeScanner: f453b33c4b7dfe545d8c6484ed744d55671788cb + nanopb: 59317e09cf1f1a0af72f12af412d54edf52603fc package_info: 873975fc26034f0b863a300ad47e7f1ac6c7ec62 path_provider: abfe2b5c733d04e238b0d8691db0cfd63a27a93c permission_handler: ccb20a9fad0ee9b1314a52b70b76b473c5f8dab0 + PromisesObjC: 3113f7f76903778cf4a0586bd1ab89329a0b7b97 + Protobuf: 7327d4444215b5f18e560a97f879ff5503c4581c Reachability: 33e18b67625424e47b6cde6d202dce689ad7af96 SDWebImage: a990c053fff71e388a10f3357edb0be17929c9c5 share: 0b2c3e82132f5888bccca3351c504d0003b3b410 @@ -179,6 +276,6 @@ SPEC CHECKSUMS: url_launcher: 6fef411d543ceb26efce54b05a0a40bfd74cbbef webview_flutter: 9f491a9b5a66f2573946a389b2677987b0ff8c0b -PODFILE CHECKSUM: 5b5f101b119a1b6eb857c967d462832a9062dec4 +PODFILE CHECKSUM: f316539722a6f9dbb0d0f1065a27fa7ea38c6f88 COCOAPODS: 1.9.3 diff --git a/ios/Runner.xcodeproj/project.pbxproj b/ios/Runner.xcodeproj/project.pbxproj index 27704e6a2..3bc5b5fb6 100644 --- a/ios/Runner.xcodeproj/project.pbxproj +++ b/ios/Runner.xcodeproj/project.pbxproj @@ -7,6 +7,7 @@ objects = { /* Begin PBXBuildFile section */ + 0C37B8B926678E9100C6E5A9 /* GoogleService-Info.plist in Resources */ = {isa = PBXBuildFile; fileRef = 0C37B8B826678E9100C6E5A9 /* GoogleService-Info.plist */; }; 0C44A71A2518EF8000B570ED /* decrypt.swift in Sources */ = {isa = PBXBuildFile; fileRef = 0C44A7192518EF8000B570ED /* decrypt.swift */; }; 0C9D68C9264854B60011B691 /* secRandom.swift in Sources */ = {isa = PBXBuildFile; fileRef = 0C9D68C8264854B60011B691 /* secRandom.swift */; }; 1498D2341E8E89220040F4C2 /* GeneratedPluginRegistrant.m in Sources */ = {isa = PBXBuildFile; fileRef = 1498D2331E8E89220040F4C2 /* GeneratedPluginRegistrant.m */; }; @@ -19,6 +20,7 @@ /* End PBXBuildFile section */ /* Begin PBXFileReference section */ + 0C37B8B826678E9100C6E5A9 /* GoogleService-Info.plist */ = {isa = PBXFileReference; lastKnownFileType = text.plist.xml; name = "GoogleService-Info.plist"; path = "Runner/GoogleService-Info.plist"; sourceTree = ""; }; 0C400E0F25B21ABB0025E469 /* Runner.entitlements */ = {isa = PBXFileReference; lastKnownFileType = text.plist.entitlements; path = Runner.entitlements; sourceTree = ""; }; 0C44A7192518EF8000B570ED /* decrypt.swift */ = {isa = PBXFileReference; lastKnownFileType = sourcecode.swift; path = decrypt.swift; sourceTree = ""; }; 0C9986A3251A932F00D566FD /* CryptoSwift.framework */ = {isa = PBXFileReference; explicitFileType = wrapper.framework; path = CryptoSwift.framework; sourceTree = BUILT_PRODUCTS_DIR; }; @@ -96,6 +98,7 @@ 97C146E51CF9000F007C117D = { isa = PBXGroup; children = ( + 0C37B8B826678E9100C6E5A9 /* GoogleService-Info.plist */, 0C44A7182518EF4A00B570ED /* CakeWallet */, 9740EEB11CF90186004384FC /* Flutter */, 97C146F01CF9000F007C117D /* Runner */, @@ -191,6 +194,7 @@ isa = PBXResourcesBuildPhase; buildActionMask = 2147483647; files = ( + 0C37B8B926678E9100C6E5A9 /* GoogleService-Info.plist in Resources */, 97C147011CF9000F007C117D /* LaunchScreen.storyboard in Resources */, 3B3967161E833CAA004F5970 /* AppFrameworkInfo.plist in Resources */, 97C146FE1CF9000F007C117D /* Assets.xcassets in Resources */, @@ -365,6 +369,7 @@ CURRENT_PROJECT_VERSION = 41; DEVELOPMENT_TEAM = 32J6BB6VUS; ENABLE_BITCODE = NO; + EXCLUDED_SOURCE_FILE_NAMES = "\"$(SRCROOT)/Runner/GoogleService-Info.plist\""; FRAMEWORK_SEARCH_PATHS = ( "$(inherited)", "$(PROJECT_DIR)/Flutter", @@ -508,6 +513,7 @@ CURRENT_PROJECT_VERSION = 41; DEVELOPMENT_TEAM = 32J6BB6VUS; ENABLE_BITCODE = NO; + EXCLUDED_SOURCE_FILE_NAMES = "\"$(SRCROOT)/Runner/GoogleService-Info.plist\""; FRAMEWORK_SEARCH_PATHS = ( "$(inherited)", "$(PROJECT_DIR)/Flutter", @@ -543,6 +549,7 @@ CURRENT_PROJECT_VERSION = 41; DEVELOPMENT_TEAM = 32J6BB6VUS; ENABLE_BITCODE = NO; + EXCLUDED_SOURCE_FILE_NAMES = "\"$(SRCROOT)/Runner/GoogleService-Info.plist\""; FRAMEWORK_SEARCH_PATHS = ( "$(inherited)", "$(PROJECT_DIR)/Flutter", diff --git a/ios/Runner/AppDelegate.swift b/ios/Runner/AppDelegate.swift index e7c300079..2a3505ef9 100644 --- a/ios/Runner/AppDelegate.swift +++ b/ios/Runner/AppDelegate.swift @@ -7,6 +7,10 @@ import Flutter _ application: UIApplication, didFinishLaunchingWithOptions launchOptions: [UIApplication.LaunchOptionsKey: Any]? ) -> Bool { + if #available(iOS 10.0, *) { + UNUserNotificationCenter.current().delegate = self as? UNUserNotificationCenterDelegate + } + let controller : FlutterViewController = window?.rootViewController as! FlutterViewController let legacyMigrationChannel = FlutterMethodChannel( name: "com.cakewallet.cakewallet/legacy_wallet_migration", diff --git a/ios/Runner/Info.plist b/ios/Runner/Info.plist index 970c892cd..267805951 100644 --- a/ios/Runner/Info.plist +++ b/ios/Runner/Info.plist @@ -37,6 +37,11 @@ Enable Face ID for fast and secure access to wallets and private keys NSPhotoLibraryUsageDescription We need access to documents folder for get acces to open/save backup file + UIBackgroundModes + + fetch + remote-notification + UILaunchStoryboardName LaunchScreen UIMainStoryboardFile diff --git a/ios/Runner/Runner.entitlements b/ios/Runner/Runner.entitlements index 0c67376eb..903def2af 100644 --- a/ios/Runner/Runner.entitlements +++ b/ios/Runner/Runner.entitlements @@ -1,5 +1,8 @@ - + + aps-environment + development + diff --git a/lib/di.dart b/lib/di.dart index cae3a068f..a84a00c88 100644 --- a/lib/di.dart +++ b/lib/di.dart @@ -113,6 +113,7 @@ import 'package:cake_wallet/store/templates/exchange_template_store.dart'; import 'package:cake_wallet/entities/template.dart'; import 'package:cake_wallet/exchange/exchange_template.dart'; import 'package:cake_wallet/.secrets.g.dart' as secrets; +import 'package:cake_wallet/entities/push_notifications_service.dart'; final getIt = GetIt.instance; @@ -232,6 +233,9 @@ Future setup( settingsStore: getIt.get(), fiatConvertationStore: getIt.get())); + + getIt.registerFactory(() => PushNotificationsService()); + getIt.registerFactory(() => DashboardViewModel( balanceViewModel: getIt.get(), appStore: getIt.get(), @@ -241,7 +245,8 @@ Future setup( settingsStore: settingsStore, ordersSource: _ordersSource, ordersStore: getIt.get(), - wyreViewModel: getIt.get())); + wyreViewModel: getIt.get(), + pushNotificationsService: getIt.get())); getIt.registerFactory(() => AuthService( secureStorage: getIt.get(), diff --git a/lib/entities/push_notifications_service.dart b/lib/entities/push_notifications_service.dart new file mode 100644 index 000000000..5fe69153c --- /dev/null +++ b/lib/entities/push_notifications_service.dart @@ -0,0 +1,45 @@ +import 'dart:io'; +import 'package:cake_wallet/main.dart'; +import 'package:cake_wallet/utils/show_bar.dart'; +import 'package:firebase_messaging/firebase_messaging.dart'; + +class PushNotificationsService { + PushNotificationsService._(); + + factory PushNotificationsService() => _instance; + + static final PushNotificationsService _instance = PushNotificationsService._(); + static Future _onBackgroundMessage(Map message) async {} + final _firebaseMessaging = FirebaseMessaging(); + bool _initialized = false; + + Future init() async { + if (_initialized) { + return; + } + + _firebaseMessaging.requestNotificationPermissions(); + _firebaseMessaging.configure( + onMessage: (message) async { + Map alert = {}; + String msg = ''; + String title = ''; + + if (Platform.isIOS) { + alert = message['aps']['alert'] as Map ?? {}; + msg = alert['body'] as String ?? ''; + title = alert['title'] as String ?? ''; + } + + if (Platform.isAndroid) { + msg = message['notification']['body'] as String ?? ''; + title = message['notification']['title'] as String ?? ''; + } + + await showBar(navigatorKey.currentContext, msg, titleText: title, duration: null); + }, + onBackgroundMessage: _onBackgroundMessage); + + _initialized = true; + } +} \ No newline at end of file diff --git a/lib/src/screens/dashboard/widgets/balance_page.dart b/lib/src/screens/dashboard/widgets/balance_page.dart index 1cd17d4c0..2498e2d5c 100644 --- a/lib/src/screens/dashboard/widgets/balance_page.dart +++ b/lib/src/screens/dashboard/widgets/balance_page.dart @@ -1,5 +1,6 @@ import 'package:flutter/material.dart'; import 'package:cake_wallet/view_model/dashboard/dashboard_view_model.dart'; +import 'package:flutter/scheduler.dart'; import 'package:flutter_mobx/flutter_mobx.dart'; import 'package:auto_size_text/auto_size_text.dart'; diff --git a/lib/utils/show_bar.dart b/lib/utils/show_bar.dart index 8d2355e4f..64231b438 100644 --- a/lib/utils/show_bar.dart +++ b/lib/utils/show_bar.dart @@ -2,8 +2,11 @@ import 'package:flushbar/flushbar.dart'; import 'package:flutter/cupertino.dart'; import 'package:flutter/material.dart'; -Future showBar(BuildContext context, String text, - {bool isDark = false, Duration duration = const Duration(seconds: 1), bool isDismissible = true}) { +Future showBar(BuildContext context, String messageText, + {bool isDark = false, + Duration duration = const Duration(seconds: 1), + bool isDismissible = true, + String titleText}) { final bar = Flushbar( boxShadows: [ BoxShadow( @@ -14,9 +17,14 @@ Future showBar(BuildContext context, String text, backgroundColor: isDark ? Colors.black : Colors.white, borderRadius: 35, margin: EdgeInsets.all(50), - messageText: Text(text, + titleText: titleText != null + ? Text(titleText, + textAlign: TextAlign.center, + style: TextStyle(color: isDark ? Colors.white : Colors.black, fontWeight: FontWeight.bold, fontSize: 24.0)) + : null, + messageText: Text(messageText, textAlign: TextAlign.center, - style: TextStyle(color: isDark ? Colors.white : Colors.black)), + style: TextStyle(color: isDark ? Colors.white : Colors.black, fontSize: 16)), duration: duration, isDismissible: isDismissible, flushbarPosition: FlushbarPosition.TOP, diff --git a/lib/view_model/dashboard/dashboard_view_model.dart b/lib/view_model/dashboard/dashboard_view_model.dart index 97ed234e6..90fbe4940 100644 --- a/lib/view_model/dashboard/dashboard_view_model.dart +++ b/lib/view_model/dashboard/dashboard_view_model.dart @@ -1,6 +1,7 @@ import 'package:cake_wallet/core/transaction_history.dart'; import 'package:cake_wallet/entities/balance.dart'; import 'package:cake_wallet/entities/order.dart'; +import 'package:cake_wallet/entities/push_notifications_service.dart'; import 'package:cake_wallet/monero/account.dart'; import 'package:cake_wallet/monero/monero_balance.dart'; import 'package:cake_wallet/monero/monero_transaction_info.dart'; @@ -44,7 +45,9 @@ abstract class DashboardViewModelBase with Store { this.settingsStore, this.ordersSource, this.ordersStore, - this.wyreViewModel}) { + this.wyreViewModel, + PushNotificationsService pushNotificationsService}) { + _pushNotificationsService = pushNotificationsService; filterItems = { S.current.transactions: [ FilterItem( @@ -133,6 +136,8 @@ abstract class DashboardViewModelBase with Store { return true; }); + + Future.delayed(Duration(seconds: 2), () => _pushNotificationsService.init()); } @observable @@ -227,18 +232,20 @@ abstract class DashboardViewModelBase with Store { bool get isBuyEnabled => settingsStore.isBitcoinBuyEnabled; + PushNotificationsService _pushNotificationsService; + ReactionDisposer _onMoneroAccountChangeReaction; ReactionDisposer _onMoneroBalanceChangeReaction; + @observable + bool isOutdatedElectrumWallet; + Future reconnect() async { final node = appStore.settingsStore.getCurrentNode(wallet.type); await wallet.connectToNode(node: node); } - @observable - bool isOutdatedElectrumWallet; - @action void _onWalletChange( WalletBase, diff --git a/pubspec.lock b/pubspec.lock index 3ff596074..28474d35c 100644 --- a/pubspec.lock +++ b/pubspec.lock @@ -70,7 +70,7 @@ packages: path: "." ref: cake resolved-ref: "02fef082f20af13de00b4e64efb93a2c1e5e1cf2" - url: "git@github.com:cake-tech/bech32.git" + url: "https://github.com/cake-tech/bech32.git" source: git version: "0.2.0" bip32: @@ -92,8 +92,8 @@ packages: description: path: "." ref: cake - resolved-ref: b3ab2926c665f0e68b74a4a5f31059f7fcd817b7 - url: "git@github.com:cake-tech/bitcoin_flutter.git" + resolved-ref: cbabfd87b6ce3cae6051a3e86ddb56e7a934e188 + url: "https://github.com/cake-tech/bitcoin_flutter.git" source: git version: "2.0.2" boolean_selector: @@ -362,6 +362,34 @@ packages: url: "https://pub.dartlang.org" source: hosted version: "3.0.0-nullsafety.2" + firebase_core: + dependency: transitive + description: + name: firebase_core + url: "https://pub.dartlang.org" + source: hosted + version: "0.5.3" + firebase_core_platform_interface: + dependency: transitive + description: + name: firebase_core_platform_interface + url: "https://pub.dartlang.org" + source: hosted + version: "2.1.0" + firebase_core_web: + dependency: transitive + description: + name: firebase_core_web + url: "https://pub.dartlang.org" + source: hosted + version: "0.2.1+1" + firebase_messaging: + dependency: "direct main" + description: + name: firebase_messaging + url: "https://pub.dartlang.org" + source: hosted + version: "7.0.3" fixnum: dependency: transitive description: diff --git a/pubspec.yaml b/pubspec.yaml index 1fad1c4d9..352bb24bd 100644 --- a/pubspec.yaml +++ b/pubspec.yaml @@ -78,6 +78,7 @@ dependencies: file_picker: ^3.0.0-nullsafety.2 unorm_dart: ^0.2.0 permission_handler: ^5.0.1+1 + firebase_messaging: ^7.0.3 dev_dependencies: flutter_test: From 6ac8dabf87a8402bbc548367251680a83f077564 Mon Sep 17 00:00:00 2001 From: OleksandrSobol Date: Mon, 7 Jun 2021 14:28:53 +0300 Subject: [PATCH 8/9] CAKE-306 | fixed onEnabled() method in the moonpay_buy_provider.dart --- lib/buy/moonpay/moonpay_buy_provider.dart | 18 +++++------------- lib/di.dart | 10 ++++------ lib/store/settings_store.dart | 10 ++++------ 3 files changed, 13 insertions(+), 25 deletions(-) diff --git a/lib/buy/moonpay/moonpay_buy_provider.dart b/lib/buy/moonpay/moonpay_buy_provider.dart index 22b349c79..65effe483 100644 --- a/lib/buy/moonpay/moonpay_buy_provider.dart +++ b/lib/buy/moonpay/moonpay_buy_provider.dart @@ -23,7 +23,7 @@ class MoonPayBuyProvider extends BuyProvider { static const _currenciesSuffix = '/v3/currencies'; static const _quoteSuffix = '/buy_quote'; static const _transactionsSuffix = '/v1/transactions'; - static const _countrySuffix = '/v3/countries'; + static const _ipAddressSuffix = '/v4/ip_address'; static const _apiKey = secrets.moonPayApiKey; static const _secretKey = secrets.moonPaySecretKey; @@ -125,23 +125,15 @@ class MoonPayBuyProvider extends BuyProvider { ); } - static Future onEnabled(String deviceCountryCode) async { - final url = _apiUrl + _countrySuffix; + static Future onEnabled() async { + final url = _apiUrl + _ipAddressSuffix + '?apiKey=' + _apiKey; var isBuyEnable = false; final response = await get(url); try { - final responseJSON = json.decode(response.body) as List; - - for (var element in responseJSON) { - final countryMap = element as Map; - final countryCode = countryMap['alpha2'] as String; - if (countryCode == deviceCountryCode) { - isBuyEnable = countryMap['isBuyAllowed'] as bool; - break; - } - } + final responseJSON = json.decode(response.body) as Map; + isBuyEnable = responseJSON['isBuyAllowed'] as bool; } catch (e) { isBuyEnable = false; print(e.toString()); diff --git a/lib/di.dart b/lib/di.dart index b5bb7bfd3..a4e922f7c 100644 --- a/lib/di.dart +++ b/lib/di.dart @@ -155,19 +155,17 @@ Future setup( (secrets.wyreApiKey?.isNotEmpty ?? false) && (secrets.wyreAccountId?.isNotEmpty ?? false); - /*var isMoonPayEnabled = false; + var isMoonPayEnabled = false; try { - final locale = await Devicelocale.currentLocale; - final deviceCountryCode = locale.split('_').last; - isMoonPayEnabled = await MoonPayBuyProvider.onEnabled(deviceCountryCode); + isMoonPayEnabled = await MoonPayBuyProvider.onEnabled(); } catch (e) { isMoonPayEnabled = false; print(e.toString()); - }*/ + } final settingsStore = await SettingsStoreBase.load( nodeSource: _nodeSource, isBitcoinBuyEnabled: isBitcoinBuyEnabled, - isMoonPayEnabled: true); + isMoonPayEnabled: isMoonPayEnabled); if (_isSetupFinished) { return; diff --git a/lib/store/settings_store.dart b/lib/store/settings_store.dart index 207a731c9..206c3141b 100644 --- a/lib/store/settings_store.dart +++ b/lib/store/settings_store.dart @@ -253,20 +253,18 @@ abstract class SettingsStoreBase with Store { (secrets.wyreApiKey?.isNotEmpty ?? false) && (secrets.wyreAccountId?.isNotEmpty ?? false); - /*var isMoonPayEnabled = false; + var isMoonPayEnabled = false; try { - final locale = await Devicelocale.currentLocale; - final deviceCountryCode = locale.split('_').last; - isMoonPayEnabled = await MoonPayBuyProvider.onEnabled(deviceCountryCode); + isMoonPayEnabled = await MoonPayBuyProvider.onEnabled(); } catch (e) { isMoonPayEnabled = false; print(e.toString()); - }*/ + } final settings = await SettingsStoreBase.load( nodeSource: nodeSource, isBitcoinBuyEnabled: isBitcoinBuyEnabled, - isMoonPayEnabled: true, + isMoonPayEnabled: isMoonPayEnabled, initialBalanceDisplayMode: initialBalanceDisplayMode, initialFiatCurrency: initialFiatCurrency, initialMoneroTransactionPriority: initialMoneroTransactionPriority, From d5d1afd89b62344332e0c2473d7154267041d41f Mon Sep 17 00:00:00 2001 From: OleksandrSobol Date: Mon, 7 Jun 2021 16:40:25 +0300 Subject: [PATCH 9/9] CAKE-306 | merged main branch into current; added _fetchBuyItems() method to buy_view_model.dart; deleted isMoonPayEnabled parameter from settings_store.dart --- lib/di.dart | 14 +-------- lib/entities/push_notifications_service.dart | 2 +- lib/store/settings_store.dart | 16 ---------- lib/view_model/buy/buy_view_model.dart | 31 +++++++++++++------- res/values/strings_hr.arb | 2 ++ res/values/strings_it.arb | 2 ++ 6 files changed, 27 insertions(+), 40 deletions(-) diff --git a/lib/di.dart b/lib/di.dart index eda81d899..0de43a76e 100644 --- a/lib/di.dart +++ b/lib/di.dart @@ -1,11 +1,9 @@ import 'package:cake_wallet/bitcoin/bitcoin_wallet_service.dart'; import 'package:cake_wallet/bitcoin/litecoin_wallet_service.dart'; -import 'package:cake_wallet/buy/moonpay/moonpay_buy_provider.dart'; import 'package:cake_wallet/core/backup_service.dart'; import 'package:cake_wallet/core/wallet_service.dart'; import 'package:cake_wallet/entities/biometric_auth.dart'; import 'package:cake_wallet/entities/contact_record.dart'; -import 'package:cake_wallet/entities/load_current_wallet.dart'; import 'package:cake_wallet/buy/order.dart'; import 'package:cake_wallet/entities/transaction_description.dart'; import 'package:cake_wallet/entities/transaction_info.dart'; @@ -92,7 +90,6 @@ import 'package:cake_wallet/view_model/wallet_list/wallet_list_view_model.dart'; import 'package:cake_wallet/view_model/wallet_restore_view_model.dart'; import 'package:cake_wallet/view_model/wallet_seed_view_model.dart'; import 'package:cake_wallet/view_model/exchange/exchange_view_model.dart'; -import 'package:devicelocale/devicelocale.dart'; import 'package:flutter/widgets.dart'; import 'package:get_it/get_it.dart'; import 'package:hive/hive.dart'; @@ -156,17 +153,8 @@ Future setup( (secrets.wyreApiKey?.isNotEmpty ?? false) && (secrets.wyreAccountId?.isNotEmpty ?? false); - var isMoonPayEnabled = false; - try { - isMoonPayEnabled = await MoonPayBuyProvider.onEnabled(); - } catch (e) { - isMoonPayEnabled = false; - print(e.toString()); - } - final settingsStore = await SettingsStoreBase.load( - nodeSource: _nodeSource, isBitcoinBuyEnabled: isBitcoinBuyEnabled, - isMoonPayEnabled: isMoonPayEnabled); + nodeSource: _nodeSource, isBitcoinBuyEnabled: isBitcoinBuyEnabled); if (_isSetupFinished) { return; diff --git a/lib/entities/push_notifications_service.dart b/lib/entities/push_notifications_service.dart index 5fe69153c..5fb68bae4 100644 --- a/lib/entities/push_notifications_service.dart +++ b/lib/entities/push_notifications_service.dart @@ -21,7 +21,7 @@ class PushNotificationsService { _firebaseMessaging.requestNotificationPermissions(); _firebaseMessaging.configure( onMessage: (message) async { - Map alert = {}; + Map alert = {}; String msg = ''; String title = ''; diff --git a/lib/store/settings_store.dart b/lib/store/settings_store.dart index 206c3141b..66124a108 100644 --- a/lib/store/settings_store.dart +++ b/lib/store/settings_store.dart @@ -1,5 +1,4 @@ import 'package:cake_wallet/bitcoin/bitcoin_transaction_priority.dart'; -import 'package:cake_wallet/buy/moonpay/moonpay_buy_provider.dart'; import 'package:cake_wallet/entities/preferences_key.dart'; import 'package:cake_wallet/entities/transaction_priority.dart'; import 'package:cake_wallet/themes/theme_base.dart'; @@ -9,7 +8,6 @@ import 'package:flutter/material.dart'; import 'package:hive/hive.dart'; import 'package:mobx/mobx.dart'; import 'package:package_info/package_info.dart'; -import 'package:devicelocale/devicelocale.dart'; import 'package:cake_wallet/di.dart'; import 'package:cake_wallet/entities/wallet_type.dart'; import 'package:shared_preferences/shared_preferences.dart'; @@ -41,7 +39,6 @@ abstract class SettingsStoreBase with Store { @required TransactionPriority initialBitcoinTransactionPriority, @required TransactionPriority initialMoneroTransactionPriority, @required this.isBitcoinBuyEnabled, - @required this.isMoonPayEnabled, this.actionlistDisplayMode}) { fiatCurrency = initialFiatCurrency; balanceDisplayMode = initialBalanceDisplayMode; @@ -150,12 +147,9 @@ abstract class SettingsStoreBase with Store { bool isBitcoinBuyEnabled; - bool isMoonPayEnabled; - static Future load( {@required Box nodeSource, @required bool isBitcoinBuyEnabled, - @required bool isMoonPayEnabled, FiatCurrency initialFiatCurrency = FiatCurrency.usd, MoneroTransactionPriority initialMoneroTransactionPriority = MoneroTransactionPriority.slow, @@ -227,7 +221,6 @@ abstract class SettingsStoreBase with Store { }, appVersion: packageInfo.version, isBitcoinBuyEnabled: isBitcoinBuyEnabled, - isMoonPayEnabled: isMoonPayEnabled, initialFiatCurrency: currentFiatCurrency, initialBalanceDisplayMode: currentBalanceDisplayMode, initialSaveRecipientAddress: shouldSaveRecipientAddress, @@ -253,18 +246,9 @@ abstract class SettingsStoreBase with Store { (secrets.wyreApiKey?.isNotEmpty ?? false) && (secrets.wyreAccountId?.isNotEmpty ?? false); - var isMoonPayEnabled = false; - try { - isMoonPayEnabled = await MoonPayBuyProvider.onEnabled(); - } catch (e) { - isMoonPayEnabled = false; - print(e.toString()); - } - final settings = await SettingsStoreBase.load( nodeSource: nodeSource, isBitcoinBuyEnabled: isBitcoinBuyEnabled, - isMoonPayEnabled: isMoonPayEnabled, initialBalanceDisplayMode: initialBalanceDisplayMode, initialFiatCurrency: initialFiatCurrency, initialMoneroTransactionPriority: initialMoneroTransactionPriority, diff --git a/lib/view_model/buy/buy_view_model.dart b/lib/view_model/buy/buy_view_model.dart index 68afb9577..95739edd0 100644 --- a/lib/view_model/buy/buy_view_model.dart +++ b/lib/view_model/buy/buy_view_model.dart @@ -21,15 +21,9 @@ class BuyViewModel = BuyViewModelBase with _$BuyViewModel; abstract class BuyViewModelBase with Store { BuyViewModelBase(this.ordersSource, this.ordersStore, this.settingsStore, this.buyAmountViewModel, {@required this.wallet}) { - providerList = [WyreBuyProvider(wallet: wallet)]; - if (settingsStore.isMoonPayEnabled ?? false) { - providerList.add(MoonPayBuyProvider(wallet: wallet)); - } + _fetchBuyItems(); - items = providerList.map((provider) => - BuyItem(provider: provider, buyAmountViewModel: buyAmountViewModel)) - .toList(); isRunning = false; isDisabled = true; isShowProviderButtons = false; @@ -41,9 +35,6 @@ abstract class BuyViewModelBase with Store { final BuyAmountViewModel buyAmountViewModel; final WalletBase wallet; - @observable - List providerList; - @observable BuyProvider selectedProvider; @@ -96,4 +87,24 @@ abstract class BuyViewModelBase with Store { buyAmountViewModel.amount = ''; selectedProvider = null; } + + Future _fetchBuyItems() async { + final List _providerList = [WyreBuyProvider(wallet: wallet)]; + + var isMoonPayEnabled = false; + try { + isMoonPayEnabled = await MoonPayBuyProvider.onEnabled(); + } catch (e) { + isMoonPayEnabled = false; + print(e.toString()); + } + + if (isMoonPayEnabled) { + _providerList.add(MoonPayBuyProvider(wallet: wallet)); + } + + items = _providerList.map((provider) => + BuyItem(provider: provider, buyAmountViewModel: buyAmountViewModel)) + .toList(); + } } \ No newline at end of file diff --git a/res/values/strings_hr.arb b/res/values/strings_hr.arb index 0eb24134c..1d3233d0e 100644 --- a/res/values/strings_hr.arb +++ b/res/values/strings_hr.arb @@ -478,5 +478,7 @@ "apk_update" : "APK ažuriranje", + "buy_bitcoin" : "Kupite Bitcoin", + "buy_with" : "Kupite s", "moonpay_alert_text" : "Vrijednost iznosa mora biti veća ili jednaka ${minAmount} ${fiatCurrency}" } \ No newline at end of file diff --git a/res/values/strings_it.arb b/res/values/strings_it.arb index 7f8dc6499..00d88efd8 100644 --- a/res/values/strings_it.arb +++ b/res/values/strings_it.arb @@ -478,5 +478,7 @@ "apk_update" : "Aggiornamento APK", + "buy_bitcoin" : "Acquista Bitcoin", + "buy_with" : "Acquista con", "moonpay_alert_text" : "Il valore dell'importo deve essere maggiore o uguale a ${minAmount} ${fiatCurrency}" } \ No newline at end of file