mirror of
https://github.com/nextcloud/talk-android
synced 2025-01-31 19:42:34 +00:00
Allow to inject the api version into all methods for the room api
Signed-off-by: Joas Schilling <coding@schilljs.com>
This commit is contained in:
parent
1a15bd9f5f
commit
c3061df60b
@ -257,9 +257,11 @@ public class CallNotificationController extends BaseController {
|
||||
|
||||
}
|
||||
|
||||
@SuppressLint("LongLogTag")
|
||||
private void handleFromNotification() {
|
||||
Integer apiVersion = ApiUtils.getApiVersion(userBeingCalled, "conversation", new int[] {4, 3, 1});
|
||||
if (apiVersion == null) {
|
||||
Log.e(TAG, "No supported API version found", new Exception("No supported API version found"));
|
||||
return;
|
||||
}
|
||||
|
||||
|
@ -308,9 +308,12 @@ public class ContactsController extends BaseController implements SearchView.OnQ
|
||||
bundle.putString(BundleKeys.INSTANCE.getKEY_ROOM_TOKEN(), roomOverall.getOcs().getData().getToken());
|
||||
bundle.putString(BundleKeys.INSTANCE.getKEY_ROOM_ID(), roomOverall.getOcs().getData().getRoomId());
|
||||
|
||||
if (currentUser.hasSpreedFeatureCapability("chat-v2")) {
|
||||
Integer apiVersion = ApiUtils.getApiVersion(currentUser, "conversation",
|
||||
new int[] {1});
|
||||
if (apiVersion != null && currentUser.hasSpreedFeatureCapability("chat-v2")) {
|
||||
|
||||
ncApi.getRoom(credentials,
|
||||
ApiUtils.getRoom(currentUser.getBaseUrl(),
|
||||
ApiUtils.getUrlForRoom(apiVersion, currentUser.getBaseUrl(),
|
||||
roomOverall.getOcs().getData().getToken()))
|
||||
.subscribeOn(Schedulers.io())
|
||||
.observeOn(AndroidSchedulers.mainThread())
|
||||
|
@ -20,6 +20,7 @@
|
||||
|
||||
package com.nextcloud.talk.controllers.bottomsheet;
|
||||
|
||||
import android.annotation.SuppressLint;
|
||||
import android.app.Activity;
|
||||
import android.content.Intent;
|
||||
import android.net.Uri;
|
||||
@ -82,6 +83,8 @@ import retrofit2.HttpException;
|
||||
@AutoInjector(NextcloudTalkApplication.class)
|
||||
public class OperationsMenuController extends BaseController {
|
||||
|
||||
private static final String TAG = "OperationsMenuController";
|
||||
|
||||
@BindView(R.id.progress_bar)
|
||||
ProgressBar progressBar;
|
||||
|
||||
@ -169,6 +172,7 @@ public class OperationsMenuController extends BaseController {
|
||||
processOperation();
|
||||
}
|
||||
|
||||
@SuppressLint("LongLogTag")
|
||||
private void processOperation() {
|
||||
currentUser = userUtils.getCurrentUser();
|
||||
OperationsObserver operationsObserver = new OperationsObserver();
|
||||
@ -189,9 +193,18 @@ public class OperationsMenuController extends BaseController {
|
||||
credentials = null;
|
||||
}
|
||||
|
||||
Integer apiVersion = ApiUtils.getApiVersion(currentUser, "conversation",
|
||||
new int[] {1});
|
||||
|
||||
if(apiVersion == null) {
|
||||
Log.e(TAG, "No supported API version found", new Exception("No supported API version found"));
|
||||
return;
|
||||
}
|
||||
|
||||
switch (operationCode) {
|
||||
case 2:
|
||||
ncApi.renameRoom(credentials, ApiUtils.getRoom(currentUser.getBaseUrl(), conversation.getToken()),
|
||||
ncApi.renameRoom(credentials, ApiUtils.getUrlForRoom(apiVersion, currentUser.getBaseUrl(),
|
||||
conversation.getToken()),
|
||||
conversation.getName())
|
||||
.subscribeOn(Schedulers.io())
|
||||
.observeOn(AndroidSchedulers.mainThread())
|
||||
@ -199,8 +212,8 @@ public class OperationsMenuController extends BaseController {
|
||||
.subscribe(operationsObserver);
|
||||
break;
|
||||
case 3:
|
||||
ncApi.makeRoomPublic(credentials, ApiUtils.getUrlForRoomVisibility(currentUser.getBaseUrl(), conversation
|
||||
.getToken()))
|
||||
ncApi.makeRoomPublic(credentials, ApiUtils.getUrlForRoomPublic(apiVersion, currentUser.getBaseUrl(),
|
||||
conversation.getToken()))
|
||||
.subscribeOn(Schedulers.io())
|
||||
.observeOn(AndroidSchedulers.mainThread())
|
||||
.retry(1)
|
||||
@ -213,8 +226,8 @@ public class OperationsMenuController extends BaseController {
|
||||
if (conversation.getPassword() != null) {
|
||||
pass = conversation.getPassword();
|
||||
}
|
||||
ncApi.setPassword(credentials, ApiUtils.getUrlForPassword(currentUser.getBaseUrl(),
|
||||
conversation.getToken()), pass)
|
||||
ncApi.setPassword(credentials, ApiUtils.getUrlForRoomPassword(apiVersion, currentUser.getBaseUrl(),
|
||||
conversation.getToken()), pass)
|
||||
.subscribeOn(Schedulers.io())
|
||||
.observeOn(AndroidSchedulers.mainThread())
|
||||
.retry(1)
|
||||
@ -224,15 +237,16 @@ public class OperationsMenuController extends BaseController {
|
||||
// Operation 7 is sharing, so we handle this differently
|
||||
break;
|
||||
case 8:
|
||||
ncApi.makeRoomPrivate(credentials, ApiUtils.getUrlForRoomVisibility(currentUser.getBaseUrl(), conversation
|
||||
.getToken()))
|
||||
ncApi.makeRoomPrivate(credentials, ApiUtils.getUrlForRoomPublic(apiVersion,
|
||||
currentUser.getBaseUrl(),
|
||||
conversation.getToken()))
|
||||
.subscribeOn(Schedulers.io())
|
||||
.observeOn(AndroidSchedulers.mainThread())
|
||||
.retry(1)
|
||||
.subscribe(operationsObserver);
|
||||
break;
|
||||
case 10:
|
||||
ncApi.getRoom(credentials, ApiUtils.getRoom(baseUrl, conversationToken))
|
||||
ncApi.getRoom(credentials, ApiUtils.getUrlForRoom(apiVersion, baseUrl, conversationToken))
|
||||
.subscribeOn(Schedulers.io())
|
||||
.observeOn(AndroidSchedulers.mainThread())
|
||||
.retry(1)
|
||||
@ -300,7 +314,8 @@ public class OperationsMenuController extends BaseController {
|
||||
conversation = roomOverall.getOcs().getData();
|
||||
|
||||
ncApi.getRoom(credentials,
|
||||
ApiUtils.getRoom(currentUser.getBaseUrl(), conversation.getToken()))
|
||||
ApiUtils.getUrlForRoom(apiVersion, currentUser.getBaseUrl(),
|
||||
conversation.getToken()))
|
||||
.subscribeOn(Schedulers.io())
|
||||
.observeOn(AndroidSchedulers.mainThread())
|
||||
.subscribe(new Observer<RoomOverall>() {
|
||||
@ -349,15 +364,19 @@ public class OperationsMenuController extends BaseController {
|
||||
case 97:
|
||||
case 98:
|
||||
if (operationCode == 97) {
|
||||
ncApi.removeConversationFromFavorites(credentials, ApiUtils.getUrlForConversationFavorites(currentUser.getBaseUrl(),
|
||||
conversation.getToken()))
|
||||
ncApi.removeConversationFromFavorites(credentials,
|
||||
ApiUtils.getUrlForRoomFavorite(apiVersion,
|
||||
currentUser.getBaseUrl(),
|
||||
conversation.getToken()))
|
||||
.subscribeOn(Schedulers.io())
|
||||
.observeOn(AndroidSchedulers.mainThread())
|
||||
.retry(1)
|
||||
.subscribe(operationsObserver);
|
||||
} else {
|
||||
ncApi.addConversationToFavorites(credentials, ApiUtils.getUrlForConversationFavorites(currentUser.getBaseUrl(),
|
||||
conversation.getToken()))
|
||||
ncApi.addConversationToFavorites(credentials,
|
||||
ApiUtils.getUrlForRoomFavorite(apiVersion,
|
||||
currentUser.getBaseUrl(),
|
||||
conversation.getToken()))
|
||||
.subscribeOn(Schedulers.io())
|
||||
.observeOn(AndroidSchedulers.mainThread())
|
||||
.retry(1)
|
||||
@ -365,7 +384,9 @@ public class OperationsMenuController extends BaseController {
|
||||
}
|
||||
break;
|
||||
case 99:
|
||||
ncApi.joinRoom(credentials, ApiUtils.getUrlForSettingMyselfAsActiveParticipant(baseUrl, conversationToken),
|
||||
ncApi.joinRoom(credentials, ApiUtils.getUrlForParticipantsActive(apiVersion,
|
||||
baseUrl,
|
||||
conversationToken),
|
||||
callPassword)
|
||||
.subscribeOn(Schedulers.io())
|
||||
.observeOn(AndroidSchedulers.mainThread())
|
||||
@ -378,8 +399,19 @@ public class OperationsMenuController extends BaseController {
|
||||
}
|
||||
}
|
||||
|
||||
@SuppressLint("LongLogTag")
|
||||
private void performGroupCallWorkaround(String credentials) {
|
||||
ncApi.makeRoomPrivate(credentials, ApiUtils.getUrlForRoomVisibility(currentUser.getBaseUrl(), conversation.getToken()))
|
||||
|
||||
Integer apiVersion = ApiUtils.getApiVersion(currentUser, "conversation",
|
||||
new int[] {1});
|
||||
|
||||
if(apiVersion == null) {
|
||||
Log.e(TAG, "No supported API version found", new Exception("No supported API version found"));
|
||||
return;
|
||||
}
|
||||
|
||||
ncApi.makeRoomPrivate(credentials, ApiUtils.getUrlForRoomPublic(apiVersion, currentUser.getBaseUrl(),
|
||||
conversation.getToken()))
|
||||
.subscribeOn(Schedulers.io())
|
||||
.observeOn(AndroidSchedulers.mainThread())
|
||||
.retry(1)
|
||||
|
@ -20,7 +20,10 @@
|
||||
|
||||
package com.nextcloud.talk.jobs;
|
||||
|
||||
import android.annotation.SuppressLint;
|
||||
import android.content.Context;
|
||||
import android.util.Log;
|
||||
|
||||
import androidx.annotation.NonNull;
|
||||
import androidx.work.Data;
|
||||
import androidx.work.Worker;
|
||||
@ -47,6 +50,7 @@ import java.net.CookieManager;
|
||||
|
||||
@AutoInjector(NextcloudTalkApplication.class)
|
||||
public class DeleteConversationWorker extends Worker {
|
||||
private static final String TAG = "DeleteConversationWorker";
|
||||
@Inject
|
||||
Retrofit retrofit;
|
||||
|
||||
@ -66,6 +70,7 @@ public class DeleteConversationWorker extends Worker {
|
||||
NextcloudTalkApplication.Companion.getSharedApplication().getComponentApplication().inject(this);
|
||||
}
|
||||
|
||||
@SuppressLint("LongLogTag")
|
||||
@NonNull
|
||||
@Override
|
||||
public Result doWork() {
|
||||
@ -75,6 +80,14 @@ public class DeleteConversationWorker extends Worker {
|
||||
UserEntity operationUser = userUtils.getUserWithId(operationUserId);
|
||||
|
||||
if (operationUser != null) {
|
||||
Integer apiVersion = ApiUtils.getApiVersion(operationUser, "conversation",
|
||||
new int[] {1});
|
||||
|
||||
if (apiVersion == null) {
|
||||
Log.e(TAG, "No supported API version found", new Exception("No supported API version found"));
|
||||
return Result.failure();
|
||||
}
|
||||
|
||||
String credentials = ApiUtils.getCredentials(operationUser.getUsername(), operationUser.getToken());
|
||||
ncApi = retrofit.newBuilder().client(okHttpClient.newBuilder().cookieJar(new
|
||||
JavaNetCookieJar(new CookieManager())).build()).build().create(NcApi.class);
|
||||
@ -82,7 +95,8 @@ public class DeleteConversationWorker extends Worker {
|
||||
EventStatus eventStatus = new EventStatus(operationUser.getId(),
|
||||
EventStatus.EventType.CONVERSATION_UPDATE, true);
|
||||
|
||||
ncApi.deleteRoom(credentials, ApiUtils.getRoom(operationUser.getBaseUrl(), conversationToken))
|
||||
ncApi.deleteRoom(credentials, ApiUtils.getUrlForRoom(apiVersion, operationUser.getBaseUrl(),
|
||||
conversationToken))
|
||||
.subscribeOn(Schedulers.io())
|
||||
.blockingSubscribe(new Observer<GenericOverall>() {
|
||||
Disposable disposable;
|
||||
|
@ -21,6 +21,8 @@
|
||||
package com.nextcloud.talk.jobs;
|
||||
|
||||
import android.content.Context;
|
||||
import android.util.Log;
|
||||
|
||||
import androidx.annotation.NonNull;
|
||||
import androidx.work.Data;
|
||||
import androidx.work.Worker;
|
||||
@ -47,6 +49,9 @@ import java.net.CookieManager;
|
||||
|
||||
@AutoInjector(NextcloudTalkApplication.class)
|
||||
public class LeaveConversationWorker extends Worker {
|
||||
|
||||
private static final String TAG = "LeaveConversationWorker";
|
||||
|
||||
@Inject
|
||||
Retrofit retrofit;
|
||||
|
||||
@ -82,7 +87,17 @@ public class LeaveConversationWorker extends Worker {
|
||||
EventStatus eventStatus = new EventStatus(operationUser.getId(),
|
||||
EventStatus.EventType.CONVERSATION_UPDATE, true);
|
||||
|
||||
ncApi.removeSelfFromRoom(credentials, ApiUtils.getUrlForRemoveSelfFromRoom(operationUser.getBaseUrl(), conversationToken))
|
||||
Integer apiVersion = ApiUtils.getApiVersion(operationUser, "conversation",
|
||||
new int[] {1});
|
||||
|
||||
if(apiVersion == null) {
|
||||
Log.e(TAG, "No supported API version found", new Exception("No supported API version found"));
|
||||
return Result.failure();
|
||||
}
|
||||
|
||||
ncApi.removeSelfFromRoom(credentials, ApiUtils.getUrlForParticipantsSelf(apiVersion,
|
||||
operationUser.getBaseUrl(),
|
||||
conversationToken))
|
||||
.subscribeOn(Schedulers.io())
|
||||
.blockingSubscribe(new Observer<GenericOverall>() {
|
||||
Disposable disposable;
|
||||
|
@ -152,8 +152,16 @@ public class NotificationWorker extends Worker {
|
||||
importantConversation = Boolean.parseBoolean(arbitraryStorageEntity.getValue());
|
||||
}
|
||||
|
||||
Integer apiVersion = ApiUtils.getApiVersion(userEntity, "conversation",
|
||||
new int[] {1});
|
||||
|
||||
ncApi.getRoom(credentials, ApiUtils.getRoom(userEntity.getBaseUrl(),
|
||||
if (apiVersion == null) {
|
||||
Log.e(TAG, "No supported API version found", new Exception("No supported API version found"));
|
||||
return;
|
||||
}
|
||||
|
||||
|
||||
ncApi.getRoom(credentials, ApiUtils.getUrlForRoom(apiVersion, userEntity.getBaseUrl(),
|
||||
intent.getExtras().getString(BundleKeys.INSTANCE.getKEY_ROOM_TOKEN())))
|
||||
.blockingSubscribe(new Observer<RoomOverall>() {
|
||||
@Override
|
||||
|
@ -52,12 +52,12 @@ public class ApiUtils {
|
||||
*/
|
||||
@Deprecated
|
||||
public static String getUrlForLobbyForConversation(String baseUrl, String token) {
|
||||
return getRoom(baseUrl, token) + "/webinary/lobby";
|
||||
return getUrlForRoomWebinaryLobby(1, baseUrl, token);
|
||||
}
|
||||
|
||||
@Deprecated
|
||||
public static String getUrlForRemovingParticipantFromConversation(String baseUrl, String roomToken, boolean isGuest) {
|
||||
String url = getUrlForParticipants(baseUrl, roomToken);
|
||||
String url = getUrlForParticipants(1, baseUrl, roomToken);
|
||||
|
||||
if (isGuest) {
|
||||
url += "/guests";
|
||||
@ -108,22 +108,13 @@ public class ApiUtils {
|
||||
return retrofitBucket;
|
||||
}
|
||||
|
||||
/**
|
||||
* @deprecated Please specify the api version you want to use via
|
||||
* {@link ApiUtils#getUrlForRoomNotificationLevel(int, String, String)} instead.
|
||||
*/
|
||||
@Deprecated
|
||||
public static String getUrlForSettingNotificationlevel(String baseUrl, String token) {
|
||||
return getRoom(baseUrl, token) + "/notify";
|
||||
}
|
||||
|
||||
/**
|
||||
* @deprecated Please specify the api version you want to use via
|
||||
* {@link ApiUtils#getUrlForParticipantsActive(int, String, String)} instead.
|
||||
*/
|
||||
@Deprecated
|
||||
public static String getUrlForSettingMyselfAsActiveParticipant(String baseUrl, String token) {
|
||||
return getRoom(baseUrl, token) + "/participants/active";
|
||||
return getUrlForParticipantsActive(1, baseUrl, token);
|
||||
}
|
||||
|
||||
|
||||
@ -187,10 +178,34 @@ public class ApiUtils {
|
||||
return getUrlForParticipants(version, baseUrl, token) + "/active";
|
||||
}
|
||||
|
||||
public static String getUrlForParticipantsSelf(int version, String baseUrl, String token) {
|
||||
return getUrlForParticipants(version, baseUrl, token) + "/self";
|
||||
}
|
||||
|
||||
public static String getUrlForRoomFavorite(int version, String baseUrl, String token) {
|
||||
return getUrlForRoom(version, baseUrl, token) + "/favorite";
|
||||
}
|
||||
|
||||
public static String getUrlForRoomModerators(int version, String baseUrl, String token) {
|
||||
return getUrlForRoom(version, baseUrl, token) + "/moderators";
|
||||
}
|
||||
|
||||
public static String getUrlForRoomNotificationLevel(int version, String baseUrl, String token) {
|
||||
return getUrlForRoom(version, baseUrl, token) + "/notify";
|
||||
}
|
||||
|
||||
public static String getUrlForRoomPublic(int version, String baseUrl, String token) {
|
||||
return getUrlForRoom(version, baseUrl, token) + "/public";
|
||||
}
|
||||
|
||||
public static String getUrlForRoomPassword(int version, String baseUrl, String token) {
|
||||
return getUrlForRoom(version, baseUrl, token) + "/password";
|
||||
}
|
||||
|
||||
public static String getUrlForRoomReadOnlyState(int version, String baseUrl, String token) {
|
||||
return getUrlForRoom(version, baseUrl, token) + "/read-only";
|
||||
}
|
||||
|
||||
public static String getUrlForRoomWebinaryLobby(int version, String baseUrl, String token) {
|
||||
return getUrlForRoom(version, baseUrl, token) + "/webinary/lobby";
|
||||
}
|
||||
@ -244,18 +259,9 @@ public class ApiUtils {
|
||||
return retrofitBucket;
|
||||
}
|
||||
|
||||
@Deprecated
|
||||
public static String getUrlForRemoveSelfFromRoom(String baseUrl, String token) {
|
||||
return baseUrl + ocsApiVersion + spreedApiVersion + "/room/" + token + "/participants/self";
|
||||
}
|
||||
|
||||
@Deprecated
|
||||
public static String getUrlForRoomVisibility(String baseUrl, String token) {
|
||||
return baseUrl + ocsApiVersion + spreedApiVersion + "/room/" + token + "/public";
|
||||
}
|
||||
|
||||
@Deprecated
|
||||
public static String getUrlForCall(String baseUrl, String token) {
|
||||
// FIXME user APIv4
|
||||
return baseUrl + ocsApiVersion + spreedApiVersion + "/call/" + token;
|
||||
|
||||
}
|
||||
@ -265,23 +271,22 @@ public class ApiUtils {
|
||||
return getUrlForCall(baseUrl, token) + "/ping";
|
||||
}
|
||||
|
||||
@Deprecated
|
||||
public static String getUrlForChat(String baseUrl, String token) {
|
||||
return baseUrl + ocsApiVersion + spreedApiVersion + "/chat/" + token;
|
||||
}
|
||||
|
||||
@Deprecated
|
||||
public static String getUrlForExternalServerAuthBackend(String baseUrl) {
|
||||
return baseUrl + ocsApiVersion + spreedApiVersion + "/signaling/backend";
|
||||
return getUrlForSignaling(baseUrl, null) + "/backend";
|
||||
}
|
||||
|
||||
@Deprecated
|
||||
public static String getUrlForMentionSuggestions(String baseUrl, String token) {
|
||||
return getUrlForChat(baseUrl, token) + "/mentions";
|
||||
}
|
||||
|
||||
@Deprecated
|
||||
public static String getUrlForSignaling(String baseUrl, @Nullable String token) {
|
||||
// FIXME use APIv2 ?
|
||||
String signalingUrl = baseUrl + ocsApiVersion + spreedApiVersion + "/signaling";
|
||||
if (token == null) {
|
||||
return signalingUrl;
|
||||
@ -290,9 +295,13 @@ public class ApiUtils {
|
||||
}
|
||||
}
|
||||
|
||||
/**
|
||||
* @deprecated Please specify the api version you want to use via
|
||||
* {@link ApiUtils#getUrlForRoomModerators(int, String, String)} instead.
|
||||
*/
|
||||
@Deprecated
|
||||
public static String getUrlForModerators(String baseUrl, String roomToken) {
|
||||
return getRoom(baseUrl, roomToken) + "/moderators";
|
||||
return getUrlForRoomModerators(1, baseUrl, roomToken);
|
||||
}
|
||||
|
||||
@Deprecated
|
||||
@ -309,7 +318,6 @@ public class ApiUtils {
|
||||
return baseUrl + ocsApiVersion + "/cloud/users/" + userId;
|
||||
}
|
||||
|
||||
@Deprecated
|
||||
public static String getUrlForUserSettings(String baseUrl) {
|
||||
return baseUrl + ocsApiVersion + spreedApiVersion + "/settings/user";
|
||||
}
|
||||
@ -337,11 +345,6 @@ public class ApiUtils {
|
||||
return baseUrl + "/index.php/avatar/guest/" + Uri.encode(name) + "/" + avatarSize;
|
||||
}
|
||||
|
||||
@Deprecated
|
||||
public static String getUrlForPassword(String baseUrl, String token) {
|
||||
return baseUrl + ocsApiVersion + spreedApiVersion + "/room/" + token + "/password";
|
||||
}
|
||||
|
||||
public static String getCredentials(String username, String token) {
|
||||
if (TextUtils.isEmpty(username) && TextUtils.isEmpty(token)) {
|
||||
return null;
|
||||
@ -358,20 +361,10 @@ public class ApiUtils {
|
||||
getApplicationContext().getResources().getString(R.string.nc_push_server_url) + "/devices";
|
||||
}
|
||||
|
||||
@Deprecated
|
||||
public static String getUrlForConversationFavorites(String baseUrl, String roomToken) {
|
||||
return baseUrl + ocsApiVersion + spreedApiVersion + "/room/" + roomToken + "/favorite";
|
||||
}
|
||||
|
||||
public static String getUrlForNotificationWithId(String baseUrl, String notificationId) {
|
||||
return baseUrl + ocsApiVersion + "/apps/notifications/api/v2/notifications/" + notificationId;
|
||||
}
|
||||
|
||||
@Deprecated
|
||||
public static String getUrlForReadOnlyState(String baseUrl, String roomToken) {
|
||||
return baseUrl + ocsApiVersion + spreedApiVersion + "/room/" + roomToken + "/read-only";
|
||||
}
|
||||
|
||||
public static String getUrlForSearchByNumber(String baseUrl) {
|
||||
return baseUrl + ocsApiVersion + "/cloud/users/search/by-phone";
|
||||
}
|
||||
@ -384,9 +377,8 @@ public class ApiUtils {
|
||||
return baseUrl + "/remote.php/dav/files/" + user + "/" + remotePath;
|
||||
}
|
||||
|
||||
@Deprecated
|
||||
public static String getUrlForMessageDeletion(String baseUrl, String token, String messageId) {
|
||||
return baseUrl + ocsApiVersion + spreedApiVersion + "/chat/" + token + "/" + messageId;
|
||||
return getUrlForChat(baseUrl, token) + "/" + messageId;
|
||||
}
|
||||
|
||||
public static String getUrlForTempAvatar(String baseUrl) {
|
||||
|
@ -22,6 +22,8 @@ package com.nextcloud.talk.utils.preferences.preferencestorage;
|
||||
|
||||
import android.os.Bundle;
|
||||
import android.text.TextUtils;
|
||||
import android.util.Log;
|
||||
|
||||
import autodagger.AutoInjector;
|
||||
import com.nextcloud.talk.api.NcApi;
|
||||
import com.nextcloud.talk.application.NextcloudTalkApplication;
|
||||
@ -40,6 +42,8 @@ import java.util.Set;
|
||||
|
||||
@AutoInjector(NextcloudTalkApplication.class)
|
||||
public class DatabaseStorageModule implements StorageModule {
|
||||
private static final String TAG = "DatabaseStorageModule";
|
||||
|
||||
@Inject
|
||||
ArbitraryStorageUtils arbitraryStorageUtils;
|
||||
|
||||
@ -53,6 +57,7 @@ public class DatabaseStorageModule implements StorageModule {
|
||||
private boolean lobbyValue;
|
||||
|
||||
private String messageNotificationLevel;
|
||||
|
||||
public DatabaseStorageModule(UserEntity conversationUser, String conversationToken) {
|
||||
NextcloudTalkApplication.Companion.getSharedApplication().getComponentApplication().inject(this);
|
||||
|
||||
@ -92,8 +97,14 @@ public class DatabaseStorageModule implements StorageModule {
|
||||
intValue = 0;
|
||||
}
|
||||
|
||||
Integer apiVersion = ApiUtils.getApiVersion(conversationUser, "conversation", new int[] {4, 1});
|
||||
if (apiVersion == null) {
|
||||
Log.e(TAG, "No supported API version found", new Exception("No supported API version found"));
|
||||
}
|
||||
|
||||
ncApi.setNotificationLevel(ApiUtils.getCredentials(conversationUser.getUsername(), conversationUser.getToken()),
|
||||
ApiUtils.getUrlForSettingNotificationlevel(conversationUser.getBaseUrl(), conversationToken),
|
||||
ApiUtils.getUrlForRoomNotificationLevel(apiVersion, conversationUser.getBaseUrl(),
|
||||
conversationToken),
|
||||
intValue)
|
||||
.subscribeOn(Schedulers.io())
|
||||
.subscribe(new Observer<GenericOverall>() {
|
||||
|
Loading…
Reference in New Issue
Block a user