Report -1 instead of null for no activity

This commit is contained in:
Joseph Abbey
2024-01-28 13:05:34 +00:00
parent 9f759b1dad
commit 6fc639f17f
2 changed files with 8 additions and 4 deletions

View File

@ -103,13 +103,15 @@ class BackgroundServiceDelegate extends System.ServiceDelegate {
}
];
if (Activity has :getProfileInfo) {
var activity = Activity.getProfileInfo().sport;
var sub_activity = Activity.getProfileInfo().subSport;
data.add({
"state" => Activity.getProfileInfo().sport,
"state" => activity ? activity : -1,
"type" => "sensor",
"unique_id" => "activity"
});
data.add({
"state" => Activity.getProfileInfo().subSport,
"state" => sub_activity ? sub_activity : -1,
"type" => "sensor",
"unique_id" => "sub_activity"
});