Cw 150 cake pay introduction card (#486)

* create introducing card

* add ability to close the card

* update walletInfo class

* update localization

* fix intro text

* fix card size

* show card for existing and new wallet types

* disable card for haven wallets

* fixes to PR

* fixes to PR

* fix PR
This commit is contained in:
Serhii
2022-08-30 19:03:02 +01:00
committed by GitHub
parent 5fcbf3634b
commit 7fae9cf9bb
21 changed files with 189 additions and 19 deletions
@@ -39,6 +39,7 @@ abstract class BalanceViewModelBase with Store {
@required this.fiatConvertationStore}) {
isReversing = false;
wallet ??= appStore.wallet;
isShowCard = wallet.walletInfo.isShowIntroCakePayCard;
reaction((_) => appStore.wallet, _onWalletChange);
}
@@ -235,6 +236,9 @@ abstract class BalanceViewModelBase with Store {
@computed
CryptoCurrency get currency => appStore.wallet.currency;
@observable
bool isShowCard;
ReactionDisposer _onCurrentWalletChangeReaction;
@action
@@ -244,6 +248,15 @@ abstract class BalanceViewModelBase with Store {
wallet) {
this.wallet = wallet;
_onCurrentWalletChangeReaction?.reaction?.dispose();
isShowCard = wallet.walletInfo.isShowIntroCakePayCard;
}
@action
Future<void> disableIntroCakePayCard () async {
const cardDisplayStatus = false;
wallet.walletInfo.showIntroCakePayCard = cardDisplayStatus;
await wallet.walletInfo.save();
isShowCard = cardDisplayStatus;
}
String _getFiatBalance({double price, String cryptoAmount}) {
+5 -1
View File
@@ -37,6 +37,9 @@ abstract class WalletCreationVMBase with Store {
bool nameExists(String name)
=> walletCreationService.exists(name);
bool typeExists(WalletType type)
=> walletCreationService.typeExists(type);
Future<void> create({dynamic options}) async {
try {
state = IsExecutingState();
@@ -56,7 +59,8 @@ abstract class WalletCreationVMBase with Store {
restoreHeight: credentials.height ?? 0,
date: DateTime.now(),
path: path,
dirPath: dirPath);
dirPath: dirPath,
showIntroCakePayCard: (!walletCreationService.typeExists(type)) && type != WalletType.haven);
credentials.walletInfo = walletInfo;
final wallet = await process(credentials);
walletInfo.address = wallet.walletAddresses.address;