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
Konstantin Ullrich committed
Jul 25, 2025 at 14:07 UTC
93d3582e8e54c6425b81ac66ae14aef3c55b137b
10 files changed
+17
-17
cw_monero/lib/ledger.dart
+2
-1
@@ -34,7 +34,8 @@ void enableLedgerExchange(LedgerConnection connection) {
34
35
api.MoneroWallet.setDeviceReceivedData(
36
result.cast<UnsignedChar>(), response.length);
37
- api.MoneroFree().free(result.cast());
37
+ malloc.free(result);
38
+ // api.MoneroFree().free(result.cast());
39
}
40
41
callable = NativeCallable<LedgerCallback>.listener(callback);
cw_monero/pubspec.yaml
+1
-1
@@ -26,7 +26,7 @@ dependencies:
26
monero:
27
git:
28
url: https://github.com/mrcyjanek/monero_c
29
- ref: a27fbcb24d91143715ed930a05aaa4d853fba1f2
29
+ ref: b576312e4d466569cd03482b61c597b39a9f4dc3
30
path: impls/monero.dart
31
mutex: ^3.1.0
32
ledger_flutter_plus: ^1.4.1
cw_wownero/pubspec.yaml
+1
-1
@@ -24,7 +24,7 @@ dependencies:
24
monero:
25
git:
26
url: https://github.com/mrcyjanek/monero_c
27
- ref: a27fbcb24d91143715ed930a05aaa4d853fba1f2 # monero_c hash
27
+ ref: b576312e4d466569cd03482b61c597b39a9f4dc3 # monero_c hash
28
path: impls/monero.dart
29
mutex: ^3.1.0
30
cw_zano/pubspec.yaml
+1
-1
@@ -25,7 +25,7 @@ dependencies:
25
monero:
26
git:
27
url: https://github.com/mrcyjanek/monero_c
28
- ref: a27fbcb24d91143715ed930a05aaa4d853fba1f2 # monero_c hash
28
+ ref: b576312e4d466569cd03482b61c597b39a9f4dc3 # monero_c hash
29
path: impls/monero.dart
30
dev_dependencies:
31
flutter_test:
lib/src/screens/connect_device/connect_device_page.dart
+3
-3
@@ -197,9 +197,9 @@ class ConnectDevicePageBodyState extends State<ConnectDevicePageBody> {
197
Padding(
198
padding: EdgeInsets.only(left: 20, right: 20, bottom: 20),
199
child: Text(
200
- Platform.isIOS
201
- ? S.of(context).connect_your_hardware_wallet_ios
202
- : S.of(context).connect_your_hardware_wallet,
200
+ Platform.isAndroid
201
+ ? S.of(context).connect_your_hardware_wallet
202
+ : S.of(context).connect_your_hardware_wallet_ios,
203
style: Theme.of(context)
204
.textTheme.titleMedium,
205
textAlign: TextAlign.center,
lib/src/screens/restore/restore_options_page.dart
-4
@@ -45,10 +45,6 @@ class _RestoreOptionsBodyState extends State<_RestoreOptionsBody> {
45
bool isRestoring = false;
46
47
bool get _doesSupportHardwareWallets {
48
- if (!DeviceInfo.instance.isMobile) {
49
- return false;
50
- }
51
-
48
if (isMoneroOnly) {
49
return DeviceConnectionType.supportedConnectionTypes(WalletType.monero, Platform.isIOS)
50
.isNotEmpty;
lib/view_model/hardware_wallet/ledger_view_model.dart
+2
-5
@@ -9,7 +9,6 @@ import 'package:cake_wallet/monero/monero.dart';
9
import 'package:cake_wallet/polygon/polygon.dart';
10
import 'package:cake_wallet/routes.dart';
11
import 'package:cake_wallet/src/screens/connect_device/connect_device_page.dart';
12
-import 'package:cake_wallet/utils/device_info.dart';
12
import 'package:cake_wallet/wallet_type_utils.dart';
13
import 'package:cw_core/hardware/device_connection_type.dart';
14
import 'package:cw_core/utils/print_verbose.dart';
@@ -30,10 +29,6 @@ abstract class LedgerViewModelBase with Store {
29
late final sdk.LedgerInterface ledgerPlusUSB;
30
31
bool get _doesSupportHardwareWallets {
33
- if (!DeviceInfo.instance.isMobile) {
34
- return false;
35
- }
36
-
32
if (isMoneroOnly) {
33
return DeviceConnectionType.supportedConnectionTypes(
34
WalletType.monero, Platform.isIOS)
@@ -65,6 +60,8 @@ abstract class LedgerViewModelBase with Store {
60
if (bleIsEnabled && !_bleIsInitialized) {
61
ledgerPlusBLE = sdk.LedgerInterface.ble(
62
onPermissionRequest: (_) async {
63
+ if (Platform.isMacOS) return true;
64
+
65
Map<Permission, PermissionStatus> statuses = await [
66
Permission.bluetoothScan,
67
Permission.bluetoothConnect,
macos/Runner/DebugProfileBase.entitlements
+2
@@ -8,6 +8,8 @@
8
<true/>
9
<key>com.apple.security.network.server</key>
10
<true/>
11
+ <key>com.apple.security.device.bluetooth</key>
12
+ <true/>
13
<key>keychain-access-groups</key>
14
<array>
15
<string>$(AppIdentifierPrefix)${BUNDLE_ID}</string>
macos/Runner/ReleaseBase.entitlements
+2
@@ -4,6 +4,8 @@
4
<dict>
5
<key>com.apple.security.app-sandbox</key>
6
<true/>
7
+ <key>com.apple.security.device.bluetooth</key>
8
+ <true/>
9
<key>keychain-access-groups</key>
10
<array>
11
<string>$(AppIdentifierPrefix)${BUNDLE_ID}</string>
macos/Runner/RunnerBase.entitlements
+3
-1
@@ -6,9 +6,11 @@
6
<true/>
7
<key>com.apple.security.network.client</key>
8
<true/>
9
+ <key>com.apple.security.device.bluetooth</key>
10
+ <true/>
11
<key>keychain-access-groups</key>
12
<array>
13
<string>$(AppIdentifierPrefix)${BUNDLE_ID}</string>
14
</array>
15
</dict>
14
-</plist>
\ No newline at end of file
16
+</plist>