Skip to content
This repository has been archived by the owner on Apr 21, 2023. It is now read-only.

Commit

Permalink
Opt In release (#606)
Browse files Browse the repository at this point in the history
Co-authored-by: AdriaCarrera <adria.cm95@gmail.com>
  • Loading branch information
Peersyst Technology and AdriaCarrera committed Sep 15, 2020
1 parent e3bdafc commit b2363d0
Show file tree
Hide file tree
Showing 43 changed files with 4,228 additions and 866 deletions.
10 changes: 9 additions & 1 deletion package.json
Original file line number Diff line number Diff line change
Expand Up @@ -19,6 +19,9 @@
"browser-sync": "^2.11.1",
"browserify": "^13.0.0",
"browserify-ngannotate": "^2.0.0",
"bufferutil": "^4.0.1",
"catapult-optin-module": "git+https://github.com/nemgrouplimited/symbol-optin-module.git",
"symbol-paper-wallets": "git+https://github.com/Peersyst/symbol-paper-wallets.git",
"chart.js": "2.1.6",
"crypto-js": "^3.1.9-1",
"glob": "7.0.5",
Expand All @@ -37,12 +40,17 @@
"nem-library": "1.0.5",
"nem-sdk": "1.6.7",
"nem-trezor": "1.1.0",
"nem-voting": "^2.2.9",
"nem-voting": "^2.2.6",
"symbol-hd-wallets": "0.12.0",
"ng-toast": "2.0.0",
"ngstorage": "0.3.10",
"nw": "^0.26.6",
"nw-builder": "^3.4.1",
"rxjs": "^6.5.3",
"symbol-qr-library": "^0.9.0",
"symbol-sdk": "0.20.7-alpha-202007211137",
"url-parse": "1.1.9",
"utf-8-validate": "^5.0.2",
"vinyl-source-stream": "^1.1.0",
"zxcvbn": "4.4.2"
},
Expand Down
5 changes: 4 additions & 1 deletion src/app/app.js
Original file line number Diff line number Diff line change
Expand Up @@ -55,6 +55,7 @@ import './modules/signedMessage';
import './modules/domainNameSystem';
import './modules/importWalletQrCode';
import './modules/NEMonster';
import './modules/catapultOptin';

// Create and bootstrap application
const requires = [
Expand Down Expand Up @@ -112,7 +113,9 @@ const requires = [
'app.domainNameSystem',
'app.dnsSearch',
'app.NEMonster',
'app.importWalletQrCode'
'app.importWalletQrCode',
'app.catapultOptin',
'app.multisigOptin'
];

window.$ = window.jQuery = $;
Expand Down
2 changes: 1 addition & 1 deletion src/app/config/app.constants.js
Original file line number Diff line number Diff line change
Expand Up @@ -2,7 +2,7 @@ const AppConstants = {
//Application name
appName: 'NEM Wallet',

version: '2.4.7',
version: '2.4.7-optin',

//Network
defaultNetwork: 104,
Expand Down
28 changes: 25 additions & 3 deletions src/app/modules/account/account.controller.js
Original file line number Diff line number Diff line change
Expand Up @@ -30,13 +30,16 @@ class AccountCtrl {

// Show / Hide account selection depending of number of accounts
this.showAccounts = false;

// Store the label for new account
this.newAccountLabel = "";

// Show the password input for mobile wallet QR
this.showMobileQRPass = true;

// Show the password input for mobile account QR
this.showMobileAccountQRPass = true;

// Common object to contain our password & private key data for adding account
this.common = nem.model.objects.get("common");

Expand All @@ -46,6 +49,9 @@ class AccountCtrl {
// Common object to contain our password & private key data for QR wallet
this.commonQR = nem.model.objects.get("common");

// Common object to contain our password & private key data for QR account
this.commonAccountQR = nem.model.objects.get("common");

// Prevent users to click twice on button when already processing
this.okPressed = false;

Expand Down Expand Up @@ -93,6 +99,21 @@ class AccountCtrl {
return;
}

/**
* Generate the mobile account QR
*/
generateAccountQR() {
let QR = this._Wallet.generateCurrentAccountQR(this.commonAccountQR);
if(QR) {
$('#mobileAccountQR').html("");
$('#mobileAccountQR').append(QR);
// Hide the password input for export to mobile qr
this.showMobileAccountQRPass = false;
}
this.reset();
return;
}

/**
* Reveal the private key
*/
Expand Down Expand Up @@ -150,7 +171,7 @@ class AccountCtrl {
this.reset();
return;
});
},
},
(err) => {
this._$timeout(() => {
this.okPressed = false;
Expand Down Expand Up @@ -192,6 +213,7 @@ class AccountCtrl {
this.common = nem.model.objects.get("common");
this.commonPK = nem.model.objects.get("common");
this.commonQR = nem.model.objects.get("common");
this.commonAccountQR = nem.model.objects.get("common");
this.newAccountLabel = "";
return;
}
Expand All @@ -200,4 +222,4 @@ class AccountCtrl {

}

export default AccountCtrl;
export default AccountCtrl;
35 changes: 35 additions & 0 deletions src/app/modules/account/account.html
Original file line number Diff line number Diff line change
Expand Up @@ -123,6 +123,13 @@ <h3>{{'ACCOUNT_EXPORT_MOBILE' | translate }}</h3>
<button type="button" class="btn btn-block" data-toggle="modal" data-target="#walletModalMobileApps" ng-disabled="$ctrl._Wallet.algo === 'trezor'">{{'ACCOUNT_WALLET_QR_BTN_2' | translate }}</button>
</div>
</div>
<div class="row" style="margin-top: 15px;">
<div class="col-sm-6">
</div>
<div class="col-sm-6">
<button type="button" class="btn btn-block" data-toggle="modal" data-target="#accountModalMobileApps" ng-disabled="$ctrl._Wallet.algo === 'trezor'">{{'ACCOUNT_QR_BTN_2' | translate }}</button>
</div>
</div>
</div>
</div>

Expand Down Expand Up @@ -217,6 +224,34 @@ <h4 class="modal-title">{{ 'ACCOUNT_WALLET_QR_ANDROID_IOS_TITLE' | translate }}<
</div>
</div>


<!-- Wallet qr Modal for ios and android -->
<div id="accountModalMobileApps" class="modal fade" role="dialog" data-backdrop="static" data-keyboard="false">
<div class="modal-dialog">
<!-- Modal content-->
<div class="modal-content">
<div class="modal-header">
<button type="button" class="close" data-dismiss="modal" ng-click="$ctrl.showMobileAccountQRPass = true;">&times;</button>
<h4 class="modal-title">{{ 'ACCOUNT_QR_ANDROID_IOS_TITLE' | translate }}</h4>
</div>
<div class="modal-body">
<div class="text-center" id="mobileAccountQR" ng-show="!$ctrl.showMobileAccountQRPass"></div>
<div ng-show="$ctrl.showMobileAccountQRPass">
<!-- Password Field -->
<password-input common="$ctrl.commonAccountQR"></password-input>
<button class="btn btn-success"
type="submit" ng-disabled="$ctrl.okPressed || $ctrl._Wallet.algo !== 'trezor' && !$ctrl.commonAccountQR.password.length" ng-click="$ctrl.generateAccountQR()">
{{'GENERAL_REVEAL' | translate }}
</button>
</div>
</div>
<div class="modal-footer">
<button type="button" class="btn btn-default" data-dismiss="modal" ng-click="$ctrl.showMobileAccountQRPass = true;">{{ 'GENERAL_CLOSE' | translate }}</button>
</div>
</div>
</div>
</div>

<!-- Add new account modal -->
<div id="addAccountModal" class="modal fade" role="dialog">
<div class="modal-dialog">
Expand Down
Original file line number Diff line number Diff line change
@@ -0,0 +1,15 @@
function CatapultOptInConfig($stateProvider) {
'ngInject';

$stateProvider
.state('app.catapultOptin', {
url: '/catapultOptin',
controller: 'CatapultOptInCtrl',
controllerAs: '$ctrl',
templateUrl: 'modules/catapultOptin/catapultOptin/catapultOptin.html',
title: 'Catapult Opt In'
});

};

export default CatapultOptInConfig;
Loading

0 comments on commit b2363d0

Please sign in to comment.