This commit is contained in:
Mo Bitar
2020-02-11 11:17:03 -06:00
parent 1497048c72
commit d91d141417
12 changed files with 253 additions and 349 deletions

View File

@@ -112,17 +112,13 @@ class EditorCtrl extends PureCtrl {
return;
}
if (eventName === ApplicationEvents.HighLatencySync) {
this.setState({
syncTakingTooLong: true
});
this.setState({ syncTakingTooLong: true });
} else if (eventName === ApplicationEvents.CompletedSync) {
this.setState({
syncTakingTooLong: false
});
this.setState({ syncTakingTooLong: false });
if (this.state.note.dirty) {
/** if we're still dirty, don't change status, a sync is likely upcoming. */
} else {
const saved = this.state.note.updated_at > this.state.note.lastSyncBegan;
const saved = this.state.note.lastSyncEnd > this.state.note.lastSyncBegan;
const isInErrorState = this.state.saveError;
if (isInErrorState || saved) {
this.showAllChangesSavedStatus();
@@ -792,8 +788,8 @@ class EditorCtrl extends PureCtrl {
this.reloadFont();
if (
this.state.marginResizersEnabled &&
this.leftPanelPuppet.ready &&
this.state.marginResizersEnabled &&
this.leftPanelPuppet.ready &&
this.rightPanelPuppet.ready
) {
const width = this.preferencesManager.getValue(

View File

@@ -59,7 +59,6 @@ class FooterCtrl extends PureCtrl {
});
this.user = this.application.getUser();
this.updateOfflineStatus();
this.addAppEventObserver();
this.findErrors();
this.streamItems();
this.registerComponentHandler();
@@ -111,15 +110,14 @@ class FooterCtrl extends PureCtrl {
/** @override */
onApplicationEvent(eventName) {
if (eventName === ApplicationEvents.LoadedLocalData) {
if (this.offline && this.application.getNoteCount() === 0) {
this.showAccountMenu = true;
}
} else if (eventName === ApplicationEvents.EnteredOutOfSync) {
if (eventName === ApplicationEvents.EnteredOutOfSync) {
this.outOfSync = true;
} else if (eventName === ApplicationEvents.ExitedOutOfSync) {
this.outOfSync = false;
} else if (eventName === ApplicationEvents.CompletedSync) {
if (this.offline && this.application.getNoteCount() === 0) {
this.showAccountMenu = true;
}
this.syncUpdated();
this.findErrors();
this.updateOfflineStatus();

View File

@@ -113,6 +113,9 @@ class NotesCtrl extends PureCtrl {
this.createDummyOnSynCompletionIfNoNotes = true;
}
} else if (eventName === ApplicationEvents.CompletedSync) {
if (this.state.notes.length === 0) {
this.createNewNote();
}
if (this.createDummyOnSynCompletionIfNoNotes && this.state.notes.length === 0) {
this.createDummyOnSynCompletionIfNoNotes = false;
this.createNewNote();

View File

@@ -37,7 +37,7 @@ class RootCtrl extends PureCtrl {
this.themeManager = themeManager;
this.platformString = getPlatformString();
this.state = {
needsUnlock: true,
ready: false,
appClass: ''
};
this.loadApplication();
@@ -86,17 +86,18 @@ class RootCtrl extends PureCtrl {
}
});
await this.application.launch();
this.setState({ ready: true });
// this.addSyncStatusObserver();
// this.addSyncEventHandler();
}
onUpdateAvailable() {
this.$rootScope.$broadcast('new-update-available');
};
/** @override */
async onApplicationEvent(eventName) {
if (eventName === ApplicationEvents.ApplicationUnlocked) {
if (eventName === ApplicationEvents.ApplicationUnlocked) {
this.setState({ needsUnlock: false });
this.application.componentManager.setDesktopManager(this.desktopManager);
this.application.registerService(this.themeManager);