Fix UI from copayers view. Fix redirect to home

This commit is contained in:
Gustavo Maximiliano Cortez 2017-05-24 09:44:04 -03:00
parent 6eedcd01a6
commit e98ce470f7
No known key found for this signature in database
GPG Key ID: 15EDAD8D9F2EB1AF
4 changed files with 64 additions and 27 deletions

View File

@ -1,7 +1,7 @@
'use strict';
angular.module('copayApp.controllers').controller('copayersController',
function($scope, $log, $timeout, $stateParams, $state, $rootScope, $ionicHistory, appConfigService, lodash, profileService, walletService, popupService, bwcError, platformInfo, gettextCatalog, ongoingProcess) {
function($scope, $log, $timeout, $stateParams, $state, $rootScope, $ionicHistory, appConfigService, lodash, profileService, walletService, popupService, bwcError, platformInfo, gettextCatalog, ongoingProcess, pushNotificationsService) {
var appName = appConfigService.userVisibleName;
var appUrl = appConfigService.url;
@ -10,6 +10,7 @@ angular.module('copayApp.controllers').controller('copayersController',
$scope.$on("$ionicView.beforeEnter", function(event, data) {
$scope.wallet = profileService.getWallet(data.stateParams.walletId);
updateWallet();
$scope.shareIcon = platformInfo.isIOS ? 'iOS' : 'Android';
});
var listener = $rootScope.$on('bwsEvent', function() {
@ -35,7 +36,12 @@ angular.module('copayApp.controllers').controller('copayersController',
if (status.wallet.status == 'complete') {
$scope.wallet.openWallet(function(err, status) {
if (err) $log.error(err);
$scope.goHome();
$scope.clearNextView();
$state.go('tabs.home').then(function() {
$state.transitionTo('tabs.wallet', {
walletId: $scope.wallet.credentials.walletId
});
});
});
}
});
@ -56,7 +62,9 @@ angular.module('copayApp.controllers').controller('copayersController',
if (err) {
popupService.showAlert(gettextCatalog.getString('Error'), err.message || err);
} else {
$scope.goHome();
pushNotificationsService.unsubscribe($scope.wallet);
$scope.clearNextView();
$state.go('tabs.home');
}
});
};
@ -81,9 +89,12 @@ angular.module('copayApp.controllers').controller('copayersController',
}
};
$scope.goHome = function() {
$state.go('tabs.home');
$ionicHistory.clearHistory();
$scope.clearNextView = function() {
$ionicHistory.nextViewOptions({
disableAnimate: true,
historyRoot: true
});
$ionicHistory.clearHistory();
};
});

View File

@ -24,6 +24,7 @@ $v-text-accent-color: #647ce8 !default;
$v-success-color: #13e5b6 !default;
$v-warning-color: #ffa500 !default;
$v-error-color: #ef473a !default;
$v-wallet-color-map: (
0: (color: #dd4b39, name: 'Cinnabar'),

View File

@ -1,13 +1,37 @@
.copayers-secret {
text-align: center;
font-size: 12px;
margin: 10px;
white-space: -moz-pre-wrap !important;
white-space: -pre-wrap;
white-space: -o-pre-wrap;
white-space: pre-wrap;
word-wrap: break-word;
white-space: -webkit-pre-wrap;
word-break: break-all;
white-space: normal;
#copayers-invitation {
@extend .deflash-blue;
.button-share {
color: #fff;
box-shadow: none;
border-color: transparent;
background: transparent;
padding: 0 10px;
.icon:before {
font-size: 26px;
}
}
.button-cancel {
margin-top: 15px;
background: transparent;
border: none;
font-size: 12px;
color: $v-error-color;
i.icon {
vertical-align: middle;
padding-left: 5px;
}
}
.copayers-secret {
text-align: center;
font-size: 12px;
margin: 10px;
white-space: -moz-pre-wrap !important;
white-space: -pre-wrap;
white-space: -o-pre-wrap;
white-space: pre-wrap;
word-wrap: break-word;
white-space: -webkit-pre-wrap;
word-break: break-all;
white-space: normal;
}
}

View File

@ -1,19 +1,23 @@
<ion-view>
<ion-view id="copayers-invitation">
<ion-nav-bar class="bar-royal">
<ion-nav-back-button>
</ion-nav-back-button>
<ion-nav-title>{{wallet.name}}</ion-nav-title>
<ion-nav-buttons side="secondary">
<button class="button button-clear" ng-click="showDeletePopup()">
Cancel
<button class="button-share ng-hide" ng-show="isCordova && secret" ng-click="shareSecret()">
<i class="icon"
ng-class="{
'ion-ios-upload-outline': shareIcon == 'iOS',
'ion-android-share-alt': shareIcon != 'iOS'
}"></i>
</button>
</ion-nav-buttons>
</ion-nav-bar>
<ion-content>
<div ng-show="!wallet.notAuthorized">
<div class="list card text-center">
<div class="list text-center">
<div class="item item-heading item-text-wrap" translate>
Share this invitation with your copayers
</div>
@ -29,11 +33,8 @@
{{secret || ('Loading...'|translate)}}
</div>
</div>
<button ng-if="isCordova && secret"
class="button button-primary button-outline button-small"
ng-click="shareSecret()">
<i class="icon ion-ios-upload-outline"></i>
<span translate>Share invitation</span>
<button ng-if="secret" class="button-cancel" ng-click="showDeletePopup()">
<span translate>Cancel invitation</span>
</button>
</div>
</div>