Skip to content

Commit

Permalink
Fixing transaction crash when pairing HRM while workout is recorded #269
Browse files Browse the repository at this point in the history


Solution: move read elements out of the write transaction
  • Loading branch information
MrCsabaToth committed Jul 20, 2023
1 parent 9453360 commit f145b87
Showing 1 changed file with 2 additions and 2 deletions.
4 changes: 2 additions & 2 deletions lib/ui/recording.dart
Original file line number Diff line number Diff line change
Expand Up @@ -2345,9 +2345,9 @@ class RecordingState extends State<RecordingScreen> {
);
String hrmId = await _initializeHeartRateMonitor(true);
if (hrmId.isNotEmpty && _activity != null && (_activity!.hrmId != hrmId)) {
_activity!.hrmId = hrmId;
_activity!.hrmCalorieFactor = await DbUtils().calorieFactorValue(hrmId, true);
_database.writeTxnSync(() async {
_activity!.hrmId = hrmId;
_activity!.hrmCalorieFactor = await DbUtils().calorieFactorValue(hrmId, true);
_database.activitys.putSync(_activity!);
});
}
Expand Down

0 comments on commit f145b87

Please sign in to comment.