|
@@ -2,8 +2,10 @@
|
|
* Nextcloud Talk application
|
|
* Nextcloud Talk application
|
|
*
|
|
*
|
|
* @author Mario Danic
|
|
* @author Mario Danic
|
|
|
|
+ * @author Marcel Hibbe
|
|
* @author Tim Krüger
|
|
* @author Tim Krüger
|
|
* Copyright (C) 2021 Tim Krüger <t@timkrueger.me>
|
|
* Copyright (C) 2021 Tim Krüger <t@timkrueger.me>
|
|
|
|
+ * Copyright (C) 2021-2022 Marcel Hibbe <dev@mhibbe.de>
|
|
* Copyright (C) 2017-2018 Mario Danic <mario@lovelyhq.com>
|
|
* Copyright (C) 2017-2018 Mario Danic <mario@lovelyhq.com>
|
|
*
|
|
*
|
|
* This program is free software: you can redistribute it and/or modify
|
|
* This program is free software: you can redistribute it and/or modify
|
|
@@ -61,8 +63,8 @@ public class ApiUtils {
|
|
}
|
|
}
|
|
|
|
|
|
/**
|
|
/**
|
|
- * @deprecated This is only supported on API v1-3, in API v4+ please use
|
|
|
|
- * {@link ApiUtils#getUrlForAttendees(int, String, String)} instead.
|
|
|
|
|
|
+ * @deprecated This is only supported on API v1-3, in API v4+ please use {@link ApiUtils#getUrlForAttendees(int,
|
|
|
|
+ * String, String)} instead.
|
|
*/
|
|
*/
|
|
@Deprecated
|
|
@Deprecated
|
|
public static String getUrlForRemovingParticipantFromConversation(String baseUrl, String roomToken, boolean isGuest) {
|
|
public static String getUrlForRemovingParticipantFromConversation(String baseUrl, String roomToken, boolean isGuest) {
|
|
@@ -95,13 +97,13 @@ public class ApiUtils {
|
|
|
|
|
|
public static String getUrlForFilePreviewWithRemotePath(String baseUrl, String remotePath, int px) {
|
|
public static String getUrlForFilePreviewWithRemotePath(String baseUrl, String remotePath, int px) {
|
|
return baseUrl + "/index.php/core/preview.png?file="
|
|
return baseUrl + "/index.php/core/preview.png?file="
|
|
- + Uri.encode(remotePath, "UTF-8")
|
|
|
|
- + "&x=" + px + "&y=" + px + "&a=1&mode=cover&forceIcon=1";
|
|
|
|
|
|
+ + Uri.encode(remotePath, "UTF-8")
|
|
|
|
+ + "&x=" + px + "&y=" + px + "&a=1&mode=cover&forceIcon=1";
|
|
}
|
|
}
|
|
|
|
|
|
public static String getUrlForFilePreviewWithFileId(String baseUrl, String fileId, int px) {
|
|
public static String getUrlForFilePreviewWithFileId(String baseUrl, String fileId, int px) {
|
|
return baseUrl + "/index.php/core/preview?fileId="
|
|
return baseUrl + "/index.php/core/preview?fileId="
|
|
- + fileId + "&x=" + px + "&y=" + px + "&a=1&mode=cover&forceIcon=1";
|
|
|
|
|
|
+ + fileId + "&x=" + px + "&y=" + px + "&a=1&mode=cover&forceIcon=1";
|
|
}
|
|
}
|
|
|
|
|
|
public static String getSharingUrl(String baseUrl) {
|
|
public static String getSharingUrl(String baseUrl) {
|
|
@@ -151,8 +153,8 @@ public class ApiUtils {
|
|
if (user.hasSpreedFeatureCapability("conversation-v2")) {
|
|
if (user.hasSpreedFeatureCapability("conversation-v2")) {
|
|
return version;
|
|
return version;
|
|
}
|
|
}
|
|
- if (version == APIv1 &&
|
|
|
|
- user.hasSpreedFeatureCapability("mention-flag") &&
|
|
|
|
|
|
+ if (version == APIv1 &&
|
|
|
|
+ user.hasSpreedFeatureCapability( "mention-flag") &&
|
|
!user.hasSpreedFeatureCapability("conversation-v4")) {
|
|
!user.hasSpreedFeatureCapability("conversation-v4")) {
|
|
return version;
|
|
return version;
|
|
}
|
|
}
|
|
@@ -238,7 +240,7 @@ public class ApiUtils {
|
|
}
|
|
}
|
|
|
|
|
|
public static String getUrlForParticipants(int version, String baseUrl, String token) {
|
|
public static String getUrlForParticipants(int version, String baseUrl, String token) {
|
|
- if (token == null || token.isEmpty()){
|
|
|
|
|
|
+ if (token == null || token.isEmpty()) {
|
|
Log.e(TAG, "token was null or empty");
|
|
Log.e(TAG, "token was null or empty");
|
|
}
|
|
}
|
|
return getUrlForRoom(version, baseUrl, token) + "/participants";
|
|
return getUrlForRoom(version, baseUrl, token) + "/participants";
|
|
@@ -287,6 +289,7 @@ public class ApiUtils {
|
|
public static String getUrlForCall(int version, String baseUrl, String token) {
|
|
public static String getUrlForCall(int version, String baseUrl, String token) {
|
|
return getUrlForApi(version, baseUrl) + "/call/" + token;
|
|
return getUrlForApi(version, baseUrl) + "/call/" + token;
|
|
}
|
|
}
|
|
|
|
+
|
|
public static String getUrlForChat(int version, String baseUrl, String token) {
|
|
public static String getUrlForChat(int version, String baseUrl, String token) {
|
|
return getUrlForApi(version, baseUrl) + "/chat/" + token;
|
|
return getUrlForApi(version, baseUrl) + "/chat/" + token;
|
|
}
|
|
}
|
|
@@ -294,10 +297,11 @@ public class ApiUtils {
|
|
public static String getUrlForMentionSuggestions(int version, String baseUrl, String token) {
|
|
public static String getUrlForMentionSuggestions(int version, String baseUrl, String token) {
|
|
return getUrlForChat(version, baseUrl, token) + "/mentions";
|
|
return getUrlForChat(version, baseUrl, token) + "/mentions";
|
|
}
|
|
}
|
|
|
|
+
|
|
public static String getUrlForChatMessage(int version, String baseUrl, String token, String messageId) {
|
|
public static String getUrlForChatMessage(int version, String baseUrl, String token, String messageId) {
|
|
return getUrlForChat(version, baseUrl, token) + "/" + messageId;
|
|
return getUrlForChat(version, baseUrl, token) + "/" + messageId;
|
|
}
|
|
}
|
|
-
|
|
|
|
|
|
+
|
|
public static String getUrlForChatSharedItems(int version, String baseUrl, String token) {
|
|
public static String getUrlForChatSharedItems(int version, String baseUrl, String token) {
|
|
return getUrlForChat(version, baseUrl, token) + "/share";
|
|
return getUrlForChat(version, baseUrl, token) + "/share";
|
|
}
|
|
}
|
|
@@ -366,11 +370,11 @@ public class ApiUtils {
|
|
}
|
|
}
|
|
|
|
|
|
public static RetrofitBucket getRetrofitBucketForAddParticipantWithSource(
|
|
public static RetrofitBucket getRetrofitBucketForAddParticipantWithSource(
|
|
- int version,
|
|
|
|
- String baseUrl,
|
|
|
|
- String token,
|
|
|
|
- String source,
|
|
|
|
- String id
|
|
|
|
|
|
+ int version,
|
|
|
|
+ String baseUrl,
|
|
|
|
+ String token,
|
|
|
|
+ String source,
|
|
|
|
+ String id
|
|
) {
|
|
) {
|
|
RetrofitBucket retrofitBucket = getRetrofitBucketForAddParticipant(version, baseUrl, token, id);
|
|
RetrofitBucket retrofitBucket = getRetrofitBucketForAddParticipant(version, baseUrl, token, id);
|
|
retrofitBucket.getQueryMap().put("source", source);
|
|
retrofitBucket.getQueryMap().put("source", source);
|
|
@@ -417,7 +421,7 @@ public class ApiUtils {
|
|
|
|
|
|
public static String getUrlPushProxy() {
|
|
public static String getUrlPushProxy() {
|
|
return NextcloudTalkApplication.Companion.getSharedApplication().
|
|
return NextcloudTalkApplication.Companion.getSharedApplication().
|
|
- getApplicationContext().getResources().getString(R.string.nc_push_server_url) + "/devices";
|
|
|
|
|
|
+ getApplicationContext().getResources().getString(R.string.nc_push_server_url) + "/devices";
|
|
}
|
|
}
|
|
|
|
|
|
public static String getUrlForNotificationWithId(String baseUrl, String notificationId) {
|
|
public static String getUrlForNotificationWithId(String baseUrl, String notificationId) {
|
|
@@ -448,8 +452,10 @@ public class ApiUtils {
|
|
return getUrlForChat(version, baseUrl, roomToken) + "/share";
|
|
return getUrlForChat(version, baseUrl, roomToken) + "/share";
|
|
}
|
|
}
|
|
|
|
|
|
- public static String getUrlForHoverCard(String baseUrl, String userId) { return baseUrl + ocsApiVersion +
|
|
|
|
- "/hovercard/v1/" + userId; }
|
|
|
|
|
|
+ public static String getUrlForHoverCard(String baseUrl, String userId) {
|
|
|
|
+ return baseUrl + ocsApiVersion +
|
|
|
|
+ "/hovercard/v1/" + userId;
|
|
|
|
+ }
|
|
|
|
|
|
public static String getUrlForSetChatReadMarker(int version, String baseUrl, String roomToken) {
|
|
public static String getUrlForSetChatReadMarker(int version, String baseUrl, String roomToken) {
|
|
return getUrlForChat(version, baseUrl, roomToken) + "/read";
|
|
return getUrlForChat(version, baseUrl, roomToken) + "/read";
|
|
@@ -497,4 +503,16 @@ public class ApiUtils {
|
|
public static String getUrlForUnifiedSearch(@NotNull String baseUrl, @NotNull String providerId) {
|
|
public static String getUrlForUnifiedSearch(@NotNull String baseUrl, @NotNull String providerId) {
|
|
return baseUrl + ocsApiVersion + "/search/providers/" + providerId + "/search";
|
|
return baseUrl + ocsApiVersion + "/search/providers/" + providerId + "/search";
|
|
}
|
|
}
|
|
|
|
+
|
|
|
|
+ public static String getUrlForPoll(String baseUrl,
|
|
|
|
+ String roomToken,
|
|
|
|
+ String pollId) {
|
|
|
|
+ return getUrlForPoll(baseUrl, roomToken) + "/" + pollId;
|
|
|
|
+ }
|
|
|
|
+
|
|
|
|
+ public static String getUrlForPoll(String baseUrl,
|
|
|
|
+ String roomToken) {
|
|
|
|
+ return baseUrl + ocsApiVersion + spreedApiVersion + "/poll/" + roomToken;
|
|
|
|
+ }
|
|
|
|
+
|
|
}
|
|
}
|