Windows fix (#1624)
* CW-488 Fix missing Wownero logo * Temporary fix for windows
Konstantin Ullrich committed
Aug 19, 2024 at 16:06 UTC
5449b94ba42c4e60d8cfd2a55696ee0f288a767a
2 files changed
+21
-18
lib/src/screens/dashboard/desktop_widgets/desktop_wallet_selection_dropdown.dart
+13
-16
@@ -1,5 +1,4 @@
1
import 'package:another_flushbar/flushbar.dart';
2
-import 'package:cake_wallet/themes/extensions/cake_text_theme.dart';
2
import 'package:cake_wallet/core/auth_service.dart';
3
import 'package:cake_wallet/entities/desktop_dropdown_item.dart';
4
import 'package:cake_wallet/generated/i18n.dart';
@@ -8,8 +7,9 @@ import 'package:cake_wallet/src/screens/auth/auth_page.dart';
7
import 'package:cake_wallet/src/screens/dashboard/desktop_widgets/dropdown_item_widget.dart';
8
import 'package:cake_wallet/src/screens/wallet_unlock/wallet_unlock_arguments.dart';
9
import 'package:cake_wallet/src/widgets/alert_with_two_actions.dart';
11
-import 'package:cake_wallet/themes/extensions/menu_theme.dart';
10
import 'package:cake_wallet/store/settings_store.dart';
11
+import 'package:cake_wallet/themes/extensions/cake_text_theme.dart';
12
+import 'package:cake_wallet/themes/extensions/menu_theme.dart';
13
import 'package:cake_wallet/utils/show_bar.dart';
14
import 'package:cake_wallet/utils/show_pop_up.dart';
15
import 'package:cake_wallet/view_model/wallet_list/wallet_list_item.dart';
@@ -122,9 +122,7 @@ class _DesktopWalletSelectionDropDownState extends State<DesktopWalletSelectionD
122
}
123
124
void _onSelectedWallet(WalletListItem selectedWallet) async {
125
- if (selectedWallet.isCurrent || !selectedWallet.isEnabled) {
126
- return;
127
- }
125
+ if (selectedWallet.isCurrent || !selectedWallet.isEnabled) return;
126
127
WidgetsBinding.instance.addPostFrameCallback((_) async {
128
final confirmed = await showPopUp<bool>(
@@ -149,9 +147,7 @@ class _DesktopWalletSelectionDropDownState extends State<DesktopWalletSelectionD
147
Image _imageFor({required WalletType type, bool? isTestnet}) {
148
switch (type) {
149
case WalletType.bitcoin:
152
- if (isTestnet == true) {
153
- return tBitcoinIcon;
154
- }
150
+ if (isTestnet == true) return tBitcoinIcon;
151
return bitcoinIcon;
152
case WalletType.monero:
153
return moneroIcon;
@@ -173,6 +169,8 @@ class _DesktopWalletSelectionDropDownState extends State<DesktopWalletSelectionD
169
return solanaIcon;
170
case WalletType.tron:
171
return tronIcon;
172
+ case WalletType.wownero:
173
+ return wowneroIcon;
174
default:
175
return nonWalletTypeIcon;
176
}
@@ -180,24 +178,23 @@ class _DesktopWalletSelectionDropDownState extends State<DesktopWalletSelectionD
178
179
Future<void> _loadWallet(WalletListItem wallet) async {
180
if (SettingsStoreBase.walletPasswordDirectInput) {
183
- Navigator.of(context).pushNamed(
184
- Routes.walletUnlockLoadable,
181
+ Navigator.of(context).pushNamed(Routes.walletUnlockLoadable,
182
arguments: WalletUnlockArguments(
183
callback: (bool isAuthenticatedSuccessfully, AuthPageState auth) async {
184
if (isAuthenticatedSuccessfully) {
185
auth.close();
186
setState(() {});
187
}
191
- }, walletName: wallet.name,
188
+ },
189
+ walletName: wallet.name,
190
walletType: wallet.type));
191
return;
192
}
193
196
- widget._authService.authenticateAction(context,
197
- onAuthSuccess: (isAuthenticatedSuccessfully) async {
198
- if (!isAuthenticatedSuccessfully) {
199
- return;
200
- }
194
+ widget._authService.authenticateAction(
195
+ context,
196
+ onAuthSuccess: (isAuthenticatedSuccessfully) async {
197
+ if (!isAuthenticatedSuccessfully) return;
198
199
try {
200
if (mounted) {
lib/store/settings_store.dart
+8
-2
@@ -1549,8 +1549,14 @@ abstract class SettingsStoreBase with Store {
1549
final macInfo = await deviceInfoPlugin.macOsInfo;
1550
deviceName = macInfo.computerName;
1551
} else if (Platform.isWindows) {
1552
- final windowsInfo = await deviceInfoPlugin.windowsInfo;
1553
- deviceName = windowsInfo.productName;
1552
+ try {
1553
+ final windowsInfo = await deviceInfoPlugin.windowsInfo;
1554
+ deviceName = windowsInfo.productName;
1555
+ } catch (e) {
1556
+ print(e);
1557
+ print('likely digitalProductId is null wait till https://github.com/fluttercommunity/plus_plugins/pull/3188 is merged');
1558
+ deviceName = "Windows Device";
1559
+ }
1560
}
1561
1562
return deviceName;