[skip ci] save

This commit is contained in:
Matthew Fosse 2024-07-25 11:58:55 -05:00
parent 2721a9ad5e
commit 978491e287
2 changed files with 33 additions and 75 deletions

View file

@ -1,43 +0,0 @@
import 'package:cw_core/transaction_priority.dart';
import 'package:cw_core/wallet_info.dart';
import 'package:cw_core/unspent_coins_info.dart';
import 'package:cw_core/wallet_service.dart';
import 'package:cw_core/receive_page_option.dart';
import 'package:cw_core/crypto_amount_format.dart';
import 'package:hive/hive.dart';
import 'package:mobx/mobx.dart';
import 'package:intl/intl.dart';
Lightning? lightning;
abstract class Lightning {
String formatterLightningAmountToString({required int amount});
double formatterLightningAmountToDouble({required int amount});
int formatterStringDoubleToLightningAmount(String amount);
WalletService createLightningWalletService(
Box<WalletInfo> walletInfoSource, Box<UnspentCoinsInfo> unspentCoinSource);
List<ReceivePageOption> getLightningReceivePageOptions();
String satsToLightningString(int sats);
ReceivePageOption getOptionInvoice();
ReceivePageOption getOptionOnchain();
String bitcoinAmountToLightningString({required int amount});
int bitcoinAmountToLightningAmount({required int amount});
double bitcoinDoubleToLightningDouble({required double amount});
double lightningDoubleToBitcoinDouble({required double amount});
Map<String, int> getIncomingPayments(Object wallet);
void clearIncomingPayments(Object wallet);
String lightningTransactionPriorityWithLabel(TransactionPriority priority, int rate, {int? customRate});
List<TransactionPriority> getTransactionPriorities();
TransactionPriority getLightningTransactionPriorityCustom();
int getFeeRate(Object wallet, TransactionPriority priority);
int getMaxCustomFeeRate(Object wallet);
Future<void> fetchFees(Object wallet);
Future<int> calculateEstimatedFeeAsync(Object wallet, TransactionPriority? priority, int? amount);
Future<int> getEstimatedFeeWithFeeRate(Object wallet, int feeRate, int? amount);
TransactionPriority getDefaultTransactionPriority();
TransactionPriority deserializeLightningTransactionPriority({required int raw});
String getBreezApiKey();
}

View file

@ -44,43 +44,44 @@ class ConnectionSyncPage extends BasePage {
: S.current.rescan,
handler: (context) => Navigator.of(context).pushNamed(Routes.rescan),
),
// if (DeviceInfo.instance.isMobile && FeatureFlag.isBackgroundSyncEnabled) ...[
Observer(builder: (context) {
return SettingsPickerCell<SyncMode>(
title: S.current.background_sync_mode,
items: SyncMode.all,
displayItem: (SyncMode syncMode) => syncMode.name,
selectedItem: dashboardViewModel.syncMode,
onItemSelected: (syncMode) async {
dashboardViewModel.setSyncMode(syncMode);
if (DeviceInfo.instance.isMobile && FeatureFlag.isBackgroundSyncEnabled) ...[
Observer(builder: (context) {
return SettingsPickerCell<SyncMode>(
title: S.current.background_sync_mode,
items: SyncMode.all,
displayItem: (SyncMode syncMode) => syncMode.name,
selectedItem: dashboardViewModel.syncMode,
onItemSelected: (syncMode) async {
dashboardViewModel.setSyncMode(syncMode);
if (Platform.isIOS) return;
if (Platform.isIOS) return;
if (syncMode.type != SyncType.disabled) {
final isDisabled = await isBatteryOptimizationDisabled();
if (syncMode.type != SyncType.disabled) {
final isDisabled = await isBatteryOptimizationDisabled();
if (isDisabled) return;
if (isDisabled) return;
await showPopUp<void>(
context: context,
builder: (BuildContext dialogContext) {
return AlertWithTwoActions(
alertTitle: S.current.disableBatteryOptimization,
alertContent: S.current.disableBatteryOptimizationDescription,
leftButtonText: S.of(context).cancel,
rightButtonText: S.of(context).ok,
actionLeftButton: () => Navigator.of(dialogContext).pop(),
actionRightButton: () async {
await requestDisableBatteryOptimization();
await showPopUp<void>(
context: context,
builder: (BuildContext dialogContext) {
return AlertWithTwoActions(
alertTitle: S.current.disableBatteryOptimization,
alertContent: S.current.disableBatteryOptimizationDescription,
leftButtonText: S.of(context).cancel,
rightButtonText: S.of(context).ok,
actionLeftButton: () => Navigator.of(dialogContext).pop(),
actionRightButton: () async {
await requestDisableBatteryOptimization();
Navigator.of(dialogContext).pop();
},
);
},
);
}
});
}),
Navigator.of(dialogContext).pop();
},
);
},
);
}
});
}),
],
Observer(builder: (context) {
return SettingsSwitcherCell(
title: S.current.sync_all_wallets,