mirror of
https://github.com/nextcloud/talk-android
synced 2025-07-12 15:24:09 +01:00
Show phonebook setting only for Talk11 (verified via capability)
Signed-off-by: tobiasKaminsky <tobias@kaminsky.me>
This commit is contained in:
parent
ad97abaee4
commit
1496b902bb
@ -305,6 +305,12 @@ public class SettingsController extends BaseController {
|
||||
SwitchAccountController()).pushChangeHandler(new VerticalChangeHandler())
|
||||
.popChangeHandler(new VerticalChangeHandler()));
|
||||
});
|
||||
|
||||
if (userUtils.getCurrentUser().isPhoneBookIntegrationAvailable()) {
|
||||
phoneBookIntegretationPreference.setVisibility(View.VISIBLE);
|
||||
} else {
|
||||
phoneBookIntegretationPreference.setVisibility(View.GONE);
|
||||
}
|
||||
|
||||
String host = null;
|
||||
int port = -1;
|
||||
|
@ -21,17 +21,19 @@ package com.nextcloud.talk.models.database;
|
||||
|
||||
import android.os.Parcelable;
|
||||
import android.util.Log;
|
||||
|
||||
import com.bluelinelabs.logansquare.LoganSquare;
|
||||
import com.nextcloud.talk.models.json.capabilities.Capabilities;
|
||||
import io.requery.Entity;
|
||||
import io.requery.Generated;
|
||||
import io.requery.Key;
|
||||
import io.requery.Persistable;
|
||||
|
||||
import java.io.IOException;
|
||||
import java.io.Serializable;
|
||||
import java.util.HashMap;
|
||||
|
||||
import io.requery.Entity;
|
||||
import io.requery.Generated;
|
||||
import io.requery.Key;
|
||||
import io.requery.Persistable;
|
||||
|
||||
@Entity
|
||||
public interface User extends Parcelable, Persistable, Serializable {
|
||||
static final String TAG = "UserEntity";
|
||||
@ -128,4 +130,20 @@ public interface User extends Parcelable, Persistable, Serializable {
|
||||
}
|
||||
return 1000;
|
||||
}
|
||||
|
||||
default boolean isPhoneBookIntegrationAvailable() {
|
||||
if (getCapabilities() != null) {
|
||||
Capabilities capabilities;
|
||||
try {
|
||||
capabilities = LoganSquare.parse(getCapabilities(), Capabilities.class);
|
||||
return capabilities != null &&
|
||||
capabilities.getSpreedCapability() != null &&
|
||||
capabilities.getSpreedCapability().getFeatures() != null &&
|
||||
capabilities.getSpreedCapability().getFeatures().contains("phonebook-search");
|
||||
} catch (IOException e) {
|
||||
e.printStackTrace();
|
||||
}
|
||||
}
|
||||
return false;
|
||||
}
|
||||
}
|
||||
|
Loading…
Reference in New Issue
Block a user