Merge pull request #3689 from nextcloud/techdebt/noid/move-sidebar-state-to-browser-storage-plugin

Move sidebar state to browser storage package
This commit is contained in:
marco 2020-05-27 01:15:17 -07:00 коммит произвёл GitHub
Родитель 68bd2b723c 679fb087f6
Коммит f766280437
Не найден ключ, соответствующий данной подписи
Идентификатор ключа GPG: 4AEE18F83AFDEB23
6 изменённых файлов: 46 добавлений и 4 удалений

15
package-lock.json сгенерированный
Просмотреть файл

@ -2560,6 +2560,21 @@
}
}
},
"@nextcloud/browser-storage": {
"version": "0.1.1",
"resolved": "https://registry.npmjs.org/@nextcloud/browser-storage/-/browser-storage-0.1.1.tgz",
"integrity": "sha512-bWzs/A44rEK8b3CMOFw0ZhsenagrWdsB902LOEwmlMCcFysiFgWiOPbF4/0/ODlOYjvPrO02wf6RigWtb8P+gA==",
"requires": {
"core-js": "3.6.1"
},
"dependencies": {
"core-js": {
"version": "3.6.1",
"resolved": "https://registry.npmjs.org/core-js/-/core-js-3.6.1.tgz",
"integrity": "sha512-186WjSik2iTGfDjfdCZAxv2ormxtKgemjC3SI6PL31qOA0j5LhTDVjHChccoc7brwLvpvLPiMyRlcO88C4l1QQ=="
}
}
},
"@nextcloud/browserslist-config": {
"version": "1.0.0",
"resolved": "https://registry.npmjs.org/@nextcloud/browserslist-config/-/browserslist-config-1.0.0.tgz",

Просмотреть файл

@ -19,6 +19,7 @@
"@juliushaertl/vue-richtext": "^0.3.1",
"@nextcloud/auth": "^1.2.3",
"@nextcloud/axios": "^1.3.2",
"@nextcloud/browser-storage": "^0.1.1",
"@nextcloud/dialogs": "^1.3.0",
"@nextcloud/event-bus": "^1.1.4",
"@nextcloud/initial-state": "^1.1.2",

Просмотреть файл

@ -44,6 +44,7 @@ import PreventUnload from 'vue-prevent-unload'
import Router from './router/router'
import RightSidebar from './components/RightSidebar/RightSidebar'
import { EventBus } from './services/EventBus'
import BrowserStorage from './services/BrowserStorage'
import { getCurrentUser } from '@nextcloud/auth'
import { fetchConversation } from './services/conversationsService'
import {
@ -311,9 +312,9 @@ export default {
// see browserCheck mixin
this.checkBrowser()
// Check sidebar status in previous sessions
if (localStorage.getItem('sidebarOpen') === 'false') {
if (BrowserStorage.getItem('sidebarOpen') === 'false') {
this.$store.dispatch('hideSidebar')
} else if (localStorage.getItem('sidebarOpen') === 'true') {
} else if (BrowserStorage.getItem('sidebarOpen') === 'true') {
this.$store.dispatch('showSidebar')
}
},

Просмотреть файл

@ -74,6 +74,7 @@ import AppSidebar from '@nextcloud/vue/dist/Components/AppSidebar'
import AppSidebarTab from '@nextcloud/vue/dist/Components/AppSidebarTab'
import ChatView from '../ChatView'
import { CollectionList } from 'nextcloud-vue-collections'
import BrowserStorage from '../../services/BrowserStorage'
import { CONVERSATION, WEBINAR, PARTICIPANT } from '../../constants'
import ParticipantsTab from './Participants/ParticipantsTab'
import {
@ -199,7 +200,7 @@ export default {
handleClose() {
this.dismissEditing()
this.$store.dispatch('hideSidebar')
localStorage.setItem('sidebarOpen', 'false')
BrowserStorage.setItem('sidebarOpen', 'false')
},
async onFavoriteChange() {

Просмотреть файл

@ -151,6 +151,7 @@ import Popover from '@nextcloud/vue/dist/Components/Popover'
import Actions from '@nextcloud/vue/dist/Components/Actions'
import CallButton from './CallButton'
import { EventBus } from '../../services/EventBus'
import BrowserStorage from '../../services/BrowserStorage'
import ActionCheckbox from '@nextcloud/vue/dist/Components/ActionCheckbox'
import ActionInput from '@nextcloud/vue/dist/Components/ActionInput'
import ActionLink from '@nextcloud/vue/dist/Components/ActionLink'
@ -366,7 +367,7 @@ export default {
methods: {
openSidebar() {
this.$store.dispatch('showSidebar')
localStorage.setItem('sidebarOpen', 'true')
BrowserStorage.setItem('sidebarOpen', 'true')
},
fullScreenChanged() {

Просмотреть файл

@ -0,0 +1,23 @@
/**
* @copyright Copyright (c) 2020 Joas Schilling <coding@schilljs.com>
*
* @license GNU AGPL version 3 or any later version
*
* This program is free software: you can redistribute it and/or modify
* it under the terms of the GNU Affero General Public License as
* published by the Free Software Foundation, either version 3 of the
* License, or (at your option) any later version.
*
* This program is distributed in the hope that it will be useful,
* but WITHOUT ANY WARRANTY; without even the implied warranty of
* MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
* GNU Affero General Public License for more details.
*
* You should have received a copy of the GNU Affero General Public License
* along with this program. If not, see <http://www.gnu.org/licenses/>.
*
*/
import { getBuilder } from '@nextcloud/browser-storage'
export default getBuilder('talk').persist().build()