mirror of
https://github.com/Such-Software/hash-wallet.git
synced 2026-12-01 12:04:21 +01:00
Dashboard desktop view (#737)
* Add build scripts for macOS. Add macos for cw_monero plugin. Add macos proj to the application. * - Update Flutter secure storage to work with macos - Enable uni links only on Mobile - Update devcelocale to work with macos * Add network access to mac * Change Dashboard view on desktop size screens * Add on Tap to desktop_action_button.dart Remove unused functions * Fix arch match for monero lib for darwin x86_64 -> x86-64 * Add Bundle ID in entitlements files through app config script * Update deployment target to 10.13 * Revert back to Cake fork for secure storage * Revert back to Cake fork for secure storage * Revert mac os version * Revert mac os version * Add platform channel specific code for mac os * Add desktop sidebar * [skip ci] Add desktop sidebar * [skip ci] Add desktop sidebar * - Remove legacy migration from macos - Remove wake lock native code and just use the ready made package * Remove wake lock native code and just use the ready made package * Remove unstoppable domain from macos since it's not supported * Temporarily fetch unstoppable domains only on mobile * refactor desktop settings sidebar * Ignore increasing brightness for non-mobile platforms * Add Wallet selection dropdown to dashboard desktop view * Generate MacOS icons * localize settings * fix dashboard sidebar and responsive utils * Change Mac os app name and bundle id * Fix exchange page as fullScreenDialog * Remove constants * - Refactor onRamper to have a single point of modification - Enlarge initial app size - update Flutter and Packages * Add pubspec.lock and Podfile.lock to gitignore * Remove Podfile.lock from cache * Fix bug on sidebar reset * Fix issues from code review * [skip ci] reformat desktop dashboard * [skip ci] reformat desktop dashboard * Revert removing .lock files * Revert changes in .gitignore * [skip ci] remove .project changes * [skip ci] remove .project changes * Separate Dashboard desktop view from mobile view * constraint images and pincoded box * Remove drawer from mac os * - Listen to keyboard events in PIN screen - Fix PIN buttons style * Fix desktop nav bar UI * Add Marketplace to dashboard view * Update trailing icon to open transaction page * Update widget contraints * Add empty trailing to center page title on desktop * Refresh desktop dashboard actions on wallet change * Change ionia welcome page animation * Fix Constrained width screens UI * Refactor sidebar state management * remove empty line * Add max width constrain to Welcome page * Change Exchange page UI depending on platform * - Change design/paddings for Send page on desktop view - Make AddTemplateButton instead of having it duplicated in send/exchange * Fix Desktop dashboard actions background color * Constrain primary Buttons width * Make side menu items toggle back to dashboard * Add padding to support page * Add width constraints to desktop dashboard * Fix UI issues, paddings and alignments * Rename misleading variable Change initial mac window size * Fix wallet create in settings * remove unnecessary code * remove unnecessary code * Remove duplicated constrains * - Use close icon on main screens - Minor UI fixes * fix pageview controller reset index * Add create and restore wallet options to dropdown menu * Fix desktop background color and address book view issues * Fix input field * Add onFieldSubmitted to allow "enter" button interaction * Fix issue from code review * Fix Popup width constraint and add focus orders * Fix variable name * Fix issues from code review * refactor dropdown items * Fix alignment in create and restore wallet screens * Fix dropdown change state bug Hide scanner for desktop * remove space * override navbar with desktopnavbar * Remove autofocus * remove unused code * Fix ionia input field alignment * Replace removed code * Add app lock feature on mac * Add assertion to avoid null * Add Nano currency image * Enable adding contact from send screen * Fix UI issues Add missing translation * pop only PIN screen after successful auth * Add back wallet settings page to desktop settings actions * Fix Navigation animation for settings screens * Fixate MobX version to fix restore issue * CW-324 Refresh current settings page if wallet changed (#811) * Fix refresh current settings page if wallet changed * Fix refresh current settings page if wallet changed * Refresh Wallet Seeds/Keys List upon wallet change --------- Co-authored-by: OmarHatem <omarh.ismail1@gmail.com> * Remove navigation workaround for duplicate key, and fix the issue by handling creation/disposing of global key (#840) * Cw 323 add wallet list to settings on mac (#843) * Remove navigation workaround for duplicate key, and fix the issue by handling creation/disposing of global key * - Register Wallet List as singleton in Desktop to be modify the same instance from settings and dropdown - General Fixes and Enhancements * Fix Changing/Restoring wallet from settings * Fix Create wallet not showing seeds screens if launched from settings * Add max width constraint for Alerts * - Add Desktop API keys - Fix Change back up password issue - Fix Popup width * Sync Mac with latest main updates * Swap Transactions icon with lock icon * Save backup file locally on desktop * Sync with latest main updates * Fix Navigation issues with anonpay * Update macos build version * Remove deprecated custom wake lock code for Android * Remove Legacy CryptoSwift package from MacOS * - Refactor Payfura page code - Add OnRamper new configs to onramper_buy_provider.dart - Fix Conflicts with main * Updated device locale package * Update android tools * Revert changes and update only gradle version * Downgrade android tools version * Update gradle version * Update package/gradle/plugin version * - Fixate device locale version - Downgrade gradle version * Update kotlin version * Update gradle version * Trial for a custom fork from devicelocale * Fixate shared preferences package version * Revert gradle version * Revert kotlin version * Downgrade gradle version * Downgrade gradle version * Repair cache and clean before build * Fixate flutter version * update google services version * revert google services version * Force shared pref android version * Override shared prefs android package version * Override shared prefs android package [skip ci] --------- Co-authored-by: M <m@cakewallet.com> Co-authored-by: Godwin Asuquo <godilite@gmail.com> Co-authored-by: Godwin Asuquo <41484542+godilite@users.noreply.github.com>
This commit is contained in:
co-authored by
M
Godwin Asuquo
Godwin Asuquo
parent
5c4fd78951
commit
c5477e4f9e
@@ -1,13 +1,9 @@
|
||||
import 'package:cake_wallet/entities/exchange_api_mode.dart';
|
||||
import 'package:cake_wallet/entities/fiat_api_mode.dart';
|
||||
import 'package:cake_wallet/store/anonpay/anonpay_transactions_store.dart';
|
||||
import 'package:cake_wallet/view_model/dashboard/anonpay_transaction_list_item.dart';
|
||||
import 'package:cake_wallet/wallet_type_utils.dart';
|
||||
import 'package:cw_core/transaction_history.dart';
|
||||
import 'package:cw_core/balance.dart';
|
||||
import 'package:cake_wallet/buy/order.dart';
|
||||
import 'package:cake_wallet/entities/transaction_history.dart';
|
||||
import 'package:cake_wallet/exchange/trade_state.dart';
|
||||
import 'package:cake_wallet/entities/balance_display_mode.dart';
|
||||
import 'package:cw_core/transaction_info.dart';
|
||||
import 'package:cake_wallet/exchange/exchange_provider_description.dart';
|
||||
@@ -21,10 +17,6 @@ import 'package:cake_wallet/view_model/dashboard/order_list_item.dart';
|
||||
import 'package:cake_wallet/view_model/dashboard/trade_list_item.dart';
|
||||
import 'package:cake_wallet/view_model/dashboard/transaction_list_item.dart';
|
||||
import 'package:cake_wallet/view_model/dashboard/action_list_item.dart';
|
||||
import 'package:cake_wallet/view_model/dashboard/action_list_display_mode.dart';
|
||||
import 'package:crypto/crypto.dart';
|
||||
import 'package:flutter/services.dart';
|
||||
import 'package:hive/hive.dart';
|
||||
import 'package:mobx/mobx.dart';
|
||||
import 'package:cw_core/wallet_base.dart';
|
||||
import 'package:cw_core/sync_status.dart';
|
||||
|
||||
@@ -0,0 +1,34 @@
|
||||
import 'package:mobx/mobx.dart';
|
||||
|
||||
part 'desktop_sidebar_view_model.g.dart';
|
||||
|
||||
enum SidebarItem {
|
||||
dashboard,
|
||||
support,
|
||||
settings,
|
||||
transactions;
|
||||
}
|
||||
|
||||
class DesktopSidebarViewModel = DesktopSidebarViewModelBase with _$DesktopSidebarViewModel;
|
||||
|
||||
abstract class DesktopSidebarViewModelBase with Store {
|
||||
DesktopSidebarViewModelBase();
|
||||
|
||||
@observable
|
||||
SidebarItem currentPage = SidebarItem.dashboard;
|
||||
|
||||
@action
|
||||
void onPageChange(SidebarItem item) {
|
||||
if (currentPage == item) {
|
||||
resetSidebar();
|
||||
|
||||
return;
|
||||
}
|
||||
currentPage = item;
|
||||
}
|
||||
|
||||
@action
|
||||
void resetSidebar() {
|
||||
currentPage = SidebarItem.dashboard;
|
||||
}
|
||||
}
|
||||
@@ -1,4 +1,6 @@
|
||||
import 'package:cake_wallet/generated/i18n.dart';
|
||||
import 'package:cake_wallet/store/app_store.dart';
|
||||
import 'package:cake_wallet/utils/mobx.dart';
|
||||
import 'package:hive/hive.dart';
|
||||
import 'package:mobx/mobx.dart';
|
||||
import 'package:cw_core/wallet_base.dart';
|
||||
@@ -7,25 +9,28 @@ import 'package:cw_core/node.dart';
|
||||
import 'package:cake_wallet/entities/node_list.dart';
|
||||
import 'package:cake_wallet/entities/default_settings_migration.dart';
|
||||
import 'package:cw_core/wallet_type.dart';
|
||||
import 'package:cake_wallet/utils/mobx.dart';
|
||||
|
||||
part 'node_list_view_model.g.dart';
|
||||
|
||||
class NodeListViewModel = NodeListViewModelBase with _$NodeListViewModel;
|
||||
|
||||
abstract class NodeListViewModelBase with Store {
|
||||
NodeListViewModelBase(this._nodeSource, this.wallet, this.settingsStore)
|
||||
: nodes = ObservableList<Node>() {
|
||||
_nodeSource.bindToList(nodes,
|
||||
filter: (Node val) => val?.type == wallet.type, initialFire: true);
|
||||
NodeListViewModelBase(this._nodeSource, this._appStore)
|
||||
: nodes = ObservableList<Node>(),
|
||||
settingsStore = _appStore.settingsStore {
|
||||
_bindNodes();
|
||||
|
||||
reaction((_) => _appStore.wallet, (WalletBase? _wallet) {
|
||||
_bindNodes();
|
||||
});
|
||||
}
|
||||
|
||||
@computed
|
||||
Node get currentNode {
|
||||
final node = settingsStore.nodes[wallet.type];
|
||||
final node = settingsStore.nodes[_appStore.wallet!.type];
|
||||
|
||||
if (node == null) {
|
||||
throw Exception('No node for wallet type: ${wallet.type}');
|
||||
throw Exception('No node for wallet type: ${_appStore.wallet!.type}');
|
||||
}
|
||||
|
||||
return node;
|
||||
@@ -33,19 +38,19 @@ abstract class NodeListViewModelBase with Store {
|
||||
|
||||
String getAlertContent(String uri) =>
|
||||
S.current.change_current_node(uri) +
|
||||
'${uri.endsWith('.onion') || uri.contains('.onion:') ? '\n' + S.current.orbot_running_alert : ''}';
|
||||
'${uri.endsWith('.onion') || uri.contains('.onion:') ? '\n' + S.current.orbot_running_alert : ''}';
|
||||
|
||||
final ObservableList<Node> nodes;
|
||||
final SettingsStore settingsStore;
|
||||
final WalletBase wallet;
|
||||
final Box<Node> _nodeSource;
|
||||
final AppStore _appStore;
|
||||
|
||||
Future<void> reset() async {
|
||||
await resetToDefault(_nodeSource);
|
||||
|
||||
Node node;
|
||||
|
||||
switch (wallet.type) {
|
||||
switch (_appStore.wallet!.type) {
|
||||
case WalletType.bitcoin:
|
||||
node = getBitcoinDefaultElectrumServer(nodes: _nodeSource)!;
|
||||
break;
|
||||
@@ -59,7 +64,7 @@ abstract class NodeListViewModelBase with Store {
|
||||
node = getHavenDefaultNode(nodes: _nodeSource)!;
|
||||
break;
|
||||
default:
|
||||
throw Exception('Unexpected wallet type: ${wallet.type}');
|
||||
throw Exception('Unexpected wallet type: ${_appStore.wallet!.type}');
|
||||
}
|
||||
|
||||
await setAsCurrent(node);
|
||||
@@ -68,6 +73,15 @@ abstract class NodeListViewModelBase with Store {
|
||||
@action
|
||||
Future<void> delete(Node node) async => node.delete();
|
||||
|
||||
Future<void> setAsCurrent(Node node) async =>
|
||||
settingsStore.nodes[wallet.type] = node;
|
||||
Future<void> setAsCurrent(Node node) async => settingsStore.nodes[_appStore.wallet!.type] = node;
|
||||
|
||||
@action
|
||||
void _bindNodes() {
|
||||
nodes.clear();
|
||||
_nodeSource.bindToList(
|
||||
nodes,
|
||||
filter: (val) => val.type == _appStore.wallet!.type,
|
||||
initialFire: true,
|
||||
);
|
||||
}
|
||||
}
|
||||
|
||||
@@ -1,3 +1,4 @@
|
||||
import 'package:cake_wallet/store/app_store.dart';
|
||||
import 'package:cw_core/wallet_type.dart';
|
||||
import 'package:mobx/mobx.dart';
|
||||
import 'package:cake_wallet/generated/i18n.dart';
|
||||
@@ -12,70 +13,83 @@ part 'wallet_keys_view_model.g.dart';
|
||||
class WalletKeysViewModel = WalletKeysViewModelBase with _$WalletKeysViewModel;
|
||||
|
||||
abstract class WalletKeysViewModelBase with Store {
|
||||
WalletKeysViewModelBase(WalletBase wallet)
|
||||
: title = wallet.type == WalletType.bitcoin || wallet.type == WalletType.litecoin
|
||||
WalletKeysViewModelBase(this._appStore)
|
||||
: title = _appStore.wallet!.type == WalletType.bitcoin ||
|
||||
_appStore.wallet!.type == WalletType.litecoin
|
||||
? S.current.wallet_seed
|
||||
: S.current.wallet_keys,
|
||||
_wallet = wallet,
|
||||
_restoreHeight = wallet.walletInfo.restoreHeight,
|
||||
_restoreHeight = _appStore.wallet!.walletInfo.restoreHeight,
|
||||
items = ObservableList<StandartListItem>() {
|
||||
if (wallet.type == WalletType.monero) {
|
||||
final keys = monero!.getKeys(wallet);
|
||||
items.addAll([
|
||||
if (keys['publicSpendKey'] != null)
|
||||
StandartListItem(title: S.current.spend_key_public, value: keys['publicSpendKey']!),
|
||||
if (keys['privateSpendKey'] != null)
|
||||
StandartListItem(title: S.current.spend_key_private, value: keys['privateSpendKey']!),
|
||||
if (keys['publicViewKey'] != null)
|
||||
StandartListItem(title: S.current.view_key_public, value: keys['publicViewKey']!),
|
||||
if (keys['privateViewKey'] != null)
|
||||
StandartListItem(title: S.current.view_key_private, value: keys['privateViewKey']!),
|
||||
StandartListItem(title: S.current.wallet_seed, value: wallet.seed),
|
||||
]);
|
||||
}
|
||||
_populateItems();
|
||||
|
||||
if (wallet.type == WalletType.haven) {
|
||||
final keys = haven!.getKeys(wallet);
|
||||
items.addAll([
|
||||
if (keys['publicSpendKey'] != null)
|
||||
StandartListItem(title: S.current.spend_key_public, value: keys['publicSpendKey']!),
|
||||
if (keys['privateSpendKey'] != null)
|
||||
StandartListItem(title: S.current.spend_key_private, value: keys['privateSpendKey']!),
|
||||
if (keys['publicViewKey'] != null)
|
||||
StandartListItem(title: S.current.view_key_public, value: keys['publicViewKey']!),
|
||||
if (keys['privateViewKey'] != null)
|
||||
StandartListItem(title: S.current.view_key_private, value: keys['privateViewKey']!),
|
||||
StandartListItem(title: S.current.wallet_seed, value: wallet.seed),
|
||||
]);
|
||||
}
|
||||
|
||||
if (wallet.type == WalletType.bitcoin || wallet.type == WalletType.litecoin) {
|
||||
items.addAll([
|
||||
StandartListItem(title: S.current.wallet_seed, value: wallet.seed),
|
||||
]);
|
||||
}
|
||||
reaction((_) => _appStore.wallet, (WalletBase? _wallet) {
|
||||
_populateItems();
|
||||
});
|
||||
}
|
||||
|
||||
final ObservableList<StandartListItem> items;
|
||||
|
||||
final String title;
|
||||
|
||||
final WalletBase _wallet;
|
||||
final AppStore _appStore;
|
||||
|
||||
final int _restoreHeight;
|
||||
|
||||
void _populateItems() {
|
||||
items.clear();
|
||||
|
||||
if (_appStore.wallet!.type == WalletType.monero) {
|
||||
final keys = monero!.getKeys(_appStore.wallet!);
|
||||
|
||||
items.addAll([
|
||||
if (keys['publicSpendKey'] != null)
|
||||
StandartListItem(title: S.current.spend_key_public, value: keys['publicSpendKey']!),
|
||||
if (keys['privateSpendKey'] != null)
|
||||
StandartListItem(title: S.current.spend_key_private, value: keys['privateSpendKey']!),
|
||||
if (keys['publicViewKey'] != null)
|
||||
StandartListItem(title: S.current.view_key_public, value: keys['publicViewKey']!),
|
||||
if (keys['privateViewKey'] != null)
|
||||
StandartListItem(title: S.current.view_key_private, value: keys['privateViewKey']!),
|
||||
StandartListItem(title: S.current.wallet_seed, value: _appStore.wallet!.seed),
|
||||
]);
|
||||
}
|
||||
|
||||
if (_appStore.wallet!.type == WalletType.haven) {
|
||||
final keys = haven!.getKeys(_appStore.wallet!);
|
||||
|
||||
items.addAll([
|
||||
if (keys['publicSpendKey'] != null)
|
||||
StandartListItem(title: S.current.spend_key_public, value: keys['publicSpendKey']!),
|
||||
if (keys['privateSpendKey'] != null)
|
||||
StandartListItem(title: S.current.spend_key_private, value: keys['privateSpendKey']!),
|
||||
if (keys['publicViewKey'] != null)
|
||||
StandartListItem(title: S.current.view_key_public, value: keys['publicViewKey']!),
|
||||
if (keys['privateViewKey'] != null)
|
||||
StandartListItem(title: S.current.view_key_private, value: keys['privateViewKey']!),
|
||||
StandartListItem(title: S.current.wallet_seed, value: _appStore.wallet!.seed),
|
||||
]);
|
||||
}
|
||||
|
||||
if (_appStore.wallet!.type == WalletType.bitcoin ||
|
||||
_appStore.wallet!.type == WalletType.litecoin) {
|
||||
items.addAll([
|
||||
StandartListItem(title: S.current.wallet_seed, value: _appStore.wallet!.seed),
|
||||
]);
|
||||
}
|
||||
}
|
||||
|
||||
Future<int?> currentHeight() async {
|
||||
if (_wallet.type == WalletType.haven) {
|
||||
if (_appStore.wallet!.type == WalletType.haven) {
|
||||
return await haven!.getCurrentHeight();
|
||||
}
|
||||
if (_wallet.type == WalletType.monero) {
|
||||
if (_appStore.wallet!.type == WalletType.monero) {
|
||||
return monero_wallet.getCurrentHeight();
|
||||
}
|
||||
return null;
|
||||
}
|
||||
|
||||
String get _path {
|
||||
switch (_wallet.type) {
|
||||
switch (_appStore.wallet!.type) {
|
||||
case WalletType.monero:
|
||||
return 'monero_wallet:';
|
||||
case WalletType.bitcoin:
|
||||
@@ -85,7 +99,7 @@ abstract class WalletKeysViewModelBase with Store {
|
||||
case WalletType.haven:
|
||||
return 'haven_wallet:';
|
||||
default:
|
||||
throw Exception('Unexpected wallet type: ${_wallet.toString()}');
|
||||
throw Exception('Unexpected wallet type: ${_appStore.wallet!.toString()}');
|
||||
}
|
||||
}
|
||||
|
||||
@@ -103,7 +117,7 @@ abstract class WalletKeysViewModelBase with Store {
|
||||
Future<Map<String, String>> get _queryParams async {
|
||||
final restoreHeightResult = await restoreHeight;
|
||||
return {
|
||||
'seed': _wallet.seed,
|
||||
'seed': _appStore.wallet!.seed,
|
||||
if (restoreHeightResult != null) ...{'height': restoreHeightResult}
|
||||
};
|
||||
}
|
||||
|
||||
@@ -1,13 +1,13 @@
|
||||
import 'package:flutter/foundation.dart';
|
||||
import 'package:cw_core/wallet_type.dart';
|
||||
|
||||
class WalletListItem {
|
||||
const WalletListItem(
|
||||
{required this.name,
|
||||
required this.type,
|
||||
required this.key,
|
||||
this.isCurrent = false,
|
||||
this.isEnabled = true});
|
||||
const WalletListItem({
|
||||
required this.name,
|
||||
required this.type,
|
||||
required this.key,
|
||||
this.isCurrent = false,
|
||||
this.isEnabled = true,
|
||||
});
|
||||
|
||||
final String name;
|
||||
final WalletType type;
|
||||
|
||||
@@ -22,6 +22,7 @@ abstract class WalletListViewModelBase with Store {
|
||||
this._authService,
|
||||
) : wallets = ObservableList<WalletListItem>() {
|
||||
_updateList();
|
||||
reaction((_) => _appStore.wallet, (_) => _updateList());
|
||||
}
|
||||
|
||||
@observable
|
||||
|
||||
Reference in New Issue
Block a user