fix: Generic fixes of bugs from Support (#1774)
David Adegoke committed
Oct 31, 2024 at 02:10 UTC
752b6bbebf7e975840f11ff569f13bff7600d1ea
10 files changed
+46
-6
cw_bitcoin/lib/electrum_wallet.dart
+2
@@ -2270,6 +2270,8 @@ abstract class ElectrumWalletBase extends WalletBase<
2270
Timer(Duration(seconds: 5), () {
2271
if (this.syncStatus is NotConnectedSyncStatus ||
2272
this.syncStatus is LostConnectionSyncStatus) {
2273
+ if (node == null) return;
2274
+
2275
this.electrumClient.connectToUri(
2276
node!.uri,
2277
useSSL: node!.useSSL ?? false,
cw_haven/lib/haven_wallet_addresses.dart
+2
@@ -23,6 +23,8 @@ abstract class HavenWalletAddressesBase extends WalletAddressesWithAccount<Accou
23
@observable
24
String address;
25
26
+ String get primaryAddress => address;
27
+
28
// @override
29
@observable
30
Account? account;
lib/core/wallet_connect/web3wallet_service.dart
+8
@@ -267,6 +267,8 @@ abstract class Web3WalletServiceBase with Store {
267
268
final keyForWallet = getKeyForStoringTopicsForWallet();
269
270
+ if (keyForWallet.isEmpty) return;
271
+
272
final currentTopicsForWallet = getPairingTopicsForWallet(keyForWallet);
273
274
final filteredPairings =
@@ -360,6 +362,10 @@ abstract class Web3WalletServiceBase with Store {
362
String getKeyForStoringTopicsForWallet() {
363
List<ChainKeyModel> chainKeys = walletKeyService.getKeysForChain(appStore.wallet!);
364
365
+ if (chainKeys.isEmpty) {
366
+ return '';
367
+ }
368
+
369
final keyForPairingTopic =
370
PreferencesKey.walletConnectPairingTopicsListForWallet(chainKeys.first.publicKey);
371
@@ -386,6 +392,8 @@ abstract class Web3WalletServiceBase with Store {
392
// Get key specific to the current wallet
393
final key = getKeyForStoringTopicsForWallet();
394
395
+ if (key.isEmpty) return;
396
+
397
// Get all pairing topics attached to this key
398
final pairingTopicsForWallet = getPairingTopicsForWallet(key);
399
lib/entities/fiat_currency.dart
+1
-1
@@ -114,7 +114,7 @@ class FiatCurrency extends EnumerableItem<String> with Serializable<String> impl
114
FiatCurrency.tur.raw: FiatCurrency.tur,
115
};
116
117
- static FiatCurrency deserialize({required String raw}) => _all[raw]!;
117
+ static FiatCurrency deserialize({required String raw}) => _all[raw] ?? FiatCurrency.usd;
118
119
@override
120
bool operator ==(Object other) => other is FiatCurrency && other.raw == raw;
lib/src/screens/dashboard/desktop_widgets/desktop_wallet_selection_dropdown.dart
+6
-2
@@ -10,7 +10,6 @@ import 'package:cake_wallet/src/screens/dashboard/desktop_widgets/dropdown_item_
10
import 'package:cake_wallet/src/screens/wallet_unlock/wallet_unlock_arguments.dart';
11
import 'package:cake_wallet/src/widgets/alert_with_two_actions.dart';
12
import 'package:cake_wallet/store/settings_store.dart';
13
-import 'package:cake_wallet/themes/extensions/cake_text_theme.dart';
13
import 'package:cake_wallet/themes/extensions/menu_theme.dart';
14
import 'package:cake_wallet/utils/show_bar.dart';
15
import 'package:cake_wallet/utils/show_pop_up.dart';
@@ -100,6 +99,11 @@ class _DesktopWalletSelectionDropDownState extends State<DesktopWalletSelectionD
99
),
100
];
101
102
+ final selectedItem = dropDownItems.firstWhere(
103
+ (element) => element.isSelected,
104
+ orElse: () => dropDownItems.first,
105
+ );
106
+
107
return DropdownButton<DesktopDropdownItem>(
108
items: dropDownItems
109
.map(
@@ -115,7 +119,7 @@ class _DesktopWalletSelectionDropDownState extends State<DesktopWalletSelectionD
119
dropdownColor: themeData.extension<CakeMenuTheme>()!.backgroundColor,
120
style: TextStyle(color: themeData.extension<CakeTextTheme>()!.titleColor),
121
selectedItemBuilder: (context) => dropDownItems.map((item) => item.child).toList(),
118
- value: dropDownItems.firstWhere((element) => element.isSelected),
122
+ value: selectedItem,
123
underline: const SizedBox(),
124
focusColor: Colors.transparent,
125
borderRadius: BorderRadius.circular(15.0),
lib/src/screens/wallet_connect/widgets/modals/bottom_sheet_listener.dart
+3
-1
@@ -52,7 +52,9 @@ class BottomSheetListenerState extends State<BottomSheetListener> {
52
);
53
},
54
);
55
- item.completer.complete(value);
55
+ if (!item.completer.isCompleted) {
56
+ item.completer.complete(value);
57
+ }
58
widget.bottomSheetService.resetCurrentSheet();
59
}
60
}
lib/src/widgets/cake_image_widget.dart
+2
@@ -25,6 +25,7 @@ class CakeImageWidget extends StatelessWidget {
25
imageUrl!,
26
height: height,
27
width: width,
28
+ errorBuilder: (_, __, ___) => Icon(Icons.error),
29
);
30
}
31
@@ -33,6 +34,7 @@ class CakeImageWidget extends StatelessWidget {
34
imageUrl!,
35
height: height,
36
width: width,
37
+ placeholderBuilder: (_) => Icon(Icons.error),
38
);
39
}
40
lib/src/widgets/services_updates_widget.dart
+2
@@ -46,6 +46,7 @@ class _ServicesUpdatesWidgetState extends State<ServicesUpdatesWidget> {
46
"assets/images/notification_icon.svg",
47
color: Theme.of(context).extension<DashboardPageTheme>()!.pageTitleTextColor,
48
width: 30,
49
+ placeholderBuilder: (_) => Icon(Icons.error),
50
),
51
);
52
}
@@ -136,6 +137,7 @@ class _ServicesUpdatesWidgetState extends State<ServicesUpdatesWidget> {
137
"assets/images/notification_icon.svg",
138
color: Theme.of(context).extension<DashboardPageTheme>()!.pageTitleTextColor,
139
width: 30,
140
+ placeholderBuilder: (_) => Icon(Icons.error),
141
),
142
if (state.hasData && state.data!.hasUpdates && !wasOpened)
143
Container(
lib/utils/exception_handler.dart
+8
@@ -62,6 +62,14 @@ class ExceptionHandler {
62
63
await _addDeviceInfo(_file!);
64
65
+ // Check if a mail client is available
66
+ final bool canSend = await FlutterMailer.canSendMail();
67
+
68
+ if (Platform.isIOS && !canSend) {
69
+ debugPrint('Mail app is not available');
70
+ return;
71
+ }
72
+
73
final MailOptions mailOptions = MailOptions(
74
subject: 'Mobile App Issue',
75
recipients: ['support@cakewallet.com'],
lib/utils/image_utill.dart
+12
-2
@@ -53,8 +53,18 @@ class ImageUtil {
53
);
54
} else {
55
return isSvg
56
- ? SvgPicture.asset(imagePath, height: _height, width: _width)
57
- : Image.asset(imagePath, height: _height, width: _width);
56
+ ? SvgPicture.asset(
57
+ imagePath,
58
+ height: _height,
59
+ width: _width,
60
+ placeholderBuilder: (_) => Icon(Icons.error),
61
+ )
62
+ : Image.asset(
63
+ imagePath,
64
+ height: _height,
65
+ width: _width,
66
+ errorBuilder: (_, __, ___) => Icon(Icons.error),
67
+ );
68
}
69
}
70
}