various frost ui flow tweaks and fixes

This commit is contained in:
Julian 2024-05-03 12:22:19 -06:00
parent e2fe526be4
commit 0d3ae2a635
21 changed files with 60 additions and 50 deletions

View file

@ -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

View file

@ -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,
),

View file

@ -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,

View file

@ -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,
);

View file

@ -130,7 +130,7 @@ class _RestoreFrostMsWalletViewState
whileFuture: _createWalletAndRecover(),
context: context,
message: "Restoring wallet...",
isDesktop: Util.isDesktop,
rootNavigator: Util.isDesktop,
onException: (e) {
ex = e;
},

View file

@ -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",
);

View file

@ -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) {

View file

@ -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;

View file

@ -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;
},

View file

@ -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;
},

View file

@ -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:")) {

View file

@ -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}",
);

View file

@ -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) {

View file

@ -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(

View file

@ -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",
);

View file

@ -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) {

View file

@ -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;

View file

@ -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)

View file

@ -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);
}

View file

@ -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;
}

View file

@ -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!) {