mirror of
https://github.com/nextcloud/talk-android.git
synced 2024-11-22 04:55:29 +03:00
Fix a bug with account removals
Signed-off-by: Mario Danic <mario@lovelyhq.com>
This commit is contained in:
parent
97589da58e
commit
7680e0000c
1 changed files with 93 additions and 55 deletions
|
@ -22,6 +22,7 @@ package com.nextcloud.talk.jobs;
|
||||||
|
|
||||||
|
|
||||||
import android.support.annotation.NonNull;
|
import android.support.annotation.NonNull;
|
||||||
|
import android.text.TextUtils;
|
||||||
import android.util.Log;
|
import android.util.Log;
|
||||||
|
|
||||||
import com.bluelinelabs.logansquare.LoganSquare;
|
import com.bluelinelabs.logansquare.LoganSquare;
|
||||||
|
@ -40,6 +41,7 @@ import java.util.HashMap;
|
||||||
import javax.inject.Inject;
|
import javax.inject.Inject;
|
||||||
|
|
||||||
import autodagger.AutoInjector;
|
import autodagger.AutoInjector;
|
||||||
|
import io.reactivex.CompletableObserver;
|
||||||
import io.reactivex.Observer;
|
import io.reactivex.Observer;
|
||||||
import io.reactivex.disposables.Disposable;
|
import io.reactivex.disposables.Disposable;
|
||||||
|
|
||||||
|
@ -62,6 +64,7 @@ public class AccountRemovalJob extends Job {
|
||||||
for(Object userEntityObject : userUtils.getUsersScheduledForDeletion()) {
|
for(Object userEntityObject : userUtils.getUsersScheduledForDeletion()) {
|
||||||
UserEntity userEntity = (UserEntity) userEntityObject;
|
UserEntity userEntity = (UserEntity) userEntityObject;
|
||||||
try {
|
try {
|
||||||
|
if (!TextUtils.isEmpty(userEntity.getPushConfigurationState())) {
|
||||||
pushConfigurationState = LoganSquare.parse(userEntity.getPushConfigurationState(),
|
pushConfigurationState = LoganSquare.parse(userEntity.getPushConfigurationState(),
|
||||||
PushConfigurationState.class);
|
PushConfigurationState.class);
|
||||||
PushConfigurationState finalPushConfigurationState = pushConfigurationState;
|
PushConfigurationState finalPushConfigurationState = pushConfigurationState;
|
||||||
|
@ -94,37 +97,72 @@ public class AccountRemovalJob extends Job {
|
||||||
|
|
||||||
@Override
|
@Override
|
||||||
public void onNext(Void aVoid) {
|
public void onNext(Void aVoid) {
|
||||||
|
userUtils.deleteUser(userEntity.getUsername(),
|
||||||
|
userEntity.getBaseUrl()).subscribe(new CompletableObserver() {
|
||||||
|
@Override
|
||||||
|
public void onSubscribe(Disposable d) {
|
||||||
|
|
||||||
|
}
|
||||||
|
|
||||||
|
@Override
|
||||||
|
public void onComplete() {
|
||||||
|
|
||||||
|
}
|
||||||
|
|
||||||
|
@Override
|
||||||
|
public void onError(Throwable e) {
|
||||||
|
|
||||||
|
}
|
||||||
|
});
|
||||||
|
}
|
||||||
|
|
||||||
|
@Override
|
||||||
|
public void onError(Throwable e) {
|
||||||
|
|
||||||
|
}
|
||||||
|
|
||||||
|
@Override
|
||||||
|
public void onComplete() {
|
||||||
|
|
||||||
|
}
|
||||||
|
});
|
||||||
|
}
|
||||||
|
}
|
||||||
|
|
||||||
|
@Override
|
||||||
|
public void onError(Throwable e) {
|
||||||
|
|
||||||
|
}
|
||||||
|
|
||||||
|
@Override
|
||||||
|
public void onComplete() {
|
||||||
|
|
||||||
|
}
|
||||||
|
});
|
||||||
|
} else {
|
||||||
|
userUtils.deleteUser(userEntity.getUsername(),
|
||||||
|
userEntity.getBaseUrl()).subscribe(new CompletableObserver() {
|
||||||
|
@Override
|
||||||
|
public void onSubscribe(Disposable d) {
|
||||||
|
|
||||||
|
}
|
||||||
|
|
||||||
|
@Override
|
||||||
|
public void onComplete() {
|
||||||
|
|
||||||
|
}
|
||||||
|
|
||||||
|
@Override
|
||||||
|
public void onError(Throwable e) {
|
||||||
|
|
||||||
|
}
|
||||||
|
});
|
||||||
|
}
|
||||||
|
} catch(IOException e) {
|
||||||
|
Log.d(TAG, "Something went wrong while removing job at parsing PushConfigurationState");
|
||||||
userUtils.deleteUser(userEntity.getUsername(),
|
userUtils.deleteUser(userEntity.getUsername(),
|
||||||
userEntity.getBaseUrl());
|
userEntity.getBaseUrl());
|
||||||
}
|
}
|
||||||
|
|
||||||
@Override
|
|
||||||
public void onError(Throwable e) {
|
|
||||||
|
|
||||||
}
|
|
||||||
|
|
||||||
@Override
|
|
||||||
public void onComplete() {
|
|
||||||
|
|
||||||
}
|
|
||||||
});
|
|
||||||
}
|
|
||||||
}
|
|
||||||
|
|
||||||
@Override
|
|
||||||
public void onError(Throwable e) {
|
|
||||||
|
|
||||||
}
|
|
||||||
|
|
||||||
@Override
|
|
||||||
public void onComplete() {
|
|
||||||
|
|
||||||
}
|
|
||||||
});
|
|
||||||
} catch (IOException e) {
|
|
||||||
Log.d(TAG, "Something went wrong while removing job at parsing PushConfigurationState");
|
|
||||||
}
|
|
||||||
|
|
||||||
}
|
}
|
||||||
return Result.SUCCESS;
|
return Result.SUCCESS;
|
||||||
}
|
}
|
||||||
|
|
Loading…
Reference in a new issue