import { UiBalanceForCurrency, UiBalanceForWallet, UiCapitalGain, UiNotification, UiPortfolio, UiTaxReport, UiTransaction, UiTransactionSource, UiWallet } from "structs.slint"; import { TestData } from "test-data.slint"; export global Facade { // MODELS in-out property <[UiWallet]> wallets: TestData.wallets; in-out property <[UiTransactionSource]> sources: TestData.sources; in-out property <[string]> source-types; in-out property <[UiTransaction]> transactions: TestData.transactions; in-out property transaction-warning-count: 0; in-out property <[StandardListViewItem]> report-years: TestData.report-years; in-out property <[UiTaxReport]> reports: TestData.reports; in-out property portfolio: TestData.portfolio; in-out property <[UiNotification]> notifications; out property wallet-filter: -1; out property currency-filter: ""; out property text-filter: ""; out property warnings-filter: false; // ACTIONS callback new-portfolio(); callback load-portfolio(); callback close-portfolio(); callback add-wallet(string); callback remove-wallet(int); callback add-source(int); callback remove-source(int,int); callback ignore-currency(string); // params: (blockchain, tx_hash) callback open-transaction(string, string); // params: (wallet_index, enabled) callback set-wallet-enabled(int, bool); // params: (wallet_index, source_index, enabled) callback set-source-enabled(int, int, bool); // params: (wallet_index, source_index) callback sync-source(int, int); // params: (report_index) callback export-summary(int); callback export-capital-gains(int); callback export-all(); callback export-transactions-csv; callback export-transactions-json; // parems: (notification_index) callback remove-notification(int); callback transaction-filter-changed; // DATA REQUESTS // params: (id) pure callback ui-index-for-transaction(int) -> int; // params: (currency) pure callback balances-for-currency(string) -> [UiBalanceForCurrency]; // params: (wallet_index) pure callback balances-for-wallet(int) -> [UiBalanceForWallet]; // FUNCTIONS public function set-wallet-filter(wallet-index: int) { if (wallet-filter != wallet-index || currency-filter != "") { wallet-filter = wallet-index; currency-filter = ""; transaction-filter-changed(); } } public function set-currency-filter(currency: string) { if (currency-filter != currency || wallet-filter != -1) { currency-filter = currency; wallet-filter = -1; transaction-filter-changed(); } } public function set-text-filter(text: string) { if (text-filter != text) { text-filter = text; transaction-filter-changed(); } } public function set-warnings-filter(enabled: bool) { if (warnings-filter != enabled) { warnings-filter = enabled; transaction-filter-changed(); } } }