diff --git a/CHANGELOG.md b/CHANGELOG.md index c11f2816..67067ab9 100644 --- a/CHANGELOG.md +++ b/CHANGELOG.md @@ -4,6 +4,7 @@ * Remove [stopOnNotificationOpen] property. * Make notification mandatory so android foreground services can be used. * [Android] Refactor alarm to native android services. +* Replace [volumeMax] with [volume] double property. ## 2.2.0 * [Android] Move alarm service to native code. diff --git a/android/src/main/kotlin/com/gdelataillade/alarm/alarm/AlarmService.kt b/android/src/main/kotlin/com/gdelataillade/alarm/alarm/AlarmService.kt index 9d4439a1..0e0bed98 100644 --- a/android/src/main/kotlin/com/gdelataillade/alarm/alarm/AlarmService.kt +++ b/android/src/main/kotlin/com/gdelataillade/alarm/alarm/AlarmService.kt @@ -89,7 +89,7 @@ class AlarmService : Service() { Log.d("AlarmService", "Error while invoking alarmRinging channel: $e") } - if (volume != -1.0) { + if (volume >= 0.0 && volume <= 1.0) { volumeService?.setVolume(volume, showSystemUI) } diff --git a/example/pubspec.lock b/example/pubspec.lock index 365475d2..2e105762 100644 --- a/example/pubspec.lock +++ b/example/pubspec.lock @@ -7,7 +7,7 @@ packages: path: ".." relative: true source: path - version: "2.2.0" + version: "3.0.0-dev.1" args: dependency: transitive description: @@ -68,10 +68,10 @@ packages: dependency: transitive description: name: dbus - sha256: "6f07cba3f7b3448d42d015bfd3d53fe12e5b36da2423f23838efc1d5fb31a263" + sha256: "365c771ac3b0e58845f39ec6deebc76e3276aa9922b0cc60840712094d9047ac" url: "https://pub.dev" source: hosted - version: "0.7.8" + version: "0.7.10" fake_async: dependency: transitive description: @@ -235,10 +235,10 @@ packages: dependency: transitive description: name: plugin_platform_interface - sha256: da3fdfeccc4d4ff2da8f8c556704c08f912542c5fb3cf2233ed75372384a034d + sha256: f4f88d4a900933e7267e2b353594774fc0d07fb072b47eedcd5b54e1ea3269f8 url: "https://pub.dev" source: hosted - version: "2.1.6" + version: "2.1.7" shared_preferences: dependency: transitive description: @@ -283,10 +283,10 @@ packages: dependency: transitive description: name: shared_preferences_web - sha256: d762709c2bbe80626ecc819143013cc820fa49ca5e363620ee20a8b15a3e3daf + sha256: "7b15ffb9387ea3e237bb7a66b8a23d2147663d391cafc5c8f37b2e7b4bde5d21" url: "https://pub.dev" source: hosted - version: "2.2.1" + version: "2.2.2" shared_preferences_windows: dependency: transitive description: @@ -397,5 +397,5 @@ packages: source: hosted version: "6.4.2" sdks: - dart: ">=3.2.0-194.0.dev <4.0.0" - flutter: ">=3.7.0" + dart: ">=3.2.0 <4.0.0" + flutter: ">=3.16.0" diff --git a/lib/model/alarm_settings.dart b/lib/model/alarm_settings.dart index f4f1909f..a9363cbd 100644 --- a/lib/model/alarm_settings.dart +++ b/lib/model/alarm_settings.dart @@ -92,11 +92,11 @@ class AlarmSettings { dateTime: DateTime.fromMicrosecondsSinceEpoch(json['dateTime'] as int), assetAudioPath: json['assetAudioPath'] as String, loopAudio: json['loopAudio'] as bool, - vibrate: json['vibrate'] != null ? json['vibrate'] as bool : true, + vibrate: json['vibrate'] as bool? ?? true, volume: json['volume'] as double?, fadeDuration: json['fadeDuration'] as double, - notificationTitle: json['notificationTitle'] as String, - notificationBody: json['notificationBody'] as String, + notificationTitle: json['notificationTitle'] as String? ?? '', + notificationBody: json['notificationBody'] as String? ?? '', enableNotificationOnKill: json['enableNotificationOnKill'] as bool? ?? true, androidFullScreenIntent: