From a299a230c6db2e3c3262f1f18f23a7b4d2d40294 Mon Sep 17 00:00:00 2001 From: Mario Danic Date: Thu, 23 Aug 2018 00:16:06 +0200 Subject: [PATCH] Fixes Signed-off-by: Mario Danic --- .../com/nextcloud/talk/activities/MagicCallActivity.java | 1 - .../nextcloud/talk/controllers/ContactsController.java | 2 -- .../com/nextcloud/talk/jobs/AccountRemovalWorker.java | 5 ++++- app/src/main/java/com/nextcloud/talk/utils/PushUtils.java | 7 +++---- .../com/nextcloud/talk/utils/database/user/UserUtils.java | 8 +++----- 5 files changed, 10 insertions(+), 13 deletions(-) diff --git a/app/src/main/java/com/nextcloud/talk/activities/MagicCallActivity.java b/app/src/main/java/com/nextcloud/talk/activities/MagicCallActivity.java index 44cab626c..f5ede5627 100644 --- a/app/src/main/java/com/nextcloud/talk/activities/MagicCallActivity.java +++ b/app/src/main/java/com/nextcloud/talk/activities/MagicCallActivity.java @@ -99,7 +99,6 @@ public class MagicCallActivity extends AppCompatActivity { @Override public void onConfigurationChanged(Configuration newConfig) { super.onConfigurationChanged(newConfig); - eventBus.post(new ConfigurationChangeEvent()); } } diff --git a/app/src/main/java/com/nextcloud/talk/controllers/ContactsController.java b/app/src/main/java/com/nextcloud/talk/controllers/ContactsController.java index 04388e5b8..99f41b116 100644 --- a/app/src/main/java/com/nextcloud/talk/controllers/ContactsController.java +++ b/app/src/main/java/com/nextcloud/talk/controllers/ContactsController.java @@ -215,8 +215,6 @@ public class ContactsController extends BaseController implements SearchView.OnQ if (adapter == null) { adapter = new FlexibleAdapter<>(contactItems, getActivity(), false); - currentUser = userUtils.getCurrentUser(); - if (currentUser != null) { fetchData(true); } diff --git a/app/src/main/java/com/nextcloud/talk/jobs/AccountRemovalWorker.java b/app/src/main/java/com/nextcloud/talk/jobs/AccountRemovalWorker.java index d453429fc..ae06dbb4c 100644 --- a/app/src/main/java/com/nextcloud/talk/jobs/AccountRemovalWorker.java +++ b/app/src/main/java/com/nextcloud/talk/jobs/AccountRemovalWorker.java @@ -83,7 +83,6 @@ public class AccountRemovalWorker extends Worker { PushConfigurationState.class); PushConfigurationState finalPushConfigurationState = pushConfigurationState; - ApplicationWideApiHolder.getInstance().removeNcApiInstanceForAccountId(userEntity.getId()); ncApi = ApplicationWideApiHolder.getInstance().getNcApiInstanceForAccountId(userEntity.getId(), null); credentials = ApiUtils.getCredentials(userEntity.getUserId(), userEntity.getToken()); @@ -116,6 +115,9 @@ public class AccountRemovalWorker extends Worker { @Override public void onNext(Void aVoid) { + + ApplicationWideApiHolder.getInstance().removeNcApiInstanceForAccountId(userEntity.getId()); + if (Build.VERSION.SDK_INT >= Build.VERSION_CODES.O) { String groupName = String.format(getApplicationContext().getResources() .getString(R.string @@ -140,6 +142,7 @@ public class AccountRemovalWorker extends Worker { @Override public void onComplete() { + } @Override diff --git a/app/src/main/java/com/nextcloud/talk/utils/PushUtils.java b/app/src/main/java/com/nextcloud/talk/utils/PushUtils.java index 04a67b540..85c7edb54 100644 --- a/app/src/main/java/com/nextcloud/talk/utils/PushUtils.java +++ b/app/src/main/java/com/nextcloud/talk/utils/PushUtils.java @@ -267,8 +267,7 @@ public class PushUtils { ncApi.registerDeviceForNotificationsWithNextcloud( credentials, ApiUtils.getUrlNextcloudPush(userEntity.getBaseUrl()), queryMap) - .subscribeOn(Schedulers.newThread()) - .subscribe(new Observer() { + .blockingSubscribe(new Observer() { @Override public void onSubscribe(Disposable d) { @@ -289,7 +288,7 @@ public class PushUtils { ncApi.registerDeviceForNotificationsWithProxy(finalCredentials, ApiUtils.getUrlPushProxy(), proxyMap) .subscribeOn(Schedulers.newThread()) - .subscribe(new Observer() { + .blockingSubscribe(new Observer() { @Override public void onSubscribe(Disposable d) { @@ -317,7 +316,7 @@ public class PushUtils { userEntity.getDisplayName(), LoganSquare.serialize(pushConfigurationState), null, null, userEntity.getId(), null, null) - .subscribe(new Observer() { + .blockingSubscribe(new Observer() { @Override public void onSubscribe(Disposable d) { diff --git a/app/src/main/java/com/nextcloud/talk/utils/database/user/UserUtils.java b/app/src/main/java/com/nextcloud/talk/utils/database/user/UserUtils.java index a0ac4896b..b1d47b234 100644 --- a/app/src/main/java/com/nextcloud/talk/utils/database/user/UserUtils.java +++ b/app/src/main/java/com/nextcloud/talk/utils/database/user/UserUtils.java @@ -49,9 +49,8 @@ public class UserUtils { } public List getUsers() { - Result findUsersQueryResult = dataStore.select(User.class).where(UserEntity.SCHEDULED_FOR_DELETION.notEqual - (true)) - .get(); + Result findUsersQueryResult = dataStore.select(User.class).where + (UserEntity.SCHEDULED_FOR_DELETION.notEqual(true)).get(); return findUsersQueryResult.toList(); } @@ -109,8 +108,7 @@ public class UserUtils { } public UserEntity getUserWithId(long id) { - Result findUserQueryResult = dataStore.select(User.class).where(UserEntity.ID.eq(id) - .and(UserEntity.SCHEDULED_FOR_DELETION.notEqual(true))) + Result findUserQueryResult = dataStore.select(User.class).where(UserEntity.ID.eq(id)) .limit(1).get(); return (UserEntity) findUserQueryResult.firstOrNull();