Merge pull request #2605 from matiu/bug/notif2

WIP: Bug/notif2
This commit is contained in:
Matias Alejo Garcia 2015-04-23 23:00:18 -03:00
commit e2b5e74664
7 changed files with 64 additions and 67 deletions

View File

@ -26,9 +26,6 @@
<div ng-include="'views/includes/sidebar.html'" ng-if="index.hasProfile"></div> <div ng-include="'views/includes/sidebar.html'" ng-if="index.hasProfile"></div>
<div notifications="right top"></div> <div notifications="right top"></div>
<div ng-include="'views/includes/offline.html'" ng-if="index.isOffline"></div>
<div ng-include="'views/includes/clientError.html'" ng-if="index.clientError"></div>
<div ng-include="'views/includes/password.html'" ng-if="index.askPassword" <div ng-include="'views/includes/password.html'" ng-if="index.askPassword"
></div> ></div>

View File

@ -1 +0,0 @@
<div class="extra-margin-bottom"></div>

View File

@ -1,11 +0,0 @@
<div class="client-error dr-notification-wrapper">
<div class="dr-notification">
<div class="dr-notification-image">
<i class="fi-alert"></i>
</div>
<div class="dr-notification-content">
<h3 class="dr-notification-title">Wallet Service Error</h3>
<div class="dr-notification-text ellipsis">{{index.clientError.message || index.clientError}}</div>
</div>
</div>
</div>

View File

@ -1,11 +0,0 @@
<div class="offline dr-notification-wrapper">
<div class="dr-notification">
<div class="dr-notification-image">
<i class="fi-alert"></i>
</div>
<div class="dr-notification-content">
<h3 class="dr-notification-title">{{'Could not connect to Wallet Service'|translate}}</h3>
<div class="dr-notification-text ellipsis animated infinite flash">{{'Trying to reconnnect...'|translate}}</div>
</div>
</div>
</div>

View File

@ -1,6 +1,43 @@
<div ng-controller="walletHomeController as home"> <div ng-controller="walletHomeController as home">
<div class="row columns m20tp" ng-show="index.noFocusedWallet">
<div class="text-center text-warning m20b">
<i class="fi-alert"></i> <span translate>You do not have any wallet</span>
</div>
<button class="button black expand" ng-click="$root.go('add')" translate>Create</button>
</div>
<div class="onGoingProcess" ng-show="index.isOffline" style="background-color:#222">
<div class="spinner">
<div class="rect1"></div>
<div class="rect2"></div>
<div class="rect3"></div>
<div class="rect4"></div>
<div class="rect5"></div>
</div>
<span translate>Reconnecting to Wallet Server...</span>
</div>
<div class="onGoingProcess" ng-show="index.anyOnGoingProcess && !index.isOffline" ng-style="{'background-color':index.backgroundColor}">
<div class="spinner">
<div class="rect1"></div>
<div class="rect2"></div>
<div class="rect3"></div>
<div class="rect4"></div>
<div class="rect5"></div>
</div>
<span translate ng-show="
index.onGoingProcessName == 'openingWallet'
|| index.onGoingProcessName == 'updatingStatus'
|| index.onGoingProcessName == 'updatingBalance'
"> Updating Wallet... </span>
<span translate ng-show="index.onGoingProcessName == 'scanning'">Scanning Wallet funds...</span>
<span translate ng-show="index.onGoingProcessName == 'recreating'">Recreating Wallet...</span>
</div>
<div class="oh" ng-show="!index.noFocusedWallet">
<div id="walletHome" class="walletHome tab-view tab-in"> <div id="walletHome" class="walletHome tab-view tab-in">
<div class="oh" ng-show="!index.noFocusedWallet">
<div class="amount" ng-style="{'background-color':index.backgroundColor}"> <div class="amount" ng-style="{'background-color':index.backgroundColor}">
<div ng-if="!index.anyOnGoingProcess && !index.notAuthorized"> <div ng-if="!index.anyOnGoingProcess && !index.notAuthorized">
<div ng-show="index.updateError" ng-click='index.openWallet()'> <div ng-show="index.updateError" ng-click='index.openWallet()'>
@ -27,7 +64,7 @@
<strong>...</strong> <strong>...</strong>
</div> </div>
</div> </div>
</div> </div> <!-- amount -->
<div class="pr columns line-b"> <div class="pr columns line-b">
<div class="avatar-wallet left" <div class="avatar-wallet left"
ng-style="{'background-color':index.backgroundColor}">{{index.walletName | limitTo: 1}}</div> ng-style="{'background-color':index.backgroundColor}">{{index.walletName | limitTo: 1}}</div>
@ -50,23 +87,8 @@
</div> </div>
</div> </div>
<div class="onGoingProcess" ng-show="index.anyOnGoingProcess" ng-style="{'background-color':index.backgroundColor}">
<div class="spinner">
<div class="rect1"></div>
<div class="rect2"></div>
<div class="rect3"></div>
<div class="rect4"></div>
<div class="rect5"></div>
</div>
<span translate ng-show="index.onGoingProcessName == 'openingWallet'"> Updating Wallet... </span>
<span translate ng-show="index.onGoingProcessName == 'updatingStatus'"> Updating Status...</span>
<span translate ng-show="index.onGoingProcessName == 'updatingBalance'">Updating Wallet... </span>
<span translate ng-show="index.onGoingProcessName == 'updatingPendingTxps'">Updating Wallet...</span>
<span translate ng-show="index.onGoingProcessName == 'scanning'">Scanning Wallet funds...</span>
<span translate ng-show="index.onGoingProcessName == 'recreating'">Recreating Wallet...</span>
</div>
<div class="m20t" ng-show="index.notAuthorized"> <div class="m20t" ng-show="index.notAuthorized && ! index.anyOnGoingProcess">
<div class="text-center text-warning"> <div class="text-center text-warning">
<i class="fi-alert"></i> <i class="fi-alert"></i>
<span translate> <span translate>
@ -174,7 +196,7 @@
<div class="row m20t" ng-if="home.addr"> <div class="row m20t" ng-if="home.addr">
<div class="large-12 columns"> <div class="large-12 columns">
<button class="button black expand radius" ng-click="home.newAddress()" <button class="button black expand radius" ng-click="home.newAddress()"
ng-style="{'background-color':index.backgroundColor}" ng-disabled="home.generatingAddress" translate> ng-style="{'background-color':index.backgroundColor}" ng-disabled="home.generatingAddress || index.isOffline" translate>
Generate new address Generate new address
</button> </button>
</div> </div>
@ -317,7 +339,7 @@
<a ng-click="home.resetForm(sendForm)" class="button expand outline dark-gray" translate>Cancel</a> <a ng-click="home.resetForm(sendForm)" class="button expand outline dark-gray" translate>Cancel</a>
</div> </div>
<div class="columns" ng-class="{'small-6 medium-6 large-6':(home._paypro || home.lockAddress)}"> <div class="columns" ng-class="{'small-6 medium-6 large-6':(home._paypro || home.lockAddress)}">
<button type="submit" class="button black radius expand" ng-disabled="sendForm.$invalid || home.blockUx" <button type="submit" class="button black radius expand" ng-disabled="sendForm.$invalid || home.blockUx || index.isOffline"
ng-style="{'background-color':index.backgroundColor}" translate> ng-style="{'background-color':index.backgroundColor}" translate>
Send Send
</button> </button>
@ -343,7 +365,7 @@ history
<span ng-if="!index.updatingTxHistory"> <span ng-if="!index.updatingTxHistory">
<span ng-show="index.txHistoryError && !index.notAuthorized" ng-click='index.openWallet()'> <span ng-show="index.txHistoryError && !index.notAuthorized" ng-click='index.openWallet()'>
<span translate>Could not fetch transaction history</span> <span translate>Could not fetch transaction history</span>
<br> [<span translate>Tap to retry</span>] <br> <span translate>Tap to retry</span>
</span> </span>
<span ng-if="!index.txHistoryError" translate> <span ng-if="!index.txHistoryError" translate>
No transactions yet No transactions yet
@ -401,15 +423,5 @@ history
</div> </div>
<!-- END -->
<div class="row columns m20tp" ng-show="index.noFocusedWallet">
<div class="text-center text-warning m20b">
<i class="fi-alert"></i> <span translate>You do not have any wallet</span>
</div>
<button class="button black expand" ng-click="$root.go('add')" translate>Create</button>
</div>
</div> </div>
<div class="extra-margin-bottom"></div> <div class="extra-margin-bottom"></div>

View File

@ -1110,12 +1110,12 @@ input.ng-invalid-match, input.ng-invalid-match:focus {
.onGoingProcess { .onGoingProcess {
background: #213140; background: #213140;
text-align: center; text-align: center;
max-width: 14.5rem; max-width: 16.5rem;
max-height: 3.5rem; max-height: 3.5rem;
top:auto; top:auto;
left:0; left:0;
right:0; right:0;
bottom:90px; bottom:170px;
margin: auto; margin: auto;
border-radius: 3px; border-radius: 3px;
color: #fff; color: #fff;
@ -1123,6 +1123,7 @@ input.ng-invalid-match, input.ng-invalid-match:focus {
font-size: 13px; font-size: 13px;
position: absolute; position: absolute;
opacity: 0.8; opacity: 0.8;
z-index: 1000;
} }

View File

@ -72,7 +72,6 @@ angular.module('copayApp.controllers').controller('indexController', function($r
self.alternativeBalanceAvailable = false; self.alternativeBalanceAvailable = false;
self.totalBalanceAlternative = null; self.totalBalanceAlternative = null;
self.notAuthorized = false; self.notAuthorized = false;
self.clientError = null;
self.txHistory = []; self.txHistory = [];
self.txHistoryPaging = false; self.txHistoryPaging = false;
@ -411,17 +410,27 @@ angular.module('copayApp.controllers').controller('indexController', function($r
}; };
self.clientError = function (err) {
if (isCordova) {
navigator.notification.confirm(
err,
function() {},
'Wallet Server Error', ['OK']
);
} else {
alert(err);
}
};
self.recreate = function(cb) { self.recreate = function(cb) {
var fc = profileService.focusedClient; var fc = profileService.focusedClient;
self.setOngoingProcess('recreating', true); self.setOngoingProcess('recreating', true);
self.clientError = null;
fc.recreateWallet(function(err) { fc.recreateWallet(function(err) {
self.notAuthorized = false; self.notAuthorized = false;
self.setOngoingProcess('recreating', false); self.setOngoingProcess('recreating', false);
if (err) { if (err) {
self.clientError = 'Could not recreate wallet:' + err; self.clientError('Could not recreate wallet:' + err);
$rootScope.$apply(); $rootScope.$apply();
return; return;
} }
@ -458,7 +467,7 @@ angular.module('copayApp.controllers').controller('indexController', function($r
if (err) { if (err) {
if (self.walletId == walletId) if (self.walletId == walletId)
self.setOngoingProcess('scanning', false); self.setOngoingProcess('scanning', false);
self.clientError = 'Could not scan wallet:' + err; self.clientError = ('Could not scan wallet:' + err);
$rootScope.$apply(); $rootScope.$apply();
} }
}); });
@ -522,7 +531,6 @@ angular.module('copayApp.controllers').controller('indexController', function($r
$rootScope.$on(eventName, function(event) { $rootScope.$on(eventName, function(event) {
$log.debug('### Online event'); $log.debug('### Online event');
self.isOffline = false; self.isOffline = false;
self.clientError = null;
self.updateAll(); self.updateAll();
self.updateTxHistory(); self.updateTxHistory();
}); });
@ -531,6 +539,9 @@ angular.module('copayApp.controllers').controller('indexController', function($r
$rootScope.$on('Local/Offline', function(event) { $rootScope.$on('Local/Offline', function(event) {
$log.debug('Offline event'); $log.debug('Offline event');
self.isOffline = true; self.isOffline = true;
$timeout(function(){
$rootScope.$apply();
});
}); });
$rootScope.$on('Local/BackupDone', function(event) { $rootScope.$on('Local/BackupDone', function(event) {
@ -544,7 +555,7 @@ angular.module('copayApp.controllers').controller('indexController', function($r
}); });
$rootScope.$on('Local/BWSNotFound', function(event) { $rootScope.$on('Local/BWSNotFound', function(event) {
self.clientError = 'Could not access to Bitcore Wallet Service: Service not found'; self.clientError('Could not access to Bitcore Wallet Service: Service not found');
$rootScope.$apply(); $rootScope.$apply();
}); });
@ -557,7 +568,7 @@ angular.module('copayApp.controllers').controller('indexController', function($r
} else if (err.code === 'ETIMEDOUT') { } else if (err.code === 'ETIMEDOUT') {
$log.debug('Time out:', err); $log.debug('Time out:', err);
} else { } else {
self.clientError = err; self.clientError(err && err.message ? 'Error at Bitcore Wallet Service:' + err.message : err);
} }
$rootScope.$apply(); $rootScope.$apply();
}); });
@ -627,7 +638,6 @@ angular.module('copayApp.controllers').controller('indexController', function($r
$timeout(function() { $timeout(function() {
self.hasProfile = true; self.hasProfile = true;
self.noFocusedWallet = true; self.noFocusedWallet = true;
self.clientError = null;
self.isComplete = null; self.isComplete = null;
self.walletName = null; self.walletName = null;
go.addWallet(); go.addWallet();