1
0
mirror of https://github.com/laurent22/joplin.git synced 2025-06-27 23:28:38 +02:00

Android: Fixes #7791: Fixed issue where app would close after sharing a file

This commit is contained in:
Laurent Cozic
2023-02-20 16:05:00 +00:00
parent f2995dd196
commit 25a31b0689
5 changed files with 53 additions and 28 deletions

View File

@ -468,9 +468,9 @@ export default class Note extends BaseItem {
return this.modelSelectAll('SELECT * FROM notes WHERE is_conflict = 0');
}
public static async updateGeolocation(noteId: string): Promise<void> {
if (!Setting.value('trackLocation')) return;
if (!Note.updateGeolocationEnabled_) return;
public static async updateGeolocation(noteId: string): Promise<NoteEntity | null> {
if (!Setting.value('trackLocation')) return null;
if (!Note.updateGeolocationEnabled_) return null;
const startWait = time.unixMs();
while (true) {
@ -479,7 +479,7 @@ export default class Note extends BaseItem {
await time.sleep(1);
if (startWait + 1000 * 20 < time.unixMs()) {
this.logger().warn(`Failed to update geolocation for: timeout: ${noteId}`);
return;
return null;
}
}
@ -499,7 +499,7 @@ export default class Note extends BaseItem {
this.geolocationUpdating_ = false;
if (!geoData) return;
if (!geoData) return null;
this.logger().info('Got lat/long');
this.geolocationCache_ = geoData;
@ -508,12 +508,14 @@ export default class Note extends BaseItem {
this.logger().info(`Updating lat/long of note ${noteId}`);
const note = await Note.load(noteId);
if (!note) return; // Race condition - note has been deleted in the meantime
if (!note) return null; // Race condition - note has been deleted in the meantime
note.longitude = geoData.coords.longitude;
note.latitude = geoData.coords.latitude;
note.altitude = geoData.coords.altitude;
await Note.save(note, { ignoreProvisionalFlag: true });
return note;
}
static filter(note: NoteEntity) {