fix: Restrict Windows platform from using Zcash and Lightning features; update Lightning availability checks. (#3220)

This commit is contained in:
Konstantin Ullrich
2026-05-06 21:40:06 +02:00
committed by GitHub
parent 8e7d4485ac
commit 46064f075a
6 changed files with 18 additions and 10 deletions
+1 -1
View File
@@ -24,7 +24,7 @@ IF NOT EXIST "%secrets_file_path%" (
) ELSE (echo === Using previously/already generated secrets file: %secrets_file_path% ===)
echo === Generating mobx models ===
for /d %%i in (cw_core cw_monero cw_bitcoin cw_ethereum cw_evm cw_polygon cw_nano cw_bitcoin_cash cw_solana cw_tron cw_base cw_arbitrum.) do (
for /d %%i in (cw_core cw_monero cw_bitcoin cw_evm cw_nano cw_bitcoin_cash cw_solana cw_tron cw_zcash.) do (
cd %%i
call flutter pub get > nul
call dart run build_runner build --delete-conflicting-outputs > nul
+2 -2
View File
@@ -100,7 +100,7 @@ abstract class BitcoinWalletBase extends ElectrumWallet with Store {
// String sideDerivationPath = derivationPath.substring(0, derivationPath.length - 1) + "1";
// final hd = bitcoin.HDWallet.fromSeed(seedBytes, network: networkType);
if (mnemonic != null && this.useLightning) {
if (mnemonic != null && this.useLightning && LightningWallet.isAvailable) {
try {
lightningWallet = LightningWallet(
mnemonic: mnemonic,
@@ -142,7 +142,7 @@ abstract class BitcoinWalletBase extends ElectrumWallet with Store {
});
reaction((_) => this.useLightning, (bool useLightning) {
if (useLightning) {
if (useLightning && LightningWallet.isAvailable) {
if (mnemonic != null) {
lightningWallet = LightningWallet(
mnemonic: mnemonic,
@@ -33,9 +33,11 @@ class LightningWallet {
required this.apiKey,
required this.lnurlDomain,
this.network = Network.mainnet,
this.cachedAddress
this.cachedAddress,
});
static bool get isAvailable => Platform.isIOS || Platform.isAndroid || Platform.isMacOS;
StreamSubscription<SdkEvent>? _eventSubscription;
Stream<SdkEvent>? _eventStream;
+10 -5
View File
@@ -165,12 +165,17 @@ Future<void> runAppWithZone({Key? topLevelKey}) async {
if (FeatureFlag.hasDevOptions) {
ProxyWrapper.logger = MemoryProxyLogger();
}
var zcashPassword = await secureStorageShared.read(key: "com.cakewallet.cw_zcash/zec.db");
if (zcashPassword == null || zcashPassword.isEmpty) {
zcashPassword = generateKey().substring(0, 32);
secureStorageShared.write(key: "com.cakewallet.cw_zcash/zec.db", value: zcashPassword);
if (!Platform.isWindows) {
var zcashPassword = await secureStorageShared.read(
key: "com.cakewallet.cw_zcash/zec.db");
if (zcashPassword == null || zcashPassword.isEmpty) {
zcashPassword = generateKey().substring(0, 32);
secureStorageShared.write(
key: "com.cakewallet.cw_zcash/zec.db", value: zcashPassword);
}
zcash?.unlockDatabase(zcashPassword);
}
zcash?.unlockDatabase(zcashPassword);
// Basically when we're running a test
if (topLevelKey != null) {
@@ -109,7 +109,7 @@ abstract class PrivacySettingsViewModelBase with Store {
bool get canUsePayjoin => _wallet.type == WalletType.bitcoin && DeviceInfo.instance.isMobile;
@computed
bool get canUseLightning => _wallet.type == WalletType.bitcoin;
bool get canUseLightning => _wallet.type == WalletType.bitcoin && !Platform.isWindows;
@computed
bool get useLightning => _wallet.type == WalletType.bitcoin && bitcoin!.useLightning(_wallet);
+1
View File
@@ -226,6 +226,7 @@ dependency_overrides:
ref: c414574bc5ac349450f601e7f72c7b9f31b4d087
decimal: ^2.3.3
flutter_rust_bridge: 2.11.1
flutter_secure_storage_windows: 3.1.2
flutter_icons:
image_path: "assets/images/app_logo.png"