use of com.nextcloud.talk.models.RetrofitBucket in project talk-android by nextcloud.
the class ApiUtils method getRetrofitBucketForContactsSearch.
public static RetrofitBucket getRetrofitBucketForContactsSearch(String baseUrl, String searchQuery) {
RetrofitBucket retrofitBucket = new RetrofitBucket();
retrofitBucket.setUrl(baseUrl + ocsApiVersion + "/apps/files_sharing/api/v1/sharees");
Map<String, String> queryMap = new HashMap<>();
queryMap.put("format", "json");
queryMap.put("search", searchQuery);
queryMap.put("perPage", "200");
queryMap.put("itemType", "call");
retrofitBucket.setQueryMap(queryMap);
return retrofitBucket;
}
use of com.nextcloud.talk.models.RetrofitBucket in project talk-android by nextcloud.
the class ContactsController method onItemClick.
@Override
public boolean onItemClick(View view, int position) {
if (adapter.getItem(position) instanceof UserItem) {
if (!isNewConversationView) {
UserItem userItem = (UserItem) adapter.getItem(position);
RetrofitBucket retrofitBucket = ApiUtils.getRetrofitBucketForCreateRoom(userEntity.getBaseUrl(), "1", userItem.getModel().getUserId(), null);
ncApi.createRoom(ApiUtils.getCredentials(userEntity.getUsername(), userEntity.getToken()), retrofitBucket.getUrl(), retrofitBucket.getQueryMap()).subscribeOn(Schedulers.newThread()).observeOn(AndroidSchedulers.mainThread()).subscribe(new Observer<RoomOverall>() {
@Override
public void onSubscribe(Disposable d) {
}
@Override
public void onNext(RoomOverall roomOverall) {
if (getActivity() != null) {
Intent callIntent = new Intent(getActivity(), CallActivity.class);
Bundle bundle = new Bundle();
bundle.putString(BundleKeys.KEY_ROOM_TOKEN, roomOverall.getOcs().getData().getToken());
bundle.putParcelable(BundleKeys.KEY_USER_ENTITY, Parcels.wrap(userEntity));
callIntent.putExtras(bundle);
startActivity(callIntent);
}
}
@Override
public void onError(Throwable e) {
}
@Override
public void onComplete() {
}
});
} else {
((UserItem) adapter.getItem(position)).flipItemSelection();
adapter.toggleSelection(position);
checkAndHandleBottomButtons();
}
} else if (adapter.getItem(position) instanceof NewCallHeaderItem) {
adapter.toggleSelection(position);
isPublicCall = adapter.isSelected(position);
((NewCallHeaderItem) adapter.getItem(position)).togglePublicCall(isPublicCall);
checkAndHandleBottomButtons();
}
return true;
}
use of com.nextcloud.talk.models.RetrofitBucket in project talk-android by nextcloud.
the class ApiUtils method getRetrofitBucketForCreateRoom.
public static RetrofitBucket getRetrofitBucketForCreateRoom(String baseUrl, String roomType, @Nullable String invite, @Nullable String conversationName) {
RetrofitBucket retrofitBucket = new RetrofitBucket();
retrofitBucket.setUrl(baseUrl + ocsApiVersion + spreedApiVersion + "/room");
Map<String, String> queryMap = new HashMap<>();
queryMap.put("roomType", roomType);
if (invite != null) {
queryMap.put("invite", invite);
}
if (conversationName != null) {
queryMap.put("roomName", conversationName);
}
retrofitBucket.setQueryMap(queryMap);
return retrofitBucket;
}
Aggregations