use of com.nextcloud.talk.models.json.capabilities.CapabilitiesOverall in project talk-android by nextcloud.
the class CapabilitiesJob method onRunJob.
@NonNull
@Override
protected Result onRunJob(Params params) {
NextcloudTalkApplication.getSharedApplication().getComponentApplication().inject(this);
long internalUserId = getParams().getExtras().getLong(BundleKeys.KEY_INTERNAL_USER_ID, -1);
UserEntity userEntity;
List userEntityObjectList = new ArrayList();
if (internalUserId == -1 || (userEntity = userUtils.getUserWithInternalId(internalUserId)) == null) {
userEntityObjectList = userUtils.getUsers();
} else {
userEntityObjectList.add(userEntity);
}
for (Object userEntityObject : userEntityObjectList) {
UserEntity internalUserEntity = (UserEntity) userEntityObject;
ncApi = retrofit.newBuilder().client(okHttpClient.newBuilder().cookieJar(new JavaNetCookieJar(new java.net.CookieManager())).build()).build().create(NcApi.class);
ncApi.getCapabilities(ApiUtils.getCredentials(internalUserEntity.getUsername(), internalUserEntity.getToken()), ApiUtils.getUrlForCapabilities(internalUserEntity.getBaseUrl())).subscribeOn(Schedulers.newThread()).subscribe(new Observer<CapabilitiesOverall>() {
@Override
public void onSubscribe(Disposable d) {
}
@Override
public void onNext(CapabilitiesOverall capabilitiesOverall) {
updateUser(capabilitiesOverall, internalUserEntity);
}
@Override
public void onError(Throwable e) {
}
@Override
public void onComplete() {
}
});
}
return Result.SUCCESS;
}
Aggregations