Merge pull request #785 from maraoz/bug/remove-rogue-notifications
remove some extra old-style notifications
This commit is contained in:
commit
0bfbad880d
5 changed files with 24 additions and 41 deletions
19
index.html
19
index.html
|
|
@ -81,25 +81,6 @@
|
||||||
|
|
||||||
</div>
|
</div>
|
||||||
|
|
||||||
<div class="row" ng-if="updateVersion">
|
|
||||||
<div class="small-9 large-centered columns">
|
|
||||||
<div data-alert class="alert-box radius {{updateVersion.class}}">
|
|
||||||
A newer version of Copay is now available ({{updateVersion.version}}), please update your wallet.
|
|
||||||
Check <a href="http://www.copay.io">Copay.io</a> for details.
|
|
||||||
</div>
|
|
||||||
</div>
|
|
||||||
</div>
|
|
||||||
|
|
||||||
<div class="row" ng-if='$root.insightError>0'>
|
|
||||||
<div class="small-8 large-centered columns">
|
|
||||||
<div data-alert class="alert-box radius error">
|
|
||||||
Having troubles connecting to Insight server. Check
|
|
||||||
you settings and Internet connection.<br>
|
|
||||||
Reconnect Atempt #{{$root.insightError}}
|
|
||||||
</div>
|
|
||||||
</div>
|
|
||||||
</div>
|
|
||||||
|
|
||||||
<div ng-if='$root.wallet && !$root.wallet.isReady() && !loading'>
|
<div ng-if='$root.wallet && !$root.wallet.isReady() && !loading'>
|
||||||
<div class="row">
|
<div class="row">
|
||||||
<div class="large-12 medium-12 small-12 columns">
|
<div class="large-12 medium-12 small-12 columns">
|
||||||
|
|
|
||||||
|
|
@ -30,16 +30,14 @@ angular.module('copayApp.controllers').controller('HeaderController',
|
||||||
};
|
};
|
||||||
var latestVersion = data[0].name.replace('v', '').split('.').map(toInt);
|
var latestVersion = data[0].name.replace('v', '').split('.').map(toInt);
|
||||||
var currentVersion = copay.version.split('.').map(toInt);
|
var currentVersion = copay.version.split('.').map(toInt);
|
||||||
|
var title = 'Copay '+data[0].name+' available.';
|
||||||
|
var content;
|
||||||
if (currentVersion[0] < latestVersion[0]) {
|
if (currentVersion[0] < latestVersion[0]) {
|
||||||
$scope.updateVersion = {
|
content = 'It\'s important that you update your wallet at https://copay.io';
|
||||||
class: 'error',
|
notification.version(title, content, true);
|
||||||
version: data[0].name
|
|
||||||
};
|
|
||||||
} else if (currentVersion[0] == latestVersion[0] && currentVersion[1] < latestVersion[1]) {
|
} else if (currentVersion[0] == latestVersion[0] && currentVersion[1] < latestVersion[1]) {
|
||||||
$scope.updateVersion = {
|
var content = 'Please update your wallet at https://copay.io';
|
||||||
class: 'info',
|
notification.version(title, content, false);
|
||||||
version: data[0].name
|
|
||||||
};
|
|
||||||
}
|
}
|
||||||
});
|
});
|
||||||
|
|
||||||
|
|
@ -49,14 +47,16 @@ angular.module('copayApp.controllers').controller('HeaderController',
|
||||||
$rootScope.txAlertCount = 0;
|
$rootScope.txAlertCount = 0;
|
||||||
$rootScope.insightError = 0;
|
$rootScope.insightError = 0;
|
||||||
|
|
||||||
|
|
||||||
$rootScope.$watch('insightError', function(status) {
|
$rootScope.$watch('insightError', function(status) {
|
||||||
if (status === -1) {
|
if (status === -1) {
|
||||||
notification.success('Networking restored', 'Connection to insight restored');
|
notification.success('Networking restored', 'Connection to Insight re-established');
|
||||||
$rootScope.insightError = 0;
|
//$rootScope.insightError = 0;
|
||||||
|
} else if (status !== 0) {
|
||||||
|
notification.error('Networking problem', 'Connection to Insight lost, reconnecting (attempt number '+status+')');
|
||||||
}
|
}
|
||||||
});
|
});
|
||||||
|
|
||||||
|
|
||||||
// Init socket handlers (with no wallet yet)
|
// Init socket handlers (with no wallet yet)
|
||||||
controllerUtils.setSocketHandlers();
|
controllerUtils.setSocketHandlers();
|
||||||
|
|
||||||
|
|
|
||||||
|
|
@ -69,13 +69,6 @@ angular.module('copayApp.services')
|
||||||
$rootScope.txAlertCount = 0;
|
$rootScope.txAlertCount = 0;
|
||||||
$rootScope.insightError = 0;
|
$rootScope.insightError = 0;
|
||||||
$rootScope.isCollapsed = true;
|
$rootScope.isCollapsed = true;
|
||||||
$rootScope.$watch('insightError', function(status) {
|
|
||||||
if (status === -1) {
|
|
||||||
notification.success('Networking restored', 'Connection to Insight re-established');
|
|
||||||
$rootScope.insightError = 0;
|
|
||||||
}
|
|
||||||
});
|
|
||||||
|
|
||||||
$rootScope.$watch('txAlertCount', function(txAlertCount) {
|
$rootScope.$watch('txAlertCount', function(txAlertCount) {
|
||||||
if (txAlertCount && txAlertCount > 0) {
|
if (txAlertCount && txAlertCount > 0) {
|
||||||
notification.info('New Transaction', ($rootScope.txAlertCount == 1) ? 'You have a pending transaction proposal' : 'You have ' + $rootScope.txAlertCount + ' pending transaction proposals', txAlertCount);
|
notification.info('New Transaction', ($rootScope.txAlertCount == 1) ? 'You have a pending transaction proposal' : 'You have ' + $rootScope.txAlertCount + ' pending transaction proposals', txAlertCount);
|
||||||
|
|
|
||||||
|
|
@ -16,6 +16,10 @@ factory('notification', ['$timeout',
|
||||||
duration: 5000,
|
duration: 5000,
|
||||||
enabled: true
|
enabled: true
|
||||||
},
|
},
|
||||||
|
version: {
|
||||||
|
duration: 60000,
|
||||||
|
enabled: true
|
||||||
|
},
|
||||||
warning: {
|
warning: {
|
||||||
duration: 5000,
|
duration: 5000,
|
||||||
enabled: true
|
enabled: true
|
||||||
|
|
@ -135,6 +139,10 @@ factory('notification', ['$timeout',
|
||||||
return this.awesomeNotify('funds', 'bitcoin', title, content, userData);
|
return this.awesomeNotify('funds', 'bitcoin', title, content, userData);
|
||||||
},
|
},
|
||||||
|
|
||||||
|
version: function(title, content, severe) {
|
||||||
|
return this.awesomeNotify('version', severe ? 'alert' : 'flag', title, content);
|
||||||
|
},
|
||||||
|
|
||||||
error: function(title, content, userData) {
|
error: function(title, content, userData) {
|
||||||
return this.awesomeNotify('error', 'x', title, content, userData);
|
return this.awesomeNotify('error', 'x', title, content, userData);
|
||||||
},
|
},
|
||||||
|
|
|
||||||
|
|
@ -261,13 +261,14 @@ describe("Unit: Controllers", function() {
|
||||||
$httpBackend.flush();
|
$httpBackend.flush();
|
||||||
});
|
});
|
||||||
|
|
||||||
it('should check version ', function() {
|
it('should check version ', inject(function($injector) {
|
||||||
|
notification = $injector.get('notification');
|
||||||
|
var spy = sinon.spy(notification, 'version');
|
||||||
$httpBackend.expectGET(GH);
|
$httpBackend.expectGET(GH);
|
||||||
scope.$apply();
|
scope.$apply();
|
||||||
$httpBackend.flush();
|
$httpBackend.flush();
|
||||||
expect(scope.updateVersion.class).equal('error');
|
spy.calledOnce.should.equal(true);
|
||||||
expect(scope.updateVersion.version).equal('v100.1.6');
|
}));
|
||||||
});
|
|
||||||
|
|
||||||
it('should check blockChainStatus', function() {
|
it('should check blockChainStatus', function() {
|
||||||
$httpBackend.expectGET(GH);
|
$httpBackend.expectGET(GH);
|
||||||
|
|
|
||||||
Loading…
Add table
Add a link
Reference in a new issue