mirror of
https://github.com/cake-tech/cake_wallet.git
synced 2024-12-22 19:49:22 +00:00
Generic fixes (#1282)
* New versions * Fix unspent coins issue * Fix white screen issues for some users
This commit is contained in:
parent
952503f0d8
commit
b92ccb5c0b
11 changed files with 82 additions and 53 deletions
|
@ -150,7 +150,7 @@ class CWBitcoin extends Bitcoin {
|
|||
return bitcoinWallet.unspentCoins;
|
||||
}
|
||||
|
||||
void updateUnspents(Object wallet) async {
|
||||
Future<void> updateUnspents(Object wallet) async {
|
||||
final bitcoinWallet = wallet as ElectrumWallet;
|
||||
await bitcoinWallet.updateUnspent();
|
||||
}
|
||||
|
|
|
@ -186,7 +186,10 @@ Future<void> defaultSettingsMigration(
|
|||
await rewriteSecureStoragePin(secureStorage: secureStorage);
|
||||
break;
|
||||
case 26:
|
||||
await insecureStorageMigration(secureStorage: secureStorage, sharedPreferences: sharedPreferences);
|
||||
/// commented out as it was a probable cause for some users to have white screen issues
|
||||
/// maybe due to multiple access on Secure Storage at once
|
||||
/// or long await time on start of the app
|
||||
// await insecureStorageMigration(secureStorage: secureStorage, sharedPreferences: sharedPreferences);
|
||||
break;
|
||||
default:
|
||||
break;
|
||||
|
@ -507,7 +510,7 @@ Future<void> changeLitecoinCurrentElectrumServerToDefault(
|
|||
Future<void> changeBitcoinCashCurrentNodeToDefault(
|
||||
{required SharedPreferences sharedPreferences, required Box<Node> nodes}) async {
|
||||
final server = getBitcoinCashDefaultElectrumServer(nodes: nodes);
|
||||
final serverId = server?.key as int ?? 0;
|
||||
final serverId = server?.key as int? ?? 0;
|
||||
|
||||
await sharedPreferences.setInt(PreferencesKey.currentBitcoinCashNodeIdKey, serverId);
|
||||
}
|
||||
|
|
|
@ -331,7 +331,7 @@ class CWMonero extends Monero {
|
|||
}
|
||||
|
||||
@override
|
||||
void updateUnspents(Object wallet) async {
|
||||
Future<void> updateUnspents(Object wallet) async {
|
||||
final moneroWallet = wallet as MoneroWallet;
|
||||
await moneroWallet.updateUnspent();
|
||||
}
|
||||
|
|
|
@ -283,15 +283,17 @@ class ExchangeTradeState extends State<ExchangeTradeForm> {
|
|||
|
||||
if (state is TransactionCommitted) {
|
||||
WidgetsBinding.instance.addPostFrameCallback((_) {
|
||||
showPopUp<void>(
|
||||
context: context,
|
||||
builder: (BuildContext popupContext) {
|
||||
return AlertWithOneAction(
|
||||
alertTitle: S.of(popupContext).sending,
|
||||
alertContent: S.of(popupContext).transaction_sent,
|
||||
buttonText: S.of(popupContext).ok,
|
||||
buttonAction: () => Navigator.of(popupContext).pop());
|
||||
});
|
||||
if (context.mounted) {
|
||||
showPopUp<void>(
|
||||
context: context,
|
||||
builder: (BuildContext popupContext) {
|
||||
return AlertWithOneAction(
|
||||
alertTitle: S.of(popupContext).sending,
|
||||
alertContent: S.of(popupContext).transaction_sent,
|
||||
buttonText: S.of(popupContext).ok,
|
||||
buttonAction: () => Navigator.of(popupContext).pop());
|
||||
});
|
||||
}
|
||||
});
|
||||
}
|
||||
});
|
||||
|
|
|
@ -53,16 +53,16 @@ class RootState extends State<Root> with WidgetsBindingObserver {
|
|||
|
||||
@override
|
||||
void initState() {
|
||||
WidgetsBinding.instance.addPostFrameCallback((_) async {
|
||||
bool value = await widget.authService.requireAuth();
|
||||
setState(() {
|
||||
_requestAuth = value;
|
||||
WidgetsBinding.instance.addObserver(this);
|
||||
|
||||
widget.authService.requireAuth().then((value) {
|
||||
WidgetsBinding.instance.addPostFrameCallback((_) {
|
||||
setState(() => _requestAuth = value);
|
||||
});
|
||||
});
|
||||
_isInactiveController = StreamController<bool>.broadcast();
|
||||
_isInactive = false;
|
||||
_postFrameCallback = false;
|
||||
WidgetsBinding.instance.addObserver(this);
|
||||
super.initState();
|
||||
if (DeviceInfo.instance.isMobile) {
|
||||
initUniLinks();
|
||||
|
|
|
@ -922,7 +922,7 @@ abstract class SettingsStoreBase with Store {
|
|||
final allowBiometricalAuthentication = await SecureKey.getBool(
|
||||
secureStorage: secureStorage,
|
||||
sharedPreferences: sharedPreferences,
|
||||
key: SecureKey.pinTimeOutDuration,
|
||||
key: SecureKey.allowBiometricalAuthenticationKey,
|
||||
) ??
|
||||
false;
|
||||
|
||||
|
@ -1247,6 +1247,16 @@ abstract class SettingsStoreBase with Store {
|
|||
) ??
|
||||
totpSecretKey;
|
||||
|
||||
final timeOutDuration = await SecureKey.getInt(
|
||||
secureStorage: _secureStorage,
|
||||
sharedPreferences: sharedPreferences,
|
||||
key: SecureKey.pinTimeOutDuration,
|
||||
);
|
||||
|
||||
pinTimeOutDuration = timeOutDuration != null
|
||||
? PinCodeRequiredDuration.deserialize(raw: timeOutDuration)
|
||||
: defaultPinCodeTimeOutDuration;
|
||||
|
||||
allowBiometricalAuthentication = await SecureKey.getBool(
|
||||
secureStorage: _secureStorage,
|
||||
sharedPreferences: sharedPreferences,
|
||||
|
|
|
@ -16,30 +16,17 @@ abstract class UnspentCoinsListViewModelBase with Store {
|
|||
UnspentCoinsListViewModelBase(
|
||||
{required this.wallet, required Box<UnspentCoinsInfo> unspentCoinsInfo})
|
||||
: _unspentCoinsInfo = unspentCoinsInfo {
|
||||
_updateUnspentCoinsInfo();
|
||||
_updateUnspents();
|
||||
}
|
||||
|
||||
WalletBase wallet;
|
||||
final Box<UnspentCoinsInfo> _unspentCoinsInfo;
|
||||
|
||||
@computed
|
||||
ObservableList<UnspentCoinsItem> get items => ObservableList.of(_getUnspents().map((elem) {
|
||||
final info =
|
||||
getUnspentCoinInfo(elem.hash, elem.address, elem.value, elem.vout, elem.keyImage);
|
||||
final ObservableList<UnspentCoinsItem> _items = ObservableList();
|
||||
|
||||
return UnspentCoinsItem(
|
||||
address: elem.address,
|
||||
amount: '${formatAmountToString(elem.value)} ${wallet.currency.title}',
|
||||
hash: elem.hash,
|
||||
isFrozen: info.isFrozen,
|
||||
note: info.note,
|
||||
isSending: info.isSending,
|
||||
amountRaw: elem.value,
|
||||
vout: elem.vout,
|
||||
keyImage: elem.keyImage,
|
||||
isChange: elem.isChange,
|
||||
);
|
||||
}));
|
||||
@computed
|
||||
ObservableList<UnspentCoinsItem> get items => _items;
|
||||
|
||||
Future<void> saveUnspentCoinInfo(UnspentCoinsItem item) async {
|
||||
try {
|
||||
|
@ -77,9 +64,14 @@ abstract class UnspentCoinsListViewModelBase with Store {
|
|||
}
|
||||
|
||||
Future<void> _updateUnspents() async {
|
||||
if (wallet.type == WalletType.monero) return monero!.updateUnspents(wallet);
|
||||
if ([WalletType.bitcoin, WalletType.litecoin, WalletType.bitcoinCash].contains(wallet.type))
|
||||
return bitcoin!.updateUnspents(wallet);
|
||||
if (wallet.type == WalletType.monero) {
|
||||
await monero!.updateUnspents(wallet);
|
||||
}
|
||||
if ([WalletType.bitcoin, WalletType.litecoin, WalletType.bitcoinCash].contains(wallet.type)) {
|
||||
await bitcoin!.updateUnspents(wallet);
|
||||
}
|
||||
|
||||
_updateUnspentCoinsInfo();
|
||||
}
|
||||
|
||||
List<Unspent> _getUnspents() {
|
||||
|
@ -88,4 +80,26 @@ abstract class UnspentCoinsListViewModelBase with Store {
|
|||
return bitcoin!.getUnspents(wallet);
|
||||
return List.empty();
|
||||
}
|
||||
|
||||
@action
|
||||
void _updateUnspentCoinsInfo() {
|
||||
_items.clear();
|
||||
_items.addAll(_getUnspents().map((elem) {
|
||||
final info =
|
||||
getUnspentCoinInfo(elem.hash, elem.address, elem.value, elem.vout, elem.keyImage);
|
||||
|
||||
return UnspentCoinsItem(
|
||||
address: elem.address,
|
||||
amount: '${formatAmountToString(elem.value)} ${wallet.currency.title}',
|
||||
hash: elem.hash,
|
||||
isFrozen: info.isFrozen,
|
||||
note: info.note,
|
||||
isSending: info.isSending,
|
||||
amountRaw: elem.value,
|
||||
vout: elem.vout,
|
||||
keyImage: elem.keyImage,
|
||||
isChange: elem.isChange,
|
||||
);
|
||||
}));
|
||||
}
|
||||
}
|
||||
|
|
|
@ -15,15 +15,15 @@ TYPES=($MONERO_COM $CAKEWALLET $HAVEN)
|
|||
APP_ANDROID_TYPE=$1
|
||||
|
||||
MONERO_COM_NAME="Monero.com"
|
||||
MONERO_COM_VERSION="1.10.1"
|
||||
MONERO_COM_BUILD_NUMBER=73
|
||||
MONERO_COM_VERSION="1.10.2"
|
||||
MONERO_COM_BUILD_NUMBER=74
|
||||
MONERO_COM_BUNDLE_ID="com.monero.app"
|
||||
MONERO_COM_PACKAGE="com.monero.app"
|
||||
MONERO_COM_SCHEME="monero.com"
|
||||
|
||||
CAKEWALLET_NAME="Cake Wallet"
|
||||
CAKEWALLET_VERSION="4.13.1"
|
||||
CAKEWALLET_BUILD_NUMBER=190
|
||||
CAKEWALLET_VERSION="4.13.2"
|
||||
CAKEWALLET_BUILD_NUMBER=191
|
||||
CAKEWALLET_BUNDLE_ID="com.cakewallet.cake_wallet"
|
||||
CAKEWALLET_PACKAGE="com.cakewallet.cake_wallet"
|
||||
CAKEWALLET_SCHEME="cakewallet"
|
||||
|
|
|
@ -13,13 +13,13 @@ TYPES=($MONERO_COM $CAKEWALLET $HAVEN)
|
|||
APP_IOS_TYPE=$1
|
||||
|
||||
MONERO_COM_NAME="Monero.com"
|
||||
MONERO_COM_VERSION="1.10.1"
|
||||
MONERO_COM_BUILD_NUMBER=71
|
||||
MONERO_COM_VERSION="1.10.2"
|
||||
MONERO_COM_BUILD_NUMBER=72
|
||||
MONERO_COM_BUNDLE_ID="com.cakewallet.monero"
|
||||
|
||||
CAKEWALLET_NAME="Cake Wallet"
|
||||
CAKEWALLET_VERSION="4.13.1"
|
||||
CAKEWALLET_BUILD_NUMBER=209
|
||||
CAKEWALLET_VERSION="4.13.2"
|
||||
CAKEWALLET_BUILD_NUMBER=210
|
||||
CAKEWALLET_BUNDLE_ID="com.fotolockr.cakewallet"
|
||||
|
||||
HAVEN_NAME="Haven"
|
||||
|
|
|
@ -16,13 +16,13 @@ if [ -n "$1" ]; then
|
|||
fi
|
||||
|
||||
MONERO_COM_NAME="Monero.com"
|
||||
MONERO_COM_VERSION="1.0.1"
|
||||
MONERO_COM_BUILD_NUMBER=3
|
||||
MONERO_COM_VERSION="1.0.2"
|
||||
MONERO_COM_BUILD_NUMBER=4
|
||||
MONERO_COM_BUNDLE_ID="com.cakewallet.monero"
|
||||
|
||||
CAKEWALLET_NAME="Cake Wallet"
|
||||
CAKEWALLET_VERSION="1.6.1"
|
||||
CAKEWALLET_BUILD_NUMBER=51
|
||||
CAKEWALLET_VERSION="1.6.2"
|
||||
CAKEWALLET_BUILD_NUMBER=52
|
||||
CAKEWALLET_BUNDLE_ID="com.fotolockr.cakewallet"
|
||||
|
||||
if ! [[ " ${TYPES[*]} " =~ " ${APP_MACOS_TYPE} " ]]; then
|
||||
|
|
|
@ -127,7 +127,7 @@ abstract class Bitcoin {
|
|||
String bitcoinTransactionPriorityWithLabel(TransactionPriority priority, int rate);
|
||||
|
||||
List<Unspent> getUnspents(Object wallet);
|
||||
void updateUnspents(Object wallet);
|
||||
Future<void> updateUnspents(Object wallet);
|
||||
WalletService createBitcoinWalletService(Box<WalletInfo> walletInfoSource, Box<UnspentCoinsInfo> unspentCoinSource);
|
||||
WalletService createLitecoinWalletService(Box<WalletInfo> walletInfoSource, Box<UnspentCoinsInfo> unspentCoinSource);
|
||||
TransactionPriority getBitcoinTransactionPriorityMedium();
|
||||
|
@ -270,7 +270,7 @@ abstract class Monero {
|
|||
List<String> getMoneroWordList(String language);
|
||||
|
||||
List<Unspent> getUnspents(Object wallet);
|
||||
void updateUnspents(Object wallet);
|
||||
Future<void> updateUnspents(Object wallet);
|
||||
|
||||
WalletCredentials createMoneroRestoreWalletFromKeysCredentials({
|
||||
required String name,
|
||||
|
|
Loading…
Reference in a new issue