mirror of
https://github.com/cypherstack/stack_wallet.git
synced 2024-11-17 09:47:37 +00:00
migrate wallet on open
This commit is contained in:
parent
c034413bc7
commit
998967245e
6 changed files with 737 additions and 607 deletions
|
@ -38,6 +38,7 @@ import 'package:stackwallet/utilities/enums/wallet_balance_toggle_state.dart';
|
||||||
import 'package:stackwallet/utilities/text_styles.dart';
|
import 'package:stackwallet/utilities/text_styles.dart';
|
||||||
import 'package:stackwallet/utilities/theme/stack_colors.dart';
|
import 'package:stackwallet/utilities/theme/stack_colors.dart';
|
||||||
import 'package:stackwallet/widgets/background.dart';
|
import 'package:stackwallet/widgets/background.dart';
|
||||||
|
import 'package:stackwallet/widgets/conditional_parent.dart';
|
||||||
import 'package:stackwallet/widgets/custom_buttons/app_bar_icon_button.dart';
|
import 'package:stackwallet/widgets/custom_buttons/app_bar_icon_button.dart';
|
||||||
import 'package:stackwallet/widgets/custom_buttons/blue_text_button.dart';
|
import 'package:stackwallet/widgets/custom_buttons/blue_text_button.dart';
|
||||||
import 'package:stackwallet/widgets/custom_loading_overlay.dart';
|
import 'package:stackwallet/widgets/custom_loading_overlay.dart';
|
||||||
|
@ -77,6 +78,8 @@ class _WalletViewState extends ConsumerState<WalletView> {
|
||||||
late StreamSubscription<dynamic> _syncStatusSubscription;
|
late StreamSubscription<dynamic> _syncStatusSubscription;
|
||||||
late StreamSubscription<dynamic> _nodeStatusSubscription;
|
late StreamSubscription<dynamic> _nodeStatusSubscription;
|
||||||
|
|
||||||
|
bool _rescanningOnOpen = false;
|
||||||
|
|
||||||
@override
|
@override
|
||||||
void initState() {
|
void initState() {
|
||||||
walletId = widget.walletId;
|
walletId = widget.walletId;
|
||||||
|
@ -91,7 +94,18 @@ class _WalletViewState extends ConsumerState<WalletView> {
|
||||||
_shouldDisableAutoSyncOnLogOut = false;
|
_shouldDisableAutoSyncOnLogOut = false;
|
||||||
}
|
}
|
||||||
|
|
||||||
ref.read(managerProvider).refresh();
|
if (ref.read(managerProvider).rescanOnOpenVersion == Constants.rescanV1) {
|
||||||
|
_rescanningOnOpen = true;
|
||||||
|
ref.read(managerProvider).fullRescan(20, 1000).then(
|
||||||
|
(_) => ref.read(managerProvider).resetRescanOnOpen().then(
|
||||||
|
(_) => WidgetsBinding.instance.addPostFrameCallback(
|
||||||
|
(_) => setState(() => _rescanningOnOpen = false),
|
||||||
|
),
|
||||||
|
),
|
||||||
|
);
|
||||||
|
} else {
|
||||||
|
ref.read(managerProvider).refresh();
|
||||||
|
}
|
||||||
|
|
||||||
if (ref.read(managerProvider).isRefreshing) {
|
if (ref.read(managerProvider).isRefreshing) {
|
||||||
_currentSyncStatus = WalletSyncStatus.syncing;
|
_currentSyncStatus = WalletSyncStatus.syncing;
|
||||||
|
@ -372,418 +386,448 @@ class _WalletViewState extends ConsumerState<WalletView> {
|
||||||
|
|
||||||
final coin = ref.watch(managerProvider.select((value) => value.coin));
|
final coin = ref.watch(managerProvider.select((value) => value.coin));
|
||||||
|
|
||||||
return WillPopScope(
|
return ConditionalParent(
|
||||||
onWillPop: _onWillPop,
|
condition: _rescanningOnOpen,
|
||||||
child: Background(
|
builder: (child) {
|
||||||
child: Scaffold(
|
return WillPopScope(
|
||||||
backgroundColor:
|
onWillPop: () async => !_rescanningOnOpen,
|
||||||
Theme.of(context).extension<StackColors>()!.background,
|
child: Stack(
|
||||||
appBar: AppBar(
|
children: [
|
||||||
leading: AppBarBackButton(
|
child,
|
||||||
onPressed: () {
|
Background(
|
||||||
_logout();
|
child: CustomLoadingOverlay(
|
||||||
Navigator.of(context).pop();
|
message:
|
||||||
},
|
"Migration in progress\nThis could take a while\nPlease don't leave this screen",
|
||||||
),
|
subMessage: "This only needs to run once per wallet",
|
||||||
titleSpacing: 0,
|
eventBus: null,
|
||||||
title: Row(
|
textColor:
|
||||||
children: [
|
Theme.of(context).extension<StackColors>()!.textDark,
|
||||||
SvgPicture.asset(
|
|
||||||
Assets.svg.iconFor(coin: coin),
|
|
||||||
// color: Theme.of(context).extension<StackColors>()!.accentColorDark
|
|
||||||
width: 24,
|
|
||||||
height: 24,
|
|
||||||
),
|
),
|
||||||
const SizedBox(
|
)
|
||||||
width: 16,
|
|
||||||
),
|
|
||||||
Expanded(
|
|
||||||
child: Text(
|
|
||||||
ref.watch(
|
|
||||||
managerProvider.select((value) => value.walletName)),
|
|
||||||
style: STextStyles.navBarTitle(context),
|
|
||||||
overflow: TextOverflow.ellipsis,
|
|
||||||
),
|
|
||||||
)
|
|
||||||
],
|
|
||||||
),
|
|
||||||
actions: [
|
|
||||||
Padding(
|
|
||||||
padding: const EdgeInsets.only(
|
|
||||||
top: 10,
|
|
||||||
bottom: 10,
|
|
||||||
right: 10,
|
|
||||||
),
|
|
||||||
child: AspectRatio(
|
|
||||||
aspectRatio: 1,
|
|
||||||
child: AppBarIconButton(
|
|
||||||
key: const Key("walletViewRadioButton"),
|
|
||||||
size: 36,
|
|
||||||
shadows: const [],
|
|
||||||
color:
|
|
||||||
Theme.of(context).extension<StackColors>()!.background,
|
|
||||||
icon: _buildNetworkIcon(_currentSyncStatus),
|
|
||||||
onPressed: () {
|
|
||||||
Navigator.of(context).pushNamed(
|
|
||||||
WalletNetworkSettingsView.routeName,
|
|
||||||
arguments: Tuple3(
|
|
||||||
walletId,
|
|
||||||
_currentSyncStatus,
|
|
||||||
_currentNodeStatus,
|
|
||||||
),
|
|
||||||
);
|
|
||||||
},
|
|
||||||
),
|
|
||||||
),
|
|
||||||
),
|
|
||||||
Padding(
|
|
||||||
padding: const EdgeInsets.only(
|
|
||||||
top: 10,
|
|
||||||
bottom: 10,
|
|
||||||
right: 10,
|
|
||||||
),
|
|
||||||
child: AspectRatio(
|
|
||||||
aspectRatio: 1,
|
|
||||||
child: AppBarIconButton(
|
|
||||||
key: const Key("walletViewAlertsButton"),
|
|
||||||
size: 36,
|
|
||||||
shadows: const [],
|
|
||||||
color:
|
|
||||||
Theme.of(context).extension<StackColors>()!.background,
|
|
||||||
icon: SvgPicture.asset(
|
|
||||||
ref.watch(notificationsProvider.select((value) =>
|
|
||||||
value.hasUnreadNotificationsFor(walletId)))
|
|
||||||
? Assets.svg.bellNew(context)
|
|
||||||
: Assets.svg.bell,
|
|
||||||
width: 20,
|
|
||||||
height: 20,
|
|
||||||
color: ref.watch(notificationsProvider.select((value) =>
|
|
||||||
value.hasUnreadNotificationsFor(walletId)))
|
|
||||||
? null
|
|
||||||
: Theme.of(context)
|
|
||||||
.extension<StackColors>()!
|
|
||||||
.topNavIconPrimary,
|
|
||||||
),
|
|
||||||
onPressed: () {
|
|
||||||
// reset unread state
|
|
||||||
ref.refresh(unreadNotificationsStateProvider);
|
|
||||||
|
|
||||||
Navigator.of(context)
|
|
||||||
.pushNamed(
|
|
||||||
NotificationsView.routeName,
|
|
||||||
arguments: walletId,
|
|
||||||
)
|
|
||||||
.then((_) {
|
|
||||||
final Set<int> unreadNotificationIds = ref
|
|
||||||
.read(unreadNotificationsStateProvider.state)
|
|
||||||
.state;
|
|
||||||
if (unreadNotificationIds.isEmpty) return;
|
|
||||||
|
|
||||||
List<Future<dynamic>> futures = [];
|
|
||||||
for (int i = 0;
|
|
||||||
i < unreadNotificationIds.length - 1;
|
|
||||||
i++) {
|
|
||||||
futures.add(ref
|
|
||||||
.read(notificationsProvider)
|
|
||||||
.markAsRead(
|
|
||||||
unreadNotificationIds.elementAt(i), false));
|
|
||||||
}
|
|
||||||
|
|
||||||
// wait for multiple to update if any
|
|
||||||
Future.wait(futures).then((_) {
|
|
||||||
// only notify listeners once
|
|
||||||
ref
|
|
||||||
.read(notificationsProvider)
|
|
||||||
.markAsRead(unreadNotificationIds.last, true);
|
|
||||||
});
|
|
||||||
});
|
|
||||||
},
|
|
||||||
),
|
|
||||||
),
|
|
||||||
),
|
|
||||||
Padding(
|
|
||||||
padding: const EdgeInsets.only(
|
|
||||||
top: 10,
|
|
||||||
bottom: 10,
|
|
||||||
right: 10,
|
|
||||||
),
|
|
||||||
child: AspectRatio(
|
|
||||||
aspectRatio: 1,
|
|
||||||
child: AppBarIconButton(
|
|
||||||
key: const Key("walletViewSettingsButton"),
|
|
||||||
size: 36,
|
|
||||||
shadows: const [],
|
|
||||||
color:
|
|
||||||
Theme.of(context).extension<StackColors>()!.background,
|
|
||||||
icon: SvgPicture.asset(
|
|
||||||
Assets.svg.bars,
|
|
||||||
color: Theme.of(context)
|
|
||||||
.extension<StackColors>()!
|
|
||||||
.accentColorDark,
|
|
||||||
width: 20,
|
|
||||||
height: 20,
|
|
||||||
),
|
|
||||||
onPressed: () {
|
|
||||||
//todo: check if print needed
|
|
||||||
// debugPrint("wallet view settings tapped");
|
|
||||||
Navigator.of(context).pushNamed(
|
|
||||||
WalletSettingsView.routeName,
|
|
||||||
arguments: Tuple4(
|
|
||||||
walletId,
|
|
||||||
ref.read(managerProvider).coin,
|
|
||||||
_currentSyncStatus,
|
|
||||||
_currentNodeStatus,
|
|
||||||
),
|
|
||||||
);
|
|
||||||
},
|
|
||||||
),
|
|
||||||
),
|
|
||||||
),
|
|
||||||
],
|
],
|
||||||
),
|
),
|
||||||
body: SafeArea(
|
);
|
||||||
child: Container(
|
},
|
||||||
color: Theme.of(context).extension<StackColors>()!.background,
|
child: WillPopScope(
|
||||||
child: Column(
|
onWillPop: _onWillPop,
|
||||||
|
child: Background(
|
||||||
|
child: Scaffold(
|
||||||
|
backgroundColor:
|
||||||
|
Theme.of(context).extension<StackColors>()!.background,
|
||||||
|
appBar: AppBar(
|
||||||
|
leading: AppBarBackButton(
|
||||||
|
onPressed: () {
|
||||||
|
_logout();
|
||||||
|
Navigator.of(context).pop();
|
||||||
|
},
|
||||||
|
),
|
||||||
|
titleSpacing: 0,
|
||||||
|
title: Row(
|
||||||
children: [
|
children: [
|
||||||
const SizedBox(
|
SvgPicture.asset(
|
||||||
height: 10,
|
Assets.svg.iconFor(coin: coin),
|
||||||
|
// color: Theme.of(context).extension<StackColors>()!.accentColorDark
|
||||||
|
width: 24,
|
||||||
|
height: 24,
|
||||||
),
|
),
|
||||||
Center(
|
const SizedBox(
|
||||||
child: Padding(
|
width: 16,
|
||||||
padding: const EdgeInsets.symmetric(horizontal: 16),
|
),
|
||||||
child: WalletSummary(
|
Expanded(
|
||||||
walletId: walletId,
|
child: Text(
|
||||||
managerProvider: managerProvider,
|
ref.watch(
|
||||||
initialSyncStatus: ref.watch(managerProvider
|
managerProvider.select((value) => value.walletName)),
|
||||||
.select((value) => value.isRefreshing))
|
style: STextStyles.navBarTitle(context),
|
||||||
? WalletSyncStatus.syncing
|
overflow: TextOverflow.ellipsis,
|
||||||
: WalletSyncStatus.synced,
|
),
|
||||||
),
|
)
|
||||||
|
],
|
||||||
|
),
|
||||||
|
actions: [
|
||||||
|
Padding(
|
||||||
|
padding: const EdgeInsets.only(
|
||||||
|
top: 10,
|
||||||
|
bottom: 10,
|
||||||
|
right: 10,
|
||||||
|
),
|
||||||
|
child: AspectRatio(
|
||||||
|
aspectRatio: 1,
|
||||||
|
child: AppBarIconButton(
|
||||||
|
key: const Key("walletViewRadioButton"),
|
||||||
|
size: 36,
|
||||||
|
shadows: const [],
|
||||||
|
color: Theme.of(context)
|
||||||
|
.extension<StackColors>()!
|
||||||
|
.background,
|
||||||
|
icon: _buildNetworkIcon(_currentSyncStatus),
|
||||||
|
onPressed: () {
|
||||||
|
Navigator.of(context).pushNamed(
|
||||||
|
WalletNetworkSettingsView.routeName,
|
||||||
|
arguments: Tuple3(
|
||||||
|
walletId,
|
||||||
|
_currentSyncStatus,
|
||||||
|
_currentNodeStatus,
|
||||||
|
),
|
||||||
|
);
|
||||||
|
},
|
||||||
),
|
),
|
||||||
),
|
),
|
||||||
if (coin == Coin.firo)
|
),
|
||||||
|
Padding(
|
||||||
|
padding: const EdgeInsets.only(
|
||||||
|
top: 10,
|
||||||
|
bottom: 10,
|
||||||
|
right: 10,
|
||||||
|
),
|
||||||
|
child: AspectRatio(
|
||||||
|
aspectRatio: 1,
|
||||||
|
child: AppBarIconButton(
|
||||||
|
key: const Key("walletViewAlertsButton"),
|
||||||
|
size: 36,
|
||||||
|
shadows: const [],
|
||||||
|
color: Theme.of(context)
|
||||||
|
.extension<StackColors>()!
|
||||||
|
.background,
|
||||||
|
icon: SvgPicture.asset(
|
||||||
|
ref.watch(notificationsProvider.select((value) =>
|
||||||
|
value.hasUnreadNotificationsFor(walletId)))
|
||||||
|
? Assets.svg.bellNew(context)
|
||||||
|
: Assets.svg.bell,
|
||||||
|
width: 20,
|
||||||
|
height: 20,
|
||||||
|
color: ref.watch(notificationsProvider.select((value) =>
|
||||||
|
value.hasUnreadNotificationsFor(walletId)))
|
||||||
|
? null
|
||||||
|
: Theme.of(context)
|
||||||
|
.extension<StackColors>()!
|
||||||
|
.topNavIconPrimary,
|
||||||
|
),
|
||||||
|
onPressed: () {
|
||||||
|
// reset unread state
|
||||||
|
ref.refresh(unreadNotificationsStateProvider);
|
||||||
|
|
||||||
|
Navigator.of(context)
|
||||||
|
.pushNamed(
|
||||||
|
NotificationsView.routeName,
|
||||||
|
arguments: walletId,
|
||||||
|
)
|
||||||
|
.then((_) {
|
||||||
|
final Set<int> unreadNotificationIds = ref
|
||||||
|
.read(unreadNotificationsStateProvider.state)
|
||||||
|
.state;
|
||||||
|
if (unreadNotificationIds.isEmpty) return;
|
||||||
|
|
||||||
|
List<Future<dynamic>> futures = [];
|
||||||
|
for (int i = 0;
|
||||||
|
i < unreadNotificationIds.length - 1;
|
||||||
|
i++) {
|
||||||
|
futures.add(ref
|
||||||
|
.read(notificationsProvider)
|
||||||
|
.markAsRead(
|
||||||
|
unreadNotificationIds.elementAt(i), false));
|
||||||
|
}
|
||||||
|
|
||||||
|
// wait for multiple to update if any
|
||||||
|
Future.wait(futures).then((_) {
|
||||||
|
// only notify listeners once
|
||||||
|
ref
|
||||||
|
.read(notificationsProvider)
|
||||||
|
.markAsRead(unreadNotificationIds.last, true);
|
||||||
|
});
|
||||||
|
});
|
||||||
|
},
|
||||||
|
),
|
||||||
|
),
|
||||||
|
),
|
||||||
|
Padding(
|
||||||
|
padding: const EdgeInsets.only(
|
||||||
|
top: 10,
|
||||||
|
bottom: 10,
|
||||||
|
right: 10,
|
||||||
|
),
|
||||||
|
child: AspectRatio(
|
||||||
|
aspectRatio: 1,
|
||||||
|
child: AppBarIconButton(
|
||||||
|
key: const Key("walletViewSettingsButton"),
|
||||||
|
size: 36,
|
||||||
|
shadows: const [],
|
||||||
|
color: Theme.of(context)
|
||||||
|
.extension<StackColors>()!
|
||||||
|
.background,
|
||||||
|
icon: SvgPicture.asset(
|
||||||
|
Assets.svg.bars,
|
||||||
|
color: Theme.of(context)
|
||||||
|
.extension<StackColors>()!
|
||||||
|
.accentColorDark,
|
||||||
|
width: 20,
|
||||||
|
height: 20,
|
||||||
|
),
|
||||||
|
onPressed: () {
|
||||||
|
//todo: check if print needed
|
||||||
|
// debugPrint("wallet view settings tapped");
|
||||||
|
Navigator.of(context).pushNamed(
|
||||||
|
WalletSettingsView.routeName,
|
||||||
|
arguments: Tuple4(
|
||||||
|
walletId,
|
||||||
|
ref.read(managerProvider).coin,
|
||||||
|
_currentSyncStatus,
|
||||||
|
_currentNodeStatus,
|
||||||
|
),
|
||||||
|
);
|
||||||
|
},
|
||||||
|
),
|
||||||
|
),
|
||||||
|
),
|
||||||
|
],
|
||||||
|
),
|
||||||
|
body: SafeArea(
|
||||||
|
child: Container(
|
||||||
|
color: Theme.of(context).extension<StackColors>()!.background,
|
||||||
|
child: Column(
|
||||||
|
children: [
|
||||||
const SizedBox(
|
const SizedBox(
|
||||||
height: 10,
|
height: 10,
|
||||||
),
|
),
|
||||||
if (coin == Coin.firo)
|
Center(
|
||||||
Padding(
|
child: Padding(
|
||||||
padding: const EdgeInsets.symmetric(horizontal: 16),
|
padding: const EdgeInsets.symmetric(horizontal: 16),
|
||||||
child: Row(
|
child: WalletSummary(
|
||||||
children: [
|
walletId: walletId,
|
||||||
Expanded(
|
managerProvider: managerProvider,
|
||||||
child: TextButton(
|
initialSyncStatus: ref.watch(managerProvider
|
||||||
style: Theme.of(context)
|
.select((value) => value.isRefreshing))
|
||||||
.extension<StackColors>()!
|
? WalletSyncStatus.syncing
|
||||||
.getSecondaryEnabledButtonStyle(context),
|
: WalletSyncStatus.synced,
|
||||||
onPressed: () async {
|
),
|
||||||
await showDialog<void>(
|
),
|
||||||
context: context,
|
),
|
||||||
builder: (context) => StackDialog(
|
if (coin == Coin.firo)
|
||||||
title: "Attention!",
|
const SizedBox(
|
||||||
message:
|
height: 10,
|
||||||
"You're about to anonymize all of your public funds.",
|
),
|
||||||
leftButton: TextButton(
|
if (coin == Coin.firo)
|
||||||
onPressed: () {
|
Padding(
|
||||||
Navigator.of(context).pop();
|
padding: const EdgeInsets.symmetric(horizontal: 16),
|
||||||
},
|
child: Row(
|
||||||
child: Text(
|
children: [
|
||||||
"Cancel",
|
Expanded(
|
||||||
style: STextStyles.button(context)
|
child: TextButton(
|
||||||
.copyWith(
|
style: Theme.of(context)
|
||||||
color: Theme.of(context)
|
.extension<StackColors>()!
|
||||||
.extension<StackColors>()!
|
.getSecondaryEnabledButtonStyle(context),
|
||||||
.accentColorDark,
|
onPressed: () async {
|
||||||
|
await showDialog<void>(
|
||||||
|
context: context,
|
||||||
|
builder: (context) => StackDialog(
|
||||||
|
title: "Attention!",
|
||||||
|
message:
|
||||||
|
"You're about to anonymize all of your public funds.",
|
||||||
|
leftButton: TextButton(
|
||||||
|
onPressed: () {
|
||||||
|
Navigator.of(context).pop();
|
||||||
|
},
|
||||||
|
child: Text(
|
||||||
|
"Cancel",
|
||||||
|
style: STextStyles.button(context)
|
||||||
|
.copyWith(
|
||||||
|
color: Theme.of(context)
|
||||||
|
.extension<StackColors>()!
|
||||||
|
.accentColorDark,
|
||||||
|
),
|
||||||
|
),
|
||||||
|
),
|
||||||
|
rightButton: TextButton(
|
||||||
|
onPressed: () async {
|
||||||
|
Navigator.of(context).pop();
|
||||||
|
|
||||||
|
unawaited(attemptAnonymize());
|
||||||
|
},
|
||||||
|
style: Theme.of(context)
|
||||||
|
.extension<StackColors>()!
|
||||||
|
.getPrimaryEnabledButtonStyle(
|
||||||
|
context),
|
||||||
|
child: Text(
|
||||||
|
"Continue",
|
||||||
|
style: STextStyles.button(context),
|
||||||
),
|
),
|
||||||
),
|
),
|
||||||
),
|
),
|
||||||
rightButton: TextButton(
|
);
|
||||||
onPressed: () async {
|
},
|
||||||
Navigator.of(context).pop();
|
child: Text(
|
||||||
|
"Anonymize funds",
|
||||||
unawaited(attemptAnonymize());
|
style: STextStyles.button(context).copyWith(
|
||||||
},
|
color: Theme.of(context)
|
||||||
style: Theme.of(context)
|
.extension<StackColors>()!
|
||||||
.extension<StackColors>()!
|
.buttonTextSecondary,
|
||||||
.getPrimaryEnabledButtonStyle(
|
|
||||||
context),
|
|
||||||
child: Text(
|
|
||||||
"Continue",
|
|
||||||
style: STextStyles.button(context),
|
|
||||||
),
|
|
||||||
),
|
|
||||||
),
|
),
|
||||||
);
|
|
||||||
},
|
|
||||||
child: Text(
|
|
||||||
"Anonymize funds",
|
|
||||||
style: STextStyles.button(context).copyWith(
|
|
||||||
color: Theme.of(context)
|
|
||||||
.extension<StackColors>()!
|
|
||||||
.buttonTextSecondary,
|
|
||||||
),
|
),
|
||||||
),
|
),
|
||||||
),
|
),
|
||||||
|
],
|
||||||
|
),
|
||||||
|
),
|
||||||
|
const SizedBox(
|
||||||
|
height: 20,
|
||||||
|
),
|
||||||
|
Padding(
|
||||||
|
padding: const EdgeInsets.symmetric(horizontal: 16),
|
||||||
|
child: Row(
|
||||||
|
mainAxisAlignment: MainAxisAlignment.spaceBetween,
|
||||||
|
children: [
|
||||||
|
Text(
|
||||||
|
"Transactions",
|
||||||
|
style: STextStyles.itemSubtitle(context).copyWith(
|
||||||
|
color: Theme.of(context)
|
||||||
|
.extension<StackColors>()!
|
||||||
|
.textDark3,
|
||||||
|
),
|
||||||
|
),
|
||||||
|
CustomTextButton(
|
||||||
|
text: "See all",
|
||||||
|
onTap: () {
|
||||||
|
Navigator.of(context).pushNamed(
|
||||||
|
AllTransactionsView.routeName,
|
||||||
|
arguments: walletId,
|
||||||
|
);
|
||||||
|
},
|
||||||
),
|
),
|
||||||
],
|
],
|
||||||
),
|
),
|
||||||
),
|
),
|
||||||
const SizedBox(
|
const SizedBox(
|
||||||
height: 20,
|
height: 12,
|
||||||
),
|
|
||||||
Padding(
|
|
||||||
padding: const EdgeInsets.symmetric(horizontal: 16),
|
|
||||||
child: Row(
|
|
||||||
mainAxisAlignment: MainAxisAlignment.spaceBetween,
|
|
||||||
children: [
|
|
||||||
Text(
|
|
||||||
"Transactions",
|
|
||||||
style: STextStyles.itemSubtitle(context).copyWith(
|
|
||||||
color: Theme.of(context)
|
|
||||||
.extension<StackColors>()!
|
|
||||||
.textDark3,
|
|
||||||
),
|
|
||||||
),
|
|
||||||
CustomTextButton(
|
|
||||||
text: "See all",
|
|
||||||
onTap: () {
|
|
||||||
Navigator.of(context).pushNamed(
|
|
||||||
AllTransactionsView.routeName,
|
|
||||||
arguments: walletId,
|
|
||||||
);
|
|
||||||
},
|
|
||||||
),
|
|
||||||
],
|
|
||||||
),
|
),
|
||||||
),
|
Expanded(
|
||||||
const SizedBox(
|
child: Stack(
|
||||||
height: 12,
|
children: [
|
||||||
),
|
Padding(
|
||||||
Expanded(
|
padding: const EdgeInsets.symmetric(horizontal: 16),
|
||||||
child: Stack(
|
child: Padding(
|
||||||
children: [
|
padding: const EdgeInsets.only(bottom: 14),
|
||||||
Padding(
|
child: ClipRRect(
|
||||||
padding: const EdgeInsets.symmetric(horizontal: 16),
|
borderRadius: BorderRadius.vertical(
|
||||||
child: Padding(
|
top: Radius.circular(
|
||||||
padding: const EdgeInsets.only(bottom: 14),
|
Constants.size.circularBorderRadius,
|
||||||
child: ClipRRect(
|
),
|
||||||
borderRadius: BorderRadius.vertical(
|
bottom: Radius.circular(
|
||||||
top: Radius.circular(
|
// WalletView.navBarHeight / 2.0,
|
||||||
Constants.size.circularBorderRadius,
|
|
||||||
),
|
|
||||||
bottom: Radius.circular(
|
|
||||||
// WalletView.navBarHeight / 2.0,
|
|
||||||
Constants.size.circularBorderRadius,
|
|
||||||
),
|
|
||||||
),
|
|
||||||
child: Container(
|
|
||||||
decoration: BoxDecoration(
|
|
||||||
color: Colors.transparent,
|
|
||||||
borderRadius: BorderRadius.circular(
|
|
||||||
Constants.size.circularBorderRadius,
|
Constants.size.circularBorderRadius,
|
||||||
),
|
),
|
||||||
),
|
),
|
||||||
child: Column(
|
child: Container(
|
||||||
crossAxisAlignment:
|
decoration: BoxDecoration(
|
||||||
CrossAxisAlignment.stretch,
|
color: Colors.transparent,
|
||||||
children: [
|
borderRadius: BorderRadius.circular(
|
||||||
Expanded(
|
Constants.size.circularBorderRadius,
|
||||||
child: TransactionsList(
|
|
||||||
managerProvider: managerProvider,
|
|
||||||
walletId: walletId,
|
|
||||||
),
|
|
||||||
),
|
),
|
||||||
],
|
),
|
||||||
|
child: Column(
|
||||||
|
crossAxisAlignment:
|
||||||
|
CrossAxisAlignment.stretch,
|
||||||
|
children: [
|
||||||
|
Expanded(
|
||||||
|
child: TransactionsList(
|
||||||
|
managerProvider: managerProvider,
|
||||||
|
walletId: walletId,
|
||||||
|
),
|
||||||
|
),
|
||||||
|
],
|
||||||
|
),
|
||||||
),
|
),
|
||||||
),
|
),
|
||||||
),
|
),
|
||||||
),
|
),
|
||||||
),
|
Column(
|
||||||
Column(
|
mainAxisAlignment: MainAxisAlignment.end,
|
||||||
mainAxisAlignment: MainAxisAlignment.end,
|
children: [
|
||||||
children: [
|
Row(
|
||||||
Row(
|
mainAxisAlignment: MainAxisAlignment.center,
|
||||||
mainAxisAlignment: MainAxisAlignment.center,
|
children: [
|
||||||
children: [
|
Padding(
|
||||||
Padding(
|
padding: const EdgeInsets.only(
|
||||||
padding: const EdgeInsets.only(
|
bottom: 14,
|
||||||
bottom: 14,
|
left: 16,
|
||||||
left: 16,
|
right: 16,
|
||||||
right: 16,
|
),
|
||||||
),
|
child: WalletNavigationBar(
|
||||||
child: WalletNavigationBar(
|
walletId: widget.walletId,
|
||||||
walletId: widget.walletId,
|
coin: ref.watch(managerProvider
|
||||||
coin: ref.watch(managerProvider
|
.select((value) => value.coin)),
|
||||||
.select((value) => value.coin)),
|
enableExchange:
|
||||||
enableExchange: Constants.enableExchange &&
|
Constants.enableExchange &&
|
||||||
ref.watch(managerProvider.select(
|
ref.watch(managerProvider.select(
|
||||||
(value) => value.coin)) !=
|
(value) => value.coin)) !=
|
||||||
Coin.epicCash,
|
Coin.epicCash,
|
||||||
height: WalletView.navBarHeight,
|
height: WalletView.navBarHeight,
|
||||||
onExchangePressed: () =>
|
onExchangePressed: () =>
|
||||||
_onExchangePressed(context),
|
_onExchangePressed(context),
|
||||||
onReceivePressed: () async {
|
onReceivePressed: () async {
|
||||||
final coin =
|
final coin =
|
||||||
ref.read(managerProvider).coin;
|
ref.read(managerProvider).coin;
|
||||||
if (mounted) {
|
if (mounted) {
|
||||||
unawaited(
|
unawaited(
|
||||||
Navigator.of(context).pushNamed(
|
Navigator.of(context).pushNamed(
|
||||||
ReceiveView.routeName,
|
ReceiveView.routeName,
|
||||||
|
arguments: Tuple2(
|
||||||
|
walletId,
|
||||||
|
coin,
|
||||||
|
),
|
||||||
|
));
|
||||||
|
}
|
||||||
|
},
|
||||||
|
onSendPressed: () {
|
||||||
|
final walletId =
|
||||||
|
ref.read(managerProvider).walletId;
|
||||||
|
final coin =
|
||||||
|
ref.read(managerProvider).coin;
|
||||||
|
switch (ref
|
||||||
|
.read(
|
||||||
|
walletBalanceToggleStateProvider
|
||||||
|
.state)
|
||||||
|
.state) {
|
||||||
|
case WalletBalanceToggleState.full:
|
||||||
|
ref
|
||||||
|
.read(
|
||||||
|
publicPrivateBalanceStateProvider
|
||||||
|
.state)
|
||||||
|
.state = "Public";
|
||||||
|
break;
|
||||||
|
case WalletBalanceToggleState
|
||||||
|
.available:
|
||||||
|
ref
|
||||||
|
.read(
|
||||||
|
publicPrivateBalanceStateProvider
|
||||||
|
.state)
|
||||||
|
.state = "Private";
|
||||||
|
break;
|
||||||
|
}
|
||||||
|
Navigator.of(context).pushNamed(
|
||||||
|
SendView.routeName,
|
||||||
arguments: Tuple2(
|
arguments: Tuple2(
|
||||||
walletId,
|
walletId,
|
||||||
coin,
|
coin,
|
||||||
),
|
),
|
||||||
|
);
|
||||||
|
},
|
||||||
|
onBuyPressed: () {
|
||||||
|
unawaited(
|
||||||
|
Navigator.of(context).pushNamed(
|
||||||
|
BuyInWalletView.routeName,
|
||||||
|
arguments: coin,
|
||||||
));
|
));
|
||||||
}
|
},
|
||||||
},
|
),
|
||||||
onSendPressed: () {
|
|
||||||
final walletId =
|
|
||||||
ref.read(managerProvider).walletId;
|
|
||||||
final coin =
|
|
||||||
ref.read(managerProvider).coin;
|
|
||||||
switch (ref
|
|
||||||
.read(walletBalanceToggleStateProvider
|
|
||||||
.state)
|
|
||||||
.state) {
|
|
||||||
case WalletBalanceToggleState.full:
|
|
||||||
ref
|
|
||||||
.read(
|
|
||||||
publicPrivateBalanceStateProvider
|
|
||||||
.state)
|
|
||||||
.state = "Public";
|
|
||||||
break;
|
|
||||||
case WalletBalanceToggleState.available:
|
|
||||||
ref
|
|
||||||
.read(
|
|
||||||
publicPrivateBalanceStateProvider
|
|
||||||
.state)
|
|
||||||
.state = "Private";
|
|
||||||
break;
|
|
||||||
}
|
|
||||||
Navigator.of(context).pushNamed(
|
|
||||||
SendView.routeName,
|
|
||||||
arguments: Tuple2(
|
|
||||||
walletId,
|
|
||||||
coin,
|
|
||||||
),
|
|
||||||
);
|
|
||||||
},
|
|
||||||
onBuyPressed: () {
|
|
||||||
unawaited(Navigator.of(context).pushNamed(
|
|
||||||
BuyInWalletView.routeName,
|
|
||||||
arguments: coin,
|
|
||||||
));
|
|
||||||
},
|
|
||||||
),
|
),
|
||||||
),
|
],
|
||||||
],
|
),
|
||||||
),
|
],
|
||||||
],
|
)
|
||||||
)
|
],
|
||||||
],
|
),
|
||||||
),
|
),
|
||||||
),
|
],
|
||||||
],
|
),
|
||||||
),
|
),
|
||||||
),
|
),
|
||||||
),
|
),
|
||||||
|
|
|
@ -24,12 +24,15 @@ import 'package:stackwallet/services/event_bus/events/global/wallet_sync_status_
|
||||||
import 'package:stackwallet/services/event_bus/global_event_bus.dart';
|
import 'package:stackwallet/services/event_bus/global_event_bus.dart';
|
||||||
import 'package:stackwallet/services/mixins/paynym_wallet_interface.dart';
|
import 'package:stackwallet/services/mixins/paynym_wallet_interface.dart';
|
||||||
import 'package:stackwallet/utilities/assets.dart';
|
import 'package:stackwallet/utilities/assets.dart';
|
||||||
|
import 'package:stackwallet/utilities/constants.dart';
|
||||||
import 'package:stackwallet/utilities/enums/backup_frequency_type.dart';
|
import 'package:stackwallet/utilities/enums/backup_frequency_type.dart';
|
||||||
import 'package:stackwallet/utilities/enums/coin_enum.dart';
|
import 'package:stackwallet/utilities/enums/coin_enum.dart';
|
||||||
import 'package:stackwallet/utilities/enums/derive_path_type_enum.dart';
|
import 'package:stackwallet/utilities/enums/derive_path_type_enum.dart';
|
||||||
import 'package:stackwallet/utilities/logger.dart';
|
import 'package:stackwallet/utilities/logger.dart';
|
||||||
import 'package:stackwallet/utilities/text_styles.dart';
|
import 'package:stackwallet/utilities/text_styles.dart';
|
||||||
import 'package:stackwallet/utilities/theme/stack_colors.dart';
|
import 'package:stackwallet/utilities/theme/stack_colors.dart';
|
||||||
|
import 'package:stackwallet/widgets/background.dart';
|
||||||
|
import 'package:stackwallet/widgets/conditional_parent.dart';
|
||||||
import 'package:stackwallet/widgets/custom_buttons/app_bar_icon_button.dart';
|
import 'package:stackwallet/widgets/custom_buttons/app_bar_icon_button.dart';
|
||||||
import 'package:stackwallet/widgets/custom_loading_overlay.dart';
|
import 'package:stackwallet/widgets/custom_loading_overlay.dart';
|
||||||
import 'package:stackwallet/widgets/desktop/desktop_app_bar.dart';
|
import 'package:stackwallet/widgets/desktop/desktop_app_bar.dart';
|
||||||
|
@ -63,6 +66,7 @@ class _DesktopWalletViewState extends ConsumerState<DesktopWalletView> {
|
||||||
late final EventBus eventBus;
|
late final EventBus eventBus;
|
||||||
|
|
||||||
late final bool _shouldDisableAutoSyncOnLogOut;
|
late final bool _shouldDisableAutoSyncOnLogOut;
|
||||||
|
bool _rescanningOnOpen = false;
|
||||||
|
|
||||||
Future<void> onBackPressed() async {
|
Future<void> onBackPressed() async {
|
||||||
await _logout();
|
await _logout();
|
||||||
|
@ -265,7 +269,18 @@ class _DesktopWalletViewState extends ConsumerState<DesktopWalletView> {
|
||||||
_shouldDisableAutoSyncOnLogOut = false;
|
_shouldDisableAutoSyncOnLogOut = false;
|
||||||
}
|
}
|
||||||
|
|
||||||
ref.read(managerProvider).refresh();
|
if (ref.read(managerProvider).rescanOnOpenVersion == Constants.rescanV1) {
|
||||||
|
_rescanningOnOpen = true;
|
||||||
|
ref.read(managerProvider).fullRescan(20, 1000).then(
|
||||||
|
(_) => ref.read(managerProvider).resetRescanOnOpen().then(
|
||||||
|
(_) => WidgetsBinding.instance.addPostFrameCallback(
|
||||||
|
(_) => setState(() => _rescanningOnOpen = false),
|
||||||
|
),
|
||||||
|
),
|
||||||
|
);
|
||||||
|
} else {
|
||||||
|
ref.read(managerProvider).refresh();
|
||||||
|
}
|
||||||
|
|
||||||
super.initState();
|
super.initState();
|
||||||
}
|
}
|
||||||
|
@ -284,241 +299,263 @@ class _DesktopWalletViewState extends ConsumerState<DesktopWalletView> {
|
||||||
final managerProvider = ref.watch(walletsChangeNotifierProvider
|
final managerProvider = ref.watch(walletsChangeNotifierProvider
|
||||||
.select((value) => value.getManagerProvider(widget.walletId)));
|
.select((value) => value.getManagerProvider(widget.walletId)));
|
||||||
|
|
||||||
return DesktopScaffold(
|
return ConditionalParent(
|
||||||
appBar: DesktopAppBar(
|
condition: _rescanningOnOpen,
|
||||||
background: Theme.of(context).extension<StackColors>()!.popupBG,
|
builder: (child) {
|
||||||
leading: Expanded(
|
return Stack(
|
||||||
child: Row(
|
children: [
|
||||||
children: [
|
child,
|
||||||
const SizedBox(
|
Background(
|
||||||
width: 32,
|
child: CustomLoadingOverlay(
|
||||||
|
message:
|
||||||
|
"Migration in progress\nThis could take a while\nPlease don't leave this screen",
|
||||||
|
subMessage: "This only needs to run once per wallet",
|
||||||
|
eventBus: null,
|
||||||
|
textColor: Theme.of(context).extension<StackColors>()!.textDark,
|
||||||
),
|
),
|
||||||
AppBarIconButton(
|
)
|
||||||
size: 32,
|
],
|
||||||
color: Theme.of(context)
|
);
|
||||||
.extension<StackColors>()!
|
},
|
||||||
.textFieldDefaultBG,
|
child: DesktopScaffold(
|
||||||
shadows: const [],
|
appBar: DesktopAppBar(
|
||||||
icon: SvgPicture.asset(
|
background: Theme.of(context).extension<StackColors>()!.popupBG,
|
||||||
Assets.svg.arrowLeft,
|
leading: Expanded(
|
||||||
width: 18,
|
child: Row(
|
||||||
height: 18,
|
children: [
|
||||||
|
const SizedBox(
|
||||||
|
width: 32,
|
||||||
|
),
|
||||||
|
AppBarIconButton(
|
||||||
|
size: 32,
|
||||||
color: Theme.of(context)
|
color: Theme.of(context)
|
||||||
.extension<StackColors>()!
|
.extension<StackColors>()!
|
||||||
.topNavIconPrimary,
|
.textFieldDefaultBG,
|
||||||
|
shadows: const [],
|
||||||
|
icon: SvgPicture.asset(
|
||||||
|
Assets.svg.arrowLeft,
|
||||||
|
width: 18,
|
||||||
|
height: 18,
|
||||||
|
color: Theme.of(context)
|
||||||
|
.extension<StackColors>()!
|
||||||
|
.topNavIconPrimary,
|
||||||
|
),
|
||||||
|
onPressed: onBackPressed,
|
||||||
|
),
|
||||||
|
const SizedBox(
|
||||||
|
width: 15,
|
||||||
|
),
|
||||||
|
SvgPicture.asset(
|
||||||
|
Assets.svg.iconFor(coin: coin),
|
||||||
|
width: 32,
|
||||||
|
height: 32,
|
||||||
|
),
|
||||||
|
const SizedBox(
|
||||||
|
width: 12,
|
||||||
|
),
|
||||||
|
ConstrainedBox(
|
||||||
|
constraints: const BoxConstraints(
|
||||||
|
minWidth: 48,
|
||||||
|
),
|
||||||
|
child: IntrinsicWidth(
|
||||||
|
child: DesktopWalletNameField(
|
||||||
|
walletId: widget.walletId,
|
||||||
|
),
|
||||||
|
),
|
||||||
|
),
|
||||||
|
const Spacer(),
|
||||||
|
Row(
|
||||||
|
children: [
|
||||||
|
NetworkInfoButton(
|
||||||
|
walletId: widget.walletId,
|
||||||
|
eventBus: eventBus,
|
||||||
|
),
|
||||||
|
const SizedBox(
|
||||||
|
width: 2,
|
||||||
|
),
|
||||||
|
WalletKeysButton(
|
||||||
|
walletId: widget.walletId,
|
||||||
|
),
|
||||||
|
const SizedBox(
|
||||||
|
width: 2,
|
||||||
|
),
|
||||||
|
DeleteWalletButton(
|
||||||
|
walletId: widget.walletId,
|
||||||
|
),
|
||||||
|
const SizedBox(
|
||||||
|
width: 12,
|
||||||
|
),
|
||||||
|
],
|
||||||
|
),
|
||||||
|
],
|
||||||
|
),
|
||||||
|
),
|
||||||
|
useSpacers: false,
|
||||||
|
isCompactHeight: true,
|
||||||
|
),
|
||||||
|
body: Padding(
|
||||||
|
padding: const EdgeInsets.all(24),
|
||||||
|
child: Column(
|
||||||
|
children: [
|
||||||
|
RoundedWhiteContainer(
|
||||||
|
padding: const EdgeInsets.all(20),
|
||||||
|
child: Row(
|
||||||
|
children: [
|
||||||
|
SvgPicture.asset(
|
||||||
|
Assets.svg.iconFor(coin: coin),
|
||||||
|
width: 40,
|
||||||
|
height: 40,
|
||||||
|
),
|
||||||
|
const SizedBox(
|
||||||
|
width: 10,
|
||||||
|
),
|
||||||
|
DesktopWalletSummary(
|
||||||
|
walletId: widget.walletId,
|
||||||
|
managerProvider: managerProvider,
|
||||||
|
initialSyncStatus: ref.watch(managerProvider
|
||||||
|
.select((value) => value.isRefreshing))
|
||||||
|
? WalletSyncStatus.syncing
|
||||||
|
: WalletSyncStatus.synced,
|
||||||
|
),
|
||||||
|
const Spacer(),
|
||||||
|
if (coin == Coin.firo) const SizedBox(width: 10),
|
||||||
|
if (coin == Coin.firo)
|
||||||
|
SecondaryButton(
|
||||||
|
width: 180,
|
||||||
|
buttonHeight: ButtonHeight.l,
|
||||||
|
label: "Anonymize funds",
|
||||||
|
onPressed: () async {
|
||||||
|
await showDialog<void>(
|
||||||
|
context: context,
|
||||||
|
barrierDismissible: false,
|
||||||
|
builder: (context) => DesktopDialog(
|
||||||
|
maxWidth: 500,
|
||||||
|
maxHeight: 210,
|
||||||
|
child: Padding(
|
||||||
|
padding: const EdgeInsets.symmetric(
|
||||||
|
horizontal: 32, vertical: 20),
|
||||||
|
child: Column(
|
||||||
|
children: [
|
||||||
|
Text(
|
||||||
|
"Attention!",
|
||||||
|
style: STextStyles.desktopH2(context),
|
||||||
|
),
|
||||||
|
const SizedBox(height: 16),
|
||||||
|
Text(
|
||||||
|
"You're about to anonymize all of your public funds.",
|
||||||
|
style:
|
||||||
|
STextStyles.desktopTextSmall(context),
|
||||||
|
),
|
||||||
|
const SizedBox(height: 32),
|
||||||
|
Row(
|
||||||
|
mainAxisAlignment:
|
||||||
|
MainAxisAlignment.center,
|
||||||
|
children: [
|
||||||
|
SecondaryButton(
|
||||||
|
width: 200,
|
||||||
|
buttonHeight: ButtonHeight.l,
|
||||||
|
label: "Cancel",
|
||||||
|
onPressed: () {
|
||||||
|
Navigator.of(context).pop();
|
||||||
|
},
|
||||||
|
),
|
||||||
|
const SizedBox(width: 20),
|
||||||
|
PrimaryButton(
|
||||||
|
width: 200,
|
||||||
|
buttonHeight: ButtonHeight.l,
|
||||||
|
label: "Continue",
|
||||||
|
onPressed: () {
|
||||||
|
Navigator.of(context).pop();
|
||||||
|
|
||||||
|
unawaited(attemptAnonymize());
|
||||||
|
},
|
||||||
|
)
|
||||||
|
],
|
||||||
|
),
|
||||||
|
],
|
||||||
|
),
|
||||||
|
),
|
||||||
|
),
|
||||||
|
);
|
||||||
|
},
|
||||||
|
),
|
||||||
|
if (ref.watch(walletsChangeNotifierProvider.select(
|
||||||
|
(value) => value
|
||||||
|
.getManager(widget.walletId)
|
||||||
|
.hasPaynymSupport)))
|
||||||
|
SecondaryButton(
|
||||||
|
label: "PayNym",
|
||||||
|
width: 160,
|
||||||
|
buttonHeight: ButtonHeight.l,
|
||||||
|
icon: SvgPicture.asset(
|
||||||
|
Assets.svg.user,
|
||||||
|
height: 20,
|
||||||
|
width: 20,
|
||||||
|
color: Theme.of(context)
|
||||||
|
.extension<StackColors>()!
|
||||||
|
.buttonTextSecondary,
|
||||||
|
),
|
||||||
|
onPressed: onPaynymButtonPressed,
|
||||||
|
),
|
||||||
|
// if (coin == Coin.firo) const SizedBox(width: 16),
|
||||||
|
// SecondaryButton(
|
||||||
|
// width: 180,
|
||||||
|
// buttonHeight: ButtonHeight.l,
|
||||||
|
// onPressed: () {
|
||||||
|
// _onExchangePressed(context);
|
||||||
|
// },
|
||||||
|
// label: "Exchange",
|
||||||
|
// icon: Container(
|
||||||
|
// width: 24,
|
||||||
|
// height: 24,
|
||||||
|
// decoration: BoxDecoration(
|
||||||
|
// borderRadius: BorderRadius.circular(24),
|
||||||
|
// color: Theme.of(context)
|
||||||
|
// .extension<StackColors>()!
|
||||||
|
// .buttonBackPrimary
|
||||||
|
// .withOpacity(0.2),
|
||||||
|
// ),
|
||||||
|
// child: Center(
|
||||||
|
// child: SvgPicture.asset(
|
||||||
|
// Assets.svg.arrowRotate2,
|
||||||
|
// width: 14,
|
||||||
|
// height: 14,
|
||||||
|
// color: Theme.of(context)
|
||||||
|
// .extension<StackColors>()!
|
||||||
|
// .buttonTextSecondary,
|
||||||
|
// ),
|
||||||
|
// ),
|
||||||
|
// ),
|
||||||
|
// ),
|
||||||
|
],
|
||||||
),
|
),
|
||||||
onPressed: onBackPressed,
|
|
||||||
),
|
),
|
||||||
const SizedBox(
|
const SizedBox(
|
||||||
width: 15,
|
height: 24,
|
||||||
),
|
),
|
||||||
SvgPicture.asset(
|
Expanded(
|
||||||
Assets.svg.iconFor(coin: coin),
|
child: Row(
|
||||||
width: 32,
|
children: [
|
||||||
height: 32,
|
SizedBox(
|
||||||
),
|
width: 450,
|
||||||
const SizedBox(
|
child: MyWallet(
|
||||||
width: 12,
|
walletId: widget.walletId,
|
||||||
),
|
),
|
||||||
ConstrainedBox(
|
),
|
||||||
constraints: const BoxConstraints(
|
const SizedBox(
|
||||||
minWidth: 48,
|
width: 16,
|
||||||
|
),
|
||||||
|
Expanded(
|
||||||
|
child: RecentDesktopTransactions(
|
||||||
|
walletId: widget.walletId,
|
||||||
|
),
|
||||||
|
),
|
||||||
|
],
|
||||||
),
|
),
|
||||||
child: IntrinsicWidth(
|
|
||||||
child: DesktopWalletNameField(
|
|
||||||
walletId: widget.walletId,
|
|
||||||
),
|
|
||||||
),
|
|
||||||
),
|
|
||||||
const Spacer(),
|
|
||||||
Row(
|
|
||||||
children: [
|
|
||||||
NetworkInfoButton(
|
|
||||||
walletId: widget.walletId,
|
|
||||||
eventBus: eventBus,
|
|
||||||
),
|
|
||||||
const SizedBox(
|
|
||||||
width: 2,
|
|
||||||
),
|
|
||||||
WalletKeysButton(
|
|
||||||
walletId: widget.walletId,
|
|
||||||
),
|
|
||||||
const SizedBox(
|
|
||||||
width: 2,
|
|
||||||
),
|
|
||||||
DeleteWalletButton(
|
|
||||||
walletId: widget.walletId,
|
|
||||||
),
|
|
||||||
const SizedBox(
|
|
||||||
width: 12,
|
|
||||||
),
|
|
||||||
],
|
|
||||||
),
|
),
|
||||||
],
|
],
|
||||||
),
|
),
|
||||||
),
|
),
|
||||||
useSpacers: false,
|
|
||||||
isCompactHeight: true,
|
|
||||||
),
|
|
||||||
body: Padding(
|
|
||||||
padding: const EdgeInsets.all(24),
|
|
||||||
child: Column(
|
|
||||||
children: [
|
|
||||||
RoundedWhiteContainer(
|
|
||||||
padding: const EdgeInsets.all(20),
|
|
||||||
child: Row(
|
|
||||||
children: [
|
|
||||||
SvgPicture.asset(
|
|
||||||
Assets.svg.iconFor(coin: coin),
|
|
||||||
width: 40,
|
|
||||||
height: 40,
|
|
||||||
),
|
|
||||||
const SizedBox(
|
|
||||||
width: 10,
|
|
||||||
),
|
|
||||||
DesktopWalletSummary(
|
|
||||||
walletId: widget.walletId,
|
|
||||||
managerProvider: managerProvider,
|
|
||||||
initialSyncStatus: ref.watch(managerProvider
|
|
||||||
.select((value) => value.isRefreshing))
|
|
||||||
? WalletSyncStatus.syncing
|
|
||||||
: WalletSyncStatus.synced,
|
|
||||||
),
|
|
||||||
const Spacer(),
|
|
||||||
if (coin == Coin.firo) const SizedBox(width: 10),
|
|
||||||
if (coin == Coin.firo)
|
|
||||||
SecondaryButton(
|
|
||||||
width: 180,
|
|
||||||
buttonHeight: ButtonHeight.l,
|
|
||||||
label: "Anonymize funds",
|
|
||||||
onPressed: () async {
|
|
||||||
await showDialog<void>(
|
|
||||||
context: context,
|
|
||||||
barrierDismissible: false,
|
|
||||||
builder: (context) => DesktopDialog(
|
|
||||||
maxWidth: 500,
|
|
||||||
maxHeight: 210,
|
|
||||||
child: Padding(
|
|
||||||
padding: const EdgeInsets.symmetric(
|
|
||||||
horizontal: 32, vertical: 20),
|
|
||||||
child: Column(
|
|
||||||
children: [
|
|
||||||
Text(
|
|
||||||
"Attention!",
|
|
||||||
style: STextStyles.desktopH2(context),
|
|
||||||
),
|
|
||||||
const SizedBox(height: 16),
|
|
||||||
Text(
|
|
||||||
"You're about to anonymize all of your public funds.",
|
|
||||||
style:
|
|
||||||
STextStyles.desktopTextSmall(context),
|
|
||||||
),
|
|
||||||
const SizedBox(height: 32),
|
|
||||||
Row(
|
|
||||||
mainAxisAlignment: MainAxisAlignment.center,
|
|
||||||
children: [
|
|
||||||
SecondaryButton(
|
|
||||||
width: 200,
|
|
||||||
buttonHeight: ButtonHeight.l,
|
|
||||||
label: "Cancel",
|
|
||||||
onPressed: () {
|
|
||||||
Navigator.of(context).pop();
|
|
||||||
},
|
|
||||||
),
|
|
||||||
const SizedBox(width: 20),
|
|
||||||
PrimaryButton(
|
|
||||||
width: 200,
|
|
||||||
buttonHeight: ButtonHeight.l,
|
|
||||||
label: "Continue",
|
|
||||||
onPressed: () {
|
|
||||||
Navigator.of(context).pop();
|
|
||||||
|
|
||||||
unawaited(attemptAnonymize());
|
|
||||||
},
|
|
||||||
)
|
|
||||||
],
|
|
||||||
),
|
|
||||||
],
|
|
||||||
),
|
|
||||||
),
|
|
||||||
),
|
|
||||||
);
|
|
||||||
},
|
|
||||||
),
|
|
||||||
if (ref.watch(walletsChangeNotifierProvider.select((value) =>
|
|
||||||
value.getManager(widget.walletId).hasPaynymSupport)))
|
|
||||||
SecondaryButton(
|
|
||||||
label: "PayNym",
|
|
||||||
width: 160,
|
|
||||||
buttonHeight: ButtonHeight.l,
|
|
||||||
icon: SvgPicture.asset(
|
|
||||||
Assets.svg.user,
|
|
||||||
height: 20,
|
|
||||||
width: 20,
|
|
||||||
color: Theme.of(context)
|
|
||||||
.extension<StackColors>()!
|
|
||||||
.buttonTextSecondary,
|
|
||||||
),
|
|
||||||
onPressed: onPaynymButtonPressed,
|
|
||||||
),
|
|
||||||
// if (coin == Coin.firo) const SizedBox(width: 16),
|
|
||||||
// SecondaryButton(
|
|
||||||
// width: 180,
|
|
||||||
// buttonHeight: ButtonHeight.l,
|
|
||||||
// onPressed: () {
|
|
||||||
// _onExchangePressed(context);
|
|
||||||
// },
|
|
||||||
// label: "Exchange",
|
|
||||||
// icon: Container(
|
|
||||||
// width: 24,
|
|
||||||
// height: 24,
|
|
||||||
// decoration: BoxDecoration(
|
|
||||||
// borderRadius: BorderRadius.circular(24),
|
|
||||||
// color: Theme.of(context)
|
|
||||||
// .extension<StackColors>()!
|
|
||||||
// .buttonBackPrimary
|
|
||||||
// .withOpacity(0.2),
|
|
||||||
// ),
|
|
||||||
// child: Center(
|
|
||||||
// child: SvgPicture.asset(
|
|
||||||
// Assets.svg.arrowRotate2,
|
|
||||||
// width: 14,
|
|
||||||
// height: 14,
|
|
||||||
// color: Theme.of(context)
|
|
||||||
// .extension<StackColors>()!
|
|
||||||
// .buttonTextSecondary,
|
|
||||||
// ),
|
|
||||||
// ),
|
|
||||||
// ),
|
|
||||||
// ),
|
|
||||||
],
|
|
||||||
),
|
|
||||||
),
|
|
||||||
const SizedBox(
|
|
||||||
height: 24,
|
|
||||||
),
|
|
||||||
Expanded(
|
|
||||||
child: Row(
|
|
||||||
children: [
|
|
||||||
SizedBox(
|
|
||||||
width: 450,
|
|
||||||
child: MyWallet(
|
|
||||||
walletId: widget.walletId,
|
|
||||||
),
|
|
||||||
),
|
|
||||||
const SizedBox(
|
|
||||||
width: 16,
|
|
||||||
),
|
|
||||||
Expanded(
|
|
||||||
child: RecentDesktopTransactions(
|
|
||||||
walletId: widget.walletId,
|
|
||||||
),
|
|
||||||
),
|
|
||||||
],
|
|
||||||
),
|
|
||||||
),
|
|
||||||
],
|
|
||||||
),
|
|
||||||
),
|
),
|
||||||
);
|
);
|
||||||
}
|
}
|
||||||
|
|
|
@ -2,6 +2,7 @@ import 'dart:async';
|
||||||
|
|
||||||
import 'package:event_bus/event_bus.dart';
|
import 'package:event_bus/event_bus.dart';
|
||||||
import 'package:flutter/material.dart';
|
import 'package:flutter/material.dart';
|
||||||
|
import 'package:stackwallet/hive/db.dart';
|
||||||
import 'package:stackwallet/models/balance.dart';
|
import 'package:stackwallet/models/balance.dart';
|
||||||
import 'package:stackwallet/models/isar/models/isar_models.dart' as isar_models;
|
import 'package:stackwallet/models/isar/models/isar_models.dart' as isar_models;
|
||||||
import 'package:stackwallet/models/models.dart';
|
import 'package:stackwallet/models/models.dart';
|
||||||
|
@ -227,4 +228,18 @@ class Manager with ChangeNotifier {
|
||||||
int get currentHeight => _currentWallet.storedChainHeight;
|
int get currentHeight => _currentWallet.storedChainHeight;
|
||||||
|
|
||||||
bool get hasPaynymSupport => _currentWallet is PaynymWalletInterface;
|
bool get hasPaynymSupport => _currentWallet is PaynymWalletInterface;
|
||||||
|
|
||||||
|
int get rescanOnOpenVersion =>
|
||||||
|
DB.instance.get<dynamic>(
|
||||||
|
boxName: DB.boxNameDBInfo,
|
||||||
|
key: "rescan_on_open_$walletId",
|
||||||
|
) as int? ??
|
||||||
|
0;
|
||||||
|
|
||||||
|
Future<void> resetRescanOnOpen() async {
|
||||||
|
await DB.instance.delete<dynamic>(
|
||||||
|
key: "rescan_on_open_$walletId",
|
||||||
|
boxName: DB.boxNameDBInfo,
|
||||||
|
);
|
||||||
|
}
|
||||||
}
|
}
|
||||||
|
|
|
@ -21,7 +21,8 @@ abstract class Constants {
|
||||||
}
|
}
|
||||||
|
|
||||||
static bool enableExchange = Util.isDesktop || !Platform.isIOS;
|
static bool enableExchange = Util.isDesktop || !Platform.isIOS;
|
||||||
static bool enableBuy = true; // true for development, TODO change to "Util.isDesktop || !Platform.isIOS;" as above or even just = enableExchange
|
static bool enableBuy =
|
||||||
|
true; // true for development, TODO change to "Util.isDesktop || !Platform.isIOS;" as above or even just = enableExchange
|
||||||
|
|
||||||
//TODO: correct for monero?
|
//TODO: correct for monero?
|
||||||
static const int _satsPerCoinMonero = 1000000000000;
|
static const int _satsPerCoinMonero = 1000000000000;
|
||||||
|
@ -41,6 +42,8 @@ abstract class Constants {
|
||||||
|
|
||||||
static const int currentHiveDbVersion = 5;
|
static const int currentHiveDbVersion = 5;
|
||||||
|
|
||||||
|
static const int rescanV1 = 1;
|
||||||
|
|
||||||
static int satsPerCoin(Coin coin) {
|
static int satsPerCoin(Coin coin) {
|
||||||
switch (coin) {
|
switch (coin) {
|
||||||
case Coin.bitcoin:
|
case Coin.bitcoin:
|
||||||
|
|
|
@ -8,6 +8,7 @@ import 'package:stackwallet/models/node_model.dart';
|
||||||
import 'package:stackwallet/services/mixins/wallet_db.dart';
|
import 'package:stackwallet/services/mixins/wallet_db.dart';
|
||||||
import 'package:stackwallet/services/node_service.dart';
|
import 'package:stackwallet/services/node_service.dart';
|
||||||
import 'package:stackwallet/services/wallets_service.dart';
|
import 'package:stackwallet/services/wallets_service.dart';
|
||||||
|
import 'package:stackwallet/utilities/constants.dart';
|
||||||
import 'package:stackwallet/utilities/default_nodes.dart';
|
import 'package:stackwallet/utilities/default_nodes.dart';
|
||||||
import 'package:stackwallet/utilities/enums/coin_enum.dart';
|
import 'package:stackwallet/utilities/enums/coin_enum.dart';
|
||||||
import 'package:stackwallet/utilities/flutter_secure_storage_interface.dart';
|
import 'package:stackwallet/utilities/flutter_secure_storage_interface.dart';
|
||||||
|
@ -222,6 +223,13 @@ class DbVersionMigrator with WalletDB {
|
||||||
await secureStore.write(
|
await secureStore.write(
|
||||||
key: '${walletId}_mnemonicPassphrase', value: "");
|
key: '${walletId}_mnemonicPassphrase', value: "");
|
||||||
}
|
}
|
||||||
|
|
||||||
|
// set flag to initiate full rescan on opening wallet
|
||||||
|
await DB.instance.put<dynamic>(
|
||||||
|
boxName: DB.boxNameDBInfo,
|
||||||
|
key: "rescan_on_open_$walletId",
|
||||||
|
value: Constants.rescanV1,
|
||||||
|
);
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
|
@ -11,11 +11,15 @@ class CustomLoadingOverlay extends ConsumerStatefulWidget {
|
||||||
const CustomLoadingOverlay({
|
const CustomLoadingOverlay({
|
||||||
Key? key,
|
Key? key,
|
||||||
required this.message,
|
required this.message,
|
||||||
|
this.subMessage,
|
||||||
required this.eventBus,
|
required this.eventBus,
|
||||||
|
this.textColor,
|
||||||
}) : super(key: key);
|
}) : super(key: key);
|
||||||
|
|
||||||
final String message;
|
final String message;
|
||||||
|
final String? subMessage;
|
||||||
final EventBus? eventBus;
|
final EventBus? eventBus;
|
||||||
|
final Color? textColor;
|
||||||
|
|
||||||
@override
|
@override
|
||||||
ConsumerState<CustomLoadingOverlay> createState() =>
|
ConsumerState<CustomLoadingOverlay> createState() =>
|
||||||
|
@ -56,10 +60,12 @@ class _CustomLoadingOverlayState extends ConsumerState<CustomLoadingOverlay> {
|
||||||
children: [
|
children: [
|
||||||
Text(
|
Text(
|
||||||
widget.message,
|
widget.message,
|
||||||
|
textAlign: TextAlign.center,
|
||||||
style: STextStyles.pageTitleH2(context).copyWith(
|
style: STextStyles.pageTitleH2(context).copyWith(
|
||||||
color: Theme.of(context)
|
color: widget.textColor ??
|
||||||
.extension<StackColors>()!
|
Theme.of(context)
|
||||||
.loadingOverlayTextColor,
|
.extension<StackColors>()!
|
||||||
|
.loadingOverlayTextColor,
|
||||||
),
|
),
|
||||||
),
|
),
|
||||||
if (widget.eventBus != null)
|
if (widget.eventBus != null)
|
||||||
|
@ -70,11 +76,28 @@ class _CustomLoadingOverlayState extends ConsumerState<CustomLoadingOverlay> {
|
||||||
Text(
|
Text(
|
||||||
"${(_percent * 100).toStringAsFixed(2)}%",
|
"${(_percent * 100).toStringAsFixed(2)}%",
|
||||||
style: STextStyles.pageTitleH2(context).copyWith(
|
style: STextStyles.pageTitleH2(context).copyWith(
|
||||||
color: Theme.of(context)
|
color: widget.textColor ??
|
||||||
.extension<StackColors>()!
|
Theme.of(context)
|
||||||
.loadingOverlayTextColor,
|
.extension<StackColors>()!
|
||||||
|
.loadingOverlayTextColor,
|
||||||
),
|
),
|
||||||
),
|
),
|
||||||
|
if (widget.subMessage != null)
|
||||||
|
const SizedBox(
|
||||||
|
height: 10,
|
||||||
|
),
|
||||||
|
if (widget.subMessage != null)
|
||||||
|
Text(
|
||||||
|
widget.subMessage!,
|
||||||
|
textAlign: TextAlign.center,
|
||||||
|
style: STextStyles.pageTitleH2(context).copyWith(
|
||||||
|
fontSize: 14,
|
||||||
|
color: widget.textColor ??
|
||||||
|
Theme.of(context)
|
||||||
|
.extension<StackColors>()!
|
||||||
|
.loadingOverlayTextColor,
|
||||||
|
),
|
||||||
|
)
|
||||||
],
|
],
|
||||||
),
|
),
|
||||||
),
|
),
|
||||||
|
|
Loading…
Reference in a new issue