Skip to content

Option to sync a case before viewing it#3237

Open
chrisekelley wants to merge 4 commits intodevelopfrom
3235_sync-case-if-online
Open

Option to sync a case before viewing it#3237
chrisekelley wants to merge 4 commits intodevelopfrom
3235_sync-case-if-online

Conversation

@chrisekelley
Copy link
Member

New syncCaseIfOnline property for app-config.json
Configure this feature in settings
New pulldoc function in sync-couchdb service to sync a single doc.

[List the issues fixed and any other relevant issues]

Type of Change

[Please delete irrelevant options]

  • New feature (non-breaking change which adds functionality)
  • This change requires a documentation update

New syncCaseIfOnline property for app-config.json
Configure this feature in settings
New pulldoc function in sync-couchdb service to sync a single doc.
const expiryTimestamp = syncSessionUrlParts[6].split(':')[0];
const timeLeftInToken = Date.now() - parseInt(expiryTimestamp)
const expiryWindow = 1000 * 60 * 60 * 2; // 2 hours in milliseconds
if (timeLeftInToken < expiryWindow) {
Copy link
Member Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

This will expire every 2 hours. Currently calculating age of token. Check : const timeLeftInToken = 24 - Date.now() - parseInt(tokenCreationTime)

if (timeLeftInToken < expiryWindow) {
// token has expired
syncSessionInfo = <SyncSessionInfo>await this.http.get(`${syncDetails.serverUrl}sync-session-v2/start/${syncDetails.groupId}/${syncDetails.deviceId}/${syncDetails.deviceToken}`).toPromise()
}
Copy link
Member Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

be sure to persist this: await this.variableService.set('syncSessionInfo', syncSessionInfo)

const appConfig = await this.appConfigService.getAppConfig()
let batchSize = appConfig.batchSize || 100
const device = await this.deviceService.getDevice()
const formInfos = await this.tangyFormsInfoService.getFormsInfo()
Copy link
Member Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

don't need formInfos and maybe other stuff...

ProcessMonitorDialogComponent
caseUpdated field is updated when case is updated.
Moved syncDoc in case.service to sync-couchdb.service
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

None yet

Projects

None yet

Development

Successfully merging this pull request may close these issues.

1 participant