Skip to content

Commit e314847

Browse files
Merge pull request #1257 from cypherstack/julian/fixes
Julian/fixes
2 parents adf1bc8 + bdb1d41 commit e314847

File tree

6 files changed

+120
-126
lines changed

6 files changed

+120
-126
lines changed

lib/db/isar/main_db.dart

Lines changed: 12 additions & 12 deletions
Original file line numberDiff line numberDiff line change
@@ -8,6 +8,8 @@
88
*
99
*/
1010

11+
import 'dart:io';
12+
1113
import 'package:decimal/decimal.dart';
1214
import 'package:isar_community/isar.dart';
1315
import 'package:tuple/tuple.dart';
@@ -76,7 +78,7 @@ class MainDB {
7678
// inspector: kDebugMode,
7779
inspector: false,
7880
name: "wallet_data",
79-
maxSizeMiB: 512,
81+
maxSizeMiB: Platform.isWindows ? 1024 : 512,
8082
);
8183
return true;
8284
}
@@ -445,18 +447,16 @@ class MainDB {
445447

446448
//
447449
Future<void> deleteWalletBlockchainData(String walletId) async {
448-
final transactionCount = await getTransactions(walletId).count();
449-
final transactionCountV2 = await isar.transactionV2s
450-
.where()
451-
.walletIdEqualTo(walletId)
452-
.count();
453-
final addressCount = await getAddresses(walletId).count();
454-
final utxoCount = await getUTXOs(walletId).count();
455-
// final lelantusCoinCount =
456-
// await isar.lelantusCoins.where().walletIdEqualTo(walletId).count();
457-
458450
await isar.writeTxn(() async {
459-
const paginateLimit = 50;
451+
final transactionCount = await getTransactions(walletId).count();
452+
final transactionCountV2 = await isar.transactionV2s
453+
.where()
454+
.walletIdEqualTo(walletId)
455+
.count();
456+
final addressCount = await getAddresses(walletId).count();
457+
final utxoCount = await getUTXOs(walletId).count();
458+
459+
const paginateLimit = 100;
460460

461461
// transactions
462462
for (int i = 0; i < transactionCount; i += paginateLimit) {

lib/pages/wallet_view/transaction_views/tx_v2/transaction_v2_list.dart

Lines changed: 5 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -131,9 +131,11 @@ class _TransactionsV2ListState extends ConsumerState<TransactionsV2List> {
131131

132132
_subscription = _query.watch().listen((event) {
133133
WidgetsBinding.instance.addPostFrameCallback((_) {
134-
setState(() {
135-
_transactions = event;
136-
});
134+
if (mounted) {
135+
setState(() {
136+
_transactions = event;
137+
});
138+
}
137139
});
138140
});
139141

lib/pages_desktop_specific/my_stack_view/wallet_view/sub_widgets/delete_wallet_keys_popup.dart

Lines changed: 40 additions & 52 deletions
Original file line numberDiff line numberDiff line change
@@ -13,6 +13,7 @@ import 'dart:async';
1313
import 'package:flutter/material.dart';
1414
import 'package:flutter/services.dart';
1515
import 'package:flutter_riverpod/flutter_riverpod.dart';
16+
1617
import '../../../../notifications/show_flush_bar.dart';
1718
import '../../../../pages/add_wallet_views/new_wallet_recovery_phrase_view/sub_widgets/mnemonic_table.dart';
1819
import '../../../../providers/global/secure_store_provider.dart';
@@ -21,6 +22,7 @@ import '../../../../route_generator.dart';
2122
import '../../../../themes/stack_colors.dart';
2223
import '../../../../utilities/assets.dart';
2324
import '../../../../utilities/clipboard_interface.dart';
25+
import '../../../../utilities/logger.dart';
2426
import '../../../../utilities/text_styles.dart';
2527
import '../../../../wallets/isar/providers/wallet_info_provider.dart';
2628
import '../../../../widgets/desktop/desktop_dialog.dart';
@@ -52,6 +54,11 @@ class _DeleteWalletKeysPopup extends ConsumerState<DeleteWalletKeysPopup> {
5254
late final List<String> _words;
5355
late final ClipboardInterface _clipboardInterface;
5456

57+
static const _recoveryPhraseInfo =
58+
"Please write down your recovery phrase in the correct order and save it "
59+
"to keep your funds secure. "
60+
"You will be shown your recovery phrase on the next screen.";
61+
5562
@override
5663
void initState() {
5764
_walletId = widget.walletId;
@@ -72,61 +79,45 @@ class _DeleteWalletKeysPopup extends ConsumerState<DeleteWalletKeysPopup> {
7279
mainAxisAlignment: MainAxisAlignment.spaceBetween,
7380
children: [
7481
Padding(
75-
padding: const EdgeInsets.only(
76-
left: 32,
77-
),
82+
padding: const EdgeInsets.only(left: 32),
7883
child: Text(
7984
"Wallet keys",
8085
style: STextStyles.desktopH3(context),
8186
),
8287
),
8388
DesktopDialogCloseButton(
8489
onPressedOverride: () {
85-
Navigator.of(
86-
context,
87-
rootNavigator: true,
88-
).pop();
90+
Navigator.of(context, rootNavigator: true).pop();
8991
},
9092
),
9193
],
9294
),
93-
const SizedBox(
94-
height: 28,
95-
),
95+
const SizedBox(height: 28),
9696
Text(
9797
"Recovery phrase",
9898
style: STextStyles.desktopTextMedium(context),
9999
),
100-
const SizedBox(
101-
height: 8,
102-
),
100+
const SizedBox(height: 8),
103101
Center(
104102
child: Padding(
105-
padding: const EdgeInsets.symmetric(
106-
horizontal: 32,
107-
),
103+
padding: const EdgeInsets.symmetric(horizontal: 32),
108104
child: Text(
109-
"Please write down your recovery phrase in the correct order and "
110-
"save it to keep your funds secure. You will be shown your recovery phrase on the next screen.",
105+
_recoveryPhraseInfo,
111106
style: STextStyles.desktopTextExtraExtraSmall(context),
112107
textAlign: TextAlign.center,
113108
),
114109
),
115110
),
116-
const SizedBox(
117-
height: 24,
118-
),
111+
const SizedBox(height: 24),
119112
Padding(
120-
padding: const EdgeInsets.symmetric(
121-
horizontal: 32,
122-
),
113+
padding: const EdgeInsets.symmetric(horizontal: 32),
123114
child: RawMaterialButton(
124115
hoverColor: Colors.transparent,
125116
onPressed: () async {
126117
await _clipboardInterface.setData(
127118
ClipboardData(text: _words.join(" ")),
128119
);
129-
if (mounted) {
120+
if (context.mounted) {
130121
unawaited(
131122
showFloatingFlushBar(
132123
type: FlushBarType.info,
@@ -140,19 +131,15 @@ class _DeleteWalletKeysPopup extends ConsumerState<DeleteWalletKeysPopup> {
140131
child: MnemonicTable(
141132
words: widget.words,
142133
isDesktop: true,
143-
itemBorderColor: Theme.of(context)
144-
.extension<StackColors>()!
145-
.buttonBackSecondary,
134+
itemBorderColor: Theme.of(
135+
context,
136+
).extension<StackColors>()!.buttonBackSecondary,
146137
),
147138
),
148139
),
149-
const SizedBox(
150-
height: 24,
151-
),
140+
const SizedBox(height: 24),
152141
Padding(
153-
padding: const EdgeInsets.symmetric(
154-
horizontal: 32,
155-
),
142+
padding: const EdgeInsets.symmetric(horizontal: 32),
156143
child: Row(
157144
children: [
158145
Expanded(
@@ -162,9 +149,7 @@ class _DeleteWalletKeysPopup extends ConsumerState<DeleteWalletKeysPopup> {
162149
await Navigator.of(context).push(
163150
RouteGenerator.getRoute(
164151
builder: (context) {
165-
return ConfirmDelete(
166-
walletId: _walletId,
167-
);
152+
return ConfirmDelete(walletId: _walletId);
168153
},
169154
settings: const RouteSettings(
170155
name: "/desktopConfirmDelete",
@@ -177,20 +162,15 @@ class _DeleteWalletKeysPopup extends ConsumerState<DeleteWalletKeysPopup> {
177162
],
178163
),
179164
),
180-
const SizedBox(
181-
height: 32,
182-
),
165+
const SizedBox(height: 32),
183166
],
184167
),
185168
);
186169
}
187170
}
188171

189172
class ConfirmDelete extends ConsumerStatefulWidget {
190-
const ConfirmDelete({
191-
super.key,
192-
required this.walletId,
193-
});
173+
const ConfirmDelete({super.key, required this.walletId});
194174

195175
final String walletId;
196176

@@ -207,9 +187,7 @@ class _ConfirmDeleteState extends ConsumerState<ConfirmDelete> {
207187
children: [
208188
const Row(
209189
mainAxisAlignment: MainAxisAlignment.end,
210-
children: [
211-
DesktopDialogCloseButton(),
212-
],
190+
children: [DesktopDialogCloseButton()],
213191
),
214192
Column(
215193
crossAxisAlignment: CrossAxisAlignment.center,
@@ -238,12 +216,22 @@ class _ConfirmDeleteState extends ConsumerState<ConfirmDelete> {
238216
buttonHeight: ButtonHeight.xl,
239217
label: "Continue",
240218
onPressed: () async {
241-
await ref.read(pWallets).deleteWallet(
242-
ref.read(pWalletInfo(widget.walletId)),
243-
ref.read(secureStoreProvider),
244-
);
219+
try {
220+
await ref
221+
.read(pWallets)
222+
.deleteWallet(
223+
ref.read(pWalletInfo(widget.walletId)),
224+
ref.read(secureStoreProvider),
225+
);
226+
} catch (e, s) {
227+
Logging.instance.f(
228+
"Wallet deletion errors",
229+
error: e,
230+
stackTrace: s,
231+
);
232+
}
245233

246-
if (mounted) {
234+
if (context.mounted) {
247235
Navigator.of(context, rootNavigator: true).pop(true);
248236
}
249237
},

0 commit comments

Comments
 (0)