Skip to content

Commit

Permalink
Add function to emit sync completion after media uploads
Browse files Browse the repository at this point in the history
  • Loading branch information
esurface committed Dec 12, 2023
1 parent cdf2bfc commit 7fc3cc4
Show file tree
Hide file tree
Showing 4 changed files with 12 additions and 6 deletions.
4 changes: 4 additions & 0 deletions client/src/app/core/sync-records/_services/syncing.service.ts
Original file line number Diff line number Diff line change
Expand Up @@ -151,4 +151,8 @@ export class SyncingService {
}));
}

emitSyncComplete() {
this.onComplete$.next();
}

}
Original file line number Diff line number Diff line change
Expand Up @@ -122,6 +122,8 @@ export class SyncRecordsComponent implements OnInit {
}

});

this.syncingService.emitSyncComplete();
}
}

Expand Down
2 changes: 2 additions & 0 deletions client/src/app/sync/components/sync/sync.component.ts
Original file line number Diff line number Diff line change
Expand Up @@ -230,6 +230,8 @@ export class SyncComponent implements OnInit, OnDestroy {
} else {
console.log('Not a Cordova App - no media uploads')
}

this.syncService.emitSyncComplete();

}

Expand Down
10 changes: 4 additions & 6 deletions client/src/app/sync/sync.service.ts
Original file line number Diff line number Diff line change
Expand Up @@ -88,12 +88,6 @@ export class SyncService {
}
})

this.syncCouchdbService.onComplete$.subscribe({
next: (replicationStatus) => {
this.onComplete$.next(replicationStatus);
}
})

this.syncCouchdbServiceStartTime = new Date().toISOString()

this.replicationStatus = await this.syncCouchdbService.sync(
Expand Down Expand Up @@ -591,5 +585,9 @@ export class SyncService {
}
return deletedArchivedDocs
}

emitSyncComplete() {
this.onComplete$.next();
}

}

0 comments on commit 7fc3cc4

Please sign in to comment.