mirror of
https://github.com/Such-Software/hash-wallet.git
synced 2026-12-01 12:04:21 +01:00
Fixes for LTC and added banner for old bitcoin electrum wallets.
This commit is contained in:
@@ -16,6 +16,7 @@ import 'package:cake_wallet/src/screens/dashboard/widgets/transactions_page.dart
|
||||
import 'package:cake_wallet/src/screens/dashboard/widgets/sync_indicator.dart';
|
||||
import 'package:cake_wallet/view_model/wallet_address_list/wallet_address_list_view_model.dart';
|
||||
import 'package:flutter_mobx/flutter_mobx.dart';
|
||||
import 'package:mobx/mobx.dart';
|
||||
import 'package:smooth_page_indicator/smooth_page_indicator.dart';
|
||||
import 'package:flutter_spinkit/flutter_spinkit.dart';
|
||||
|
||||
@@ -26,8 +27,8 @@ class DashboardPage extends BasePage {
|
||||
});
|
||||
|
||||
@override
|
||||
Color get backgroundLightColor => currentTheme.type == ThemeType.bright
|
||||
? Colors.transparent : Colors.white;
|
||||
Color get backgroundLightColor =>
|
||||
currentTheme.type == ThemeType.bright ? Colors.transparent : Colors.white;
|
||||
|
||||
@override
|
||||
Color get backgroundDarkColor => Colors.transparent;
|
||||
@@ -56,9 +57,8 @@ class DashboardPage extends BasePage {
|
||||
|
||||
@override
|
||||
Widget trailing(BuildContext context) {
|
||||
final menuButton =
|
||||
Image.asset('assets/images/menu.png',
|
||||
color: Theme.of(context).accentTextTheme.display3.backgroundColor);
|
||||
final menuButton = Image.asset('assets/images/menu.png',
|
||||
color: Theme.of(context).accentTextTheme.display3.backgroundColor);
|
||||
|
||||
return Container(
|
||||
alignment: Alignment.centerRight,
|
||||
@@ -81,15 +81,18 @@ class DashboardPage extends BasePage {
|
||||
@override
|
||||
Widget body(BuildContext context) {
|
||||
final sendImage = Image.asset('assets/images/upload.png',
|
||||
height: 22.24, width: 24,
|
||||
height: 22.24,
|
||||
width: 24,
|
||||
color: Theme.of(context).accentTextTheme.display3.backgroundColor);
|
||||
final exchangeImage = Image.asset('assets/images/transfer.png',
|
||||
height: 24.27, width: 22.25,
|
||||
height: 24.27,
|
||||
width: 22.25,
|
||||
color: Theme.of(context).accentTextTheme.display3.backgroundColor);
|
||||
final buyImage = Image.asset('assets/images/coins.png',
|
||||
height: 22.24, width: 24,
|
||||
height: 22.24,
|
||||
width: 24,
|
||||
color: Theme.of(context).accentTextTheme.display3.backgroundColor);
|
||||
_setEffects();
|
||||
_setEffects(context);
|
||||
|
||||
return SafeArea(
|
||||
child: Column(
|
||||
@@ -111,7 +114,9 @@ class DashboardPage extends BasePage {
|
||||
dotWidth: 6.0,
|
||||
dotHeight: 6.0,
|
||||
dotColor: Theme.of(context).indicatorColor,
|
||||
activeDotColor: Theme.of(context).accentTextTheme.display1
|
||||
activeDotColor: Theme.of(context)
|
||||
.accentTextTheme
|
||||
.display1
|
||||
.backgroundColor),
|
||||
)),
|
||||
Container(
|
||||
@@ -129,25 +134,27 @@ class DashboardPage extends BasePage {
|
||||
route: Routes.exchange),
|
||||
Observer(
|
||||
builder: (_) => Stack(
|
||||
clipBehavior: Clip.none,
|
||||
alignment: Alignment.topCenter,
|
||||
children: [
|
||||
if (walletViewModel.isRunningWebView) Positioned(
|
||||
top: -5,
|
||||
child: SpinKitRing(
|
||||
color: Theme.of(context).buttonColor,
|
||||
lineWidth: 3,
|
||||
size: 70.0,
|
||||
),
|
||||
),
|
||||
ActionButton(
|
||||
image: buyImage,
|
||||
title: S.of(context).buy,
|
||||
onClick: walletViewModel.isRunningWebView
|
||||
? null
|
||||
: () async => await _onClickBuyButton(context))
|
||||
],
|
||||
)),
|
||||
clipBehavior: Clip.none,
|
||||
alignment: Alignment.topCenter,
|
||||
children: [
|
||||
if (walletViewModel.isRunningWebView)
|
||||
Positioned(
|
||||
top: -5,
|
||||
child: SpinKitRing(
|
||||
color: Theme.of(context).buttonColor,
|
||||
lineWidth: 3,
|
||||
size: 70.0,
|
||||
),
|
||||
),
|
||||
ActionButton(
|
||||
image: buyImage,
|
||||
title: S.of(context).buy,
|
||||
onClick: walletViewModel.isRunningWebView
|
||||
? null
|
||||
: () async =>
|
||||
await _onClickBuyButton(context))
|
||||
],
|
||||
)),
|
||||
],
|
||||
),
|
||||
)
|
||||
@@ -155,7 +162,7 @@ class DashboardPage extends BasePage {
|
||||
));
|
||||
}
|
||||
|
||||
void _setEffects() {
|
||||
void _setEffects(BuildContext context) {
|
||||
if (_isEffectsInstalled) {
|
||||
return;
|
||||
}
|
||||
@@ -164,14 +171,42 @@ class DashboardPage extends BasePage {
|
||||
pages.add(BalancePage(dashboardViewModel: walletViewModel));
|
||||
pages.add(TransactionsPage(dashboardViewModel: walletViewModel));
|
||||
|
||||
autorun((_) async {
|
||||
if (!walletViewModel.isOutdatedElectrumWallet) {
|
||||
return;
|
||||
}
|
||||
|
||||
await Future<void>.delayed(Duration(seconds: 1));
|
||||
await showPopUp<void>(
|
||||
context: context,
|
||||
builder: (BuildContext context) {
|
||||
return AlertWithOneAction(
|
||||
alertTitle: S.of(context).pre_seed_title,
|
||||
alertContent:
|
||||
S.of(context).outdated_electrum_wallet_desceription,
|
||||
buttonText: S.of(context).understand,
|
||||
buttonAction: () => Navigator.of(context).pop());
|
||||
});
|
||||
});
|
||||
|
||||
_isEffectsInstalled = true;
|
||||
}
|
||||
|
||||
Future <void> _onClickBuyButton(BuildContext context) async {
|
||||
Future<void> _onClickBuyButton(BuildContext context) async {
|
||||
final walletType = walletViewModel.type;
|
||||
|
||||
switch (walletType) {
|
||||
case WalletType.monero:
|
||||
case WalletType.bitcoin:
|
||||
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;
|
||||
default:
|
||||
await showPopUp<void>(
|
||||
context: context,
|
||||
builder: (BuildContext context) {
|
||||
@@ -182,16 +217,6 @@ class DashboardPage extends BasePage {
|
||||
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;
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
Reference in New Issue
Block a user