aboutsummaryrefslogtreecommitdiff
path: root/app/src/main/java/ml
diff options
context:
space:
mode:
authorAlex Ning <chineseperson5@gmail.com>2021-09-28 11:23:34 +0000
committerAlex Ning <chineseperson5@gmail.com>2021-09-28 11:23:34 +0000
commit426db4c069c2237aef2e93aa78e282b1a28eb351 (patch)
treef60b6ee1c47821ee76074cce319ea958d78efd64 /app/src/main/java/ml
parent10cccb5b935202122516a50c7740688d940eb466 (diff)
downloadinfinity-for-reddit-426db4c069c2237aef2e93aa78e282b1a28eb351.tar
infinity-for-reddit-426db4c069c2237aef2e93aa78e282b1a28eb351.tar.gz
infinity-for-reddit-426db4c069c2237aef2e93aa78e282b1a28eb351.tar.bz2
infinity-for-reddit-426db4c069c2237aef2e93aa78e282b1a28eb351.tar.lz
infinity-for-reddit-426db4c069c2237aef2e93aa78e282b1a28eb351.tar.xz
infinity-for-reddit-426db4c069c2237aef2e93aa78e282b1a28eb351.tar.zst
infinity-for-reddit-426db4c069c2237aef2e93aa78e282b1a28eb351.zip
Delete anonymous multireddit.
Diffstat (limited to 'app/src/main/java/ml')
-rw-r--r--app/src/main/java/ml/docilealligator/infinityforreddit/asynctasks/DeleteMultiredditInDatabase.java6
-rw-r--r--app/src/main/java/ml/docilealligator/infinityforreddit/multireddit/DeleteMultiReddit.java2
-rw-r--r--app/src/main/java/ml/docilealligator/infinityforreddit/multireddit/MultiRedditDao.java3
3 files changed, 9 insertions, 2 deletions
diff --git a/app/src/main/java/ml/docilealligator/infinityforreddit/asynctasks/DeleteMultiredditInDatabase.java b/app/src/main/java/ml/docilealligator/infinityforreddit/asynctasks/DeleteMultiredditInDatabase.java
index d6e2522d..0279498f 100644
--- a/app/src/main/java/ml/docilealligator/infinityforreddit/asynctasks/DeleteMultiredditInDatabase.java
+++ b/app/src/main/java/ml/docilealligator/infinityforreddit/asynctasks/DeleteMultiredditInDatabase.java
@@ -13,7 +13,11 @@ public class DeleteMultiredditInDatabase {
String accountName, String multipath,
DeleteMultiredditInDatabaseListener deleteMultiredditInDatabaseListener) {
executor.execute(() -> {
- redditDataRoomDatabase.multiRedditDao().deleteMultiReddit(multipath, accountName);
+ if (accountName.equals("-")) {
+ redditDataRoomDatabase.multiRedditDao().anonymousDeleteMultiReddit(multipath);
+ } else {
+ redditDataRoomDatabase.multiRedditDao().deleteMultiReddit(multipath, accountName);
+ }
handler.post(deleteMultiredditInDatabaseListener::success);
});
}
diff --git a/app/src/main/java/ml/docilealligator/infinityforreddit/multireddit/DeleteMultiReddit.java b/app/src/main/java/ml/docilealligator/infinityforreddit/multireddit/DeleteMultiReddit.java
index 7fbb3ab7..9ccdbb92 100644
--- a/app/src/main/java/ml/docilealligator/infinityforreddit/multireddit/DeleteMultiReddit.java
+++ b/app/src/main/java/ml/docilealligator/infinityforreddit/multireddit/DeleteMultiReddit.java
@@ -27,7 +27,7 @@ public class DeleteMultiReddit {
String accessToken, String accountName, String multipath,
DeleteMultiRedditListener deleteMultiRedditListener) {
oauthRetrofit.create(RedditAPI.class).deleteMultiReddit(APIUtils.getOAuthHeader(accessToken),
- multipath).enqueue(new Callback<String>() {
+ multipath).enqueue(new Callback<>() {
@Override
public void onResponse(@NonNull Call<String> call, @NonNull Response<String> response) {
if (response.isSuccessful()) {
diff --git a/app/src/main/java/ml/docilealligator/infinityforreddit/multireddit/MultiRedditDao.java b/app/src/main/java/ml/docilealligator/infinityforreddit/multireddit/MultiRedditDao.java
index cb50cba6..69721319 100644
--- a/app/src/main/java/ml/docilealligator/infinityforreddit/multireddit/MultiRedditDao.java
+++ b/app/src/main/java/ml/docilealligator/infinityforreddit/multireddit/MultiRedditDao.java
@@ -28,6 +28,9 @@ public interface MultiRedditDao {
@Query("DELETE FROM multi_reddits WHERE name = :name AND username = :username")
void deleteMultiReddit(String name, String username);
+ @Query("DELETE FROM multi_reddits WHERE path = :path")
+ void anonymousDeleteMultiReddit(String path);
+
@Query("DELETE FROM multi_reddits WHERE username = :username")
void deleteAllUserMultiReddits(String username);
}