Windows fix (#1624)
Some checks failed
Cache Dependencies / test (push) Has been cancelled

* CW-488 Fix missing Wownero logo

* Temporary fix for windows
This commit is contained in:
Konstantin Ullrich 2024-08-19 16:06:57 +02:00 committed by GitHub
parent 19c600ba10
commit 5449b94ba4
No known key found for this signature in database
GPG key ID: B5690EEEBB952194
2 changed files with 21 additions and 18 deletions

View file

@ -1,5 +1,4 @@
import 'package:another_flushbar/flushbar.dart'; import 'package:another_flushbar/flushbar.dart';
import 'package:cake_wallet/themes/extensions/cake_text_theme.dart';
import 'package:cake_wallet/core/auth_service.dart'; import 'package:cake_wallet/core/auth_service.dart';
import 'package:cake_wallet/entities/desktop_dropdown_item.dart'; import 'package:cake_wallet/entities/desktop_dropdown_item.dart';
import 'package:cake_wallet/generated/i18n.dart'; import 'package:cake_wallet/generated/i18n.dart';
@ -8,8 +7,9 @@ import 'package:cake_wallet/src/screens/auth/auth_page.dart';
import 'package:cake_wallet/src/screens/dashboard/desktop_widgets/dropdown_item_widget.dart'; import 'package:cake_wallet/src/screens/dashboard/desktop_widgets/dropdown_item_widget.dart';
import 'package:cake_wallet/src/screens/wallet_unlock/wallet_unlock_arguments.dart'; import 'package:cake_wallet/src/screens/wallet_unlock/wallet_unlock_arguments.dart';
import 'package:cake_wallet/src/widgets/alert_with_two_actions.dart'; import 'package:cake_wallet/src/widgets/alert_with_two_actions.dart';
import 'package:cake_wallet/themes/extensions/menu_theme.dart';
import 'package:cake_wallet/store/settings_store.dart'; import 'package:cake_wallet/store/settings_store.dart';
import 'package:cake_wallet/themes/extensions/cake_text_theme.dart';
import 'package:cake_wallet/themes/extensions/menu_theme.dart';
import 'package:cake_wallet/utils/show_bar.dart'; import 'package:cake_wallet/utils/show_bar.dart';
import 'package:cake_wallet/utils/show_pop_up.dart'; import 'package:cake_wallet/utils/show_pop_up.dart';
import 'package:cake_wallet/view_model/wallet_list/wallet_list_item.dart'; import 'package:cake_wallet/view_model/wallet_list/wallet_list_item.dart';
@ -122,9 +122,7 @@ class _DesktopWalletSelectionDropDownState extends State<DesktopWalletSelectionD
} }
void _onSelectedWallet(WalletListItem selectedWallet) async { void _onSelectedWallet(WalletListItem selectedWallet) async {
if (selectedWallet.isCurrent || !selectedWallet.isEnabled) { if (selectedWallet.isCurrent || !selectedWallet.isEnabled) return;
return;
}
WidgetsBinding.instance.addPostFrameCallback((_) async { WidgetsBinding.instance.addPostFrameCallback((_) async {
final confirmed = await showPopUp<bool>( final confirmed = await showPopUp<bool>(
@ -149,9 +147,7 @@ class _DesktopWalletSelectionDropDownState extends State<DesktopWalletSelectionD
Image _imageFor({required WalletType type, bool? isTestnet}) { Image _imageFor({required WalletType type, bool? isTestnet}) {
switch (type) { switch (type) {
case WalletType.bitcoin: case WalletType.bitcoin:
if (isTestnet == true) { if (isTestnet == true) return tBitcoinIcon;
return tBitcoinIcon;
}
return bitcoinIcon; return bitcoinIcon;
case WalletType.monero: case WalletType.monero:
return moneroIcon; return moneroIcon;
@ -173,6 +169,8 @@ class _DesktopWalletSelectionDropDownState extends State<DesktopWalletSelectionD
return solanaIcon; return solanaIcon;
case WalletType.tron: case WalletType.tron:
return tronIcon; return tronIcon;
case WalletType.wownero:
return wowneroIcon;
default: default:
return nonWalletTypeIcon; return nonWalletTypeIcon;
} }
@ -180,24 +178,23 @@ class _DesktopWalletSelectionDropDownState extends State<DesktopWalletSelectionD
Future<void> _loadWallet(WalletListItem wallet) async { Future<void> _loadWallet(WalletListItem wallet) async {
if (SettingsStoreBase.walletPasswordDirectInput) { if (SettingsStoreBase.walletPasswordDirectInput) {
Navigator.of(context).pushNamed( Navigator.of(context).pushNamed(Routes.walletUnlockLoadable,
Routes.walletUnlockLoadable,
arguments: WalletUnlockArguments( arguments: WalletUnlockArguments(
callback: (bool isAuthenticatedSuccessfully, AuthPageState auth) async { callback: (bool isAuthenticatedSuccessfully, AuthPageState auth) async {
if (isAuthenticatedSuccessfully) { if (isAuthenticatedSuccessfully) {
auth.close(); auth.close();
setState(() {}); setState(() {});
} }
}, walletName: wallet.name, },
walletName: wallet.name,
walletType: wallet.type)); walletType: wallet.type));
return; return;
} }
widget._authService.authenticateAction(context, widget._authService.authenticateAction(
onAuthSuccess: (isAuthenticatedSuccessfully) async { context,
if (!isAuthenticatedSuccessfully) { onAuthSuccess: (isAuthenticatedSuccessfully) async {
return; if (!isAuthenticatedSuccessfully) return;
}
try { try {
if (mounted) { if (mounted) {

View file

@ -1549,8 +1549,14 @@ abstract class SettingsStoreBase with Store {
final macInfo = await deviceInfoPlugin.macOsInfo; final macInfo = await deviceInfoPlugin.macOsInfo;
deviceName = macInfo.computerName; deviceName = macInfo.computerName;
} else if (Platform.isWindows) { } else if (Platform.isWindows) {
final windowsInfo = await deviceInfoPlugin.windowsInfo; try {
deviceName = windowsInfo.productName; final windowsInfo = await deviceInfoPlugin.windowsInfo;
deviceName = windowsInfo.productName;
} catch (e) {
print(e);
print('likely digitalProductId is null wait till https://github.com/fluttercommunity/plus_plugins/pull/3188 is merged');
deviceName = "Windows Device";
}
} }
return deviceName; return deviceName;