Improvements to native ext mgr and password wizard

This commit is contained in:
Mo Bitar
2020-02-17 12:08:21 -06:00
parent 6fc53f3920
commit c6198a4612
12 changed files with 544 additions and 594 deletions

View File

@@ -2,6 +2,7 @@ import { Challenges, ChallengeResponse } from 'snjs';
import { getPlatformString } from '@/utils';
import template from '%/root.pug';
import { AppStateEvents } from '@/state';
import angular from 'angular';
import {
PANEL_NAME_NOTES,
PANEL_NAME_TAGS
@@ -16,6 +17,7 @@ import { PureCtrl } from './abstract/pure_ctrl';
class RootCtrl extends PureCtrl {
/* @ngInject */
constructor(
$compile,
$location,
$scope,
$rootScope,
@@ -31,6 +33,7 @@ class RootCtrl extends PureCtrl {
super($scope, $timeout, application, appState);
this.$location = $location;
this.$rootScope = $rootScope;
this.$compile = $compile;
this.desktopManager = desktopManager;
this.lockManager = lockManager;
this.statusManager = statusManager;
@@ -46,13 +49,14 @@ class RootCtrl extends PureCtrl {
onAppStart() {
super.onAppStart();
this.overrideComponentManagerFunctions();
this.application.componentManager.setDesktopManager(this.desktopManager);
this.setState({ ready: true });
}
onAppLaunch() {
super.onAppLaunch();
this.setState({ needsUnlock: false });
this.application.componentManager.setDesktopManager(this.desktopManager);
this.application.registerService(this.themeManager);
this.handleAutoSignInFromParams();
}
@@ -119,6 +123,25 @@ class RootCtrl extends PureCtrl {
}
}
overrideComponentManagerFunctions() {
function openModalComponent(component) {
const scope = this.$rootScope.$new(true);
scope.component = component;
const el = this.$compile("<component-modal component='component' class='sk-modal'></component-modal>")(scope);
angular.element(document.body).append(el);
}
function presentPermissionsDialog(dialog) {
const scope = this.$rootScope.$new(true);
scope.permissionsString = dialog.permissionsString;
scope.component = dialog.component;
scope.callback = dialog.callback;
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.application.componentManager.openModalComponent = openModalComponent.bind(this);
this.application.componentManager.presentPermissionsDialog = presentPermissionsDialog.bind(this);
}
// addSyncStatusObserver() {
// this.syncStatusObserver = syncManager.registerSyncStatusObserver((status) => {
// if (status.retrievedCount > 20) {