mirror of
https://codeberg.org/Freeyourgadget/Gadgetbridge
synced 2024-12-01 14:32:54 +01:00
Huami: Persist workout raw details even if gpx has no points
This commit is contained in:
parent
8e270fcbf7
commit
ccfc112e2b
@ -123,19 +123,23 @@ public class FetchSportsDetailsOperation extends AbstractFetchOperation {
|
|||||||
String fileName = FileUtils.makeValidFileName("gadgetbridge-" + trackType.toLowerCase() + "-" + DateTimeUtils.formatIso8601(summary.getStartTime()) + ".gpx");
|
String fileName = FileUtils.makeValidFileName("gadgetbridge-" + trackType.toLowerCase() + "-" + DateTimeUtils.formatIso8601(summary.getStartTime()) + ".gpx");
|
||||||
File targetFile = new File(FileUtils.getExternalFilesDir(), fileName);
|
File targetFile = new File(FileUtils.getExternalFilesDir(), fileName);
|
||||||
|
|
||||||
|
boolean exportGpxSuccess = true;
|
||||||
try {
|
try {
|
||||||
exporter.performExport(track, targetFile);
|
exporter.performExport(track, targetFile);
|
||||||
|
} catch (ActivityTrackExporter.GPXTrackEmptyException ex) {
|
||||||
|
exportGpxSuccess = false;
|
||||||
|
GB.toast(getContext(), "This activity does not contain GPX tracks.", Toast.LENGTH_LONG, GB.ERROR, ex);
|
||||||
|
}
|
||||||
|
|
||||||
try (DBHandler dbHandler = GBApplication.acquireDB()) {
|
try (DBHandler dbHandler = GBApplication.acquireDB()) {
|
||||||
|
if (exportGpxSuccess) {
|
||||||
summary.setGpxTrack(targetFile.getAbsolutePath());
|
summary.setGpxTrack(targetFile.getAbsolutePath());
|
||||||
|
}
|
||||||
if (rawBytesPath != null) {
|
if (rawBytesPath != null) {
|
||||||
summary.setRawDetailsPath(rawBytesPath);
|
summary.setRawDetailsPath(rawBytesPath);
|
||||||
}
|
}
|
||||||
dbHandler.getDaoSession().getBaseActivitySummaryDao().update(summary);
|
dbHandler.getDaoSession().getBaseActivitySummaryDao().update(summary);
|
||||||
}
|
}
|
||||||
} catch (ActivityTrackExporter.GPXTrackEmptyException ex) {
|
|
||||||
GB.toast(getContext(), "This activity does not contain GPX tracks.", Toast.LENGTH_LONG, GB.ERROR, ex);
|
|
||||||
}
|
|
||||||
} catch (Exception ex) {
|
} catch (Exception ex) {
|
||||||
GB.toast(getContext(), "Error getting activity details: " + ex.getMessage(), Toast.LENGTH_LONG, GB.ERROR, ex);
|
GB.toast(getContext(), "Error getting activity details: " + ex.getMessage(), Toast.LENGTH_LONG, GB.ERROR, ex);
|
||||||
parseSuccess = false;
|
parseSuccess = false;
|
||||||
|
Loading…
Reference in New Issue
Block a user