This is to implement the mechanism for persisting the state of cards that were dismissed by the user from the Feed list, so that they remain dismissed when the feed is refreshed or the app is restarted.
Some discussion notes:
One way to implement this might be to persist the List<Card> in FeedCoordinatorBase as a JSON string SharedPreference, like we do for page tabs, in onPause and restore them in onResume(). Some considerations:
- Dismissed Cards are marked "dismissed" and preserved like any other Card.
- Cards flagged with dismissed are not replaced when updating the list.
- Cards flagged with dismissed do are not considered for display.
- The List size would be capped at 500(?) Cards.
The complication is in handling subsequent updates to the List. Consider the following scenarios in testing:
- The first Card of the List is dismissed yesterday and an update is requested.
- The last Card of the List is dismissed and an update is requested.
- All cards for a given date have been dismissed and an update for that date has been requested. (Don't show dismissed cards and don't make redundant requests.)
- The List has exceeded the maximum allowed size by growing upward. (Some cards must be sticky like search.)
- The List has exceeded the maximum allowed size by growing downward. (Some cards must be sticky like search.)
- The List is empty.
- The List only contains dismissed Cards. (Request more Cards and don't show dismissed Cards.)
- A force refresh has been requested. (Don't show dismissed Cards.)
The above was only suggested as it seems lower cost than a database solution.