From 38be0ba01f6dd08c0be1a830e0d0389405949a56 Mon Sep 17 00:00:00 2001 From: Alex Ning Date: Mon, 7 Jan 2019 19:03:49 +0800 Subject: New feature: Subscribe or unsubscribe to a subreddit. Allow clear text traffic in Android Pie. Rewrite some code in lambda. --- .../java/SubscribedSubredditDatabase/SubscribedSubredditDao.java | 6 ++++++ 1 file changed, 6 insertions(+) (limited to 'app/src/main/java/SubscribedSubredditDatabase/SubscribedSubredditDao.java') 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> 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); } -- cgit v1.2.3