Skip to content

Commit

Permalink
Fix notification not working on release build
Browse files Browse the repository at this point in the history
  • Loading branch information
dihak committed Oct 2, 2024
1 parent c477e0c commit 3290d5b
Show file tree
Hide file tree
Showing 7 changed files with 28 additions and 16 deletions.
9 changes: 8 additions & 1 deletion android/app/proguard-rules.pro
Original file line number Diff line number Diff line change
Expand Up @@ -29,4 +29,11 @@
# Prevent R8 from leaving Data object members always null
-keepclassmembers,allowobfuscation class * {
@com.google.gson.annotations.SerializedName <fields>;
}
}

# Retain org.xmlpull classes
-keep class org.xmlpull.** { *; }

# Retain generic signatures of TypeToken and its subclasses with R8 version 3.0 and higher.
-keep,allowobfuscation,allowshrinking class com.google.gson.reflect.TypeToken
-keep,allowobfuscation,allowshrinking class * extends com.google.gson.reflect.TypeToken
11 changes: 0 additions & 11 deletions android/app/src/debug/AndroidManifest.xml
Original file line number Diff line number Diff line change
Expand Up @@ -18,16 +18,5 @@
<category android:name="android.intent.category.LAUNCHER"/>
</intent-filter>
</activity>

<receiver android:exported="false" android:name="com.dexterous.flutterlocalnotifications.ScheduledNotificationReceiver" />
<receiver android:exported="false" android:name="com.dexterous.flutterlocalnotifications.ScheduledNotificationBootReceiver">
<intent-filter>
<action android:name="android.intent.action.BOOT_COMPLETED"/>
<action android:name="android.intent.action.MY_PACKAGE_REPLACED"/>
<action android:name="android.intent.action.QUICKBOOT_POWERON" />
<action android:name="com.htc.intent.action.QUICKBOOT_POWERON"/>
</intent-filter>
</receiver>
<receiver android:exported="false" android:name="com.dexterous.flutterlocalnotifications.ActionBroadcastReceiver" />
</application>
</manifest>
2 changes: 1 addition & 1 deletion lib/models/notification.dart
Original file line number Diff line number Diff line change
Expand Up @@ -54,7 +54,7 @@ Future initializeNotification(BuildContext context) async {
// Request notification permissions for Android 13 or higher
final androidImplementation = flutterLocalNotificationsPlugin
.resolvePlatformSpecificImplementation<AndroidFlutterLocalNotificationsPlugin>();
await androidImplementation?.requestExactAlarmsPermission();
await androidImplementation?.requestNotificationsPermission();

// Create the notification channel
const AndroidNotificationChannel channel = AndroidNotificationChannel(
Expand Down
1 change: 0 additions & 1 deletion lib/pages/detail/modal/edit.dart
Original file line number Diff line number Diff line change
@@ -1,6 +1,5 @@
import 'package:flutter/material.dart';
import 'package:istiqomah/constants/app.dart';
import 'package:istiqomah/constants/app_theme.dart';
import 'package:istiqomah/models/habit.dart';

class _ModalEditHabit extends StatefulWidget {
Expand Down
4 changes: 2 additions & 2 deletions lib/pages/home/modal/add.dart
Original file line number Diff line number Diff line change
Expand Up @@ -152,7 +152,7 @@ class _ModalAddHabitState extends State<_ModalAddHabit> {
onPressed: () {
showTimePicker(
context: context,
initialTime: selectedTime!,
initialTime: selectedTime,
).then(
(value) {
if (value == null) return;
Expand All @@ -163,7 +163,7 @@ class _ModalAddHabitState extends State<_ModalAddHabit> {
);
},
child: Text(
getTime(selectedTime!),
getTime(selectedTime),
style: TextStyle(fontSize: 18, fontWeight: FontWeight.bold),
),
),
Expand Down
16 changes: 16 additions & 0 deletions pubspec.lock
Original file line number Diff line number Diff line change
Expand Up @@ -110,6 +110,14 @@ packages:
description: flutter
source: sdk
version: "0.0.0"
flutter_lints:
dependency: "direct dev"
description:
name: flutter_lints
sha256: "5398f14efa795ffb7a33e9b6a08798b26a180edac4ad7db3f231e40f82ce11e1"
url: "https://pub.dev"
source: hosted
version: "5.0.0"
flutter_local_notifications:
dependency: "direct main"
description:
Expand Down Expand Up @@ -200,6 +208,14 @@ packages:
url: "https://pub.dev"
source: hosted
version: "3.0.1"
lints:
dependency: transitive
description:
name: lints
sha256: "3315600f3fb3b135be672bf4a178c55f274bebe368325ae18462c89ac1e3b413"
url: "https://pub.dev"
source: hosted
version: "5.0.0"
matcher:
dependency: transitive
description:
Expand Down
1 change: 1 addition & 0 deletions pubspec.yaml
Original file line number Diff line number Diff line change
Expand Up @@ -40,6 +40,7 @@ dependencies:
dev_dependencies:
flutter_test:
sdk: flutter
flutter_lints: ^5.0.0

# For information on the generic Dart part of this file, see the
# following page: https://dart.dev/tools/pub/pubspec
Expand Down

0 comments on commit 3290d5b

Please sign in to comment.