Task lists WIP:
* remember if task app was open, and restore when in fullpage mode * refactoring
This commit is contained in:
parent
5c9733147b
commit
9ef71c07dd
@ -194,7 +194,8 @@ async function initConverse (
|
|||||||
// We enable task list only if we are in the peertube interface.
|
// We enable task list only if we are in the peertube interface.
|
||||||
// Technically it would work in 'chat-only' mode, but i don't want to add too many things to test
|
// Technically it would work in 'chat-only' mode, but i don't want to add too many things to test
|
||||||
// (and i now there is some CSS bugs in the task list).
|
// (and i now there is some CSS bugs in the task list).
|
||||||
params.livechat_task_list_enabled = true
|
params.livechat_task_app_enabled = true
|
||||||
|
params.livechat_task_app_restore = chatIncludeMode === 'peertube-fullpage'
|
||||||
}
|
}
|
||||||
|
|
||||||
try {
|
try {
|
||||||
|
@ -16,7 +16,8 @@ export default class MUCTaskApp extends CustomElement {
|
|||||||
}
|
}
|
||||||
|
|
||||||
async initialize () {
|
async initialize () {
|
||||||
this.show = false
|
this.show = api.settings.get('livechat_task_app_restore') &&
|
||||||
|
(window.sessionStorage?.getItem?.('livechat-converse-task-app-show') === '1')
|
||||||
}
|
}
|
||||||
|
|
||||||
render () {
|
render () {
|
||||||
@ -25,6 +26,7 @@ export default class MUCTaskApp extends CustomElement {
|
|||||||
|
|
||||||
toggleApp () {
|
toggleApp () {
|
||||||
this.show = !this.show
|
this.show = !this.show
|
||||||
|
window.sessionStorage?.setItem?.('livechat-converse-task-app-show', this.show ? '1' : '')
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
|
@ -18,7 +18,8 @@ converse.plugins.add('livechat-converse-tasks', {
|
|||||||
_converse.ChatRoomTasks = ChatRoomTasks
|
_converse.ChatRoomTasks = ChatRoomTasks
|
||||||
|
|
||||||
_converse.api.settings.extend({
|
_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 => {
|
_converse.api.listen.on('chatRoomInitialized', muc => {
|
||||||
|
@ -89,7 +89,7 @@ export function initOrDestroyChatRoomTaskLists (mucModel) {
|
|||||||
return _destroyChatRoomTaskLists(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.
|
// Feature disabled, no need to handle tasks.
|
||||||
return _destroyChatRoomTaskLists(mucModel)
|
return _destroyChatRoomTaskLists(mucModel)
|
||||||
}
|
}
|
||||||
|
@ -5,7 +5,7 @@ import { html } from 'lit'
|
|||||||
export default (o) => {
|
export default (o) => {
|
||||||
return html`
|
return html`
|
||||||
${
|
${
|
||||||
o?.model && api.settings.get('livechat_task_list_enabled')
|
o?.model && api.settings.get('livechat_task_app_enabled')
|
||||||
? html`<livechat-converse-muc-task-app .model=${o.model}></livechat-converse-muc-task-app>`
|
? html`<livechat-converse-muc-task-app .model=${o.model}></livechat-converse-muc-task-app>`
|
||||||
: ''
|
: ''
|
||||||
}
|
}
|
||||||
|
@ -86,7 +86,8 @@ export const livechatSpecificsPlugin = {
|
|||||||
'livechat_external_auth_reconnect_mode',
|
'livechat_external_auth_reconnect_mode',
|
||||||
'livechat_mini_muc_head',
|
'livechat_mini_muc_head',
|
||||||
'livechat_specific_external_authent',
|
'livechat_specific_external_authent',
|
||||||
'livechat_task_list_enabled'
|
'livechat_task_app_enabled',
|
||||||
|
'livechat_task_app_restore'
|
||||||
]) {
|
]) {
|
||||||
_converse.api.settings.set(k, params[k])
|
_converse.api.settings.set(k, params[k])
|
||||||
}
|
}
|
||||||
|
Loading…
x
Reference in New Issue
Block a user