public class FeedManagerImpl extends java.lang.Object implements FeedManager
FeedManager.InternalGfycatException, FeedManager.NoSearchResultException
Modifier and Type | Field and Description |
---|---|
static int |
DEFAULT_GET_ITEMS_VALUE |
static int |
DEFAULT_GET_MORE_ITEMS_VALUE |
Constructor and Description |
---|
FeedManagerImpl(CategoriesCache categoriesCache,
GfycatAPI gfycatApi,
GfycatFeedCache gfycatFeedCache) |
Modifier and Type | Method and Description |
---|---|
Completable |
addRecentGfycat(Gfycat gfycat) |
<any> |
createFeedIfNotExist(FeedIdentifier feedIdentifier,
Gfycat gfycat,
java.lang.String digest,
CloseMode closeMode) |
void |
dropFeed(FeedIdentifier feedIdentifier) |
<any> |
getCategories()
Request categories list from cache.
|
<any> |
getGfycat(java.lang.String gfyId)
Look for a Gfycat in cache.
|
Completable |
getGfycats(FeedIdentifier feedIdentifier)
Perform a network request of Gfycat list for a specified .
|
Completable |
getMoreGfycats(FeedDescription feedDescription)
Perform a network request of more Gfycats for corresponding feed.
|
Completable |
getNewGfycats(FeedDescription feedDescription)
Perform a network request of new Gfycats for a specified .
|
<any> |
getRecentCategory() |
<any> |
observeGfycats(android.content.Context context,
FeedIdentifier identifier)
|
<any> |
observeGfycats(FeedIdentifier identifier)
Subscribe for Gfycat changes in local DB.
|
void |
prefetchCategories() |
public static final int DEFAULT_GET_ITEMS_VALUE
public static final int DEFAULT_GET_MORE_ITEMS_VALUE
public FeedManagerImpl(CategoriesCache categoriesCache, GfycatAPI gfycatApi, GfycatFeedCache gfycatFeedCache)
public <any> getGfycat(java.lang.String gfyId)
FeedManager
getGfycat
in interface FeedManager
Single
emitting a Gfycat object or null, if not found neither in cache nor during network request.public <any> getCategories()
FeedManager
If found in cache but expired - will return cached one and perform network request for updates.
So, onNext may be called more than once!!!
getCategories
in interface FeedManager
GfycatCategoriesList
observable.public <any> getRecentCategory()
public <any> observeGfycats(android.content.Context context, FeedIdentifier identifier)
FeedManager
FeedManager.observeGfycats(FeedIdentifier)
.
Deprecation reason: Context not required anymore. Target deprecation version: 0.9.0
observeGfycats
in interface FeedManager
public <any> observeGfycats(FeedIdentifier identifier)
FeedManager
!!! Important: You should NOT forget to unsubscribe, otherwise memory leak will occur.
observeGfycats
in interface FeedManager
identifier
- - to subscribe for.FeedData
flowable.public Completable getGfycats(FeedIdentifier feedIdentifier)
FeedManager
FeedData
containing this request result will be returned via FeedManager.observeGfycats(Context, FeedIdentifier)
observable.
getGfycats
in interface FeedManager
feedIdentifier
- - to get gfycats for.Completable
calling onError in case of failure or onComplete in case of success.public Completable getNewGfycats(FeedDescription feedDescription)
FeedManager
FeedData
containing this request result will be returned via FeedManager.observeGfycats(Context, FeedIdentifier)
observable.
NOTE: This works only with FeedDescription
obtained via PublicFeedIdentifier.trending()
.
getNewGfycats
in interface FeedManager
feedDescription
- from the latest FeedData
received with FeedManager.observeGfycats(Context, FeedIdentifier)
Completable
calling onError in case of failure or onComplete in case of success.public Completable getMoreGfycats(FeedDescription feedDescription)
FeedManager
FeedData
containing this request result will be returned via FeedManager.observeGfycats(Context, FeedIdentifier)
observable.
getMoreGfycats
in interface FeedManager
feedDescription
- from latest FeedData
received with FeedManager.observeGfycats(Context, FeedIdentifier)
.Completable
calling onError in case of failure or onComplete in case of successpublic void prefetchCategories()
public <any> createFeedIfNotExist(FeedIdentifier feedIdentifier, Gfycat gfycat, java.lang.String digest, CloseMode closeMode)
public Completable addRecentGfycat(Gfycat gfycat)
public void dropFeed(FeedIdentifier feedIdentifier)