This document explains the sync logic used in the trace mobile app.
Sync types
Sync types are defined with which types of data are syncing.
- Company details
- Project details
- New farmers
- New cards
- Buy transactions
- Send transactions
- Transaction invoices
- Updated farmers
- Product list
- Buyer list
- Farmer list
- Transaction list
- Batch list
Sync variables
Syncing is done with 3 different stages.
1. Initial sync
Initial sync is happens on onboarding screen and it starts after login and user details APIs. When initial sync starts syncStage is updated to 1 and syncInProgress updated to true. Initial sync starts from company details API and end on farmer list API. After initial sync user is user will get continue option on onboarding screen to go to home page. Then syncStage is updated to 2, syncInProgress to false and, syncSuccessfull to true.- Company details:
- Project details:
- New farmers:
- New cards:
- Buy transactions:
- Send transactions:
- Transaction invoices:
- Updated farmers:
- Product list:
- Buyer list:
- Farmer list:
2. Transaction sync
Transaction sync happens when user on dashboard after login. syncStage will be 2, transaction list and batch list will be synced from server side to app. After transaction sync, syncStage will be updated to 3. Syncing progress can be see in transaction list page.- Transaction list:
- Batch list