Skip to content

Commit

Permalink
Tries to wiggle ears
Browse files Browse the repository at this point in the history
  • Loading branch information
Codel1417 committed Dec 26, 2024
1 parent 8964355 commit 3d569da
Showing 1 changed file with 12 additions and 3 deletions.
15 changes: 12 additions & 3 deletions lib/Backend/sensors.dart
Original file line number Diff line number Diff line change
Expand Up @@ -241,13 +241,22 @@ abstract class TriggerDefinition extends ChangeNotifier implements Comparable<Tr
actionsToRun.add(baseAction);
}
//only adding a check here
if (baseAction != null && (!baseAction.deviceCategory.toSet().containsAll(flattenedDeviceTypes) || (baseAction is CommandAction && hasLegacyEars))) {
if (baseAction != null && ((baseAction is CommandAction && hasLegacyEars) || !baseAction.deviceCategory.toSet().containsAll(flattenedDeviceTypes) || (baseAction is EarsMoveList && !hasLegacyEars))) {
// find the missing device type
// The goal here is if a user selects multiple moves, send a move to all gear
final Set<DeviceType> missingGearAction = baseAction.deviceCategory
.whereNot(
.where(
// filtering out the first actions ears entry if its a unified move but legacy gear is connected
(element) => DeviceType.ears == element && baseAction is CommandAction && hasLegacyEars,
(element) {
if (DeviceType.ears == element) {
if (baseAction is CommandAction && hasLegacyEars) {
return false;
} else if (baseAction is EarsMoveList && !hasLegacyEars) {
return false;
}
}
return true;
},
)
.toSet()
.difference(flattenedDeviceTypes);
Expand Down

0 comments on commit 3d569da

Please sign in to comment.