Browse Source

Fixes

Signed-off-by: Mario Danic <mario@lovelyhq.com>
Mario Danic 6 years ago
parent
commit
a299a230c6

+ 0 - 1
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());
     }
 }

+ 0 - 2
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);
             }

+ 4 - 1
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

+ 3 - 4
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<PushRegistrationOverall>() {
+                                    .blockingSubscribe(new Observer<PushRegistrationOverall>() {
                                         @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<Void>() {
+                                                    .blockingSubscribe(new Observer<Void>() {
                                                         @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<UserEntity>() {
+                                                                        .blockingSubscribe(new Observer<UserEntity>() {
                                                                             @Override
                                                                             public void onSubscribe(Disposable d) {
 

+ 3 - 5
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();