Use 'val' instead of 'var'

Signed-off-by: Tim Krüger <t@timkrueger.me>
This commit is contained in:
Tim Krüger 2022-09-08 10:55:19 +02:00
parent 2780636b5a
commit c031e7063e
No known key found for this signature in database
GPG Key ID: FECE3A7222C52A4E

View File

@ -2,6 +2,8 @@
* Nextcloud Talk application * Nextcloud Talk application
* *
* @author Marcel Hibbe * @author Marcel Hibbe
* @author Tim Krüger
* Copyright (C) 2022 Tim Krüger <t@timkrueger.me>
* Copyright (C) 2022 Marcel Hibbe <dev@mhibbe.de> * Copyright (C) 2022 Marcel Hibbe <dev@mhibbe.de>
* *
* This program is free software: you can redistribute it and/or modify * This program is free software: you can redistribute it and/or modify
@ -27,27 +29,16 @@ import com.nextcloud.talk.utils.database.user.CapabilitiesUtilNew
* see https://nextcloud-talk.readthedocs.io/en/latest/constants/#attendee-permissions * see https://nextcloud-talk.readthedocs.io/en/latest/constants/#attendee-permissions
*/ */
class AttendeePermissionsUtil(flag: Int) { class AttendeePermissionsUtil(flag: Int) {
var isDefault: Boolean = false
var isCustom: Boolean = false
var canStartCall: Boolean = false
var canJoinCall: Boolean = false
var canIgnoreLobby: Boolean = false
var canPublishAudio: Boolean = false
var canPublishVideo: Boolean = false
var canPublishScreen: Boolean = false
private var hasChatPermission: Boolean = false
init { val isDefault = (flag and DEFAULT) == DEFAULT
isDefault = (flag and DEFAULT) == DEFAULT val isCustom = (flag and CUSTOM) == CUSTOM
isCustom = (flag and CUSTOM) == CUSTOM val canStartCall = (flag and START_CALL) == START_CALL
canStartCall = (flag and START_CALL) == START_CALL val canJoinCall = (flag and JOIN_CALL) == JOIN_CALL
canJoinCall = (flag and JOIN_CALL) == JOIN_CALL val canIgnoreLobby = (flag and CAN_IGNORE_LOBBY) == CAN_IGNORE_LOBBY
canIgnoreLobby = (flag and CAN_IGNORE_LOBBY) == CAN_IGNORE_LOBBY val canPublishAudio = (flag and PUBLISH_AUDIO) == PUBLISH_AUDIO
canPublishAudio = (flag and PUBLISH_AUDIO) == PUBLISH_AUDIO val canPublishVideo = (flag and PUBLISH_VIDEO) == PUBLISH_VIDEO
canPublishVideo = (flag and PUBLISH_VIDEO) == PUBLISH_VIDEO val canPublishScreen = (flag and PUBLISH_SCREEN) == PUBLISH_SCREEN
canPublishScreen = (flag and PUBLISH_SCREEN) == PUBLISH_SCREEN private val hasChatPermission = (flag and CHAT) == CHAT
hasChatPermission = (flag and CHAT) == CHAT
}
fun hasChatPermission(user: User): Boolean { fun hasChatPermission(user: User): Boolean {
if (CapabilitiesUtilNew.hasSpreedFeatureCapability(user, "chat-permission")) { if (CapabilitiesUtilNew.hasSpreedFeatureCapability(user, "chat-permission")) {