Merge branch 'main' into CW-506-Add-a-switch-to-enable-disable-domain-lookups
|
@ -0,0 +1,74 @@
|
|||
<?xml version="1.0" encoding="utf-8"?>
|
||||
<vector
|
||||
android:height="108dp"
|
||||
android:width="108dp"
|
||||
android:viewportHeight="108"
|
||||
android:viewportWidth="108"
|
||||
xmlns:android="http://schemas.android.com/apk/res/android">
|
||||
<path android:fillColor="#3DDC84"
|
||||
android:pathData="M0,0h108v108h-108z"/>
|
||||
<path android:fillColor="#00000000" android:pathData="M9,0L9,108"
|
||||
android:strokeColor="#33FFFFFF" android:strokeWidth="0.8"/>
|
||||
<path android:fillColor="#00000000" android:pathData="M19,0L19,108"
|
||||
android:strokeColor="#33FFFFFF" android:strokeWidth="0.8"/>
|
||||
<path android:fillColor="#00000000" android:pathData="M29,0L29,108"
|
||||
android:strokeColor="#33FFFFFF" android:strokeWidth="0.8"/>
|
||||
<path android:fillColor="#00000000" android:pathData="M39,0L39,108"
|
||||
android:strokeColor="#33FFFFFF" android:strokeWidth="0.8"/>
|
||||
<path android:fillColor="#00000000" android:pathData="M49,0L49,108"
|
||||
android:strokeColor="#33FFFFFF" android:strokeWidth="0.8"/>
|
||||
<path android:fillColor="#00000000" android:pathData="M59,0L59,108"
|
||||
android:strokeColor="#33FFFFFF" android:strokeWidth="0.8"/>
|
||||
<path android:fillColor="#00000000" android:pathData="M69,0L69,108"
|
||||
android:strokeColor="#33FFFFFF" android:strokeWidth="0.8"/>
|
||||
<path android:fillColor="#00000000" android:pathData="M79,0L79,108"
|
||||
android:strokeColor="#33FFFFFF" android:strokeWidth="0.8"/>
|
||||
<path android:fillColor="#00000000" android:pathData="M89,0L89,108"
|
||||
android:strokeColor="#33FFFFFF" android:strokeWidth="0.8"/>
|
||||
<path android:fillColor="#00000000" android:pathData="M99,0L99,108"
|
||||
android:strokeColor="#33FFFFFF" android:strokeWidth="0.8"/>
|
||||
<path android:fillColor="#00000000" android:pathData="M0,9L108,9"
|
||||
android:strokeColor="#33FFFFFF" android:strokeWidth="0.8"/>
|
||||
<path android:fillColor="#00000000" android:pathData="M0,19L108,19"
|
||||
android:strokeColor="#33FFFFFF" android:strokeWidth="0.8"/>
|
||||
<path android:fillColor="#00000000" android:pathData="M0,29L108,29"
|
||||
android:strokeColor="#33FFFFFF" android:strokeWidth="0.8"/>
|
||||
<path android:fillColor="#00000000" android:pathData="M0,39L108,39"
|
||||
android:strokeColor="#33FFFFFF" android:strokeWidth="0.8"/>
|
||||
<path android:fillColor="#00000000" android:pathData="M0,49L108,49"
|
||||
android:strokeColor="#33FFFFFF" android:strokeWidth="0.8"/>
|
||||
<path android:fillColor="#00000000" android:pathData="M0,59L108,59"
|
||||
android:strokeColor="#33FFFFFF" android:strokeWidth="0.8"/>
|
||||
<path android:fillColor="#00000000" android:pathData="M0,69L108,69"
|
||||
android:strokeColor="#33FFFFFF" android:strokeWidth="0.8"/>
|
||||
<path android:fillColor="#00000000" android:pathData="M0,79L108,79"
|
||||
android:strokeColor="#33FFFFFF" android:strokeWidth="0.8"/>
|
||||
<path android:fillColor="#00000000" android:pathData="M0,89L108,89"
|
||||
android:strokeColor="#33FFFFFF" android:strokeWidth="0.8"/>
|
||||
<path android:fillColor="#00000000" android:pathData="M0,99L108,99"
|
||||
android:strokeColor="#33FFFFFF" android:strokeWidth="0.8"/>
|
||||
<path android:fillColor="#00000000" android:pathData="M19,29L89,29"
|
||||
android:strokeColor="#33FFFFFF" android:strokeWidth="0.8"/>
|
||||
<path android:fillColor="#00000000" android:pathData="M19,39L89,39"
|
||||
android:strokeColor="#33FFFFFF" android:strokeWidth="0.8"/>
|
||||
<path android:fillColor="#00000000" android:pathData="M19,49L89,49"
|
||||
android:strokeColor="#33FFFFFF" android:strokeWidth="0.8"/>
|
||||
<path android:fillColor="#00000000" android:pathData="M19,59L89,59"
|
||||
android:strokeColor="#33FFFFFF" android:strokeWidth="0.8"/>
|
||||
<path android:fillColor="#00000000" android:pathData="M19,69L89,69"
|
||||
android:strokeColor="#33FFFFFF" android:strokeWidth="0.8"/>
|
||||
<path android:fillColor="#00000000" android:pathData="M19,79L89,79"
|
||||
android:strokeColor="#33FFFFFF" android:strokeWidth="0.8"/>
|
||||
<path android:fillColor="#00000000" android:pathData="M29,19L29,89"
|
||||
android:strokeColor="#33FFFFFF" android:strokeWidth="0.8"/>
|
||||
<path android:fillColor="#00000000" android:pathData="M39,19L39,89"
|
||||
android:strokeColor="#33FFFFFF" android:strokeWidth="0.8"/>
|
||||
<path android:fillColor="#00000000" android:pathData="M49,19L49,89"
|
||||
android:strokeColor="#33FFFFFF" android:strokeWidth="0.8"/>
|
||||
<path android:fillColor="#00000000" android:pathData="M59,19L59,89"
|
||||
android:strokeColor="#33FFFFFF" android:strokeWidth="0.8"/>
|
||||
<path android:fillColor="#00000000" android:pathData="M69,19L69,89"
|
||||
android:strokeColor="#33FFFFFF" android:strokeWidth="0.8"/>
|
||||
<path android:fillColor="#00000000" android:pathData="M79,19L79,89"
|
||||
android:strokeColor="#33FFFFFF" android:strokeWidth="0.8"/>
|
||||
</vector>
|
Before Width: | Height: | Size: 5.3 KiB After Width: | Height: | Size: 30 KiB |
|
@ -1,5 +1,5 @@
|
|||
<?xml version="1.0" encoding="utf-8"?>
|
||||
<adaptive-icon xmlns:android="http://schemas.android.com/apk/res/android">
|
||||
<background android:drawable="@mipmap/ic_launcher_adaptive_back"/>
|
||||
<foreground android:drawable="@mipmap/ic_launcher_adaptive_fore"/>
|
||||
<background android:drawable="@mipmap/ic_launcher_adaptive_back"/>
|
||||
<foreground android:drawable="@mipmap/ic_launcher_adaptive_fore"/>
|
||||
</adaptive-icon>
|
Before Width: | Height: | Size: 5.6 KiB After Width: | Height: | Size: 2.5 KiB |
Before Width: | Height: | Size: 932 B After Width: | Height: | Size: 509 B |
Before Width: | Height: | Size: 7.8 KiB After Width: | Height: | Size: 3.6 KiB |
Before Width: | Height: | Size: 3.6 KiB After Width: | Height: | Size: 1.7 KiB |
Before Width: | Height: | Size: 539 B After Width: | Height: | Size: 327 B |
Before Width: | Height: | Size: 4.2 KiB After Width: | Height: | Size: 2.2 KiB |
Before Width: | Height: | Size: 8.5 KiB After Width: | Height: | Size: 3.1 KiB |
Before Width: | Height: | Size: 1.4 KiB After Width: | Height: | Size: 677 B |
Before Width: | Height: | Size: 10 KiB After Width: | Height: | Size: 5.4 KiB |
Before Width: | Height: | Size: 14 KiB After Width: | Height: | Size: 5 KiB |
Before Width: | Height: | Size: 2.6 KiB After Width: | Height: | Size: 1,017 B |
Before Width: | Height: | Size: 19 KiB After Width: | Height: | Size: 9.2 KiB |
Before Width: | Height: | Size: 20 KiB After Width: | Height: | Size: 7.1 KiB |
Before Width: | Height: | Size: 4.2 KiB After Width: | Height: | Size: 1.7 KiB |
Before Width: | Height: | Size: 27 KiB After Width: | Height: | Size: 14 KiB |
Before Width: | Height: | Size: 96 KiB After Width: | Height: | Size: 30 KiB |
Before Width: | Height: | Size: 3.7 KiB After Width: | Height: | Size: 28 KiB |
Before Width: | Height: | Size: 21 KiB After Width: | Height: | Size: 28 KiB |
|
@ -1,5 +1,5 @@
|
|||
<?xml version="1.0" encoding="utf-8"?>
|
||||
<adaptive-icon xmlns:android="http://schemas.android.com/apk/res/android">
|
||||
<background android:drawable="@mipmap/ic_launcher_adaptive_back"/>
|
||||
<foreground android:drawable="@mipmap/ic_launcher_adaptive_fore"/>
|
||||
<background android:drawable="@mipmap/ic_launcher_adaptive_back"/>
|
||||
<foreground android:drawable="@mipmap/ic_launcher_adaptive_fore"/>
|
||||
</adaptive-icon>
|
Before Width: | Height: | Size: 5.2 KiB After Width: | Height: | Size: 2.4 KiB |
Before Width: | Height: | Size: 932 B After Width: | Height: | Size: 509 B |
Before Width: | Height: | Size: 6.8 KiB After Width: | Height: | Size: 3.5 KiB |
Before Width: | Height: | Size: 3.4 KiB After Width: | Height: | Size: 1.6 KiB |
Before Width: | Height: | Size: 539 B After Width: | Height: | Size: 327 B |
Before Width: | Height: | Size: 3.8 KiB After Width: | Height: | Size: 2.2 KiB |
Before Width: | Height: | Size: 7.9 KiB After Width: | Height: | Size: 3.3 KiB |
Before Width: | Height: | Size: 1.4 KiB After Width: | Height: | Size: 677 B |
Before Width: | Height: | Size: 8.8 KiB After Width: | Height: | Size: 5 KiB |
Before Width: | Height: | Size: 12 KiB After Width: | Height: | Size: 5 KiB |
Before Width: | Height: | Size: 2.6 KiB After Width: | Height: | Size: 1,017 B |
Before Width: | Height: | Size: 16 KiB After Width: | Height: | Size: 8.5 KiB |
Before Width: | Height: | Size: 18 KiB After Width: | Height: | Size: 6.9 KiB |
Before Width: | Height: | Size: 4.2 KiB After Width: | Height: | Size: 1.7 KiB |
Before Width: | Height: | Size: 21 KiB After Width: | Height: | Size: 12 KiB |
|
@ -1 +1 @@
|
|||
C:/Users/borod/AppData/Local/Pub/Cache/hosted/pub.dev/path_provider_linux-2.2.0/
|
||||
/Users/blazebrain/.pub-cache/hosted/pub.dev/path_provider_linux-2.2.1/
|
|
@ -36,4 +36,6 @@ abstract class WalletAddresses {
|
|||
print(e.toString());
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
bool containsAddress(String address) => addressesMap.containsKey(address);
|
||||
}
|
||||
|
|
|
@ -63,14 +63,14 @@ abstract class HavenWalletAddressesBase extends WalletAddressesWithAccount<Accou
|
|||
|
||||
bool validate() {
|
||||
accountList.update();
|
||||
final accountListLength = accountList.accounts.length ?? 0;
|
||||
final accountListLength = accountList.accounts.length;
|
||||
|
||||
if (accountListLength <= 0) {
|
||||
return false;
|
||||
}
|
||||
|
||||
subaddressList.update(accountIndex: accountList.accounts.first.id);
|
||||
final subaddressListLength = subaddressList.subaddresses.length ?? 0;
|
||||
final subaddressListLength = subaddressList.subaddresses.length;
|
||||
|
||||
if (subaddressListLength <= 0) {
|
||||
return false;
|
||||
|
@ -84,4 +84,8 @@ abstract class HavenWalletAddressesBase extends WalletAddressesWithAccount<Accou
|
|||
subaddress = subaddressList.subaddresses.first;
|
||||
address = subaddress!.address;
|
||||
}
|
||||
}
|
||||
|
||||
@override
|
||||
bool containsAddress(String address) =>
|
||||
addressInfos[account?.id ?? 0]?.any((it) => it.address == address) ?? false;
|
||||
}
|
||||
|
|
|
@ -57,9 +57,7 @@ abstract class MoneroWalletBase
|
|||
walletAddresses = MoneroWalletAddresses(walletInfo, transactionHistory);
|
||||
|
||||
_onAccountChangeReaction = reaction((_) => walletAddresses.account, (Account? account) {
|
||||
if (account == null) {
|
||||
return;
|
||||
}
|
||||
if (account == null) return;
|
||||
|
||||
balance = ObservableMap<CryptoCurrency, MoneroBalance>.of(<CryptoCurrency, MoneroBalance>{
|
||||
currency: MoneroBalance(
|
||||
|
@ -67,6 +65,7 @@ abstract class MoneroWalletBase
|
|||
unlockedBalance: monero_wallet.getUnlockedBalance(accountIndex: account.id))
|
||||
});
|
||||
_updateSubAddress(isEnabledAutoGenerateSubaddress, account: account);
|
||||
_askForUpdateTransactionHistory();
|
||||
});
|
||||
|
||||
reaction((_) => isEnabledAutoGenerateSubaddress, (bool enabled) {
|
||||
|
@ -362,9 +361,7 @@ abstract class MoneroWalletBase
|
|||
}
|
||||
|
||||
@override
|
||||
Future<void> changePassword(String password) async {
|
||||
monero_wallet.setPasswordSync(password);
|
||||
}
|
||||
Future<void> changePassword(String password) async => monero_wallet.setPasswordSync(password);
|
||||
|
||||
Future<int> getNodeHeight() async => monero_wallet.getNodeHeight();
|
||||
|
||||
|
@ -499,9 +496,8 @@ abstract class MoneroWalletBase
|
|||
}
|
||||
}
|
||||
|
||||
String getSubaddressLabel(int accountIndex, int addressIndex) {
|
||||
return monero_wallet.getSubaddressLabel(accountIndex, addressIndex);
|
||||
}
|
||||
String getSubaddressLabel(int accountIndex, int addressIndex) =>
|
||||
monero_wallet.getSubaddressLabel(accountIndex, addressIndex);
|
||||
|
||||
List<MoneroTransactionInfo> _getAllTransactionsOfAccount(int? accountIndex) => transaction_history
|
||||
.getAllTransactions()
|
||||
|
|
|
@ -1,11 +1,11 @@
|
|||
import 'package:cw_core/account.dart';
|
||||
import 'package:cw_core/address_info.dart';
|
||||
import 'package:cw_core/subaddress.dart';
|
||||
import 'package:cw_core/wallet_addresses.dart';
|
||||
import 'package:cw_core/wallet_info.dart';
|
||||
import 'package:cw_core/account.dart';
|
||||
import 'package:cw_monero/api/wallet.dart';
|
||||
import 'package:cw_monero/monero_account_list.dart';
|
||||
import 'package:cw_monero/monero_subaddress_list.dart';
|
||||
import 'package:cw_core/subaddress.dart';
|
||||
import 'package:cw_monero/monero_transaction_history.dart';
|
||||
import 'package:mobx/mobx.dart';
|
||||
|
||||
|
@ -112,4 +112,8 @@ abstract class MoneroWalletAddressesBase extends WalletAddresses with Store {
|
|||
subaddress = subaddressList.subaddresses.last;
|
||||
address = subaddress!.address;
|
||||
}
|
||||
|
||||
@override
|
||||
bool containsAddress(String address) =>
|
||||
addressInfos[account?.id ?? 0]?.any((it) => it.address == address) ?? false;
|
||||
}
|
||||
|
|
|
@ -115,6 +115,9 @@ PODS:
|
|||
- Flutter
|
||||
- flutter_secure_storage (6.0.0):
|
||||
- Flutter
|
||||
- fluttertoast (0.0.2):
|
||||
- Flutter
|
||||
- Toast
|
||||
- in_app_review (0.2.0):
|
||||
- Flutter
|
||||
- local_auth_ios (0.0.1):
|
||||
|
@ -143,6 +146,7 @@ PODS:
|
|||
- FlutterMacOS
|
||||
- SwiftProtobuf (1.22.0)
|
||||
- SwiftyGif (5.4.4)
|
||||
- Toast (4.0.0)
|
||||
- uni_links (0.0.1):
|
||||
- Flutter
|
||||
- UnstoppableDomainsResolution (4.0.0):
|
||||
|
@ -171,6 +175,7 @@ DEPENDENCIES:
|
|||
- flutter_inappwebview (from `.symlinks/plugins/flutter_inappwebview/ios`)
|
||||
- flutter_mailer (from `.symlinks/plugins/flutter_mailer/ios`)
|
||||
- flutter_secure_storage (from `.symlinks/plugins/flutter_secure_storage/ios`)
|
||||
- fluttertoast (from `.symlinks/plugins/fluttertoast/ios`)
|
||||
- in_app_review (from `.symlinks/plugins/in_app_review/ios`)
|
||||
- local_auth_ios (from `.symlinks/plugins/local_auth_ios/ios`)
|
||||
- package_info (from `.symlinks/plugins/package_info/ios`)
|
||||
|
@ -198,6 +203,7 @@ SPEC REPOS:
|
|||
- SDWebImage
|
||||
- SwiftProtobuf
|
||||
- SwiftyGif
|
||||
- Toast
|
||||
- UnstoppableDomainsResolution
|
||||
|
||||
EXTERNAL SOURCES:
|
||||
|
@ -229,6 +235,8 @@ EXTERNAL SOURCES:
|
|||
:path: ".symlinks/plugins/flutter_mailer/ios"
|
||||
flutter_secure_storage:
|
||||
:path: ".symlinks/plugins/flutter_secure_storage/ios"
|
||||
fluttertoast:
|
||||
:path: ".symlinks/plugins/fluttertoast/ios"
|
||||
in_app_review:
|
||||
:path: ".symlinks/plugins/in_app_review/ios"
|
||||
local_auth_ios:
|
||||
|
@ -275,6 +283,7 @@ SPEC CHECKSUMS:
|
|||
flutter_inappwebview: 3d32228f1304635e7c028b0d4252937730bbc6cf
|
||||
flutter_mailer: 2ef5a67087bc8c6c4cefd04a178bf1ae2c94cd83
|
||||
flutter_secure_storage: 23fc622d89d073675f2eaa109381aefbcf5a49be
|
||||
fluttertoast: fafc4fa4d01a6a9e4f772ecd190ffa525e9e2d9c
|
||||
in_app_review: 318597b3a06c22bb46dc454d56828c85f444f99d
|
||||
local_auth_ios: c6cf091ded637a88f24f86a8875d8b0f526e2605
|
||||
MTBBarcodeScanner: f453b33c4b7dfe545d8c6484ed744d55671788cb
|
||||
|
@ -290,6 +299,7 @@ SPEC CHECKSUMS:
|
|||
shared_preferences_foundation: 5b919d13b803cadd15ed2dc053125c68730e5126
|
||||
SwiftProtobuf: 40bd808372cb8706108f22d28f8ab4a6b9bc6989
|
||||
SwiftyGif: 93a1cc87bf3a51916001cf8f3d63835fb64c819f
|
||||
Toast: 91b396c56ee72a5790816f40d3a94dd357abc196
|
||||
uni_links: d97da20c7701486ba192624d99bffaaffcfc298a
|
||||
UnstoppableDomainsResolution: c3c67f4d0a5e2437cb00d4bd50c2e00d6e743841
|
||||
url_launcher_ios: 08a3dfac5fb39e8759aeb0abbd5d9480f30fc8b4
|
||||
|
|
|
@ -6,7 +6,7 @@ import 'package:cake_wallet/core/wallet_connect/eth_transaction_model.dart';
|
|||
import 'package:cake_wallet/core/wallet_connect/evm_chain_id.dart';
|
||||
import 'package:cake_wallet/core/wallet_connect/wc_bottom_sheet_service.dart';
|
||||
import 'package:cake_wallet/generated/i18n.dart';
|
||||
import 'package:cake_wallet/src/screens/wallet_connect/widgets/error_display_widget.dart';
|
||||
import 'package:cake_wallet/src/screens/wallet_connect/widgets/message_display_widget.dart';
|
||||
import 'package:cake_wallet/store/app_store.dart';
|
||||
import 'package:cake_wallet/core/wallet_connect/models/chain_key_model.dart';
|
||||
import 'package:cake_wallet/core/wallet_connect/models/connection_model.dart';
|
||||
|
|
|
@ -10,7 +10,7 @@ import 'package:cake_wallet/core/wallet_connect/models/auth_request_model.dart';
|
|||
import 'package:cake_wallet/core/wallet_connect/models/chain_key_model.dart';
|
||||
import 'package:cake_wallet/core/wallet_connect/models/session_request_model.dart';
|
||||
import 'package:cake_wallet/src/screens/wallet_connect/widgets/connection_request_widget.dart';
|
||||
import 'package:cake_wallet/src/screens/wallet_connect/widgets/error_display_widget.dart';
|
||||
import 'package:cake_wallet/src/screens/wallet_connect/widgets/message_display_widget.dart';
|
||||
import 'package:cake_wallet/src/screens/wallet_connect/widgets/modals/web3_request_modal.dart';
|
||||
import 'package:cake_wallet/store/app_store.dart';
|
||||
import 'package:eth_sig_util/eth_sig_util.dart';
|
||||
|
@ -200,6 +200,24 @@ abstract class Web3WalletServiceBase with Store {
|
|||
);
|
||||
}
|
||||
|
||||
@action
|
||||
Future<void> pairWithUri(Uri uri) async {
|
||||
try {
|
||||
log('Pairing with URI: $uri');
|
||||
await _web3Wallet.pair(uri: uri);
|
||||
} on WalletConnectError catch (e) {
|
||||
_bottomSheetHandler.queueBottomSheet(
|
||||
isModalDismissible: true,
|
||||
widget: BottomSheetMessageDisplayWidget(message: e.message),
|
||||
);
|
||||
} catch (e) {
|
||||
_bottomSheetHandler.queueBottomSheet(
|
||||
isModalDismissible: true,
|
||||
widget: BottomSheetMessageDisplayWidget(message: e.toString()),
|
||||
);
|
||||
}
|
||||
}
|
||||
|
||||
void _onPairingCreate(PairingEvent? args) {
|
||||
log('Pairing Create Event: $args');
|
||||
}
|
||||
|
|
|
@ -52,6 +52,7 @@ import 'package:cake_wallet/src/screens/setup_2fa/setup_2fa_enter_code_page.dart
|
|||
import 'package:cake_wallet/src/screens/support_chat/support_chat_page.dart';
|
||||
import 'package:cake_wallet/src/screens/support_other_links/support_other_links_page.dart';
|
||||
import 'package:cake_wallet/src/screens/wallet/wallet_edit_page.dart';
|
||||
import 'package:cake_wallet/src/screens/wallet_connect/wc_connections_listing_view.dart';
|
||||
import 'package:cake_wallet/themes/theme_list.dart';
|
||||
import 'package:cake_wallet/utils/device_info.dart';
|
||||
import 'package:cake_wallet/store/anonpay/anonpay_transactions_store.dart';
|
||||
|
@ -280,7 +281,7 @@ Future<void> setup({
|
|||
powNodeSource: _powNodeSource,
|
||||
isBitcoinBuyEnabled: isBitcoinBuyEnabled,
|
||||
// Enforce darkTheme on platforms other than mobile till the design for other themes is completed
|
||||
initialTheme: ResponsiveLayoutUtil.instance.isMobile && DeviceInfo.instance.isMobile
|
||||
initialTheme: responsiveLayoutUtil.shouldRenderMobileUI && DeviceInfo.instance.isMobile
|
||||
? null
|
||||
: ThemeList.darkTheme,
|
||||
);
|
||||
|
@ -1159,5 +1160,9 @@ Future<void> setup({
|
|||
return ManageNodesPage(isPow, nodeListViewModel: getIt.get<NodeListViewModel>());
|
||||
});
|
||||
|
||||
getIt.registerFactory(
|
||||
() => WalletConnectConnectionsView(web3walletService: getIt.get<Web3WalletService>()));
|
||||
|
||||
|
||||
_isSetupFinished = true;
|
||||
}
|
||||
|
|
|
@ -33,6 +33,7 @@ enum VerboseControlSettings {
|
|||
sendsToNonContacts,
|
||||
sendsToInternalWallets,
|
||||
exchangesToInternalWallets,
|
||||
exchangesToExternalWallets,
|
||||
securityAndBackupSettings,
|
||||
creatingNewWallets,
|
||||
}
|
||||
|
|
|
@ -77,6 +77,8 @@ class PreferencesKey {
|
|||
'should_require_totp_2fa_for_sends_to_internal_wallets';
|
||||
static const shouldRequireTOTP2FAForExchangesToInternalWallets =
|
||||
'should_require_totp_2fa_for_exchanges_to_internal_wallets';
|
||||
static const shouldRequireTOTP2FAForExchangesToExternalWallets =
|
||||
'should_require_totp_2fa_for_exchanges_to_external_wallets';
|
||||
static const shouldRequireTOTP2FAForAddingContacts =
|
||||
'should_require_totp_2fa_for_adding_contacts';
|
||||
static const shouldRequireTOTP2FAForCreatingNewWallets =
|
||||
|
|
|
@ -27,6 +27,7 @@ class Trade extends HiveObject {
|
|||
this.password,
|
||||
this.providerId,
|
||||
this.providerName,
|
||||
this.fromWalletAddress
|
||||
}) {
|
||||
if (provider != null) providerRaw = provider.raw;
|
||||
|
||||
|
@ -101,6 +102,9 @@ class Trade extends HiveObject {
|
|||
@HiveField(16)
|
||||
String? providerName;
|
||||
|
||||
@HiveField(17)
|
||||
String? fromWalletAddress;
|
||||
|
||||
static Trade fromMap(Map<String, Object?> map) {
|
||||
return Trade(
|
||||
id: map['id'] as String,
|
||||
|
@ -110,7 +114,9 @@ class Trade extends HiveObject {
|
|||
createdAt:
|
||||
map['date'] != null ? DateTime.fromMillisecondsSinceEpoch(map['date'] as int) : null,
|
||||
amount: map['amount'] as String,
|
||||
walletId: map['wallet_id'] as String);
|
||||
walletId: map['wallet_id'] as String,
|
||||
fromWalletAddress: map['from_wallet_address'] as String?
|
||||
);
|
||||
}
|
||||
|
||||
Map<String, dynamic> toMap() {
|
||||
|
@ -121,7 +127,8 @@ class Trade extends HiveObject {
|
|||
'output': to.serialize(),
|
||||
'date': createdAt != null ? createdAt!.millisecondsSinceEpoch : null,
|
||||
'amount': amount,
|
||||
'wallet_id': walletId
|
||||
'wallet_id': walletId,
|
||||
'from_wallet_address': fromWalletAddress
|
||||
};
|
||||
}
|
||||
|
||||
|
|
|
@ -5,6 +5,7 @@ import 'package:cake_wallet/entities/language_service.dart';
|
|||
import 'package:cake_wallet/buy/order.dart';
|
||||
import 'package:cake_wallet/locales/locale.dart';
|
||||
import 'package:cake_wallet/store/yat/yat_store.dart';
|
||||
import 'package:cake_wallet/utils/device_info.dart';
|
||||
import 'package:cake_wallet/utils/exception_handler.dart';
|
||||
import 'package:cw_core/address_info.dart';
|
||||
import 'package:cake_wallet/utils/responsive_layout_util.dart';
|
||||
|
@ -322,22 +323,20 @@ class _Home extends StatefulWidget {
|
|||
class _HomeState extends State<_Home> {
|
||||
@override
|
||||
void didChangeDependencies() {
|
||||
if (!ResponsiveLayoutUtil.instance.isMobile) {
|
||||
_setOrientation(context);
|
||||
}
|
||||
_setOrientation(context);
|
||||
|
||||
super.didChangeDependencies();
|
||||
}
|
||||
|
||||
void _setOrientation(BuildContext context) {
|
||||
final orientation = MediaQuery.of(context).orientation;
|
||||
final width = MediaQuery.of(context).size.width;
|
||||
final height = MediaQuery.of(context).size.height;
|
||||
if (orientation == Orientation.portrait && width < height) {
|
||||
SystemChrome.setPreferredOrientations(
|
||||
[DeviceOrientation.portraitUp, DeviceOrientation.portraitDown]);
|
||||
} else if (orientation == Orientation.landscape && width > height) {
|
||||
SystemChrome.setPreferredOrientations(
|
||||
[DeviceOrientation.landscapeLeft, DeviceOrientation.landscapeRight]);
|
||||
if (!DeviceInfo.instance.isDesktop) {
|
||||
if (responsiveLayoutUtil.shouldRenderMobileUI) {
|
||||
SystemChrome.setPreferredOrientations(
|
||||
[DeviceOrientation.portraitUp, DeviceOrientation.portraitDown]);
|
||||
} else {
|
||||
SystemChrome.setPreferredOrientations(
|
||||
[DeviceOrientation.landscapeLeft, DeviceOrientation.landscapeRight]);
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
|
|
|
@ -120,8 +120,6 @@ class CWMoneroWalletDetails extends MoneroWalletDetails {
|
|||
@computed
|
||||
@override
|
||||
MoneroBalance get balance {
|
||||
final moneroWallet = _wallet as MoneroWallet;
|
||||
final balance = moneroWallet.balance;
|
||||
throw Exception('Unimplemented');
|
||||
// return MoneroBalance();
|
||||
//return MoneroBalance(
|
||||
|
@ -132,14 +130,10 @@ class CWMoneroWalletDetails extends MoneroWalletDetails {
|
|||
|
||||
class CWMonero extends Monero {
|
||||
@override
|
||||
MoneroAccountList getAccountList(Object wallet) {
|
||||
return CWMoneroAccountList(wallet);
|
||||
}
|
||||
MoneroAccountList getAccountList(Object wallet) => CWMoneroAccountList(wallet);
|
||||
|
||||
@override
|
||||
MoneroSubaddressList getSubaddressList(Object wallet) {
|
||||
return CWMoneroSubaddressList(wallet);
|
||||
}
|
||||
MoneroSubaddressList getSubaddressList(Object wallet) => CWMoneroSubaddressList(wallet);
|
||||
|
||||
@override
|
||||
TransactionHistoryBase getTransactionHistory(Object wallet) {
|
||||
|
@ -148,19 +142,13 @@ class CWMonero extends Monero {
|
|||
}
|
||||
|
||||
@override
|
||||
MoneroWalletDetails getMoneroWalletDetails(Object wallet) {
|
||||
return CWMoneroWalletDetails(wallet);
|
||||
}
|
||||
MoneroWalletDetails getMoneroWalletDetails(Object wallet) => CWMoneroWalletDetails(wallet);
|
||||
|
||||
@override
|
||||
int getHeigthByDate({required DateTime date}) {
|
||||
return getMoneroHeigthByDate(date: date);
|
||||
}
|
||||
int getHeightByDate({required DateTime date}) => getMoneroHeigthByDate(date: date);
|
||||
|
||||
@override
|
||||
TransactionPriority getDefaultTransactionPriority() {
|
||||
return MoneroTransactionPriority.automatic;
|
||||
}
|
||||
TransactionPriority getDefaultTransactionPriority() => MoneroTransactionPriority.automatic;
|
||||
|
||||
@override
|
||||
TransactionPriority getMoneroTransactionPrioritySlow() => MoneroTransactionPriority.slow;
|
||||
|
@ -170,14 +158,11 @@ class CWMonero extends Monero {
|
|||
MoneroTransactionPriority.automatic;
|
||||
|
||||
@override
|
||||
TransactionPriority deserializeMoneroTransactionPriority({required int raw}) {
|
||||
return MoneroTransactionPriority.deserialize(raw: raw);
|
||||
}
|
||||
TransactionPriority deserializeMoneroTransactionPriority({required int raw}) =>
|
||||
MoneroTransactionPriority.deserialize(raw: raw);
|
||||
|
||||
@override
|
||||
List<TransactionPriority> getTransactionPriorities() {
|
||||
return MoneroTransactionPriority.all;
|
||||
}
|
||||
List<TransactionPriority> getTransactionPriorities() => MoneroTransactionPriority.all;
|
||||
|
||||
@override
|
||||
List<String> getMoneroWordList(String language) {
|
||||
|
@ -209,41 +194,37 @@ class CWMonero extends Monero {
|
|||
|
||||
@override
|
||||
WalletCredentials createMoneroRestoreWalletFromKeysCredentials(
|
||||
{required String name,
|
||||
required String spendKey,
|
||||
required String viewKey,
|
||||
required String address,
|
||||
required String password,
|
||||
required String language,
|
||||
required int height}) {
|
||||
return MoneroRestoreWalletFromKeysCredentials(
|
||||
name: name,
|
||||
spendKey: spendKey,
|
||||
viewKey: viewKey,
|
||||
address: address,
|
||||
password: password,
|
||||
language: language,
|
||||
height: height);
|
||||
}
|
||||
{required String name,
|
||||
required String spendKey,
|
||||
required String viewKey,
|
||||
required String address,
|
||||
required String password,
|
||||
required String language,
|
||||
required int height}) =>
|
||||
MoneroRestoreWalletFromKeysCredentials(
|
||||
name: name,
|
||||
spendKey: spendKey,
|
||||
viewKey: viewKey,
|
||||
address: address,
|
||||
password: password,
|
||||
language: language,
|
||||
height: height);
|
||||
|
||||
@override
|
||||
WalletCredentials createMoneroRestoreWalletFromSeedCredentials(
|
||||
{required String name,
|
||||
required String password,
|
||||
required int height,
|
||||
required String mnemonic}) {
|
||||
return MoneroRestoreWalletFromSeedCredentials(
|
||||
name: name, password: password, height: height, mnemonic: mnemonic);
|
||||
}
|
||||
{required String name,
|
||||
required String password,
|
||||
required int height,
|
||||
required String mnemonic}) =>
|
||||
MoneroRestoreWalletFromSeedCredentials(
|
||||
name: name, password: password, height: height, mnemonic: mnemonic);
|
||||
|
||||
@override
|
||||
WalletCredentials createMoneroNewWalletCredentials({
|
||||
required String name,
|
||||
required String language,
|
||||
String? password,
|
||||
}) {
|
||||
return MoneroNewWalletCredentials(name: name, password: password, language: language);
|
||||
}
|
||||
String? password}) =>
|
||||
MoneroNewWalletCredentials(name: name, password: password, language: language);
|
||||
|
||||
@override
|
||||
Map<String, String> getKeys(Object wallet) {
|
||||
|
@ -259,43 +240,37 @@ class CWMonero extends Monero {
|
|||
|
||||
@override
|
||||
Object createMoneroTransactionCreationCredentials(
|
||||
{required List<Output> outputs, required TransactionPriority priority}) {
|
||||
return MoneroTransactionCreationCredentials(
|
||||
outputs: outputs
|
||||
.map((out) => OutputInfo(
|
||||
fiatAmount: out.fiatAmount,
|
||||
cryptoAmount: out.cryptoAmount,
|
||||
address: out.address,
|
||||
note: out.note,
|
||||
sendAll: out.sendAll,
|
||||
extractedAddress: out.extractedAddress,
|
||||
isParsedAddress: out.isParsedAddress,
|
||||
formattedCryptoAmount: out.formattedCryptoAmount))
|
||||
.toList(),
|
||||
priority: priority as MoneroTransactionPriority);
|
||||
}
|
||||
{required List<Output> outputs, required TransactionPriority priority}) =>
|
||||
MoneroTransactionCreationCredentials(
|
||||
outputs: outputs
|
||||
.map((out) => OutputInfo(
|
||||
fiatAmount: out.fiatAmount,
|
||||
cryptoAmount: out.cryptoAmount,
|
||||
address: out.address,
|
||||
note: out.note,
|
||||
sendAll: out.sendAll,
|
||||
extractedAddress: out.extractedAddress,
|
||||
isParsedAddress: out.isParsedAddress,
|
||||
formattedCryptoAmount: out.formattedCryptoAmount))
|
||||
.toList(),
|
||||
priority: priority as MoneroTransactionPriority);
|
||||
|
||||
@override
|
||||
Object createMoneroTransactionCreationCredentialsRaw(
|
||||
{required List<OutputInfo> outputs, required TransactionPriority priority}) {
|
||||
return MoneroTransactionCreationCredentials(
|
||||
outputs: outputs, priority: priority as MoneroTransactionPriority);
|
||||
}
|
||||
{required List<OutputInfo> outputs, required TransactionPriority priority}) =>
|
||||
MoneroTransactionCreationCredentials(
|
||||
outputs: outputs, priority: priority as MoneroTransactionPriority);
|
||||
|
||||
@override
|
||||
String formatterMoneroAmountToString({required int amount}) {
|
||||
return moneroAmountToString(amount: amount);
|
||||
}
|
||||
String formatterMoneroAmountToString({required int amount}) =>
|
||||
moneroAmountToString(amount: amount);
|
||||
|
||||
@override
|
||||
double formatterMoneroAmountToDouble({required int amount}) {
|
||||
return moneroAmountToDouble(amount: amount);
|
||||
}
|
||||
double formatterMoneroAmountToDouble({required int amount}) =>
|
||||
moneroAmountToDouble(amount: amount);
|
||||
|
||||
@override
|
||||
int formatterMoneroParseAmount({required String amount}) {
|
||||
return moneroParseAmount(amount: amount);
|
||||
}
|
||||
int formatterMoneroParseAmount({required String amount}) => moneroParseAmount(amount: amount);
|
||||
|
||||
@override
|
||||
Account getCurrentAccount(Object wallet) {
|
||||
|
@ -312,9 +287,7 @@ class CWMonero extends Monero {
|
|||
}
|
||||
|
||||
@override
|
||||
void onStartup() {
|
||||
monero_wallet_api.onStartup();
|
||||
}
|
||||
void onStartup() => monero_wallet_api.onStartup();
|
||||
|
||||
@override
|
||||
int getTransactionInfoAccountId(TransactionInfo tx) {
|
||||
|
@ -324,9 +297,8 @@ class CWMonero extends Monero {
|
|||
|
||||
@override
|
||||
WalletService createMoneroWalletService(
|
||||
Box<WalletInfo> walletInfoSource, Box<UnspentCoinsInfo> unspentCoinSource) {
|
||||
return MoneroWalletService(walletInfoSource, unspentCoinSource);
|
||||
}
|
||||
Box<WalletInfo> walletInfoSource, Box<UnspentCoinsInfo> unspentCoinSource) =>
|
||||
MoneroWalletService(walletInfoSource, unspentCoinSource);
|
||||
|
||||
@override
|
||||
String getTransactionAddress(Object wallet, int accountIndex, int addressIndex) {
|
||||
|
|
|
@ -1,6 +1,7 @@
|
|||
import 'package:cake_wallet/anonpay/anonpay_info_base.dart';
|
||||
import 'package:cake_wallet/anonpay/anonpay_invoice_info.dart';
|
||||
import 'package:cake_wallet/core/totp_request_details.dart';
|
||||
import 'package:cake_wallet/core/wallet_connect/web3wallet_service.dart';
|
||||
import 'package:cake_wallet/entities/contact_record.dart';
|
||||
import 'package:cake_wallet/buy/order.dart';
|
||||
import 'package:cake_wallet/entities/qr_view_data.dart';
|
||||
|
@ -50,6 +51,7 @@ import 'package:cake_wallet/src/screens/support_chat/support_chat_page.dart';
|
|||
import 'package:cake_wallet/src/screens/support_other_links/support_other_links_page.dart';
|
||||
import 'package:cake_wallet/src/screens/unspent_coins/unspent_coins_details_page.dart';
|
||||
import 'package:cake_wallet/src/screens/unspent_coins/unspent_coins_list_page.dart';
|
||||
import 'package:cake_wallet/src/screens/wallet_connect/wc_connections_listing_view.dart';
|
||||
import 'package:cake_wallet/utils/payment_request.dart';
|
||||
import 'package:cake_wallet/view_model/dashboard/dashboard_view_model.dart';
|
||||
import 'package:cake_wallet/view_model/monero_account_list/account_list_item.dart';
|
||||
|
@ -599,6 +601,12 @@ Route<dynamic> createRoute(RouteSettings settings) {
|
|||
case Routes.managePowNodes:
|
||||
return MaterialPageRoute<void>(builder: (_) => getIt.get<ManageNodesPage>(param1: true));
|
||||
|
||||
case Routes.walletConnectConnectionsListing:
|
||||
return MaterialPageRoute<void>(
|
||||
builder: (_) => WalletConnectConnectionsView(
|
||||
web3walletService: getIt.get<Web3WalletService>(),
|
||||
launchUri: settings.arguments as Uri?,
|
||||
));
|
||||
default:
|
||||
return MaterialPageRoute<void>(
|
||||
builder: (_) => Scaffold(
|
||||
|
|
|
@ -99,5 +99,5 @@ class Routes {
|
|||
static const editToken = '/edit_token';
|
||||
static const manageNodes = '/manage_nodes';
|
||||
static const managePowNodes = '/manage_pow_nodes';
|
||||
|
||||
static const walletConnectConnectionsListing = '/wallet-connect-connections-listing';
|
||||
}
|
||||
|
|
|
@ -52,26 +52,23 @@ class DashboardPage extends StatelessWidget {
|
|||
@override
|
||||
Widget build(BuildContext context) {
|
||||
return Scaffold(
|
||||
body: LayoutBuilder(
|
||||
builder: (context, constraints) {
|
||||
body: Observer(
|
||||
builder: (_) {
|
||||
final dashboardPageView = _DashboardPageView(
|
||||
balancePage: balancePage,
|
||||
bottomSheetService: bottomSheetService,
|
||||
dashboardViewModel: dashboardViewModel,
|
||||
addressListViewModel: addressListViewModel,
|
||||
);
|
||||
|
||||
if (DeviceInfo.instance.isDesktop) {
|
||||
if (constraints.maxWidth > ResponsiveLayoutUtil.kDesktopMaxDashBoardWidthConstraint) {
|
||||
if (responsiveLayoutUtil.screenWidth > ResponsiveLayoutUtilBase.kDesktopMaxDashBoardWidthConstraint) {
|
||||
return getIt.get<DesktopSidebarWrapper>();
|
||||
} else {
|
||||
return _DashboardPageView(
|
||||
balancePage: balancePage,
|
||||
bottomSheetService: bottomSheetService,
|
||||
dashboardViewModel: dashboardViewModel,
|
||||
addressListViewModel: addressListViewModel,
|
||||
);
|
||||
return dashboardPageView;
|
||||
}
|
||||
} else if (ResponsiveLayoutUtil.instance.shouldRenderMobileUI()) {
|
||||
return _DashboardPageView(
|
||||
bottomSheetService: bottomSheetService,
|
||||
balancePage: balancePage,
|
||||
dashboardViewModel: dashboardViewModel,
|
||||
addressListViewModel: addressListViewModel,
|
||||
);
|
||||
} else if (responsiveLayoutUtil.shouldRenderMobileUI) {
|
||||
return dashboardPageView;
|
||||
} else {
|
||||
return getIt.get<DesktopSidebarWrapper>();
|
||||
}
|
||||
|
|
|
@ -64,7 +64,15 @@ class AddressPage extends BasePage {
|
|||
|
||||
@override
|
||||
Widget? leading(BuildContext context) {
|
||||
bool isMobileView = ResponsiveLayoutUtil.instance.isMobile;
|
||||
final _backButton = Icon(
|
||||
Icons.arrow_back_ios,
|
||||
color: titleColor(context),
|
||||
size: 16,
|
||||
);
|
||||
final _closeButton =
|
||||
currentTheme.type == ThemeType.dark ? closeButtonImageDarkTheme : closeButtonImage;
|
||||
|
||||
bool isMobileView = responsiveLayoutUtil.shouldRenderMobileUI;
|
||||
|
||||
return MergeSemantics(
|
||||
child: SizedBox(
|
||||
|
@ -79,7 +87,7 @@ class AddressPage extends BasePage {
|
|||
overlayColor: MaterialStateColor.resolveWith((states) => Colors.transparent),
|
||||
),
|
||||
onPressed: () => onClose(context),
|
||||
child: !isMobileView ? closeButton(context) : backButton(context),
|
||||
child: !isMobileView ? _closeButton : _backButton,
|
||||
),
|
||||
),
|
||||
),
|
||||
|
|
|
@ -1,17 +1,18 @@
|
|||
import 'package:auto_size_text/auto_size_text.dart';
|
||||
import 'package:cake_wallet/generated/i18n.dart';
|
||||
import 'package:cake_wallet/routes.dart';
|
||||
import 'package:cake_wallet/src/screens/dashboard/widgets/home_screen_account_widget.dart';
|
||||
import 'package:cake_wallet/src/screens/exchange_trade/information_page.dart';
|
||||
import 'package:cake_wallet/src/widgets/introducing_card.dart';
|
||||
import 'package:cake_wallet/store/settings_store.dart';
|
||||
import 'package:cake_wallet/themes/extensions/balance_page_theme.dart';
|
||||
import 'package:cake_wallet/themes/extensions/dashboard_page_theme.dart';
|
||||
import 'package:cake_wallet/themes/extensions/sync_indicator_theme.dart';
|
||||
import 'package:cake_wallet/utils/feature_flag.dart';
|
||||
import 'package:cake_wallet/utils/show_pop_up.dart';
|
||||
import 'package:flutter/material.dart';
|
||||
import 'package:cake_wallet/view_model/dashboard/dashboard_view_model.dart';
|
||||
import 'package:flutter/material.dart';
|
||||
import 'package:flutter_mobx/flutter_mobx.dart';
|
||||
import 'package:auto_size_text/auto_size_text.dart';
|
||||
import 'package:cake_wallet/src/widgets/introducing_card.dart';
|
||||
import 'package:cake_wallet/generated/i18n.dart';
|
||||
import 'package:cake_wallet/themes/extensions/dashboard_page_theme.dart';
|
||||
import 'package:cake_wallet/themes/extensions/balance_page_theme.dart';
|
||||
|
||||
class BalancePage extends StatelessWidget {
|
||||
BalancePage({required this.dashboardViewModel, required this.settingsStore});
|
||||
|
@ -28,47 +29,59 @@ class BalancePage extends StatelessWidget {
|
|||
!dashboardViewModel.balanceViewModel.isReversing,
|
||||
child: SingleChildScrollView(
|
||||
child: Column(
|
||||
crossAxisAlignment: CrossAxisAlignment.start,
|
||||
crossAxisAlignment: CrossAxisAlignment.center,
|
||||
children: [
|
||||
SizedBox(height: 56),
|
||||
Container(
|
||||
margin: const EdgeInsets.only(left: 24, bottom: 16),
|
||||
child: Observer(
|
||||
builder: (_) {
|
||||
return Row(
|
||||
children: [
|
||||
Text(
|
||||
dashboardViewModel.balanceViewModel.asset,
|
||||
style: TextStyle(
|
||||
fontSize: 24,
|
||||
fontFamily: 'Lato',
|
||||
fontWeight: FontWeight.w600,
|
||||
color:
|
||||
Theme.of(context).extension<DashboardPageTheme>()!.pageTitleTextColor,
|
||||
height: 1,
|
||||
),
|
||||
maxLines: 1,
|
||||
textAlign: TextAlign.center,
|
||||
),
|
||||
if (dashboardViewModel.balanceViewModel.isHomeScreenSettingsEnabled)
|
||||
InkWell(
|
||||
onTap: () => Navigator.pushNamed(context, Routes.homeSettings,
|
||||
arguments: dashboardViewModel.balanceViewModel),
|
||||
child: Padding(
|
||||
padding: const EdgeInsets.all(8.0),
|
||||
child: Image.asset(
|
||||
'assets/images/home_screen_settings_icon.png',
|
||||
color: Theme.of(context)
|
||||
.extension<DashboardPageTheme>()!
|
||||
.pageTitleTextColor,
|
||||
Observer(
|
||||
builder: (_) => dashboardViewModel.balanceViewModel.hasAccounts
|
||||
? HomeScreenAccountWidget(
|
||||
walletName: dashboardViewModel.name,
|
||||
accountName: dashboardViewModel.subname)
|
||||
: Column(
|
||||
children: [
|
||||
SizedBox(height: 56),
|
||||
Container(
|
||||
margin: const EdgeInsets.only(left: 24, bottom: 16),
|
||||
child: Observer(
|
||||
builder: (_) {
|
||||
return Row(
|
||||
children: [
|
||||
Text(
|
||||
dashboardViewModel.balanceViewModel.asset,
|
||||
style: TextStyle(
|
||||
fontSize: 24,
|
||||
fontFamily: 'Lato',
|
||||
fontWeight: FontWeight.w600,
|
||||
color: Theme.of(context)
|
||||
.extension<DashboardPageTheme>()!
|
||||
.pageTitleTextColor,
|
||||
height: 1,
|
||||
),
|
||||
maxLines: 1,
|
||||
textAlign: TextAlign.center,
|
||||
),
|
||||
if (dashboardViewModel
|
||||
.balanceViewModel.isHomeScreenSettingsEnabled)
|
||||
InkWell(
|
||||
onTap: () => Navigator.pushNamed(
|
||||
context, Routes.homeSettings,
|
||||
arguments: dashboardViewModel.balanceViewModel),
|
||||
child: Padding(
|
||||
padding: const EdgeInsets.all(8.0),
|
||||
child: Image.asset(
|
||||
'assets/images/home_screen_settings_icon.png',
|
||||
color: Theme.of(context)
|
||||
.extension<DashboardPageTheme>()!
|
||||
.pageTitleTextColor,
|
||||
),
|
||||
),
|
||||
),
|
||||
],
|
||||
);
|
||||
},
|
||||
),
|
||||
),
|
||||
),
|
||||
],
|
||||
);
|
||||
},
|
||||
),
|
||||
),
|
||||
],
|
||||
)),
|
||||
Observer(
|
||||
builder: (_) {
|
||||
if (dashboardViewModel.balanceViewModel.isShowCard &&
|
||||
|
|
|
@ -0,0 +1,69 @@
|
|||
import 'package:cake_wallet/di.dart';
|
||||
import 'package:cake_wallet/src/screens/monero_accounts/monero_account_list_page.dart';
|
||||
import 'package:cake_wallet/themes/extensions/dashboard_page_theme.dart';
|
||||
import 'package:cake_wallet/utils/show_pop_up.dart';
|
||||
import 'package:flutter/material.dart';
|
||||
|
||||
class HomeScreenAccountWidget extends StatelessWidget {
|
||||
HomeScreenAccountWidget({this.walletName, this.accountName});
|
||||
|
||||
final String? walletName;
|
||||
final String? accountName;
|
||||
|
||||
@override
|
||||
Widget build(BuildContext context) {
|
||||
return GestureDetector(
|
||||
onTap: () async {
|
||||
await showPopUp<void>(
|
||||
context: context,
|
||||
builder: (_) => getIt.get<MoneroAccountListPage>());
|
||||
},
|
||||
child: Container(
|
||||
height: 100.0,
|
||||
child: Row(
|
||||
mainAxisSize: MainAxisSize.min,
|
||||
mainAxisAlignment: MainAxisAlignment.center,
|
||||
crossAxisAlignment: CrossAxisAlignment.center,
|
||||
children: [
|
||||
Column(
|
||||
mainAxisAlignment: MainAxisAlignment.center,
|
||||
children: [
|
||||
Container(
|
||||
child: Text(
|
||||
walletName ?? '',
|
||||
style: TextStyle(
|
||||
fontSize: 22.0,
|
||||
fontWeight: FontWeight.bold,
|
||||
fontFamily: 'Lato',
|
||||
color: Theme.of(context).extension<DashboardPageTheme>()!.pageTitleTextColor,
|
||||
),
|
||||
),
|
||||
),
|
||||
SizedBox(
|
||||
height: 5.0,
|
||||
),
|
||||
Container(
|
||||
child: Text(
|
||||
accountName ?? '',
|
||||
style: TextStyle(
|
||||
fontSize: 14.0,
|
||||
fontWeight: FontWeight.bold,
|
||||
fontFamily: 'Lato',
|
||||
color: Theme.of(context).extension<DashboardPageTheme>()!.pageTitleTextColor,
|
||||
),
|
||||
),
|
||||
),
|
||||
],
|
||||
),
|
||||
Container(
|
||||
child: Icon(
|
||||
Icons.keyboard_arrow_down,
|
||||
color: Theme.of(context).extension<DashboardPageTheme>()!.pageTitleTextColor,
|
||||
),
|
||||
),
|
||||
],
|
||||
),
|
||||
),
|
||||
);
|
||||
}
|
||||
}
|
|
@ -34,7 +34,7 @@ class TransactionsPage extends StatelessWidget {
|
|||
onLongPressUp: () => dashboardViewModel.balanceViewModel.isReversing =
|
||||
!dashboardViewModel.balanceViewModel.isReversing,
|
||||
child: Container(
|
||||
color: ResponsiveLayoutUtil.instance.isMobile
|
||||
color: responsiveLayoutUtil.shouldRenderMobileUI
|
||||
? null
|
||||
: Theme.of(context).colorScheme.background,
|
||||
padding: EdgeInsets.only(top: 24, bottom: 24),
|
||||
|
|
|
@ -127,7 +127,7 @@ class ExchangePage extends BasePage {
|
|||
final _closeButton =
|
||||
currentTheme.type == ThemeType.dark ? closeButtonImageDarkTheme : closeButtonImage;
|
||||
|
||||
bool isMobileView = ResponsiveLayoutUtil.instance.isMobile;
|
||||
bool isMobileView = responsiveLayoutUtil.shouldRenderMobileUI;
|
||||
|
||||
return MergeSemantics(
|
||||
child: SizedBox(
|
||||
|
@ -705,7 +705,7 @@ class ExchangePage extends BasePage {
|
|||
},
|
||||
));
|
||||
|
||||
if (ResponsiveLayoutUtil.instance.isMobile) {
|
||||
if (responsiveLayoutUtil.shouldRenderMobileUI) {
|
||||
return MobileExchangeCardsSection(
|
||||
firstExchangeCard: firstExchangeCard,
|
||||
secondExchangeCard: secondExchangeCard,
|
||||
|
|
|
@ -96,7 +96,7 @@ class _WalletNameFormState extends State<WalletNameForm> {
|
|||
content: Center(
|
||||
child: ConstrainedBox(
|
||||
constraints:
|
||||
BoxConstraints(maxWidth: ResponsiveLayoutUtil.kDesktopMaxWidthConstraint),
|
||||
BoxConstraints(maxWidth: ResponsiveLayoutUtilBase.kDesktopMaxWidthConstraint),
|
||||
child: Column(
|
||||
crossAxisAlignment: CrossAxisAlignment.center,
|
||||
children: [
|
||||
|
|
|
@ -70,7 +70,7 @@ class WalletTypeFormState extends State<WalletTypeForm> {
|
|||
Widget build(BuildContext context) {
|
||||
return Center(
|
||||
child: ConstrainedBox(
|
||||
constraints: BoxConstraints(maxWidth: ResponsiveLayoutUtil.kDesktopMaxWidthConstraint),
|
||||
constraints: BoxConstraints(maxWidth: ResponsiveLayoutUtilBase.kDesktopMaxWidthConstraint),
|
||||
child: Column(
|
||||
children: [
|
||||
Padding(
|
||||
|
|
|
@ -69,7 +69,7 @@ class NodeCreateOrEditPage extends BasePage {
|
|||
@override
|
||||
Widget trailing(BuildContext context) => IconButton(
|
||||
onPressed: () async {
|
||||
await nodeCreateOrEditViewModel.scanQRCodeForNewNode();
|
||||
await nodeCreateOrEditViewModel.scanQRCodeForNewNode(context);
|
||||
},
|
||||
splashColor: Colors.transparent,
|
||||
highlightColor: Colors.transparent,
|
||||
|
|
|
@ -69,7 +69,7 @@ class PowNodeCreateOrEditPage extends BasePage {
|
|||
@override
|
||||
Widget trailing(BuildContext context) => IconButton(
|
||||
onPressed: () async {
|
||||
await nodeCreateOrEditViewModel.scanQRCodeForNewNode();
|
||||
await nodeCreateOrEditViewModel.scanQRCodeForNewNode(context);
|
||||
},
|
||||
splashColor: Colors.transparent,
|
||||
highlightColor: Colors.transparent,
|
||||
|
|
|
@ -191,7 +191,7 @@ class PinCodeState<T extends PinCodeWidget> extends State<T> {
|
|||
child: Center(
|
||||
child: ConstrainedBox(
|
||||
constraints: BoxConstraints(
|
||||
maxWidth: ResponsiveLayoutUtil.kDesktopMaxWidthConstraint,
|
||||
maxWidth: ResponsiveLayoutUtilBase.kDesktopMaxWidthConstraint,
|
||||
),
|
||||
child: Container(
|
||||
key: _gridViewKey,
|
||||
|
|
|
@ -99,7 +99,7 @@ class AnonPayInvoicePage extends BasePage {
|
|||
child: ScrollableWithBottomSection(
|
||||
contentPadding: EdgeInsets.only(bottom: 24),
|
||||
content: Container(
|
||||
decoration: ResponsiveLayoutUtil.instance.isMobile ? BoxDecoration(
|
||||
decoration: responsiveLayoutUtil.shouldRenderMobileUI ? BoxDecoration(
|
||||
borderRadius: BorderRadius.only(
|
||||
bottomLeft: Radius.circular(24), bottomRight: Radius.circular(24)),
|
||||
gradient: LinearGradient(
|
||||
|
|
|
@ -32,7 +32,7 @@ class CurrencyInputField extends StatelessWidget {
|
|||
);
|
||||
// This magic number for wider screen sets the text input focus at center of the inputfield
|
||||
final _width =
|
||||
ResponsiveLayoutUtil.instance.isMobile ? MediaQuery.of(context).size.width : 500;
|
||||
responsiveLayoutUtil.shouldRenderMobileUI ? MediaQuery.of(context).size.width : 500;
|
||||
|
||||
return Column(
|
||||
children: [
|
||||
|
|
|
@ -38,129 +38,134 @@ class QRWidget extends StatelessWidget {
|
|||
final copyImage = Image.asset('assets/images/copy_address.png',
|
||||
color: Theme.of(context).extension<QRCodeTheme>()!.qrWidgetCopyButtonColor);
|
||||
|
||||
return Column(
|
||||
mainAxisSize: MainAxisSize.min,
|
||||
mainAxisAlignment: MainAxisAlignment.center,
|
||||
crossAxisAlignment: CrossAxisAlignment.center,
|
||||
children: <Widget>[
|
||||
Column(
|
||||
children: [
|
||||
Padding(
|
||||
padding: const EdgeInsets.only(bottom: 12),
|
||||
child: Text(
|
||||
S.of(context).qr_fullscreen,
|
||||
style: TextStyle(
|
||||
fontSize: 14,
|
||||
fontWeight: FontWeight.w500,
|
||||
color: Theme.of(context).extension<DashboardPageTheme>()!.textColor),
|
||||
),
|
||||
),
|
||||
Row(
|
||||
children: <Widget>[
|
||||
Spacer(flex: 3),
|
||||
Observer(
|
||||
builder: (_) => Flexible(
|
||||
flex: 5,
|
||||
child: GestureDetector(
|
||||
onTap: () {
|
||||
BrightnessUtil.changeBrightnessForFunction(
|
||||
() async {
|
||||
await Navigator.pushNamed(context, Routes.fullscreenQR,
|
||||
arguments: QrViewData(
|
||||
data: addressListViewModel.uri.toString(),
|
||||
heroTag: heroTag,
|
||||
));
|
||||
return Center(
|
||||
child: SingleChildScrollView(
|
||||
child: Column(
|
||||
mainAxisSize: MainAxisSize.min,
|
||||
mainAxisAlignment: MainAxisAlignment.center,
|
||||
crossAxisAlignment: CrossAxisAlignment.center,
|
||||
children: <Widget>[
|
||||
Column(
|
||||
children: [
|
||||
Padding(
|
||||
padding: const EdgeInsets.only(bottom: 12),
|
||||
child: Text(
|
||||
S.of(context).qr_fullscreen,
|
||||
style: TextStyle(
|
||||
fontSize: 14,
|
||||
fontWeight: FontWeight.w500,
|
||||
color: Theme.of(context).extension<DashboardPageTheme>()!.textColor),
|
||||
),
|
||||
),
|
||||
Row(
|
||||
children: <Widget>[
|
||||
Spacer(flex: 3),
|
||||
Observer(
|
||||
builder: (_) => Flexible(
|
||||
flex: 5,
|
||||
child: GestureDetector(
|
||||
onTap: () {
|
||||
BrightnessUtil.changeBrightnessForFunction(
|
||||
() async {
|
||||
await Navigator.pushNamed(context, Routes.fullscreenQR,
|
||||
arguments: QrViewData(
|
||||
data: addressListViewModel.uri.toString(),
|
||||
heroTag: heroTag,
|
||||
));
|
||||
},
|
||||
);
|
||||
},
|
||||
);
|
||||
},
|
||||
child: Hero(
|
||||
tag: Key(heroTag ?? addressListViewModel.uri.toString()),
|
||||
child: Center(
|
||||
child: AspectRatio(
|
||||
aspectRatio: 1.0,
|
||||
child: Container(
|
||||
padding: EdgeInsets.all(5),
|
||||
decoration: BoxDecoration(
|
||||
border: Border.all(
|
||||
width: 3,
|
||||
color: Theme.of(context).extension<DashboardPageTheme>()!.textColor,
|
||||
),
|
||||
),
|
||||
child: Container(
|
||||
child: Hero(
|
||||
tag: Key(heroTag ?? addressListViewModel.uri.toString()),
|
||||
child: Center(
|
||||
child: AspectRatio(
|
||||
aspectRatio: 1.0,
|
||||
child: Container(
|
||||
padding: EdgeInsets.all(5),
|
||||
decoration: BoxDecoration(
|
||||
border: Border.all(
|
||||
width: 3,
|
||||
color:Colors.white,
|
||||
color:
|
||||
Theme.of(context).extension<DashboardPageTheme>()!.textColor,
|
||||
),
|
||||
),
|
||||
child: QrImage(data: addressListViewModel.uri.toString())),
|
||||
child: Container(
|
||||
decoration: BoxDecoration(
|
||||
border: Border.all(
|
||||
width: 3,
|
||||
color: Colors.white,
|
||||
),
|
||||
),
|
||||
child: QrImage(data: addressListViewModel.uri.toString())),
|
||||
),
|
||||
),
|
||||
),
|
||||
),
|
||||
),
|
||||
),
|
||||
),
|
||||
),
|
||||
),
|
||||
Spacer(flex: 3)
|
||||
],
|
||||
),
|
||||
],
|
||||
),
|
||||
Observer(builder: (_) {
|
||||
return Padding(
|
||||
padding: EdgeInsets.only(top: 10),
|
||||
child: Row(
|
||||
children: <Widget>[
|
||||
Expanded(
|
||||
child: Form(
|
||||
key: formKey,
|
||||
child: CurrencyInputField(
|
||||
focusNode: amountTextFieldFocusNode,
|
||||
controller: amountController,
|
||||
onTapPicker: () => _presentPicker(context),
|
||||
selectedCurrency: addressListViewModel.selectedCurrency,
|
||||
isLight: isLight,
|
||||
),
|
||||
),
|
||||
),
|
||||
],
|
||||
),
|
||||
);
|
||||
}),
|
||||
Padding(
|
||||
padding: EdgeInsets.only(top: 20, bottom: 8),
|
||||
child: Builder(
|
||||
builder: (context) => Observer(
|
||||
builder: (context) => GestureDetector(
|
||||
onTap: () {
|
||||
Clipboard.setData(ClipboardData(text: addressListViewModel.address.address));
|
||||
showBar<void>(context, S.of(context).copied_to_clipboard);
|
||||
},
|
||||
child: Row(
|
||||
mainAxisSize: MainAxisSize.max,
|
||||
crossAxisAlignment: CrossAxisAlignment.start,
|
||||
children: <Widget>[
|
||||
Expanded(
|
||||
child: Text(
|
||||
addressListViewModel.address.address,
|
||||
textAlign: TextAlign.center,
|
||||
style: TextStyle(
|
||||
fontSize: 15,
|
||||
fontWeight: FontWeight.w500,
|
||||
color: Theme.of(context).extension<DashboardPageTheme>()!.textColor),
|
||||
),
|
||||
),
|
||||
Padding(
|
||||
padding: EdgeInsets.only(left: 12),
|
||||
child: copyImage,
|
||||
)
|
||||
Spacer(flex: 3)
|
||||
],
|
||||
),
|
||||
),
|
||||
],
|
||||
),
|
||||
),
|
||||
)
|
||||
],
|
||||
Observer(builder: (_) {
|
||||
return Padding(
|
||||
padding: EdgeInsets.only(top: 10),
|
||||
child: Row(
|
||||
children: <Widget>[
|
||||
Expanded(
|
||||
child: Form(
|
||||
key: formKey,
|
||||
child: CurrencyInputField(
|
||||
focusNode: amountTextFieldFocusNode,
|
||||
controller: amountController,
|
||||
onTapPicker: () => _presentPicker(context),
|
||||
selectedCurrency: addressListViewModel.selectedCurrency,
|
||||
isLight: isLight,
|
||||
),
|
||||
),
|
||||
),
|
||||
],
|
||||
),
|
||||
);
|
||||
}),
|
||||
Padding(
|
||||
padding: EdgeInsets.only(top: 20, bottom: 8),
|
||||
child: Builder(
|
||||
builder: (context) => Observer(
|
||||
builder: (context) => GestureDetector(
|
||||
onTap: () {
|
||||
Clipboard.setData(ClipboardData(text: addressListViewModel.address.address));
|
||||
showBar<void>(context, S.of(context).copied_to_clipboard);
|
||||
},
|
||||
child: Row(
|
||||
mainAxisSize: MainAxisSize.max,
|
||||
crossAxisAlignment: CrossAxisAlignment.start,
|
||||
children: <Widget>[
|
||||
Expanded(
|
||||
child: Text(
|
||||
addressListViewModel.address.address,
|
||||
textAlign: TextAlign.center,
|
||||
style: TextStyle(
|
||||
fontSize: 15,
|
||||
fontWeight: FontWeight.w500,
|
||||
color: Theme.of(context).extension<DashboardPageTheme>()!.textColor),
|
||||
),
|
||||
),
|
||||
Padding(
|
||||
padding: EdgeInsets.only(left: 12),
|
||||
child: copyImage,
|
||||
)
|
||||
],
|
||||
),
|
||||
),
|
||||
),
|
||||
),
|
||||
)
|
||||
],
|
||||
),
|
||||
),
|
||||
);
|
||||
}
|
||||
|
||||
|
|
|
@ -42,7 +42,7 @@ class RestoreFromBackupPage extends BasePage {
|
|||
|
||||
return Center(
|
||||
child: ConstrainedBox(
|
||||
constraints: BoxConstraints(maxWidth: ResponsiveLayoutUtil.kDesktopMaxWidthConstraint),
|
||||
constraints: BoxConstraints(maxWidth: ResponsiveLayoutUtilBase.kDesktopMaxWidthConstraint),
|
||||
child: Padding(
|
||||
padding: EdgeInsets.only(bottom: 24, left: 24, right: 24),
|
||||
child: Column(children: [
|
||||
|
|
|
@ -12,6 +12,8 @@ import 'package:cake_wallet/routes.dart';
|
|||
import 'package:flutter/cupertino.dart';
|
||||
import 'package:cake_wallet/src/screens/base_page.dart';
|
||||
import 'package:cake_wallet/generated/i18n.dart';
|
||||
import 'package:permission_handler/permission_handler.dart';
|
||||
import 'package:cake_wallet/utils/permission_handler.dart';
|
||||
|
||||
class RestoreOptionsPage extends BasePage {
|
||||
RestoreOptionsPage({required this.isNewInstall});
|
||||
|
@ -29,7 +31,7 @@ class RestoreOptionsPage extends BasePage {
|
|||
Widget body(BuildContext context) {
|
||||
return Center(
|
||||
child: Container(
|
||||
width: ResponsiveLayoutUtil.kDesktopMaxWidthConstraint,
|
||||
width: ResponsiveLayoutUtilBase.kDesktopMaxWidthConstraint,
|
||||
height: double.infinity,
|
||||
padding: EdgeInsets.symmetric(vertical: 24, horizontal: 24),
|
||||
child: SingleChildScrollView(
|
||||
|
@ -55,6 +57,9 @@ class RestoreOptionsPage extends BasePage {
|
|||
padding: EdgeInsets.only(top: 24),
|
||||
child: OptionTile(
|
||||
onPressed: () async {
|
||||
bool isCameraPermissionGranted =
|
||||
await PermissionHandler.checkPermission(Permission.camera, context);
|
||||
if (!isCameraPermissionGranted) return;
|
||||
bool isPinSet = false;
|
||||
if (isNewInstall) {
|
||||
await Navigator.pushNamed(context, Routes.setupPin,
|
||||
|
|
|
@ -163,7 +163,7 @@ class WalletRestorePage extends BasePage {
|
|||
color: Theme.of(context).colorScheme.background,
|
||||
child: Center(
|
||||
child: ConstrainedBox(
|
||||
constraints: BoxConstraints(maxWidth: ResponsiveLayoutUtil.kDesktopMaxWidthConstraint),
|
||||
constraints: BoxConstraints(maxWidth: ResponsiveLayoutUtilBase.kDesktopMaxWidthConstraint),
|
||||
child: Column(
|
||||
mainAxisAlignment: MainAxisAlignment.center,
|
||||
children: [
|
||||
|
|
|
@ -1,15 +1,17 @@
|
|||
import 'dart:async';
|
||||
import 'package:cake_wallet/core/auth_service.dart';
|
||||
import 'package:cake_wallet/core/totp_request_details.dart';
|
||||
import 'package:cake_wallet/core/wallet_connect/wc_bottom_sheet_service.dart';
|
||||
import 'package:cake_wallet/generated/i18n.dart';
|
||||
import 'package:cake_wallet/utils/device_info.dart';
|
||||
import 'package:cake_wallet/utils/payment_request.dart';
|
||||
import 'package:cw_core/wallet_type.dart';
|
||||
import 'package:flutter/material.dart';
|
||||
import 'package:cake_wallet/routes.dart';
|
||||
import 'package:cake_wallet/src/screens/auth/auth_page.dart';
|
||||
import 'package:cake_wallet/store/app_store.dart';
|
||||
import 'package:cake_wallet/store/authentication_store.dart';
|
||||
import 'package:cake_wallet/entities/qr_scanner.dart';
|
||||
import 'package:fluttertoast/fluttertoast.dart';
|
||||
import 'package:uni_links/uni_links.dart';
|
||||
|
||||
import '../setup_2fa/setup_2fa_enter_code_page.dart';
|
||||
|
@ -139,8 +141,9 @@ class RootState extends State<Root> with WidgetsBindingObserver {
|
|||
}
|
||||
_reset();
|
||||
totpAuth.close(
|
||||
route: _isValidPaymentUri() ? Routes.send : null,
|
||||
arguments: PaymentRequest.fromUri(launchUri),
|
||||
route: _getRouteToGo(),
|
||||
arguments:
|
||||
isWalletConnectLink ? launchUri : PaymentRequest.fromUri(launchUri),
|
||||
);
|
||||
launchUri = null;
|
||||
},
|
||||
|
@ -151,8 +154,8 @@ class RootState extends State<Root> with WidgetsBindingObserver {
|
|||
} else {
|
||||
_reset();
|
||||
auth.close(
|
||||
route: _isValidPaymentUri() ? Routes.send : null,
|
||||
arguments: PaymentRequest.fromUri(launchUri),
|
||||
route: _getRouteToGo(),
|
||||
arguments: isWalletConnectLink ? launchUri : PaymentRequest.fromUri(launchUri),
|
||||
);
|
||||
launchUri = null;
|
||||
}
|
||||
|
@ -166,8 +169,19 @@ class RootState extends State<Root> with WidgetsBindingObserver {
|
|||
arguments: PaymentRequest.fromUri(launchUri),
|
||||
);
|
||||
launchUri = null;
|
||||
} else if (isWalletConnectLink) {
|
||||
if (widget.appStore.wallet!.type == WalletType.ethereum) {
|
||||
widget.navigatorKey.currentState?.pushNamed(
|
||||
Routes.walletConnectConnectionsListing,
|
||||
arguments: launchUri,
|
||||
);
|
||||
launchUri = null;
|
||||
} else {
|
||||
_nonETHWalletErrorToast(S.current.switchToETHWallet);
|
||||
}
|
||||
}
|
||||
|
||||
|
||||
launchUri = null;
|
||||
return WillPopScope(
|
||||
onWillPop: () async => false,
|
||||
child: widget.child,
|
||||
|
@ -187,4 +201,31 @@ class RootState extends State<Root> with WidgetsBindingObserver {
|
|||
}
|
||||
|
||||
bool _isValidPaymentUri() => launchUri?.path.isNotEmpty ?? false;
|
||||
|
||||
bool get isWalletConnectLink => launchUri?.authority == 'wc';
|
||||
|
||||
String? _getRouteToGo() {
|
||||
if (isWalletConnectLink) {
|
||||
if (widget.appStore.wallet!.type != WalletType.ethereum) {
|
||||
_nonETHWalletErrorToast(S.current.switchToETHWallet);
|
||||
return null;
|
||||
}
|
||||
return Routes.walletConnectConnectionsListing;
|
||||
} else if (_isValidPaymentUri()) {
|
||||
return Routes.send;
|
||||
} else {
|
||||
return null;
|
||||
}
|
||||
}
|
||||
|
||||
Future<void> _nonETHWalletErrorToast(String message) async {
|
||||
Fluttertoast.showToast(
|
||||
msg: message,
|
||||
toastLength: Toast.LENGTH_LONG,
|
||||
gravity: ToastGravity.SNACKBAR,
|
||||
backgroundColor: Colors.black,
|
||||
textColor: Colors.white,
|
||||
fontSize: 16.0,
|
||||
);
|
||||
}
|
||||
}
|
||||
|
|
|
@ -35,7 +35,7 @@ class PreSeedPage extends BasePage {
|
|||
alignment: Alignment.center,
|
||||
padding: EdgeInsets.all(24),
|
||||
child: ConstrainedBox(
|
||||
constraints: BoxConstraints(maxWidth: ResponsiveLayoutUtil.kDesktopMaxWidthConstraint),
|
||||
constraints: BoxConstraints(maxWidth: ResponsiveLayoutUtilBase.kDesktopMaxWidthConstraint),
|
||||
child: Column(
|
||||
mainAxisAlignment: MainAxisAlignment.spaceBetween,
|
||||
children: <Widget>[
|
||||
|
|
|
@ -93,7 +93,7 @@ class WalletSeedPage extends BasePage {
|
|||
padding: EdgeInsets.all(24),
|
||||
alignment: Alignment.center,
|
||||
child: ConstrainedBox(
|
||||
constraints: BoxConstraints(maxWidth: ResponsiveLayoutUtil.kDesktopMaxWidthConstraint),
|
||||
constraints: BoxConstraints(maxWidth: ResponsiveLayoutUtilBase.kDesktopMaxWidthConstraint),
|
||||
child: Column(
|
||||
mainAxisAlignment: MainAxisAlignment.spaceBetween,
|
||||
children: <Widget>[
|
||||
|
|
|
@ -69,7 +69,7 @@ class SendPage extends BasePage {
|
|||
final _closeButton =
|
||||
currentTheme.type == ThemeType.dark ? closeButtonImageDarkTheme : closeButtonImage;
|
||||
|
||||
bool isMobileView = ResponsiveLayoutUtil.instance.isMobile;
|
||||
bool isMobileView = responsiveLayoutUtil.shouldRenderMobileUI;
|
||||
|
||||
return MergeSemantics(
|
||||
child: SizedBox(
|
||||
|
@ -98,7 +98,7 @@ class SendPage extends BasePage {
|
|||
double _sendCardHeight(BuildContext context) {
|
||||
final double initialHeight = sendViewModel.hasCoinControl ? 500 : 465;
|
||||
|
||||
if (!ResponsiveLayoutUtil.instance.isMobile) {
|
||||
if (!responsiveLayoutUtil.shouldRenderMobileUI) {
|
||||
return initialHeight - 66;
|
||||
}
|
||||
return initialHeight;
|
||||
|
|
|
@ -122,7 +122,7 @@ class SendCardState extends State<SendCard> with AutomaticKeepAliveClientMixin<S
|
|||
),
|
||||
),
|
||||
Container(
|
||||
decoration: ResponsiveLayoutUtil.instance.isMobile
|
||||
decoration: responsiveLayoutUtil.shouldRenderMobileUI
|
||||
? BoxDecoration(
|
||||
borderRadius: BorderRadius.only(
|
||||
bottomLeft: Radius.circular(24), bottomRight: Radius.circular(24)),
|
||||
|
@ -139,9 +139,9 @@ class SendCardState extends State<SendCard> with AutomaticKeepAliveClientMixin<S
|
|||
child: Padding(
|
||||
padding: EdgeInsets.fromLTRB(
|
||||
24,
|
||||
ResponsiveLayoutUtil.instance.isMobile ? 100 : 55,
|
||||
responsiveLayoutUtil.shouldRenderMobileUI ? 100 : 55,
|
||||
24,
|
||||
ResponsiveLayoutUtil.instance.isMobile ? 32 : 0,
|
||||
responsiveLayoutUtil.shouldRenderMobileUI ? 32 : 0,
|
||||
),
|
||||
child: SingleChildScrollView(
|
||||
child: Observer(
|
||||
|
|
|
@ -87,15 +87,7 @@ class ConnectionSyncPage extends BasePage {
|
|||
),
|
||||
if (dashboardViewModel.wallet.type == WalletType.ethereum) ...[
|
||||
WalletConnectTile(
|
||||
onTap: () async {
|
||||
Navigator.of(context).push(
|
||||
MaterialPageRoute(
|
||||
builder: (context) {
|
||||
return WalletConnectConnectionsView(web3walletService: web3walletService!);
|
||||
},
|
||||
),
|
||||
);
|
||||
},
|
||||
onTap: () => Navigator.of(context).pushNamed(Routes.walletConnectConnectionsListing),
|
||||
),
|
||||
const StandardListSeparator(padding: EdgeInsets.symmetric(horizontal: 24)),
|
||||
]
|
||||
|
|
|
@ -75,7 +75,7 @@ class DisplaySettingsPage extends BasePage {
|
|||
return LanguageService.list[code]?.toLowerCase().contains(searchText) ?? false;
|
||||
},
|
||||
),
|
||||
if (ResponsiveLayoutUtil.instance.isMobile && DeviceInfo.instance.isMobile)
|
||||
if (responsiveLayoutUtil.shouldRenderMobileUI && DeviceInfo.instance.isMobile)
|
||||
SettingsThemeChoicesCell(_displaySettingsViewModel),
|
||||
],
|
||||
),
|
||||
|
|
|
@ -133,6 +133,17 @@ class _2FAControlsWidget extends StatelessWidget {
|
|||
},
|
||||
),
|
||||
StandardListSeparator(padding: EdgeInsets.symmetric(horizontal: 24)),
|
||||
Observer(
|
||||
builder: (context) {
|
||||
return SettingsSwitcherCell(
|
||||
title: S.current.require_for_exchanges_to_external_wallets,
|
||||
value: setup2FAViewModel.shouldRequireTOTP2FAForExchangesToExternalWallets,
|
||||
onValueChange: (context, value) async =>
|
||||
setup2FAViewModel.switchShouldRequireTOTP2FAForExchangesToExternalWallets(value),
|
||||
);
|
||||
},
|
||||
),
|
||||
StandardListSeparator(padding: EdgeInsets.symmetric(horizontal: 24)),
|
||||
Observer(
|
||||
builder: (context) {
|
||||
return SettingsSwitcherCell(
|
||||
|
|
|
@ -8,10 +8,12 @@ import 'package:cake_wallet/themes/extensions/cake_text_theme.dart';
|
|||
import 'package:cake_wallet/utils/device_info.dart';
|
||||
import 'package:flutter/material.dart';
|
||||
import 'package:flutter_mobx/flutter_mobx.dart';
|
||||
import 'package:permission_handler/permission_handler.dart';
|
||||
import 'package:walletconnect_flutter_v2/walletconnect_flutter_v2.dart';
|
||||
import 'package:cake_wallet/entities/qr_scanner.dart';
|
||||
import 'package:cake_wallet/src/widgets/primary_button.dart';
|
||||
import 'package:cake_wallet/utils/show_pop_up.dart';
|
||||
import 'package:cake_wallet/utils/permission_handler.dart';
|
||||
|
||||
import 'widgets/pairing_item_widget.dart';
|
||||
import 'wc_pairing_detail_page.dart';
|
||||
|
@ -19,7 +21,24 @@ import 'wc_pairing_detail_page.dart';
|
|||
class WalletConnectConnectionsView extends StatelessWidget {
|
||||
final Web3WalletService web3walletService;
|
||||
|
||||
WalletConnectConnectionsView({required this.web3walletService, Key? key}) : super(key: key);
|
||||
WalletConnectConnectionsView({required this.web3walletService, Uri? launchUri, Key? key})
|
||||
: super(key: key) {
|
||||
_triggerPairingFromDeeplink(launchUri);
|
||||
}
|
||||
|
||||
void _triggerPairingFromDeeplink(Uri? launchUri) async {
|
||||
if (launchUri == null) return;
|
||||
|
||||
final actualLinkList = launchUri.query.split("uri=");
|
||||
|
||||
final query = actualLinkList[1];
|
||||
|
||||
final uri = Uri.decodeComponent(query);
|
||||
|
||||
final uriData = Uri.parse(uri);
|
||||
|
||||
await web3walletService.pairWithUri(uriData);
|
||||
}
|
||||
|
||||
@override
|
||||
Widget build(BuildContext context) {
|
||||
|
@ -41,6 +60,9 @@ class WCPairingsWidget extends BasePage {
|
|||
final String? uri;
|
||||
|
||||
if (DeviceInfo.instance.isMobile) {
|
||||
bool isCameraPermissionGranted =
|
||||
await PermissionHandler.checkPermission(Permission.camera, context);
|
||||
if (!isCameraPermissionGranted) return;
|
||||
uri = await presentQRScanner();
|
||||
} else {
|
||||
uri = await _showEnterWalletConnectURIPopUp(context);
|
||||
|
@ -48,15 +70,9 @@ class WCPairingsWidget extends BasePage {
|
|||
|
||||
if (uri == null) return _invalidUriToast(context, S.current.nullURIError);
|
||||
|
||||
try {
|
||||
log('_onFoundUri: $uri');
|
||||
final Uri uriData = Uri.parse(uri);
|
||||
await web3Wallet.pair(uri: uriData);
|
||||
} on WalletConnectError catch (e) {
|
||||
await _invalidUriToast(context, e.message);
|
||||
} catch (e) {
|
||||
await _invalidUriToast(context, e.toString());
|
||||
}
|
||||
log('_onFoundUri: $uri');
|
||||
final Uri uriData = Uri.parse(uri);
|
||||
await web3walletService.pairWithUri(uriData);
|
||||
}
|
||||
|
||||
Future<String?> _showEnterWalletConnectURIPopUp(BuildContext context) async {
|
||||
|
|
|
@ -22,13 +22,19 @@ class BottomSheetMessageDisplayWidget extends StatelessWidget {
|
|||
),
|
||||
),
|
||||
SizedBox(height: 8),
|
||||
Text(
|
||||
message,
|
||||
style: TextStyle(
|
||||
fontSize: 14,
|
||||
fontWeight: FontWeight.normal,
|
||||
color: Colors.white,
|
||||
),
|
||||
Row(
|
||||
children: [
|
||||
Expanded(
|
||||
child: Text(
|
||||
message,
|
||||
style: TextStyle(
|
||||
fontSize: 14,
|
||||
fontWeight: FontWeight.normal,
|
||||
color: Colors.white,
|
||||
),
|
||||
),
|
||||
),
|
||||
],
|
||||
),
|
||||
],
|
||||
);
|
|
@ -275,7 +275,7 @@ class WalletListBodyState extends State<WalletListBody> {
|
|||
await hideProgressText();
|
||||
// only pop the wallets route in mobile as it will go back to dashboard page
|
||||
// in desktop platforms the navigation tree is different
|
||||
if (ResponsiveLayoutUtil.instance.shouldRenderMobileUI()) {
|
||||
if (responsiveLayoutUtil.shouldRenderMobileUI) {
|
||||
WidgetsBinding.instance.addPostFrameCallback((_) {
|
||||
Navigator.of(context).pop();
|
||||
});
|
||||
|
|
|
@ -70,7 +70,7 @@ class WelcomePage extends BasePage {
|
|||
padding: EdgeInsets.only(top: 64, bottom: 24, left: 24, right: 24),
|
||||
child: ConstrainedBox(
|
||||
constraints: BoxConstraints(
|
||||
maxWidth: ResponsiveLayoutUtil.kDesktopMaxWidthConstraint),
|
||||
maxWidth: ResponsiveLayoutUtilBase.kDesktopMaxWidthConstraint),
|
||||
child: Column(
|
||||
mainAxisAlignment: MainAxisAlignment.spaceBetween,
|
||||
children: <Widget>[
|
||||
|
|
|
@ -27,7 +27,7 @@ class AddTemplateButton extends StatelessWidget {
|
|||
child: Container(
|
||||
height: 34,
|
||||
padding: EdgeInsets.symmetric(
|
||||
horizontal: ResponsiveLayoutUtil.instance.isMobile ? 10 : 30),
|
||||
horizontal: responsiveLayoutUtil.shouldRenderMobileUI ? 10 : 30),
|
||||
alignment: Alignment.center,
|
||||
decoration: BoxDecoration(
|
||||
borderRadius: BorderRadius.all(Radius.circular(20)),
|
||||
|
|
|
@ -9,6 +9,8 @@ import 'package:cake_wallet/entities/qr_scanner.dart';
|
|||
import 'package:cake_wallet/entities/contact_base.dart';
|
||||
import 'package:cw_core/crypto_currency.dart';
|
||||
import 'package:cake_wallet/themes/extensions/send_page_theme.dart';
|
||||
import 'package:cake_wallet/utils/permission_handler.dart';
|
||||
import 'package:permission_handler/permission_handler.dart';
|
||||
|
||||
enum AddressTextFieldOption { paste, qrCode, addressBook }
|
||||
|
||||
|
@ -98,7 +100,7 @@ class AddressTextField extends StatelessWidget {
|
|||
child: SizedBox(
|
||||
width: prefixIconWidth * options.length + (spaceBetweenPrefixIcons * options.length),
|
||||
child: Row(
|
||||
mainAxisAlignment: ResponsiveLayoutUtil.instance.isMobile
|
||||
mainAxisAlignment: responsiveLayoutUtil.shouldRenderMobileUI
|
||||
? MainAxisAlignment.spaceBetween
|
||||
: MainAxisAlignment.end,
|
||||
children: [
|
||||
|
@ -188,6 +190,9 @@ class AddressTextField extends StatelessWidget {
|
|||
}
|
||||
|
||||
Future<void> _presentQRScanner(BuildContext context) async {
|
||||
bool isCameraPermissionGranted =
|
||||
await PermissionHandler.checkPermission(Permission.camera, context);
|
||||
if (!isCameraPermissionGranted) return;
|
||||
final code = await presentQRScanner();
|
||||
if (code.isEmpty) {
|
||||
return;
|
||||
|
|
|
@ -25,7 +25,7 @@ class AlertBackground extends StatelessWidget {
|
|||
Theme.of(context).extension<AlertTheme>()!.backdropColor),
|
||||
child: Center(
|
||||
child: Container(
|
||||
width: ResponsiveLayoutUtil.kDesktopMaxWidthConstraint,
|
||||
width: ResponsiveLayoutUtilBase.kDesktopMaxWidthConstraint,
|
||||
child: child,
|
||||
),
|
||||
),
|
||||
|
|
|
@ -36,16 +36,13 @@ class BlockchainHeightState extends State<BlockchainHeightWidget> {
|
|||
restoreHeightController.addListener(() {
|
||||
if (restoreHeightController.text.isNotEmpty) {
|
||||
widget.onHeightOrDateEntered?.call(true);
|
||||
}
|
||||
else {
|
||||
} else {
|
||||
widget.onHeightOrDateEntered?.call(false);
|
||||
dateController.text = '';
|
||||
}
|
||||
try {
|
||||
_changeHeight(restoreHeightController.text != null &&
|
||||
restoreHeightController.text.isNotEmpty
|
||||
? int.parse(restoreHeightController.text)
|
||||
: 0);
|
||||
_changeHeight(
|
||||
restoreHeightController.text.isNotEmpty ? int.parse(restoreHeightController.text) : 0);
|
||||
} catch (_) {
|
||||
_changeHeight(0);
|
||||
}
|
||||
|
@ -117,7 +114,7 @@ class BlockchainHeightState extends State<BlockchainHeightWidget> {
|
|||
);
|
||||
}
|
||||
|
||||
Future _selectDate(BuildContext context) async {
|
||||
Future<void> _selectDate(BuildContext context) async {
|
||||
final now = DateTime.now();
|
||||
final date = await getDate(
|
||||
context: context,
|
||||
|
@ -126,7 +123,7 @@ class BlockchainHeightState extends State<BlockchainHeightWidget> {
|
|||
lastDate: now);
|
||||
|
||||
if (date != null) {
|
||||
final height = monero!.getHeigthByDate(date: date);
|
||||
final height = monero!.getHeightByDate(date: date);
|
||||
setState(() {
|
||||
dateController.text = DateFormat('yyyy-MM-dd').format(date);
|
||||
restoreHeightController.text = '$height';
|
||||
|
|
|
@ -61,7 +61,7 @@ class CheckBoxPickerState extends State<CheckBoxPicker> {
|
|||
child: ConstrainedBox(
|
||||
constraints: BoxConstraints(
|
||||
maxHeight: MediaQuery.of(context).size.height * 0.65,
|
||||
maxWidth: ResponsiveLayoutUtil.kPopupWidth,
|
||||
maxWidth: ResponsiveLayoutUtilBase.kPopupWidth,
|
||||
),
|
||||
child: Column(
|
||||
mainAxisSize: MainAxisSize.min,
|
||||
|
|
|
@ -151,7 +151,7 @@ class _PickerState<Item> extends State<Picker<Item>> {
|
|||
child: ConstrainedBox(
|
||||
constraints: BoxConstraints(
|
||||
maxHeight: containerHeight,
|
||||
maxWidth: ResponsiveLayoutUtil.kPopupWidth,
|
||||
maxWidth: ResponsiveLayoutUtilBase.kPopupWidth,
|
||||
),
|
||||
child: Column(
|
||||
mainAxisSize: MainAxisSize.min,
|
||||
|
|
|
@ -52,7 +52,7 @@ class PickerInnerWrapperWidget extends StatelessWidget {
|
|||
itemsHeight != null && itemsHeight! <= containerHeight
|
||||
? itemsHeight!
|
||||
: containerHeight,
|
||||
maxWidth: ResponsiveLayoutUtil.kPopupWidth,
|
||||
maxWidth: ResponsiveLayoutUtilBase.kPopupWidth,
|
||||
),
|
||||
child: Column(
|
||||
children: children,
|
||||
|
@ -77,7 +77,7 @@ class PickerInnerWrapperWidget extends StatelessWidget {
|
|||
child: ConstrainedBox(
|
||||
constraints: BoxConstraints(
|
||||
maxHeight: containerHeight,
|
||||
maxWidth: ResponsiveLayoutUtil.kPopupWidth,
|
||||
maxWidth: ResponsiveLayoutUtilBase.kPopupWidth,
|
||||
),
|
||||
child: Column(
|
||||
children: children,
|
||||
|
|
|
@ -44,7 +44,7 @@ class PickerWrapperWidget extends StatelessWidget {
|
|||
mainAxisSize: MainAxisSize.min,
|
||||
children: children,
|
||||
),
|
||||
SizedBox(height: ResponsiveLayoutUtil.kPopupSpaceHeight),
|
||||
SizedBox(height: ResponsiveLayoutUtilBase.kPopupSpaceHeight),
|
||||
AlertCloseButton(bottom: closeButtonBottom),
|
||||
],
|
||||
),
|
||||
|
|
|
@ -26,7 +26,7 @@ class PrimaryButton extends StatelessWidget {
|
|||
@override
|
||||
Widget build(BuildContext context) {
|
||||
final content = ConstrainedBox(
|
||||
constraints: BoxConstraints(maxWidth: ResponsiveLayoutUtil.kDesktopMaxWidthConstraint),
|
||||
constraints: BoxConstraints(maxWidth: ResponsiveLayoutUtilBase.kDesktopMaxWidthConstraint),
|
||||
child: SizedBox(
|
||||
width: double.infinity,
|
||||
height: 52.0,
|
||||
|
@ -82,7 +82,7 @@ class LoadingPrimaryButton extends StatelessWidget {
|
|||
@override
|
||||
Widget build(BuildContext context) {
|
||||
return ConstrainedBox(
|
||||
constraints: BoxConstraints(maxWidth: ResponsiveLayoutUtil.kDesktopMaxWidthConstraint),
|
||||
constraints: BoxConstraints(maxWidth: ResponsiveLayoutUtilBase.kDesktopMaxWidthConstraint),
|
||||
child: SizedBox(
|
||||
width: double.infinity,
|
||||
height: 52.0,
|
||||
|
@ -138,7 +138,7 @@ class PrimaryIconButton extends StatelessWidget {
|
|||
@override
|
||||
Widget build(BuildContext context) {
|
||||
return ConstrainedBox(
|
||||
constraints: BoxConstraints(maxWidth: ResponsiveLayoutUtil.kDesktopMaxWidthConstraint),
|
||||
constraints: BoxConstraints(maxWidth: ResponsiveLayoutUtilBase.kDesktopMaxWidthConstraint),
|
||||
child: SizedBox(
|
||||
width: double.infinity,
|
||||
height: 52.0,
|
||||
|
@ -201,7 +201,7 @@ class PrimaryImageButton extends StatelessWidget {
|
|||
@override
|
||||
Widget build(BuildContext context) {
|
||||
return ConstrainedBox(
|
||||
constraints: BoxConstraints(maxWidth: ResponsiveLayoutUtil.kDesktopMaxWidthConstraint),
|
||||
constraints: BoxConstraints(maxWidth: ResponsiveLayoutUtilBase.kDesktopMaxWidthConstraint),
|
||||
child: SizedBox(
|
||||
width: double.infinity,
|
||||
height: 52.0,
|
||||
|
|
|
@ -1,7 +1,7 @@
|
|||
import 'package:cw_core/wallet_base.dart';
|
||||
import 'package:mobx/mobx.dart';
|
||||
import 'package:cake_wallet/exchange/exchange_provider_description.dart';
|
||||
import 'package:cake_wallet/view_model/dashboard/trade_list_item.dart';
|
||||
import 'package:cw_core/wallet_base.dart';
|
||||
import 'package:mobx/mobx.dart';
|
||||
|
||||
part'trade_filter_store.g.dart';
|
||||
|
||||
|
@ -87,29 +87,31 @@ abstract class TradeFilterStoreBase with Store {
|
|||
}
|
||||
|
||||
List<TradeListItem> filtered({required List<TradeListItem> trades, required WalletBase wallet}) {
|
||||
final _trades =
|
||||
trades.where((item) => item.trade.walletId == wallet.id).toList();
|
||||
final _trades = trades
|
||||
.where((item) => item.trade.walletId == wallet.id && isTradeInAccount(item, wallet))
|
||||
.toList();
|
||||
final needToFilter = !displayAllTrades;
|
||||
|
||||
return needToFilter
|
||||
? _trades
|
||||
.where((item) =>
|
||||
(displayXMRTO &&
|
||||
item.trade.provider == ExchangeProviderDescription.xmrto) ||
|
||||
(displaySideShift &&
|
||||
item.trade.provider == ExchangeProviderDescription.sideShift) ||
|
||||
(displayChangeNow &&
|
||||
item.trade.provider ==
|
||||
ExchangeProviderDescription.changeNow) ||
|
||||
(displayMorphToken &&
|
||||
item.trade.provider ==
|
||||
ExchangeProviderDescription.morphToken)
|
||||
||(displaySimpleSwap &&
|
||||
item.trade.provider ==
|
||||
ExchangeProviderDescription.simpleSwap)
|
||||
||(displayTrocador && item.trade.provider == ExchangeProviderDescription.trocador)
|
||||
||(displayExolix && item.trade.provider == ExchangeProviderDescription.exolix))
|
||||
.toList()
|
||||
.where((item) =>
|
||||
(displayXMRTO && item.trade.provider == ExchangeProviderDescription.xmrto) ||
|
||||
(displaySideShift &&
|
||||
item.trade.provider == ExchangeProviderDescription.sideShift) ||
|
||||
(displayChangeNow &&
|
||||
item.trade.provider == ExchangeProviderDescription.changeNow) ||
|
||||
(displayMorphToken &&
|
||||
item.trade.provider == ExchangeProviderDescription.morphToken) ||
|
||||
(displaySimpleSwap &&
|
||||
item.trade.provider == ExchangeProviderDescription.simpleSwap) ||
|
||||
(displayTrocador && item.trade.provider == ExchangeProviderDescription.trocador) ||
|
||||
(displayExolix && item.trade.provider == ExchangeProviderDescription.exolix))
|
||||
.toList()
|
||||
: _trades;
|
||||
}
|
||||
}
|
||||
|
||||
bool isTradeInAccount(TradeListItem item, WalletBase wallet) =>
|
||||
item.trade.fromWalletAddress == null
|
||||
? true
|
||||
: wallet.walletAddresses.containsAddress(item.trade.fromWalletAddress!);
|
||||
}
|
||||
|
|
|
@ -76,6 +76,7 @@ abstract class SettingsStoreBase with Store {
|
|||
required bool initialShouldRequireTOTP2FAForSendsToNonContact,
|
||||
required bool initialShouldRequireTOTP2FAForSendsToInternalWallets,
|
||||
required bool initialShouldRequireTOTP2FAForExchangesToInternalWallets,
|
||||
required bool initialShouldRequireTOTP2FAForExchangesToExternalWallets,
|
||||
required bool initialShouldRequireTOTP2FAForAddingContacts,
|
||||
required bool initialShouldRequireTOTP2FAForCreatingNewWallets,
|
||||
required bool initialShouldRequireTOTP2FAForAllSecurityAndBackupSettings,
|
||||
|
@ -124,6 +125,8 @@ abstract class SettingsStoreBase with Store {
|
|||
initialShouldRequireTOTP2FAForSendsToInternalWallets,
|
||||
shouldRequireTOTP2FAForExchangesToInternalWallets =
|
||||
initialShouldRequireTOTP2FAForExchangesToInternalWallets,
|
||||
shouldRequireTOTP2FAForExchangesToExternalWallets =
|
||||
initialShouldRequireTOTP2FAForExchangesToExternalWallets,
|
||||
shouldRequireTOTP2FAForAddingContacts = initialShouldRequireTOTP2FAForAddingContacts,
|
||||
shouldRequireTOTP2FAForCreatingNewWallets =
|
||||
initialShouldRequireTOTP2FAForCreatingNewWallets,
|
||||
|
@ -277,6 +280,12 @@ abstract class SettingsStoreBase with Store {
|
|||
PreferencesKey.shouldRequireTOTP2FAForExchangesToInternalWallets,
|
||||
requireTOTP2FAForExchangesToInternalWallets));
|
||||
|
||||
reaction(
|
||||
(_) => shouldRequireTOTP2FAForExchangesToExternalWallets,
|
||||
(bool requireTOTP2FAForExchangesToExternalWallets) => sharedPreferences.setBool(
|
||||
PreferencesKey.shouldRequireTOTP2FAForExchangesToExternalWallets,
|
||||
requireTOTP2FAForExchangesToExternalWallets));
|
||||
|
||||
reaction(
|
||||
(_) => shouldRequireTOTP2FAForAddingContacts,
|
||||
(bool requireTOTP2FAForAddingContacts) => sharedPreferences.setBool(
|
||||
|
@ -461,6 +470,9 @@ abstract class SettingsStoreBase with Store {
|
|||
@observable
|
||||
bool shouldRequireTOTP2FAForExchangesToInternalWallets;
|
||||
|
||||
@observable
|
||||
bool shouldRequireTOTP2FAForExchangesToExternalWallets;
|
||||
|
||||
@observable
|
||||
Cake2FAPresetsOptions selectedCake2FAPreset;
|
||||
|
||||
|
@ -651,6 +663,9 @@ abstract class SettingsStoreBase with Store {
|
|||
final shouldRequireTOTP2FAForExchangesToInternalWallets = sharedPreferences
|
||||
.getBool(PreferencesKey.shouldRequireTOTP2FAForExchangesToInternalWallets) ??
|
||||
false;
|
||||
final shouldRequireTOTP2FAForExchangesToExternalWallets = sharedPreferences
|
||||
.getBool(PreferencesKey.shouldRequireTOTP2FAForExchangesToExternalWallets) ??
|
||||
false;
|
||||
final shouldRequireTOTP2FAForAddingContacts =
|
||||
sharedPreferences.getBool(PreferencesKey.shouldRequireTOTP2FAForAddingContacts) ?? false;
|
||||
final shouldRequireTOTP2FAForCreatingNewWallets =
|
||||
|
@ -817,6 +832,8 @@ abstract class SettingsStoreBase with Store {
|
|||
shouldRequireTOTP2FAForSendsToInternalWallets,
|
||||
initialShouldRequireTOTP2FAForExchangesToInternalWallets:
|
||||
shouldRequireTOTP2FAForExchangesToInternalWallets,
|
||||
initialShouldRequireTOTP2FAForExchangesToExternalWallets:
|
||||
shouldRequireTOTP2FAForExchangesToExternalWallets,
|
||||
initialShouldRequireTOTP2FAForAddingContacts: shouldRequireTOTP2FAForAddingContacts,
|
||||
initialShouldRequireTOTP2FAForCreatingNewWallets: shouldRequireTOTP2FAForCreatingNewWallets,
|
||||
initialShouldRequireTOTP2FAForAllSecurityAndBackupSettings:
|
||||
|
@ -901,6 +918,9 @@ abstract class SettingsStoreBase with Store {
|
|||
shouldRequireTOTP2FAForExchangesToInternalWallets = sharedPreferences
|
||||
.getBool(PreferencesKey.shouldRequireTOTP2FAForExchangesToInternalWallets) ??
|
||||
false;
|
||||
shouldRequireTOTP2FAForExchangesToExternalWallets = sharedPreferences
|
||||
.getBool(PreferencesKey.shouldRequireTOTP2FAForExchangesToExternalWallets) ??
|
||||
false;
|
||||
shouldRequireTOTP2FAForAddingContacts =
|
||||
sharedPreferences.getBool(PreferencesKey.shouldRequireTOTP2FAForAddingContacts) ?? false;
|
||||
shouldRequireTOTP2FAForCreatingNewWallets =
|
||||
|
|
32
lib/utils/permission_handler.dart
Normal file
|
@ -0,0 +1,32 @@
|
|||
import 'package:cake_wallet/generated/i18n.dart';
|
||||
import 'package:cake_wallet/utils/show_bar.dart';
|
||||
import 'package:flutter/cupertino.dart';
|
||||
import 'package:permission_handler/permission_handler.dart';
|
||||
|
||||
class PermissionHandler {
|
||||
static Future<bool> checkPermission(Permission permission, BuildContext context) async {
|
||||
final Map<Permission, String> _permissionMessages = {
|
||||
Permission.camera: S.of(context).camera_permission_is_required,
|
||||
};
|
||||
|
||||
var status = await permission.status;
|
||||
|
||||
if (status.isDenied) {
|
||||
status = await permission.request();
|
||||
}
|
||||
|
||||
if (status.isPermanentlyDenied || status.isDenied) {
|
||||
String? message = _permissionMessages[permission];
|
||||
if (message != null) {
|
||||
showBar<void>(context, message);
|
||||
}
|
||||
return false;
|
||||
}
|
||||
|
||||
if (status.isGranted) {
|
||||
return true;
|
||||
}
|
||||
|
||||
return false;
|
||||
}
|
||||
}
|
|
@ -1,46 +1,53 @@
|
|||
import 'package:flutter/material.dart';
|
||||
import 'package:mobx/mobx.dart';
|
||||
|
||||
class ResponsiveLayoutUtil {
|
||||
part 'responsive_layout_util.g.dart';
|
||||
|
||||
class _ResponsiveLayoutUtil = ResponsiveLayoutUtilBase with _$_ResponsiveLayoutUtil;
|
||||
|
||||
abstract class ResponsiveLayoutUtilBase with Store, WidgetsBindingObserver {
|
||||
static const double _kMobileThreshold = 550;
|
||||
static const double kDesktopMaxWidthConstraint = 400;
|
||||
static const double kDesktopMaxDashBoardWidthConstraint = 900;
|
||||
static const double kPopupWidth = 400;
|
||||
static const double kPopupSpaceHeight = 100;
|
||||
|
||||
const ResponsiveLayoutUtil._();
|
||||
|
||||
static final instance = ResponsiveLayoutUtil._();
|
||||
|
||||
bool get isMobile =>
|
||||
MediaQueryData.fromWindow(WidgetsBinding.instance.window).size.shortestSide <=
|
||||
_kMobileThreshold;
|
||||
|
||||
bool shouldRenderMobileUI() {
|
||||
final mediaQuery = MediaQueryData.fromWindow(WidgetsBinding.instance.window);
|
||||
final orientation = mediaQuery.orientation;
|
||||
final width = mediaQuery.size.width;
|
||||
final height = mediaQuery.size.height;
|
||||
if (isMobile ||
|
||||
(orientation == Orientation.portrait && width < height) ||
|
||||
(orientation == Orientation.landscape && width < height)) {
|
||||
return true;
|
||||
} else {
|
||||
return false;
|
||||
}
|
||||
ResponsiveLayoutUtilBase() {
|
||||
WidgetsBinding.instance.addObserver(this);
|
||||
final initialMediaQuery = MediaQueryData.fromView(WidgetsBinding.instance!.window);
|
||||
updateDeviceInfo(initialMediaQuery);
|
||||
}
|
||||
|
||||
/// Returns dynamic size.
|
||||
///
|
||||
/// If screen size is mobile, it returns 66% ([scale]) of the [originalValue].
|
||||
double getDynamicSize(
|
||||
double originalValue, {
|
||||
double? mobileSize,
|
||||
double? scale,
|
||||
}) {
|
||||
scale ??= 2 / 3;
|
||||
mobileSize ??= originalValue * scale;
|
||||
final value = isMobile ? mobileSize : originalValue;
|
||||
@override
|
||||
void didChangeMetrics() {
|
||||
final mediaQuery = MediaQueryData.fromView(WidgetsBinding.instance!.window);
|
||||
updateDeviceInfo(mediaQuery);
|
||||
}
|
||||
|
||||
return value.roundToDouble();
|
||||
@observable
|
||||
double screenWidth = 0.0;
|
||||
|
||||
@observable
|
||||
double screenHeight = 0.0;
|
||||
|
||||
@observable
|
||||
Orientation orientation = Orientation.portrait;
|
||||
|
||||
@action
|
||||
void updateDeviceInfo(MediaQueryData mediaQuery) {
|
||||
orientation = mediaQuery.orientation;
|
||||
screenWidth = mediaQuery.size.width;
|
||||
screenHeight = mediaQuery.size.height;
|
||||
}
|
||||
|
||||
@computed
|
||||
bool get shouldRenderMobileUI {
|
||||
return (screenWidth <= _kMobileThreshold) ||
|
||||
(orientation == Orientation.portrait && screenWidth < screenHeight) ||
|
||||
(orientation == Orientation.landscape && screenWidth < screenHeight);
|
||||
}
|
||||
}
|
||||
|
||||
_ResponsiveLayoutUtil _singletonResponsiveLayoutUtil = _ResponsiveLayoutUtil();
|
||||
|
||||
_ResponsiveLayoutUtil get responsiveLayoutUtil => _singletonResponsiveLayoutUtil;
|
||||
|
|
|
@ -83,6 +83,9 @@ abstract class BalanceViewModelBase with Store {
|
|||
@computed
|
||||
bool get isHomeScreenSettingsEnabled => wallet.type == WalletType.ethereum;
|
||||
|
||||
@computed
|
||||
bool get hasAccounts => wallet.type == WalletType.monero;
|
||||
|
||||
@computed
|
||||
SortBalanceBy get sortBalanceBy => settingsStore.sortBalanceBy;
|
||||
|
||||
|
|
|
@ -1,36 +1,36 @@
|
|||
import 'package:cake_wallet/entities/auto_generate_subaddress_status.dart';
|
||||
import 'package:cake_wallet/entities/balance_display_mode.dart';
|
||||
import 'package:cake_wallet/entities/buy_provider_types.dart';
|
||||
import 'package:cake_wallet/entities/exchange_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/view_model/settings/sync_mode.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/entities/balance_display_mode.dart';
|
||||
import 'package:cw_core/transaction_info.dart';
|
||||
import 'package:cake_wallet/exchange/exchange_provider_description.dart';
|
||||
import 'package:cake_wallet/store/settings_store.dart';
|
||||
import 'package:cake_wallet/generated/i18n.dart';
|
||||
import 'package:cake_wallet/monero/monero.dart';
|
||||
import 'package:cake_wallet/store/anonpay/anonpay_transactions_store.dart';
|
||||
import 'package:cake_wallet/store/app_store.dart';
|
||||
import 'package:cake_wallet/store/dashboard/orders_store.dart';
|
||||
import 'package:cake_wallet/store/dashboard/trade_filter_store.dart';
|
||||
import 'package:cake_wallet/store/dashboard/trades_store.dart';
|
||||
import 'package:cake_wallet/store/dashboard/transaction_filter_store.dart';
|
||||
import 'package:cake_wallet/store/settings_store.dart';
|
||||
import 'package:cake_wallet/store/yat/yat_store.dart';
|
||||
import 'package:cake_wallet/utils/mobx.dart';
|
||||
import 'package:cake_wallet/view_model/dashboard/action_list_item.dart';
|
||||
import 'package:cake_wallet/view_model/dashboard/anonpay_transaction_list_item.dart';
|
||||
import 'package:cake_wallet/view_model/dashboard/balance_view_model.dart';
|
||||
import 'package:cake_wallet/view_model/dashboard/filter_item.dart';
|
||||
import 'package:cake_wallet/view_model/dashboard/formatted_item_list.dart';
|
||||
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:mobx/mobx.dart';
|
||||
import 'package:cw_core/wallet_base.dart';
|
||||
import 'package:cake_wallet/view_model/settings/sync_mode.dart';
|
||||
import 'package:cake_wallet/wallet_type_utils.dart';
|
||||
import 'package:cw_core/balance.dart';
|
||||
import 'package:cw_core/sync_status.dart';
|
||||
import 'package:cw_core/transaction_history.dart';
|
||||
import 'package:cw_core/transaction_info.dart';
|
||||
import 'package:cw_core/wallet_base.dart';
|
||||
import 'package:cw_core/wallet_type.dart';
|
||||
import 'package:cake_wallet/store/app_store.dart';
|
||||
import 'package:cake_wallet/generated/i18n.dart';
|
||||
import 'package:cake_wallet/store/dashboard/trades_store.dart';
|
||||
import 'package:cake_wallet/store/dashboard/trade_filter_store.dart';
|
||||
import 'package:cake_wallet/store/dashboard/transaction_filter_store.dart';
|
||||
import 'package:cake_wallet/view_model/dashboard/formatted_item_list.dart';
|
||||
import 'package:cake_wallet/monero/monero.dart';
|
||||
import 'package:mobx/mobx.dart';
|
||||
|
||||
part 'dashboard_view_model.g.dart';
|
||||
|
||||
|
@ -47,69 +47,69 @@ abstract class DashboardViewModelBase with Store {
|
|||
required this.yatStore,
|
||||
required this.ordersStore,
|
||||
required this.anonpayTransactionsStore})
|
||||
: hasSellAction = false,
|
||||
hasBuyAction = false,
|
||||
hasExchangeAction = false,
|
||||
isShowFirstYatIntroduction = false,
|
||||
isShowSecondYatIntroduction = false,
|
||||
isShowThirdYatIntroduction = false,
|
||||
filterItems = {
|
||||
S.current.transactions: [
|
||||
FilterItem(
|
||||
value: () => transactionFilterStore.displayAll,
|
||||
caption: S.current.all_transactions,
|
||||
onChanged: transactionFilterStore.toggleAll),
|
||||
FilterItem(
|
||||
value: () => transactionFilterStore.displayIncoming,
|
||||
caption: S.current.incoming,
|
||||
onChanged:transactionFilterStore.toggleIncoming),
|
||||
FilterItem(
|
||||
value: () => transactionFilterStore.displayOutgoing,
|
||||
caption: S.current.outgoing,
|
||||
onChanged: transactionFilterStore.toggleOutgoing),
|
||||
// FilterItem(
|
||||
// value: () => false,
|
||||
// caption: S.current.transactions_by_date,
|
||||
// onChanged: null),
|
||||
],
|
||||
S.current.trades: [
|
||||
FilterItem(
|
||||
value: () => tradeFilterStore.displayAllTrades,
|
||||
caption: S.current.all_trades,
|
||||
onChanged: () => tradeFilterStore
|
||||
.toggleDisplayExchange(ExchangeProviderDescription.all)),
|
||||
FilterItem(
|
||||
value: () => tradeFilterStore.displayChangeNow,
|
||||
caption: ExchangeProviderDescription.changeNow.title,
|
||||
onChanged: () => tradeFilterStore
|
||||
.toggleDisplayExchange(ExchangeProviderDescription.changeNow)),
|
||||
FilterItem(
|
||||
value: () => tradeFilterStore.displaySideShift,
|
||||
caption: ExchangeProviderDescription.sideShift.title,
|
||||
onChanged: () => tradeFilterStore
|
||||
.toggleDisplayExchange(ExchangeProviderDescription.sideShift)),
|
||||
FilterItem(
|
||||
value: () => tradeFilterStore.displaySimpleSwap,
|
||||
caption: ExchangeProviderDescription.simpleSwap.title,
|
||||
onChanged: () => tradeFilterStore
|
||||
.toggleDisplayExchange(ExchangeProviderDescription.simpleSwap)),
|
||||
FilterItem(
|
||||
value: () => tradeFilterStore.displayTrocador,
|
||||
caption: ExchangeProviderDescription.trocador.title,
|
||||
onChanged: () => tradeFilterStore
|
||||
.toggleDisplayExchange(ExchangeProviderDescription.trocador)),
|
||||
FilterItem(
|
||||
value: () => tradeFilterStore.displayExolix,
|
||||
caption: ExchangeProviderDescription.exolix.title,
|
||||
onChanged: () => tradeFilterStore
|
||||
.toggleDisplayExchange(ExchangeProviderDescription.exolix)),
|
||||
]
|
||||
},
|
||||
subname = '',
|
||||
name = appStore.wallet!.name,
|
||||
type = appStore.wallet!.type,
|
||||
transactions = ObservableList<TransactionListItem>(),
|
||||
wallet = appStore.wallet! {
|
||||
: hasSellAction = false,
|
||||
hasBuyAction = false,
|
||||
hasExchangeAction = false,
|
||||
isShowFirstYatIntroduction = false,
|
||||
isShowSecondYatIntroduction = false,
|
||||
isShowThirdYatIntroduction = false,
|
||||
filterItems = {
|
||||
S.current.transactions: [
|
||||
FilterItem(
|
||||
value: () => transactionFilterStore.displayAll,
|
||||
caption: S.current.all_transactions,
|
||||
onChanged: transactionFilterStore.toggleAll),
|
||||
FilterItem(
|
||||
value: () => transactionFilterStore.displayIncoming,
|
||||
caption: S.current.incoming,
|
||||
onChanged: transactionFilterStore.toggleIncoming),
|
||||
FilterItem(
|
||||
value: () => transactionFilterStore.displayOutgoing,
|
||||
caption: S.current.outgoing,
|
||||
onChanged: transactionFilterStore.toggleOutgoing),
|
||||
// FilterItem(
|
||||
// value: () => false,
|
||||
// caption: S.current.transactions_by_date,
|
||||
// onChanged: null),
|
||||
],
|
||||
S.current.trades: [
|
||||
FilterItem(
|
||||
value: () => tradeFilterStore.displayAllTrades,
|
||||
caption: S.current.all_trades,
|
||||
onChanged: () =>
|
||||
tradeFilterStore.toggleDisplayExchange(ExchangeProviderDescription.all)),
|
||||
FilterItem(
|
||||
value: () => tradeFilterStore.displayChangeNow,
|
||||
caption: ExchangeProviderDescription.changeNow.title,
|
||||
onChanged: () =>
|
||||
tradeFilterStore.toggleDisplayExchange(ExchangeProviderDescription.changeNow)),
|
||||
FilterItem(
|
||||
value: () => tradeFilterStore.displaySideShift,
|
||||
caption: ExchangeProviderDescription.sideShift.title,
|
||||
onChanged: () =>
|
||||
tradeFilterStore.toggleDisplayExchange(ExchangeProviderDescription.sideShift)),
|
||||
FilterItem(
|
||||
value: () => tradeFilterStore.displaySimpleSwap,
|
||||
caption: ExchangeProviderDescription.simpleSwap.title,
|
||||
onChanged: () =>
|
||||
tradeFilterStore.toggleDisplayExchange(ExchangeProviderDescription.simpleSwap)),
|
||||
FilterItem(
|
||||
value: () => tradeFilterStore.displayTrocador,
|
||||
caption: ExchangeProviderDescription.trocador.title,
|
||||
onChanged: () =>
|
||||
tradeFilterStore.toggleDisplayExchange(ExchangeProviderDescription.trocador)),
|
||||
FilterItem(
|
||||
value: () => tradeFilterStore.displayExolix,
|
||||
caption: ExchangeProviderDescription.exolix.title,
|
||||
onChanged: () =>
|
||||
tradeFilterStore.toggleDisplayExchange(ExchangeProviderDescription.exolix)),
|
||||
]
|
||||
},
|
||||
subname = '',
|
||||
name = appStore.wallet!.name,
|
||||
type = appStore.wallet!.type,
|
||||
transactions = ObservableList<TransactionListItem>(),
|
||||
wallet = appStore.wallet! {
|
||||
name = wallet.name;
|
||||
type = wallet.type;
|
||||
isShowFirstYatIntroduction = false;
|
||||
|
@ -222,9 +222,8 @@ abstract class DashboardViewModelBase with Store {
|
|||
BalanceDisplayMode get balanceDisplayMode => appStore.settingsStore.balanceDisplayMode;
|
||||
|
||||
@computed
|
||||
bool get shouldShowMarketPlaceInDashboard {
|
||||
return appStore.settingsStore.shouldShowMarketPlaceInDashboard;
|
||||
}
|
||||
bool get shouldShowMarketPlaceInDashboard =>
|
||||
appStore.settingsStore.shouldShowMarketPlaceInDashboard;
|
||||
|
||||
@computed
|
||||
List<TradeListItem> get trades =>
|
||||
|
|
|
@ -1,25 +1,18 @@
|
|||
import 'package:cake_wallet/entities/balance_display_mode.dart';
|
||||
import 'package:cake_wallet/exchange/trade.dart';
|
||||
import 'package:cake_wallet/store/settings_store.dart';
|
||||
import 'package:cake_wallet/view_model/dashboard/action_list_item.dart';
|
||||
import 'package:cake_wallet/entities/balance_display_mode.dart';
|
||||
|
||||
class TradeListItem extends ActionListItem {
|
||||
TradeListItem({
|
||||
required this.trade,
|
||||
required this.settingsStore});
|
||||
TradeListItem({required this.trade, required this.settingsStore});
|
||||
|
||||
final Trade trade;
|
||||
final SettingsStore settingsStore;
|
||||
|
||||
BalanceDisplayMode get displayMode => settingsStore.balanceDisplayMode;
|
||||
|
||||
String get tradeFormattedAmount {
|
||||
return trade.amount != null
|
||||
? displayMode == BalanceDisplayMode.hiddenBalance
|
||||
? '---'
|
||||
: trade.amountFormatted()
|
||||
: trade.amount;
|
||||
}
|
||||
String get tradeFormattedAmount =>
|
||||
displayMode == BalanceDisplayMode.hiddenBalance ? '---' : trade.amountFormatted();
|
||||
|
||||
@override
|
||||
DateTime get date => trade.createdAt!;
|
||||
|
|
|
@ -237,15 +237,21 @@ abstract class ExchangeViewModelBase extends WalletChangeListenerViewModel with
|
|||
bool get shouldDisplayTOTP2FAForExchangesToInternalWallet =>
|
||||
_settingsStore.shouldRequireTOTP2FAForExchangesToInternalWallets;
|
||||
|
||||
@computed
|
||||
bool get shouldDisplayTOTP2FAForExchangesToExternalWallet =>
|
||||
_settingsStore.shouldRequireTOTP2FAForExchangesToExternalWallets;
|
||||
|
||||
//* Still open to further optimize these checks
|
||||
//* It works but can be made better
|
||||
@action
|
||||
bool shouldDisplayTOTP() {
|
||||
final isInternalWallet = checkIfWalletIsAnInternalWallet(receiveAddress);
|
||||
|
||||
if (isInternalWallet) {
|
||||
return shouldDisplayTOTP2FAForExchangesToInternalWallet;
|
||||
} else {
|
||||
return shouldDisplayTOTP2FAForExchangesToExternalWallet;
|
||||
}
|
||||
return false;
|
||||
}
|
||||
|
||||
@computed
|
||||
|
@ -263,7 +269,7 @@ abstract class ExchangeViewModelBase extends WalletChangeListenerViewModel with
|
|||
(wallet.type == WalletType.bitcoin ||
|
||||
wallet.type == WalletType.litecoin ||
|
||||
wallet.type == WalletType.bitcoinCash) &&
|
||||
depositCurrency == wallet.currency;
|
||||
depositCurrency == wallet.currency;
|
||||
|
||||
bool get isMoneroWallet => wallet.type == WalletType.monero;
|
||||
|
||||
|
@ -275,14 +281,11 @@ abstract class ExchangeViewModelBase extends WalletChangeListenerViewModel with
|
|||
case WalletType.bitcoin:
|
||||
return transactionPriority == bitcoin!.getBitcoinTransactionPrioritySlow();
|
||||
case WalletType.litecoin:
|
||||
return transactionPriority ==
|
||||
bitcoin!.getLitecoinTransactionPrioritySlow();
|
||||
return transactionPriority == bitcoin!.getLitecoinTransactionPrioritySlow();
|
||||
case WalletType.ethereum:
|
||||
return transactionPriority ==
|
||||
ethereum!.getEthereumTransactionPrioritySlow();
|
||||
return transactionPriority == ethereum!.getEthereumTransactionPrioritySlow();
|
||||
case WalletType.bitcoinCash:
|
||||
return transactionPriority ==
|
||||
bitcoinCash!.getBitcoinCashTransactionPrioritySlow();
|
||||
return transactionPriority == bitcoinCash!.getBitcoinCashTransactionPrioritySlow();
|
||||
default:
|
||||
return false;
|
||||
}
|
||||
|
@ -491,6 +494,7 @@ abstract class ExchangeViewModelBase extends WalletChangeListenerViewModel with
|
|||
final trade =
|
||||
await provider.createTrade(request: request, isFixedRateMode: isFixedRateMode);
|
||||
trade.walletId = wallet.id;
|
||||
trade.fromWalletAddress = wallet.walletAddresses.address;
|
||||
tradesStore.setTrade(trade);
|
||||
await trades.add(trade);
|
||||
tradeState = TradeIsCreatedSuccessfully(trade: trade);
|
||||
|
@ -534,7 +538,9 @@ abstract class ExchangeViewModelBase extends WalletChangeListenerViewModel with
|
|||
|
||||
@action
|
||||
void calculateDepositAllAmount() {
|
||||
if (wallet.type == WalletType.bitcoin || wallet.type == WalletType.litecoin || wallet.type == WalletType.bitcoinCash) {
|
||||
if (wallet.type == WalletType.bitcoin ||
|
||||
wallet.type == WalletType.litecoin ||
|
||||
wallet.type == WalletType.bitcoinCash) {
|
||||
final availableBalance = wallet.balance[wallet.currency]!.available;
|
||||
final priority = _settingsStore.priority[wallet.type]!;
|
||||
final fee = wallet.calculateEstimatedFee(priority, null);
|
||||
|
|
|
@ -1,11 +1,14 @@
|
|||
import 'package:cake_wallet/core/execution_state.dart';
|
||||
import 'package:cake_wallet/entities/qr_scanner.dart';
|
||||
import 'package:cake_wallet/store/settings_store.dart';
|
||||
import 'package:flutter/cupertino.dart';
|
||||
import 'package:hive/hive.dart';
|
||||
import 'package:mobx/mobx.dart';
|
||||
import 'package:cw_core/node.dart';
|
||||
import 'package:cw_core/wallet_type.dart';
|
||||
import 'package:collection/collection.dart';
|
||||
import 'package:cake_wallet/utils/permission_handler.dart';
|
||||
import 'package:permission_handler/permission_handler.dart';
|
||||
|
||||
part 'node_create_or_edit_view_model.g.dart';
|
||||
|
||||
|
@ -175,8 +178,11 @@ abstract class NodeCreateOrEditViewModelBase with Store {
|
|||
void setAsCurrent(Node node) => _settingsStore.nodes[_walletType] = node;
|
||||
|
||||
@action
|
||||
Future<void> scanQRCodeForNewNode() async {
|
||||
Future<void> scanQRCodeForNewNode(BuildContext context) async {
|
||||
try {
|
||||
bool isCameraPermissionGranted =
|
||||
await PermissionHandler.checkPermission(Permission.camera, context);
|
||||
if (!isCameraPermissionGranted) return;
|
||||
String code = await presentQRScanner();
|
||||
|
||||
if (code.isEmpty) {
|
||||
|
|