Signed-off-by: Mario Danic <mario@lovelyhq.com>
This commit is contained in:
Mario Danic 2018-01-29 02:31:22 +01:00
parent 89352e902d
commit 2dc738e2f2
72 changed files with 236 additions and 286 deletions

View file

@ -28,10 +28,6 @@ import android.Manifest;
import android.animation.Animator;
import android.animation.AnimatorListenerAdapter;
import android.annotation.SuppressLint;
import android.content.BroadcastReceiver;
import android.content.Context;
import android.content.Intent;
import android.content.IntentFilter;
import android.content.res.Configuration;
import android.os.Bundle;
import android.os.Handler;
@ -51,29 +47,27 @@ import android.widget.RelativeLayout;
import android.widget.TextView;
import com.bluelinelabs.logansquare.LoganSquare;
import com.evernote.android.job.JobRequest;
import com.evernote.android.job.util.Device;
import com.nextcloud.talk.R;
import com.nextcloud.talk.api.NcApi;
import com.nextcloud.talk.api.helpers.api.ApiHelper;
import com.nextcloud.talk.api.models.json.call.CallOverall;
import com.nextcloud.talk.api.models.json.generic.GenericOverall;
import com.nextcloud.talk.api.models.json.rooms.Room;
import com.nextcloud.talk.api.models.json.rooms.RoomsOverall;
import com.nextcloud.talk.api.models.json.signaling.DataChannelMessage;
import com.nextcloud.talk.api.models.json.signaling.NCIceCandidate;
import com.nextcloud.talk.api.models.json.signaling.NCMessagePayload;
import com.nextcloud.talk.api.models.json.signaling.NCMessageWrapper;
import com.nextcloud.talk.api.models.json.signaling.NCSignalingMessage;
import com.nextcloud.talk.api.models.json.signaling.Signaling;
import com.nextcloud.talk.api.models.json.signaling.SignalingOverall;
import com.nextcloud.talk.api.models.json.signaling.settings.IceServer;
import com.nextcloud.talk.api.models.json.signaling.settings.SignalingSettingsOverall;
import com.nextcloud.talk.application.NextcloudTalkApplication;
import com.nextcloud.talk.events.MediaStreamEvent;
import com.nextcloud.talk.events.PeerConnectionEvent;
import com.nextcloud.talk.events.SessionDescriptionSendEvent;
import com.nextcloud.talk.models.json.call.CallOverall;
import com.nextcloud.talk.models.json.generic.GenericOverall;
import com.nextcloud.talk.models.json.rooms.Room;
import com.nextcloud.talk.models.json.rooms.RoomsOverall;
import com.nextcloud.talk.models.json.signaling.DataChannelMessage;
import com.nextcloud.talk.models.json.signaling.NCIceCandidate;
import com.nextcloud.talk.models.json.signaling.NCMessagePayload;
import com.nextcloud.talk.models.json.signaling.NCMessageWrapper;
import com.nextcloud.talk.models.json.signaling.NCSignalingMessage;
import com.nextcloud.talk.models.json.signaling.Signaling;
import com.nextcloud.talk.models.json.signaling.SignalingOverall;
import com.nextcloud.talk.models.json.signaling.settings.IceServer;
import com.nextcloud.talk.models.json.signaling.settings.SignalingSettingsOverall;
import com.nextcloud.talk.persistence.entities.UserEntity;
import com.nextcloud.talk.utils.ApiUtils;
import com.nextcloud.talk.utils.animations.PulseAnimation;
import com.nextcloud.talk.utils.bundle.BundleKeys;
import com.nextcloud.talk.utils.database.user.UserUtils;
@ -201,8 +195,6 @@ public class CallActivity extends AppCompatActivity {
private boolean videoOn = false;
private boolean audioOn = false;
private BroadcastReceiver networkBroadcastReceier;
private Handler handler = new Handler();
private boolean isPTTActive = false;
@ -242,20 +234,7 @@ public class CallActivity extends AppCompatActivity {
roomToken = getIntent().getExtras().getString(BundleKeys.KEY_ROOM_TOKEN, "");
userEntity = Parcels.unwrap(getIntent().getExtras().getParcelable(BundleKeys.KEY_USER_ENTITY));
callSession = getIntent().getExtras().getString(BundleKeys.KEY_CALL_SESSION, "0");
credentials = ApiHelper.getCredentials(userEntity.getUsername(), userEntity.getToken());
networkBroadcastReceier = new BroadcastReceiver() {
@Override
public void onReceive(Context context, Intent intent) {
if ("android.net.conn.CONNECTIVITY_CHANGE".equals(intent.getAction())) {
if (!Device.getNetworkType(context).equals(JobRequest.NetworkType.ANY)) {
startPullingSignalingMessages(true);
} else {
//hangup(true);
}
}
}
};
credentials = ApiUtils.getCredentials(userEntity.getUsername(), userEntity.getToken());
callControls.setZ(100.0f);
basicInitialization();
@ -301,16 +280,8 @@ public class CallActivity extends AppCompatActivity {
}
}
private void performIceRestart() {
for (int i = 0; i < magicPeerConnectionWrapperList.size(); i++) {
sdpConstraints.optional.add(new MediaConstraints.KeyValuePair("IceRestart", "true"));
PeerConnection.RTCConfiguration rtcConfiguration = new PeerConnection.RTCConfiguration(iceServers);
magicPeerConnectionWrapperList.get(i).getPeerConnection().setConfiguration(rtcConfiguration);
}
}
private void handleFromNotification() {
ncApi.getRooms(credentials, ApiHelper.getUrlForGetRooms(userEntity.getBaseUrl()))
ncApi.getRooms(credentials, ApiUtils.getUrlForGetRooms(userEntity.getBaseUrl()))
.subscribeOn(Schedulers.newThread())
.observeOn(AndroidSchedulers.mainThread())
.subscribe(new Observer<RoomsOverall>() {
@ -690,8 +661,7 @@ public class CallActivity extends AppCompatActivity {
if (!isPTTActive) {
animateCallControls(false, 7500);
}
startPullingSignalingMessages(false);
//registerNetworkReceiver();
startPullingSignalingMessages();
}
@OnClick({R.id.pip_video_view, R.id.remote_renderers_layout})
@ -699,17 +669,11 @@ public class CallActivity extends AppCompatActivity {
animateCallControls(true, 0);
}
public void startPullingSignalingMessages(boolean restart) {
if (restart) {
dispose(null);
//hangupNetworkCalls();
}
public void startPullingSignalingMessages() {
leavingCall = false;
ncApi.getSignalingSettings(ApiHelper.getCredentials(userEntity.getUsername(), userEntity.getToken()),
ApiHelper.getUrlForSignalingSettings(userEntity.getBaseUrl()))
ncApi.getSignalingSettings(ApiUtils.getCredentials(userEntity.getUsername(), userEntity.getToken()),
ApiUtils.getUrlForSignalingSettings(userEntity.getBaseUrl()))
.subscribeOn(Schedulers.newThread())
.observeOn(AndroidSchedulers.mainThread())
.subscribe(new Observer<SignalingSettingsOverall>() {
@ -747,11 +711,7 @@ public class CallActivity extends AppCompatActivity {
}
}
if (restart) {
performIceRestart();
} else {
joinRoomAndCall();
}
joinRoomAndCall();
}
@Override
@ -773,7 +733,7 @@ public class CallActivity extends AppCompatActivity {
private void joinRoomAndCall() {
if (callSession.equals("0")) {
ncApi.joinRoom(credentials, ApiHelper.getUrlForRoomParticipants(userEntity.getBaseUrl(), roomToken), null)
ncApi.joinRoom(credentials, ApiUtils.getUrlForRoomParticipants(userEntity.getBaseUrl(), roomToken), null)
.subscribeOn(Schedulers.newThread())
.observeOn(AndroidSchedulers.mainThread())
.retry(3)
@ -805,7 +765,7 @@ public class CallActivity extends AppCompatActivity {
private void performCall(@Nullable String callSessionId) {
ncApi.joinCall(credentials,
ApiHelper.getUrlForCall(userEntity.getBaseUrl(), roomToken))
ApiUtils.getUrlForCall(userEntity.getBaseUrl(), roomToken))
.subscribeOn(Schedulers.newThread())
.retry(3)
.observeOn(AndroidSchedulers.mainThread())
@ -823,8 +783,8 @@ public class CallActivity extends AppCompatActivity {
}
// start pinging the call
ncApi.pingCall(ApiHelper.getCredentials(userEntity.getUsername(), userEntity.getToken()),
ApiHelper.getUrlForCallPing(userEntity.getBaseUrl(), roomToken))
ncApi.pingCall(ApiUtils.getCredentials(userEntity.getUsername(), userEntity.getToken()),
ApiUtils.getUrlForCallPing(userEntity.getBaseUrl(), roomToken))
.subscribeOn(Schedulers.newThread())
.observeOn(AndroidSchedulers.mainThread())
.repeatWhen(observable -> observable.delay(5000, TimeUnit.MILLISECONDS))
@ -853,8 +813,8 @@ public class CallActivity extends AppCompatActivity {
});
// Start pulling signaling messages
ncApi.pullSignalingMessages(ApiHelper.getCredentials(userEntity.getUsername(),
userEntity.getToken()), ApiHelper.getUrlForSignaling(userEntity.getBaseUrl()))
ncApi.pullSignalingMessages(ApiUtils.getCredentials(userEntity.getUsername(),
userEntity.getToken()), ApiUtils.getUrlForSignaling(userEntity.getBaseUrl()))
.subscribeOn(Schedulers.newThread())
.observeOn(AndroidSchedulers.mainThread())
.repeatWhen(observable -> observable)
@ -1090,8 +1050,8 @@ public class CallActivity extends AppCompatActivity {
}
private void hangupNetworkCalls() {
String credentials = ApiHelper.getCredentials(userEntity.getUsername(), userEntity.getToken());
ncApi.leaveCall(credentials, ApiHelper.getUrlForCall(userEntity.getBaseUrl(), roomToken))
String credentials = ApiUtils.getCredentials(userEntity.getUsername(), userEntity.getToken());
ncApi.leaveCall(credentials, ApiUtils.getUrlForCall(userEntity.getBaseUrl(), roomToken))
.subscribeOn(Schedulers.newThread())
.observeOn(AndroidSchedulers.mainThread())
.subscribe(new Observer<GenericOverall>() {
@ -1102,7 +1062,7 @@ public class CallActivity extends AppCompatActivity {
@Override
public void onNext(GenericOverall genericOverall) {
ncApi.leaveRoom(credentials, ApiHelper.getUrlForRoomParticipants(userEntity.getBaseUrl(), roomToken))
ncApi.leaveRoom(credentials, ApiUtils.getUrlForRoomParticipants(userEntity.getBaseUrl(), roomToken))
.subscribeOn(Schedulers.newThread())
.observeOn(AndroidSchedulers.mainThread())
.subscribe(new Observer<GenericOverall>() {
@ -1309,7 +1269,7 @@ public class CallActivity extends AppCompatActivity {
@Subscribe(threadMode = ThreadMode.BACKGROUND)
public void onMessageEvent(SessionDescriptionSendEvent sessionDescriptionSend) throws IOException {
String credentials = ApiHelper.getCredentials(userEntity.getUsername(), userEntity.getToken());
String credentials = ApiUtils.getCredentials(userEntity.getUsername(), userEntity.getToken());
NCMessageWrapper ncMessageWrapper = new NCMessageWrapper();
ncMessageWrapper.setEv("message");
ncMessageWrapper.setSessionId(callSession);
@ -1349,7 +1309,7 @@ public class CallActivity extends AppCompatActivity {
String stringToSend = stringBuilder.toString();
strings.add(stringToSend);
ncApi.sendSignalingMessages(credentials, ApiHelper.getUrlForSignaling(userEntity.getBaseUrl()),
ncApi.sendSignalingMessages(credentials, ApiUtils.getUrlForSignaling(userEntity.getBaseUrl()),
strings.toString())
.retry(3)
.subscribeOn(Schedulers.newThread())
@ -1405,14 +1365,6 @@ public class CallActivity extends AppCompatActivity {
this);
}
private void registerNetworkReceiver() {
IntentFilter intentFilter = new IntentFilter();
intentFilter.addAction("android.net.conn.CONNECTIVITY_CHANxGE");
intentFilter.addAction("android.net.wifi.STATE_CHANGE");
this.registerReceiver(networkBroadcastReceier, intentFilter);
}
private void animateCallControls(boolean show, long startDelay) {
if (!isPTTActive) {
float alpha;

View file

@ -35,8 +35,8 @@ import com.bumptech.glide.load.model.LazyHeaders;
import com.bumptech.glide.load.resource.bitmap.CircleCrop;
import com.bumptech.glide.request.RequestOptions;
import com.nextcloud.talk.R;
import com.nextcloud.talk.api.helpers.api.ApiHelper;
import com.nextcloud.talk.api.models.json.participants.Participant;
import com.nextcloud.talk.utils.ApiUtils;
import com.nextcloud.talk.models.json.participants.Participant;
import com.nextcloud.talk.application.NextcloudTalkApplication;
import com.nextcloud.talk.persistence.entities.UserEntity;
import com.nextcloud.talk.utils.glide.GlideApp;
@ -123,10 +123,10 @@ public class AdvancedUserItem extends AbstractFlexibleItem<AdvancedUserItem.User
layoutParams.setMarginStart(0);
layoutParams.removeRule(RelativeLayout.ALIGN_PARENT_START);
holder.linearLayout.setLayoutParams(layoutParams);
GlideUrl glideUrl = new GlideUrl(ApiHelper.getUrlForAvatarWithName(userEntity.getBaseUrl(),
GlideUrl glideUrl = new GlideUrl(ApiUtils.getUrlForAvatarWithName(userEntity.getBaseUrl(),
participant.getUserId(), false), new LazyHeaders.Builder()
.setHeader("Accept", "image/*")
.setHeader("User-Agent", ApiHelper.getUserAgent())
.setHeader("User-Agent", ApiUtils.getUserAgent())
.build());
GlideApp.with(NextcloudTalkApplication.getSharedApplication().getApplicationContext())

View file

@ -33,8 +33,8 @@ import com.bumptech.glide.load.model.LazyHeaders;
import com.bumptech.glide.load.resource.bitmap.CircleCrop;
import com.bumptech.glide.request.RequestOptions;
import com.nextcloud.talk.R;
import com.nextcloud.talk.api.helpers.api.ApiHelper;
import com.nextcloud.talk.api.models.json.rooms.Room;
import com.nextcloud.talk.utils.ApiUtils;
import com.nextcloud.talk.models.json.rooms.Room;
import com.nextcloud.talk.application.NextcloudTalkApplication;
import com.nextcloud.talk.events.MoreMenuClickEvent;
import com.nextcloud.talk.persistence.entities.UserEntity;
@ -125,10 +125,10 @@ public class CallItem extends AbstractFlexibleItem<CallItem.RoomItemViewHolder>
holder.avatarImageView.setVisibility(View.VISIBLE);
if (!TextUtils.isEmpty(room.getName())) {
GlideUrl glideUrl = new GlideUrl(ApiHelper.getUrlForAvatarWithName(userEntity.getBaseUrl(),
GlideUrl glideUrl = new GlideUrl(ApiUtils.getUrlForAvatarWithName(userEntity.getBaseUrl(),
room.getName(), false), new LazyHeaders.Builder()
.setHeader("Accept", "image/*")
.setHeader("User-Agent", ApiHelper.getUserAgent())
.setHeader("User-Agent", ApiUtils.getUserAgent())
.build());
GlideApp.with(NextcloudTalkApplication.getSharedApplication().getApplicationContext())

View file

@ -30,8 +30,8 @@ import com.bumptech.glide.load.model.LazyHeaders;
import com.bumptech.glide.load.resource.bitmap.CircleCrop;
import com.bumptech.glide.request.RequestOptions;
import com.nextcloud.talk.R;
import com.nextcloud.talk.api.helpers.api.ApiHelper;
import com.nextcloud.talk.api.models.json.participants.Participant;
import com.nextcloud.talk.utils.ApiUtils;
import com.nextcloud.talk.models.json.participants.Participant;
import com.nextcloud.talk.application.NextcloudTalkApplication;
import com.nextcloud.talk.persistence.entities.UserEntity;
import com.nextcloud.talk.utils.glide.GlideApp;
@ -102,10 +102,10 @@ public class UserItem extends AbstractFlexibleItem<UserItem.UserItemViewHolder>
holder.contactDisplayName.setText(participant.getName());
}
GlideUrl glideUrl = new GlideUrl(ApiHelper.getUrlForAvatarWithName(userEntity.getBaseUrl(),
GlideUrl glideUrl = new GlideUrl(ApiUtils.getUrlForAvatarWithName(userEntity.getBaseUrl(),
participant.getUserId(), false), new LazyHeaders.Builder()
.setHeader("Accept", "image/*")
.setHeader("User-Agent", ApiHelper.getUserAgent())
.setHeader("User-Agent", ApiUtils.getUserAgent())
.build());
GlideApp.with(NextcloudTalkApplication.getSharedApplication().getApplicationContext())

View file

@ -22,18 +22,18 @@ package com.nextcloud.talk.api;
import android.support.annotation.Nullable;
import com.nextcloud.talk.api.models.json.call.CallOverall;
import com.nextcloud.talk.api.models.json.generic.GenericOverall;
import com.nextcloud.talk.api.models.json.generic.Status;
import com.nextcloud.talk.api.models.json.participants.AddParticipantOverall;
import com.nextcloud.talk.api.models.json.participants.ParticipantsOverall;
import com.nextcloud.talk.api.models.json.push.PushRegistrationOverall;
import com.nextcloud.talk.api.models.json.rooms.RoomOverall;
import com.nextcloud.talk.api.models.json.rooms.RoomsOverall;
import com.nextcloud.talk.api.models.json.sharees.ShareesOverall;
import com.nextcloud.talk.api.models.json.signaling.SignalingOverall;
import com.nextcloud.talk.api.models.json.signaling.settings.SignalingSettingsOverall;
import com.nextcloud.talk.api.models.json.userprofile.UserProfileOverall;
import com.nextcloud.talk.models.json.call.CallOverall;
import com.nextcloud.talk.models.json.generic.GenericOverall;
import com.nextcloud.talk.models.json.generic.Status;
import com.nextcloud.talk.models.json.participants.AddParticipantOverall;
import com.nextcloud.talk.models.json.participants.ParticipantsOverall;
import com.nextcloud.talk.models.json.push.PushRegistrationOverall;
import com.nextcloud.talk.models.json.rooms.RoomOverall;
import com.nextcloud.talk.models.json.rooms.RoomsOverall;
import com.nextcloud.talk.models.json.sharees.ShareesOverall;
import com.nextcloud.talk.models.json.signaling.SignalingOverall;
import com.nextcloud.talk.models.json.signaling.settings.SignalingSettingsOverall;
import com.nextcloud.talk.models.json.userprofile.UserProfileOverall;
import java.util.Map;

View file

@ -36,7 +36,7 @@ import com.bluelinelabs.conductor.changehandler.HorizontalChangeHandler;
import com.evernote.android.job.JobRequest;
import com.nextcloud.talk.R;
import com.nextcloud.talk.api.NcApi;
import com.nextcloud.talk.api.helpers.api.ApiHelper;
import com.nextcloud.talk.utils.ApiUtils;
import com.nextcloud.talk.application.NextcloudTalkApplication;
import com.nextcloud.talk.controllers.base.BaseController;
import com.nextcloud.talk.jobs.PushRegistrationJob;
@ -136,9 +136,9 @@ public class AccountVerificationController extends BaseController {
baseUrl = baseUrl.replace("http://", "").replace("https://", "");
if (checkForcedHttps) {
queryUrl = "https://" + baseUrl + ApiHelper.getUrlPostfixForStatus();
queryUrl = "https://" + baseUrl + ApiUtils.getUrlPostfixForStatus();
} else {
queryUrl = "http://" + baseUrl + ApiHelper.getUrlPostfixForStatus();
queryUrl = "http://" + baseUrl + ApiUtils.getUrlPostfixForStatus();
}
statusQueryDisposable = ncApi.getServerStatus(queryUrl)
@ -164,10 +164,10 @@ public class AccountVerificationController extends BaseController {
}
private void checkEverything() {
String credentials = ApiHelper.getCredentials(username, token);
String credentials = ApiUtils.getCredentials(username, token);
cookieManager.getCookieStore().removeAll();
roomsQueryDisposable = ncApi.getRooms(credentials, ApiHelper.getUrlForGetRooms(baseUrl))
roomsQueryDisposable = ncApi.getRooms(credentials, ApiUtils.getUrlForGetRooms(baseUrl))
.subscribeOn(Schedulers.newThread())
.observeOn(AndroidSchedulers.mainThread())
.subscribe(roomsOverall -> {
@ -175,7 +175,7 @@ public class AccountVerificationController extends BaseController {
R.string.nc_nextcloud_talk_app_installed), getResources().getString(R.string.nc_app_name)));
profileQueryDisposable = ncApi.getUserProfile(credentials,
ApiHelper.getUrlForUserProfile(baseUrl))
ApiUtils.getUrlForUserProfile(baseUrl))
.subscribeOn(Schedulers.newThread())
.observeOn(AndroidSchedulers.mainThread())
.subscribe(userProfileOverall -> {

View file

@ -55,9 +55,9 @@ import com.nextcloud.talk.R;
import com.nextcloud.talk.activities.CallActivity;
import com.nextcloud.talk.adapters.items.CallItem;
import com.nextcloud.talk.api.NcApi;
import com.nextcloud.talk.api.helpers.api.ApiHelper;
import com.nextcloud.talk.api.models.json.participants.Participant;
import com.nextcloud.talk.api.models.json.rooms.Room;
import com.nextcloud.talk.utils.ApiUtils;
import com.nextcloud.talk.models.json.participants.Participant;
import com.nextcloud.talk.models.json.rooms.Room;
import com.nextcloud.talk.application.NextcloudTalkApplication;
import com.nextcloud.talk.controllers.base.BaseController;
import com.nextcloud.talk.controllers.bottomsheet.CallMenuController;
@ -245,8 +245,8 @@ public class CallsListController extends BaseController implements SearchView.On
callItems = new ArrayList<>();
roomsQueryDisposable = ncApi.getRooms(ApiHelper.getCredentials(userEntity.getUsername(),
userEntity.getToken()), ApiHelper.getUrlForGetRooms(userEntity.getBaseUrl()))
roomsQueryDisposable = ncApi.getRooms(ApiUtils.getCredentials(userEntity.getUsername(),
userEntity.getToken()), ApiUtils.getUrlForGetRooms(userEntity.getBaseUrl()))
.subscribeOn(Schedulers.newThread())
.observeOn(AndroidSchedulers.mainThread())
.subscribe(roomsOverall -> {

View file

@ -54,10 +54,10 @@ import com.nextcloud.talk.R;
import com.nextcloud.talk.activities.CallActivity;
import com.nextcloud.talk.adapters.items.UserItem;
import com.nextcloud.talk.api.NcApi;
import com.nextcloud.talk.api.helpers.api.ApiHelper;
import com.nextcloud.talk.api.models.json.participants.Participant;
import com.nextcloud.talk.api.models.json.rooms.RoomOverall;
import com.nextcloud.talk.api.models.json.sharees.Sharee;
import com.nextcloud.talk.utils.ApiUtils;
import com.nextcloud.talk.models.json.participants.Participant;
import com.nextcloud.talk.models.json.rooms.RoomOverall;
import com.nextcloud.talk.models.json.sharees.Sharee;
import com.nextcloud.talk.application.NextcloudTalkApplication;
import com.nextcloud.talk.controllers.base.BaseController;
import com.nextcloud.talk.models.RetrofitBucket;
@ -226,10 +226,10 @@ public class ContactsController extends BaseController implements SearchView.OnQ
contactItems = new ArrayList<>();
RetrofitBucket retrofitBucket = ApiHelper.getRetrofitBucketForContactsSearch(userEntity.getBaseUrl(),
RetrofitBucket retrofitBucket = ApiUtils.getRetrofitBucketForContactsSearch(userEntity.getBaseUrl(),
"");
contactsQueryDisposable = ncApi.getContactsWithSearchParam(
ApiHelper.getCredentials(userEntity.getUsername(), userEntity.getToken()),
ApiUtils.getCredentials(userEntity.getUsername(), userEntity.getToken()),
retrofitBucket.getUrl(), retrofitBucket.getQueryMap())
.subscribeOn(Schedulers.newThread())
.observeOn(AndroidSchedulers.mainThread())
@ -439,9 +439,9 @@ public class ContactsController extends BaseController implements SearchView.OnQ
@Override
public boolean onItemClick(int position) {
UserItem userItem = adapter.getItem(position);
RetrofitBucket retrofitBucket = ApiHelper.getRetrofitBucketForCreateRoom(userEntity.getBaseUrl(), "1",
RetrofitBucket retrofitBucket = ApiUtils.getRetrofitBucketForCreateRoom(userEntity.getBaseUrl(), "1",
userItem.getModel().getUserId());
ncApi.createRoom(ApiHelper.getCredentials(userEntity.getUsername(), userEntity.getToken()),
ncApi.createRoom(ApiUtils.getCredentials(userEntity.getUsername(), userEntity.getToken()),
retrofitBucket.getUrl(), retrofitBucket.getQueryMap())
.subscribeOn(Schedulers.newThread())
.observeOn(AndroidSchedulers.mainThread())

View file

@ -39,7 +39,7 @@ import com.bluelinelabs.conductor.RouterTransaction;
import com.bluelinelabs.conductor.changehandler.HorizontalChangeHandler;
import com.nextcloud.talk.R;
import com.nextcloud.talk.api.NcApi;
import com.nextcloud.talk.api.helpers.api.ApiHelper;
import com.nextcloud.talk.utils.ApiUtils;
import com.nextcloud.talk.application.NextcloudTalkApplication;
import com.nextcloud.talk.controllers.base.BaseController;
import com.nextcloud.talk.utils.AccountUtils;
@ -212,7 +212,7 @@ public class ServerSelectionController extends BaseController {
url = url.substring(0, url.length() - 1);
}
String queryUrl = url + ApiHelper.getUrlPostfixForStatus();
String queryUrl = url + ApiUtils.getUrlPostfixForStatus();
if (url.startsWith("http://") || url.startsWith("https://")) {
checkServer(queryUrl, false);

View file

@ -43,7 +43,7 @@ import com.evernote.android.job.JobRequest;
import com.nextcloud.talk.BuildConfig;
import com.nextcloud.talk.R;
import com.nextcloud.talk.api.NcApi;
import com.nextcloud.talk.api.helpers.api.ApiHelper;
import com.nextcloud.talk.utils.ApiUtils;
import com.nextcloud.talk.application.NextcloudTalkApplication;
import com.nextcloud.talk.controllers.base.BaseController;
import com.nextcloud.talk.jobs.AccountRemovalJob;
@ -273,9 +273,9 @@ public class SettingsController extends BaseController {
loadAvatarImage();
profileQueryDisposable = ncApi.getUserProfile(ApiHelper.getCredentials(userEntity.getUsername(),
profileQueryDisposable = ncApi.getUserProfile(ApiUtils.getCredentials(userEntity.getUsername(),
userEntity.getToken()),
ApiHelper.getUrlForUserProfile(userEntity.getBaseUrl()))
ApiUtils.getUrlForUserProfile(userEntity.getBaseUrl()))
.subscribeOn(Schedulers.newThread())
.observeOn(AndroidSchedulers.mainThread())
.subscribe(userProfileOverall -> {
@ -418,10 +418,10 @@ public class SettingsController extends BaseController {
avatarId = userEntity.getUsername();
}
GlideUrl glideUrl = new GlideUrl(ApiHelper.getUrlForAvatarWithName(userEntity.getBaseUrl(),
GlideUrl glideUrl = new GlideUrl(ApiUtils.getUrlForAvatarWithName(userEntity.getBaseUrl(),
avatarId, true), new LazyHeaders.Builder()
.setHeader("Accept", "image/*")
.setHeader("User-Agent", ApiHelper.getUserAgent())
.setHeader("User-Agent", ApiUtils.getUserAgent())
.build());
GlideApp.with(NextcloudTalkApplication.getSharedApplication().getApplicationContext())

View file

@ -38,7 +38,7 @@ import com.bluelinelabs.conductor.RouterTransaction;
import com.bluelinelabs.conductor.changehandler.HorizontalChangeHandler;
import com.nextcloud.talk.R;
import com.nextcloud.talk.adapters.items.AdvancedUserItem;
import com.nextcloud.talk.api.models.json.participants.Participant;
import com.nextcloud.talk.models.json.participants.Participant;
import com.nextcloud.talk.application.NextcloudTalkApplication;
import com.nextcloud.talk.controllers.base.BaseController;
import com.nextcloud.talk.models.ImportAccount;

View file

@ -36,7 +36,7 @@ import com.kennyc.bottomsheet.adapters.AppAdapter;
import com.nextcloud.talk.R;
import com.nextcloud.talk.adapters.items.AppItem;
import com.nextcloud.talk.adapters.items.MenuItem;
import com.nextcloud.talk.api.models.json.rooms.Room;
import com.nextcloud.talk.models.json.rooms.Room;
import com.nextcloud.talk.application.NextcloudTalkApplication;
import com.nextcloud.talk.controllers.base.BaseController;
import com.nextcloud.talk.events.BottomSheetLockEvent;

View file

@ -35,7 +35,7 @@ import android.widget.Button;
import com.bluelinelabs.conductor.RouterTransaction;
import com.nextcloud.talk.R;
import com.nextcloud.talk.api.models.json.rooms.Room;
import com.nextcloud.talk.models.json.rooms.Room;
import com.nextcloud.talk.application.NextcloudTalkApplication;
import com.nextcloud.talk.controllers.base.BaseController;
import com.nextcloud.talk.events.BottomSheetLockEvent;

View file

@ -35,9 +35,9 @@ import com.bluelinelabs.conductor.internal.NoOpControllerChangeHandler;
import com.nextcloud.talk.R;
import com.nextcloud.talk.activities.CallActivity;
import com.nextcloud.talk.api.NcApi;
import com.nextcloud.talk.api.helpers.api.ApiHelper;
import com.nextcloud.talk.api.models.json.call.CallOverall;
import com.nextcloud.talk.api.models.json.rooms.Room;
import com.nextcloud.talk.utils.ApiUtils;
import com.nextcloud.talk.models.json.call.CallOverall;
import com.nextcloud.talk.models.json.rooms.Room;
import com.nextcloud.talk.application.NextcloudTalkApplication;
import com.nextcloud.talk.controllers.base.BaseController;
import com.nextcloud.talk.events.BottomSheetLockEvent;
@ -124,10 +124,10 @@ public class OperationsMenuController extends BaseController {
UserEntity userEntity = userUtils.getCurrentUser();
OperationsObserver operationsObserver = new OperationsObserver();
if (userEntity != null) {
String credentials = ApiHelper.getCredentials(userEntity.getUsername(), userEntity.getToken());
String credentials = ApiUtils.getCredentials(userEntity.getUsername(), userEntity.getToken());
switch (operationCode) {
case 1:
ncApi.removeSelfFromRoom(credentials, ApiHelper.getUrlForRemoveSelfFromRoom(userEntity.getBaseUrl
ncApi.removeSelfFromRoom(credentials, ApiUtils.getUrlForRemoveSelfFromRoom(userEntity.getBaseUrl
(), room.getToken()))
.subscribeOn(Schedulers.newThread())
.observeOn(AndroidSchedulers.mainThread())
@ -135,7 +135,7 @@ public class OperationsMenuController extends BaseController {
.subscribe(operationsObserver);
break;
case 2:
ncApi.renameRoom(credentials, ApiHelper.getRoom(userEntity.getBaseUrl(), room.getToken()),
ncApi.renameRoom(credentials, ApiUtils.getRoom(userEntity.getBaseUrl(), room.getToken()),
room.getName())
.subscribeOn(Schedulers.newThread())
.observeOn(AndroidSchedulers.mainThread())
@ -143,7 +143,7 @@ public class OperationsMenuController extends BaseController {
.subscribe(operationsObserver);
break;
case 3:
ncApi.makeRoomPublic(credentials, ApiHelper.getUrlForRoomVisibility(userEntity.getBaseUrl(), room
ncApi.makeRoomPublic(credentials, ApiUtils.getUrlForRoomVisibility(userEntity.getBaseUrl(), room
.getToken()))
.subscribeOn(Schedulers.newThread())
.observeOn(AndroidSchedulers.mainThread())
@ -157,7 +157,7 @@ public class OperationsMenuController extends BaseController {
if (room.getPassword() != null) {
pass = room.getPassword();
}
ncApi.setPassword(credentials, ApiHelper.getUrlForPassword(userEntity.getBaseUrl(),
ncApi.setPassword(credentials, ApiUtils.getUrlForPassword(userEntity.getBaseUrl(),
room.getToken()), pass)
.subscribeOn(Schedulers.newThread())
.observeOn(AndroidSchedulers.mainThread())
@ -168,7 +168,7 @@ public class OperationsMenuController extends BaseController {
// Operation 7 is sharing, so we handle this differently
break;
case 8:
ncApi.makeRoomPrivate(credentials, ApiHelper.getUrlForRoomVisibility(userEntity.getBaseUrl(), room
ncApi.makeRoomPrivate(credentials, ApiUtils.getUrlForRoomVisibility(userEntity.getBaseUrl(), room
.getToken()))
.subscribeOn(Schedulers.newThread())
.observeOn(AndroidSchedulers.mainThread())
@ -176,13 +176,13 @@ public class OperationsMenuController extends BaseController {
.subscribe(operationsObserver);
break;
case 9:
ncApi.deleteRoom(credentials, ApiHelper.getUrlForRoomParticipants(userEntity.getBaseUrl(), room.getToken()))
ncApi.deleteRoom(credentials, ApiUtils.getUrlForRoomParticipants(userEntity.getBaseUrl(), room.getToken()))
.subscribeOn(Schedulers.newThread())
.observeOn(AndroidSchedulers.mainThread())
.retry(1)
.subscribe(operationsObserver);
case 99:
ncApi.joinRoom(credentials, ApiHelper.getUrlForRoomParticipants(userEntity.getBaseUrl(), room.getToken()),
ncApi.joinRoom(credentials, ApiUtils.getUrlForRoomParticipants(userEntity.getBaseUrl(), room.getToken()),
callPassword)
.subscribeOn(Schedulers.newThread())
.observeOn(AndroidSchedulers.mainThread())

View file

@ -28,7 +28,7 @@ import android.util.Log;
import com.github.aurae.retrofit2.LoganSquareConverterFactory;
import com.nextcloud.talk.BuildConfig;
import com.nextcloud.talk.api.NcApi;
import com.nextcloud.talk.api.helpers.api.ApiHelper;
import com.nextcloud.talk.utils.ApiUtils;
import com.nextcloud.talk.application.NextcloudTalkApplication;
import com.nextcloud.talk.utils.preferences.AppPreferences;
import com.nextcloud.talk.utils.ssl.MagicTrustManager;
@ -208,7 +208,7 @@ public class RestModule {
Request original = chain.request();
Request request = original.newBuilder()
.header("User-Agent", ApiHelper.getUserAgent())
.header("User-Agent", ApiUtils.getUserAgent())
.header("Accept", "application/json")
.header("OCS-APIRequest", "true")
.method(original.method(), original.body())

View file

@ -20,7 +20,7 @@
package com.nextcloud.talk.events;
import com.nextcloud.talk.api.models.json.rooms.Room;
import com.nextcloud.talk.models.json.rooms.Room;
import lombok.Data;

View file

@ -22,7 +22,7 @@ package com.nextcloud.talk.events;
import android.support.annotation.Nullable;
import com.nextcloud.talk.api.models.json.signaling.NCIceCandidate;
import com.nextcloud.talk.models.json.signaling.NCIceCandidate;
import org.webrtc.SessionDescription;

View file

@ -28,9 +28,9 @@ import android.util.Log;
import com.bluelinelabs.logansquare.LoganSquare;
import com.evernote.android.job.Job;
import com.nextcloud.talk.api.NcApi;
import com.nextcloud.talk.api.helpers.api.ApiHelper;
import com.nextcloud.talk.api.models.json.generic.GenericOverall;
import com.nextcloud.talk.api.models.json.push.PushConfigurationState;
import com.nextcloud.talk.utils.ApiUtils;
import com.nextcloud.talk.models.json.generic.GenericOverall;
import com.nextcloud.talk.models.json.push.PushConfigurationState;
import com.nextcloud.talk.application.NextcloudTalkApplication;
import com.nextcloud.talk.persistence.entities.UserEntity;
import com.nextcloud.talk.utils.database.user.UserUtils;
@ -81,8 +81,8 @@ public class AccountRemovalJob extends Job {
ncApi = retrofit.newBuilder().client(okHttpClient.newBuilder().cookieJar(new
JavaNetCookieJar(new CookieManager())).build()).build().create(NcApi.class);
ncApi.unregisterDeviceForNotificationsWithNextcloud(ApiHelper.getCredentials(userEntity.getUsername(),
userEntity.getToken()), ApiHelper.getUrlNextcloudPush(userEntity.getBaseUrl()))
ncApi.unregisterDeviceForNotificationsWithNextcloud(ApiUtils.getCredentials(userEntity.getUsername(),
userEntity.getToken()), ApiUtils.getUrlNextcloudPush(userEntity.getBaseUrl()))
.subscribe(new Observer<GenericOverall>() {
@Override
public void onSubscribe(Disposable d) {
@ -100,8 +100,8 @@ public class AccountRemovalJob extends Job {
finalPushConfigurationState.getDeviceIdentifierSignature());
ncApi.unregisterDeviceForNotificationsWithProxy
(ApiHelper.getCredentials(userEntity.getUsername(),
userEntity.getToken()), ApiHelper.getUrlPushProxy(), queryMap)
(ApiUtils.getCredentials(userEntity.getUsername(),
userEntity.getToken()), ApiUtils.getUrlPushProxy(), queryMap)
.subscribe(new Observer<Void>() {
@Override
public void onSubscribe(Disposable d) {

View file

@ -0,0 +1,52 @@
/*
* Nextcloud Talk application
*
* @author Mario Danic
* Copyright (C) 2017-2018 Mario Danic <mario@lovelyhq.com>
*
* This program is free software: you can redistribute it and/or modify
* it under the terms of the GNU General Public License as published by
* the Free Software Foundation, either version 3 of the License, or
* at your option) any later version.
*
* This program is distributed in the hope that it will be useful,
* but WITHOUT ANY WARRANTY; without even the implied warranty of
* MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
* GNU General Public License for more details.
*
* You should have received a copy of the GNU General Public License
* along with this program. If not, see <http://www.gnu.org/licenses/>.
*/
package com.nextcloud.talk.models.database;
import android.os.Parcelable;
import java.io.Serializable;
import io.requery.Entity;
import io.requery.Generated;
import io.requery.Key;
import io.requery.Persistable;
@Entity
public interface User extends Parcelable, Persistable, Serializable {
@Key
@Generated
long getId();
String getUserId();
String getUsername();
String getBaseUrl();
String getToken();
String getDisplayName();
String getPushConfigurationState();
boolean getCurrent();
boolean getScheduledForDeletion();
}

View file

@ -18,7 +18,7 @@
* You should have received a copy of the GNU General Public License
* along with this program. If not, see <http://www.gnu.org/licenses/>.
*/
package com.nextcloud.talk.api.models.json.call;
package com.nextcloud.talk.models.json.call;
import com.bluelinelabs.logansquare.annotation.JsonField;
import com.bluelinelabs.logansquare.annotation.JsonObject;

View file

@ -18,11 +18,11 @@
* You should have received a copy of the GNU General Public License
* along with this program. If not, see <http://www.gnu.org/licenses/>.
*/
package com.nextcloud.talk.api.models.json.call;
package com.nextcloud.talk.models.json.call;
import com.bluelinelabs.logansquare.annotation.JsonField;
import com.bluelinelabs.logansquare.annotation.JsonObject;
import com.nextcloud.talk.api.models.json.generic.GenericOCS;
import com.nextcloud.talk.models.json.generic.GenericOCS;
import org.parceler.Parcel;

View file

@ -18,7 +18,7 @@
* You should have received a copy of the GNU General Public License
* along with this program. If not, see <http://www.gnu.org/licenses/>.
*/
package com.nextcloud.talk.api.models.json.call;
package com.nextcloud.talk.models.json.call;
import com.bluelinelabs.logansquare.annotation.JsonField;
import com.bluelinelabs.logansquare.annotation.JsonObject;

View file

@ -18,10 +18,10 @@
* along with this program. If not, see <http://www.gnu.org/licenses/>.
*/
package com.nextcloud.talk.api.models.json.converters;
package com.nextcloud.talk.models.json.converters;
import com.bluelinelabs.logansquare.typeconverters.IntBasedTypeConverter;
import com.nextcloud.talk.api.models.json.participants.Participant;
import com.nextcloud.talk.models.json.participants.Participant;
public class EnumParticipantTypeConverter extends IntBasedTypeConverter<Participant.ParticipantType> {
@Override

View file

@ -18,10 +18,10 @@
* along with this program. If not, see <http://www.gnu.org/licenses/>.
*/
package com.nextcloud.talk.api.models.json.converters;
package com.nextcloud.talk.models.json.converters;
import com.bluelinelabs.logansquare.typeconverters.IntBasedTypeConverter;
import com.nextcloud.talk.api.models.json.rooms.Room;
import com.nextcloud.talk.models.json.rooms.Room;
public class EnumRoomTypeConverter extends IntBasedTypeConverter<Room.RoomType> {
@Override

View file

@ -18,7 +18,7 @@
* You should have received a copy of the GNU General Public License
* along with this program. If not, see <http://www.gnu.org/licenses/>.
*/
package com.nextcloud.talk.api.models.json.generic;
package com.nextcloud.talk.models.json.generic;
import com.bluelinelabs.logansquare.annotation.JsonField;
import com.bluelinelabs.logansquare.annotation.JsonObject;

View file

@ -18,7 +18,7 @@
* You should have received a copy of the GNU General Public License
* along with this program. If not, see <http://www.gnu.org/licenses/>.
*/
package com.nextcloud.talk.api.models.json.generic;
package com.nextcloud.talk.models.json.generic;
import com.bluelinelabs.logansquare.annotation.JsonField;
import com.bluelinelabs.logansquare.annotation.JsonObject;

View file

@ -18,7 +18,7 @@
* You should have received a copy of the GNU General Public License
* along with this program. If not, see <http://www.gnu.org/licenses/>.
*/
package com.nextcloud.talk.api.models.json.generic;
package com.nextcloud.talk.models.json.generic;
import com.bluelinelabs.logansquare.annotation.JsonField;
import com.bluelinelabs.logansquare.annotation.JsonObject;

View file

@ -18,7 +18,7 @@
* along with this program. If not, see <http://www.gnu.org/licenses/>.
*/
package com.nextcloud.talk.api.models.json.generic;
package com.nextcloud.talk.models.json.generic;
import com.bluelinelabs.logansquare.annotation.JsonField;
import com.bluelinelabs.logansquare.annotation.JsonObject;

View file

@ -18,12 +18,12 @@
* You should have received a copy of the GNU General Public License
* along with this program. If not, see <http://www.gnu.org/licenses/>.
*/
package com.nextcloud.talk.api.models.json.participants;
package com.nextcloud.talk.models.json.participants;
import com.bluelinelabs.logansquare.annotation.JsonField;
import com.bluelinelabs.logansquare.annotation.JsonObject;
import com.nextcloud.talk.api.models.json.generic.GenericOCS;
import com.nextcloud.talk.api.models.json.rooms.Room;
import com.nextcloud.talk.models.json.generic.GenericOCS;
import com.nextcloud.talk.models.json.rooms.Room;
@JsonObject
public class AddParticipantOCS extends GenericOCS {

View file

@ -18,11 +18,11 @@
* You should have received a copy of the GNU General Public License
* along with this program. If not, see <http://www.gnu.org/licenses/>.
*/
package com.nextcloud.talk.api.models.json.participants;
package com.nextcloud.talk.models.json.participants;
import com.bluelinelabs.logansquare.annotation.JsonField;
import com.bluelinelabs.logansquare.annotation.JsonObject;
import com.nextcloud.talk.api.models.json.rooms.RoomsOCS;
import com.nextcloud.talk.models.json.rooms.RoomsOCS;
@JsonObject
public class AddParticipantOverall {

View file

@ -18,7 +18,7 @@
* You should have received a copy of the GNU General Public License
* along with this program. If not, see <http://www.gnu.org/licenses/>.
*/
package com.nextcloud.talk.api.models.json.participants;
package com.nextcloud.talk.models.json.participants;
import com.bluelinelabs.logansquare.annotation.JsonField;
import com.bluelinelabs.logansquare.annotation.JsonObject;

View file

@ -18,11 +18,11 @@
* You should have received a copy of the GNU General Public License
* along with this program. If not, see <http://www.gnu.org/licenses/>.
*/
package com.nextcloud.talk.api.models.json.participants;
package com.nextcloud.talk.models.json.participants;
import com.bluelinelabs.logansquare.annotation.JsonField;
import com.bluelinelabs.logansquare.annotation.JsonObject;
import com.nextcloud.talk.api.models.json.generic.GenericOCS;
import com.nextcloud.talk.models.json.generic.GenericOCS;
import java.util.List;

View file

@ -18,7 +18,7 @@
* You should have received a copy of the GNU General Public License
* along with this program. If not, see <http://www.gnu.org/licenses/>.
*/
package com.nextcloud.talk.api.models.json.participants;
package com.nextcloud.talk.models.json.participants;
import com.bluelinelabs.logansquare.annotation.JsonField;
import com.bluelinelabs.logansquare.annotation.JsonObject;

View file

@ -18,7 +18,7 @@
* along with this program. If not, see <http://www.gnu.org/licenses/>.
*/
package com.nextcloud.talk.api.models.json.push;
package com.nextcloud.talk.models.json.push;
import com.bluelinelabs.logansquare.annotation.JsonField;
import com.bluelinelabs.logansquare.annotation.JsonObject;

View file

@ -18,7 +18,7 @@
* along with this program. If not, see <http://www.gnu.org/licenses/>.
*/
package com.nextcloud.talk.api.models.json.push;
package com.nextcloud.talk.models.json.push;
import com.bluelinelabs.logansquare.annotation.JsonField;
import com.bluelinelabs.logansquare.annotation.JsonObject;

View file

@ -18,7 +18,7 @@
* along with this program. If not, see <http://www.gnu.org/licenses/>.
*/
package com.nextcloud.talk.api.models.json.push;
package com.nextcloud.talk.models.json.push;
import org.parceler.Parcel;

View file

@ -18,7 +18,7 @@
* along with this program. If not, see <http://www.gnu.org/licenses/>.
*/
package com.nextcloud.talk.api.models.json.push;
package com.nextcloud.talk.models.json.push;
import com.bluelinelabs.logansquare.annotation.JsonField;

View file

@ -18,11 +18,11 @@
* along with this program. If not, see <http://www.gnu.org/licenses/>.
*/
package com.nextcloud.talk.api.models.json.push;
package com.nextcloud.talk.models.json.push;
import com.bluelinelabs.logansquare.annotation.JsonField;
import com.bluelinelabs.logansquare.annotation.JsonObject;
import com.nextcloud.talk.api.models.json.generic.GenericOCS;
import com.nextcloud.talk.models.json.generic.GenericOCS;
import org.parceler.Parcel;

View file

@ -18,7 +18,7 @@
* along with this program. If not, see <http://www.gnu.org/licenses/>.
*/
package com.nextcloud.talk.api.models.json.push;
package com.nextcloud.talk.models.json.push;
import com.bluelinelabs.logansquare.annotation.JsonField;
import com.bluelinelabs.logansquare.annotation.JsonObject;

View file

@ -18,13 +18,13 @@
* You should have received a copy of the GNU General Public License
* along with this program. If not, see <http://www.gnu.org/licenses/>.
*/
package com.nextcloud.talk.api.models.json.rooms;
package com.nextcloud.talk.models.json.rooms;
import com.bluelinelabs.logansquare.annotation.JsonField;
import com.bluelinelabs.logansquare.annotation.JsonObject;
import com.nextcloud.talk.api.models.json.converters.EnumParticipantTypeConverter;
import com.nextcloud.talk.api.models.json.converters.EnumRoomTypeConverter;
import com.nextcloud.talk.api.models.json.participants.Participant;
import com.nextcloud.talk.models.json.converters.EnumParticipantTypeConverter;
import com.nextcloud.talk.models.json.converters.EnumRoomTypeConverter;
import com.nextcloud.talk.models.json.participants.Participant;
import org.parceler.Parcel;

View file

@ -18,11 +18,11 @@
* You should have received a copy of the GNU General Public License
* along with this program. If not, see <http://www.gnu.org/licenses/>.
*/
package com.nextcloud.talk.api.models.json.rooms;
package com.nextcloud.talk.models.json.rooms;
import com.bluelinelabs.logansquare.annotation.JsonField;
import com.bluelinelabs.logansquare.annotation.JsonObject;
import com.nextcloud.talk.api.models.json.generic.GenericOCS;
import com.nextcloud.talk.models.json.generic.GenericOCS;
import lombok.Data;

View file

@ -18,7 +18,7 @@
* You should have received a copy of the GNU General Public License
* along with this program. If not, see <http://www.gnu.org/licenses/>.
*/
package com.nextcloud.talk.api.models.json.rooms;
package com.nextcloud.talk.models.json.rooms;
import com.bluelinelabs.logansquare.annotation.JsonField;
import com.bluelinelabs.logansquare.annotation.JsonObject;

View file

@ -18,11 +18,11 @@
* You should have received a copy of the GNU General Public License
* along with this program. If not, see <http://www.gnu.org/licenses/>.
*/
package com.nextcloud.talk.api.models.json.rooms;
package com.nextcloud.talk.models.json.rooms;
import com.bluelinelabs.logansquare.annotation.JsonField;
import com.bluelinelabs.logansquare.annotation.JsonObject;
import com.nextcloud.talk.api.models.json.generic.GenericOCS;
import com.nextcloud.talk.models.json.generic.GenericOCS;
import org.parceler.Parcel;

View file

@ -18,7 +18,7 @@
* You should have received a copy of the GNU General Public License
* along with this program. If not, see <http://www.gnu.org/licenses/>.
*/
package com.nextcloud.talk.api.models.json.rooms;
package com.nextcloud.talk.models.json.rooms;
import com.bluelinelabs.logansquare.annotation.JsonField;
import com.bluelinelabs.logansquare.annotation.JsonObject;

View file

@ -18,7 +18,7 @@
* You should have received a copy of the GNU General Public License
* along with this program. If not, see <http://www.gnu.org/licenses/>.
*/
package com.nextcloud.talk.api.models.json.sharees;
package com.nextcloud.talk.models.json.sharees;
import com.bluelinelabs.logansquare.annotation.JsonField;
import com.bluelinelabs.logansquare.annotation.JsonObject;

View file

@ -18,7 +18,7 @@
* You should have received a copy of the GNU General Public License
* along with this program. If not, see <http://www.gnu.org/licenses/>.
*/
package com.nextcloud.talk.api.models.json.sharees;
package com.nextcloud.talk.models.json.sharees;
import com.bluelinelabs.logansquare.annotation.JsonField;
import com.bluelinelabs.logansquare.annotation.JsonObject;

View file

@ -18,11 +18,11 @@
* You should have received a copy of the GNU General Public License
* along with this program. If not, see <http://www.gnu.org/licenses/>.
*/
package com.nextcloud.talk.api.models.json.sharees;
package com.nextcloud.talk.models.json.sharees;
import com.bluelinelabs.logansquare.annotation.JsonField;
import com.bluelinelabs.logansquare.annotation.JsonObject;
import com.nextcloud.talk.api.models.json.generic.GenericOCS;
import com.nextcloud.talk.models.json.generic.GenericOCS;
import org.parceler.Parcel;

View file

@ -18,7 +18,7 @@
* You should have received a copy of the GNU General Public License
* along with this program. If not, see <http://www.gnu.org/licenses/>.
*/
package com.nextcloud.talk.api.models.json.sharees;
package com.nextcloud.talk.models.json.sharees;
import com.bluelinelabs.logansquare.annotation.JsonField;
import com.bluelinelabs.logansquare.annotation.JsonObject;

View file

@ -18,7 +18,7 @@
* You should have received a copy of the GNU General Public License
* along with this program. If not, see <http://www.gnu.org/licenses/>.
*/
package com.nextcloud.talk.api.models.json.sharees;
package com.nextcloud.talk.models.json.sharees;
import com.bluelinelabs.logansquare.annotation.JsonField;
import com.bluelinelabs.logansquare.annotation.JsonObject;

View file

@ -18,7 +18,7 @@
* You should have received a copy of the GNU General Public License
* along with this program. If not, see <http://www.gnu.org/licenses/>.
*/
package com.nextcloud.talk.api.models.json.sharees;
package com.nextcloud.talk.models.json.sharees;
import com.bluelinelabs.logansquare.annotation.JsonField;
import com.bluelinelabs.logansquare.annotation.JsonObject;

View file

@ -18,7 +18,7 @@
* along with this program. If not, see <http://www.gnu.org/licenses/>.
*/
package com.nextcloud.talk.api.models.json.signaling;
package com.nextcloud.talk.models.json.signaling;
import com.bluelinelabs.logansquare.annotation.JsonField;
import com.bluelinelabs.logansquare.annotation.JsonObject;

View file

@ -18,7 +18,7 @@
* along with this program. If not, see <http://www.gnu.org/licenses/>.
*/
package com.nextcloud.talk.api.models.json.signaling;
package com.nextcloud.talk.models.json.signaling;
import com.bluelinelabs.logansquare.annotation.JsonField;
import com.bluelinelabs.logansquare.annotation.JsonObject;

View file

@ -18,7 +18,7 @@
* along with this program. If not, see <http://www.gnu.org/licenses/>.
*/
package com.nextcloud.talk.api.models.json.signaling;
package com.nextcloud.talk.models.json.signaling;
import com.bluelinelabs.logansquare.annotation.JsonField;
import com.bluelinelabs.logansquare.annotation.JsonObject;

View file

@ -18,7 +18,7 @@
* along with this program. If not, see <http://www.gnu.org/licenses/>.
*/
package com.nextcloud.talk.api.models.json.signaling;
package com.nextcloud.talk.models.json.signaling;
import com.bluelinelabs.logansquare.annotation.JsonField;
import com.bluelinelabs.logansquare.annotation.JsonObject;

View file

@ -18,7 +18,7 @@
* along with this program. If not, see <http://www.gnu.org/licenses/>.
*/
package com.nextcloud.talk.api.models.json.signaling;
package com.nextcloud.talk.models.json.signaling;
import com.bluelinelabs.logansquare.annotation.JsonField;
import com.bluelinelabs.logansquare.annotation.JsonObject;

View file

@ -18,7 +18,7 @@
* along with this program. If not, see <http://www.gnu.org/licenses/>.
*/
package com.nextcloud.talk.api.models.json.signaling;
package com.nextcloud.talk.models.json.signaling;
import com.bluelinelabs.logansquare.annotation.JsonField;
import com.bluelinelabs.logansquare.annotation.JsonObject;

View file

@ -18,11 +18,11 @@
* along with this program. If not, see <http://www.gnu.org/licenses/>.
*/
package com.nextcloud.talk.api.models.json.signaling;
package com.nextcloud.talk.models.json.signaling;
import com.bluelinelabs.logansquare.annotation.JsonField;
import com.bluelinelabs.logansquare.annotation.JsonObject;
import com.nextcloud.talk.api.models.json.generic.GenericOCS;
import com.nextcloud.talk.models.json.generic.GenericOCS;
import java.util.List;

View file

@ -18,7 +18,7 @@
* along with this program. If not, see <http://www.gnu.org/licenses/>.
*/
package com.nextcloud.talk.api.models.json.signaling;
package com.nextcloud.talk.models.json.signaling;
import com.bluelinelabs.logansquare.annotation.JsonField;
import com.bluelinelabs.logansquare.annotation.JsonObject;

View file

@ -18,7 +18,7 @@
* along with this program. If not, see <http://www.gnu.org/licenses/>.
*/
package com.nextcloud.talk.api.models.json.signaling.settings;
package com.nextcloud.talk.models.json.signaling.settings;
import com.bluelinelabs.logansquare.annotation.JsonField;
import com.bluelinelabs.logansquare.annotation.JsonObject;

View file

@ -18,7 +18,7 @@
* along with this program. If not, see <http://www.gnu.org/licenses/>.
*/
package com.nextcloud.talk.api.models.json.signaling.settings;
package com.nextcloud.talk.models.json.signaling.settings;
import com.bluelinelabs.logansquare.annotation.JsonField;
import com.bluelinelabs.logansquare.annotation.JsonObject;

View file

@ -18,11 +18,11 @@
* along with this program. If not, see <http://www.gnu.org/licenses/>.
*/
package com.nextcloud.talk.api.models.json.signaling.settings;
package com.nextcloud.talk.models.json.signaling.settings;
import com.bluelinelabs.logansquare.annotation.JsonField;
import com.bluelinelabs.logansquare.annotation.JsonObject;
import com.nextcloud.talk.api.models.json.generic.GenericOCS;
import com.nextcloud.talk.models.json.generic.GenericOCS;
import lombok.Data;

View file

@ -18,7 +18,7 @@
* along with this program. If not, see <http://www.gnu.org/licenses/>.
*/
package com.nextcloud.talk.api.models.json.signaling.settings;
package com.nextcloud.talk.models.json.signaling.settings;
import com.bluelinelabs.logansquare.annotation.JsonField;
import com.bluelinelabs.logansquare.annotation.JsonObject;

View file

@ -18,7 +18,7 @@
* You should have received a copy of the GNU General Public License
* along with this program. If not, see <http://www.gnu.org/licenses/>.
*/
package com.nextcloud.talk.api.models.json.userprofile;
package com.nextcloud.talk.models.json.userprofile;
import com.bluelinelabs.logansquare.annotation.JsonField;
import com.bluelinelabs.logansquare.annotation.JsonObject;

View file

@ -18,11 +18,11 @@
* You should have received a copy of the GNU General Public License
* along with this program. If not, see <http://www.gnu.org/licenses/>.
*/
package com.nextcloud.talk.api.models.json.userprofile;
package com.nextcloud.talk.models.json.userprofile;
import com.bluelinelabs.logansquare.annotation.JsonField;
import com.bluelinelabs.logansquare.annotation.JsonObject;
import com.nextcloud.talk.api.models.json.generic.GenericOCS;
import com.nextcloud.talk.models.json.generic.GenericOCS;
import org.parceler.Parcel;

View file

@ -18,7 +18,7 @@
* You should have received a copy of the GNU General Public License
* along with this program. If not, see <http://www.gnu.org/licenses/>.
*/
package com.nextcloud.talk.api.models.json.userprofile;
package com.nextcloud.talk.models.json.userprofile;
import com.bluelinelabs.logansquare.annotation.JsonField;
import com.bluelinelabs.logansquare.annotation.JsonObject;

View file

@ -1,53 +0,0 @@
/*
*
* Nextcloud Talk application
*
* @author Mario Danic
* Copyright (C) 2017 Mario Danic (mario@lovelyhq.com)
*
* This program is free software: you can redistribute it and/or modify
* it under the terms of the GNU General Public License as published by
* the Free Software Foundation, either version 3 of the License, or
* at your option) any later version.
*
* This program is distributed in the hope that it will be useful,
* but WITHOUT ANY WARRANTY; without even the implied warranty of
* MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
* GNU General Public License for more details.
*
* You should have received a copy of the GNU General Public License
* along with this program. If not, see <http://www.gnu.org/licenses/>.
*/
package com.nextcloud.talk.persistence.entities;
import android.os.Parcelable;
import java.io.Serializable;
import io.requery.Entity;
import io.requery.Generated;
import io.requery.Key;
import io.requery.Persistable;
@Entity
public interface User extends Parcelable, Persistable, Serializable {
@Key
@Generated
long getId();
String getUserId();
String getUsername();
String getBaseUrl();
String getToken();
String getDisplayName();
String getPushConfigurationState();
boolean getCurrent();
boolean getScheduledForDeletion();
}

View file

@ -40,8 +40,8 @@ import com.google.firebase.messaging.FirebaseMessagingService;
import com.google.firebase.messaging.RemoteMessage;
import com.nextcloud.talk.R;
import com.nextcloud.talk.activities.CallActivity;
import com.nextcloud.talk.api.models.json.push.DecryptedPushMessage;
import com.nextcloud.talk.api.models.json.push.PushMessage;
import com.nextcloud.talk.models.json.push.DecryptedPushMessage;
import com.nextcloud.talk.models.json.push.PushMessage;
import com.nextcloud.talk.models.SignatureVerification;
import com.nextcloud.talk.utils.NotificationUtils;
import com.nextcloud.talk.utils.PushUtils;

View file

@ -2,7 +2,7 @@
* Nextcloud Talk application
*
* @author Mario Danic
* Copyright (C) 2017 Mario Danic (mario@lovelyhq.com)
* Copyright (C) 2017-2018 Mario Danic <mario@lovelyhq.com>
*
* This program is free software: you can redistribute it and/or modify
* it under the terms of the GNU General Public License as published by
@ -17,7 +17,7 @@
* You should have received a copy of the GNU General Public License
* along with this program. If not, see <http://www.gnu.org/licenses/>.
*/
package com.nextcloud.talk.api.helpers.api;
package com.nextcloud.talk.utils;
import android.net.Uri;
@ -31,7 +31,7 @@ import java.util.Map;
import okhttp3.Credentials;
public class ApiHelper {
public class ApiUtils {
private static String ocsApiVersion = "/ocs/v2.php";
private static String spreedApiVersion = "/apps/spreed/api/v1";

View file

@ -28,8 +28,7 @@ import android.util.Log;
import com.bluelinelabs.logansquare.LoganSquare;
import com.nextcloud.talk.R;
import com.nextcloud.talk.api.NcApi;
import com.nextcloud.talk.api.helpers.api.ApiHelper;
import com.nextcloud.talk.api.models.json.push.PushConfigurationState;
import com.nextcloud.talk.models.json.push.PushConfigurationState;
import com.nextcloud.talk.application.NextcloudTalkApplication;
import com.nextcloud.talk.models.SignatureVerification;
import com.nextcloud.talk.persistence.entities.UserEntity;
@ -265,8 +264,8 @@ public class PushUtils {
JavaNetCookieJar(new CookieManager())).build()).build().create(NcApi.class);
ncApi.registerDeviceForNotificationsWithNextcloud(
ApiHelper.getCredentials(userEntity.getUsername(), userEntity.getToken()),
ApiHelper.getUrlNextcloudPush(userEntity.getBaseUrl()), queryMap)
ApiUtils.getCredentials(userEntity.getUsername(), userEntity.getToken()),
ApiUtils.getUrlNextcloudPush(userEntity.getBaseUrl()), queryMap)
.subscribeOn(Schedulers.newThread())
.subscribe(pushRegistrationOverall -> {
Map<String, String> proxyMap = new HashMap<>();
@ -279,9 +278,9 @@ public class PushUtils {
.getData().getPublicKey());
ncApi.registerDeviceForNotificationsWithProxy(ApiHelper.getCredentials
ncApi.registerDeviceForNotificationsWithProxy(ApiUtils.getCredentials
(userEntity.getUsername(), userEntity.getToken()),
ApiHelper.getUrlPushProxy(), proxyMap)
ApiUtils.getUrlPushProxy(), proxyMap)
.subscribeOn(Schedulers.newThread())
.subscribe(new Consumer<Void>() {
@Override

View file

@ -33,7 +33,7 @@ import android.text.TextUtils;
import com.kennyc.bottomsheet.adapters.AppAdapter;
import com.nextcloud.talk.R;
import com.nextcloud.talk.api.models.json.rooms.Room;
import com.nextcloud.talk.models.json.rooms.Room;
import com.nextcloud.talk.persistence.entities.UserEntity;
import com.nextcloud.talk.utils.database.user.UserUtils;

View file

@ -23,7 +23,7 @@ package com.nextcloud.talk.utils.database.user;
import android.support.annotation.Nullable;
import android.text.TextUtils;
import com.nextcloud.talk.persistence.entities.User;
import com.nextcloud.talk.models.database.User;
import com.nextcloud.talk.persistence.entities.UserEntity;
import java.util.List;

View file

@ -26,8 +26,8 @@ import android.util.Log;
import com.bluelinelabs.logansquare.LoganSquare;
import com.nextcloud.talk.R;
import com.nextcloud.talk.api.models.json.signaling.DataChannelMessage;
import com.nextcloud.talk.api.models.json.signaling.NCIceCandidate;
import com.nextcloud.talk.models.json.signaling.DataChannelMessage;
import com.nextcloud.talk.models.json.signaling.NCIceCandidate;
import com.nextcloud.talk.application.NextcloudTalkApplication;
import com.nextcloud.talk.events.MediaStreamEvent;
import com.nextcloud.talk.events.PeerConnectionEvent;