-
public final class InboxDatasourceInbox datasource. Wraps SQLite queries (DAO).
-
-
Constructor Summary
Constructors Constructor Description InboxDatasource(Context context)
-
Method Summary
Modifier and Type Method Description voidwipeData()Clear all content voidclose()Close the datasource. List<InboxNotificationContentInternal>getNotifications(List<String> notificationIds, long fetcherId)longgetFetcherID(FetcherType type, String identifier)Try to get the fetcher ID from the SQLiteCreate and insert it if it doesn't exist List<InboxCandidateNotificationInternal>getCandidateNotifications(@Nullable() String cursor, int limit, long fetcherId)Look in database for cached notifications booleaninsertResponse(InboxWebserviceResponse response, long fetcherId)Add a response's notification to the database StringupdateNotification(JSONObject notification, long fetcherId)Read the notification object and update the row in databaseWe update different values depending on what the server actually sent intmarkAllAsRead(long time, long fetcherId)Mark all notification received before a specified time as read voidmarkNotificationAsRead(String notificationID)Mark a notification as read voidmarkNotificationAsDeleted(String notificationID)Mark a notification as deleted locally booleandeleteNotifications(List<String> notificationIds)Delete notification by ID booleancleanDatabase()Remove notifications older than 90 daysAlso remove related row in other tables -
-
Constructor Detail
-
InboxDatasource
InboxDatasource(Context context)
-
-
Method Detail
-
wipeData
void wipeData()
Clear all content
-
close
void close()
Close the datasource. You should not make any other call to this datasource once this has been called.
-
getNotifications
List<InboxNotificationContentInternal> getNotifications(List<String> notificationIds, long fetcherId)
-
getFetcherID
long getFetcherID(FetcherType type, String identifier)
Try to get the fetcher ID from the SQLiteCreate and insert it if it doesn't exist
- Parameters:
type- The fetcher typeidentifier- The user identifier
-
getCandidateNotifications
List<InboxCandidateNotificationInternal> getCandidateNotifications(@Nullable() String cursor, int limit, long fetcherId)
Look in database for cached notifications
- Parameters:
cursor- The cursorfetcherId- The fetcher identifier
-
insertResponse
boolean insertResponse(InboxWebserviceResponse response, long fetcherId)
Add a response's notification to the database
- Parameters:
response- response to add
-
updateNotification
String updateNotification(JSONObject notification, long fetcherId)
Read the notification object and update the row in databaseWe update different values depending on what the server actually sent
-
markAllAsRead
int markAllAsRead(long time, long fetcherId)
Mark all notification received before a specified time as read
-
markNotificationAsRead
void markNotificationAsRead(String notificationID)
Mark a notification as read
- Parameters:
notificationID- the notification identifier
-
markNotificationAsDeleted
void markNotificationAsDeleted(String notificationID)
Mark a notification as deleted locally
- Parameters:
notificationID- the notification identifier
-
deleteNotifications
boolean deleteNotifications(List<String> notificationIds)
Delete notification by ID
- Parameters:
notificationIds- IDs of the notifications to delete
-
cleanDatabase
boolean cleanDatabase()
Remove notifications older than 90 daysAlso remove related row in other tables
-
-
-
-