mirror of
https://github.com/cake-tech/cake_wallet.git
synced 2024-11-16 17:27:37 +00:00
filter templates by current wallet type
This commit is contained in:
parent
860e904816
commit
1d3e4f4331
2 changed files with 18 additions and 15 deletions
|
@ -197,7 +197,7 @@ class SendPage extends BasePage {
|
|||
itemCount: itemCount,
|
||||
itemBuilder: (context, index) {
|
||||
final template = templates[index];
|
||||
|
||||
print(template.cryptoCurrency);
|
||||
return TemplateTile(
|
||||
key: UniqueKey(),
|
||||
to: template.name,
|
||||
|
|
|
@ -29,8 +29,11 @@ part 'send_view_model.g.dart';
|
|||
class SendViewModel = SendViewModelBase with _$SendViewModel;
|
||||
|
||||
abstract class SendViewModelBase with Store {
|
||||
SendViewModelBase(this._wallet, this._settingsStore,
|
||||
this.sendTemplateViewModel, this._fiatConversationStore,
|
||||
SendViewModelBase(
|
||||
this._wallet,
|
||||
this._settingsStore,
|
||||
this.sendTemplateViewModel,
|
||||
this._fiatConversationStore,
|
||||
this.transactionDescriptionBox)
|
||||
: state = InitialExecutionState() {
|
||||
final priority = _settingsStore.priority[_wallet.type];
|
||||
|
@ -127,15 +130,18 @@ abstract class SendViewModelBase with Store {
|
|||
bool get isReadyForSend => _wallet.syncStatus is SyncedSyncStatus;
|
||||
|
||||
@computed
|
||||
ObservableList<Template> get templates => sendTemplateViewModel.templates;
|
||||
ObservableList<Template> get templates => sendTemplateViewModel.templates
|
||||
.where((template) => template.cryptoCurrency == _wallet.currency.title)
|
||||
.toList()
|
||||
.asObservable();
|
||||
|
||||
@computed
|
||||
bool get isElectrumWallet => _wallet.type == WalletType.bitcoin || _wallet.type == WalletType.litecoin;
|
||||
bool get isElectrumWallet =>
|
||||
_wallet.type == WalletType.bitcoin || _wallet.type == WalletType.litecoin;
|
||||
|
||||
bool get hasYat
|
||||
=> outputs.any((out) => out.isParsedAddress
|
||||
&& out.parsedAddress.parseFrom == ParseFrom.yatRecord);
|
||||
|
||||
bool get hasYat => outputs.any((out) =>
|
||||
out.isParsedAddress &&
|
||||
out.parsedAddress.parseFrom == ParseFrom.yatRecord);
|
||||
|
||||
WalletType get walletType => _wallet.type;
|
||||
final WalletBase _wallet;
|
||||
|
@ -200,19 +206,16 @@ abstract class SendViewModelBase with Store {
|
|||
case WalletType.bitcoin:
|
||||
final priority = _settingsStore.priority[_wallet.type];
|
||||
|
||||
return bitcoin.createBitcoinTransactionCredentials(
|
||||
outputs, priority);
|
||||
return bitcoin.createBitcoinTransactionCredentials(outputs, priority);
|
||||
case WalletType.litecoin:
|
||||
final priority = _settingsStore.priority[_wallet.type];
|
||||
|
||||
return bitcoin.createBitcoinTransactionCredentials(
|
||||
outputs, priority);
|
||||
return bitcoin.createBitcoinTransactionCredentials(outputs, priority);
|
||||
case WalletType.monero:
|
||||
final priority = _settingsStore.priority[_wallet.type];
|
||||
|
||||
return monero.createMoneroTransactionCreationCredentials(
|
||||
outputs: outputs,
|
||||
priority: priority);
|
||||
outputs: outputs, priority: priority);
|
||||
default:
|
||||
return null;
|
||||
}
|
||||
|
|
Loading…
Reference in a new issue