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.push.PushConfigurationState;
|
||||
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.webrtc.WebSocketConnectionHelper;
|
||||
|
||||
@ -63,6 +64,9 @@ public class AccountRemovalWorker extends Worker {
|
||||
@Inject
|
||||
UserUtils userUtils;
|
||||
|
||||
@Inject
|
||||
ArbitraryStorageUtils arbitraryStorageUtils;
|
||||
|
||||
@Inject
|
||||
Retrofit retrofit;
|
||||
|
||||
@ -143,6 +147,14 @@ public class AccountRemovalWorker extends Worker {
|
||||
|
||||
WebSocketConnectionHelper.deleteExternalSignalingInstanceForUserEntity(userEntity.getId());
|
||||
|
||||
arbitraryStorageUtils.deleteAllEntriesForAccountIdentifier(userEntity.getId()).subscribe(new Observer() {
|
||||
@Override
|
||||
public void onSubscribe(Disposable d) {
|
||||
|
||||
}
|
||||
|
||||
@Override
|
||||
public void onNext(Object o) {
|
||||
userUtils.deleteUser(userEntity.getId()).subscribe(new CompletableObserver() {
|
||||
@Override
|
||||
public void onSubscribe(Disposable d) {
|
||||
@ -172,6 +184,18 @@ public class AccountRemovalWorker extends Worker {
|
||||
}
|
||||
});
|
||||
}
|
||||
|
||||
@Override
|
||||
public void onError(Throwable e) {
|
||||
|
||||
}
|
||||
|
||||
@Override
|
||||
public void onComplete() {
|
||||
|
||||
}
|
||||
});
|
||||
}
|
||||
}
|
||||
|
||||
@Override
|
||||
|
@ -31,11 +31,14 @@ import java.util.List;
|
||||
import androidx.annotation.Nullable;
|
||||
import io.reactivex.Completable;
|
||||
import io.reactivex.Observable;
|
||||
import io.reactivex.Observer;
|
||||
import io.reactivex.android.schedulers.AndroidSchedulers;
|
||||
import io.reactivex.disposables.Disposable;
|
||||
import io.reactivex.schedulers.Schedulers;
|
||||
import io.requery.Persistable;
|
||||
import io.requery.query.Result;
|
||||
import io.requery.reactivex.ReactiveEntityStore;
|
||||
import io.requery.reactivex.ReactiveScalar;
|
||||
|
||||
public class ArbitraryStorageUtils {
|
||||
private ReactiveEntityStore<Persistable> dataStore;
|
||||
@ -66,4 +69,11 @@ public class ArbitraryStorageUtils {
|
||||
|
||||
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