diff --git a/lib/src/screens/dashboard/dashboard_page.dart b/lib/src/screens/dashboard/dashboard_page.dart index 172483ed0..400b34060 100644 --- a/lib/src/screens/dashboard/dashboard_page.dart +++ b/lib/src/screens/dashboard/dashboard_page.dart @@ -1,7 +1,9 @@ import 'package:cake_wallet/entities/wallet_type.dart'; import 'package:cake_wallet/generated/i18n.dart'; import 'package:cake_wallet/routes.dart'; +import 'package:cake_wallet/src/widgets/alert_with_one_action.dart'; import 'package:cake_wallet/themes/theme_base.dart'; +import 'package:cake_wallet/utils/show_pop_up.dart'; import 'package:flutter/material.dart'; import 'package:flutter/cupertino.dart'; import 'package:cake_wallet/view_model/dashboard/dashboard_view_model.dart'; @@ -42,7 +44,7 @@ class DashboardPage extends BasePage { child: scaffold); @override - bool get resizeToAvoidBottomPadding => false; + bool get resizeToAvoidBottomInset => false; @override Widget get endDrawer => MenuWidget(walletViewModel); @@ -114,7 +116,7 @@ class DashboardPage extends BasePage { )), Container( padding: EdgeInsets.only(left: 45, right: 45, bottom: 24), - child: Observer(builder: (_) => Row( + child: Row( mainAxisAlignment: MainAxisAlignment.spaceAround, children: [ ActionButton( @@ -125,7 +127,7 @@ class DashboardPage extends BasePage { image: exchangeImage, title: S.of(context).exchange, route: Routes.exchange), - if (walletViewModel.type == WalletType.bitcoin) Observer( + Observer( builder: (_) => Stack( clipBehavior: Clip.none, alignment: Alignment.topCenter, @@ -143,23 +145,11 @@ class DashboardPage extends BasePage { title: S.of(context).buy, onClick: walletViewModel.isRunningWebView ? null - : () async { - try { - walletViewModel.isRunningWebView = true; - final url = - await walletViewModel.wyreViewModel.wyreUrl; - await Navigator.of(context) - .pushNamed(Routes.wyre, arguments: url); - walletViewModel.isRunningWebView = false; - } catch(e) { - print(e.toString()); - walletViewModel.isRunningWebView = false; - } - }) + : () async => await _onClickBuyButton(context)) ], )), ], - )), + ), ) ], )); @@ -176,4 +166,32 @@ class DashboardPage extends BasePage { _isEffectsInstalled = true; } + + Future _onClickBuyButton(BuildContext context) async { + final walletType = walletViewModel.type; + + switch (walletType) { + case WalletType.monero: + await showPopUp( + context: context, + builder: (BuildContext context) { + return AlertWithOneAction( + alertTitle: S.of(context).buy, + alertContent: S.of(context).buy_alert_content, + buttonText: S.of(context).ok, + buttonAction: () => Navigator.of(context).pop()); + }); + break; + default: + try { + walletViewModel.isRunningWebView = true; + final url = await walletViewModel.wyreViewModel.wyreUrl; + await Navigator.of(context).pushNamed(Routes.wyre, arguments: url); + walletViewModel.isRunningWebView = false; + } catch(_) { + walletViewModel.isRunningWebView = false; + } + break; + } + } } diff --git a/res/values/strings_de.arb b/res/values/strings_de.arb index 3059a1f81..c9836f13b 100644 --- a/res/values/strings_de.arb +++ b/res/values/strings_de.arb @@ -469,5 +469,7 @@ "unconfirmed" : "Unbestätigt", "displayable" : "Anzeigebar", - "submit_request" : "Einen Antrag stellen" + "submit_request" : "Einen Antrag stellen", + + "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" } \ No newline at end of file diff --git a/res/values/strings_en.arb b/res/values/strings_en.arb index 181af4809..2364bca10 100644 --- a/res/values/strings_en.arb +++ b/res/values/strings_en.arb @@ -469,5 +469,7 @@ "unconfirmed" : "Unconfirmed", "displayable" : "Displayable", - "submit_request" : "submit a request" + "submit_request" : "submit a request", + + "buy_alert_content" : "Currently we only support the purchase of Bitcoin. To buy Bitcoin, please create or switch to your Bitcoin wallet" } \ No newline at end of file diff --git a/res/values/strings_es.arb b/res/values/strings_es.arb index 80247191a..a57886fe8 100644 --- a/res/values/strings_es.arb +++ b/res/values/strings_es.arb @@ -469,5 +469,7 @@ "unconfirmed" : "Inconfirmado", "displayable" : "Visualizable", - "submit_request" : "presentar una solicitud" + "submit_request" : "presentar una solicitud", + + "buy_alert_content" : "Actualmente solo apoyamos la compra de Bitcoin. Para comprar Bitcoin, cree o cambie a su billetera Bitcoin" } \ No newline at end of file diff --git a/res/values/strings_hi.arb b/res/values/strings_hi.arb index 09188bd8d..852e249c9 100644 --- a/res/values/strings_hi.arb +++ b/res/values/strings_hi.arb @@ -469,5 +469,7 @@ "unconfirmed" : "अपुष्ट", "displayable" : "प्रदर्शन योग्य", - "submit_request" : "एक अनुरोध सबमिट करें" + "submit_request" : "एक अनुरोध सबमिट करें", + + "buy_alert_content" : "वर्तमान में हम केवल बिटकॉइन की खरीद का समर्थन करते हैं। बिटकॉइन खरीदने के लिए, कृपया अपना बिटकॉइन वॉलेट बनाएं या स्विच करें" } \ No newline at end of file diff --git a/res/values/strings_ja.arb b/res/values/strings_ja.arb index 0ac0d33cc..0df4e9dda 100644 --- a/res/values/strings_ja.arb +++ b/res/values/strings_ja.arb @@ -469,5 +469,7 @@ "unconfirmed" : "未確認", "displayable" : "表示可能", - "submit_request" : "リクエストを送信する" + "submit_request" : "リクエストを送信する", + + "buy_alert_content" : "現在、ビットコインの購入のみをサポートしています。 ビットコインを購入するには、ビットコインウォレットを作成するか切り替えてください" } \ No newline at end of file diff --git a/res/values/strings_ko.arb b/res/values/strings_ko.arb index 64dcdee49..ade3cc847 100644 --- a/res/values/strings_ko.arb +++ b/res/values/strings_ko.arb @@ -469,5 +469,7 @@ "unconfirmed" : "미확인", "displayable" : "표시 가능", - "submit_request" : "요청을 제출" + "submit_request" : "요청을 제출", + + "buy_alert_content" : "현재 우리는 비트 코인 구매 만 지원합니다. 비트 코인을 구매하려면 비트 코인 지갑을 생성하거나 전환하십시오" } \ No newline at end of file diff --git a/res/values/strings_nl.arb b/res/values/strings_nl.arb index abcef001a..8f50f7102 100644 --- a/res/values/strings_nl.arb +++ b/res/values/strings_nl.arb @@ -469,5 +469,7 @@ "unconfirmed" : "Niet bevestigd", "displayable" : "Weer te geven", - "submit_request" : "een verzoek indienen" + "submit_request" : "een verzoek indienen", + + "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" } \ No newline at end of file diff --git a/res/values/strings_pl.arb b/res/values/strings_pl.arb index ab83b9760..84a8ba338 100644 --- a/res/values/strings_pl.arb +++ b/res/values/strings_pl.arb @@ -469,5 +469,7 @@ "unconfirmed" : "Niepotwierdzony", "displayable" : "Wyświetlane", - "submit_request" : "złożyć wniosek" + "submit_request" : "złożyć wniosek", + + "buy_alert_content" : "Obecnie obsługujemy tylko zakup Bitcoinów. Aby kupić Bitcoin, utwórz lub przełącz się na swój portfel Bitcoin" } \ No newline at end of file diff --git a/res/values/strings_pt.arb b/res/values/strings_pt.arb index baaf4642c..18a5ad9b5 100644 --- a/res/values/strings_pt.arb +++ b/res/values/strings_pt.arb @@ -469,5 +469,7 @@ "unconfirmed" : "Não confirmado", "displayable" : "Exibível", - "submit_request" : "enviar um pedido" + "submit_request" : "enviar um pedido", + + "buy_alert_content" : "Atualmente, apoiamos apenas a compra de Bitcoin. Para comprar Bitcoin, crie ou mude para sua carteira Bitcoin" } \ No newline at end of file diff --git a/res/values/strings_ru.arb b/res/values/strings_ru.arb index f23c8010a..711d4fa07 100644 --- a/res/values/strings_ru.arb +++ b/res/values/strings_ru.arb @@ -469,5 +469,7 @@ "unconfirmed" : "Неподтвержденный", "displayable" : "Отображаемый", - "submit_request" : "отправить запрос" + "submit_request" : "отправить запрос", + + "buy_alert_content" : "В настоящее время мы поддерживаем только покупку Bitcoin. Чтобы купить Bitcoin, создайте или переключитесь на ваш Bitcoin кошелек" } \ No newline at end of file diff --git a/res/values/strings_uk.arb b/res/values/strings_uk.arb index c699574d1..46c82da58 100644 --- a/res/values/strings_uk.arb +++ b/res/values/strings_uk.arb @@ -469,5 +469,7 @@ "unconfirmed" : "Непідтверджений", "displayable" : "Відображуваний", - "submit_request" : "надіслати запит" + "submit_request" : "надіслати запит", + + "buy_alert_content" : "На даний час ми підтримуємо тільки покупку Bitcoin. Щоб купити Bitcoin, будь ласка, створіть або переключіться на ваш Bitcoin гаманець" } \ No newline at end of file diff --git a/res/values/strings_zh.arb b/res/values/strings_zh.arb index 27a27b910..cff7833b1 100644 --- a/res/values/strings_zh.arb +++ b/res/values/strings_zh.arb @@ -467,6 +467,6 @@ "confirmed" : "已确认", "unconfirmed" : "未经证实", "displayable" : "可显示", - - "submit_request" : "提交请求" + "submit_request" : "提交请求", + "buy_alert_content" : "目前,我們僅支持購買比特幣。 要購買比特幣,請創建或切換到您的比特幣錢包" } \ No newline at end of file