mirror of
https://github.com/nextcloud/talk-android
synced 2025-06-20 12:09:45 +01:00
remove all legacy code except basic requery implementation still needed for the cypher upgrade
Signed-off-by: Andy Scherzinger <info@andy-scherzinger.de>
This commit is contained in:
parent
99049e01d7
commit
9ab4c58b41
@ -48,7 +48,6 @@ import com.nextcloud.talk.controllers.WebViewLoginController
|
|||||||
import com.nextcloud.talk.controllers.base.providers.ActionBarProvider
|
import com.nextcloud.talk.controllers.base.providers.ActionBarProvider
|
||||||
import com.nextcloud.talk.data.user.model.User
|
import com.nextcloud.talk.data.user.model.User
|
||||||
import com.nextcloud.talk.databinding.ActivityMainBinding
|
import com.nextcloud.talk.databinding.ActivityMainBinding
|
||||||
import com.nextcloud.talk.models.database.UserEntity
|
|
||||||
import com.nextcloud.talk.models.json.conversations.RoomOverall
|
import com.nextcloud.talk.models.json.conversations.RoomOverall
|
||||||
import com.nextcloud.talk.users.UserManager
|
import com.nextcloud.talk.users.UserManager
|
||||||
import com.nextcloud.talk.utils.ApiUtils
|
import com.nextcloud.talk.utils.ApiUtils
|
||||||
@ -376,7 +375,7 @@ class MainActivity : BaseActivity(), ActionBarProvider {
|
|||||||
startActivity(callNotificationIntent)
|
startActivity(callNotificationIntent)
|
||||||
} else {
|
} else {
|
||||||
remapChatController(
|
remapChatController(
|
||||||
router!!, intent.getParcelableExtra<UserEntity>(KEY_USER_ENTITY)!!.id,
|
router!!, intent.getParcelableExtra<User>(KEY_USER_ENTITY)!!.id!!,
|
||||||
intent.getStringExtra(KEY_ROOM_TOKEN)!!, intent.extras!!, false, true
|
intent.getStringExtra(KEY_ROOM_TOKEN)!!, intent.extras!!, false, true
|
||||||
)
|
)
|
||||||
}
|
}
|
||||||
|
@ -1,297 +0,0 @@
|
|||||||
/*
|
|
||||||
* Nextcloud Talk application
|
|
||||||
*
|
|
||||||
* @author Andy Scherzinger
|
|
||||||
* @author Mario Danic
|
|
||||||
* 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
|
|
||||||
* it under the terms of the GNU General Public License as published by
|
|
||||||
* the Free Software Foundation, either version 3 of the License, or
|
|
||||||
* at your option) any later version.
|
|
||||||
*
|
|
||||||
* This program is distributed in the hope that it will be useful,
|
|
||||||
* but WITHOUT ANY WARRANTY; without even the implied warranty of
|
|
||||||
* MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
|
|
||||||
* GNU General Public License for more details.
|
|
||||||
*
|
|
||||||
* You should have received a copy of the GNU General Public License
|
|
||||||
* along with this program. If not, see <http://www.gnu.org/licenses/>.
|
|
||||||
*/
|
|
||||||
package com.nextcloud.talk.models.database;
|
|
||||||
|
|
||||||
import android.util.Log;
|
|
||||||
|
|
||||||
import com.bluelinelabs.logansquare.LoganSquare;
|
|
||||||
import com.nextcloud.talk.models.json.capabilities.Capabilities;
|
|
||||||
|
|
||||||
import java.io.IOException;
|
|
||||||
import java.util.HashMap;
|
|
||||||
import java.util.Map;
|
|
||||||
|
|
||||||
import androidx.annotation.NonNull;
|
|
||||||
import androidx.annotation.Nullable;
|
|
||||||
|
|
||||||
/**
|
|
||||||
* Deprecated, please migrate to {@link com.nextcloud.talk.utils.database.user.CapabilitiesUtilNew}.
|
|
||||||
*/
|
|
||||||
@Deprecated
|
|
||||||
public abstract class CapabilitiesUtil {
|
|
||||||
private static final String TAG = CapabilitiesUtil.class.getSimpleName();
|
|
||||||
|
|
||||||
public static boolean hasNotificationsCapability(@Nullable UserEntity user, String capabilityName) {
|
|
||||||
if (user != null && user.getCapabilities() != null) {
|
|
||||||
try {
|
|
||||||
Capabilities capabilities = parseUserCapabilities(user);
|
|
||||||
if (capabilities.getNotificationsCapability() != null &&
|
|
||||||
capabilities.getNotificationsCapability().getFeatures() != null) {
|
|
||||||
return capabilities.getSpreedCapability().getFeatures().contains(capabilityName);
|
|
||||||
}
|
|
||||||
} catch (IOException e) {
|
|
||||||
Log.e(TAG, "Failed to get capabilities for the user");
|
|
||||||
}
|
|
||||||
}
|
|
||||||
return false;
|
|
||||||
}
|
|
||||||
|
|
||||||
public static boolean hasExternalCapability(@Nullable UserEntity user, String capabilityName) {
|
|
||||||
if (user != null && user.getCapabilities() != null) {
|
|
||||||
try {
|
|
||||||
Capabilities capabilities = parseUserCapabilities(user);
|
|
||||||
if (capabilities.getExternalCapability() != null &&
|
|
||||||
capabilities.getExternalCapability().containsKey("v1")) {
|
|
||||||
return capabilities.getExternalCapability().get("v1").contains(capabilityName);
|
|
||||||
}
|
|
||||||
} catch (IOException e) {
|
|
||||||
Log.e(TAG, "Failed to get capabilities for the user");
|
|
||||||
}
|
|
||||||
}
|
|
||||||
return false;
|
|
||||||
}
|
|
||||||
|
|
||||||
public static boolean isServerEOL(@Nullable UserEntity user) {
|
|
||||||
// Capability is available since Talk 4 => Nextcloud 14 => Autmn 2018
|
|
||||||
return !hasSpreedFeatureCapability(user, "no-ping");
|
|
||||||
}
|
|
||||||
|
|
||||||
public static boolean isServerAlmostEOL(@Nullable UserEntity user) {
|
|
||||||
// Capability is available since Talk 8 => Nextcloud 18 => January 2020
|
|
||||||
return !hasSpreedFeatureCapability(user, "chat-replies");
|
|
||||||
}
|
|
||||||
|
|
||||||
public static boolean canSetChatReadMarker(@Nullable UserEntity user) {
|
|
||||||
return hasSpreedFeatureCapability(user, "chat-read-marker");
|
|
||||||
}
|
|
||||||
|
|
||||||
public static boolean hasSpreedFeatureCapability(@Nullable UserEntity user, String capabilityName) {
|
|
||||||
if (user != null && user.getCapabilities() != null) {
|
|
||||||
try {
|
|
||||||
Capabilities capabilities = parseUserCapabilities(user);
|
|
||||||
if (capabilities != null && capabilities.getSpreedCapability() != null &&
|
|
||||||
capabilities.getSpreedCapability().getFeatures() != null) {
|
|
||||||
return capabilities.getSpreedCapability().getFeatures().contains(capabilityName);
|
|
||||||
}
|
|
||||||
} catch (IOException e) {
|
|
||||||
Log.e(TAG, "Failed to get capabilities for the user");
|
|
||||||
}
|
|
||||||
}
|
|
||||||
return false;
|
|
||||||
}
|
|
||||||
|
|
||||||
public static Integer getMessageMaxLength(@Nullable UserEntity user) {
|
|
||||||
if (user != null && user.getCapabilities() != null) {
|
|
||||||
try {
|
|
||||||
Capabilities capabilities = parseUserCapabilities(user);
|
|
||||||
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) {
|
|
||||||
return chatSize;
|
|
||||||
} else {
|
|
||||||
return 1000;
|
|
||||||
}
|
|
||||||
}
|
|
||||||
}
|
|
||||||
} catch (IOException e) {
|
|
||||||
Log.e(TAG, "Failed to get capabilities for the user");
|
|
||||||
}
|
|
||||||
}
|
|
||||||
return 1000;
|
|
||||||
}
|
|
||||||
|
|
||||||
@Deprecated
|
|
||||||
public static boolean isPhoneBookIntegrationAvailable(@Nullable UserEntity user) {
|
|
||||||
if (user != null && user.getCapabilities() != null) {
|
|
||||||
try {
|
|
||||||
Capabilities capabilities = parseUserCapabilities(user);
|
|
||||||
return capabilities != null &&
|
|
||||||
capabilities.getSpreedCapability() != null &&
|
|
||||||
capabilities.getSpreedCapability().getFeatures() != null &&
|
|
||||||
capabilities.getSpreedCapability().getFeatures().contains("phonebook-search");
|
|
||||||
} catch (IOException e) {
|
|
||||||
Log.e(TAG, "Failed to get capabilities for the user");
|
|
||||||
}
|
|
||||||
}
|
|
||||||
return false;
|
|
||||||
}
|
|
||||||
|
|
||||||
public static boolean isReadStatusAvailable(@Nullable UserEntity user) {
|
|
||||||
if (user != null && user.getCapabilities() != null) {
|
|
||||||
try {
|
|
||||||
Capabilities capabilities = parseUserCapabilities(user);
|
|
||||||
if (capabilities != null &&
|
|
||||||
capabilities.getSpreedCapability() != null &&
|
|
||||||
capabilities.getSpreedCapability().getConfig() != null &&
|
|
||||||
capabilities.getSpreedCapability().getConfig().containsKey("chat")) {
|
|
||||||
Map<String, String> map = capabilities.getSpreedCapability().getConfig().get("chat");
|
|
||||||
return map != null && map.containsKey("read-privacy");
|
|
||||||
}
|
|
||||||
} catch (IOException e) {
|
|
||||||
Log.e(TAG, "Failed to get capabilities for the user");
|
|
||||||
}
|
|
||||||
}
|
|
||||||
return false;
|
|
||||||
}
|
|
||||||
|
|
||||||
@Deprecated
|
|
||||||
public static boolean isReadStatusPrivate(@Nullable UserEntity user) {
|
|
||||||
if (user != null && user.getCapabilities() != null) {
|
|
||||||
try {
|
|
||||||
Capabilities capabilities = parseUserCapabilities(user);
|
|
||||||
if (capabilities != null &&
|
|
||||||
capabilities.getSpreedCapability() != null &&
|
|
||||||
capabilities.getSpreedCapability().getConfig() != null &&
|
|
||||||
capabilities.getSpreedCapability().getConfig().containsKey("chat")) {
|
|
||||||
HashMap<String, String> map = capabilities.getSpreedCapability().getConfig().get("chat");
|
|
||||||
if (map != null && map.containsKey("read-privacy")) {
|
|
||||||
return Integer.parseInt(map.get("read-privacy")) == 1;
|
|
||||||
}
|
|
||||||
}
|
|
||||||
} catch (IOException e) {
|
|
||||||
Log.e(TAG, "Failed to get capabilities for the user");
|
|
||||||
}
|
|
||||||
}
|
|
||||||
return false;
|
|
||||||
}
|
|
||||||
|
|
||||||
public static boolean isUserStatusAvailable(@Nullable UserEntity user) {
|
|
||||||
if (user != null && user.getCapabilities() != null) {
|
|
||||||
try {
|
|
||||||
Capabilities capabilities = parseUserCapabilities(user);
|
|
||||||
if (capabilities.getUserStatusCapability() != null &&
|
|
||||||
capabilities.getUserStatusCapability().getEnabled() &&
|
|
||||||
capabilities.getUserStatusCapability().getSupportsEmoji()) {
|
|
||||||
return true;
|
|
||||||
}
|
|
||||||
} catch (IOException e) {
|
|
||||||
Log.e(TAG, "Failed to get capabilities for the user");
|
|
||||||
}
|
|
||||||
}
|
|
||||||
return false;
|
|
||||||
}
|
|
||||||
|
|
||||||
public static String getAttachmentFolder(@Nullable UserEntity user) {
|
|
||||||
if (user != null && user.getCapabilities() != null) {
|
|
||||||
try {
|
|
||||||
Capabilities capabilities = parseUserCapabilities(user);
|
|
||||||
if (capabilities != null &&
|
|
||||||
capabilities.getSpreedCapability() != null &&
|
|
||||||
capabilities.getSpreedCapability().getConfig() != null &&
|
|
||||||
capabilities.getSpreedCapability().getConfig().containsKey("attachments")) {
|
|
||||||
HashMap<String, String> map = capabilities.getSpreedCapability().getConfig().get("attachments");
|
|
||||||
if (map != null && map.containsKey("folder")) {
|
|
||||||
return map.get("folder");
|
|
||||||
}
|
|
||||||
}
|
|
||||||
} catch (IOException e) {
|
|
||||||
Log.e("User.java", "Failed to get attachment folder", e);
|
|
||||||
}
|
|
||||||
}
|
|
||||||
return "/Talk";
|
|
||||||
}
|
|
||||||
|
|
||||||
public static String getServerName(@Nullable UserEntity user) {
|
|
||||||
if (user != null && user.getCapabilities() != null) {
|
|
||||||
try {
|
|
||||||
Capabilities capabilities = parseUserCapabilities(user);
|
|
||||||
if (capabilities != null && capabilities.getThemingCapability() != null) {
|
|
||||||
return capabilities.getThemingCapability().getName();
|
|
||||||
}
|
|
||||||
} catch (IOException e) {
|
|
||||||
Log.e("User.java", "Failed to get server name", e);
|
|
||||||
}
|
|
||||||
}
|
|
||||||
return "";
|
|
||||||
}
|
|
||||||
|
|
||||||
// TODO later avatar can also be checked via user fields, for now it is in Talk capability
|
|
||||||
public static boolean isAvatarEndpointAvailable(@Nullable UserEntity user) {
|
|
||||||
if (user != null && user.getCapabilities() != null) {
|
|
||||||
try {
|
|
||||||
Capabilities capabilities = parseUserCapabilities(user);
|
|
||||||
return (capabilities != null &&
|
|
||||||
capabilities.getSpreedCapability() != null &&
|
|
||||||
capabilities.getSpreedCapability().getFeatures() != null &&
|
|
||||||
capabilities.getSpreedCapability().getFeatures().contains("temp-user-avatar-api"));
|
|
||||||
} catch (IOException e) {
|
|
||||||
Log.e("User.java", "Failed to get server name", e);
|
|
||||||
}
|
|
||||||
}
|
|
||||||
return false;
|
|
||||||
}
|
|
||||||
|
|
||||||
public static boolean canEditScopes(@Nullable UserEntity user) {
|
|
||||||
if (user != null && user.getCapabilities() != null) {
|
|
||||||
try {
|
|
||||||
Capabilities capabilities = parseUserCapabilities(user);
|
|
||||||
return (capabilities != null &&
|
|
||||||
capabilities.getProvisioningCapability() != null &&
|
|
||||||
capabilities.getProvisioningCapability().getAccountPropertyScopesVersion() != null &&
|
|
||||||
capabilities.getProvisioningCapability().getAccountPropertyScopesVersion() > 1);
|
|
||||||
} catch (IOException e) {
|
|
||||||
Log.e("User.java", "Failed to get server name", e);
|
|
||||||
}
|
|
||||||
}
|
|
||||||
return false;
|
|
||||||
}
|
|
||||||
|
|
||||||
public static boolean isAbleToCall(@Nullable UserEntity user) {
|
|
||||||
if (user != null && user.getCapabilities() != null) {
|
|
||||||
try {
|
|
||||||
Capabilities capabilities = parseUserCapabilities(user);
|
|
||||||
if (capabilities != null &&
|
|
||||||
capabilities.getSpreedCapability() != null &&
|
|
||||||
capabilities.getSpreedCapability().getConfig() != null &&
|
|
||||||
capabilities.getSpreedCapability().getConfig().containsKey("call") &&
|
|
||||||
capabilities.getSpreedCapability().getConfig().get("call") != null &&
|
|
||||||
capabilities.getSpreedCapability().getConfig().get("call").containsKey("enabled")) {
|
|
||||||
return Boolean.parseBoolean(
|
|
||||||
capabilities.getSpreedCapability().getConfig().get("call").get("enabled"));
|
|
||||||
} else {
|
|
||||||
// older nextcloud versions without the capability can't disable the calls
|
|
||||||
return true;
|
|
||||||
}
|
|
||||||
} catch (IOException e) {
|
|
||||||
Log.e(TAG, "Failed to get capabilities for the user", e);
|
|
||||||
}
|
|
||||||
}
|
|
||||||
return false;
|
|
||||||
}
|
|
||||||
|
|
||||||
@Deprecated
|
|
||||||
private static Capabilities parseUserCapabilities(@NonNull final UserEntity user) throws IOException {
|
|
||||||
return LoganSquare.parse(user.getCapabilities(), Capabilities.class);
|
|
||||||
}
|
|
||||||
|
|
||||||
public static boolean isUnifiedSearchAvailable(@Nullable final UserEntity user) {
|
|
||||||
return hasSpreedFeatureCapability(user, "unified-search");
|
|
||||||
}
|
|
||||||
}
|
|
@ -32,7 +32,6 @@ import com.nextcloud.talk.R;
|
|||||||
import com.nextcloud.talk.application.NextcloudTalkApplication;
|
import com.nextcloud.talk.application.NextcloudTalkApplication;
|
||||||
import com.nextcloud.talk.data.user.model.User;
|
import com.nextcloud.talk.data.user.model.User;
|
||||||
import com.nextcloud.talk.models.RetrofitBucket;
|
import com.nextcloud.talk.models.RetrofitBucket;
|
||||||
import com.nextcloud.talk.models.database.CapabilitiesUtil;
|
|
||||||
import com.nextcloud.talk.models.database.UserEntity;
|
import com.nextcloud.talk.models.database.UserEntity;
|
||||||
import com.nextcloud.talk.utils.database.user.CapabilitiesUtilNew;
|
import com.nextcloud.talk.utils.database.user.CapabilitiesUtilNew;
|
||||||
|
|
||||||
@ -123,11 +122,6 @@ public class ApiUtils {
|
|||||||
return baseUrl + ocsApiVersion + "/cloud/capabilities";
|
return baseUrl + ocsApiVersion + "/cloud/capabilities";
|
||||||
}
|
}
|
||||||
|
|
||||||
@Deprecated
|
|
||||||
public static int getCallApiVersion(UserEntity capabilities, int[] versions) throws NoSupportedApiException {
|
|
||||||
return getCallApiVersion(LegacyUserEntityMapper.toModel(capabilities), versions);
|
|
||||||
}
|
|
||||||
|
|
||||||
public static int getCallApiVersion(User capabilities, int[] versions) throws NoSupportedApiException {
|
public static int getCallApiVersion(User capabilities, int[] versions) throws NoSupportedApiException {
|
||||||
return getConversationApiVersion(capabilities, versions);
|
return getConversationApiVersion(capabilities, versions);
|
||||||
}
|
}
|
||||||
@ -163,16 +157,6 @@ public class ApiUtils {
|
|||||||
throw new NoSupportedApiException();
|
throw new NoSupportedApiException();
|
||||||
}
|
}
|
||||||
|
|
||||||
@Deprecated
|
|
||||||
public static int getConversationApiVersion(UserEntity user, int[] versions) throws NoSupportedApiException {
|
|
||||||
return getConversationApiVersion(LegacyUserEntityMapper.toModel(user), versions);
|
|
||||||
}
|
|
||||||
|
|
||||||
@Deprecated
|
|
||||||
public static int getSignalingApiVersion(UserEntity user, int[] versions) throws NoSupportedApiException {
|
|
||||||
return getSignalingApiVersion(LegacyUserEntityMapper.toModel(user), versions);
|
|
||||||
}
|
|
||||||
|
|
||||||
public static int getSignalingApiVersion(User user, int[] versions) throws NoSupportedApiException {
|
public static int getSignalingApiVersion(User user, int[] versions) throws NoSupportedApiException {
|
||||||
for (int version : versions) {
|
for (int version : versions) {
|
||||||
if (CapabilitiesUtilNew.hasSpreedFeatureCapability(user, "signaling-v" + version)) {
|
if (CapabilitiesUtilNew.hasSpreedFeatureCapability(user, "signaling-v" + version)) {
|
||||||
@ -194,25 +178,6 @@ public class ApiUtils {
|
|||||||
throw new NoSupportedApiException();
|
throw new NoSupportedApiException();
|
||||||
}
|
}
|
||||||
|
|
||||||
/**
|
|
||||||
* migrate to {@link #getChatApiVersion(User, int[])}.
|
|
||||||
*
|
|
||||||
* @param user User
|
|
||||||
* @param versions API versions
|
|
||||||
* @return to be used verison
|
|
||||||
* @throws NoSupportedApiException if no supported version available
|
|
||||||
*/
|
|
||||||
@Deprecated
|
|
||||||
public static int getChatApiVersion(UserEntity user, int[] versions) throws NoSupportedApiException {
|
|
||||||
for (int version : versions) {
|
|
||||||
if (version == APIv1 && CapabilitiesUtil.hasSpreedFeatureCapability(user, "chat-v2")) {
|
|
||||||
// Do not question that chat-v2 capability shows the availability of api/v1/ endpoint *see no evil*
|
|
||||||
return version;
|
|
||||||
}
|
|
||||||
}
|
|
||||||
throw new NoSupportedApiException();
|
|
||||||
}
|
|
||||||
|
|
||||||
public static int getChatApiVersion(User user, int[] versions) throws NoSupportedApiException {
|
public static int getChatApiVersion(User user, int[] versions) throws NoSupportedApiException {
|
||||||
for (int version : versions) {
|
for (int version : versions) {
|
||||||
if (version == APIv1 && CapabilitiesUtilNew.hasSpreedFeatureCapability(user, "chat-v2")) {
|
if (version == APIv1 && CapabilitiesUtilNew.hasSpreedFeatureCapability(user, "chat-v2")) {
|
||||||
|
@ -21,7 +21,6 @@
|
|||||||
package com.nextcloud.talk.utils
|
package com.nextcloud.talk.utils
|
||||||
|
|
||||||
import com.nextcloud.talk.data.user.model.User
|
import com.nextcloud.talk.data.user.model.User
|
||||||
import com.nextcloud.talk.models.database.UserEntity
|
|
||||||
import com.nextcloud.talk.utils.database.user.CapabilitiesUtilNew
|
import com.nextcloud.talk.utils.database.user.CapabilitiesUtilNew
|
||||||
|
|
||||||
/**
|
/**
|
||||||
@ -50,11 +49,6 @@ class AttendeePermissionsUtil(flag: Int) {
|
|||||||
hasChatPermission = (flag and CHAT) == CHAT
|
hasChatPermission = (flag and CHAT) == CHAT
|
||||||
}
|
}
|
||||||
|
|
||||||
@Deprecated("use hasChatPermission(user: User) instead")
|
|
||||||
fun hasChatPermission(user: UserEntity): Boolean {
|
|
||||||
return hasChatPermission(LegacyUserEntityMapper.toModel(user)!!)
|
|
||||||
}
|
|
||||||
|
|
||||||
fun hasChatPermission(user: User): Boolean {
|
fun hasChatPermission(user: User): Boolean {
|
||||||
if (CapabilitiesUtilNew.hasSpreedFeatureCapability(user, "chat-permission")) {
|
if (CapabilitiesUtilNew.hasSpreedFeatureCapability(user, "chat-permission")) {
|
||||||
return hasChatPermission
|
return hasChatPermission
|
||||||
|
@ -197,10 +197,6 @@ public class DisplayUtils {
|
|||||||
return getImageRequestForUrl(url, (User) null);
|
return getImageRequestForUrl(url, (User) null);
|
||||||
}
|
}
|
||||||
|
|
||||||
public static ImageRequest getImageRequestForUrl(String url, @Nullable UserEntity userEntity) {
|
|
||||||
return getImageRequestForUrl(url, LegacyUserEntityMapper.toModel(userEntity));
|
|
||||||
}
|
|
||||||
|
|
||||||
public static ImageRequest getImageRequestForUrl(String url, @Nullable User user) {
|
public static ImageRequest getImageRequestForUrl(String url, @Nullable User user) {
|
||||||
Map<String, String> headers = new HashMap<>();
|
Map<String, String> headers = new HashMap<>();
|
||||||
if (user != null &&
|
if (user != null &&
|
||||||
@ -582,11 +578,6 @@ public class DisplayUtils {
|
|||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
@Deprecated
|
|
||||||
public static void loadAvatarImage(UserEntity user, SimpleDraweeView avatarImageView, boolean deleteCache) {
|
|
||||||
loadAvatarImage(Objects.requireNonNull(LegacyUserEntityMapper.toModel(user)), avatarImageView, deleteCache);
|
|
||||||
}
|
|
||||||
|
|
||||||
public static void loadAvatarImage(User user, SimpleDraweeView avatarImageView, boolean deleteCache) {
|
public static void loadAvatarImage(User user, SimpleDraweeView avatarImageView, boolean deleteCache) {
|
||||||
String avatarId;
|
String avatarId;
|
||||||
if (!TextUtils.isEmpty(user.getUserId())) {
|
if (!TextUtils.isEmpty(user.getUserId())) {
|
||||||
|
@ -1,56 +0,0 @@
|
|||||||
/*
|
|
||||||
* Nextcloud Talk application
|
|
||||||
*
|
|
||||||
* @author Andy Scherzinger
|
|
||||||
* Copyright (C) 2022 Andy Scherzinger <infoi@andy-scherzinger.de>
|
|
||||||
*
|
|
||||||
* model program is free software: you can redistribute it and/or modify
|
|
||||||
* it under the terms of the GNU General Public License as published by
|
|
||||||
* the Free Software Foundation, either version 3 of the License, or
|
|
||||||
* at your option) any later version.
|
|
||||||
*
|
|
||||||
* model program is distributed in the hope that it will be useful,
|
|
||||||
* but WITHOUT ANY WARRANTY; without even the implied warranty of
|
|
||||||
* MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
|
|
||||||
* GNU General Public License for more details.
|
|
||||||
*
|
|
||||||
* You should have received a copy of the GNU General Public License
|
|
||||||
* along with model program. If not, see <http://www.gnu.org/licenses/>.
|
|
||||||
*/
|
|
||||||
|
|
||||||
package com.nextcloud.talk.utils
|
|
||||||
|
|
||||||
import com.bluelinelabs.logansquare.LoganSquare
|
|
||||||
import com.nextcloud.talk.data.user.model.User
|
|
||||||
import com.nextcloud.talk.models.ExternalSignalingServer
|
|
||||||
import com.nextcloud.talk.models.database.UserEntity
|
|
||||||
import com.nextcloud.talk.models.json.capabilities.Capabilities
|
|
||||||
import com.nextcloud.talk.models.json.push.PushConfigurationState
|
|
||||||
|
|
||||||
object LegacyUserEntityMapper {
|
|
||||||
fun toModel(entities: List<UserEntity?>?): List<User> {
|
|
||||||
return entities?.map { user: UserEntity? ->
|
|
||||||
toModel(user)!!
|
|
||||||
} ?: emptyList()
|
|
||||||
}
|
|
||||||
|
|
||||||
@JvmStatic
|
|
||||||
fun toModel(entity: UserEntity?): User? {
|
|
||||||
return entity?.let {
|
|
||||||
User(
|
|
||||||
entity.id,
|
|
||||||
entity.userId,
|
|
||||||
entity.username,
|
|
||||||
entity.baseUrl,
|
|
||||||
entity.token,
|
|
||||||
entity.displayName,
|
|
||||||
entity.pushConfigurationState?.let { LoganSquare.parse(it, PushConfigurationState::class.java) },
|
|
||||||
entity.capabilities?.let { LoganSquare.parse(it, Capabilities::class.java) },
|
|
||||||
entity.clientCertificate,
|
|
||||||
entity.externalSignalingServer?.let { LoganSquare.parse(it, ExternalSignalingServer::class.java) },
|
|
||||||
entity.current,
|
|
||||||
entity.scheduledForDeletion
|
|
||||||
)
|
|
||||||
}
|
|
||||||
}
|
|
||||||
}
|
|
@ -40,11 +40,6 @@ public class ArbitraryStorageModule {
|
|||||||
public ArbitraryStorageModule() {
|
public ArbitraryStorageModule() {
|
||||||
}
|
}
|
||||||
|
|
||||||
@Provides
|
|
||||||
public ArbitraryStorageUtils provideArbitraryStorageUtils(ReactiveEntityStore<Persistable> dataStore) {
|
|
||||||
return new ArbitraryStorageUtils(dataStore);
|
|
||||||
}
|
|
||||||
|
|
||||||
@Provides
|
@Provides
|
||||||
public ArbitraryStorageManager provideArbitraryStorageManager(ArbitraryStoragesRepository repository) {
|
public ArbitraryStorageManager provideArbitraryStorageManager(ArbitraryStoragesRepository repository) {
|
||||||
return new ArbitraryStorageManager(repository);
|
return new ArbitraryStorageManager(repository);
|
||||||
|
@ -1,35 +0,0 @@
|
|||||||
/*
|
|
||||||
* Nextcloud Talk application
|
|
||||||
*
|
|
||||||
* @author Mario Danic
|
|
||||||
* Copyright (C) 2017-2018 Mario Danic <mario@lovelyhq.com>
|
|
||||||
*
|
|
||||||
* This program is free software: you can redistribute it and/or modify
|
|
||||||
* it under the terms of the GNU General Public License as published by
|
|
||||||
* the Free Software Foundation, either version 3 of the License, or
|
|
||||||
* at your option) any later version.
|
|
||||||
*
|
|
||||||
* This program is distributed in the hope that it will be useful,
|
|
||||||
* but WITHOUT ANY WARRANTY; without even the implied warranty of
|
|
||||||
* MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
|
|
||||||
* GNU General Public License for more details.
|
|
||||||
*
|
|
||||||
* You should have received a copy of the GNU General Public License
|
|
||||||
* along with this program. If not, see <http://www.gnu.org/licenses/>.
|
|
||||||
*/
|
|
||||||
package com.nextcloud.talk.utils.database.arbitrarystorage;
|
|
||||||
|
|
||||||
import io.requery.Persistable;
|
|
||||||
import io.requery.reactivex.ReactiveEntityStore;
|
|
||||||
|
|
||||||
/**
|
|
||||||
* @deprecated use {@link com.nextcloud.talk.arbitrarystorage.ArbitraryStorageManager} instead.
|
|
||||||
*/
|
|
||||||
@Deprecated
|
|
||||||
public class ArbitraryStorageUtils {
|
|
||||||
private ReactiveEntityStore<Persistable> dataStore;
|
|
||||||
|
|
||||||
ArbitraryStorageUtils(ReactiveEntityStore<Persistable> dataStore) {
|
|
||||||
this.dataStore = dataStore;
|
|
||||||
}
|
|
||||||
}
|
|
@ -35,11 +35,6 @@ abstract class UserModule {
|
|||||||
abstract fun bindCurrentUserProviderNew(userManager: UserManager): CurrentUserProviderNew
|
abstract fun bindCurrentUserProviderNew(userManager: UserManager): CurrentUserProviderNew
|
||||||
|
|
||||||
companion object {
|
companion object {
|
||||||
@Provides
|
|
||||||
fun provideUserUtils(dataStore: ReactiveEntityStore<Persistable?>?): UserUtils {
|
|
||||||
return UserUtils(dataStore)
|
|
||||||
}
|
|
||||||
|
|
||||||
@Provides
|
@Provides
|
||||||
fun provideUserManager(userRepository: UsersRepository): UserManager {
|
fun provideUserManager(userRepository: UsersRepository): UserManager {
|
||||||
return UserManager(userRepository)
|
return UserManager(userRepository)
|
||||||
|
@ -1,50 +0,0 @@
|
|||||||
/*
|
|
||||||
* Nextcloud Talk application
|
|
||||||
*
|
|
||||||
* @author Mario Danic
|
|
||||||
* Copyright (C) 2017 Mario Danic (mario@lovelyhq.com)
|
|
||||||
*
|
|
||||||
* This program is free software: you can redistribute it and/or modify
|
|
||||||
* it under the terms of the GNU General Public License as published by
|
|
||||||
* the Free Software Foundation, either version 3 of the License, or
|
|
||||||
* at your option) any later version.
|
|
||||||
*
|
|
||||||
* This program is distributed in the hope that it will be useful,
|
|
||||||
* but WITHOUT ANY WARRANTY; without even the implied warranty of
|
|
||||||
* MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
|
|
||||||
* GNU General Public License for more details.
|
|
||||||
*
|
|
||||||
* You should have received a copy of the GNU General Public License
|
|
||||||
* along with this program. If not, see <http://www.gnu.org/licenses/>.
|
|
||||||
*/
|
|
||||||
package com.nextcloud.talk.utils.database.user;
|
|
||||||
|
|
||||||
import android.text.TextUtils;
|
|
||||||
|
|
||||||
import com.nextcloud.talk.models.database.User;
|
|
||||||
import com.nextcloud.talk.models.database.UserEntity;
|
|
||||||
|
|
||||||
import java.util.List;
|
|
||||||
|
|
||||||
import androidx.annotation.Nullable;
|
|
||||||
import io.reactivex.Completable;
|
|
||||||
import io.reactivex.Observable;
|
|
||||||
import io.reactivex.android.schedulers.AndroidSchedulers;
|
|
||||||
import io.reactivex.schedulers.Schedulers;
|
|
||||||
import io.requery.Persistable;
|
|
||||||
import io.requery.query.Result;
|
|
||||||
import io.requery.reactivex.ReactiveEntityStore;
|
|
||||||
|
|
||||||
/**
|
|
||||||
* @deprecated use {@link com.nextcloud.talk.users.UserManager} instead.
|
|
||||||
*
|
|
||||||
* TODO: remove this class with a major version, 15.0.0 or 16.0.0.
|
|
||||||
*/
|
|
||||||
@Deprecated
|
|
||||||
public class UserUtils {
|
|
||||||
private ReactiveEntityStore<Persistable> dataStore;
|
|
||||||
|
|
||||||
UserUtils(ReactiveEntityStore<Persistable> dataStore) {
|
|
||||||
this.dataStore = dataStore;
|
|
||||||
}
|
|
||||||
}
|
|
@ -25,7 +25,6 @@ import android.util.Log;
|
|||||||
|
|
||||||
import com.nextcloud.talk.application.NextcloudTalkApplication;
|
import com.nextcloud.talk.application.NextcloudTalkApplication;
|
||||||
import com.nextcloud.talk.data.user.model.User;
|
import com.nextcloud.talk.data.user.model.User;
|
||||||
import com.nextcloud.talk.models.database.UserEntity;
|
|
||||||
import com.nextcloud.talk.models.json.signaling.NCMessageWrapper;
|
import com.nextcloud.talk.models.json.signaling.NCMessageWrapper;
|
||||||
import com.nextcloud.talk.models.json.websocket.ActorWebSocketMessage;
|
import com.nextcloud.talk.models.json.websocket.ActorWebSocketMessage;
|
||||||
import com.nextcloud.talk.models.json.websocket.AuthParametersWebSocketMessage;
|
import com.nextcloud.talk.models.json.websocket.AuthParametersWebSocketMessage;
|
||||||
@ -40,7 +39,6 @@ import com.nextcloud.talk.models.json.websocket.RoomOverallWebSocketMessage;
|
|||||||
import com.nextcloud.talk.models.json.websocket.RoomWebSocketMessage;
|
import com.nextcloud.talk.models.json.websocket.RoomWebSocketMessage;
|
||||||
import com.nextcloud.talk.models.json.websocket.SignalingDataWebSocketMessageForOffer;
|
import com.nextcloud.talk.models.json.websocket.SignalingDataWebSocketMessageForOffer;
|
||||||
import com.nextcloud.talk.utils.ApiUtils;
|
import com.nextcloud.talk.utils.ApiUtils;
|
||||||
import com.nextcloud.talk.utils.LegacyUserEntityMapper;
|
|
||||||
|
|
||||||
import java.util.HashMap;
|
import java.util.HashMap;
|
||||||
import java.util.Map;
|
import java.util.Map;
|
||||||
@ -72,16 +70,6 @@ public class WebSocketConnectionHelper {
|
|||||||
return null;
|
return null;
|
||||||
}
|
}
|
||||||
|
|
||||||
@Deprecated
|
|
||||||
public static synchronized MagicWebSocketInstance getExternalSignalingInstanceForServer(String url,
|
|
||||||
UserEntity userEntity,
|
|
||||||
String webSocketTicket, boolean isGuest) {
|
|
||||||
return getExternalSignalingInstanceForServer(url,
|
|
||||||
LegacyUserEntityMapper.toModel(userEntity),
|
|
||||||
webSocketTicket,
|
|
||||||
isGuest);
|
|
||||||
}
|
|
||||||
|
|
||||||
public static synchronized MagicWebSocketInstance getExternalSignalingInstanceForServer(String url,
|
public static synchronized MagicWebSocketInstance getExternalSignalingInstanceForServer(String url,
|
||||||
User user,
|
User user,
|
||||||
String webSocketTicket, boolean isGuest) {
|
String webSocketTicket, boolean isGuest) {
|
||||||
|
Loading…
Reference in New Issue
Block a user