make helper methods easy to access from java code

Signed-off-by: Andy Scherzinger <info@andy-scherzinger.de>
This commit is contained in:
Andy Scherzinger 2022-07-05 22:41:55 +02:00
parent 0fe26b6d08
commit 9fb176dc88
No known key found for this signature in database
GPG key ID: 6CADC7E3523C308B

View file

@ -36,6 +36,7 @@ object CapabilitiesUtilNew {
return false return false
} }
@JvmStatic
fun isServerEOL(user: User): Boolean { fun isServerEOL(user: User): Boolean {
// Capability is available since Talk 4 => Nextcloud 14 => Autmn 2018 // Capability is available since Talk 4 => Nextcloud 14 => Autmn 2018
return !hasSpreedFeatureCapability(user, "no-ping") return !hasSpreedFeatureCapability(user, "no-ping")
@ -50,6 +51,7 @@ object CapabilitiesUtilNew {
return hasSpreedFeatureCapability(user, "chat-read-marker") return hasSpreedFeatureCapability(user, "chat-read-marker")
} }
@JvmStatic
fun hasSpreedFeatureCapability(user: User, capabilityName: String): Boolean { fun hasSpreedFeatureCapability(user: User, capabilityName: String): Boolean {
if (user.capabilities?.spreedCapability?.features != null) { if (user.capabilities?.spreedCapability?.features != null) {
return user.capabilities!!.spreedCapability!!.features!!.contains(capabilityName) return user.capabilities!!.spreedCapability!!.features!!.contains(capabilityName)
@ -97,6 +99,7 @@ object CapabilitiesUtilNew {
return false return false
} }
@JvmStatic
fun isUserStatusAvailable(user: User): Boolean { fun isUserStatusAvailable(user: User): Boolean {
return user.capabilities?.userStatusCapability?.enabled == true && return user.capabilities?.userStatusCapability?.enabled == true &&
user.capabilities?.userStatusCapability?.supportsEmoji == true user.capabilities?.userStatusCapability?.supportsEmoji == true
@ -146,6 +149,7 @@ object CapabilitiesUtilNew {
return false return false
} }
@JvmStatic
fun isUnifiedSearchAvailable(user: User): Boolean { fun isUnifiedSearchAvailable(user: User): Boolean {
return hasSpreedFeatureCapability(user, "unified-search") return hasSpreedFeatureCapability(user, "unified-search")
} }