The app should be mostly usable without internet -- content that has been viewed previously should still be accessible. Signing in to the app should trigger the eventual downloading of favorited guides. The guides will be kept up to date without any user action. Favoriting a guide will perform the favorite API call and then trigger a sync.
Every GET request response will be stored in the database keyed off of the URL and userid. If there isn't an internet connection, the stored response can be used in place of a live response.
Synced favorites will be stored in a separate table including siteid, userid, guideid, response_body, modified_date, and status (COMPLETE, IN_PROGRESS). Syncing will involve comparing the current list from the API with what is stored in the DB. Based on the existence or nonexistence of entries as well as the modified dates, guides will be added, deleted, and updated accordingly.
Images and videos will be stored as files in private internal storage named based on the hash of the URL.
If the guide API call in GuideViewActivity is either a no connection error or is from the saved responses, then the favorites list will be checked if there is a guide properly stored for offline viewing. If a favorited guide is present, the guide will be displayed in "offline mode" where the images aren't loaded from the internet but rather from the file system. If not, either an error message will be displayed or the previous data will be used but images may be missing.
Battle plan
Write some simple tests using Espresso and maybe Spoon too. These will focus on authentication and very light coverage of every section of the app.
Refactor login/authentication to use the built in Account Manager. #188
Add favoriting of guides (just performing the API call). #183
Save all GET requests to the DB. #185
Implement the SyncAdapter to do the heavy lifting of offline storage. #200
Add "offline mode" to guide view so it will use the synced data. #200
User Experience
The app should be mostly usable without internet -- content that has been viewed previously should still be accessible. Signing in to the app should trigger the eventual downloading of favorited guides. The guides will be kept up to date without any user action. Favoriting a guide will perform the favorite API call and then trigger a sync.
Technologies
Implementation
GET
request response will be stored in the database keyed off of the URL and userid. If there isn't an internet connection, the stored response can be used in place of a live response.siteid
,userid
,guideid
,response_body
,modified_date
, andstatus
(COMPLETE
,IN_PROGRESS
). Syncing will involve comparing the current list from the API with what is stored in the DB. Based on the existence or nonexistence of entries as well as the modified dates, guides will be added, deleted, and updated accordingly.GuideViewActivity
is either a no connection error or is from the saved responses, then the favorites list will be checked if there is a guide properly stored for offline viewing. If a favorited guide is present, the guide will be displayed in "offline mode" where the images aren't loaded from the internet but rather from the file system. If not, either an error message will be displayed or the previous data will be used but images may be missing.Battle plan
Refactor login/authentication to use the built in Account Manager.#188Add favoriting of guides (just performing the API call).#183Save all#185GET
requests to the DB.Implement the#200SyncAdapter
to do the heavy lifting of offline storage.Add "offline mode" to guide view so it will use the synced data.#200