Fix subscription thread

Signed-off-by: Mario Danic <mario@lovelyhq.com>
This commit is contained in:
Mario Danic 2019-04-29 09:18:36 +02:00 committed by Mario Đanić
parent e2fe9a61af
commit 550b46c454
20 changed files with 63 additions and 63 deletions

View file

@ -47,7 +47,7 @@ public class DavListing extends ListingAbstractClass {
public ReadFilesystemOperation call() { public ReadFilesystemOperation call() {
return new ReadFilesystemOperation(okHttpClient, currentUser, path, 1); return new ReadFilesystemOperation(okHttpClient, currentUser, path, 1);
} }
}).subscribeOn(Schedulers.newThread()) }).subscribeOn(Schedulers.io())
.subscribe(new SingleObserver<ReadFilesystemOperation>() { .subscribe(new SingleObserver<ReadFilesystemOperation>() {
@Override @Override
public void onSubscribe(Disposable d) { public void onSubscribe(Disposable d) {

View file

@ -176,7 +176,7 @@ public class AccountVerificationController extends BaseController {
} }
ncApi.getServerStatus(queryUrl) ncApi.getServerStatus(queryUrl)
.subscribeOn(Schedulers.newThread()) .subscribeOn(Schedulers.io())
.observeOn(AndroidSchedulers.mainThread()) .observeOn(AndroidSchedulers.mainThread())
.subscribe(new Observer<Status>() { .subscribe(new Observer<Status>() {
@Override @Override
@ -220,7 +220,7 @@ public class AccountVerificationController extends BaseController {
private void findServerTalkApp(String credentials) { private void findServerTalkApp(String credentials) {
ncApi.getRooms(credentials, ApiUtils.getUrlForGetRooms(baseUrl)) ncApi.getRooms(credentials, ApiUtils.getUrlForGetRooms(baseUrl))
.subscribeOn(Schedulers.newThread()) .subscribeOn(Schedulers.io())
.subscribe(new Observer<RoomsOverall>() { .subscribe(new Observer<RoomsOverall>() {
@Override @Override
public void onSubscribe(Disposable d) { public void onSubscribe(Disposable d) {
@ -257,7 +257,7 @@ public class AccountVerificationController extends BaseController {
baseUrl, displayName, null, true, baseUrl, displayName, null, true,
userId, null, null, userId, null, null,
appPreferences.getTemporaryClientCertAlias(), null) appPreferences.getTemporaryClientCertAlias(), null)
.subscribeOn(Schedulers.newThread()) .subscribeOn(Schedulers.io())
.subscribe(new Observer<UserEntity>() { .subscribe(new Observer<UserEntity>() {
@Override @Override
public void onSubscribe(Disposable d) { public void onSubscribe(Disposable d) {
@ -297,7 +297,7 @@ public class AccountVerificationController extends BaseController {
private void fetchProfile(String credentials) { private void fetchProfile(String credentials) {
ncApi.getUserProfile(credentials, ncApi.getUserProfile(credentials,
ApiUtils.getUrlForUserProfile(baseUrl)) ApiUtils.getUrlForUserProfile(baseUrl))
.subscribeOn(Schedulers.newThread()) .subscribeOn(Schedulers.io())
.subscribe(new Observer<UserProfileOverall>() { .subscribe(new Observer<UserProfileOverall>() {
@Override @Override
public void onSubscribe(Disposable d) { public void onSubscribe(Disposable d) {

View file

@ -340,7 +340,7 @@ public class CallController extends BaseController {
private void handleFromNotification() { private void handleFromNotification() {
ncApi.getRooms(credentials, ApiUtils.getUrlForGetRooms(baseUrl)) ncApi.getRooms(credentials, ApiUtils.getUrlForGetRooms(baseUrl))
.retry(3) .retry(3)
.subscribeOn(Schedulers.newThread()) .subscribeOn(Schedulers.io())
.observeOn(AndroidSchedulers.mainThread()) .observeOn(AndroidSchedulers.mainThread())
.subscribe(new Observer<RoomsOverall>() { .subscribe(new Observer<RoomsOverall>() {
@Override @Override
@ -863,7 +863,7 @@ public class CallController extends BaseController {
leavingCall = false; leavingCall = false;
ncApi.getSignalingSettings(credentials, ApiUtils.getUrlForSignalingSettings(baseUrl)) ncApi.getSignalingSettings(credentials, ApiUtils.getUrlForSignalingSettings(baseUrl))
.subscribeOn(Schedulers.newThread()) .subscribeOn(Schedulers.io())
.retry(3) .retry(3)
.observeOn(AndroidSchedulers.mainThread()) .observeOn(AndroidSchedulers.mainThread())
.subscribe(new Observer<SignalingSettingsOverall>() { .subscribe(new Observer<SignalingSettingsOverall>() {
@ -894,7 +894,7 @@ public class CallController extends BaseController {
try { try {
userUtils.createOrUpdateUser(null, null, null, null, null, null, null, userUtils.createOrUpdateUser(null, null, null, null, null, null, null,
conversationUser.getId(), null, null, LoganSquare.serialize(externalSignalingServer)) conversationUser.getId(), null, null, LoganSquare.serialize(externalSignalingServer))
.subscribeOn(Schedulers.newThread()) .subscribeOn(Schedulers.io())
.subscribe(); .subscribe();
} catch (IOException exception) { } catch (IOException exception) {
Log.e(TAG, "Failed to serialize external signaling server"); Log.e(TAG, "Failed to serialize external signaling server");
@ -949,7 +949,7 @@ public class CallController extends BaseController {
private void checkCapabilities() { private void checkCapabilities() {
ncApi.getCapabilities(credentials, ApiUtils.getUrlForCapabilities(baseUrl)) ncApi.getCapabilities(credentials, ApiUtils.getUrlForCapabilities(baseUrl))
.retry(3) .retry(3)
.subscribeOn(Schedulers.newThread()) .subscribeOn(Schedulers.io())
.observeOn(AndroidSchedulers.mainThread()) .observeOn(AndroidSchedulers.mainThread())
.subscribe(new Observer<CapabilitiesOverall>() { .subscribe(new Observer<CapabilitiesOverall>() {
@Override @Override
@ -999,7 +999,7 @@ public class CallController extends BaseController {
private void joinRoomAndCall() { private void joinRoomAndCall() {
ncApi.joinRoom(credentials, ApiUtils.getUrlForSettingMyselfAsActiveParticipant(baseUrl, ncApi.joinRoom(credentials, ApiUtils.getUrlForSettingMyselfAsActiveParticipant(baseUrl,
roomToken), conversationPassword) roomToken), conversationPassword)
.subscribeOn(Schedulers.newThread()) .subscribeOn(Schedulers.io())
.observeOn(AndroidSchedulers.mainThread()) .observeOn(AndroidSchedulers.mainThread())
.retry(3) .retry(3)
.subscribe(new Observer<CallOverall>() { .subscribe(new Observer<CallOverall>() {
@ -1041,7 +1041,7 @@ public class CallController extends BaseController {
private void performCall() { private void performCall() {
ncApi.joinCall(credentials, ncApi.joinCall(credentials,
ApiUtils.getUrlForCall(baseUrl, roomToken)) ApiUtils.getUrlForCall(baseUrl, roomToken))
.subscribeOn(Schedulers.newThread()) .subscribeOn(Schedulers.io())
.retry(3) .retry(3)
.observeOn(AndroidSchedulers.mainThread()) .observeOn(AndroidSchedulers.mainThread())
.subscribe(new Observer<GenericOverall>() { .subscribe(new Observer<GenericOverall>() {
@ -1070,7 +1070,7 @@ public class CallController extends BaseController {
if (needsPing) { if (needsPing) {
ncApi.pingCall(credentials, ApiUtils.getUrlForCallPing(baseUrl, roomToken)) ncApi.pingCall(credentials, ApiUtils.getUrlForCallPing(baseUrl, roomToken))
.subscribeOn(Schedulers.newThread()) .subscribeOn(Schedulers.io())
.observeOn(AndroidSchedulers.mainThread()) .observeOn(AndroidSchedulers.mainThread())
.repeatWhen(observable -> observable.delay(5000, TimeUnit.MILLISECONDS)) .repeatWhen(observable -> observable.delay(5000, TimeUnit.MILLISECONDS))
.takeWhile(observable -> inCall) .takeWhile(observable -> inCall)
@ -1108,7 +1108,7 @@ public class CallController extends BaseController {
if (!hasExternalSignalingServer) { if (!hasExternalSignalingServer) {
ncApi.pullSignalingMessages(credentials, ApiUtils.getUrlForSignaling(baseUrl, urlToken)) ncApi.pullSignalingMessages(credentials, ApiUtils.getUrlForSignaling(baseUrl, urlToken))
.subscribeOn(Schedulers.newThread()) .subscribeOn(Schedulers.io())
.observeOn(AndroidSchedulers.mainThread()) .observeOn(AndroidSchedulers.mainThread())
.repeatWhen(observable -> observable) .repeatWhen(observable -> observable)
.takeWhile(observable -> inCall) .takeWhile(observable -> inCall)
@ -1358,7 +1358,7 @@ public class CallController extends BaseController {
private void hangupNetworkCalls() { private void hangupNetworkCalls() {
ncApi.leaveCall(credentials, ApiUtils.getUrlForCall(baseUrl, roomToken)) ncApi.leaveCall(credentials, ApiUtils.getUrlForCall(baseUrl, roomToken))
.subscribeOn(Schedulers.newThread()) .subscribeOn(Schedulers.io())
.observeOn(AndroidSchedulers.mainThread()) .observeOn(AndroidSchedulers.mainThread())
.subscribe(new Observer<GenericOverall>() { .subscribe(new Observer<GenericOverall>() {
@Override @Override
@ -1395,7 +1395,7 @@ public class CallController extends BaseController {
private void leaveRoom() { private void leaveRoom() {
ncApi.leaveRoom(credentials, ApiUtils.getUrlForSettingMyselfAsActiveParticipant(baseUrl, roomToken)) ncApi.leaveRoom(credentials, ApiUtils.getUrlForSettingMyselfAsActiveParticipant(baseUrl, roomToken))
.subscribeOn(Schedulers.newThread()) .subscribeOn(Schedulers.io())
.observeOn(AndroidSchedulers.mainThread()) .observeOn(AndroidSchedulers.mainThread())
.subscribe(new Observer<GenericOverall>() { .subscribe(new Observer<GenericOverall>() {
@Override @Override
@ -1483,7 +1483,7 @@ public class CallController extends BaseController {
private void getPeersForCall() { private void getPeersForCall() {
ncApi.getPeersForCall(credentials, ApiUtils.getUrlForCall(baseUrl, roomToken)) ncApi.getPeersForCall(credentials, ApiUtils.getUrlForCall(baseUrl, roomToken))
.subscribeOn(Schedulers.newThread()) .subscribeOn(Schedulers.io())
.subscribe(new Observer<ParticipantsOverall>() { .subscribe(new Observer<ParticipantsOverall>() {
@Override @Override
public void onSubscribe(Disposable d) { public void onSubscribe(Disposable d) {
@ -1675,7 +1675,7 @@ public class CallController extends BaseController {
Observable Observable
.interval(1, TimeUnit.SECONDS) .interval(1, TimeUnit.SECONDS)
.takeWhile(observer -> inCall) .takeWhile(observer -> inCall)
.observeOn(Schedulers.newThread()) .observeOn(Schedulers.io())
.doOnNext(n -> magicPeerConnectionWrapperList.get(finalI).sendChannelData(dataChannelMessage)); .doOnNext(n -> magicPeerConnectionWrapperList.get(finalI).sendChannelData(dataChannelMessage));
break; break;
} }
@ -1743,7 +1743,7 @@ public class CallController extends BaseController {
ncApi.sendSignalingMessages(credentials, ApiUtils.getUrlForSignaling(baseUrl, urlToken), ncApi.sendSignalingMessages(credentials, ApiUtils.getUrlForSignaling(baseUrl, urlToken),
strings.toString()) strings.toString())
.retry(3) .retry(3)
.subscribeOn(Schedulers.newThread()) .subscribeOn(Schedulers.io())
.subscribe(new Observer<SignalingOverall>() { .subscribe(new Observer<SignalingOverall>() {
@Override @Override
public void onSubscribe(Disposable d) { public void onSubscribe(Disposable d) {

View file

@ -197,7 +197,7 @@ public class CallNotificationController extends BaseController {
private void checkIfAnyParticipantsRemainInRoom() { private void checkIfAnyParticipantsRemainInRoom() {
ncApi.getPeersForCall(credentials, ApiUtils.getUrlForParticipants(userBeingCalled.getBaseUrl(), ncApi.getPeersForCall(credentials, ApiUtils.getUrlForParticipants(userBeingCalled.getBaseUrl(),
currentConversation.getToken())) currentConversation.getToken()))
.subscribeOn(Schedulers.newThread()) .subscribeOn(Schedulers.io())
.takeWhile(observable -> !leavingScreen) .takeWhile(observable -> !leavingScreen)
.retry(3) .retry(3)
.subscribe(new Observer<ParticipantsOverall>() { .subscribe(new Observer<ParticipantsOverall>() {
@ -246,7 +246,7 @@ public class CallNotificationController extends BaseController {
private void handleFromNotification() { private void handleFromNotification() {
ncApi.getRooms(credentials, ApiUtils.getUrlForGetRooms(userBeingCalled.getBaseUrl())) ncApi.getRooms(credentials, ApiUtils.getUrlForGetRooms(userBeingCalled.getBaseUrl()))
.subscribeOn(Schedulers.newThread()) .subscribeOn(Schedulers.io())
.retry(3) .retry(3)
.observeOn(AndroidSchedulers.mainThread()) .observeOn(AndroidSchedulers.mainThread())
.subscribe(new Observer<RoomsOverall>() { .subscribe(new Observer<RoomsOverall>() {

View file

@ -213,7 +213,7 @@ public class ChatController extends BaseController implements MessagesListAdapte
private void getRoomInfo() { private void getRoomInfo() {
ncApi.getRoom(credentials, ApiUtils.getRoom(conversationUser.getBaseUrl(), roomToken)) ncApi.getRoom(credentials, ApiUtils.getRoom(conversationUser.getBaseUrl(), roomToken))
.subscribeOn(Schedulers.newThread()) .subscribeOn(Schedulers.io())
.observeOn(AndroidSchedulers.mainThread()) .observeOn(AndroidSchedulers.mainThread())
.subscribe(new Observer<RoomOverall>() { .subscribe(new Observer<RoomOverall>() {
@Override @Override
@ -246,7 +246,7 @@ public class ChatController extends BaseController implements MessagesListAdapte
private void handleFromNotification() { private void handleFromNotification() {
ncApi.getRooms(credentials, ApiUtils.getUrlForGetRooms(conversationUser.getBaseUrl())) ncApi.getRooms(credentials, ApiUtils.getUrlForGetRooms(conversationUser.getBaseUrl()))
.subscribeOn(Schedulers.newThread()) .subscribeOn(Schedulers.io())
.observeOn(AndroidSchedulers.mainThread()) .observeOn(AndroidSchedulers.mainThread())
.subscribe(new Observer<RoomsOverall>() { .subscribe(new Observer<RoomsOverall>() {
@Override @Override
@ -621,7 +621,7 @@ public class ChatController extends BaseController implements MessagesListAdapte
private void startPing() { private void startPing() {
if (!conversationUser.hasSpreedCapabilityWithName("no-ping")) { if (!conversationUser.hasSpreedCapabilityWithName("no-ping")) {
ncApi.pingCall(credentials, ApiUtils.getUrlForCallPing(conversationUser.getBaseUrl(), roomToken)) ncApi.pingCall(credentials, ApiUtils.getUrlForCallPing(conversationUser.getBaseUrl(), roomToken))
.subscribeOn(Schedulers.newThread()) .subscribeOn(Schedulers.io())
.observeOn(AndroidSchedulers.mainThread()) .observeOn(AndroidSchedulers.mainThread())
.repeatWhen(observable -> observable.delay(5000, TimeUnit.MILLISECONDS)) .repeatWhen(observable -> observable.delay(5000, TimeUnit.MILLISECONDS))
.takeWhile(observable -> inChat) .takeWhile(observable -> inChat)
@ -666,7 +666,7 @@ public class ChatController extends BaseController implements MessagesListAdapte
if (currentCall == null) { if (currentCall == null) {
ncApi.joinRoom(credentials, ncApi.joinRoom(credentials,
ApiUtils.getUrlForSettingMyselfAsActiveParticipant(conversationUser.getBaseUrl(), roomToken), roomPassword) ApiUtils.getUrlForSettingMyselfAsActiveParticipant(conversationUser.getBaseUrl(), roomToken), roomPassword)
.subscribeOn(Schedulers.newThread()) .subscribeOn(Schedulers.io())
.observeOn(AndroidSchedulers.mainThread()) .observeOn(AndroidSchedulers.mainThread())
.retry(3) .retry(3)
.subscribe(new Observer<CallOverall>() { .subscribe(new Observer<CallOverall>() {
@ -719,7 +719,7 @@ public class ChatController extends BaseController implements MessagesListAdapte
ncApi.leaveRoom(credentials, ncApi.leaveRoom(credentials,
ApiUtils.getUrlForSettingMyselfAsActiveParticipant(conversationUser.getBaseUrl(), ApiUtils.getUrlForSettingMyselfAsActiveParticipant(conversationUser.getBaseUrl(),
roomToken)) roomToken))
.subscribeOn(Schedulers.newThread()) .subscribeOn(Schedulers.io())
.observeOn(AndroidSchedulers.mainThread()) .observeOn(AndroidSchedulers.mainThread())
.subscribe(new Observer<GenericOverall>() { .subscribe(new Observer<GenericOverall>() {
@Override @Override
@ -777,7 +777,7 @@ public class ChatController extends BaseController implements MessagesListAdapte
ncApi.sendChatMessage(credentials, ApiUtils.getUrlForChat(conversationUser.getBaseUrl(), roomToken), ncApi.sendChatMessage(credentials, ApiUtils.getUrlForChat(conversationUser.getBaseUrl(), roomToken),
message, conversationUser message, conversationUser
.getDisplayName()) .getDisplayName())
.subscribeOn(Schedulers.newThread()) .subscribeOn(Schedulers.io())
.observeOn(AndroidSchedulers.mainThread()) .observeOn(AndroidSchedulers.mainThread())
.subscribe(new Observer<GenericOverall>() { .subscribe(new Observer<GenericOverall>() {
@Override @Override
@ -850,7 +850,7 @@ public class ChatController extends BaseController implements MessagesListAdapte
ncApi.pullChatMessages(credentials, ApiUtils.getUrlForChat(conversationUser.getBaseUrl(), ncApi.pullChatMessages(credentials, ApiUtils.getUrlForChat(conversationUser.getBaseUrl(),
roomToken), roomToken),
fieldMap) fieldMap)
.subscribeOn(Schedulers.newThread()) .subscribeOn(Schedulers.io())
.observeOn(AndroidSchedulers.mainThread()) .observeOn(AndroidSchedulers.mainThread())
.takeWhile(observable -> inChat && !wasDetached) .takeWhile(observable -> inChat && !wasDetached)
.retry(3, observable -> inChat && !wasDetached) .retry(3, observable -> inChat && !wasDetached)
@ -879,7 +879,7 @@ public class ChatController extends BaseController implements MessagesListAdapte
} else { } else {
ncApi.pullChatMessages(credentials, ncApi.pullChatMessages(credentials,
ApiUtils.getUrlForChat(conversationUser.getBaseUrl(), roomToken), fieldMap) ApiUtils.getUrlForChat(conversationUser.getBaseUrl(), roomToken), fieldMap)
.subscribeOn(Schedulers.newThread()) .subscribeOn(Schedulers.io())
.observeOn(AndroidSchedulers.mainThread()) .observeOn(AndroidSchedulers.mainThread())
.retry(3, observable -> inChat && !wasDetached) .retry(3, observable -> inChat && !wasDetached)
.takeWhile(observable -> inChat && !wasDetached) .takeWhile(observable -> inChat && !wasDetached)
@ -1201,7 +1201,7 @@ public class ChatController extends BaseController implements MessagesListAdapte
ncApi.createRoom(credentials, ncApi.createRoom(credentials,
retrofitBucket.getUrl(), retrofitBucket.getQueryMap()) retrofitBucket.getUrl(), retrofitBucket.getQueryMap())
.subscribeOn(Schedulers.newThread()) .subscribeOn(Schedulers.io())
.observeOn(AndroidSchedulers.mainThread()) .observeOn(AndroidSchedulers.mainThread())
.subscribe(new Observer<RoomOverall>() { .subscribe(new Observer<RoomOverall>() {
@Override @Override

View file

@ -253,7 +253,7 @@ public class ContactsController extends BaseController implements SearchView.OnQ
((UserItem) selectedObject).getModel().getUserId(), null); ((UserItem) selectedObject).getModel().getUserId(), null);
ncApi.createRoom(credentials, ncApi.createRoom(credentials,
retrofitBucket.getUrl(), retrofitBucket.getQueryMap()) retrofitBucket.getUrl(), retrofitBucket.getQueryMap())
.subscribeOn(Schedulers.newThread()) .subscribeOn(Schedulers.io())
.observeOn(AndroidSchedulers.mainThread()) .observeOn(AndroidSchedulers.mainThread())
.subscribe(new Observer<RoomOverall>() { .subscribe(new Observer<RoomOverall>() {
@Override @Override
@ -447,7 +447,7 @@ public class ContactsController extends BaseController implements SearchView.OnQ
ncApi.getContactsWithSearchParam( ncApi.getContactsWithSearchParam(
credentials, credentials,
retrofitBucket.getUrl(), shareTypesList, modifiedQueryMap) retrofitBucket.getUrl(), shareTypesList, modifiedQueryMap)
.subscribeOn(Schedulers.newThread()) .subscribeOn(Schedulers.io())
.observeOn(AndroidSchedulers.mainThread()) .observeOn(AndroidSchedulers.mainThread())
.retry(3) .retry(3)
.subscribe(new Observer<ResponseBody>() { .subscribe(new Observer<ResponseBody>() {
@ -865,7 +865,7 @@ public class ContactsController extends BaseController implements SearchView.OnQ
ncApi.createRoom(credentials, ncApi.createRoom(credentials,
retrofitBucket.getUrl(), retrofitBucket.getQueryMap()) retrofitBucket.getUrl(), retrofitBucket.getQueryMap())
.subscribeOn(Schedulers.newThread()) .subscribeOn(Schedulers.io())
.observeOn(AndroidSchedulers.mainThread()) .observeOn(AndroidSchedulers.mainThread())
.subscribe(new Observer<RoomOverall>() { .subscribe(new Observer<RoomOverall>() {
@Override @Override

View file

@ -280,7 +280,7 @@ public class ConversationInfoController extends BaseController {
private void getListOfParticipants() { private void getListOfParticipants() {
ncApi.getPeersForCall(credentials, ApiUtils.getUrlForParticipants(conversationUser.getBaseUrl(), conversationToken)) ncApi.getPeersForCall(credentials, ApiUtils.getUrlForParticipants(conversationUser.getBaseUrl(), conversationToken))
.subscribeOn(Schedulers.newThread()) .subscribeOn(Schedulers.io())
.observeOn(AndroidSchedulers.mainThread()) .observeOn(AndroidSchedulers.mainThread())
.subscribe(new Observer<ParticipantsOverall>() { .subscribe(new Observer<ParticipantsOverall>() {
@Override @Override
@ -351,7 +351,7 @@ public class ConversationInfoController extends BaseController {
private void fetchRoomInfo() { private void fetchRoomInfo() {
ncApi.getRoom(credentials, ApiUtils.getRoom(conversationUser.getBaseUrl(), conversationToken)) ncApi.getRoom(credentials, ApiUtils.getRoom(conversationUser.getBaseUrl(), conversationToken))
.subscribeOn(Schedulers.newThread()) .subscribeOn(Schedulers.io())
.observeOn(AndroidSchedulers.mainThread()) .observeOn(AndroidSchedulers.mainThread())
.subscribe(new Observer<RoomOverall>() { .subscribe(new Observer<RoomOverall>() {
@Override @Override

View file

@ -314,7 +314,7 @@ public class ConversationsListController extends BaseController implements Searc
callItems = new ArrayList<>(); callItems = new ArrayList<>();
roomsQueryDisposable = ncApi.getRooms(credentials, ApiUtils.getUrlForGetRooms(currentUser.getBaseUrl())) roomsQueryDisposable = ncApi.getRooms(credentials, ApiUtils.getUrlForGetRooms(currentUser.getBaseUrl()))
.subscribeOn(Schedulers.newThread()) .subscribeOn(Schedulers.io())
.observeOn(AndroidSchedulers.mainThread()) .observeOn(AndroidSchedulers.mainThread())
.subscribe(roomsOverall -> { .subscribe(roomsOverall -> {

View file

@ -246,7 +246,7 @@ public class ServerSelectionController extends BaseController {
private void checkServer(String queryUrl, boolean checkForcedHttps) { private void checkServer(String queryUrl, boolean checkForcedHttps) {
statusQueryDisposable = ncApi.getServerStatus(queryUrl) statusQueryDisposable = ncApi.getServerStatus(queryUrl)
.subscribeOn(Schedulers.newThread()) .subscribeOn(Schedulers.io())
.observeOn(AndroidSchedulers.mainThread()) .observeOn(AndroidSchedulers.mainThread())
.subscribe(status -> { .subscribe(status -> {
String productName = getResources().getString(R.string.nc_server_product_name); String productName = getResources().getString(R.string.nc_server_product_name);

View file

@ -494,7 +494,7 @@ public class SettingsController extends BaseController {
profileQueryDisposable = ncApi.getUserProfile(credentials, profileQueryDisposable = ncApi.getUserProfile(credentials,
ApiUtils.getUrlForUserProfile(currentUser.getBaseUrl())) ApiUtils.getUrlForUserProfile(currentUser.getBaseUrl()))
.subscribeOn(Schedulers.newThread()) .subscribeOn(Schedulers.io())
.observeOn(AndroidSchedulers.mainThread()) .observeOn(AndroidSchedulers.mainThread())
.subscribe(userProfileOverall -> { .subscribe(userProfileOverall -> {
@ -516,7 +516,7 @@ public class SettingsController extends BaseController {
null, null,
null, displayName, null, null, null, displayName, null, null,
null, currentUser.getId(), null, null, null) null, currentUser.getId(), null, null, null)
.subscribeOn(Schedulers.newThread()) .subscribeOn(Schedulers.io())
.observeOn(AndroidSchedulers.mainThread()) .observeOn(AndroidSchedulers.mainThread())
.subscribe(userEntityResult -> { .subscribe(userEntityResult -> {
displayNameTextView.setText(userEntityResult.getDisplayName()); displayNameTextView.setText(userEntityResult.getDisplayName());

View file

@ -368,7 +368,7 @@ public class WebViewLoginController extends BaseController {
userQueryDisposable = userUtils.createOrUpdateUser(null, loginData.getToken(), userQueryDisposable = userUtils.createOrUpdateUser(null, loginData.getToken(),
null, null, "", true, null, null, "", true,
null, currentUser.getId(), null, appPreferences.getTemporaryClientCertAlias(), null) null, currentUser.getId(), null, appPreferences.getTemporaryClientCertAlias(), null)
.subscribeOn(Schedulers.newThread()) .subscribeOn(Schedulers.io())
.observeOn(AndroidSchedulers.mainThread()) .observeOn(AndroidSchedulers.mainThread())
.subscribe(userEntity -> { .subscribe(userEntity -> {
if (finalMessageType != null) { if (finalMessageType != null) {

View file

@ -191,7 +191,7 @@ public class OperationsMenuController extends BaseController {
case 2: case 2:
ncApi.renameRoom(credentials, ApiUtils.getRoom(currentUser.getBaseUrl(), conversation.getToken()), ncApi.renameRoom(credentials, ApiUtils.getRoom(currentUser.getBaseUrl(), conversation.getToken()),
conversation.getName()) conversation.getName())
.subscribeOn(Schedulers.newThread()) .subscribeOn(Schedulers.io())
.observeOn(AndroidSchedulers.mainThread()) .observeOn(AndroidSchedulers.mainThread())
.retry(1) .retry(1)
.subscribe(operationsObserver); .subscribe(operationsObserver);
@ -199,7 +199,7 @@ public class OperationsMenuController extends BaseController {
case 3: case 3:
ncApi.makeRoomPublic(credentials, ApiUtils.getUrlForRoomVisibility(currentUser.getBaseUrl(), conversation ncApi.makeRoomPublic(credentials, ApiUtils.getUrlForRoomVisibility(currentUser.getBaseUrl(), conversation
.getToken())) .getToken()))
.subscribeOn(Schedulers.newThread()) .subscribeOn(Schedulers.io())
.observeOn(AndroidSchedulers.mainThread()) .observeOn(AndroidSchedulers.mainThread())
.retry(1) .retry(1)
.subscribe(operationsObserver); .subscribe(operationsObserver);
@ -213,7 +213,7 @@ public class OperationsMenuController extends BaseController {
} }
ncApi.setPassword(credentials, ApiUtils.getUrlForPassword(currentUser.getBaseUrl(), ncApi.setPassword(credentials, ApiUtils.getUrlForPassword(currentUser.getBaseUrl(),
conversation.getToken()), pass) conversation.getToken()), pass)
.subscribeOn(Schedulers.newThread()) .subscribeOn(Schedulers.io())
.observeOn(AndroidSchedulers.mainThread()) .observeOn(AndroidSchedulers.mainThread())
.retry(1) .retry(1)
.subscribe(operationsObserver); .subscribe(operationsObserver);
@ -224,14 +224,14 @@ public class OperationsMenuController extends BaseController {
case 8: case 8:
ncApi.makeRoomPrivate(credentials, ApiUtils.getUrlForRoomVisibility(currentUser.getBaseUrl(), conversation ncApi.makeRoomPrivate(credentials, ApiUtils.getUrlForRoomVisibility(currentUser.getBaseUrl(), conversation
.getToken())) .getToken()))
.subscribeOn(Schedulers.newThread()) .subscribeOn(Schedulers.io())
.observeOn(AndroidSchedulers.mainThread()) .observeOn(AndroidSchedulers.mainThread())
.retry(1) .retry(1)
.subscribe(operationsObserver); .subscribe(operationsObserver);
break; break;
case 10: case 10:
ncApi.getRoom(credentials, ApiUtils.getRoom(baseUrl, conversationToken)) ncApi.getRoom(credentials, ApiUtils.getRoom(baseUrl, conversationToken))
.subscribeOn(Schedulers.newThread()) .subscribeOn(Schedulers.io())
.observeOn(AndroidSchedulers.mainThread()) .observeOn(AndroidSchedulers.mainThread())
.retry(1) .retry(1)
.subscribe(new Observer<RoomOverall>() { .subscribe(new Observer<RoomOverall>() {
@ -284,7 +284,7 @@ public class OperationsMenuController extends BaseController {
final boolean isGroupCallWorkaroundFinal = isGroupCallWorkaround; final boolean isGroupCallWorkaroundFinal = isGroupCallWorkaround;
ncApi.createRoom(credentials, retrofitBucket.getUrl(), retrofitBucket.getQueryMap()) ncApi.createRoom(credentials, retrofitBucket.getUrl(), retrofitBucket.getQueryMap())
.subscribeOn(Schedulers.newThread()) .subscribeOn(Schedulers.io())
.observeOn(AndroidSchedulers.mainThread()) .observeOn(AndroidSchedulers.mainThread())
.retry(1) .retry(1)
.subscribe(new Observer<RoomOverall>() { .subscribe(new Observer<RoomOverall>() {
@ -321,14 +321,14 @@ public class OperationsMenuController extends BaseController {
if (operationCode == 97) { if (operationCode == 97) {
ncApi.removeConversationFromFavorites(credentials, ApiUtils.getUrlForConversationFavorites(currentUser.getBaseUrl(), ncApi.removeConversationFromFavorites(credentials, ApiUtils.getUrlForConversationFavorites(currentUser.getBaseUrl(),
conversation.getToken())) conversation.getToken()))
.subscribeOn(Schedulers.newThread()) .subscribeOn(Schedulers.io())
.observeOn(AndroidSchedulers.mainThread()) .observeOn(AndroidSchedulers.mainThread())
.retry(1) .retry(1)
.subscribe(operationsObserver); .subscribe(operationsObserver);
} else { } else {
ncApi.addConversationToFavorites(credentials, ApiUtils.getUrlForConversationFavorites(currentUser.getBaseUrl(), ncApi.addConversationToFavorites(credentials, ApiUtils.getUrlForConversationFavorites(currentUser.getBaseUrl(),
conversation.getToken())) conversation.getToken()))
.subscribeOn(Schedulers.newThread()) .subscribeOn(Schedulers.io())
.observeOn(AndroidSchedulers.mainThread()) .observeOn(AndroidSchedulers.mainThread())
.retry(1) .retry(1)
.subscribe(operationsObserver); .subscribe(operationsObserver);
@ -337,7 +337,7 @@ public class OperationsMenuController extends BaseController {
case 99: case 99:
ncApi.joinRoom(credentials, ApiUtils.getUrlForSettingMyselfAsActiveParticipant(baseUrl, conversationToken), ncApi.joinRoom(credentials, ApiUtils.getUrlForSettingMyselfAsActiveParticipant(baseUrl, conversationToken),
callPassword) callPassword)
.subscribeOn(Schedulers.newThread()) .subscribeOn(Schedulers.io())
.observeOn(AndroidSchedulers.mainThread()) .observeOn(AndroidSchedulers.mainThread())
.retry(1) .retry(1)
.subscribe(operationsObserver); .subscribe(operationsObserver);
@ -350,7 +350,7 @@ public class OperationsMenuController extends BaseController {
private void performGroupCallWorkaround(String credentials) { private void performGroupCallWorkaround(String credentials) {
ncApi.makeRoomPrivate(credentials, ApiUtils.getUrlForRoomVisibility(currentUser.getBaseUrl(), conversation.getToken())) ncApi.makeRoomPrivate(credentials, ApiUtils.getUrlForRoomVisibility(currentUser.getBaseUrl(), conversation.getToken()))
.subscribeOn(Schedulers.newThread()) .subscribeOn(Schedulers.io())
.observeOn(AndroidSchedulers.mainThread()) .observeOn(AndroidSchedulers.mainThread())
.retry(1) .retry(1)
.subscribe(new Observer<GenericOverall>() { .subscribe(new Observer<GenericOverall>() {
@ -438,7 +438,7 @@ public class OperationsMenuController extends BaseController {
private void fetchCapabilities(String credentials) { private void fetchCapabilities(String credentials) {
ncApi.getCapabilities(credentials, ApiUtils.getUrlForCapabilities(baseUrl)) ncApi.getCapabilities(credentials, ApiUtils.getUrlForCapabilities(baseUrl))
.subscribeOn(Schedulers.newThread()) .subscribeOn(Schedulers.io())
.observeOn(AndroidSchedulers.mainThread()) .observeOn(AndroidSchedulers.mainThread())
.subscribe(new Observer<CapabilitiesOverall>() { .subscribe(new Observer<CapabilitiesOverall>() {
@Override @Override
@ -512,7 +512,7 @@ public class OperationsMenuController extends BaseController {
groupId); groupId);
ncApi.addParticipant(credentials, retrofitBucket.getUrl(), retrofitBucket.getQueryMap()) ncApi.addParticipant(credentials, retrofitBucket.getUrl(), retrofitBucket.getQueryMap())
.subscribeOn(Schedulers.newThread()) .subscribeOn(Schedulers.io())
.observeOn(AndroidSchedulers.mainThread()) .observeOn(AndroidSchedulers.mainThread())
.retry(1) .retry(1)
.subscribe(new Observer<AddParticipantOverall>() { .subscribe(new Observer<AddParticipantOverall>() {
@ -552,7 +552,7 @@ public class OperationsMenuController extends BaseController {
userId); userId);
ncApi.addParticipant(credentials, retrofitBucket.getUrl(), retrofitBucket.getQueryMap()) ncApi.addParticipant(credentials, retrofitBucket.getUrl(), retrofitBucket.getQueryMap())
.subscribeOn(Schedulers.newThread()) .subscribeOn(Schedulers.io())
.observeOn(AndroidSchedulers.mainThread()) .observeOn(AndroidSchedulers.mainThread())
.retry(1) .retry(1)
.subscribe(new Observer<AddParticipantOverall>() { .subscribe(new Observer<AddParticipantOverall>() {

View file

@ -83,7 +83,7 @@ public class DeleteConversationWorker extends Worker {
EventStatus.EventType.CONVERSATION_UPDATE, true); EventStatus.EventType.CONVERSATION_UPDATE, true);
ncApi.deleteRoom(credentials, ApiUtils.getRoom(operationUser.getBaseUrl(), conversationToken)) ncApi.deleteRoom(credentials, ApiUtils.getRoom(operationUser.getBaseUrl(), conversationToken))
.subscribeOn(Schedulers.newThread()) .subscribeOn(Schedulers.io())
.blockingSubscribe(new Observer<GenericOverall>() { .blockingSubscribe(new Observer<GenericOverall>() {
Disposable disposable; Disposable disposable;

View file

@ -83,7 +83,7 @@ public class LeaveConversationWorker extends Worker {
EventStatus.EventType.CONVERSATION_UPDATE, true); EventStatus.EventType.CONVERSATION_UPDATE, true);
ncApi.removeSelfFromRoom(credentials, ApiUtils.getUrlForRemoveSelfFromRoom(operationUser.getBaseUrl(), conversationToken)) ncApi.removeSelfFromRoom(credentials, ApiUtils.getUrlForRemoveSelfFromRoom(operationUser.getBaseUrl(), conversationToken))
.subscribeOn(Schedulers.newThread()) .subscribeOn(Schedulers.io())
.blockingSubscribe(new Observer<GenericOverall>() { .blockingSubscribe(new Observer<GenericOverall>() {
Disposable disposable; Disposable disposable;

View file

@ -76,7 +76,7 @@ public class ShareOperationWorker extends Worker {
filesArray.get(i), filesArray.get(i),
roomToken, roomToken,
"10") "10")
.subscribeOn(Schedulers.newThread()) .subscribeOn(Schedulers.io())
.blockingSubscribe(new Observer<Void>() { .blockingSubscribe(new Observer<Void>() {
@Override @Override
public void onSubscribe(Disposable d) { public void onSubscribe(Disposable d) {

View file

@ -95,7 +95,7 @@ public class MentionAutocompletePresenter extends RecyclerViewPresenter<Mention>
ncApi.getMentionAutocompleteSuggestions(ApiUtils.getCredentials(currentUser.getUsername(), currentUser ncApi.getMentionAutocompleteSuggestions(ApiUtils.getCredentials(currentUser.getUsername(), currentUser
.getToken()), ApiUtils.getUrlForMentionSuggestions(currentUser.getBaseUrl(), roomToken), .getToken()), ApiUtils.getUrlForMentionSuggestions(currentUser.getBaseUrl(), roomToken),
queryString, 5) queryString, 5)
.subscribeOn(Schedulers.newThread()) .subscribeOn(Schedulers.io())
.observeOn(AndroidSchedulers.mainThread()) .observeOn(AndroidSchedulers.mainThread())
.retry(3) .retry(3)
.subscribe(new Observer<MentionOverall>() { .subscribe(new Observer<MentionOverall>() {

View file

@ -271,7 +271,7 @@ public class PushUtils {
ncApi.registerDeviceForNotificationsWithProxy(finalCredentials, ncApi.registerDeviceForNotificationsWithProxy(finalCredentials,
ApiUtils.getUrlPushProxy(), proxyMap) ApiUtils.getUrlPushProxy(), proxyMap)
.subscribeOn(Schedulers.newThread()) .subscribeOn(Schedulers.io())
.subscribe(new Observer<Void>() { .subscribe(new Observer<Void>() {
@Override @Override
public void onSubscribe(Disposable d) { public void onSubscribe(Disposable d) {

View file

@ -46,7 +46,7 @@ public class ArbitraryStorageUtils {
dataStore.upsert(arbitraryStorageEntity) dataStore.upsert(arbitraryStorageEntity)
.toObservable() .toObservable()
.subscribeOn(Schedulers.newThread()) .subscribeOn(Schedulers.io())
.subscribe(); .subscribe();
} }
@ -63,6 +63,6 @@ public class ArbitraryStorageUtils {
ReactiveScalar<Integer> deleteResult = dataStore.delete(ArbitraryStorage.class).where(ArbitraryStorageEntity.ACCOUNT_IDENTIFIER.eq(accountIdentifier)).get(); ReactiveScalar<Integer> deleteResult = dataStore.delete(ArbitraryStorage.class).where(ArbitraryStorageEntity.ACCOUNT_IDENTIFIER.eq(accountIdentifier)).get();
return deleteResult.single().toObservable() return deleteResult.single().toObservable()
.subscribeOn(Schedulers.newThread()); .subscribeOn(Schedulers.io());
} }
} }

View file

@ -90,7 +90,7 @@ public class UserUtils {
UserEntity user = (UserEntity) findUserQueryResult.firstOrNull(); UserEntity user = (UserEntity) findUserQueryResult.firstOrNull();
return dataStore.delete(user) return dataStore.delete(user)
.subscribeOn(Schedulers.newThread()) .subscribeOn(Schedulers.io())
.observeOn(AndroidSchedulers.mainThread()); .observeOn(AndroidSchedulers.mainThread());
} }
@ -101,7 +101,7 @@ public class UserUtils {
UserEntity user = (UserEntity) findUserQueryResult.firstOrNull(); UserEntity user = (UserEntity) findUserQueryResult.firstOrNull();
return dataStore.delete(user) return dataStore.delete(user)
.subscribeOn(Schedulers.newThread()); .subscribeOn(Schedulers.io());
} }
@ -264,7 +264,7 @@ public class UserUtils {
return dataStore.upsert(user) return dataStore.upsert(user)
.toObservable() .toObservable()
.subscribeOn(Schedulers.newThread()); .subscribeOn(Schedulers.io());
} }
} }

View file

@ -89,7 +89,7 @@ public class DatabaseStorageModule implements StorageModule {
ncApi.setNotificationLevel(ApiUtils.getCredentials(conversationUser.getUsername(), conversationUser.getToken()), ncApi.setNotificationLevel(ApiUtils.getCredentials(conversationUser.getUsername(), conversationUser.getToken()),
ApiUtils.getUrlForSettingNotificationlevel(conversationUser.getBaseUrl(), conversationToken), ApiUtils.getUrlForSettingNotificationlevel(conversationUser.getBaseUrl(), conversationToken),
intValue) intValue)
.subscribeOn(Schedulers.newThread()) .subscribeOn(Schedulers.io())
.subscribe(new Observer<GenericOverall>() { .subscribe(new Observer<GenericOverall>() {
@Override @Override
public void onSubscribe(Disposable d) { public void onSubscribe(Disposable d) {