aboutsummaryrefslogtreecommitdiff
path: root/app/src/main/java/SubscribedSubredditDatabase
diff options
context:
space:
mode:
authorAlex Ning <chineseperson5@gmail.com>2019-01-07 11:03:49 +0000
committerAlex Ning <chineseperson5@gmail.com>2019-01-07 11:03:49 +0000
commit38be0ba01f6dd08c0be1a830e0d0389405949a56 (patch)
treeb083cf58f4737060f2f18ccabd4770e86ac58ccf /app/src/main/java/SubscribedSubredditDatabase
parent9d729579bf7ea9e179774766c02ddae105d4ccd7 (diff)
downloadinfinity-for-reddit-38be0ba01f6dd08c0be1a830e0d0389405949a56.tar
infinity-for-reddit-38be0ba01f6dd08c0be1a830e0d0389405949a56.tar.gz
infinity-for-reddit-38be0ba01f6dd08c0be1a830e0d0389405949a56.tar.bz2
infinity-for-reddit-38be0ba01f6dd08c0be1a830e0d0389405949a56.tar.lz
infinity-for-reddit-38be0ba01f6dd08c0be1a830e0d0389405949a56.tar.xz
infinity-for-reddit-38be0ba01f6dd08c0be1a830e0d0389405949a56.tar.zst
infinity-for-reddit-38be0ba01f6dd08c0be1a830e0d0389405949a56.zip
New feature: Subscribe or unsubscribe to a subreddit. Allow clear text traffic in Android Pie. Rewrite some code in lambda.
Diffstat (limited to 'app/src/main/java/SubscribedSubredditDatabase')
-rw-r--r--app/src/main/java/SubscribedSubredditDatabase/SubscribedSubredditDao.java6
1 files changed, 6 insertions, 0 deletions
diff --git a/app/src/main/java/SubscribedSubredditDatabase/SubscribedSubredditDao.java b/app/src/main/java/SubscribedSubredditDatabase/SubscribedSubredditDao.java
index 7837aa42..ed77c65c 100644
--- a/app/src/main/java/SubscribedSubredditDatabase/SubscribedSubredditDao.java
+++ b/app/src/main/java/SubscribedSubredditDatabase/SubscribedSubredditDao.java
@@ -18,4 +18,10 @@ public interface SubscribedSubredditDao {
@Query("SELECT * from subscribed_subreddits ORDER BY name COLLATE NOCASE ASC")
LiveData<List<SubscribedSubredditData>> getAllSubscribedSubreddits();
+
+ @Query("SELECT * from subscribed_subreddits WHERE name = :subredditName LIMIT 1")
+ SubscribedSubredditData getSubscribedSubreddit(String subredditName);
+
+ @Query("DELETE FROM subscribed_subreddits WHERE name = :subredditName")
+ void deleteSubscribedSubreddit(String subredditName);
}