This commit is contained in:
Mo Bitar
2020-02-08 20:37:07 -06:00
parent 8822580e7a
commit 5226d57623
7 changed files with 55 additions and 97 deletions

View File

@@ -11,7 +11,8 @@ import { AlertManager } from '@/services/alertManager';
import { WebDeviceInterface } from '@/web_device_interface';
export class Application extends SNApplication {
constructor() {
/* @ngInject */
constructor($compile, $rootScope) {
const deviceInterface = new WebDeviceInterface();
super({
environment: Environments.Web,
@@ -26,6 +27,8 @@ export class Application extends SNApplication {
}
]
});
this.$compile = $compile;
this.$rootScope = $rootScope;
deviceInterface.setApplication(this);
this.overrideComponentManagerFunctions();
}
@@ -45,7 +48,7 @@ export class Application extends SNApplication {
const el = this.$compile("<permissions-modal component='component' permissions-string='permissionsString' callback='callback' class='sk-modal'></permissions-modal>")(scope);
angular.element(document.body).append(el);
}
this.componentManager.openModalComponent = openModalComponent;
this.componentManager.presentPermissionsDialog = presentPermissionsDialog;
this.componentManager.openModalComponent = openModalComponent.bind(this);
this.componentManager.presentPermissionsDialog = presentPermissionsDialog.bind(this);
}
}

View File

@@ -504,7 +504,6 @@ class NotesCtrl extends PureCtrl {
async createNewNote() {
const selectedTag = this.appState.getSelectedTag();
if (!selectedTag) {
debugger;
throw 'Attempting to create note with no selected tag';
}
if (this.state.selectedNote && this.state.selectedNote.dummy) {
@@ -516,7 +515,8 @@ class NotesCtrl extends PureCtrl {
content: {
text: '',
title: title
}
},
add: true
});
newNote.client_updated_at = new Date();
newNote.dummy = true;

View File

@@ -5,12 +5,12 @@ class ActionsMenuCtrl extends PureCtrl {
/* @ngInject */
constructor(
$timeout,
actionsManager,
application,
godService
) {
super($timeout);
this.$timeout = $timeout;
this.actionsManager = actionsManager;
this.application = application;
this.godService = godService;
}
@@ -22,12 +22,12 @@ class ActionsMenuCtrl extends PureCtrl {
};
async loadExtensions() {
const extensions = this.actionsManager.extensions.sort((a, b) => {
const extensions = this.application.actionsManager.getExtensions().sort((a, b) => {
return a.name.toLowerCase() < b.name.toLowerCase() ? -1 : 1;
});
for (const extension of extensions) {
extension.loading = true;
await this.actionsManager.loadExtensionInContextOfItem(extension, this.props.item);
await this.application.actionsManager.loadExtensionInContextOfItem(extension, this.props.item);
extension.loading = false;
}
this.setState({
@@ -45,7 +45,7 @@ class ActionsMenuCtrl extends PureCtrl {
return;
}
action.running = true;
const result = await this.actionsManager.executeAction(
const result = await this.application.actionsManager.executeAction(
action,
extension,
this.props.item
@@ -55,7 +55,7 @@ class ActionsMenuCtrl extends PureCtrl {
}
action.running = false;
this.handleActionResult(action, result);
await this.actionsManager.loadExtensionInContextOfItem(extension, this.props.item);
await this.application.actionsManager.loadExtensionInContextOfItem(extension, this.props.item);
this.setState({
extensions: this.state.extensions
});

View File

@@ -56,7 +56,7 @@ class ComponentViewCtrl {
identifier: this.themeHandlerIdentifier,
areas: ['themes'],
activationHandler: (component) => {
this.reloadThemeStatus();
}
});
@@ -130,7 +130,7 @@ class ComponentViewCtrl {
if(this.expired && doManualReload) {
this.$rootScope.$broadcast('reload-ext-dat');
}
this.reloadThemeStatus();
this.$timeout(() => {
this.reloading = false;
}, 500);
@@ -215,27 +215,8 @@ class ComponentViewCtrl {
}
}
reloadThemeStatus() {
if(this.component.acceptsThemes()) {
return;
}
if(this.themeManager.hasActiveTheme()) {
if(!this.dismissedNoThemesMessage) {
this.showNoThemesMessage = true;
}
} else {
this.showNoThemesMessage = false;
}
}
dismissNoThemesMessage() {
this.showNoThemesMessage = false;
this.dismissedNoThemesMessage = true;
}
disableActiveTheme() {
this.themeManager.deactivateAllThemes();
this.dismissNoThemesMessage();
}
getUrl() {

View File

@@ -7,16 +7,6 @@
.sk-app-bar-item(ng-click='ctrl.reloadComponent()')
.sk-button.info
.sk-label Reload
.sn-component(ng-if='ctrl.showNoThemesMessage')
.sk-app-bar.no-edges.no-top-edge.dynamic-height
.left
.sk-app-bar-item
.sk-label.warning This extension does not support themes.
.right
.sk-app-bar-item(ng-click='ctrl.dismissNoThemesMessage()')
.sk-label Dismiss
.sk-app-bar-item(ng-click='ctrl.disableActiveTheme()')
.sk-label Disable Active Theme
.sn-component(ng-if='ctrl.expired')
.sk-app-bar.no-edges.no-top-edge.dynamic-height
.left

File diff suppressed because one or more lines are too long

File diff suppressed because one or more lines are too long