Skip to content
Open
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
6 changes: 6 additions & 0 deletions lib/Service/SettingsService.php
Original file line number Diff line number Diff line change
Expand Up @@ -68,6 +68,12 @@
return '.' . $out;
},
],
'loadRecentOnStartUp' => [
'default' => true,
'validate' => function ($value) {

Check failure on line 73 in lib/Service/SettingsService.php

View workflow job for this annotation

GitHub Actions / static-psalm-analysis dev-stable28

MissingClosureReturnType

lib/Service/SettingsService.php:73:19: MissingClosureReturnType: Closure does not have a return type, expecting bool (see https://psalm.dev/068)

Check failure on line 73 in lib/Service/SettingsService.php

View workflow job for this annotation

GitHub Actions / static-psalm-analysis dev-stable31

MissingClosureReturnType

lib/Service/SettingsService.php:73:19: MissingClosureReturnType: Closure does not have a return type, expecting bool (see https://psalm.dev/068)

Check failure on line 73 in lib/Service/SettingsService.php

View workflow job for this annotation

GitHub Actions / static-psalm-analysis dev-stable29

MissingClosureReturnType

lib/Service/SettingsService.php:73:19: MissingClosureReturnType: Closure does not have a return type, expecting bool (see https://psalm.dev/068)

Check failure on line 73 in lib/Service/SettingsService.php

View workflow job for this annotation

GitHub Actions / static-psalm-analysis dev-stable30

MissingClosureReturnType

lib/Service/SettingsService.php:73:19: MissingClosureReturnType: Closure does not have a return type, expecting bool (see https://psalm.dev/068)

Check failure on line 73 in lib/Service/SettingsService.php

View workflow job for this annotation

GitHub Actions / static-psalm-analysis dev-master

MissingClosureReturnType

lib/Service/SettingsService.php:73:19: MissingClosureReturnType: Closure does not have a return type, expecting bool (see https://psalm.dev/068)
return $value === 'true' || $value === true;
},
],
];
}

Expand All @@ -76,7 +82,7 @@

return [
'default' => $default,
'validate' => function ($value) use ($values, $default) {

Check failure on line 85 in lib/Service/SettingsService.php

View workflow job for this annotation

GitHub Actions / static-psalm-analysis dev-stable28

MissingClosureParamType

lib/Service/SettingsService.php:85:28: MissingClosureParamType: Parameter $value has no provided type (see https://psalm.dev/153)

Check failure on line 85 in lib/Service/SettingsService.php

View workflow job for this annotation

GitHub Actions / static-psalm-analysis dev-stable31

MissingClosureParamType

lib/Service/SettingsService.php:85:28: MissingClosureParamType: Parameter $value has no provided type (see https://psalm.dev/153)

Check failure on line 85 in lib/Service/SettingsService.php

View workflow job for this annotation

GitHub Actions / static-psalm-analysis dev-stable29

MissingClosureParamType

lib/Service/SettingsService.php:85:28: MissingClosureParamType: Parameter $value has no provided type (see https://psalm.dev/153)

Check failure on line 85 in lib/Service/SettingsService.php

View workflow job for this annotation

GitHub Actions / static-psalm-analysis dev-stable30

MissingClosureParamType

lib/Service/SettingsService.php:85:28: MissingClosureParamType: Parameter $value has no provided type (see https://psalm.dev/153)

Check failure on line 85 in lib/Service/SettingsService.php

View workflow job for this annotation

GitHub Actions / static-psalm-analysis dev-master

MissingClosureParamType

lib/Service/SettingsService.php:85:28: MissingClosureParamType: Parameter $value has no provided type (see https://psalm.dev/153)
if (in_array($value, $values)) {
return $value;
} else {
Expand Down
18 changes: 13 additions & 5 deletions src/App.vue
Original file line number Diff line number Diff line change
Expand Up @@ -134,12 +134,16 @@ export default {
fetchNotes()
.then(data => {
if (data === null) {
// nothing changed
return
}
if (data.notes !== null) {
this.error = false
this.routeDefault(data.lastViewedNote)
if (store.state.app.settings?.loadRecentOnStartUp) {
this.routeDefault(data.lastViewedNote)
} else {
this.routeWelcome()
}

} else if (this.loading.notes) {
// only show error state if not loading in background
this.error = data.errorMessage
Expand Down Expand Up @@ -208,9 +212,13 @@ export default {
if (availableNotes.length > 0) {
this.routeToNote(availableNotes[0].id)
} else {
if (this.$route.name !== 'welcome') {
this.$router.push({ name: 'welcome' })
}
this.routeWelcome()
}
},

routeWelcome() {
if (this.$route.name !== 'welcome') {
this.$router.push({ name: 'welcome' })
}
},

Expand Down
18 changes: 18 additions & 0 deletions src/components/AppSettings.vue
Original file line number Diff line number Diff line change
Expand Up @@ -34,6 +34,11 @@
@click="onChangeNotePath"
>
</NcAppSettingsSection>
<NcAppSettingsSection id="start-up-section" :name="t('notes', 'Start Up')">
<NcCheckboxRadioSwitch :checked.sync="settings.loadRecentOnStartUp" @update:checked="onChangeSettings">
Load recently updated note on startup
</NcCheckboxRadioSwitch>
</NcAppSettingsSection>
<NcAppSettingsSection id="file-suffix-section" :name="t('notes', 'File extension')">
<p class="app-settings-section__desc">
{{ t('notes', 'File extension for new notes') }}
Expand Down Expand Up @@ -87,6 +92,7 @@
import {
NcAppSettingsDialog,
NcAppSettingsSection,
NcCheckboxRadioSwitch,
} from '@nextcloud/vue'

import { getFilePickerBuilder } from '@nextcloud/dialogs'
Expand All @@ -101,6 +107,7 @@ export default {
components: {
NcAppSettingsDialog,
NcAppSettingsSection,
NcCheckboxRadioSwitch,
HelpMobile,
},

Expand Down Expand Up @@ -192,6 +199,17 @@ export default {
})
},

onChangeStartUp(event) {
this.saving = true
this.settings.loadRecentOnStartUp = event.target.checked
return setSettings(this.settings)
.catch(() => {
})
.then(() => {
this.saving = false
})
},

setSettingsOpen(newValue) {
this.settingsOpen = newValue
this.$emit('update:open', newValue)
Expand Down
Loading