forked from MapComplete/MapComplete
Feature(offline): attempt to upload pictures when connection is restored
This commit is contained in:
parent
3d225655df
commit
dd0ed24f3b
1 changed files with 9 additions and 2 deletions
|
@ -82,10 +82,17 @@ export class ImageUploadManager {
|
||||||
this._changes = changes
|
this._changes = changes
|
||||||
this._gps = gpsLocation
|
this._gps = gpsLocation
|
||||||
this._reportError = reportError
|
this._reportError = reportError
|
||||||
Stores.chronic(5 * 60000).addCallback(() => {
|
Stores.chronic(5 * 60000).addCallback(async () => {
|
||||||
// If images failed to upload: attempt to reupload
|
// If images failed to upload: attempt to reupload
|
||||||
this.uploadQueue()
|
await this.uploadQueue()
|
||||||
})
|
})
|
||||||
|
|
||||||
|
IsOnline.isOnline.addCallback(async (isOnline) => {
|
||||||
|
if (isOnline) {
|
||||||
|
await this.uploadQueue()
|
||||||
|
}
|
||||||
|
},
|
||||||
|
)
|
||||||
}
|
}
|
||||||
|
|
||||||
public async canBeUploaded(file: File): Promise<true | { error: Translation }> {
|
public async canBeUploaded(file: File): Promise<true | { error: Translation }> {
|
||||||
|
|
Loading…
Add table
Add a link
Reference in a new issue