Skip to content

Commit

Permalink
Merge pull request #123 from peercoin/0.7.9
Browse files Browse the repository at this point in the history
0.7.9
  • Loading branch information
Willy authored Jan 11, 2022
2 parents e9a97f4 + ee73593 commit 2e275c8
Show file tree
Hide file tree
Showing 6 changed files with 119 additions and 22 deletions.
6 changes: 5 additions & 1 deletion CHANGELOG.md
Original file line number Diff line number Diff line change
@@ -1,7 +1,11 @@
### **0.7.9** (2022-01-11)
* Allow keys to be exported in address book
* Performance improvements for transaction building for imported keys

### **0.7.8** (2022-01-06)
* Translation fixes
* Fix issue where wallet balance was not updated after TX confirmed
* Fix issue with authentification
* Fix issue with authentication

### **0.7.7** (2021-12-30)
* allow import of WIF-format private keys
Expand Down
5 changes: 5 additions & 0 deletions assets/translations/en.json
Original file line number Diff line number Diff line change
Expand Up @@ -24,11 +24,16 @@
"addressbook_dialog_remove_snack": "Address successfully removed",
"addressbook_edit_dialog_title": "Edit label",
"addressbook_edit_dialog_input": "New label",
"addressbook_export_dialog_title": "Export Private Key",
"addressbook_export_dialog_description": "This key gives full access to the coins stored with this address.\nDon't share this key with anyone!\nOnly proceed if you are absolutely sure what you are doing.",
"addressbook_export_dialog_button": "Show me the key",
"addressbook_export_dialog_hint": "This key is WIF-format.",
"addressbook_no_label": "no label",
"addressbook_no_sending": "No addresses",
"addressbook_search": "Insert addresses, labels",
"addressbook_swipe_delete": "Delete",
"addressbook_swipe_edit": "Edit",
"addressbook_swipe_export": "Export",
"addressbook_swipe_share": "Share",
"addressbook_swipe_send": "Send to",
"addressbook_title": "$coin Addresses",
Expand Down
42 changes: 24 additions & 18 deletions lib/providers/activewallets.dart
Original file line number Diff line number Diff line change
Expand Up @@ -282,18 +282,20 @@ class ActiveWallets with ChangeNotifier {
if (scanMode == true) {
//write phantom tx that are not displayed in tx list but known to the wallet
//so they won't be parsed again and cause weird display behaviour
openWallet.putTransaction(WalletTransaction(
txid: tx['txid'],
timestamp: -1, //flags phantom tx
value: 0,
fee: 0,
address: address,
direction: 'in',
broadCasted: true,
confirmations: 0,
broadcastHex: '',
opReturn: '',
));
openWallet.putTransaction(
WalletTransaction(
txid: tx['txid'],
timestamp: -1, //flags phantom tx
value: 0,
fee: 0,
address: address,
direction: 'in',
broadCasted: true,
confirmations: 0,
broadcastHex: '',
opReturn: '',
),
);
} else {
//check if that tx is already in the db
var txInWallet = openWallet.transactions;
Expand Down Expand Up @@ -458,13 +460,17 @@ class ActiveWallets with ChangeNotifier {
//set address to used
//update status for address
var openWallet = getSpecificCoinWallet(identifier);
openWallet.addresses.forEach((walletAddr) async {
if (walletAddr.address == address) {
walletAddr.newUsed = status == null ? false : true;
walletAddr.newStatus = status;
var addrInWallet = openWallet.addresses
.firstWhereOrNull((element) => element.address == address);
if (addrInWallet != null) {
addrInWallet.newUsed = status == null ? false : true;
addrInWallet.newStatus = status;

if (addrInWallet.wif!.isEmpty || addrInWallet.wif == null) {
await getWif(identifier, address);
}
await openWallet.save();
});
}
await openWallet.save();
await generateUnusedAddress(identifier);
}

Expand Down
6 changes: 4 additions & 2 deletions lib/screens/wallet/wallet_home.dart
Original file line number Diff line number Diff line change
Expand Up @@ -263,8 +263,10 @@ class _WalletHomeState extends State<WalletHomeScreen>
_rescanInProgress = true;
//init rescan
await Navigator.of(context).pushNamedAndRemoveUntil(
Routes.WalletImportScan, (_) => false,
arguments: _wallet.name);
Routes.WalletImportScan,
(_) => false,
arguments: _wallet.name,
);
},
),
],
Expand Down
80 changes: 80 additions & 0 deletions lib/widgets/wallet/addresses_tab.dart
Original file line number Diff line number Diff line change
Expand Up @@ -5,8 +5,10 @@ import 'package:peercoin/models/availablecoins.dart';
import 'package:peercoin/models/coin.dart';
import 'package:peercoin/models/walletaddress.dart';
import 'package:peercoin/providers/activewallets.dart';
import 'package:peercoin/providers/appsettings.dart';
import 'package:peercoin/screens/wallet/wallet_home.dart';
import 'package:peercoin/tools/app_localizations.dart';
import 'package:peercoin/tools/auth.dart';
import 'package:peercoin/widgets/wallet/wallet_home_qr.dart';
import 'package:provider/provider.dart';

Expand Down Expand Up @@ -120,6 +122,69 @@ class _AddressTabState extends State<AddressTab> {
);
}

Future<void> _showAddressExportDialog(
BuildContext context, WalletAddress address) async {
return showDialog(
context: context,
builder: (context) {
return AlertDialog(
title: Text(
AppLocalizations.instance
.translate('addressbook_export_dialog_title'),
textAlign: TextAlign.center,
),
content: Column(
mainAxisSize: MainAxisSize.min,
mainAxisAlignment: MainAxisAlignment.center,
children: [
Text(
AppLocalizations.instance
.translate('addressbook_export_dialog_description'),
textAlign: TextAlign.center,
style: TextStyle(
fontSize: 16,
letterSpacing: 1.2,
fontWeight: FontWeight.bold,
color: Theme.of(context).errorColor,
),
),
],
),
actions: <Widget>[
TextButton(
onPressed: () {
Navigator.pop(context);
},
child: Text(
AppLocalizations.instance
.translate('server_settings_alert_cancel'),
),
),
TextButton(
onPressed: () async {
var _wif;
if (address.wif!.isEmpty || address.wif == null) {
_wif = await context.read<ActiveWallets>().getWif(
_availableCoin.name,
address.address,
);
} else {
_wif = address.wif;
}
Navigator.of(context).pop();
WalletHomeQr.showQrDialog(context, _wif);
},
child: Text(
AppLocalizations.instance
.translate('addressbook_export_dialog_button'),
),
)
],
);
},
);
}

Future<void> _addressAddDialog(BuildContext context) async {
var _labelController = TextEditingController();
var _addressController = TextEditingController();
Expand Down Expand Up @@ -353,6 +418,21 @@ class _AddressTabState extends State<AddressTab> {
addr.address,
),
),
IconSlideAction(
caption: AppLocalizations.instance
.translate('addressbook_swipe_export'),
color: Theme.of(context).backgroundColor,
iconWidget: Icon(
Icons.vpn_key,
color: Theme.of(context).colorScheme.secondary,
),
onTap: () => Auth.requireAuth(
context: context,
biometricsAllowed:
context.read<AppSettings>().biometricsAllowed,
callback: () => _showAddressExportDialog(context, addr),
),
),
],
actionExtentRatio: 0.25,
child: ListTile(
Expand Down
2 changes: 1 addition & 1 deletion pubspec.yaml
Original file line number Diff line number Diff line change
@@ -1,7 +1,7 @@
name: peercoin
description: A new Peercoin wallet.

version: 0.7.8+75
version: 0.7.9+76

environment:
sdk: '>=2.12.0 <3.0.0'
Expand Down

0 comments on commit 2e275c8

Please sign in to comment.