mirror of
https://github.com/cypherstack/stack_wallet.git
synced 2025-01-08 19:59:29 +00:00
various frost ui flow tweaks and fixes
This commit is contained in:
parent
e2fe526be4
commit
0d3ae2a635
21 changed files with 60 additions and 50 deletions
|
@ -172,7 +172,7 @@ class _FrostReshareStep1cState extends ConsumerState<FrostReshareStep1c> {
|
|||
whileFuture: _createWallet(),
|
||||
context: context,
|
||||
message: "Setting up wallet",
|
||||
isDesktop: Util.isDesktop,
|
||||
rootNavigator: true,
|
||||
onException: (e) => ex = e,
|
||||
);
|
||||
|
||||
|
@ -191,6 +191,8 @@ class _FrostReshareStep1cState extends ConsumerState<FrostReshareStep1c> {
|
|||
frostInterruptionDialogType:
|
||||
FrostInterruptionDialogType.resharing,
|
||||
);
|
||||
ref.read(pFrostMyName.state).state =
|
||||
ref.read(pFrostResharingData).myName!;
|
||||
ref.read(pFrostCreateCurrentStep.state).state = 2;
|
||||
await Navigator.of(context).pushNamed(
|
||||
ref
|
||||
|
|
|
@ -179,23 +179,25 @@ class _FrostReshareStep3abdState extends ConsumerState<FrostReshareStep3abd> {
|
|||
],
|
||||
),
|
||||
if (!Util.isDesktop) const Spacer(),
|
||||
const SizedBox(
|
||||
height: 12,
|
||||
),
|
||||
CheckboxTextButton(
|
||||
label: "I have verified that everyone has my encryption key",
|
||||
onChanged: (value) {
|
||||
setState(() {
|
||||
_userVerifyContinue = value;
|
||||
});
|
||||
},
|
||||
),
|
||||
if (!amOutgoingParticipant)
|
||||
const SizedBox(
|
||||
height: 12,
|
||||
),
|
||||
if (!amOutgoingParticipant)
|
||||
CheckboxTextButton(
|
||||
label: "I have verified that everyone has my encryption key",
|
||||
onChanged: (value) {
|
||||
setState(() {
|
||||
_userVerifyContinue = value;
|
||||
});
|
||||
},
|
||||
),
|
||||
const SizedBox(
|
||||
height: 16,
|
||||
),
|
||||
PrimaryButton(
|
||||
label: "Continue",
|
||||
enabled: _userVerifyContinue &&
|
||||
enabled: (amOutgoingParticipant || _userVerifyContinue) &&
|
||||
!fieldIsEmptyFlags.reduce((v, e) => v |= e),
|
||||
onPressed: _onPressed,
|
||||
),
|
||||
|
|
|
@ -40,6 +40,7 @@ class _FrostReshareStep4State extends ConsumerState<FrostReshareStep4> {
|
|||
late final int? myResharerIndexIndex;
|
||||
late final String? myResharerComplete;
|
||||
late final bool amOutgoingParticipant;
|
||||
late final bool amNewParticipant;
|
||||
|
||||
final List<bool> fieldIsEmptyFlags = [];
|
||||
|
||||
|
@ -55,7 +56,8 @@ class _FrostReshareStep4State extends ConsumerState<FrostReshareStep4> {
|
|||
try {
|
||||
if (amOutgoingParticipant) {
|
||||
ref.read(pFrostResharingData).reset();
|
||||
Navigator.of(context).popUntil(
|
||||
// nav broken on desktop
|
||||
Navigator.of(context, rootNavigator: !Util.isDesktop).popUntil(
|
||||
ModalRoute.withName(
|
||||
Util.isDesktop ? DesktopWalletView.routeName : WalletView.routeName,
|
||||
),
|
||||
|
@ -104,7 +106,7 @@ class _FrostReshareStep4State extends ConsumerState<FrostReshareStep4> {
|
|||
|
||||
@override
|
||||
void initState() {
|
||||
final amNewParticipant =
|
||||
amNewParticipant =
|
||||
ref.read(pFrostResharingData).startResharerData == null &&
|
||||
ref.read(pFrostResharingData).incompleteWallet != null &&
|
||||
ref.read(pFrostResharingData).incompleteWallet?.walletId ==
|
||||
|
@ -217,20 +219,22 @@ class _FrostReshareStep4State extends ConsumerState<FrostReshareStep4> {
|
|||
const SizedBox(
|
||||
height: 16,
|
||||
),
|
||||
CheckboxTextButton(
|
||||
label: "I have verified that everyone has my resharer complete",
|
||||
onChanged: (value) {
|
||||
setState(() {
|
||||
_userVerifyContinue = value;
|
||||
});
|
||||
},
|
||||
),
|
||||
const SizedBox(
|
||||
height: 16,
|
||||
),
|
||||
if (!amNewParticipant)
|
||||
CheckboxTextButton(
|
||||
label: "I have verified that everyone has my resharer complete",
|
||||
onChanged: (value) {
|
||||
setState(() {
|
||||
_userVerifyContinue = value;
|
||||
});
|
||||
},
|
||||
),
|
||||
if (!amNewParticipant)
|
||||
const SizedBox(
|
||||
height: 16,
|
||||
),
|
||||
PrimaryButton(
|
||||
label: amOutgoingParticipant ? "Exit" : "Complete",
|
||||
enabled: _userVerifyContinue &&
|
||||
label: amOutgoingParticipant ? "Done" : "Complete",
|
||||
enabled: (amNewParticipant || _userVerifyContinue) &&
|
||||
(amOutgoingParticipant ||
|
||||
!fieldIsEmptyFlags.reduce((v, e) => v |= e)),
|
||||
onPressed: _onPressed,
|
||||
|
|
|
@ -84,7 +84,7 @@ class _FrostReshareStep5State extends ConsumerState<FrostReshareStep5> {
|
|||
),
|
||||
context: context,
|
||||
message: isNew ? "Creating wallet" : "Updating wallet data",
|
||||
isDesktop: Util.isDesktop,
|
||||
rootNavigator: true,
|
||||
onException: (e) => ex = e,
|
||||
);
|
||||
|
||||
|
|
|
@ -130,7 +130,7 @@ class _RestoreFrostMsWalletViewState
|
|||
whileFuture: _createWalletAndRecover(),
|
||||
context: context,
|
||||
message: "Restoring wallet...",
|
||||
isDesktop: Util.isDesktop,
|
||||
rootNavigator: Util.isDesktop,
|
||||
onException: (e) {
|
||||
ex = e;
|
||||
},
|
||||
|
|
|
@ -79,7 +79,7 @@ class _FusionProgressViewState extends ConsumerState<FusionProgressView> {
|
|||
Future<void>.delayed(const Duration(seconds: 2)),
|
||||
]),
|
||||
context: context,
|
||||
isDesktop: Util.isDesktop,
|
||||
rootNavigator: Util.isDesktop,
|
||||
message: "Stopping fusion",
|
||||
);
|
||||
|
||||
|
|
|
@ -349,7 +349,7 @@ class _MonkeyViewState extends ConsumerState<MonkeyView> {
|
|||
),
|
||||
]),
|
||||
context: context,
|
||||
isDesktop: Util.isDesktop,
|
||||
rootNavigator: Util.isDesktop,
|
||||
message: "Saving MonKey svg",
|
||||
onException: (e) {
|
||||
didError = true;
|
||||
|
@ -402,7 +402,7 @@ class _MonkeyViewState extends ConsumerState<MonkeyView> {
|
|||
const Duration(seconds: 2)),
|
||||
]),
|
||||
context: context,
|
||||
isDesktop: Util.isDesktop,
|
||||
rootNavigator: Util.isDesktop,
|
||||
message: "Downloading MonKey png",
|
||||
onException: (e) {
|
||||
didError = true;
|
||||
|
@ -500,7 +500,7 @@ class _MonkeyViewState extends ConsumerState<MonkeyView> {
|
|||
Future<void>.delayed(const Duration(seconds: 2)),
|
||||
]),
|
||||
context: context,
|
||||
isDesktop: Util.isDesktop,
|
||||
rootNavigator: Util.isDesktop,
|
||||
message: "Fetching MonKey",
|
||||
subMessage: "We are fetching your MonKey",
|
||||
onException: (e) {
|
||||
|
|
|
@ -321,7 +321,7 @@ class _OrdinalImageGroup extends ConsumerWidget {
|
|||
final filePath = await showLoading<String>(
|
||||
whileFuture: _savePngToFile(ref),
|
||||
context: context,
|
||||
isDesktop: true,
|
||||
rootNavigator: true,
|
||||
message: "Saving ordinal image",
|
||||
onException: (e) {
|
||||
didError = true;
|
||||
|
|
|
@ -116,7 +116,7 @@ class _FrostSendViewState extends ConsumerState<FrostSendView> {
|
|||
whileFuture: _loadingFuture(),
|
||||
context: context,
|
||||
message: "Generating sign config",
|
||||
isDesktop: Util.isDesktop,
|
||||
rootNavigator: Util.isDesktop,
|
||||
onException: (e) {
|
||||
throw e;
|
||||
},
|
||||
|
|
|
@ -212,7 +212,7 @@ class _FrostSendStep4State extends ConsumerState<FrostSendStep4> {
|
|||
),
|
||||
context: context,
|
||||
message: "Broadcasting transaction to network",
|
||||
isDesktop: true, // used to pop using root nav
|
||||
rootNavigator: true, // used to pop using root nav
|
||||
onException: (e) {
|
||||
ex = e;
|
||||
},
|
||||
|
|
|
@ -83,7 +83,7 @@ class _ChangeRepresentativeViewState
|
|||
whileFuture: changeFuture(_textController.text),
|
||||
context: context,
|
||||
message: "Updating representative...",
|
||||
isDesktop: Util.isDesktop,
|
||||
rootNavigator: Util.isDesktop,
|
||||
onException: (ex) {
|
||||
String msg = ex.toString();
|
||||
while (msg.isNotEmpty && msg.startsWith("Exception:")) {
|
||||
|
|
|
@ -98,7 +98,7 @@ class _MyTokenSelectItemState extends ConsumerState<MyTokenSelectItem> {
|
|||
final success = await showLoading<bool>(
|
||||
whileFuture: _loadTokenWallet(context, ref),
|
||||
context: context,
|
||||
isDesktop: isDesktop,
|
||||
rootNavigator: isDesktop,
|
||||
message: "Loading ${widget.token.name}",
|
||||
);
|
||||
|
||||
|
|
|
@ -127,7 +127,7 @@ class _FavoriteCardState extends ConsumerState<FavoriteCard> {
|
|||
whileFuture: loadFuture,
|
||||
context: context,
|
||||
message: 'Opening ${wallet.info.name}',
|
||||
isDesktop: Util.isDesktop,
|
||||
rootNavigator: Util.isDesktop,
|
||||
);
|
||||
|
||||
if (mounted) {
|
||||
|
|
|
@ -95,7 +95,7 @@ class WalletListItem extends ConsumerWidget {
|
|||
whileFuture: loadFuture,
|
||||
context: context,
|
||||
message: 'Opening ${wallet.info.name}',
|
||||
isDesktop: Util.isDesktop,
|
||||
rootNavigator: Util.isDesktop,
|
||||
);
|
||||
if (context.mounted) {
|
||||
unawaited(
|
||||
|
|
|
@ -132,7 +132,7 @@ class _FusionDialogViewState extends ConsumerState<FusionDialogView> {
|
|||
Future<void>.delayed(const Duration(seconds: 2)),
|
||||
]),
|
||||
context: context,
|
||||
isDesktop: true,
|
||||
rootNavigator: true,
|
||||
message: "Stopping fusion",
|
||||
);
|
||||
|
||||
|
|
|
@ -92,7 +92,7 @@ class CoinWalletsTable extends ConsumerWidget {
|
|||
whileFuture: loadFuture,
|
||||
context: context,
|
||||
message: 'Opening ${wallet.info.name}',
|
||||
isDesktop: Util.isDesktop,
|
||||
rootNavigator: Util.isDesktop,
|
||||
);
|
||||
|
||||
if (context.mounted) {
|
||||
|
|
|
@ -234,7 +234,7 @@ class _DesktopOrdinalDetailsViewState
|
|||
final path = await showLoading<String>(
|
||||
whileFuture: _savePngToFile(),
|
||||
context: context,
|
||||
isDesktop: true,
|
||||
rootNavigator: true,
|
||||
message: "Saving ordinal image",
|
||||
onException: (e) {
|
||||
didError = true;
|
||||
|
|
|
@ -210,7 +210,7 @@ class _DesktopOrdinals extends ConsumerState<DesktopOrdinalsView> {
|
|||
onPressed: () async {
|
||||
// show loading for a minimum of 2 seconds on refreshing
|
||||
await showLoading(
|
||||
isDesktop: true,
|
||||
rootNavigator: true,
|
||||
whileFuture: Future.wait<void>([
|
||||
Future.delayed(const Duration(seconds: 2)),
|
||||
(ref.read(pWallets).getWallet(widget.walletId)
|
||||
|
|
|
@ -20,7 +20,7 @@ Future<T?> showLoading<T>({
|
|||
required BuildContext context,
|
||||
required String message,
|
||||
String? subMessage,
|
||||
bool isDesktop = false,
|
||||
bool rootNavigator = false,
|
||||
bool opaqueBG = false,
|
||||
void Function(Exception)? onException,
|
||||
}) async {
|
||||
|
@ -59,7 +59,7 @@ Future<T?> showLoading<T>({
|
|||
}
|
||||
|
||||
if (context.mounted) {
|
||||
Navigator.of(context, rootNavigator: isDesktop).pop();
|
||||
Navigator.of(context, rootNavigator: rootNavigator).pop();
|
||||
if (ex != null) {
|
||||
onException?.call(ex);
|
||||
}
|
||||
|
|
|
@ -35,7 +35,9 @@ class IncompleteFrostWallet {
|
|||
threshold: -1,
|
||||
);
|
||||
|
||||
await mainDB.isar.frostWalletInfo.put(frostInfo);
|
||||
await mainDB.isar.writeTxn(() async {
|
||||
await mainDB.isar.frostWalletInfo.put(frostInfo);
|
||||
});
|
||||
|
||||
return wallet as BitcoinFrostWallet;
|
||||
}
|
||||
|
|
|
@ -137,7 +137,7 @@ class SimpleWalletCard extends ConsumerWidget {
|
|||
whileFuture: loadFuture,
|
||||
context: context,
|
||||
message: 'Opening ${wallet.info.name}',
|
||||
isDesktop: Util.isDesktop,
|
||||
rootNavigator: Util.isDesktop,
|
||||
);
|
||||
if (popPrevious) nav.pop();
|
||||
|
||||
|
@ -167,7 +167,7 @@ class SimpleWalletCard extends ConsumerWidget {
|
|||
context: desktopNavigatorState?.context ?? context,
|
||||
opaqueBG: true,
|
||||
message: "Loading ${contract.name}",
|
||||
isDesktop: Util.isDesktop,
|
||||
rootNavigator: Util.isDesktop,
|
||||
);
|
||||
|
||||
if (!success!) {
|
||||
|
|
Loading…
Reference in a new issue