feat: component viewer (#781)
* wip: component viewer * feat: get component status from component viewer * fix: remove unused property * chore(deps): snjs 2.29.0 * fix: import location
This commit is contained in:
@@ -18,12 +18,9 @@ import {
|
||||
PermissionDialog,
|
||||
Platform,
|
||||
SNApplication,
|
||||
SNComponent,
|
||||
} from '@standardnotes/snjs';
|
||||
import angular from 'angular';
|
||||
import { ComponentModalScope } from './../directives/views/componentModal';
|
||||
import { AccountSwitcherScope, PermissionsModalScope } from './../types';
|
||||
import { ComponentGroup } from './component_group';
|
||||
|
||||
type WebServices = {
|
||||
appState: AppState;
|
||||
@@ -40,7 +37,6 @@ export class WebApplication extends SNApplication {
|
||||
private webServices!: WebServices;
|
||||
private currentAuthenticationElement?: angular.IRootElementService;
|
||||
public editorGroup: EditorGroup;
|
||||
public componentGroup: ComponentGroup;
|
||||
|
||||
/* @ngInject */
|
||||
constructor(
|
||||
@@ -71,8 +67,6 @@ export class WebApplication extends SNApplication {
|
||||
this.scope = scope;
|
||||
deviceInterface.setApplication(this);
|
||||
this.editorGroup = new EditorGroup(this);
|
||||
this.componentGroup = new ComponentGroup(this);
|
||||
this.openModalComponent = this.openModalComponent.bind(this);
|
||||
this.presentPermissionsDialog = this.presentPermissionsDialog.bind(this);
|
||||
}
|
||||
|
||||
@@ -85,14 +79,12 @@ export class WebApplication extends SNApplication {
|
||||
(service as any).application = undefined;
|
||||
}
|
||||
this.webServices = {} as WebServices;
|
||||
(this.$compile as any) = undefined;
|
||||
(this.$compile as unknown) = undefined;
|
||||
this.editorGroup.deinit();
|
||||
this.componentGroup.deinit();
|
||||
(this.scope! as any).application = undefined;
|
||||
(this.scope as any).application = undefined;
|
||||
this.scope!.$destroy();
|
||||
this.scope = undefined;
|
||||
(this.openModalComponent as any) = undefined;
|
||||
(this.presentPermissionsDialog as any) = undefined;
|
||||
(this.presentPermissionsDialog as unknown) = undefined;
|
||||
/** Allow our Angular directives to be destroyed and any pending digest cycles
|
||||
* to complete before destroying the global application instance and all its services */
|
||||
setTimeout(() => {
|
||||
@@ -105,8 +97,7 @@ export class WebApplication extends SNApplication {
|
||||
|
||||
onStart(): void {
|
||||
super.onStart();
|
||||
this.componentManager!.openModalComponent = this.openModalComponent;
|
||||
this.componentManager!.presentPermissionsDialog =
|
||||
this.componentManager.presentPermissionsDialog =
|
||||
this.presentPermissionsDialog;
|
||||
}
|
||||
|
||||
@@ -210,24 +201,6 @@ export class WebApplication extends SNApplication {
|
||||
this.applicationElement.append(el);
|
||||
}
|
||||
|
||||
async openModalComponent(component: SNComponent): Promise<void> {
|
||||
switch (component.package_info?.identifier) {
|
||||
case 'org.standardnotes.cloudlink':
|
||||
if (!(await this.authorizeCloudLinkAccess())) {
|
||||
return;
|
||||
}
|
||||
break;
|
||||
}
|
||||
const scope = this.scope!.$new(true) as Partial<ComponentModalScope>;
|
||||
scope.componentUuid = component.uuid;
|
||||
scope.application = this;
|
||||
const el = this.$compile!(
|
||||
"<component-modal application='application' component-uuid='componentUuid' " +
|
||||
"class='sk-modal'></component-modal>"
|
||||
)(scope as any);
|
||||
this.applicationElement.append(el);
|
||||
}
|
||||
|
||||
presentPermissionsDialog(dialog: PermissionDialog) {
|
||||
const scope = this.scope!.$new(true) as PermissionsModalScope;
|
||||
scope.permissionsString = dialog.permissionsString;
|
||||
|
||||
Reference in New Issue
Block a user