From f7ef7af4a1ad9beba36906a5044f7c36d39a5e6a Mon Sep 17 00:00:00 2001 From: Marcel Klehr Date: Thu, 17 Aug 2023 13:14:13 +0200 Subject: [PATCH] enh(Whatsnew): Add a changelog-style whatsnew modal Signed-off-by: Marcel Klehr --- lib/Controller/SettingsController.php | 27 ++++++++++++ lib/Controller/WebViewController.php | 2 +- src/components/ViewPrivate.vue | 4 ++ src/components/WhatsnewModal.vue | 61 +++++++++++++++++++++++++++ src/store/index.js | 1 + 5 files changed, 94 insertions(+), 1 deletion(-) create mode 100644 src/components/WhatsnewModal.vue diff --git a/lib/Controller/SettingsController.php b/lib/Controller/SettingsController.php index 41a0104d..95d0790f 100644 --- a/lib/Controller/SettingsController.php +++ b/lib/Controller/SettingsController.php @@ -224,4 +224,31 @@ class SettingsController extends ApiController { public function setBackupPath(string $backupPath): JSONResponse { return $this->setSetting('backup.filePath', $backupPath); } + + /** + * get hasSeenWhatsnew + * + * @return JSONResponse + * + * @NoAdminRequired + */ + public function getWhatsnew(): JSONResponse { + return $this->getSetting( + 'hasSeenWhatsnew', + 'hasSeenWhatsnew', + '0' + ); + } + + /** + * set hasSeenWhatsnew + * + * @param string $hasSeenWhatsnew + * @return JSONResponse + * + * @NoAdminRequired + */ + public function setWhatsnew(string $hasSeenWhatsnew): JSONResponse { + return $this->setSetting('hasSeenWhatsnew', $hasSeenWhatsnew); + } } diff --git a/lib/Controller/WebViewController.php b/lib/Controller/WebViewController.php index baa6f639..2f646f2c 100644 --- a/lib/Controller/WebViewController.php +++ b/lib/Controller/WebViewController.php @@ -116,7 +116,7 @@ class WebViewController extends Controller { $this->initialState->provideInitialState($this->appName, 'folders', $this->folderController->getFolders()->getData()['data']); $settings = []; - foreach (['sorting', 'viewMode'] as $setting) { + foreach (['sorting', 'viewMode', 'hasSeenWhatsnew'] as $setting) { $settings[$setting] = $this->config->getUserValue($this->userId, $this->appName, $setting); } $this->initialState->provideInitialState($this->appName, 'settings', $settings); diff --git a/src/components/ViewPrivate.vue b/src/components/ViewPrivate.vue index 34c2c0c6..e2ab8bbe 100644 --- a/src/components/ViewPrivate.vue +++ b/src/components/ViewPrivate.vue @@ -22,6 +22,7 @@ + @@ -39,6 +40,7 @@ import { privateRoutes } from '../router.js' import { actions, mutations } from '../store/index.js' import LoadingModal from './LoadingModal.vue' import BookmarkContent from './BookmarkContent.vue' +import WhatsnewModal from './WhatsnewModal.vue' import { getCurrentUser } from '@nextcloud/auth' export default { @@ -56,12 +58,14 @@ export default { SidebarFolder, MoveDialog, CopyDialog, + WhatsnewModal, }, data() { return { newBookmark: false, showDetails: false, smallScreen: false, + showWhatsnew: false, } }, computed: { diff --git a/src/components/WhatsnewModal.vue b/src/components/WhatsnewModal.vue new file mode 100644 index 00000000..72ac13c4 --- /dev/null +++ b/src/components/WhatsnewModal.vue @@ -0,0 +1,61 @@ + + + + + diff --git a/src/store/index.js b/src/store/index.js index 5118fc8e..5c530859 100644 --- a/src/store/index.js +++ b/src/store/index.js @@ -49,6 +49,7 @@ export default { limit: 0, backupPath: '', backupEnabled: '1', + hasSeenWhatsnew: '', }, bookmarks: [], bookmarksById: {},