Updates
This commit is contained in:
@@ -17,6 +17,7 @@ export class PureCtrl {
|
||||
this.addAppStateObserver();
|
||||
this.addAppEventObserver();
|
||||
$scope.$on('$destroy', () => {
|
||||
console.log("On destroy", this);
|
||||
this.unsubApp();
|
||||
this.unsubState();
|
||||
});
|
||||
|
||||
@@ -74,8 +74,12 @@ class EditorCtrl extends PureCtrl {
|
||||
}
|
||||
};
|
||||
|
||||
this.leftResizeControl = {};
|
||||
this.rightResizeControl = {};
|
||||
this.leftPanelPuppet = {
|
||||
onReady: () => this.reloadPreferences()
|
||||
};
|
||||
this.rightPanelPuppet = {
|
||||
onReady: () => this.reloadPreferences()
|
||||
};
|
||||
this.addSyncStatusObserver();
|
||||
this.registerKeyboardShortcuts();
|
||||
|
||||
@@ -98,7 +102,7 @@ class EditorCtrl extends PureCtrl {
|
||||
data.previousNote
|
||||
);
|
||||
} else if (eventName === AppStateEvents.PreferencesChanged) {
|
||||
this.loadPreferences();
|
||||
this.reloadPreferences();
|
||||
}
|
||||
}
|
||||
|
||||
@@ -236,7 +240,7 @@ class EditorCtrl extends PureCtrl {
|
||||
noteReady: true,
|
||||
});
|
||||
this.reloadTagsString();
|
||||
this.loadPreferences();
|
||||
this.reloadPreferences();
|
||||
|
||||
if (note.dummy) {
|
||||
this.focusEditor();
|
||||
@@ -748,7 +752,7 @@ class EditorCtrl extends PureCtrl {
|
||||
PrefKeys.EditorWidth,
|
||||
width
|
||||
);
|
||||
this.leftResizeControl.setWidth(width);
|
||||
this.leftPanelPuppet.setWidth(width);
|
||||
}
|
||||
}
|
||||
if (left !== undefined && left !== null) {
|
||||
@@ -756,12 +760,12 @@ class EditorCtrl extends PureCtrl {
|
||||
PrefKeys.EditorLeft,
|
||||
left
|
||||
);
|
||||
this.rightResizeControl.setLeft(left);
|
||||
this.rightPanelPuppet.setLeft(left);
|
||||
}
|
||||
this.preferencesManager.syncUserPreferences();
|
||||
}
|
||||
|
||||
loadPreferences() {
|
||||
reloadPreferences() {
|
||||
const monospaceEnabled = this.preferencesManager.getValue(
|
||||
PrefKeys.EditorMonospaceEnabled,
|
||||
true
|
||||
@@ -787,22 +791,26 @@ class EditorCtrl extends PureCtrl {
|
||||
|
||||
this.reloadFont();
|
||||
|
||||
if (this.state.marginResizersEnabled) {
|
||||
if (
|
||||
this.state.marginResizersEnabled &&
|
||||
this.leftPanelPuppet.ready &&
|
||||
this.rightPanelPuppet.ready
|
||||
) {
|
||||
const width = this.preferencesManager.getValue(
|
||||
PrefKeys.EditorWidth,
|
||||
null
|
||||
);
|
||||
if (width != null) {
|
||||
this.leftResizeControl.setWidth(width);
|
||||
this.rightResizeControl.setWidth(width);
|
||||
this.leftPanelPuppet.setWidth(width);
|
||||
this.rightPanelPuppet.setWidth(width);
|
||||
}
|
||||
const left = this.preferencesManager.getValue(
|
||||
PrefKeys.EditorLeft,
|
||||
null
|
||||
);
|
||||
if (left != null) {
|
||||
this.leftResizeControl.setLeft(left);
|
||||
this.rightResizeControl.setLeft(left);
|
||||
this.leftPanelPuppet.setLeft(left);
|
||||
this.rightPanelPuppet.setLeft(left);
|
||||
}
|
||||
}
|
||||
}
|
||||
@@ -845,8 +853,8 @@ class EditorCtrl extends PureCtrl {
|
||||
this.reloadFont();
|
||||
} else if (key === PrefKeys.EditorResizersEnabled && this[key] === true) {
|
||||
this.$timeout(() => {
|
||||
this.leftResizeControl.flash();
|
||||
this.rightResizeControl.flash();
|
||||
this.leftPanelPuppet.flash();
|
||||
this.rightPanelPuppet.flash();
|
||||
});
|
||||
}
|
||||
}
|
||||
|
||||
@@ -31,6 +31,9 @@ class FooterCtrl extends PureCtrl {
|
||||
this.nativeExtManager = nativeExtManager;
|
||||
this.statusManager = statusManager;
|
||||
this.godService = godService;
|
||||
this.state = {
|
||||
hasPasscode: false
|
||||
};
|
||||
|
||||
this.rooms = [];
|
||||
this.themesWithIcons = [];
|
||||
@@ -46,7 +49,9 @@ class FooterCtrl extends PureCtrl {
|
||||
|
||||
application.onUnlock(() => {
|
||||
this.application.hasPasscode().then((value) => {
|
||||
this.hasPasscode = value;
|
||||
this.setState({
|
||||
hasPasscode: value
|
||||
});
|
||||
});
|
||||
|
||||
this.godService.checkForSecurityUpdate().then((available) => {
|
||||
@@ -234,7 +239,7 @@ class FooterCtrl extends PureCtrl {
|
||||
}
|
||||
|
||||
lockApp() {
|
||||
this.$rootScope.lockApplication();
|
||||
this.application.lock();
|
||||
}
|
||||
|
||||
refreshData() {
|
||||
|
||||
@@ -63,7 +63,9 @@ class NotesCtrl extends PureCtrl {
|
||||
noteFilter: { text: '' },
|
||||
};
|
||||
|
||||
this.panelController = {};
|
||||
this.panelPuppet = {
|
||||
onReady: () => this.reloadPreferences()
|
||||
};
|
||||
window.onresize = (event) => {
|
||||
this.resetPagination({
|
||||
keepCurrentIfLarger: true
|
||||
@@ -309,12 +311,12 @@ class NotesCtrl extends PureCtrl {
|
||||
const width = this.preferencesManager.getValue(
|
||||
PrefKeys.NotesPanelWidth
|
||||
);
|
||||
if (width) {
|
||||
this.panelController.setWidth(width);
|
||||
if (this.panelController.isCollapsed()) {
|
||||
if (width && this.panelPuppet.ready) {
|
||||
this.panelPuppet.setWidth(width);
|
||||
if (this.panelPuppet.isCollapsed()) {
|
||||
this.appState.panelDidResize({
|
||||
name: PANEL_NAME_NOTES,
|
||||
collapsed: this.panelController.isCollapsed()
|
||||
collapsed: this.panelPuppet.isCollapsed()
|
||||
});
|
||||
}
|
||||
}
|
||||
|
||||
@@ -1,4 +1,4 @@
|
||||
import { Challenges, ChallengeResponse } from 'snjs';
|
||||
import { Challenges, ChallengeResponse, ApplicationEvents } from 'snjs';
|
||||
import { getPlatformString } from '@/utils';
|
||||
import template from '%/root.pug';
|
||||
import { AppStateEvents } from '@/state';
|
||||
@@ -7,9 +7,9 @@ import {
|
||||
PANEL_NAME_TAGS
|
||||
} from '@/controllers/constants';
|
||||
import {
|
||||
STRING_SESSION_EXPIRED,
|
||||
// STRING_SESSION_EXPIRED,
|
||||
STRING_DEFAULT_FILE_ERROR,
|
||||
StringSyncException
|
||||
// StringSyncException
|
||||
} from '@/strings';
|
||||
import { PureCtrl } from './abstract/pure_ctrl';
|
||||
|
||||
@@ -86,16 +86,22 @@ class RootCtrl extends PureCtrl {
|
||||
}
|
||||
});
|
||||
await this.application.launch();
|
||||
this.setState({ needsUnlock: false });
|
||||
this.application.componentManager.setDesktopManager(this.desktopManager);
|
||||
this.application.registerService(this.themeManager);
|
||||
// this.addSyncStatusObserver();
|
||||
// this.addSyncEventHandler();
|
||||
}
|
||||
|
||||
|
||||
onUpdateAvailable() {
|
||||
this.$rootScope.$broadcast('new-update-available');
|
||||
};
|
||||
|
||||
/** @override */
|
||||
async onApplicationEvent(eventName) {
|
||||
if (eventName === ApplicationEvents.ApplicationUnlocked) {
|
||||
this.setState({ needsUnlock: false });
|
||||
this.application.componentManager.setDesktopManager(this.desktopManager);
|
||||
this.application.registerService(this.themeManager);
|
||||
}
|
||||
}
|
||||
|
||||
/** @override */
|
||||
async onAppStateEvent(eventName, data) {
|
||||
|
||||
@@ -19,14 +19,21 @@ class TagsPanelCtrl extends PureCtrl {
|
||||
super($scope, $timeout, application, appState);
|
||||
this.$rootScope = $rootScope;
|
||||
this.preferencesManager = preferencesManager;
|
||||
this.panelController = {};
|
||||
this.loadPreferences();
|
||||
this.registerComponentHandler();
|
||||
this.panelPuppet = {
|
||||
onReady: () => this.loadPreferences()
|
||||
};
|
||||
this.state = {
|
||||
smartTags: [],
|
||||
noteCounts: {}
|
||||
};
|
||||
application.onUnlock(() => {
|
||||
}
|
||||
|
||||
$onInit() {
|
||||
this.application.onStart(() => {
|
||||
this.registerComponentHandler();
|
||||
});
|
||||
this.application.onUnlock(() => {
|
||||
this.loadPreferences();
|
||||
this.beginStreamingItems();
|
||||
const smartTags = this.application.getSmartTags();
|
||||
this.setState({
|
||||
@@ -34,8 +41,8 @@ class TagsPanelCtrl extends PureCtrl {
|
||||
});
|
||||
this.selectTag(smartTags[0]);
|
||||
});
|
||||
|
||||
application.onSync(() => {
|
||||
|
||||
this.application.onSync(() => {
|
||||
this.reloadNoteCounts();
|
||||
});
|
||||
}
|
||||
@@ -94,13 +101,16 @@ class TagsPanelCtrl extends PureCtrl {
|
||||
}
|
||||
|
||||
loadPreferences() {
|
||||
if(!this.panelPuppet.ready) {
|
||||
return;
|
||||
}
|
||||
const width = this.preferencesManager.getValue(PrefKeys.TagsPanelWidth);
|
||||
if (width) {
|
||||
this.panelController.setWidth(width);
|
||||
if (this.panelController.isCollapsed()) {
|
||||
this.panelPuppet.setWidth(width);
|
||||
if (this.panelPuppet.isCollapsed()) {
|
||||
this.appState.panelDidResize({
|
||||
name: PANEL_NAME_TAGS,
|
||||
collapsed: this.panelController.isCollapsed()
|
||||
collapsed: this.panelPuppet.isCollapsed()
|
||||
});
|
||||
}
|
||||
}
|
||||
|
||||
@@ -36,10 +36,10 @@ class PanelResizerCtrl {
|
||||
}
|
||||
|
||||
$onInit() {
|
||||
this.configureControl();
|
||||
this.configureDefaults();
|
||||
this.addDoubleClickHandler();
|
||||
this.reloadDefaultValues();
|
||||
this.configureControl();
|
||||
this.addDoubleClickHandler();
|
||||
this.addMouseDownListener();
|
||||
this.addMouseMoveListener();
|
||||
this.addMouseUpListener();
|
||||
@@ -61,6 +61,9 @@ class PanelResizerCtrl {
|
||||
this.control.isCollapsed = () => {
|
||||
return this.isCollapsed();
|
||||
};
|
||||
|
||||
this.control.ready = true;
|
||||
this.control.onReady();
|
||||
}
|
||||
|
||||
configureDefaults() {
|
||||
|
||||
@@ -98,7 +98,7 @@ export class LockManager {
|
||||
this.lockAfterDate &&
|
||||
new Date() > this.lockAfterDate
|
||||
) {
|
||||
this.application.passcodeLock();
|
||||
this.application.lock();
|
||||
}
|
||||
this.cancelAutoLockTimer();
|
||||
} else {
|
||||
@@ -125,7 +125,7 @@ export class LockManager {
|
||||
this.lockAfterDate = addToNow(interval / MILLISECONDS_PER_SECOND);
|
||||
this.lockTimeout = setTimeout(() => {
|
||||
this.cancelAutoLockTimer();
|
||||
this.application.passcodeLock();
|
||||
this.application.lock();
|
||||
this.lockAfterDate = null;
|
||||
}, interval);
|
||||
}
|
||||
|
||||
@@ -26,11 +26,12 @@ export class AppState {
|
||||
$timeout,
|
||||
$rootScope,
|
||||
application,
|
||||
|
||||
godService
|
||||
) {
|
||||
this.$timeout = $timeout;
|
||||
this.$rootScope = $rootScope;
|
||||
this.application = application;
|
||||
this.godService = godService;
|
||||
this.observers = [];
|
||||
this.registerVisibilityObservers();
|
||||
}
|
||||
|
||||
@@ -192,7 +192,7 @@
|
||||
ng-if='self.state.noteReady && !self.state.note.errorDecrypting'
|
||||
)
|
||||
panel-resizer.left(
|
||||
control='self.leftResizeControl',
|
||||
control='self.leftPanelPuppet',
|
||||
hoverable='true',
|
||||
min-width='300',
|
||||
ng-if='self.state.marginResizersEnabled',
|
||||
@@ -219,7 +219,7 @@
|
||||
)
|
||||
| {{self.onSystemEditorLoad()}}
|
||||
panel-resizer(
|
||||
control='self.rightResizeControl',
|
||||
control='self.rightPanelPuppet',
|
||||
hoverable='true', min-width='300',
|
||||
ng-if='self.state.marginResizersEnabled',
|
||||
on-resize-finish='self.onPanelResizeFinish',
|
||||
|
||||
@@ -84,10 +84,10 @@
|
||||
elem-ready='ctrl.initSvgForShortcut(shortcut)',
|
||||
ng-attr-id='dock-svg-{{shortcut.component.uuid}}'
|
||||
)
|
||||
.sk-app-bar-item.border(ng-if='ctrl.hasPasscode')
|
||||
.sk-app-bar-item.border(ng-if='ctrl.state.hasPasscode')
|
||||
#lock-item.sk-app-bar-item(
|
||||
ng-click='ctrl.lockApp()',
|
||||
ng-if='ctrl.hasPasscode',
|
||||
ng-if='ctrl.state.hasPasscode',
|
||||
title='Locks application and wipes unencrypted data from memory.'
|
||||
)
|
||||
.sk-label
|
||||
|
||||
@@ -143,7 +143,7 @@
|
||||
.faded {{note.savedTagsString || note.tagsString()}}
|
||||
panel-resizer(
|
||||
collapsable="true"
|
||||
control="self.panelController"
|
||||
control="self.panelPuppet"
|
||||
default-width="300"
|
||||
hoverable="true"
|
||||
on-resize-finish="self.onPanelResize"
|
||||
|
||||
@@ -1,19 +1,19 @@
|
||||
.main-ui-view(
|
||||
ng-class='self.platformString'
|
||||
)
|
||||
ng-class='self.platformString'
|
||||
)
|
||||
lock-screen(
|
||||
ng-if='self.state.needsUnlock'
|
||||
on-value='self.state.onLockscreenValue',
|
||||
puppet='self.lockScreenPuppet'
|
||||
ng-if='self.state.needsUnlock'
|
||||
on-value='self.state.onLockscreenValue',
|
||||
puppet='self.lockScreenPuppet'
|
||||
)
|
||||
#app.app(
|
||||
ng-class='self.state.appClass',
|
||||
ng-if='!self.state.needsUnlock'
|
||||
ng-class='self.state.appClass',
|
||||
ng-if='!self.state.needsUnlock'
|
||||
)
|
||||
tags-panel
|
||||
notes-panel
|
||||
editor-panel
|
||||
|
||||
footer(
|
||||
ng-if='!self.state.needsUnlock'
|
||||
ng-if='!self.state.needsUnlock'
|
||||
)
|
||||
|
||||
@@ -56,7 +56,7 @@
|
||||
| No tags. Create one using the add button above.
|
||||
panel-resizer(
|
||||
collapsable='true',
|
||||
control='self.panelController',
|
||||
control='self.panelPuppet',
|
||||
default-width='150',
|
||||
hoverable='true',
|
||||
on-resize-finish='self.onPanelResize',
|
||||
|
||||
367
dist/javascripts/app.js
vendored
367
dist/javascripts/app.js
vendored
File diff suppressed because one or more lines are too long
2
dist/javascripts/app.js.map
vendored
2
dist/javascripts/app.js.map
vendored
File diff suppressed because one or more lines are too long
Reference in New Issue
Block a user