mirror of
https://github.com/nextcloud/talk-android
synced 2025-06-20 03:59:35 +01:00
Attempt at removing the data from arbitrary storage
This commit is contained in:
parent
238cab78b1
commit
c92c3db803
@ -35,6 +35,7 @@ import com.nextcloud.talk.models.database.UserEntity;
|
|||||||
import com.nextcloud.talk.models.json.generic.GenericOverall;
|
import com.nextcloud.talk.models.json.generic.GenericOverall;
|
||||||
import com.nextcloud.talk.models.json.push.PushConfigurationState;
|
import com.nextcloud.talk.models.json.push.PushConfigurationState;
|
||||||
import com.nextcloud.talk.utils.ApiUtils;
|
import com.nextcloud.talk.utils.ApiUtils;
|
||||||
|
import com.nextcloud.talk.utils.database.arbitrarystorage.ArbitraryStorageUtils;
|
||||||
import com.nextcloud.talk.utils.database.user.UserUtils;
|
import com.nextcloud.talk.utils.database.user.UserUtils;
|
||||||
import com.nextcloud.talk.webrtc.WebSocketConnectionHelper;
|
import com.nextcloud.talk.webrtc.WebSocketConnectionHelper;
|
||||||
|
|
||||||
@ -63,6 +64,9 @@ public class AccountRemovalWorker extends Worker {
|
|||||||
@Inject
|
@Inject
|
||||||
UserUtils userUtils;
|
UserUtils userUtils;
|
||||||
|
|
||||||
|
@Inject
|
||||||
|
ArbitraryStorageUtils arbitraryStorageUtils;
|
||||||
|
|
||||||
@Inject
|
@Inject
|
||||||
Retrofit retrofit;
|
Retrofit retrofit;
|
||||||
|
|
||||||
@ -143,22 +147,42 @@ public class AccountRemovalWorker extends Worker {
|
|||||||
|
|
||||||
WebSocketConnectionHelper.deleteExternalSignalingInstanceForUserEntity(userEntity.getId());
|
WebSocketConnectionHelper.deleteExternalSignalingInstanceForUserEntity(userEntity.getId());
|
||||||
|
|
||||||
userUtils.deleteUser(userEntity.getId()).subscribe(new CompletableObserver() {
|
arbitraryStorageUtils.deleteAllEntriesForAccountIdentifier(userEntity.getId()).subscribe(new Observer() {
|
||||||
@Override
|
@Override
|
||||||
public void onSubscribe(Disposable d) {
|
public void onSubscribe(Disposable d) {
|
||||||
|
|
||||||
}
|
}
|
||||||
|
|
||||||
@Override
|
@Override
|
||||||
public void onComplete() {
|
public void onNext(Object o) {
|
||||||
|
userUtils.deleteUser(userEntity.getId()).subscribe(new CompletableObserver() {
|
||||||
|
@Override
|
||||||
|
public void onSubscribe(Disposable d) {
|
||||||
|
|
||||||
}
|
}
|
||||||
|
|
||||||
@Override
|
@Override
|
||||||
public void onError(Throwable e) {
|
public void onComplete() {
|
||||||
|
|
||||||
}
|
}
|
||||||
});
|
|
||||||
|
@Override
|
||||||
|
public void onError(Throwable e) {
|
||||||
|
|
||||||
|
}
|
||||||
|
});
|
||||||
|
}
|
||||||
|
|
||||||
|
@Override
|
||||||
|
public void onError(Throwable e) {
|
||||||
|
|
||||||
|
}
|
||||||
|
|
||||||
|
@Override
|
||||||
|
public void onComplete() {
|
||||||
|
|
||||||
|
}
|
||||||
|
});
|
||||||
}
|
}
|
||||||
|
|
||||||
@Override
|
@Override
|
||||||
|
@ -31,11 +31,14 @@ import java.util.List;
|
|||||||
import androidx.annotation.Nullable;
|
import androidx.annotation.Nullable;
|
||||||
import io.reactivex.Completable;
|
import io.reactivex.Completable;
|
||||||
import io.reactivex.Observable;
|
import io.reactivex.Observable;
|
||||||
|
import io.reactivex.Observer;
|
||||||
import io.reactivex.android.schedulers.AndroidSchedulers;
|
import io.reactivex.android.schedulers.AndroidSchedulers;
|
||||||
|
import io.reactivex.disposables.Disposable;
|
||||||
import io.reactivex.schedulers.Schedulers;
|
import io.reactivex.schedulers.Schedulers;
|
||||||
import io.requery.Persistable;
|
import io.requery.Persistable;
|
||||||
import io.requery.query.Result;
|
import io.requery.query.Result;
|
||||||
import io.requery.reactivex.ReactiveEntityStore;
|
import io.requery.reactivex.ReactiveEntityStore;
|
||||||
|
import io.requery.reactivex.ReactiveScalar;
|
||||||
|
|
||||||
public class ArbitraryStorageUtils {
|
public class ArbitraryStorageUtils {
|
||||||
private ReactiveEntityStore<Persistable> dataStore;
|
private ReactiveEntityStore<Persistable> dataStore;
|
||||||
@ -66,4 +69,11 @@ public class ArbitraryStorageUtils {
|
|||||||
|
|
||||||
return (ArbitraryStorageEntity) findStorageQueryResult.firstOrNull();
|
return (ArbitraryStorageEntity) findStorageQueryResult.firstOrNull();
|
||||||
}
|
}
|
||||||
|
|
||||||
|
public Observable deleteAllEntriesForAccountIdentifier(long accountIdentifier) {
|
||||||
|
ReactiveScalar<Integer> deleteResult = dataStore.delete(ArbitraryStorage.class).where(ArbitraryStorageEntity.ACCOUNT_IDENTIFIER.eq(accountIdentifier)).get();
|
||||||
|
|
||||||
|
return deleteResult.single().toObservable()
|
||||||
|
.subscribeOn(Schedulers.newThread());
|
||||||
|
}
|
||||||
}
|
}
|
||||||
|
Loading…
Reference in New Issue
Block a user