revert subaddress fix (#1656)
Some checks are pending
Cache Dependencies / test (push) Waiting to run

add show/hide passphrase
This commit is contained in:
Omar Hatem 2024-08-29 00:52:11 +03:00 committed by GitHub
parent f072e79bb6
commit 82f64a4264
No known key found for this signature in database
GPG key ID: B5690EEEBB952194
13 changed files with 51 additions and 126 deletions

View file

@ -45,8 +45,6 @@ List<Transaction> getAllTransactions() {
confirmations: 0, confirmations: 0,
blockheight: 0, blockheight: 0,
accountIndex: i, accountIndex: i,
addressIndex: 0,
addressIndexList: [0],
paymentId: "", paymentId: "",
amount: fullBalance - availBalance, amount: fullBalance - availBalance,
isSpend: false, isSpend: false,
@ -247,30 +245,19 @@ Future<PendingTransactionDescription> createTransactionMultDest(
class Transaction { class Transaction {
final String displayLabel; final String displayLabel;
String get subaddressLabel => monero.Wallet_getSubaddressLabel( String subaddressLabel = monero.Wallet_getSubaddressLabel(wptr!, accountIndex: 0, addressIndex: 0);
late final String address = monero.Wallet_address(
wptr!, wptr!,
accountIndex: accountIndex, accountIndex: 0,
addressIndex: addressIndex, addressIndex: 0,
); );
String get address => monero.Wallet_address(
wptr!,
accountIndex: accountIndex,
addressIndex: addressIndex,
);
List<String> get addressList => List.generate(addressIndexList.length, (index) =>
monero.Wallet_address(
wptr!,
accountIndex: accountIndex,
addressIndex: addressIndexList[index],
));
final String description; final String description;
final int fee; final int fee;
final int confirmations; final int confirmations;
late final bool isPending = confirmations < 10; late final bool isPending = confirmations < 10;
final int blockheight; final int blockheight;
final int addressIndex; final int addressIndex = 0;
final int accountIndex; final int accountIndex;
final List<int> addressIndexList;
final String paymentId; final String paymentId;
final int amount; final int amount;
final bool isSpend; final bool isSpend;
@ -316,8 +303,6 @@ class Transaction {
amount = monero.TransactionInfo_amount(txInfo), amount = monero.TransactionInfo_amount(txInfo),
paymentId = monero.TransactionInfo_paymentId(txInfo), paymentId = monero.TransactionInfo_paymentId(txInfo),
accountIndex = monero.TransactionInfo_subaddrAccount(txInfo), accountIndex = monero.TransactionInfo_subaddrAccount(txInfo),
addressIndex = int.tryParse(monero.TransactionInfo_subaddrIndex(txInfo).split(", ")[0]) ?? 0,
addressIndexList = monero.TransactionInfo_subaddrIndex(txInfo).split(", ").map((e) => int.tryParse(e) ?? 0).toList(),
blockheight = monero.TransactionInfo_blockHeight(txInfo), blockheight = monero.TransactionInfo_blockHeight(txInfo),
confirmations = monero.TransactionInfo_confirmations(txInfo), confirmations = monero.TransactionInfo_confirmations(txInfo),
fee = monero.TransactionInfo_fee(txInfo), fee = monero.TransactionInfo_fee(txInfo),
@ -331,8 +316,6 @@ class Transaction {
required this.confirmations, required this.confirmations,
required this.blockheight, required this.blockheight,
required this.accountIndex, required this.accountIndex,
required this.addressIndexList,
required this.addressIndex,
required this.paymentId, required this.paymentId,
required this.amount, required this.amount,
required this.isSpend, required this.isSpend,

View file

@ -1,7 +1,6 @@
import 'package:cw_core/subaddress.dart'; import 'package:cw_core/subaddress.dart';
import 'package:cw_monero/api/coins_info.dart'; import 'package:cw_monero/api/coins_info.dart';
import 'package:cw_monero/api/subaddress_list.dart' as subaddress_list; import 'package:cw_monero/api/subaddress_list.dart' as subaddress_list;
import 'package:cw_monero/api/wallet.dart';
import 'package:flutter/services.dart'; import 'package:flutter/services.dart';
import 'package:mobx/mobx.dart'; import 'package:mobx/mobx.dart';
@ -104,9 +103,6 @@ abstract class MoneroSubaddressListBase with Store {
required List<String> usedAddresses, required List<String> usedAddresses,
}) async { }) async {
_usedAddresses.addAll(usedAddresses); _usedAddresses.addAll(usedAddresses);
final _all = _usedAddresses.toSet().toList();
_usedAddresses.clear();
_usedAddresses.addAll(_all);
if (_isUpdating) { if (_isUpdating) {
return; return;
} }
@ -128,7 +124,7 @@ abstract class MoneroSubaddressListBase with Store {
Future<List<Subaddress>> _getAllUnusedAddresses( Future<List<Subaddress>> _getAllUnusedAddresses(
{required int accountIndex, required String label}) async { {required int accountIndex, required String label}) async {
final allAddresses = subaddress_list.getAllSubaddresses(); final allAddresses = subaddress_list.getAllSubaddresses();
if (allAddresses.isEmpty || _usedAddresses.contains(allAddresses.first.address)) { if (allAddresses.isEmpty || _usedAddresses.contains(allAddresses.last)) {
final isAddressUnused = await _newSubaddress(accountIndex: accountIndex, label: label); final isAddressUnused = await _newSubaddress(accountIndex: accountIndex, label: label);
if (!isAddressUnused) { if (!isAddressUnused) {
return await _getAllUnusedAddresses(accountIndex: accountIndex, label: label); return await _getAllUnusedAddresses(accountIndex: accountIndex, label: label);
@ -147,7 +143,8 @@ abstract class MoneroSubaddressListBase with Store {
label.toLowerCase() == 'Primary account'.toLowerCase() label.toLowerCase() == 'Primary account'.toLowerCase()
? 'Primary address' ? 'Primary address'
: label); : label);
}).toList().reversed.toList(); })
.toList();
} }
Future<bool> _newSubaddress({required int accountIndex, required String label}) async { Future<bool> _newSubaddress({required int accountIndex, required String label}) async {

View file

@ -86,9 +86,6 @@ abstract class MoneroWalletBase extends WalletBase<MoneroBalance,
reaction((_) => isEnabledAutoGenerateSubaddress, (bool enabled) { reaction((_) => isEnabledAutoGenerateSubaddress, (bool enabled) {
_updateSubAddress(enabled, account: walletAddresses.account); _updateSubAddress(enabled, account: walletAddresses.account);
}); });
_onTxHistoryChangeReaction = reaction((_) => transactionHistory, (__) {
_updateSubAddress(isEnabledAutoGenerateSubaddress, account: walletAddresses.account);
});
} }
static const int _autoSaveInterval = 30; static const int _autoSaveInterval = 30;
@ -131,7 +128,6 @@ abstract class MoneroWalletBase extends WalletBase<MoneroBalance,
monero_wallet.SyncListener? _listener; monero_wallet.SyncListener? _listener;
ReactionDisposer? _onAccountChangeReaction; ReactionDisposer? _onAccountChangeReaction;
ReactionDisposer? _onTxHistoryChangeReaction;
bool _isTransactionUpdating; bool _isTransactionUpdating;
bool _hasSyncAfterStartup; bool _hasSyncAfterStartup;
Timer? _autoSaveTimer; Timer? _autoSaveTimer;
@ -171,7 +167,6 @@ abstract class MoneroWalletBase extends WalletBase<MoneroBalance,
void close() async { void close() async {
_listener?.stop(); _listener?.stop();
_onAccountChangeReaction?.reaction.dispose(); _onAccountChangeReaction?.reaction.dispose();
_onTxHistoryChangeReaction?.reaction.dispose();
_autoSaveTimer?.cancel(); _autoSaveTimer?.cancel();
} }

View file

@ -3,7 +3,6 @@ import 'package:cw_core/address_info.dart';
import 'package:cw_core/subaddress.dart'; import 'package:cw_core/subaddress.dart';
import 'package:cw_core/wallet_addresses.dart'; import 'package:cw_core/wallet_addresses.dart';
import 'package:cw_core/wallet_info.dart'; import 'package:cw_core/wallet_info.dart';
import 'package:cw_monero/api/transaction_history.dart';
import 'package:cw_monero/api/wallet.dart'; import 'package:cw_monero/api/wallet.dart';
import 'package:cw_monero/monero_account_list.dart'; import 'package:cw_monero/monero_account_list.dart';
import 'package:cw_monero/monero_subaddress_list.dart'; import 'package:cw_monero/monero_subaddress_list.dart';
@ -38,25 +37,6 @@ abstract class MoneroWalletAddressesBase extends WalletAddresses with Store {
MoneroAccountList accountList; MoneroAccountList accountList;
@override
Set<String> get usedAddresses {
final txs = getAllTransactions();
final adds = _originalUsedAddresses.toList();
for (var i = 0; i < txs.length; i++) {
for (var j = 0; j < txs[i].addressList.length; j++) {
adds.add(txs[i].addressList[j]);
}
}
return adds.toSet();
}
Set<String> _originalUsedAddresses = Set();
@override
set usedAddresses(Set<String> _usedAddresses) {
_originalUsedAddresses = _usedAddresses;
}
@override @override
Future<void> init() async { Future<void> init() async {
accountList.update(); accountList.update();

View file

@ -45,8 +45,6 @@ List<Transaction> getAllTransactions() {
confirmations: 0, confirmations: 0,
blockheight: 0, blockheight: 0,
accountIndex: i, accountIndex: i,
addressIndex: 0,
addressIndexList: [0],
paymentId: "", paymentId: "",
amount: fullBalance - availBalance, amount: fullBalance - availBalance,
isSpend: false, isSpend: false,
@ -245,26 +243,19 @@ Future<PendingTransactionDescription> createTransactionMultDest(
class Transaction { class Transaction {
final String displayLabel; final String displayLabel;
String get subaddressLabel => wownero.Wallet_getSubaddressLabel(wptr!, accountIndex: 0, addressIndex: 0); String subaddressLabel = wownero.Wallet_getSubaddressLabel(wptr!, accountIndex: 0, addressIndex: 0);
String get address => wownero.Wallet_address( late final String address = wownero.Wallet_address(
wptr!, wptr!,
accountIndex: accountIndex, accountIndex: 0,
addressIndex: addressIndex, addressIndex: 0,
); );
List<String> get addressList => List.generate(addressIndexList.length, (index) =>
wownero.Wallet_address(
wptr!,
accountIndex: accountIndex,
addressIndex: addressIndexList[index],
));
final String description; final String description;
final int fee; final int fee;
final int confirmations; final int confirmations;
late final bool isPending = confirmations < 3; late final bool isPending = confirmations < 3;
final int blockheight; final int blockheight;
final int addressIndex; final int addressIndex = 0;
final int accountIndex; final int accountIndex;
final List<int> addressIndexList;
final String paymentId; final String paymentId;
final int amount; final int amount;
final bool isSpend; final bool isSpend;
@ -310,8 +301,6 @@ class Transaction {
amount = wownero.TransactionInfo_amount(txInfo), amount = wownero.TransactionInfo_amount(txInfo),
paymentId = wownero.TransactionInfo_paymentId(txInfo), paymentId = wownero.TransactionInfo_paymentId(txInfo),
accountIndex = wownero.TransactionInfo_subaddrAccount(txInfo), accountIndex = wownero.TransactionInfo_subaddrAccount(txInfo),
addressIndex = int.tryParse(wownero.TransactionInfo_subaddrIndex(txInfo).split(", ")[0]) ?? 0,
addressIndexList = wownero.TransactionInfo_subaddrIndex(txInfo).split(", ").map((e) => int.tryParse(e) ?? 0).toList(),
blockheight = wownero.TransactionInfo_blockHeight(txInfo), blockheight = wownero.TransactionInfo_blockHeight(txInfo),
confirmations = wownero.TransactionInfo_confirmations(txInfo), confirmations = wownero.TransactionInfo_confirmations(txInfo),
fee = wownero.TransactionInfo_fee(txInfo), fee = wownero.TransactionInfo_fee(txInfo),
@ -325,8 +314,6 @@ class Transaction {
required this.confirmations, required this.confirmations,
required this.blockheight, required this.blockheight,
required this.accountIndex, required this.accountIndex,
required this.addressIndex,
required this.addressIndexList,
required this.paymentId, required this.paymentId,
required this.amount, required this.amount,
required this.isSpend, required this.isSpend,

View file

@ -1,7 +1,6 @@
import 'package:cw_core/subaddress.dart'; import 'package:cw_core/subaddress.dart';
import 'package:cw_wownero/api/coins_info.dart'; import 'package:cw_wownero/api/coins_info.dart';
import 'package:cw_wownero/api/subaddress_list.dart' as subaddress_list; import 'package:cw_wownero/api/subaddress_list.dart' as subaddress_list;
import 'package:cw_wownero/api/wallet.dart';
import 'package:flutter/services.dart'; import 'package:flutter/services.dart';
import 'package:mobx/mobx.dart'; import 'package:mobx/mobx.dart';
@ -104,9 +103,6 @@ abstract class WowneroSubaddressListBase with Store {
required List<String> usedAddresses, required List<String> usedAddresses,
}) async { }) async {
_usedAddresses.addAll(usedAddresses); _usedAddresses.addAll(usedAddresses);
final _all = _usedAddresses.toSet().toList();
_usedAddresses.clear();
_usedAddresses.addAll(_all);
if (_isUpdating) { if (_isUpdating) {
return; return;
} }

View file

@ -82,10 +82,6 @@ abstract class WowneroWalletBase
reaction((_) => isEnabledAutoGenerateSubaddress, (bool enabled) { reaction((_) => isEnabledAutoGenerateSubaddress, (bool enabled) {
_updateSubAddress(enabled, account: walletAddresses.account); _updateSubAddress(enabled, account: walletAddresses.account);
}); });
_onTxHistoryChangeReaction = reaction((_) => transactionHistory, (__) {
_updateSubAddress(isEnabledAutoGenerateSubaddress, account: walletAddresses.account);
});
} }
static const int _autoSaveInterval = 30; static const int _autoSaveInterval = 30;
@ -127,7 +123,6 @@ abstract class WowneroWalletBase
wownero_wallet.SyncListener? _listener; wownero_wallet.SyncListener? _listener;
ReactionDisposer? _onAccountChangeReaction; ReactionDisposer? _onAccountChangeReaction;
ReactionDisposer? _onTxHistoryChangeReaction;
bool _isTransactionUpdating; bool _isTransactionUpdating;
bool _hasSyncAfterStartup; bool _hasSyncAfterStartup;
Timer? _autoSaveTimer; Timer? _autoSaveTimer;
@ -163,7 +158,6 @@ abstract class WowneroWalletBase
void close() async { void close() async {
_listener?.stop(); _listener?.stop();
_onAccountChangeReaction?.reaction.dispose(); _onAccountChangeReaction?.reaction.dispose();
_onTxHistoryChangeReaction?.reaction.dispose();
_autoSaveTimer?.cancel(); _autoSaveTimer?.cancel();
} }

View file

@ -3,7 +3,6 @@ import 'package:cw_core/address_info.dart';
import 'package:cw_core/subaddress.dart'; import 'package:cw_core/subaddress.dart';
import 'package:cw_core/wallet_addresses.dart'; import 'package:cw_core/wallet_addresses.dart';
import 'package:cw_core/wallet_info.dart'; import 'package:cw_core/wallet_info.dart';
import 'package:cw_wownero/api/transaction_history.dart';
import 'package:cw_wownero/api/wallet.dart'; import 'package:cw_wownero/api/wallet.dart';
import 'package:cw_wownero/wownero_account_list.dart'; import 'package:cw_wownero/wownero_account_list.dart';
import 'package:cw_wownero/wownero_subaddress_list.dart'; import 'package:cw_wownero/wownero_subaddress_list.dart';
@ -37,24 +36,7 @@ abstract class WowneroWalletAddressesBase extends WalletAddresses with Store {
WowneroSubaddressList subaddressList; WowneroSubaddressList subaddressList;
WowneroAccountList accountList; WowneroAccountList accountList;
@override
Set<String> get usedAddresses {
final txs = getAllTransactions();
final adds = _originalUsedAddresses.toList();
for (var i = 0; i < txs.length; i++) {
for (var j = 0; j < txs[i].addressList.length; j++) {
adds.add(txs[i].addressList[j]);
}
}
return adds.toSet();
}
Set<String> _originalUsedAddresses = Set();
@override
set usedAddresses(Set<String> _usedAddresses) {
_originalUsedAddresses = _usedAddresses;
}
@override @override
Future<void> init() async { Future<void> init() async {
accountList.update(); accountList.update();

View file

@ -70,6 +70,8 @@ class _AdvancedPrivacySettingsBodyState extends State<_AdvancedPrivacySettingsBo
final _formKey = GlobalKey<FormState>(); final _formKey = GlobalKey<FormState>();
bool? testnetValue; bool? testnetValue;
bool obscurePassphrase = true;
@override @override
void initState() { void initState() {
passphraseController.text = widget.seedTypeViewModel.passphrase ?? ''; passphraseController.text = widget.seedTypeViewModel.passphrase ?? '';
@ -156,7 +158,16 @@ class _AdvancedPrivacySettingsBodyState extends State<_AdvancedPrivacySettingsBo
child: BaseTextFormField( child: BaseTextFormField(
hintText: S.current.passphrase, hintText: S.current.passphrase,
controller: passphraseController, controller: passphraseController,
obscureText: true, obscureText: obscurePassphrase,
suffixIcon: GestureDetector(
onTap: () => setState(() {
obscurePassphrase = !obscurePassphrase;
}),
child: Icon(
Icons.remove_red_eye,
color: obscurePassphrase ? Colors.black54 : Colors.black26,
),
),
), ),
), ),
], ],

View file

@ -16,14 +16,14 @@ APP_ANDROID_TYPE=$1
MONERO_COM_NAME="Monero.com" MONERO_COM_NAME="Monero.com"
MONERO_COM_VERSION="1.16.5" MONERO_COM_VERSION="1.16.5"
MONERO_COM_BUILD_NUMBER=99 MONERO_COM_BUILD_NUMBER=100
MONERO_COM_BUNDLE_ID="com.monero.app" MONERO_COM_BUNDLE_ID="com.monero.app"
MONERO_COM_PACKAGE="com.monero.app" MONERO_COM_PACKAGE="com.monero.app"
MONERO_COM_SCHEME="monero.com" MONERO_COM_SCHEME="monero.com"
CAKEWALLET_NAME="Cake Wallet" CAKEWALLET_NAME="Cake Wallet"
CAKEWALLET_VERSION="4.19.5" CAKEWALLET_VERSION="4.19.5"
CAKEWALLET_BUILD_NUMBER=226 CAKEWALLET_BUILD_NUMBER=227
CAKEWALLET_BUNDLE_ID="com.cakewallet.cake_wallet" CAKEWALLET_BUNDLE_ID="com.cakewallet.cake_wallet"
CAKEWALLET_PACKAGE="com.cakewallet.cake_wallet" CAKEWALLET_PACKAGE="com.cakewallet.cake_wallet"
CAKEWALLET_SCHEME="cakewallet" CAKEWALLET_SCHEME="cakewallet"

View file

@ -14,12 +14,12 @@ APP_IOS_TYPE=$1
MONERO_COM_NAME="Monero.com" MONERO_COM_NAME="Monero.com"
MONERO_COM_VERSION="1.16.5" MONERO_COM_VERSION="1.16.5"
MONERO_COM_BUILD_NUMBER=97 MONERO_COM_BUILD_NUMBER=98
MONERO_COM_BUNDLE_ID="com.cakewallet.monero" MONERO_COM_BUNDLE_ID="com.cakewallet.monero"
CAKEWALLET_NAME="Cake Wallet" CAKEWALLET_NAME="Cake Wallet"
CAKEWALLET_VERSION="4.19.5" CAKEWALLET_VERSION="4.19.5"
CAKEWALLET_BUILD_NUMBER=264 CAKEWALLET_BUILD_NUMBER=266
CAKEWALLET_BUNDLE_ID="com.fotolockr.cakewallet" CAKEWALLET_BUNDLE_ID="com.fotolockr.cakewallet"
HAVEN_NAME="Haven" HAVEN_NAME="Haven"

View file

@ -15,7 +15,7 @@ fi
CAKEWALLET_NAME="Cake Wallet" CAKEWALLET_NAME="Cake Wallet"
CAKEWALLET_VERSION="1.9.5" CAKEWALLET_VERSION="1.9.5"
CAKEWALLET_BUILD_NUMBER=32 CAKEWALLET_BUILD_NUMBER=33
if ! [[ " ${TYPES[*]} " =~ " ${APP_LINUX_TYPE} " ]]; then if ! [[ " ${TYPES[*]} " =~ " ${APP_LINUX_TYPE} " ]]; then
echo "Wrong app type." echo "Wrong app type."

View file

@ -17,12 +17,12 @@ fi
MONERO_COM_NAME="Monero.com" MONERO_COM_NAME="Monero.com"
MONERO_COM_VERSION="1.6.5" MONERO_COM_VERSION="1.6.5"
MONERO_COM_BUILD_NUMBER=30 MONERO_COM_BUILD_NUMBER=31
MONERO_COM_BUNDLE_ID="com.cakewallet.monero" MONERO_COM_BUNDLE_ID="com.cakewallet.monero"
CAKEWALLET_NAME="Cake Wallet" CAKEWALLET_NAME="Cake Wallet"
CAKEWALLET_VERSION="1.12.5" CAKEWALLET_VERSION="1.12.5"
CAKEWALLET_BUILD_NUMBER=86 CAKEWALLET_BUILD_NUMBER=88
CAKEWALLET_BUNDLE_ID="com.fotolockr.cakewallet" CAKEWALLET_BUNDLE_ID="com.fotolockr.cakewallet"
if ! [[ " ${TYPES[*]} " =~ " ${APP_MACOS_TYPE} " ]]; then if ! [[ " ${TYPES[*]} " =~ " ${APP_MACOS_TYPE} " ]]; then