mirror of
https://github.com/nextcloud/talk-android
synced 2025-07-15 08:45:04 +01:00
Use injected capabilities
Signed-off-by: Joas Schilling <coding@schilljs.com>
This commit is contained in:
parent
2fd0933383
commit
01813d4165
@ -176,13 +176,44 @@ public class OperationsMenuController extends BaseController {
|
|||||||
}
|
}
|
||||||
|
|
||||||
if (!TextUtils.isEmpty(baseUrl) && !baseUrl.equals(currentUser.getBaseUrl())) {
|
if (!TextUtils.isEmpty(baseUrl) && !baseUrl.equals(currentUser.getBaseUrl())) {
|
||||||
|
if (serverCapabilities != null) {
|
||||||
|
try {
|
||||||
|
useBundledCapabilitiesForGuest();
|
||||||
|
} catch (IOException e) {
|
||||||
|
// Fall back to fetching capabilities again
|
||||||
fetchCapabilitiesForGuest();
|
fetchCapabilitiesForGuest();
|
||||||
|
}
|
||||||
|
} else {
|
||||||
|
fetchCapabilitiesForGuest();
|
||||||
|
}
|
||||||
} else {
|
} else {
|
||||||
processOperation();
|
processOperation();
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|
||||||
|
@SuppressLint("LongLogTag")
|
||||||
|
private void useBundledCapabilitiesForGuest() throws IOException {
|
||||||
|
currentUser = new UserEntity();
|
||||||
|
currentUser.setBaseUrl(baseUrl);
|
||||||
|
currentUser.setUserId("?");
|
||||||
|
try {
|
||||||
|
currentUser.setCapabilities(LoganSquare.serialize(serverCapabilities));
|
||||||
|
} catch (IOException e) {
|
||||||
|
Log.e("OperationsMenu", "Failed to serialize capabilities");
|
||||||
|
throw e;
|
||||||
|
}
|
||||||
|
|
||||||
|
try {
|
||||||
|
checkCapabilities(currentUser);
|
||||||
|
processOperation();
|
||||||
|
} catch (NoSupportedApiException e) {
|
||||||
|
showResultImage(false, false);
|
||||||
|
Log.d(TAG, "No supported server version found", e);
|
||||||
|
}
|
||||||
|
}
|
||||||
|
|
||||||
|
@SuppressLint("LongLogTag")
|
||||||
private void fetchCapabilitiesForGuest() {
|
private void fetchCapabilitiesForGuest() {
|
||||||
ncApi.getCapabilities(null, ApiUtils.getUrlForCapabilities(baseUrl))
|
ncApi.getCapabilities(null, ApiUtils.getUrlForCapabilities(baseUrl))
|
||||||
.subscribeOn(Schedulers.io())
|
.subscribeOn(Schedulers.io())
|
||||||
|
Loading…
Reference in New Issue
Block a user