diff --git a/lib/data/light_sensor_service.dart b/lib/data/light_sensor_service.dart index 2fc94c5..c837dde 100644 --- a/lib/data/light_sensor_service.dart +++ b/lib/data/light_sensor_service.dart @@ -17,5 +17,10 @@ class LightSensorService { } } - Stream luxStream() => LightSensor.lightSensorStream; + Stream luxStream() { + if (!localPlatform.isAndroid) { + return const Stream.empty(); + } + return LightSensor.lightSensorStream; + } } diff --git a/test/data/light_sensor_service_test.dart b/test/data/light_sensor_service_test.dart index f30bf11..d29b50f 100644 --- a/test/data/light_sensor_service_test.dart +++ b/test/data/light_sensor_service_test.dart @@ -83,4 +83,16 @@ void main() { }); }, ); + + group('luxStream', () { + // test('Android', () async { + // when(() => localPlatform.isAndroid).thenReturn(true); + // expect(service.luxStream(), const Stream.empty()); + // }); + + test('iOS', () async { + when(() => localPlatform.isAndroid).thenReturn(false); + expect(service.luxStream(), const Stream.empty()); + }); + }); } diff --git a/test/data/volume_events_service_test.dart b/test/data/volume_events_service_test.dart index a6f5ae7..f9ef3d6 100644 --- a/test/data/volume_events_service_test.dart +++ b/test/data/volume_events_service_test.dart @@ -11,7 +11,7 @@ void main() { late _MockLocalPlatform localPlatform; late VolumeEventsService service; - + Future? methodCallSuccessHandler(MethodCall methodCall) async { switch (methodCall.method) { case "setVolumeHandling": @@ -58,4 +58,16 @@ void main() { expectLater(service.setVolumeHandling(false), completion(false)); }); }); + + group('volumeButtonsEventStream', () { + // test('Android', () async { + // when(() => localPlatform.isAndroid).thenReturn(true); + // expect(service.volumeButtonsEventStream(), const Stream.empty()); + // }); + + test('iOS', () async { + when(() => localPlatform.isAndroid).thenReturn(false); + expect(service.volumeButtonsEventStream(), const Stream.empty()); + }); + }); }