Automatically reload extensions status on expired
This commit is contained in:
@@ -23,7 +23,26 @@ angular.module('app')
|
||||
}
|
||||
})
|
||||
.controller('FooterCtrl', function ($rootScope, authManager, modelManager, $timeout, dbManager,
|
||||
syncManager, storageManager, passcodeManager, componentManager, singletonManager) {
|
||||
syncManager, storageManager, passcodeManager, componentManager, singletonManager, nativeExtManager) {
|
||||
|
||||
$rootScope.$on("reload-ext-data", () => {
|
||||
if(this.reloadInProgress) { return; }
|
||||
this.reloadInProgress = true;
|
||||
|
||||
// A reload occurs when the extensions manager window is opened. We can close it after a delay
|
||||
let extWindow = this.rooms.find((room) => {return room.package_info.identifier == nativeExtManager.extensionsManagerIdentifier});
|
||||
if(!extWindow) {
|
||||
return;
|
||||
}
|
||||
|
||||
this.selectRoom(extWindow);
|
||||
|
||||
$timeout(() => {
|
||||
this.selectRoom(extWindow);
|
||||
this.reloadInProgress = false;
|
||||
$rootScope.$broadcast("ext-reload-complete");
|
||||
}, 2000)
|
||||
});
|
||||
|
||||
this.getUser = function() {
|
||||
return authManager.user;
|
||||
@@ -151,4 +170,6 @@ angular.module('app')
|
||||
this.selectRoom = function(room) {
|
||||
room.showRoom = !room.showRoom;
|
||||
}
|
||||
|
||||
|
||||
});
|
||||
|
||||
@@ -1,6 +1,6 @@
|
||||
class ComponentView {
|
||||
|
||||
constructor(componentManager, desktopManager, $timeout) {
|
||||
constructor($rootScope, componentManager, desktopManager, $timeout) {
|
||||
this.restrict = "E";
|
||||
this.templateUrl = "directives/component-view.html";
|
||||
this.scope = {
|
||||
@@ -8,6 +8,7 @@ class ComponentView {
|
||||
manualDealloc: "="
|
||||
};
|
||||
|
||||
this.$rootScope = $rootScope;
|
||||
this.componentManager = componentManager;
|
||||
this.desktopManager = desktopManager;
|
||||
this.timeout = $timeout;
|
||||
@@ -49,7 +50,7 @@ class ComponentView {
|
||||
});
|
||||
}
|
||||
|
||||
controller($scope, $timeout, componentManager, desktopManager) {
|
||||
controller($scope, $rootScope, $timeout, componentManager, desktopManager) {
|
||||
'ngInject';
|
||||
|
||||
this.componentValueChanging = (component, prevComponent) => {
|
||||
@@ -66,6 +67,10 @@ class ComponentView {
|
||||
}
|
||||
}
|
||||
|
||||
$scope.$on("ext-reload-complete", () => {
|
||||
$scope.reloadStatus();
|
||||
})
|
||||
|
||||
$scope.reloadComponent = function() {
|
||||
console.log("Reloading component", $scope.component);
|
||||
componentManager.reloadComponent($scope.component);
|
||||
@@ -100,6 +105,12 @@ class ComponentView {
|
||||
}
|
||||
}
|
||||
|
||||
if(expired && !$scope.triedReloading) {
|
||||
// Try reloading, handled by footer, which will open Extensions window momentarily to pull in latest data
|
||||
$scope.triedReloading = true;
|
||||
$rootScope.$broadcast("reload-ext-data");
|
||||
}
|
||||
|
||||
$timeout(() => {
|
||||
$scope.reloading = false;
|
||||
}, 500)
|
||||
@@ -124,4 +135,4 @@ class ComponentView {
|
||||
|
||||
}
|
||||
|
||||
angular.module('app').directive('componentView', (componentManager, desktopManager, $timeout) => new ComponentView(componentManager, desktopManager, $timeout));
|
||||
angular.module('app').directive('componentView', ($rootScope, componentManager, desktopManager, $timeout) => new ComponentView($rootScope, componentManager, desktopManager, $timeout));
|
||||
|
||||
Reference in New Issue
Block a user