Versions Compared

Key

  • This line was added.
  • This line was removed.
  • Formatting was changed.

This document explains the sync logic used in the trace mobile app.

...

Syncing in the trace mobile app is the process that updates the data between the trance mobile app and the trance backend. Since the app supports offline features we have to update new data from the app to the backend and vice versa.

...

Sync types

Sync types are defined with which types of data are syncing.

...

  1. Company details

  2. Project details

  3. New farmers

  4. New cards

  5. Buy transactions

  6. Send transactions

  7. Transaction invoices

  8. Updated farmers

  9. Product list

  10. Buyer list

  11. Farmer list

  12. Transaction list

  13. Batch list

...

Sync variables

Sync variables are the redux state used to track sync process and used as universal variable that can access anywhere from the app.

...

  • syncStage - current sync stage value - initial value is 0.

  • syncInProgress - boolean value show that syncing is on progress or not - initial value is false.

  • syncSuccessfull - boolean value show that current syncing is successfully completed not.

...

Sync stages

Syncing is done with 3 different stages.

...

  • Stage 1: Initial sync

  • Stage 2: Transaction sync

  • Stage 3: Normal sync

1. Initial sync

Initial sync is happens on onboarding screen and it starts after login and user details APIs.

...

Getting project details from server side and API response is saved in userProjectDetails redux state. Also updating project premium table from premiums in this api response.

3. New farmers:

Updating

Syncing newly added farmers from app to server side.

4. New cards:

Syncing newly added cards from app to server side.

5. Buy transactions

Syncing newly added buy transactions from app to server side.

6. Send transactions

Syncing newly added buy transactions from app to server side.

7. Transaction invoices

Syncing updated farmer from app to server side.

8. Updated farmers

  1. Product list

  2. Buyer list

  3. Farmer list