update headers and format code

Signed-off-by: Andy Scherzinger <info@andy-scherzinger.de>
This commit is contained in:
Andy Scherzinger 2021-05-19 23:21:09 +02:00
parent ca8d6cb782
commit 4784a22e18
No known key found for this signature in database
GPG Key ID: 6CADC7E3523C308B
5 changed files with 24 additions and 17 deletions

View File

@ -2,6 +2,8 @@
* Nextcloud Talk application
*
* @author Mario Danic
* @author Andy Scherzinger
* Copyright (C) 2021 Andy Scherzinger (info@andy-scherzinger.de)
* Copyright (C) 2017-2018 Mario Danic <mario@lovelyhq.com>
*
* This program is free software: you can redistribute it and/or modify

View File

@ -5,15 +5,15 @@
* @author BlueLine Labs, Inc.
* @author Mario Danic
* Copyright (C) 2021 Andy Scherzinger (info@andy-scherzinger.de)
* Copyright (C) 2021 BlueLine Labs, Inc.
* Copyright (C) 2020 Mario Danic (mario@lovelyhq.com)
* Copyright (C) 2016 BlueLine Labs, Inc.
* <p>
*
* Licensed under the Apache License, Version 2.0 (the "License");
* you may not use this file except in compliance with the License.
* You may obtain a copy of the License at
* <p>
*
* http://www.apache.org/licenses/LICENSE-2.0
* <p>
*
* Unless required by applicable law or agreed to in writing, software
* distributed under the License is distributed on an "AS IS" BASIS,
* WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.

View File

@ -3,13 +3,13 @@
*
* @author BlueLine Labs, Inc.
* Copyright (C) 2016 BlueLine Labs, Inc.
* <p>
*
* Licensed under the Apache License, Version 2.0 (the "License");
* you may not use this file except in compliance with the License.
* You may obtain a copy of the License at
* <p>
*
* http://www.apache.org/licenses/LICENSE-2.0
* <p>
*
* Unless required by applicable law or agreed to in writing, software
* distributed under the License is distributed on an "AS IS" BASIS,
* WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.

View File

@ -39,7 +39,8 @@ public abstract class CapabilitiesUtil {
if (user != null && user.getCapabilities() != null) {
try {
Capabilities capabilities = LoganSquare.parse(user.getCapabilities(), Capabilities.class);
if (capabilities.getNotificationsCapability() != null && capabilities.getNotificationsCapability().getFeatures() != null) {
if (capabilities.getNotificationsCapability() != null &&
capabilities.getNotificationsCapability().getFeatures() != null) {
return capabilities.getSpreedCapability().getFeatures().contains(capabilityName);
}
} catch (IOException e) {
@ -53,7 +54,8 @@ public abstract class CapabilitiesUtil {
if (user != null && user.getCapabilities() != null) {
try {
Capabilities capabilities = LoganSquare.parse(user.getCapabilities(), Capabilities.class);
if (capabilities.getExternalCapability() != null && capabilities.getExternalCapability().containsKey("v1")) {
if (capabilities.getExternalCapability() != null &&
capabilities.getExternalCapability().containsKey("v1")) {
return capabilities.getExternalCapability().get("v1").contains("capabilityName");
}
} catch (IOException e) {
@ -92,9 +94,14 @@ public abstract class CapabilitiesUtil {
if (user != null && user.getCapabilities() != null) {
try {
Capabilities capabilities = LoganSquare.parse(user.getCapabilities(), Capabilities.class);
if (capabilities != null && capabilities.getSpreedCapability() != null && capabilities.getSpreedCapability().getConfig() != null
&& capabilities.getSpreedCapability().getConfig().containsKey("chat")) {
HashMap<String, String> chatConfigHashMap = capabilities.getSpreedCapability().getConfig().get("chat");
if (capabilities != null &&
capabilities.getSpreedCapability() != null &&
capabilities.getSpreedCapability().getConfig() != null &&
capabilities.getSpreedCapability().getConfig().containsKey("chat")) {
HashMap<String, String> chatConfigHashMap = capabilities
.getSpreedCapability()
.getConfig()
.get("chat");
if (chatConfigHashMap != null && chatConfigHashMap.containsKey("max-length")) {
int chatSize = Integer.parseInt(chatConfigHashMap.get("max-length"));
if (chatSize > 0) {

View File

@ -2,6 +2,8 @@
* Nextcloud Talk application
*
* @author Mario Danic
* @author Andy Scherzinger
* Copyright (C) 2021 Andy Scherzinger (info@andy-scherzinger.de)
* Copyright (C) 2017-2018 Mario Danic <mario@lovelyhq.com>
*
* This program is free software: you can redistribute it and/or modify
@ -20,14 +22,10 @@
package com.nextcloud.talk.models.database
import android.os.Parcelable
import android.util.Log
import com.bluelinelabs.logansquare.LoganSquare
import com.nextcloud.talk.models.json.capabilities.Capabilities
import io.requery.Entity
import io.requery.Generated
import io.requery.Key
import io.requery.Persistable
import java.io.IOException
import java.io.Serializable
@Entity
@ -50,4 +48,4 @@ interface User : Parcelable, Persistable, Serializable {
companion object {
const val TAG = "UserEntity"
}
}
}