fix update on resume
This commit is contained in:
parent
32ae89046d
commit
9abccdba41
4 changed files with 31 additions and 13 deletions
|
|
@ -553,17 +553,27 @@ angular.module('copayApp.controllers').controller('indexController', function($r
|
|||
go.walletHome();
|
||||
});
|
||||
|
||||
self.debouncedUpdate = lodash.throttle(function() {
|
||||
self.updateAll();
|
||||
self.updateTxHistory();
|
||||
}, 4000, {leading: false, trailing: true});
|
||||
|
||||
|
||||
// No need ot listing to Local/Resume since
|
||||
// reconnection and Local/Online will be triggered
|
||||
lodash.each(['Local/Online', 'Local/Resume'], function(eventName) {
|
||||
$rootScope.$on(eventName, function(event) {
|
||||
$log.debug('### Online event');
|
||||
self.isOffline = false;
|
||||
self.updateAll();
|
||||
self.updateTxHistory();
|
||||
$log.debug('### ' + eventName + ' event');
|
||||
self.debouncedUpdate();
|
||||
});
|
||||
});
|
||||
|
||||
$rootScope.$on('Local/Online', function(event) {
|
||||
self.isOffline = false;
|
||||
});
|
||||
|
||||
$rootScope.$on('Local/Offline', function(event) {
|
||||
$log.debug('Offline event');
|
||||
$log.debug('### Offline event');
|
||||
self.isOffline = true;
|
||||
$timeout(function() {
|
||||
$rootScope.$apply();
|
||||
|
|
|
|||
|
|
@ -45,10 +45,22 @@ angular.module('copayApp.controllers').controller('walletHomeController', functi
|
|||
self.resetForm();
|
||||
});
|
||||
|
||||
var disableResumeListener = $rootScope.$on('Local/Resume', function() {
|
||||
self.bindTouchDown();
|
||||
var disableOnlineListener = $rootScope.$on('Local/Online', function() {
|
||||
// This is needed then the apps go to sleep
|
||||
$timeout(function() {
|
||||
self.bindTouchDown();
|
||||
}, 2000);
|
||||
});
|
||||
|
||||
var disableResumeListener = $rootScope.$on('Local/Resume', function() {
|
||||
// This is needed then the apps go to sleep
|
||||
$timeout(function() {
|
||||
self.bindTouchDown();
|
||||
}, 2000);
|
||||
});
|
||||
|
||||
|
||||
|
||||
var disableTabListener = $rootScope.$on('Local/TabChanged', function(e, tab) {
|
||||
// This will slow down switch, do not add things here!
|
||||
switch (tab) {
|
||||
|
|
@ -68,6 +80,7 @@ angular.module('copayApp.controllers').controller('walletHomeController', functi
|
|||
disableTabListener();
|
||||
disableFocusListener();
|
||||
disableResumeListener();
|
||||
disableOnlineListener();
|
||||
$rootScope.hideMenuBar = false;
|
||||
});
|
||||
|
||||
|
|
|
|||
|
|
@ -18,6 +18,8 @@ angular.element(document).ready(function() {
|
|||
}, false);
|
||||
|
||||
document.addEventListener('resume', function() {
|
||||
|
||||
console.log('[init.js.21] RESUME'); //TODO
|
||||
if (!window.ignoreMobilePause) {
|
||||
window.location = '#/cordova/resume';
|
||||
}
|
||||
|
|
@ -31,10 +33,6 @@ angular.element(document).ready(function() {
|
|||
document.addEventListener('offline', function() {
|
||||
window.location = '#/cordova/offline';
|
||||
}, false);
|
||||
//
|
||||
// document.addEventListener("online", function() {
|
||||
// window.location = '#/cordoba/online';
|
||||
// }, false);
|
||||
|
||||
// Back button event
|
||||
document.addEventListener('backbutton', function() {
|
||||
|
|
|
|||
|
|
@ -448,9 +448,6 @@ angular
|
|||
case 'resume':
|
||||
$rootScope.$emit('Local/Resume');
|
||||
break;
|
||||
// case 'online':
|
||||
// // $scope.$emit('Local/Online');
|
||||
// break;
|
||||
case 'offline':
|
||||
$rootScope.$emit('Local/Offline');
|
||||
break;
|
||||
|
|
|
|||
Loading…
Add table
Add a link
Reference in a new issue