Skip to content

Commit da27227

Browse files
Merge branch 'v4.0.1'
2 parents fe4e96f + b810db6 commit da27227

File tree

5 files changed

+93
-11
lines changed

5 files changed

+93
-11
lines changed

app-template/copay/appConfig.json

+1-1
Original file line numberDiff line numberDiff line change
@@ -23,7 +23,7 @@
2323
"windowsAppId": "804636ee-b017-4cad-8719-e58ac97ffa5c",
2424
"pushSenderId": "1036948132229",
2525
"description": "A Secure Nav Coin Wallet",
26-
"version": "1.0.1",
26+
"version": "4.0.1",
2727
"androidVersion": "100001",
2828
"_extraCSS": null,
2929
"_enabledExtensions": {

src/js/controllers/tab-send.js

+41-3
Original file line numberDiff line numberDiff line change
@@ -1,13 +1,26 @@
11
'use strict';
22

3-
angular.module('copayApp.controllers').controller('tabSendController', function($scope, $rootScope, $log, $timeout, $ionicScrollDelegate, addressbookService, profileService, lodash, $state, walletService, incomingData, popupService, platformInfo, bwcError, gettextCatalog, scannerService, $window, externalLinkService) {
3+
angular.module('copayApp.controllers').controller('tabSendController', function($scope, $rootScope, $log, $timeout,
4+
$ionicScrollDelegate, addressbookService, profileService, lodash, $state, walletService, incomingData, popupService,
5+
platformInfo, bwcError, gettextCatalog, scannerService, $window, externalLinkService, bitcore) {
46

57
var originalList;
68
var CONTACTS_SHOW_LIMIT;
79
var currentContactsPage;
10+
$scope.isSweeping = false;
811
$scope.isChromeApp = platformInfo.isChromeApp;
912

1013

14+
$scope.sweepBtnDisabled = function() {
15+
var isDisabled = true;
16+
17+
if ($scope.checkPrivateKey($scope.formData.search)) {
18+
isDisabled = false;
19+
}
20+
return isDisabled;
21+
};
22+
23+
1124
var hasWallets = function() {
1225
$scope.wallets = profileService.getWallets({
1326
onlyComplete: true
@@ -232,6 +245,28 @@ angular.module('copayApp.controllers').controller('tabSendController', function(
232245
});
233246
};
234247

248+
$scope.sweepAddressClickHandler = function(privateKey) {
249+
console.log('privateKey', privateKey);
250+
251+
$state.go('tabs.home').then(function() {
252+
$timeout(function() {
253+
$state.transitionTo('tabs.home.paperWallet', {
254+
privateKey: privateKey
255+
});
256+
}, 50);
257+
});
258+
};
259+
260+
261+
$scope.checkPrivateKey = function(privateKey) {
262+
try {
263+
new bitcore.PrivateKey(privateKey, 'livenet');
264+
} catch (err) {
265+
return false;
266+
}
267+
return true;
268+
}
269+
235270
$scope.$on("$ionicView.beforeEnter", function(event, data) {
236271

237272
$scope.checkingBalance = true;
@@ -250,11 +285,14 @@ angular.module('copayApp.controllers').controller('tabSendController', function(
250285
$scope.checkingBalance = false;
251286
return;
252287
}
253-
254288
updateHasFunds();
255289

256290
if (data.stateParams.address) {
257-
$scope.formData.search = data.stateParams.address;
291+
if (data.stateParams.address === 'sweep') {
292+
$scope.isSweeping = true;
293+
} else {
294+
$scope.formData.search = data.stateParams.address;
295+
}
258296
$timeout(function() {
259297
$scope.searchFocus = true;
260298
var element = $window.document.getElementById('tab-send-address');

src/sass/forms.scss

+6-1
Original file line numberDiff line numberDiff line change
@@ -1,3 +1,8 @@
11
.button-clear{
22
background: none !important;
3-
}
3+
}
4+
5+
#sweep-option {
6+
padding-top: 20px;
7+
padding-bottom: 20px;
8+
}

www/views/advancedSettings.html

+11
Original file line numberDiff line numberDiff line change
@@ -28,6 +28,17 @@
2828
<ion-toggle ng-model="hideNextSteps.value" ng-if="!isWindowsPhoneApp" toggle-class="toggle-balanced" ng-change="nextStepsChange()">
2929
<span class="toggle-label" translate>Hide Next Steps Card</span>
3030
</ion-toggle>
31+
32+
<div class="item item-divider"></div>
33+
34+
<a id="sweep-option" class="item has-setting-value item-icon-left item-icon-right" ui-sref="tabs.send({address: 'sweep'})">
35+
<i class="icon icon-svg">
36+
<img src="img/icon-receive.svg" class="bg"/>
37+
</i>
38+
<span class="setting-title">{{'Sweep Private Key' | translate}}</span>
39+
</a>
40+
<div class="item item-divider"></div>
41+
3142
</div>
3243
</ion-content>
3344
</ion-view>

www/views/tab-send.html

+34-6
Original file line numberDiff line numberDiff line change
@@ -3,8 +3,36 @@
33
<ion-nav-title>{{'Send' | translate}}</ion-nav-title>
44
</ion-nav-bar>
55
<ion-content>
6+
<div ng-if="isSweeping">
7+
<div class="send-header-wrapper card">
8+
<div class="item item-heading send-heading"><span translate>Private Key</span></div>
9+
<div class="item input search-wrapper" ng-class="{'focus': searchFocus}">
10+
<i class="icon icon-svg abs-v-center"><img class="svg" src="img/icon-bitcoin-symbol.svg"></i>
11+
<div class="item-icon-right">
12+
<input ng-model="formData.search"
13+
ng-change="findContact(formData.search)"
14+
ng-model-onblur ng-focus="searchInFocus()"
15+
ng-blur="searchBlurred()"
16+
placeholder="{{'Enter a Nav Coin Private Key to sweep with' | translate}}"
17+
type="text"
18+
class="search-input"
19+
id="tab-sweep-address" >
20+
<i class="icon icon-svg qr abs-v-center separator-left" on-tap="openScanner()"><img src="img/scan-ico.svg"></i>
21+
</div>
22+
</div>
23+
<div class="send-next-button">
624

7-
<div ng-if="hasFunds">
25+
<button ng-disabled="sweepBtnDisabled()"
26+
ng-class="{disable: sweepBtnDisabled()}"
27+
ng-click="sweepAddressClickHandler(formData.search)"
28+
class="button button-standard button-primary" >
29+
<span class="button-label" translate>Sweep Address</span>
30+
</button>
31+
</div>
32+
</div>
33+
</div>
34+
35+
<div ng-if="hasFunds && !isSweeping">
836
<div class="send-header-wrapper card">
937
<div class="item item-heading send-heading"><span translate>Recipient</span></div>
1038
<div class="item input search-wrapper" ng-class="{'focus': searchFocus}">
@@ -20,15 +48,15 @@
2048
</ion-toggle>
2149
</div>
2250
<div class="send-next-button">
23-
<button ng-disabled="nextDisabled" class="button button-standard button-primary" ng-class="{disable: nextDisabled}" ng-click="nextClicked(formData.search)">
51+
<button ng-disabled="nextDisabled" class="button button-standard button-primary"
52+
ng-class="{disable: nextDisabled}" ng-click="nextClicked(formData.search)">
2453
<span class="button-label" translate>Next</span>
2554
</button>
2655
</div>
2756
</div>
28-
2957
</div>
3058

31-
<div ng-if="!checkingBalance && (!hasFunds || !hasWallets)">
59+
<div ng-if="!checkingBalance && !isSweeping && (!hasFunds || !hasWallets)">
3260
<div class="list card sendTip">
3361
<div class="item item-icon-right item-heading"></div>
3462
<div>
@@ -51,7 +79,7 @@
5179
</div>
5280
</div>
5381

54-
<div class="card" ng-if="hasContacts && hasWallets && hasFunds">
82+
<div class="card" ng-if="hasContacts && hasWallets && hasFunds && !isSweeping">
5583
<div class="item item-icon-right item-heading">
5684
<span translate>Contacts</span>
5785
<a ng-if="hasContacts" ui-sref="tabs.send.addressbook">
@@ -73,7 +101,7 @@
73101
</div>
74102
</div>
75103

76-
<div class="card" ng-if="showTransferCard && hasFunds">
104+
<div class="card" ng-if="showTransferCard && hasFunds && !isSweeping">
77105
<div class="item item-heading">
78106
<span translate>Transfer to Wallet</span>
79107
</div>

0 commit comments

Comments
 (0)