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