Cw 1106 enable ledger for desktop through ble (#2410)

* fix: remove redundant mobile check for hardware wallet support and add macOS BLE permission handling

* fix: update connect_device_page platform check and add macOS Bluetooth entitlements

* fix: Ledger Monero on Windows
This commit is contained in:
Konstantin Ullrich
2025-07-25 15:07:17 +03:00
committed by GitHub
parent b24ebd8ba9
commit 93d3582e8e
10 changed files with 17 additions and 17 deletions
+2 -1
View File
@@ -34,7 +34,8 @@ void enableLedgerExchange(LedgerConnection connection) {
api.MoneroWallet.setDeviceReceivedData(
result.cast<UnsignedChar>(), response.length);
api.MoneroFree().free(result.cast());
malloc.free(result);
// api.MoneroFree().free(result.cast());
}
callable = NativeCallable<LedgerCallback>.listener(callback);
+1 -1
View File
@@ -26,7 +26,7 @@ dependencies:
monero:
git:
url: https://github.com/mrcyjanek/monero_c
ref: a27fbcb24d91143715ed930a05aaa4d853fba1f2
ref: b576312e4d466569cd03482b61c597b39a9f4dc3
path: impls/monero.dart
mutex: ^3.1.0
ledger_flutter_plus: ^1.4.1
+1 -1
View File
@@ -24,7 +24,7 @@ dependencies:
monero:
git:
url: https://github.com/mrcyjanek/monero_c
ref: a27fbcb24d91143715ed930a05aaa4d853fba1f2 # monero_c hash
ref: b576312e4d466569cd03482b61c597b39a9f4dc3 # monero_c hash
path: impls/monero.dart
mutex: ^3.1.0
+1 -1
View File
@@ -25,7 +25,7 @@ dependencies:
monero:
git:
url: https://github.com/mrcyjanek/monero_c
ref: a27fbcb24d91143715ed930a05aaa4d853fba1f2 # monero_c hash
ref: b576312e4d466569cd03482b61c597b39a9f4dc3 # monero_c hash
path: impls/monero.dart
dev_dependencies:
flutter_test:
@@ -197,9 +197,9 @@ class ConnectDevicePageBodyState extends State<ConnectDevicePageBody> {
Padding(
padding: EdgeInsets.only(left: 20, right: 20, bottom: 20),
child: Text(
Platform.isIOS
? S.of(context).connect_your_hardware_wallet_ios
: S.of(context).connect_your_hardware_wallet,
Platform.isAndroid
? S.of(context).connect_your_hardware_wallet
: S.of(context).connect_your_hardware_wallet_ios,
style: Theme.of(context)
.textTheme.titleMedium,
textAlign: TextAlign.center,
@@ -45,10 +45,6 @@ class _RestoreOptionsBodyState extends State<_RestoreOptionsBody> {
bool isRestoring = false;
bool get _doesSupportHardwareWallets {
if (!DeviceInfo.instance.isMobile) {
return false;
}
if (isMoneroOnly) {
return DeviceConnectionType.supportedConnectionTypes(WalletType.monero, Platform.isIOS)
.isNotEmpty;
@@ -9,7 +9,6 @@ import 'package:cake_wallet/monero/monero.dart';
import 'package:cake_wallet/polygon/polygon.dart';
import 'package:cake_wallet/routes.dart';
import 'package:cake_wallet/src/screens/connect_device/connect_device_page.dart';
import 'package:cake_wallet/utils/device_info.dart';
import 'package:cake_wallet/wallet_type_utils.dart';
import 'package:cw_core/hardware/device_connection_type.dart';
import 'package:cw_core/utils/print_verbose.dart';
@@ -30,10 +29,6 @@ abstract class LedgerViewModelBase with Store {
late final sdk.LedgerInterface ledgerPlusUSB;
bool get _doesSupportHardwareWallets {
if (!DeviceInfo.instance.isMobile) {
return false;
}
if (isMoneroOnly) {
return DeviceConnectionType.supportedConnectionTypes(
WalletType.monero, Platform.isIOS)
@@ -65,6 +60,8 @@ abstract class LedgerViewModelBase with Store {
if (bleIsEnabled && !_bleIsInitialized) {
ledgerPlusBLE = sdk.LedgerInterface.ble(
onPermissionRequest: (_) async {
if (Platform.isMacOS) return true;
Map<Permission, PermissionStatus> statuses = await [
Permission.bluetoothScan,
Permission.bluetoothConnect,
@@ -8,6 +8,8 @@
<true/>
<key>com.apple.security.network.server</key>
<true/>
<key>com.apple.security.device.bluetooth</key>
<true/>
<key>keychain-access-groups</key>
<array>
<string>$(AppIdentifierPrefix)${BUNDLE_ID}</string>
+2
View File
@@ -4,6 +4,8 @@
<dict>
<key>com.apple.security.app-sandbox</key>
<true/>
<key>com.apple.security.device.bluetooth</key>
<true/>
<key>keychain-access-groups</key>
<array>
<string>$(AppIdentifierPrefix)${BUNDLE_ID}</string>
+3 -1
View File
@@ -6,9 +6,11 @@
<true/>
<key>com.apple.security.network.client</key>
<true/>
<key>com.apple.security.device.bluetooth</key>
<true/>
<key>keychain-access-groups</key>
<array>
<string>$(AppIdentifierPrefix)${BUNDLE_ID}</string>
</array>
</dict>
</plist>
</plist>