mirror of
https://github.com/cake-tech/cake_wallet.git
synced 2024-12-27 14:09:50 +00:00
Merge branch 'main' of https://github.com/cake-tech/cake_wallet into CW-328-Restore-wallet-from-QRCode-and-sweep-all-funds-in-a-new-wallet
This commit is contained in:
commit
e1898e5eeb
22 changed files with 187 additions and 66 deletions
|
@ -46,8 +46,14 @@
|
||||||
<category android:name="android.intent.category.DEFAULT" />
|
<category android:name="android.intent.category.DEFAULT" />
|
||||||
<category android:name="android.intent.category.BROWSABLE" />
|
<category android:name="android.intent.category.BROWSABLE" />
|
||||||
<data android:scheme="bitcoin" />
|
<data android:scheme="bitcoin" />
|
||||||
|
<data android:scheme="bitcoin-wallet" />
|
||||||
|
<data android:scheme="bitcoin_wallet" />
|
||||||
<data android:scheme="monero" />
|
<data android:scheme="monero" />
|
||||||
|
<data android:scheme="monero-wallet" />
|
||||||
|
<data android:scheme="monero_wallet" />
|
||||||
<data android:scheme="litecoin" />
|
<data android:scheme="litecoin" />
|
||||||
|
<data android:scheme="litecoin-wallet" />
|
||||||
|
<data android:scheme="litecoin_wallet" />
|
||||||
</intent-filter>
|
</intent-filter>
|
||||||
</activity>
|
</activity>
|
||||||
<meta-data
|
<meta-data
|
||||||
|
|
BIN
assets/images/restore_qr.png
Normal file
BIN
assets/images/restore_qr.png
Normal file
Binary file not shown.
After Width: | Height: | Size: 1.1 KiB |
|
@ -1,10 +1,12 @@
|
||||||
class Account {
|
class Account {
|
||||||
Account({required this.id, required this.label});
|
Account({required this.id, required this.label, this.balance});
|
||||||
|
|
||||||
Account.fromMap(Map<String, Object> map)
|
Account.fromMap(Map<String, Object> map)
|
||||||
: this.id = map['id'] == null ? 0 : int.parse(map['id'] as String),
|
: this.id = map['id'] == null ? 0 : int.parse(map['id'] as String),
|
||||||
this.label = (map['label'] ?? '') as String;
|
this.label = (map['label'] ?? '') as String,
|
||||||
|
this.balance = (map['balance'] ?? '0.00') as String;
|
||||||
|
|
||||||
final int id;
|
final int id;
|
||||||
final String label;
|
final String label;
|
||||||
|
final String? balance;
|
||||||
}
|
}
|
|
@ -1,6 +1,8 @@
|
||||||
|
import 'package:cw_core/monero_amount_format.dart';
|
||||||
import 'package:mobx/mobx.dart';
|
import 'package:mobx/mobx.dart';
|
||||||
import 'package:cw_core/account.dart';
|
import 'package:cw_core/account.dart';
|
||||||
import 'package:cw_monero/api/account_list.dart' as account_list;
|
import 'package:cw_monero/api/account_list.dart' as account_list;
|
||||||
|
import 'package:cw_monero/api/wallet.dart' as monero_wallet;
|
||||||
|
|
||||||
part 'monero_account_list.g.dart';
|
part 'monero_account_list.g.dart';
|
||||||
|
|
||||||
|
@ -41,12 +43,16 @@ abstract class MoneroAccountListBase with Store {
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
List<Account> getAll() => account_list
|
List<Account> getAll() => account_list.getAllAccount().map((accountRow) {
|
||||||
.getAllAccount()
|
final accountIndex = accountRow.getId();
|
||||||
.map((accountRow) => Account(
|
final balance = monero_wallet.getFullBalance(accountIndex: accountIndex);
|
||||||
|
|
||||||
|
return Account(
|
||||||
id: accountRow.getId(),
|
id: accountRow.getId(),
|
||||||
label: accountRow.getLabel()))
|
label: accountRow.getLabel(),
|
||||||
.toList();
|
balance: moneroAmountToString(amount: balance),
|
||||||
|
);
|
||||||
|
}).toList();
|
||||||
|
|
||||||
Future<void> addAccount({required String label}) async {
|
Future<void> addAccount({required String label}) async {
|
||||||
await account_list.addAccount(label: label);
|
await account_list.addAccount(label: label);
|
||||||
|
@ -54,8 +60,7 @@ abstract class MoneroAccountListBase with Store {
|
||||||
}
|
}
|
||||||
|
|
||||||
Future<void> setLabelAccount({required int accountIndex, required String label}) async {
|
Future<void> setLabelAccount({required int accountIndex, required String label}) async {
|
||||||
await account_list.setLabelForAccount(
|
await account_list.setLabelForAccount(accountIndex: accountIndex, label: label);
|
||||||
accountIndex: accountIndex, label: label);
|
|
||||||
update();
|
update();
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|
|
@ -42,6 +42,26 @@
|
||||||
<string>bitcoin</string>
|
<string>bitcoin</string>
|
||||||
</array>
|
</array>
|
||||||
</dict>
|
</dict>
|
||||||
|
<dict>
|
||||||
|
<key>CFBundleTypeRole</key>
|
||||||
|
<string>Editor</string>
|
||||||
|
<key>CFBundleURLName</key>
|
||||||
|
<string>bitcoin-wallet</string>
|
||||||
|
<key>CFBundleURLSchemes</key>
|
||||||
|
<array>
|
||||||
|
<string>bitcoin-wallet</string>
|
||||||
|
</array>
|
||||||
|
</dict>
|
||||||
|
<dict>
|
||||||
|
<key>CFBundleTypeRole</key>
|
||||||
|
<string>Editor</string>
|
||||||
|
<key>CFBundleURLName</key>
|
||||||
|
<string>bitcoin_wallet</string>
|
||||||
|
<key>CFBundleURLSchemes</key>
|
||||||
|
<array>
|
||||||
|
<string>bitcoin_wallet</string>
|
||||||
|
</array>
|
||||||
|
</dict>
|
||||||
<dict>
|
<dict>
|
||||||
<key>CFBundleTypeRole</key>
|
<key>CFBundleTypeRole</key>
|
||||||
<string>Editor</string>
|
<string>Editor</string>
|
||||||
|
@ -52,6 +72,26 @@
|
||||||
<string>monero</string>
|
<string>monero</string>
|
||||||
</array>
|
</array>
|
||||||
</dict>
|
</dict>
|
||||||
|
<dict>
|
||||||
|
<key>CFBundleTypeRole</key>
|
||||||
|
<string>Editor</string>
|
||||||
|
<key>CFBundleURLName</key>
|
||||||
|
<string>monero-wallet</string>
|
||||||
|
<key>CFBundleURLSchemes</key>
|
||||||
|
<array>
|
||||||
|
<string>monero-wallet</string>
|
||||||
|
</array>
|
||||||
|
</dict>
|
||||||
|
<dict>
|
||||||
|
<key>CFBundleTypeRole</key>
|
||||||
|
<string>Editor</string>
|
||||||
|
<key>CFBundleURLName</key>
|
||||||
|
<string>monero_wallet</string>
|
||||||
|
<key>CFBundleURLSchemes</key>
|
||||||
|
<array>
|
||||||
|
<string>monero_wallet</string>
|
||||||
|
</array>
|
||||||
|
</dict>
|
||||||
<dict>
|
<dict>
|
||||||
<key>CFBundleTypeRole</key>
|
<key>CFBundleTypeRole</key>
|
||||||
<string>Editor</string>
|
<string>Editor</string>
|
||||||
|
@ -62,6 +102,26 @@
|
||||||
<string>litecoin</string>
|
<string>litecoin</string>
|
||||||
</array>
|
</array>
|
||||||
</dict>
|
</dict>
|
||||||
|
<dict>
|
||||||
|
<key>CFBundleTypeRole</key>
|
||||||
|
<string>Viewer</string>
|
||||||
|
<key>CFBundleURLName</key>
|
||||||
|
<string>litecoin-wallet</string>
|
||||||
|
<key>CFBundleURLSchemes</key>
|
||||||
|
<array>
|
||||||
|
<string>litecoin-wallet</string>
|
||||||
|
</array>
|
||||||
|
</dict>
|
||||||
|
<dict>
|
||||||
|
<key>CFBundleTypeRole</key>
|
||||||
|
<string>Viewer</string>
|
||||||
|
<key>CFBundleURLName</key>
|
||||||
|
<string>litecoin_wallet</string>
|
||||||
|
<key>CFBundleURLSchemes</key>
|
||||||
|
<array>
|
||||||
|
<string>litecoin_wallet</string>
|
||||||
|
</array>
|
||||||
|
</dict>
|
||||||
</array>
|
</array>
|
||||||
<key>CFBundleVersion</key>
|
<key>CFBundleVersion</key>
|
||||||
<string>$(CURRENT_PROJECT_VERSION)</string>
|
<string>$(CURRENT_PROJECT_VERSION)</string>
|
||||||
|
|
|
@ -10,7 +10,7 @@ class CWMoneroAccountList extends MoneroAccountList {
|
||||||
final moneroWallet = _wallet as MoneroWallet;
|
final moneroWallet = _wallet as MoneroWallet;
|
||||||
final accounts = moneroWallet.walletAddresses.accountList
|
final accounts = moneroWallet.walletAddresses.accountList
|
||||||
.accounts
|
.accounts
|
||||||
.map((acc) => Account(id: acc.id, label: acc.label))
|
.map((acc) => Account(id: acc.id, label: acc.label, balance: acc.balance))
|
||||||
.toList();
|
.toList();
|
||||||
return ObservableList<Account>.of(accounts);
|
return ObservableList<Account>.of(accounts);
|
||||||
}
|
}
|
||||||
|
@ -32,7 +32,7 @@ class CWMoneroAccountList extends MoneroAccountList {
|
||||||
final moneroWallet = wallet as MoneroWallet;
|
final moneroWallet = wallet as MoneroWallet;
|
||||||
return moneroWallet.walletAddresses.accountList
|
return moneroWallet.walletAddresses.accountList
|
||||||
.getAll()
|
.getAll()
|
||||||
.map((acc) => Account(id: acc.id, label: acc.label))
|
.map((acc) => Account(id: acc.id, label: acc.label, balance: acc.balance))
|
||||||
.toList();
|
.toList();
|
||||||
}
|
}
|
||||||
|
|
||||||
|
@ -122,7 +122,7 @@ class CWMoneroWalletDetails extends MoneroWalletDetails {
|
||||||
Account get account {
|
Account get account {
|
||||||
final moneroWallet = _wallet as MoneroWallet;
|
final moneroWallet = _wallet as MoneroWallet;
|
||||||
final acc = moneroWallet.walletAddresses.account;
|
final acc = moneroWallet.walletAddresses.account;
|
||||||
return Account(id: acc!.id, label: acc.label);
|
return Account(id: acc!.id, label: acc.label, balance: acc.balance);
|
||||||
}
|
}
|
||||||
|
|
||||||
@computed
|
@computed
|
||||||
|
@ -316,13 +316,13 @@ class CWMonero extends Monero {
|
||||||
Account getCurrentAccount(Object wallet) {
|
Account getCurrentAccount(Object wallet) {
|
||||||
final moneroWallet = wallet as MoneroWallet;
|
final moneroWallet = wallet as MoneroWallet;
|
||||||
final acc = moneroWallet.walletAddresses.account;
|
final acc = moneroWallet.walletAddresses.account;
|
||||||
return Account(id: acc!.id, label: acc.label);
|
return Account(id: acc!.id, label: acc.label, balance: acc.balance);
|
||||||
}
|
}
|
||||||
|
|
||||||
@override
|
@override
|
||||||
void setCurrentAccount(Object wallet, int id, String label) {
|
void setCurrentAccount(Object wallet, int id, String label, String? balance) {
|
||||||
final moneroWallet = wallet as MoneroWallet;
|
final moneroWallet = wallet as MoneroWallet;
|
||||||
moneroWallet.walletAddresses.account = monero_account.Account(id: id, label: label);
|
moneroWallet.walletAddresses.account = monero_account.Account(id: id, label: label, balance: balance);
|
||||||
}
|
}
|
||||||
|
|
||||||
@override
|
@override
|
||||||
|
|
|
@ -59,17 +59,16 @@ class AddressPage extends BasePage {
|
||||||
|
|
||||||
bool effectsInstalled = false;
|
bool effectsInstalled = false;
|
||||||
|
|
||||||
@override
|
|
||||||
Color get titleColor => Colors.white;
|
|
||||||
|
|
||||||
@override
|
@override
|
||||||
Widget? leading(BuildContext context) {
|
Widget? leading(BuildContext context) {
|
||||||
final _backButton = Icon(Icons.arrow_back_ios,
|
final _backButton = Icon(
|
||||||
color: titleColor,
|
Icons.arrow_back_ios,
|
||||||
|
color: Theme.of(context).accentTextTheme!.headline2!.backgroundColor!,
|
||||||
size: 16,
|
size: 16,
|
||||||
);
|
);
|
||||||
final _closeButton = currentTheme.type == ThemeType.dark
|
final _closeButton = currentTheme.type == ThemeType.dark
|
||||||
? closeButtonImageDarkTheme : closeButtonImage;
|
? closeButtonImageDarkTheme
|
||||||
|
: closeButtonImage;
|
||||||
|
|
||||||
bool isMobileView = ResponsiveLayoutUtil.instance.isMobile(context);
|
bool isMobileView = ResponsiveLayoutUtil.instance.isMobile(context);
|
||||||
|
|
||||||
|
|
|
@ -91,6 +91,9 @@ class MoneroAccountListPage extends StatelessWidget {
|
||||||
return AccountTile(
|
return AccountTile(
|
||||||
isCurrent: account.isSelected,
|
isCurrent: account.isSelected,
|
||||||
accountName: account.label,
|
accountName: account.label,
|
||||||
|
accountBalance: account.balance ?? '0.00',
|
||||||
|
currency: accountListViewModel
|
||||||
|
.currency.toString(),
|
||||||
onTap: () {
|
onTap: () {
|
||||||
if (account.isSelected) {
|
if (account.isSelected) {
|
||||||
return;
|
return;
|
||||||
|
|
|
@ -1,36 +1,42 @@
|
||||||
import 'package:flutter/material.dart';
|
import 'package:flutter/material.dart';
|
||||||
import 'package:flutter_slidable/flutter_slidable.dart';
|
|
||||||
import 'package:cake_wallet/generated/i18n.dart';
|
|
||||||
|
|
||||||
class AccountTile extends StatelessWidget {
|
class AccountTile extends StatelessWidget {
|
||||||
AccountTile({
|
AccountTile({
|
||||||
required this.isCurrent,
|
required this.isCurrent,
|
||||||
required this.accountName,
|
required this.accountName,
|
||||||
|
this.accountBalance,
|
||||||
|
required this.currency,
|
||||||
required this.onTap,
|
required this.onTap,
|
||||||
required this.onEdit
|
required this.onEdit
|
||||||
});
|
});
|
||||||
|
|
||||||
final bool isCurrent;
|
final bool isCurrent;
|
||||||
final String accountName;
|
final String accountName;
|
||||||
|
final String? accountBalance;
|
||||||
|
final String currency;
|
||||||
final Function() onTap;
|
final Function() onTap;
|
||||||
final Function() onEdit;
|
final Function() onEdit;
|
||||||
|
|
||||||
@override
|
@override
|
||||||
Widget build(BuildContext context) {
|
Widget build(BuildContext context) {
|
||||||
final color = isCurrent
|
final color = isCurrent
|
||||||
? Theme.of(context).textTheme!.subtitle2!.decorationColor!
|
? Theme.of(context).textTheme.subtitle2!.decorationColor!
|
||||||
: Theme.of(context).textTheme!.headline1!.decorationColor!;
|
: Theme.of(context).textTheme.headline1!.decorationColor!;
|
||||||
final textColor = isCurrent
|
final textColor = isCurrent
|
||||||
? Theme.of(context).textTheme!.subtitle2!.color!
|
? Theme.of(context).textTheme.subtitle2!.color!
|
||||||
: Theme.of(context).textTheme!.headline1!.color!;
|
: Theme.of(context).textTheme.headline1!.color!;
|
||||||
|
|
||||||
final Widget cell = GestureDetector(
|
final Widget cell = GestureDetector(
|
||||||
onTap: onTap,
|
onTap: onTap,
|
||||||
child: Container(
|
child: Container(
|
||||||
height: 77,
|
height: 77,
|
||||||
padding: EdgeInsets.only(left: 24, right: 24),
|
padding: EdgeInsets.only(left: 24, right: 24),
|
||||||
alignment: Alignment.centerLeft,
|
|
||||||
color: color,
|
color: color,
|
||||||
|
child: Row(
|
||||||
|
mainAxisAlignment: MainAxisAlignment.spaceBetween,
|
||||||
|
children: [
|
||||||
|
Expanded(
|
||||||
|
flex: 2,
|
||||||
child: Text(
|
child: Text(
|
||||||
accountName,
|
accountName,
|
||||||
style: TextStyle(
|
style: TextStyle(
|
||||||
|
@ -42,6 +48,23 @@ class AccountTile extends StatelessWidget {
|
||||||
),
|
),
|
||||||
),
|
),
|
||||||
),
|
),
|
||||||
|
if (accountBalance != null)
|
||||||
|
Expanded(
|
||||||
|
child: Text(
|
||||||
|
'${accountBalance.toString()} $currency',
|
||||||
|
textAlign: TextAlign.end,
|
||||||
|
style: TextStyle(
|
||||||
|
fontSize: 15,
|
||||||
|
fontWeight: FontWeight.w600,
|
||||||
|
fontFamily: 'Lato',
|
||||||
|
color: Theme.of(context).textTheme.headline4!.color!,
|
||||||
|
decoration: TextDecoration.none,
|
||||||
|
),
|
||||||
|
),
|
||||||
|
),
|
||||||
|
],
|
||||||
|
),
|
||||||
|
),
|
||||||
);
|
);
|
||||||
// FIX-ME: Splidable
|
// FIX-ME: Splidable
|
||||||
return cell;
|
return cell;
|
||||||
|
|
|
@ -71,7 +71,10 @@ class FullscreenQRPage extends BasePage {
|
||||||
padding: EdgeInsets.all(10),
|
padding: EdgeInsets.all(10),
|
||||||
decoration: BoxDecoration(
|
decoration: BoxDecoration(
|
||||||
border: Border.all(width: 3, color: Theme.of(context).accentTextTheme!.headline2!.backgroundColor!)),
|
border: Border.all(width: 3, color: Theme.of(context).accentTextTheme!.headline2!.backgroundColor!)),
|
||||||
child: QrImage(data: qrViewData.data, version: qrViewData.version),
|
child: Container(
|
||||||
|
decoration: BoxDecoration(
|
||||||
|
border: Border.all(width: 3, color: Colors.white)),
|
||||||
|
child: QrImage(data: qrViewData.data, version: qrViewData.version)),
|
||||||
),
|
),
|
||||||
),
|
),
|
||||||
),
|
),
|
||||||
|
|
|
@ -53,7 +53,8 @@ class ReceivePage extends BasePage {
|
||||||
final FocusNode _cryptoAmountFocus;
|
final FocusNode _cryptoAmountFocus;
|
||||||
|
|
||||||
@override
|
@override
|
||||||
Color get titleColor => Colors.white;
|
Color? get titleColor =>
|
||||||
|
currentTheme.type == ThemeType.bright ? Colors.white : null;
|
||||||
|
|
||||||
@override
|
@override
|
||||||
Widget middle(BuildContext context) {
|
Widget middle(BuildContext context) {
|
||||||
|
|
|
@ -16,7 +16,7 @@ class QrImage extends StatelessWidget {
|
||||||
|
|
||||||
@override
|
@override
|
||||||
Widget build(BuildContext context) {
|
Widget build(BuildContext context) {
|
||||||
return qr.QrImage(
|
return qr.QrImageView(
|
||||||
data: data,
|
data: data,
|
||||||
errorCorrectionLevel: errorCorrectionLevel,
|
errorCorrectionLevel: errorCorrectionLevel,
|
||||||
version: version ?? 9, // Previous value: 7 something happened after flutter upgrade monero wallets addresses are longer than ver. 7 ???
|
version: version ?? 9, // Previous value: 7 something happened after flutter upgrade monero wallets addresses are longer than ver. 7 ???
|
||||||
|
|
|
@ -86,7 +86,14 @@ class QRWidget extends StatelessWidget {
|
||||||
Theme.of(context).accentTextTheme.headline2!.backgroundColor!,
|
Theme.of(context).accentTextTheme.headline2!.backgroundColor!,
|
||||||
),
|
),
|
||||||
),
|
),
|
||||||
child: QrImage(data: addressListViewModel.uri.toString()),
|
child: Container(
|
||||||
|
decoration: BoxDecoration(
|
||||||
|
border: Border.all(
|
||||||
|
width: 3,
|
||||||
|
color:Colors.white,
|
||||||
|
),
|
||||||
|
),
|
||||||
|
child: QrImage(data: addressListViewModel.uri.toString())),
|
||||||
),
|
),
|
||||||
),
|
),
|
||||||
),
|
),
|
||||||
|
|
|
@ -25,7 +25,7 @@ class RestoreOptionsPage extends BasePage {
|
||||||
final bool isNewInstall;
|
final bool isNewInstall;
|
||||||
final imageSeedKeys = Image.asset('assets/images/restore_wallet_image.png');
|
final imageSeedKeys = Image.asset('assets/images/restore_wallet_image.png');
|
||||||
final imageBackup = Image.asset('assets/images/backup.png');
|
final imageBackup = Image.asset('assets/images/backup.png');
|
||||||
final qrCode = Image.asset('assets/images/qr_code_icon.png');
|
final qrCode = Image.asset('assets/images/restore_qr.png');
|
||||||
|
|
||||||
@override
|
@override
|
||||||
Widget body(BuildContext context) {
|
Widget body(BuildContext context) {
|
||||||
|
|
|
@ -142,10 +142,8 @@ class ConfirmSendingAlertContentState extends State<ConfirmSendingAlertContent>
|
||||||
required this.feeValue,
|
required this.feeValue,
|
||||||
required this.feeFiatAmount,
|
required this.feeFiatAmount,
|
||||||
required this.outputs})
|
required this.outputs})
|
||||||
: itemCount = 0,
|
: recipientTitle = '' {
|
||||||
recipientTitle = '' {
|
recipientTitle = outputs.length > 1
|
||||||
itemCount = outputs.length;
|
|
||||||
recipientTitle = itemCount > 1
|
|
||||||
? S.current.transaction_details_recipient_address
|
? S.current.transaction_details_recipient_address
|
||||||
: S.current.recipient_address;
|
: S.current.recipient_address;
|
||||||
}
|
}
|
||||||
|
@ -165,7 +163,6 @@ class ConfirmSendingAlertContentState extends State<ConfirmSendingAlertContent>
|
||||||
ScrollController controller = ScrollController();
|
ScrollController controller = ScrollController();
|
||||||
double fromTop = 0;
|
double fromTop = 0;
|
||||||
String recipientTitle;
|
String recipientTitle;
|
||||||
int itemCount;
|
|
||||||
bool showScrollbar = false;
|
bool showScrollbar = false;
|
||||||
|
|
||||||
@override
|
@override
|
||||||
|
@ -342,12 +339,12 @@ class ConfirmSendingAlertContentState extends State<ConfirmSendingAlertContent>
|
||||||
decoration: TextDecoration.none,
|
decoration: TextDecoration.none,
|
||||||
),
|
),
|
||||||
),
|
),
|
||||||
itemCount > 1
|
outputs.length > 1
|
||||||
? ListView.builder(
|
? ListView.builder(
|
||||||
padding: EdgeInsets.only(top: 0),
|
padding: EdgeInsets.only(top: 0),
|
||||||
shrinkWrap: true,
|
shrinkWrap: true,
|
||||||
physics: NeverScrollableScrollPhysics(),
|
physics: NeverScrollableScrollPhysics(),
|
||||||
itemCount: itemCount,
|
itemCount: outputs.length,
|
||||||
itemBuilder: (context, index) {
|
itemBuilder: (context, index) {
|
||||||
final item = outputs[index];
|
final item = outputs[index];
|
||||||
final _address = item.isParsedAddress
|
final _address = item.isParsedAddress
|
||||||
|
|
|
@ -11,6 +11,7 @@ import 'package:cake_wallet/src/screens/base_page.dart';
|
||||||
import 'package:cake_wallet/src/widgets/list_row.dart';
|
import 'package:cake_wallet/src/widgets/list_row.dart';
|
||||||
import 'package:cake_wallet/view_model/wallet_keys_view_model.dart';
|
import 'package:cake_wallet/view_model/wallet_keys_view_model.dart';
|
||||||
import 'package:cake_wallet/routes.dart';
|
import 'package:cake_wallet/routes.dart';
|
||||||
|
import 'package:qr_flutter/qr_flutter.dart';
|
||||||
|
|
||||||
class WalletKeysPage extends BasePage {
|
class WalletKeysPage extends BasePage {
|
||||||
WalletKeysPage(this.walletKeysViewModel);
|
WalletKeysPage(this.walletKeysViewModel);
|
||||||
|
@ -32,7 +33,7 @@ class WalletKeysPage extends BasePage {
|
||||||
await Navigator.pushNamed(
|
await Navigator.pushNamed(
|
||||||
context,
|
context,
|
||||||
Routes.fullscreenQR,
|
Routes.fullscreenQR,
|
||||||
arguments: QrViewData(data: url.toString()),
|
arguments: QrViewData(data: url.toString(), version: QrVersions.auto),
|
||||||
);
|
);
|
||||||
// ignore: unawaited_futures
|
// ignore: unawaited_futures
|
||||||
DeviceDisplayBrightness.setBrightness(brightness);
|
DeviceDisplayBrightness.setBrightness(brightness);
|
||||||
|
|
|
@ -24,6 +24,9 @@ class WalletListPage extends BasePage {
|
||||||
final WalletListViewModel walletListViewModel;
|
final WalletListViewModel walletListViewModel;
|
||||||
final AuthService authService;
|
final AuthService authService;
|
||||||
|
|
||||||
|
@override
|
||||||
|
String get title => S.current.wallets;
|
||||||
|
|
||||||
@override
|
@override
|
||||||
Widget body(BuildContext context) =>
|
Widget body(BuildContext context) =>
|
||||||
WalletListBody(walletListViewModel: walletListViewModel, authService: authService);
|
WalletListBody(walletListViewModel: walletListViewModel, authService: authService);
|
||||||
|
|
|
@ -1,10 +1,9 @@
|
||||||
import 'package:flutter/foundation.dart';
|
|
||||||
|
|
||||||
class AccountListItem {
|
class AccountListItem {
|
||||||
AccountListItem(
|
AccountListItem(
|
||||||
{required this.label, required this.id, this.isSelected = false});
|
{required this.label, required this.id, this.balance, this.isSelected = false});
|
||||||
|
|
||||||
final String label;
|
final String label;
|
||||||
final int id;
|
final int id;
|
||||||
final bool isSelected;
|
final bool isSelected;
|
||||||
|
final String? balance;
|
||||||
}
|
}
|
||||||
|
|
|
@ -1,3 +1,4 @@
|
||||||
|
import 'package:cw_core/crypto_currency.dart';
|
||||||
import 'package:cw_core/wallet_type.dart';
|
import 'package:cw_core/wallet_type.dart';
|
||||||
import 'package:mobx/mobx.dart';
|
import 'package:mobx/mobx.dart';
|
||||||
import 'package:cw_core/wallet_base.dart';
|
import 'package:cw_core/wallet_base.dart';
|
||||||
|
@ -21,6 +22,8 @@ abstract class MoneroAccountListViewModelBase with Store {
|
||||||
this.scrollOffsetFromTop = scrollOffsetFromTop;
|
this.scrollOffsetFromTop = scrollOffsetFromTop;
|
||||||
}
|
}
|
||||||
|
|
||||||
|
CryptoCurrency get currency => _wallet.currency;
|
||||||
|
|
||||||
@computed
|
@computed
|
||||||
List<AccountListItem> get accounts {
|
List<AccountListItem> get accounts {
|
||||||
if (_wallet.type == WalletType.haven) {
|
if (_wallet.type == WalletType.haven) {
|
||||||
|
@ -39,6 +42,7 @@ abstract class MoneroAccountListViewModelBase with Store {
|
||||||
.accounts.map((acc) => AccountListItem(
|
.accounts.map((acc) => AccountListItem(
|
||||||
label: acc.label,
|
label: acc.label,
|
||||||
id: acc.id,
|
id: acc.id,
|
||||||
|
balance: acc.balance,
|
||||||
isSelected: acc.id == monero!.getCurrentAccount(_wallet).id))
|
isSelected: acc.id == monero!.getCurrentAccount(_wallet).id))
|
||||||
.toList();
|
.toList();
|
||||||
}
|
}
|
||||||
|
@ -53,7 +57,9 @@ abstract class MoneroAccountListViewModelBase with Store {
|
||||||
monero!.setCurrentAccount(
|
monero!.setCurrentAccount(
|
||||||
_wallet,
|
_wallet,
|
||||||
item.id,
|
item.id,
|
||||||
item.label);
|
item.label,
|
||||||
|
item.balance,
|
||||||
|
);
|
||||||
}
|
}
|
||||||
|
|
||||||
if (_wallet.type == WalletType.haven) {
|
if (_wallet.type == WalletType.haven) {
|
||||||
|
|
|
@ -51,6 +51,7 @@ class WalletRestoreFromQRCode {
|
||||||
|
|
||||||
static String getFormattedUri(String code) {
|
static String getFormattedUri(String code) {
|
||||||
final index = code.indexOf(':');
|
final index = code.indexOf(':');
|
||||||
|
if (index == -1) return throw Exception('Unexpected wallet type: $code, try to scan again');
|
||||||
final scheme = code.substring(0, index).replaceAll('_', '-');
|
final scheme = code.substring(0, index).replaceAll('_', '-');
|
||||||
final query = code.substring(index + 1).replaceAll('?', '&');
|
final query = code.substring(index + 1).replaceAll('?', '&');
|
||||||
final formattedUri = '$scheme:?$query';
|
final formattedUri = '$scheme:?$query';
|
||||||
|
|
|
@ -6,7 +6,11 @@ dependencies:
|
||||||
flutter_cupertino_localizations: ^1.0.1
|
flutter_cupertino_localizations: ^1.0.1
|
||||||
intl: ^0.17.0
|
intl: ^0.17.0
|
||||||
url_launcher: ^6.1.4
|
url_launcher: ^6.1.4
|
||||||
qr_flutter: ^4.0.0
|
qr_flutter:
|
||||||
|
git:
|
||||||
|
url: https://github.com/cake-tech/qr.flutter.git
|
||||||
|
ref: cake-4.0.2
|
||||||
|
version: 4.0.2
|
||||||
uuid: 3.0.6
|
uuid: 3.0.6
|
||||||
shared_preferences: ^2.0.15
|
shared_preferences: ^2.0.15
|
||||||
flutter_secure_storage:
|
flutter_secure_storage:
|
||||||
|
|
|
@ -158,9 +158,10 @@ import 'package:cw_monero/pending_monero_transaction.dart';
|
||||||
const moneroCwPart = "part 'cw_monero.dart';";
|
const moneroCwPart = "part 'cw_monero.dart';";
|
||||||
const moneroContent = """
|
const moneroContent = """
|
||||||
class Account {
|
class Account {
|
||||||
Account({required this.id, required this.label});
|
Account({required this.id, required this.label, this.balance});
|
||||||
final int id;
|
final int id;
|
||||||
final String label;
|
final String label;
|
||||||
|
final String? balance;
|
||||||
}
|
}
|
||||||
|
|
||||||
class Subaddress {
|
class Subaddress {
|
||||||
|
@ -246,7 +247,7 @@ abstract class Monero {
|
||||||
double formatterMoneroAmountToDouble({required int amount});
|
double formatterMoneroAmountToDouble({required int amount});
|
||||||
int formatterMoneroParseAmount({required String amount});
|
int formatterMoneroParseAmount({required String amount});
|
||||||
Account getCurrentAccount(Object wallet);
|
Account getCurrentAccount(Object wallet);
|
||||||
void setCurrentAccount(Object wallet, int id, String label);
|
void setCurrentAccount(Object wallet, int id, String label, String? balance);
|
||||||
void onStartup();
|
void onStartup();
|
||||||
int getTransactionInfoAccountId(TransactionInfo tx);
|
int getTransactionInfoAccountId(TransactionInfo tx);
|
||||||
WalletService createMoneroWalletService(Box<WalletInfo> walletInfoSource);
|
WalletService createMoneroWalletService(Box<WalletInfo> walletInfoSource);
|
||||||
|
|
Loading…
Reference in a new issue