This repository has been archived by the owner on Aug 20, 2024. It is now read-only.
-
Notifications
You must be signed in to change notification settings - Fork 5
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
RSS: Strip out common method to handle fetching feeds
Signed-off-by: Aayush Gupta <[email protected]>
- Loading branch information
1 parent
bb9ef78
commit cd089f9
Showing
3 changed files
with
17 additions
and
47 deletions.
There are no files selected for viewing
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -1,25 +1,26 @@ | ||
package io.aayush.relabs.rss | ||
|
||
import com.prof18.rssparser.model.RssItem | ||
import io.aayush.relabs.rss.data.RssFeed | ||
import javax.inject.Inject | ||
|
||
class RSSNewsRepository @Inject constructor( | ||
private val rssNewsImpl: RSSNewsImpl | ||
) { | ||
|
||
suspend fun getXDAPortalFeed(): Result<List<RssItem>> { | ||
return rssNewsImpl.getXDAPortalFeed() | ||
return rssNewsImpl.getFeed(RssFeed.XDA) | ||
} | ||
|
||
suspend fun get9to5GoogleFeed(): Result<List<RssItem>> { | ||
return rssNewsImpl.get9to5GoogleFeed() | ||
return rssNewsImpl.getFeed(RssFeed.Google9To5) | ||
} | ||
|
||
suspend fun getAndroidDevsFeed(): Result<List<RssItem>> { | ||
return rssNewsImpl.getAndroidDevsFeed() | ||
return rssNewsImpl.getFeed(RssFeed.AndroidDevs) | ||
} | ||
|
||
suspend fun getArsTechFeed(): Result<List<RssItem>> { | ||
return rssNewsImpl.getArsTechFeed() | ||
return rssNewsImpl.getFeed(RssFeed.ArsTech) | ||
} | ||
} |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,8 @@ | ||
package io.aayush.relabs.rss.data | ||
|
||
sealed class RssFeed(val source: String) { | ||
data object XDA : RssFeed("https://www.xda-developers.com/feed/category/mobile/") | ||
data object ArsTech : RssFeed("https://feeds.arstechnica.com/arstechnica/index") | ||
data object Google9To5 : RssFeed("https://9to5google.com/feed/") | ||
data object AndroidDevs : RssFeed("https://feeds.feedburner.com/blogspot/hsDu") | ||
} |