mirror of
https://github.com/nextcloud/talk-android.git
synced 2024-11-23 05:25:31 +03:00
Log an error when an API call didn't check APIv4
Signed-off-by: Joas Schilling <coding@schilljs.com>
This commit is contained in:
parent
c3061df60b
commit
ad71cc3a97
1 changed files with 14 additions and 0 deletions
|
@ -21,6 +21,7 @@ package com.nextcloud.talk.utils;
|
|||
|
||||
import android.net.Uri;
|
||||
import android.text.TextUtils;
|
||||
import android.util.Log;
|
||||
|
||||
import com.nextcloud.talk.BuildConfig;
|
||||
import com.nextcloud.talk.R;
|
||||
|
@ -28,7 +29,10 @@ import com.nextcloud.talk.application.NextcloudTalkApplication;
|
|||
import com.nextcloud.talk.models.RetrofitBucket;
|
||||
import com.nextcloud.talk.models.database.UserEntity;
|
||||
|
||||
import java.util.ArrayList;
|
||||
import java.util.Arrays;
|
||||
import java.util.HashMap;
|
||||
import java.util.List;
|
||||
import java.util.Map;
|
||||
|
||||
import androidx.annotation.DimenRes;
|
||||
|
@ -36,6 +40,7 @@ import androidx.annotation.Nullable;
|
|||
import okhttp3.Credentials;
|
||||
|
||||
public class ApiUtils {
|
||||
private static final String TAG = "ApiUtils";
|
||||
private static String ocsApiVersion = "/ocs/v2.php";
|
||||
private static String spreedApiVersion = "/apps/spreed/api/v1";
|
||||
private static String spreedApiBase = ocsApiVersion + "/apps/spreed/api/v";
|
||||
|
@ -150,8 +155,17 @@ public class ApiUtils {
|
|||
}
|
||||
|
||||
public static Integer getApiVersion(UserEntity capabilities, String apiName, int[] versions) {
|
||||
boolean checkedConversationV4 = !apiName.equals("conversation");
|
||||
|
||||
for (int version : versions) {
|
||||
checkedConversationV4 |= version == 4;
|
||||
|
||||
if (capabilities.hasSpreedFeatureCapability(apiName + "-v" + version)) {
|
||||
if (!checkedConversationV4) {
|
||||
Exception e = new Exception("Api call did not try conversation-v4 api");
|
||||
Log.e(TAG, e.getMessage(), e);
|
||||
}
|
||||
|
||||
return version;
|
||||
}
|
||||
}
|
||||
|
|
Loading…
Reference in a new issue