Skip to content

Commit

Permalink
refactor(plugin): set default sensor config to all sensors
Browse files Browse the repository at this point in the history
  • Loading branch information
matey97 committed Jul 30, 2022
1 parent 5e0c05e commit e9a9c8b
Showing 1 changed file with 8 additions and 4 deletions.
12 changes: 8 additions & 4 deletions src/wearos-sensors.android.ts
Original file line number Diff line number Diff line change
@@ -1,4 +1,4 @@
import { Common, defaultConfig, WearosSensorsConfig } from './wearos-sensors.common';
import { allSensors, Common, defaultConfig, WearosSensorsConfig } from './wearos-sensors.common';

import { getCapabilityAdvertiserResultService } from "./internal/communication/capabilities/android/capability-advertiser-result-service.android";
import { getResultMessagingService } from "./internal/communication/messaging/android/messaging-result-service.android";
Expand All @@ -24,9 +24,13 @@ class WearosSensors extends Common {
public async init(config: WearosSensorsConfig = defaultConfig): Promise<void> {
this.wireUpCapabilityAdvertiser();

setEnabledSensors(config.sensors);
if (config.sensors && config.sensors.length > 0) {
this.wireUpSensorComponents(config.sensors);
const sensors = config.sensors
? config.sensors
: allSensors;

setEnabledSensors(sensors);
if (sensors.length > 0) {
this.wireUpSensorComponents(sensors);
}

if (!config.disableWearCommands) {
Expand Down

0 comments on commit e9a9c8b

Please sign in to comment.