Merge pull request #161 from gabrielbazan7/fix/copayers1
go from create new shared to copayers
This commit is contained in:
commit
6f7c4fc1c5
6 changed files with 77 additions and 60 deletions
|
|
@ -11,7 +11,6 @@
|
||||||
</button>
|
</button>
|
||||||
</ion-nav-buttons>
|
</ion-nav-buttons>
|
||||||
</ion-nav-bar>
|
</ion-nav-bar>
|
||||||
</ion-nav-bar>
|
|
||||||
|
|
||||||
<ion-content>
|
<ion-content>
|
||||||
|
|
||||||
|
|
|
||||||
|
|
@ -3,22 +3,26 @@
|
||||||
<ion-nav-bar class="bar-royal">
|
<ion-nav-bar class="bar-royal">
|
||||||
<ion-nav-back-button>
|
<ion-nav-back-button>
|
||||||
</ion-nav-back-button>
|
</ion-nav-back-button>
|
||||||
|
<ion-nav-title>{{wallet.name}}</ion-nav-title>
|
||||||
</ion-nav-bar>
|
</ion-nav-bar>
|
||||||
|
|
||||||
<ion-content ng-controller="copayersController">
|
<ion-content>
|
||||||
<div ng-show="!wallet.notAuthorized">
|
<div ng-show="!wallet.notAuthorized">
|
||||||
<h1 class="text-center" translate>Share this invitation with your copayers</h1>
|
<div class="list card text-center">
|
||||||
|
<a class="item item-heading" ng-style="{'border-width': 0}" translate>
|
||||||
<div ng-click="copySecret()" ng-class="{'enable_text_select': !isCordova}">
|
Share this invitation with your copayers
|
||||||
<div class="text-center" copy-to-clipboard="secret">
|
</a>
|
||||||
<qrcode size="220" error-correction-level="L" data="{{secret}}"></qrcode>
|
<div ng-click="copySecret()" ng-class="{'enable_text_select': !isCordova}">
|
||||||
<div ng-show="!secret" style="position:relative; top:-226px; height:0px">
|
<div class="text-center" copy-to-clipboard="secret">
|
||||||
<div style="height:220px; width:220px; margin:auto; background: white">
|
<qrcode size="220" error-correction-level="L" data="{{secret}}"></qrcode>
|
||||||
<ion-spinner class="spinner-dark" icon="lines"></ion-spinner>
|
<div ng-show="!secret" style="position:relative; top:-226px; height:0px">
|
||||||
|
<div style="height:220px; width:220px; margin:auto; background: white">
|
||||||
|
<ion-spinner class="spinner-dark" icon="lines"></ion-spinner>
|
||||||
|
</div>
|
||||||
|
</div>
|
||||||
|
<div class="secret" ng-show="!isCordova">
|
||||||
|
{{secret || ('Loading...'|translate)}}
|
||||||
</div>
|
</div>
|
||||||
</div>
|
|
||||||
<div class="secret" ng-show="!isCordova">
|
|
||||||
{{secret || ('Loading...'|translate)}}
|
|
||||||
</div>
|
</div>
|
||||||
</div>
|
</div>
|
||||||
</div>
|
</div>
|
||||||
|
|
@ -44,12 +48,6 @@
|
||||||
<i class="icon ion-loop"></i>
|
<i class="icon ion-loop"></i>
|
||||||
<span translate>Waiting...</span>
|
<span translate>Waiting...</span>
|
||||||
</div>
|
</div>
|
||||||
|
|
||||||
<div ng-if="wallet.isComplete()" class="line-b p10 white size-12" href>
|
|
||||||
<button class="button" href ui-sref="tabs.home">
|
|
||||||
<span translate>WALLET COMPLETE!</span>
|
|
||||||
</button>
|
|
||||||
</div>
|
|
||||||
</div>
|
</div>
|
||||||
|
|
||||||
<div class="m20b text-center" ng-show="wallet.notAuthorized">
|
<div class="m20b text-center" ng-show="wallet.notAuthorized">
|
||||||
|
|
|
||||||
|
|
@ -1,24 +1,43 @@
|
||||||
'use strict';
|
'use strict';
|
||||||
|
|
||||||
angular.module('copayApp.controllers').controller('copayersController',
|
angular.module('copayApp.controllers').controller('copayersController',
|
||||||
function($scope, $log, $ionicNavBarDelegate, $timeout, $stateParams, $state, $rootScope, lodash, profileService, walletService, popupService, platformInfo, gettextCatalog, ongoingProcess) {
|
function($scope, $log, $ionicNavBarDelegate, $timeout, $stateParams, $state, $rootScope, $ionicHistory, lodash, profileService, walletService, popupService, platformInfo, gettextCatalog, ongoingProcess) {
|
||||||
if (!$stateParams.walletId) {
|
|
||||||
$log.debug('No wallet provided...back to home');
|
|
||||||
return $state.go('tabs.home');
|
|
||||||
}
|
|
||||||
|
|
||||||
var wallet = profileService.getWallet($stateParams.walletId);
|
$scope.$on("$ionicView.beforeEnter", function(event, data) {
|
||||||
$ionicNavBarDelegate.title(wallet.name);
|
init();
|
||||||
|
});
|
||||||
|
|
||||||
var secret;
|
var init = function() {
|
||||||
try {
|
$scope.isCordova = platformInfo.isCordova;
|
||||||
secret = wallet.status.wallet.secret;
|
$scope.wallet = profileService.getWallet($stateParams.walletId);
|
||||||
} catch (e) {};
|
updateWallet();
|
||||||
|
};
|
||||||
|
|
||||||
$scope.wallet = wallet;
|
$rootScope.$on('bwsEvent', function() {
|
||||||
$scope.secret = secret;
|
updateWallet();
|
||||||
$scope.copayers = wallet.status.wallet.copayers;
|
});
|
||||||
$scope.isCordova = platformInfo.isCordova;
|
|
||||||
|
var updateWallet = function() {
|
||||||
|
$log.debug('Updating wallet:' + $scope.wallet.name)
|
||||||
|
walletService.getStatus($scope.wallet, {}, function(err, status) {
|
||||||
|
if (err) {
|
||||||
|
$log.error(err); //TODO
|
||||||
|
return;
|
||||||
|
}
|
||||||
|
$scope.wallet.status = status;
|
||||||
|
$scope.copayers = $scope.wallet.status.wallet.copayers;
|
||||||
|
$scope.secret = $scope.wallet.status.wallet.secret;
|
||||||
|
$timeout(function() {
|
||||||
|
$scope.$apply();
|
||||||
|
});
|
||||||
|
if (status.wallet.status == 'complete') {
|
||||||
|
$scope.wallet.openWallet(function(err, status) {
|
||||||
|
if (err) $log.error(err);
|
||||||
|
$scope.goHome();
|
||||||
|
});
|
||||||
|
}
|
||||||
|
});
|
||||||
|
};
|
||||||
|
|
||||||
$scope.showDeletePopup = function() {
|
$scope.showDeletePopup = function() {
|
||||||
popupService.showConfirm(gettextCatalog.getString('Confirm'), gettextCatalog.getString('Are you sure you want to delete this wallet?'), null, null, function(res) {
|
popupService.showConfirm(gettextCatalog.getString('Confirm'), gettextCatalog.getString('Are you sure you want to delete this wallet?'), null, null, function(res) {
|
||||||
|
|
@ -28,19 +47,19 @@ angular.module('copayApp.controllers').controller('copayersController',
|
||||||
|
|
||||||
function deleteWallet() {
|
function deleteWallet() {
|
||||||
ongoingProcess.set('deletingWallet', true);
|
ongoingProcess.set('deletingWallet', true);
|
||||||
profileService.deleteWalletClient(wallet, function(err) {
|
profileService.deleteWalletClient($scope.wallet, function(err) {
|
||||||
ongoingProcess.set('deletingWallet', false);
|
ongoingProcess.set('deletingWallet', false);
|
||||||
if (err) {
|
if (err) {
|
||||||
popupService.showAlert(gettextCatalog.getString('Error'), err.message || err);
|
popupService.showAlert(gettextCatalog.getString('Error'), err.message || err);
|
||||||
} else {
|
} else {
|
||||||
$state.go('tabs.home');
|
$scope.goHome();
|
||||||
}
|
}
|
||||||
});
|
});
|
||||||
};
|
};
|
||||||
|
|
||||||
$scope.copySecret = function() {
|
$scope.copySecret = function() {
|
||||||
if ($scope.isCordova) {
|
if ($scope.isCordova) {
|
||||||
window.cordova.plugins.clipboard.copy(secret);
|
window.cordova.plugins.clipboard.copy($scope.secret);
|
||||||
window.plugins.toast.showShortCenter(gettextCatalog.getString('Copied to clipboard'));
|
window.plugins.toast.showShortCenter(gettextCatalog.getString('Copied to clipboard'));
|
||||||
}
|
}
|
||||||
};
|
};
|
||||||
|
|
@ -48,28 +67,15 @@ angular.module('copayApp.controllers').controller('copayersController',
|
||||||
$scope.shareSecret = function() {
|
$scope.shareSecret = function() {
|
||||||
if ($scope.isCordova) {
|
if ($scope.isCordova) {
|
||||||
var message = gettextCatalog.getString('Join my Copay wallet. Here is the invitation code: {{secret}} You can download Copay for your phone or desktop at https://copay.io', {
|
var message = gettextCatalog.getString('Join my Copay wallet. Here is the invitation code: {{secret}} You can download Copay for your phone or desktop at https://copay.io', {
|
||||||
secret: secret
|
secret: $scope.secret
|
||||||
});
|
});
|
||||||
window.plugins.socialsharing.share(message, gettextCatalog.getString('Invitation to share a Copay Wallet'), null, null);
|
window.plugins.socialsharing.share(message, gettextCatalog.getString('Invitation to share a Copay Wallet'), null, null);
|
||||||
}
|
}
|
||||||
};
|
};
|
||||||
|
|
||||||
$rootScope.$on('bwsEvent', function() {
|
$scope.goHome = function() {
|
||||||
updateWallet();
|
$ionicHistory.removeBackView();
|
||||||
});
|
$state.go('tabs.home');
|
||||||
|
|
||||||
var updateWallet = function() {
|
|
||||||
$log.debug('Updating wallet:' + wallet.name)
|
|
||||||
walletService.getStatus(wallet, {}, function(err, status) {
|
|
||||||
if (err) {
|
|
||||||
$log.error(err); //TODO
|
|
||||||
return;
|
|
||||||
}
|
|
||||||
wallet.status = status;
|
|
||||||
$scope.copayers = wallet.status.wallet.copayers;
|
|
||||||
$timeout(function() {
|
|
||||||
$scope.$apply();
|
|
||||||
});
|
|
||||||
});
|
|
||||||
};
|
};
|
||||||
|
|
||||||
});
|
});
|
||||||
|
|
|
||||||
|
|
@ -1,7 +1,7 @@
|
||||||
'use strict';
|
'use strict';
|
||||||
|
|
||||||
angular.module('copayApp.controllers').controller('createController',
|
angular.module('copayApp.controllers').controller('createController',
|
||||||
function($scope, $rootScope, $timeout, $log, lodash, $state, $ionicScrollDelegate, profileService, configService, gettext, gettextCatalog, ledger, trezor, platformInfo, derivationPathHelper, ongoingProcess, walletService, storageService, popupService) {
|
function($scope, $rootScope, $timeout, $log, lodash, $state, $ionicScrollDelegate, $ionicHistory, profileService, configService, gettext, gettextCatalog, ledger, trezor, platformInfo, derivationPathHelper, ongoingProcess, walletService, storageService, popupService) {
|
||||||
|
|
||||||
var isChromeApp = platformInfo.isChromeApp;
|
var isChromeApp = platformInfo.isChromeApp;
|
||||||
var isCordova = platformInfo.isCordova;
|
var isCordova = platformInfo.isCordova;
|
||||||
|
|
@ -175,7 +175,20 @@ angular.module('copayApp.controllers').controller('createController',
|
||||||
if ($scope.seedSource.id == 'set') {
|
if ($scope.seedSource.id == 'set') {
|
||||||
profileService.setBackupFlag(client.credentials.walletId);
|
profileService.setBackupFlag(client.credentials.walletId);
|
||||||
}
|
}
|
||||||
$state.go('tabs.home')
|
|
||||||
|
if (!client.isComplete()) {
|
||||||
|
$ionicHistory.nextViewOptions({
|
||||||
|
disableAnimate: true
|
||||||
|
});
|
||||||
|
$ionicHistory.removeBackView();
|
||||||
|
$state.go('tabs.home');
|
||||||
|
$timeout(function() {
|
||||||
|
$state.transitionTo('tabs.copayers', {
|
||||||
|
walletId: client.credentials.walletId
|
||||||
|
});
|
||||||
|
}, 100);
|
||||||
|
}
|
||||||
|
else $state.go('tabs.home')
|
||||||
});
|
});
|
||||||
}, 100);
|
}, 100);
|
||||||
}
|
}
|
||||||
|
|
|
||||||
|
|
@ -198,7 +198,7 @@ angular.module('copayApp.controllers').controller('tabHomeController',
|
||||||
});
|
});
|
||||||
});
|
});
|
||||||
|
|
||||||
$scope.$on("$ionicView.enter", function(event, data){
|
$scope.$on("$ionicView.enter", function(event, data) {
|
||||||
configService.whenAvailable(function() {
|
configService.whenAvailable(function() {
|
||||||
var config = configService.getSync();
|
var config = configService.getSync();
|
||||||
var isWindowsPhoneApp = platformInfo.isWP && platformInfo.isCordova;
|
var isWindowsPhoneApp = platformInfo.isWP && platformInfo.isCordova;
|
||||||
|
|
|
||||||
|
|
@ -396,7 +396,7 @@ angular.module('copayApp').config(function(historicLogProvider, $provide, $logPr
|
||||||
*
|
*
|
||||||
*/
|
*/
|
||||||
|
|
||||||
.state('tabs.preferences', {
|
.state('tabs.preferences', {
|
||||||
url: '/preferences/:walletId',
|
url: '/preferences/:walletId',
|
||||||
views: {
|
views: {
|
||||||
'tab-settings@tabs': {
|
'tab-settings@tabs': {
|
||||||
|
|
@ -559,7 +559,8 @@ angular.module('copayApp').config(function(historicLogProvider, $provide, $logPr
|
||||||
url: '/copayers/:walletId',
|
url: '/copayers/:walletId',
|
||||||
views: {
|
views: {
|
||||||
'tab-home': {
|
'tab-home': {
|
||||||
templateUrl: 'views/copayers.html'
|
templateUrl: 'views/copayers.html',
|
||||||
|
controller: 'copayersController'
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
})
|
})
|
||||||
|
|
|
||||||
Loading…
Add table
Add a link
Reference in a new issue