Skip to content

Commit

Permalink
Added null check
Browse files Browse the repository at this point in the history
  • Loading branch information
hoffmatteo committed Jan 29, 2024
1 parent 7b4068e commit c20121b
Show file tree
Hide file tree
Showing 2 changed files with 11 additions and 5 deletions.
Original file line number Diff line number Diff line change
Expand Up @@ -243,7 +243,7 @@ class HealthPlugin(private var channel: MethodChannel? = null) :
// "BIATHLON" to ExerciseSessionRecord.EXERCISE_TYPE_BIATHLON,
"BIKING" to ExerciseSessionRecord.EXERCISE_TYPE_BIKING,
// "BIKING_HAND" to ExerciseSessionRecord.EXERCISE_TYPE_BIKING_HAND,
// "BIKING_MOUNTAIN" to ExerciseSessionRecord.EXERCISE_TYPE_BIKING_MOUNTAIN,
//"BIKING_MOUNTAIN" to ExerciseSessionRecord.EXERCISE_TYPE_BIKING_MOUNTAIN,
// "BIKING_ROAD" to ExerciseSessionRecord.EXERCISE_TYPE_BIKING_ROAD,
// "BIKING_SPINNING" to ExerciseSessionRecord.EXERCISE_TYPE_BIKING_SPINNING,
// "BIKING_STATIONARY" to ExerciseSessionRecord.EXERCISE_TYPE_BIKING_STATIONARY,
Expand Down Expand Up @@ -2168,6 +2168,11 @@ class HealthPlugin(private var channel: MethodChannel? = null) :
val endTime = Instant.ofEpochMilli(call.argument<Long>("endTime")!!)
val totalEnergyBurned = call.argument<Int>("totalEnergyBurned")
val totalDistance = call.argument<Int>("totalDistance")
if(workoutTypeMapHealthConnect.containsKey(type) == false) {
result.success(false)
Log.w("FLUTTER_HEALTH::ERROR", "[Health Connect] Workout type not supported")
return
}
val workoutType = workoutTypeMapHealthConnect[type]!!

scope.launch {
Expand Down
9 changes: 5 additions & 4 deletions packages/health/lib/src/health_factory.dart
Original file line number Diff line number Diff line change
Expand Up @@ -787,8 +787,9 @@ class HealthFactory {
HealthWorkoutActivityType.WALKING,
HealthWorkoutActivityType.WATER_POLO,
HealthWorkoutActivityType.YOGA,

// Android only
// Once Google Fit is removed, this list needs to be changed
HealthWorkoutActivityType.AEROBICS,
HealthWorkoutActivityType.BIATHLON,
HealthWorkoutActivityType.BIKING_HAND,
Expand Down Expand Up @@ -822,13 +823,13 @@ class HealthFactory {
HealthWorkoutActivityType.P90X,
HealthWorkoutActivityType.PARAGLIDING,
HealthWorkoutActivityType.POLO,
HealthWorkoutActivityType.ROCK_CLIMBING,
HealthWorkoutActivityType.ROCK_CLIMBING,
HealthWorkoutActivityType.ROWING_MACHINE,
HealthWorkoutActivityType.RUNNING_JOGGING,
HealthWorkoutActivityType.RUNNING_SAND,
HealthWorkoutActivityType.RUNNING_SAND,
HealthWorkoutActivityType.RUNNING_TREADMILL,
HealthWorkoutActivityType.SCUBA_DIVING,
HealthWorkoutActivityType.SKATING_CROSS,
HealthWorkoutActivityType.SKATING_CROSS,
HealthWorkoutActivityType.SKATING_INDOOR,
HealthWorkoutActivityType.SKATING_INLINE,
HealthWorkoutActivityType.SKIING,
Expand Down

0 comments on commit c20121b

Please sign in to comment.