Task lists WIP:

* remember if task app was open, and restore when in fullpage mode
* refactoring
This commit is contained in:
John Livingston
2024-05-12 16:02:13 +02:00
parent 5c9733147b
commit 9ef71c07dd
6 changed files with 11 additions and 6 deletions

View File

@ -16,7 +16,8 @@ export default class MUCTaskApp extends CustomElement {
}
async initialize () {
this.show = false
this.show = api.settings.get('livechat_task_app_restore') &&
(window.sessionStorage?.getItem?.('livechat-converse-task-app-show') === '1')
}
render () {
@ -25,6 +26,7 @@ export default class MUCTaskApp extends CustomElement {
toggleApp () {
this.show = !this.show
window.sessionStorage?.setItem?.('livechat-converse-task-app-show', this.show ? '1' : '')
}
}

View File

@ -18,7 +18,8 @@ converse.plugins.add('livechat-converse-tasks', {
_converse.ChatRoomTasks = ChatRoomTasks
_converse.api.settings.extend({
livechat_task_list_enabled: false
livechat_task_app_enabled: false,
livechat_task_app_restore: false // should we open the app by default if it was previously oppened?
})
_converse.api.listen.on('chatRoomInitialized', muc => {

View File

@ -89,7 +89,7 @@ export function initOrDestroyChatRoomTaskLists (mucModel) {
return _destroyChatRoomTaskLists(mucModel)
}
if (!api.settings.get('livechat_task_list_enabled')) {
if (!api.settings.get('livechat_task_app_enabled')) {
// Feature disabled, no need to handle tasks.
return _destroyChatRoomTaskLists(mucModel)
}