mirror of
https://github.com/nextcloud/talk-android.git
synced 2024-11-26 06:55:42 +03:00
check capabilities to set status support
Signed-off-by: Marcel Hibbe <dev@mhibbe.de>
This commit is contained in:
parent
dad53a77e6
commit
622eaa1d7f
1 changed files with 26 additions and 25 deletions
|
@ -139,7 +139,6 @@ public class ChooseAccountDialogFragment extends DialogFragment {
|
|||
binding.currentAccount.userIcon.setVisibility(View.INVISIBLE);
|
||||
}
|
||||
|
||||
|
||||
loadCurrentStatus(user);
|
||||
}
|
||||
|
||||
|
@ -168,10 +167,6 @@ public class ChooseAccountDialogFragment extends DialogFragment {
|
|||
}
|
||||
});
|
||||
|
||||
if (CapabilitiesUtil.isUserStatusAvailable(userUtils.getCurrentUser())) {
|
||||
binding.statusView.setVisibility(View.VISIBLE);
|
||||
}
|
||||
|
||||
if (adapter == null) {
|
||||
adapter = new FlexibleAdapter<>(userItems, getActivity(), false);
|
||||
|
||||
|
@ -205,30 +200,36 @@ public class ChooseAccountDialogFragment extends DialogFragment {
|
|||
|
||||
private void loadCurrentStatus(User user) {
|
||||
String credentials = ApiUtils.getCredentials(user.getUsername(), user.getToken());
|
||||
ncApi.status(credentials, ApiUtils.getUrlForStatus(user.getBaseUrl())).
|
||||
subscribeOn(Schedulers.io()).
|
||||
observeOn(AndroidSchedulers.mainThread()).
|
||||
subscribe(new Observer<StatusOverall>() {
|
||||
|
||||
@Override
|
||||
public void onSubscribe(@NonNull Disposable d) {}
|
||||
if (CapabilitiesUtil.isUserStatusAvailable(userUtils.getCurrentUser())) {
|
||||
binding.statusView.setVisibility(View.VISIBLE);
|
||||
|
||||
@Override
|
||||
public void onNext(@NonNull StatusOverall statusOverall) {
|
||||
status = statusOverall.ocs.data;
|
||||
binding.setStatus.setEnabled(true);
|
||||
drawStatus();
|
||||
}
|
||||
ncApi.status(credentials, ApiUtils.getUrlForStatus(user.getBaseUrl())).
|
||||
subscribeOn(Schedulers.io()).
|
||||
observeOn(AndroidSchedulers.mainThread()).
|
||||
subscribe(new Observer<StatusOverall>() {
|
||||
|
||||
@Override
|
||||
public void onError(@NonNull Throwable e) {
|
||||
Log.e(TAG, "Can't receive user status from server. ", e);
|
||||
}
|
||||
@Override
|
||||
public void onSubscribe(@NonNull Disposable d) {}
|
||||
|
||||
@Override
|
||||
public void onComplete() {
|
||||
}
|
||||
});
|
||||
@Override
|
||||
public void onNext(@NonNull StatusOverall statusOverall) {
|
||||
status = statusOverall.ocs.data;
|
||||
|
||||
binding.setStatus.setEnabled(true);
|
||||
drawStatus();
|
||||
}
|
||||
|
||||
@Override
|
||||
public void onError(@NonNull Throwable e) {
|
||||
Log.e(TAG, "Can't receive user status from server. ", e);
|
||||
}
|
||||
|
||||
@Override
|
||||
public void onComplete() {
|
||||
}
|
||||
});
|
||||
}
|
||||
}
|
||||
|
||||
private void prepareViews() {
|
||||
|
|
Loading…
Reference in a new issue