2021-05-10 19:04:04 +00:00
|
|
|
const prosodySettings = ['prosody-port']
|
|
|
|
const converseSettings = ['chat-server', 'chat-room', 'chat-bosh-uri', 'chat-ws-uri']
|
|
|
|
const otherSettings: string[] = []
|
|
|
|
|
|
|
|
function register ({ registerSettingsScript }: RegisterOptions): void {
|
2021-06-02 10:32:00 +00:00
|
|
|
registerSettingsScript({
|
|
|
|
isSettingHidden: options => {
|
|
|
|
const name = options.setting.name
|
|
|
|
if (prosodySettings.includes(name)) {
|
|
|
|
return options.formValues['chat-use-prosody'] !== true
|
2021-05-10 19:04:04 +00:00
|
|
|
}
|
2021-06-02 10:32:00 +00:00
|
|
|
if (name === 'chat-use-builtin') {
|
|
|
|
return options.formValues['chat-use-prosody'] === true
|
|
|
|
}
|
|
|
|
if (converseSettings.includes(name)) {
|
|
|
|
return options.formValues['chat-use-builtin'] !== true || options.formValues['chat-use-prosody'] === true
|
|
|
|
}
|
|
|
|
if (name === 'chat-uri') {
|
|
|
|
return options.formValues['chat-use-prosody'] === true || options.formValues['chat-use-builtin'] === true
|
|
|
|
}
|
|
|
|
if (otherSettings.includes(name)) {
|
|
|
|
return options.formValues['chat-use-builtin'] === true || options.formValues['chat-use-prosody'] === true
|
|
|
|
}
|
|
|
|
return false
|
|
|
|
}
|
|
|
|
})
|
2021-05-10 19:04:04 +00:00
|
|
|
}
|
|
|
|
|
|
|
|
export {
|
|
|
|
register
|
|
|
|
}
|