mirror of
https://github.com/cake-tech/cake_wallet.git
synced 2024-12-23 03:59:23 +00:00
add stay awake swift support
This commit is contained in:
parent
2bbd413b12
commit
f021dbf6a6
6 changed files with 107 additions and 52 deletions
20
ios/CakeWallet/wakeLock.swift
Normal file
20
ios/CakeWallet/wakeLock.swift
Normal file
|
@ -0,0 +1,20 @@
|
||||||
|
//
|
||||||
|
// wakeLock.swift
|
||||||
|
// Runner
|
||||||
|
//
|
||||||
|
// Created by Godwin Asuquo on 1/21/22.
|
||||||
|
//
|
||||||
|
|
||||||
|
import Foundation
|
||||||
|
import UIKit
|
||||||
|
|
||||||
|
func enableWakeScreen() -> String {
|
||||||
|
UIApplication.shared.isIdleTimerDisabled = true
|
||||||
|
|
||||||
|
return "screen wake turned ON"
|
||||||
|
}
|
||||||
|
|
||||||
|
func disableWakeScreen() -> String{
|
||||||
|
UIApplication.shared.isIdleTimerDisabled = false
|
||||||
|
return "screen wake turned OFF"
|
||||||
|
}
|
|
@ -12,6 +12,7 @@
|
||||||
1498D2341E8E89220040F4C2 /* GeneratedPluginRegistrant.m in Sources */ = {isa = PBXBuildFile; fileRef = 1498D2331E8E89220040F4C2 /* GeneratedPluginRegistrant.m */; };
|
1498D2341E8E89220040F4C2 /* GeneratedPluginRegistrant.m in Sources */ = {isa = PBXBuildFile; fileRef = 1498D2331E8E89220040F4C2 /* GeneratedPluginRegistrant.m */; };
|
||||||
20ED0868E1BD7E12278C0CB3 /* Pods_Runner.framework in Frameworks */ = {isa = PBXBuildFile; fileRef = B26E3F56D69167FBB1DC160A /* Pods_Runner.framework */; };
|
20ED0868E1BD7E12278C0CB3 /* Pods_Runner.framework in Frameworks */ = {isa = PBXBuildFile; fileRef = B26E3F56D69167FBB1DC160A /* Pods_Runner.framework */; };
|
||||||
3B3967161E833CAA004F5970 /* AppFrameworkInfo.plist in Resources */ = {isa = PBXBuildFile; fileRef = 3B3967151E833CAA004F5970 /* AppFrameworkInfo.plist */; };
|
3B3967161E833CAA004F5970 /* AppFrameworkInfo.plist in Resources */ = {isa = PBXBuildFile; fileRef = 3B3967151E833CAA004F5970 /* AppFrameworkInfo.plist */; };
|
||||||
|
5AFFEBFD279AD49C00F906A4 /* wakeLock.swift in Sources */ = {isa = PBXBuildFile; fileRef = 5AFFEBFC279AD49C00F906A4 /* wakeLock.swift */; };
|
||||||
74858FAF1ED2DC5600515810 /* AppDelegate.swift in Sources */ = {isa = PBXBuildFile; fileRef = 74858FAE1ED2DC5600515810 /* AppDelegate.swift */; };
|
74858FAF1ED2DC5600515810 /* AppDelegate.swift in Sources */ = {isa = PBXBuildFile; fileRef = 74858FAE1ED2DC5600515810 /* AppDelegate.swift */; };
|
||||||
97C146FC1CF9000F007C117D /* Main.storyboard in Resources */ = {isa = PBXBuildFile; fileRef = 97C146FA1CF9000F007C117D /* Main.storyboard */; };
|
97C146FC1CF9000F007C117D /* Main.storyboard in Resources */ = {isa = PBXBuildFile; fileRef = 97C146FA1CF9000F007C117D /* Main.storyboard */; };
|
||||||
97C146FE1CF9000F007C117D /* Assets.xcassets in Resources */ = {isa = PBXBuildFile; fileRef = 97C146FD1CF9000F007C117D /* Assets.xcassets */; };
|
97C146FE1CF9000F007C117D /* Assets.xcassets in Resources */ = {isa = PBXBuildFile; fileRef = 97C146FD1CF9000F007C117D /* Assets.xcassets */; };
|
||||||
|
@ -28,6 +29,7 @@
|
||||||
20F67A1B2C2FCB2A3BB048C1 /* Pods-Runner.debug.xcconfig */ = {isa = PBXFileReference; includeInIndex = 1; lastKnownFileType = text.xcconfig; name = "Pods-Runner.debug.xcconfig"; path = "Target Support Files/Pods-Runner/Pods-Runner.debug.xcconfig"; sourceTree = "<group>"; };
|
20F67A1B2C2FCB2A3BB048C1 /* Pods-Runner.debug.xcconfig */ = {isa = PBXFileReference; includeInIndex = 1; lastKnownFileType = text.xcconfig; name = "Pods-Runner.debug.xcconfig"; path = "Target Support Files/Pods-Runner/Pods-Runner.debug.xcconfig"; sourceTree = "<group>"; };
|
||||||
3B3967151E833CAA004F5970 /* AppFrameworkInfo.plist */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = text.plist.xml; name = AppFrameworkInfo.plist; path = Flutter/AppFrameworkInfo.plist; sourceTree = "<group>"; };
|
3B3967151E833CAA004F5970 /* AppFrameworkInfo.plist */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = text.plist.xml; name = AppFrameworkInfo.plist; path = Flutter/AppFrameworkInfo.plist; sourceTree = "<group>"; };
|
||||||
501EA9286675DC8636978EA4 /* Pods-Runner.release.xcconfig */ = {isa = PBXFileReference; includeInIndex = 1; lastKnownFileType = text.xcconfig; name = "Pods-Runner.release.xcconfig"; path = "Target Support Files/Pods-Runner/Pods-Runner.release.xcconfig"; sourceTree = "<group>"; };
|
501EA9286675DC8636978EA4 /* Pods-Runner.release.xcconfig */ = {isa = PBXFileReference; includeInIndex = 1; lastKnownFileType = text.xcconfig; name = "Pods-Runner.release.xcconfig"; path = "Target Support Files/Pods-Runner/Pods-Runner.release.xcconfig"; sourceTree = "<group>"; };
|
||||||
|
5AFFEBFC279AD49C00F906A4 /* wakeLock.swift */ = {isa = PBXFileReference; lastKnownFileType = sourcecode.swift; path = wakeLock.swift; sourceTree = "<group>"; };
|
||||||
61CAA8652B54F23356F7592A /* Pods-Runner.profile.xcconfig */ = {isa = PBXFileReference; includeInIndex = 1; lastKnownFileType = text.xcconfig; name = "Pods-Runner.profile.xcconfig"; path = "Target Support Files/Pods-Runner/Pods-Runner.profile.xcconfig"; sourceTree = "<group>"; };
|
61CAA8652B54F23356F7592A /* Pods-Runner.profile.xcconfig */ = {isa = PBXFileReference; includeInIndex = 1; lastKnownFileType = text.xcconfig; name = "Pods-Runner.profile.xcconfig"; path = "Target Support Files/Pods-Runner/Pods-Runner.profile.xcconfig"; sourceTree = "<group>"; };
|
||||||
74858FAD1ED2DC5600515810 /* Runner-Bridging-Header.h */ = {isa = PBXFileReference; lastKnownFileType = sourcecode.c.h; path = "Runner-Bridging-Header.h"; sourceTree = "<group>"; };
|
74858FAD1ED2DC5600515810 /* Runner-Bridging-Header.h */ = {isa = PBXFileReference; lastKnownFileType = sourcecode.c.h; path = "Runner-Bridging-Header.h"; sourceTree = "<group>"; };
|
||||||
74858FAE1ED2DC5600515810 /* AppDelegate.swift */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = sourcecode.swift; path = AppDelegate.swift; sourceTree = "<group>"; };
|
74858FAE1ED2DC5600515810 /* AppDelegate.swift */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = sourcecode.swift; path = AppDelegate.swift; sourceTree = "<group>"; };
|
||||||
|
@ -68,6 +70,7 @@
|
||||||
children = (
|
children = (
|
||||||
0C44A7192518EF8000B570ED /* decrypt.swift */,
|
0C44A7192518EF8000B570ED /* decrypt.swift */,
|
||||||
0C9D68C8264854B60011B691 /* secRandom.swift */,
|
0C9D68C8264854B60011B691 /* secRandom.swift */,
|
||||||
|
5AFFEBFC279AD49C00F906A4 /* wakeLock.swift */,
|
||||||
);
|
);
|
||||||
path = CakeWallet;
|
path = CakeWallet;
|
||||||
sourceTree = "<group>";
|
sourceTree = "<group>";
|
||||||
|
@ -277,6 +280,7 @@
|
||||||
files = (
|
files = (
|
||||||
74858FAF1ED2DC5600515810 /* AppDelegate.swift in Sources */,
|
74858FAF1ED2DC5600515810 /* AppDelegate.swift in Sources */,
|
||||||
1498D2341E8E89220040F4C2 /* GeneratedPluginRegistrant.m in Sources */,
|
1498D2341E8E89220040F4C2 /* GeneratedPluginRegistrant.m in Sources */,
|
||||||
|
5AFFEBFD279AD49C00F906A4 /* wakeLock.swift in Sources */,
|
||||||
0C9D68C9264854B60011B691 /* secRandom.swift in Sources */,
|
0C9D68C9264854B60011B691 /* secRandom.swift in Sources */,
|
||||||
0C44A71A2518EF8000B570ED /* decrypt.swift in Sources */,
|
0C44A71A2518EF8000B570ED /* decrypt.swift in Sources */,
|
||||||
);
|
);
|
||||||
|
|
|
@ -96,6 +96,12 @@ import UnstoppableDomainsResolution
|
||||||
|
|
||||||
result(address)
|
result(address)
|
||||||
}
|
}
|
||||||
|
case "enableWakeScreen":
|
||||||
|
result(enableWakeScreen())
|
||||||
|
|
||||||
|
case "disableWakeScreen":
|
||||||
|
result(disableWakeScreen())
|
||||||
|
|
||||||
default:
|
default:
|
||||||
result(FlutterMethodNotImplemented)
|
result(FlutterMethodNotImplemented)
|
||||||
}
|
}
|
||||||
|
|
98
lib/di.dart
98
lib/di.dart
|
@ -1,3 +1,4 @@
|
||||||
|
import 'package:cake_wallet/entities/wake_lock.dart';
|
||||||
import 'package:cake_wallet/monero/monero.dart';
|
import 'package:cake_wallet/monero/monero.dart';
|
||||||
import 'package:cake_wallet/bitcoin/bitcoin.dart';
|
import 'package:cake_wallet/bitcoin/bitcoin.dart';
|
||||||
import 'package:cw_core/unspent_coins_info.dart';
|
import 'package:cw_core/unspent_coins_info.dart';
|
||||||
|
@ -192,8 +193,8 @@ Future setup(
|
||||||
getIt.registerSingleton<ExchangeTemplateStore>(
|
getIt.registerSingleton<ExchangeTemplateStore>(
|
||||||
ExchangeTemplateStore(templateSource: _exchangeTemplates));
|
ExchangeTemplateStore(templateSource: _exchangeTemplates));
|
||||||
getIt.registerSingleton<YatStore>(YatStore(
|
getIt.registerSingleton<YatStore>(YatStore(
|
||||||
appStore: getIt.get<AppStore>(),
|
appStore: getIt.get<AppStore>(),
|
||||||
secureStorage: getIt.get<FlutterSecureStorage>())
|
secureStorage: getIt.get<FlutterSecureStorage>())
|
||||||
..init());
|
..init());
|
||||||
|
|
||||||
final secretStore =
|
final secretStore =
|
||||||
|
@ -237,11 +238,9 @@ Future setup(
|
||||||
type: type, language: language);
|
type: type, language: language);
|
||||||
});
|
});
|
||||||
|
|
||||||
getIt.registerFactory<WalletAddressListViewModel>(
|
getIt.registerFactory<WalletAddressListViewModel>(() =>
|
||||||
() => WalletAddressListViewModel(
|
WalletAddressListViewModel(
|
||||||
appStore: getIt.get<AppStore>(),
|
appStore: getIt.get<AppStore>(), yatStore: getIt.get<YatStore>()));
|
||||||
yatStore: getIt.get<YatStore>()
|
|
||||||
));
|
|
||||||
|
|
||||||
getIt.registerFactory(() => BalanceViewModel(
|
getIt.registerFactory(() => BalanceViewModel(
|
||||||
appStore: getIt.get<AppStore>(),
|
appStore: getIt.get<AppStore>(),
|
||||||
|
@ -323,8 +322,7 @@ Future setup(
|
||||||
getIt.get<AppStore>().wallet,
|
getIt.get<AppStore>().wallet,
|
||||||
getIt.get<AppStore>().settingsStore,
|
getIt.get<AppStore>().settingsStore,
|
||||||
getIt.get<SendTemplateStore>(),
|
getIt.get<SendTemplateStore>(),
|
||||||
getIt.get<FiatConversionStore>()
|
getIt.get<FiatConversionStore>()));
|
||||||
));
|
|
||||||
|
|
||||||
getIt.registerFactory<SendViewModel>(() => SendViewModel(
|
getIt.registerFactory<SendViewModel>(() => SendViewModel(
|
||||||
getIt.get<AppStore>().wallet,
|
getIt.get<AppStore>().wallet,
|
||||||
|
@ -336,9 +334,8 @@ Future setup(
|
||||||
getIt.registerFactory(
|
getIt.registerFactory(
|
||||||
() => SendPage(sendViewModel: getIt.get<SendViewModel>()));
|
() => SendPage(sendViewModel: getIt.get<SendViewModel>()));
|
||||||
|
|
||||||
getIt.registerFactory(
|
getIt.registerFactory(() => SendTemplatePage(
|
||||||
() => SendTemplatePage(
|
sendTemplateViewModel: getIt.get<SendTemplateViewModel>()));
|
||||||
sendTemplateViewModel: getIt.get<SendTemplateViewModel>()));
|
|
||||||
|
|
||||||
getIt.registerFactory(() => WalletListViewModel(
|
getIt.registerFactory(() => WalletListViewModel(
|
||||||
_walletInfoSource,
|
_walletInfoSource,
|
||||||
|
@ -471,9 +468,11 @@ Future setup(
|
||||||
case WalletType.monero:
|
case WalletType.monero:
|
||||||
return monero.createMoneroWalletService(_walletInfoSource);
|
return monero.createMoneroWalletService(_walletInfoSource);
|
||||||
case WalletType.bitcoin:
|
case WalletType.bitcoin:
|
||||||
return bitcoin.createBitcoinWalletService(_walletInfoSource, _unspentCoinsInfoSource);
|
return bitcoin.createBitcoinWalletService(
|
||||||
|
_walletInfoSource, _unspentCoinsInfoSource);
|
||||||
case WalletType.litecoin:
|
case WalletType.litecoin:
|
||||||
return bitcoin.createLitecoinWalletService(_walletInfoSource, _unspentCoinsInfoSource);
|
return bitcoin.createLitecoinWalletService(
|
||||||
|
_walletInfoSource, _unspentCoinsInfoSource);
|
||||||
default:
|
default:
|
||||||
return null;
|
return null;
|
||||||
}
|
}
|
||||||
|
@ -507,13 +506,13 @@ Future setup(
|
||||||
getIt
|
getIt
|
||||||
.registerFactoryParam<TransactionDetailsViewModel, TransactionInfo, void>(
|
.registerFactoryParam<TransactionDetailsViewModel, TransactionInfo, void>(
|
||||||
(TransactionInfo transactionInfo, _) {
|
(TransactionInfo transactionInfo, _) {
|
||||||
final wallet = getIt.get<AppStore>().wallet;
|
final wallet = getIt.get<AppStore>().wallet;
|
||||||
return TransactionDetailsViewModel(
|
return TransactionDetailsViewModel(
|
||||||
transactionInfo: transactionInfo,
|
transactionInfo: transactionInfo,
|
||||||
transactionDescriptionBox: _transactionDescriptionBox,
|
transactionDescriptionBox: _transactionDescriptionBox,
|
||||||
wallet: wallet,
|
wallet: wallet,
|
||||||
settingsStore: getIt.get<SettingsStore>());
|
settingsStore: getIt.get<SettingsStore>());
|
||||||
});
|
});
|
||||||
|
|
||||||
getIt.registerFactoryParam<TransactionDetailsPage, TransactionInfo, void>(
|
getIt.registerFactoryParam<TransactionDetailsPage, TransactionInfo, void>(
|
||||||
(TransactionInfo transactionInfo, _) => TransactionDetailsPage(
|
(TransactionInfo transactionInfo, _) => TransactionDetailsPage(
|
||||||
|
@ -574,23 +573,21 @@ Future setup(
|
||||||
return PreOrderPage(buyViewModel: getIt.get<BuyViewModel>());
|
return PreOrderPage(buyViewModel: getIt.get<BuyViewModel>());
|
||||||
});
|
});
|
||||||
|
|
||||||
getIt.registerFactoryParam<BuyWebViewPage, List, void>(
|
getIt.registerFactoryParam<BuyWebViewPage, List, void>((List args, _) {
|
||||||
(List args, _) {
|
final url = args.first as String;
|
||||||
final url = args.first as String;
|
final buyViewModel = args[1] as BuyViewModel;
|
||||||
final buyViewModel = args[1] as BuyViewModel;
|
|
||||||
|
|
||||||
return BuyWebViewPage(buyViewModel: buyViewModel,
|
return BuyWebViewPage(
|
||||||
ordersStore: getIt.get<OrdersStore>(), url: url);
|
buyViewModel: buyViewModel,
|
||||||
});
|
ordersStore: getIt.get<OrdersStore>(),
|
||||||
|
url: url);
|
||||||
|
});
|
||||||
|
|
||||||
getIt.registerFactoryParam<OrderDetailsViewModel, Order, void>(
|
getIt.registerFactoryParam<OrderDetailsViewModel, Order, void>((order, _) {
|
||||||
(order, _) {
|
final wallet = getIt.get<AppStore>().wallet;
|
||||||
final wallet = getIt.get<AppStore>().wallet;
|
|
||||||
|
|
||||||
return OrderDetailsViewModel(
|
return OrderDetailsViewModel(wallet: wallet, orderForDetails: order);
|
||||||
wallet: wallet,
|
});
|
||||||
orderForDetails: order);
|
|
||||||
});
|
|
||||||
|
|
||||||
getIt.registerFactoryParam<OrderDetailsPage, Order, void>((Order order, _) =>
|
getIt.registerFactoryParam<OrderDetailsPage, Order, void>((Order order, _) =>
|
||||||
OrderDetailsPage(getIt.get<OrderDetailsViewModel>(param1: order)));
|
OrderDetailsPage(getIt.get<OrderDetailsViewModel>(param1: order)));
|
||||||
|
@ -603,31 +600,28 @@ Future setup(
|
||||||
final wallet = getIt.get<AppStore>().wallet;
|
final wallet = getIt.get<AppStore>().wallet;
|
||||||
|
|
||||||
return UnspentCoinsListViewModel(
|
return UnspentCoinsListViewModel(
|
||||||
wallet: wallet,
|
wallet: wallet, unspentCoinsInfo: _unspentCoinsInfoSource);
|
||||||
unspentCoinsInfo: _unspentCoinsInfoSource);
|
|
||||||
});
|
});
|
||||||
|
|
||||||
getIt.registerFactory(() => UnspentCoinsListPage(
|
getIt.registerFactory(() => UnspentCoinsListPage(
|
||||||
unspentCoinsListViewModel: getIt.get<UnspentCoinsListViewModel>()
|
unspentCoinsListViewModel: getIt.get<UnspentCoinsListViewModel>()));
|
||||||
));
|
|
||||||
|
|
||||||
getIt.registerFactoryParam<UnspentCoinsDetailsViewModel,
|
getIt.registerFactoryParam<UnspentCoinsDetailsViewModel, UnspentCoinsItem,
|
||||||
UnspentCoinsItem, UnspentCoinsListViewModel>((item, model) =>
|
UnspentCoinsListViewModel>(
|
||||||
UnspentCoinsDetailsViewModel(
|
(item, model) => UnspentCoinsDetailsViewModel(
|
||||||
unspentCoinsItem: item,
|
unspentCoinsItem: item, unspentCoinsListViewModel: model));
|
||||||
unspentCoinsListViewModel: model));
|
|
||||||
|
|
||||||
getIt.registerFactoryParam<UnspentCoinsDetailsPage, List, void>(
|
getIt.registerFactoryParam<UnspentCoinsDetailsPage, List, void>(
|
||||||
(List args, _) {
|
(List args, _) {
|
||||||
final item = args.first as UnspentCoinsItem;
|
final item = args.first as UnspentCoinsItem;
|
||||||
final unspentCoinsListViewModel = args[1] as UnspentCoinsListViewModel;
|
final unspentCoinsListViewModel = args[1] as UnspentCoinsListViewModel;
|
||||||
|
|
||||||
return UnspentCoinsDetailsPage(
|
return UnspentCoinsDetailsPage(
|
||||||
unspentCoinsDetailsViewModel:
|
unspentCoinsDetailsViewModel: getIt.get<UnspentCoinsDetailsViewModel>(
|
||||||
getIt.get<UnspentCoinsDetailsViewModel>(
|
param1: item, param2: unspentCoinsListViewModel));
|
||||||
param1: item,
|
|
||||||
param2: unspentCoinsListViewModel));
|
|
||||||
});
|
});
|
||||||
|
|
||||||
|
getIt.registerFactory(() => WakeLock());
|
||||||
|
|
||||||
_isSetupFinished = true;
|
_isSetupFinished = true;
|
||||||
}
|
}
|
||||||
|
|
21
lib/entities/wake_lock.dart
Normal file
21
lib/entities/wake_lock.dart
Normal file
|
@ -0,0 +1,21 @@
|
||||||
|
import 'package:flutter/services.dart';
|
||||||
|
|
||||||
|
class WakeLock {
|
||||||
|
static const _utils = const MethodChannel('com.cake_wallet/native_utils');
|
||||||
|
|
||||||
|
Future<void> enableWake() async {
|
||||||
|
try {
|
||||||
|
await _utils.invokeMethod<String>('enableWakeScreen');
|
||||||
|
} on PlatformException catch (_) {
|
||||||
|
print('Failed enabling screen wakelock');
|
||||||
|
}
|
||||||
|
}
|
||||||
|
|
||||||
|
Future<void> disableWake() async {
|
||||||
|
try {
|
||||||
|
await _utils.invokeMethod<String>('disableWakeScreen');
|
||||||
|
} on PlatformException catch (_) {
|
||||||
|
print('Failed enabling screen wakelock');
|
||||||
|
}
|
||||||
|
}
|
||||||
|
}
|
|
@ -1,9 +1,12 @@
|
||||||
|
import 'package:cake_wallet/di.dart';
|
||||||
|
import 'package:cake_wallet/entities/wake_lock.dart';
|
||||||
import 'package:mobx/mobx.dart';
|
import 'package:mobx/mobx.dart';
|
||||||
import 'package:cw_core/transaction_history.dart';
|
import 'package:cw_core/transaction_history.dart';
|
||||||
import 'package:cw_core/wallet_base.dart';
|
import 'package:cw_core/wallet_base.dart';
|
||||||
import 'package:cw_core/balance.dart';
|
import 'package:cw_core/balance.dart';
|
||||||
import 'package:cw_core/transaction_info.dart';
|
import 'package:cw_core/transaction_info.dart';
|
||||||
import 'package:cw_core/sync_status.dart';
|
import 'package:cw_core/sync_status.dart';
|
||||||
|
import 'package:flutter/services.dart';
|
||||||
|
|
||||||
ReactionDisposer _onWalletSyncStatusChangeReaction;
|
ReactionDisposer _onWalletSyncStatusChangeReaction;
|
||||||
|
|
||||||
|
@ -11,11 +14,18 @@ void startWalletSyncStatusChangeReaction(
|
||||||
WalletBase<Balance, TransactionHistoryBase<TransactionInfo>,
|
WalletBase<Balance, TransactionHistoryBase<TransactionInfo>,
|
||||||
TransactionInfo>
|
TransactionInfo>
|
||||||
wallet) {
|
wallet) {
|
||||||
|
final WakeLock _wakeLock = getIt.get<WakeLock>();
|
||||||
_onWalletSyncStatusChangeReaction?.reaction?.dispose();
|
_onWalletSyncStatusChangeReaction?.reaction?.dispose();
|
||||||
_onWalletSyncStatusChangeReaction =
|
_onWalletSyncStatusChangeReaction =
|
||||||
reaction((_) => wallet.syncStatus, (SyncStatus status) async {
|
reaction((_) => wallet.syncStatus, (SyncStatus status) async {
|
||||||
if (status is ConnectedSyncStatus) {
|
if (status is ConnectedSyncStatus) {
|
||||||
await wallet.startSync();
|
await wallet.startSync();
|
||||||
}
|
}
|
||||||
|
if (status is SyncingSyncStatus) {
|
||||||
|
await _wakeLock.enableWake();
|
||||||
|
}
|
||||||
|
if (status is SyncedSyncStatus || status is FailedSyncStatus) {
|
||||||
|
await _wakeLock.disableWake();
|
||||||
|
}
|
||||||
});
|
});
|
||||||
}
|
}
|
||||||
|
|
Loading…
Reference in a new issue