iFixit / iFixitAndroid

Official iFixit Android App
https://play.google.com/store/apps/details?id=com.dozuki.ifixit
GNU General Public License v3.0
162 stars 88 forks source link

Guide Offline Browsing Working Draft #182

Closed marczych closed 10 years ago

marczych commented 10 years ago

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

  1. Sync Adapter for downloading data in the background. This works on demand and periodically in the background. Note: This requires use of the AccountManager, Content Provider, and Service APIs.
  2. SQLiteDatabase for storing JSON data.
  3. Internal storage for saving images to disk.

    Implementation

  4. 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.
  5. 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.
  6. Images and videos will be stored as files in private internal storage named based on the hash of the URL.
  7. 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

  8. 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.
  9. Refactor login/authentication to use the built in Account Manager. #188
  10. Add favoriting of guides (just performing the API call). #183
  11. Save all GET requests to the DB. #185
  12. Implement the SyncAdapter to do the heavy lifting of offline storage. #200
  13. Add "offline mode" to guide view so it will use the synced data. #200
marczych commented 10 years ago

Closing because all of this is done (except for tests :crying_cat_face:).