Skip to content

Commit cb07cdd

Browse files
authored
[flutter_local_notifications] fixed custom sound not working in example app on iOS and macOS (#2003)
* readd custom side to example app on ios * readded sound to example app on macos * update tag used for writing error log message on android when a corrupt scheduled notification is encountered and update related changelog entry * add todo comments to update tag used when logging error message for exact alarm permission being revoked
1 parent ee0c200 commit cb07cdd

File tree

5 files changed

+15
-2
lines changed

5 files changed

+15
-2
lines changed

flutter_local_notifications/CHANGELOG.md

Lines changed: 2 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -1,6 +1,8 @@
11
# [14.0.1]
22

33
* [Android] fixed issue [1991](https://github.com/MaikuB/flutter_local_notifications/issues/1991) where tapping on a notification action with `showUserInterface` set to true whilst app is terminated wouldn't dismiss/cancel notification
4+
* [Android] updated logic when trying to show a scheduled notification so that receiver would remove a corrupt notification to avoid exceptions from occurring over and over again. An message will be written to error log when this occurs as well. Thanks to the PR from []
5+
* Fixed example app on iOS and macOS so it would play the custom sound as this step was missed in previous released where the iOS and macOS side was recreated
46

57
# [14.0.0+2]
68

flutter_local_notifications/android/src/main/java/com/dexterous/flutterlocalnotifications/FlutterLocalNotificationsPlugin.java

Lines changed: 2 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -209,6 +209,7 @@ static void rescheduleNotifications(Context context) {
209209
scheduleNotification(context, notificationDetails, false);
210210
}
211211
} catch (ExactAlarmPermissionException e) {
212+
// TODO: update tag used to match name of class
212213
Log.e("notification", e.getMessage());
213214
removeNotificationFromCache(context, notificationDetails.id);
214215
}
@@ -227,6 +228,7 @@ static void scheduleNextNotification(Context context, NotificationDetails notifi
227228
removeNotificationFromCache(context, notificationDetails.id);
228229
}
229230
} catch (ExactAlarmPermissionException e) {
231+
// TODO: update tag used to match name of class
230232
Log.e("notification", e.getMessage());
231233
removeNotificationFromCache(context, notificationDetails.id);
232234
}

flutter_local_notifications/android/src/main/java/com/dexterous/flutterlocalnotifications/ScheduledNotificationReceiver.java

Lines changed: 3 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -20,6 +20,8 @@
2020
@Keep
2121
public class ScheduledNotificationReceiver extends BroadcastReceiver {
2222

23+
private static final String TAG = "ScheduledNotificationReceiver";
24+
2325
@Override
2426
@SuppressWarnings("deprecation")
2527
public void onReceive(final Context context, Intent intent) {
@@ -40,7 +42,7 @@ public void onReceive(final Context context, Intent intent) {
4042
if (notification == null) {
4143
// This means the notification is corrupt
4244
FlutterLocalNotificationsPlugin.removeNotificationFromCache(context, notificationId);
43-
Log.e("notification", "Failed to parse a notification from Intent. ID: " + notificationId);
45+
Log.e(TAG, "Failed to parse a notification from Intent. ID: " + notificationId);
4446
return;
4547
}
4648

flutter_local_notifications/example/ios/Runner.xcodeproj/project.pbxproj

Lines changed: 4 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -10,6 +10,7 @@
1010
1498D2341E8E89220040F4C2 /* GeneratedPluginRegistrant.m in Sources */ = {isa = PBXBuildFile; fileRef = 1498D2331E8E89220040F4C2 /* GeneratedPluginRegistrant.m */; };
1111
331C808B294A63AB00263BE5 /* RunnerTests.swift in Sources */ = {isa = PBXBuildFile; fileRef = 331C807B294A618700263BE5 /* RunnerTests.swift */; };
1212
3B3967161E833CAA004F5970 /* AppFrameworkInfo.plist in Resources */ = {isa = PBXBuildFile; fileRef = 3B3967151E833CAA004F5970 /* AppFrameworkInfo.plist */; };
13+
51FDB9D02A164225005F209C /* slow_spring_board.aiff in Resources */ = {isa = PBXBuildFile; fileRef = 51FDB9CF2A164225005F209C /* slow_spring_board.aiff */; };
1314
63B386FB12F6C421C8C4FA12 /* Pods_Runner.framework in Frameworks */ = {isa = PBXBuildFile; fileRef = 0BF8A02F46B02144A4EE82AD /* Pods_Runner.framework */; };
1415
74858FAF1ED2DC5600515810 /* AppDelegate.swift in Sources */ = {isa = PBXBuildFile; fileRef = 74858FAE1ED2DC5600515810 /* AppDelegate.swift */; };
1516
97C146FC1CF9000F007C117D /* Main.storyboard in Resources */ = {isa = PBXBuildFile; fileRef = 97C146FA1CF9000F007C117D /* Main.storyboard */; };
@@ -49,6 +50,7 @@
4950
331C8081294A63A400263BE5 /* RunnerTests.xctest */ = {isa = PBXFileReference; explicitFileType = wrapper.cfbundle; includeInIndex = 0; path = RunnerTests.xctest; sourceTree = BUILT_PRODUCTS_DIR; };
5051
3B3967151E833CAA004F5970 /* AppFrameworkInfo.plist */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = text.plist.xml; name = AppFrameworkInfo.plist; path = Flutter/AppFrameworkInfo.plist; sourceTree = "<group>"; };
5152
519146162A0D159A0093315A /* Runner.entitlements */ = {isa = PBXFileReference; lastKnownFileType = text.plist.entitlements; path = Runner.entitlements; sourceTree = "<group>"; };
53+
51FDB9CF2A164225005F209C /* slow_spring_board.aiff */ = {isa = PBXFileReference; lastKnownFileType = audio.aiff; path = slow_spring_board.aiff; sourceTree = SOURCE_ROOT; };
5254
74858FAD1ED2DC5600515810 /* Runner-Bridging-Header.h */ = {isa = PBXFileReference; lastKnownFileType = sourcecode.c.h; path = "Runner-Bridging-Header.h"; sourceTree = "<group>"; };
5355
74858FAE1ED2DC5600515810 /* AppDelegate.swift */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = sourcecode.swift; path = AppDelegate.swift; sourceTree = "<group>"; };
5456
76B4846597897AEF6BBCF228 /* Pods-Runner.profile.xcconfig */ = {isa = PBXFileReference; includeInIndex = 1; lastKnownFileType = text.xcconfig; name = "Pods-Runner.profile.xcconfig"; path = "Target Support Files/Pods-Runner/Pods-Runner.profile.xcconfig"; sourceTree = "<group>"; };
@@ -158,6 +160,7 @@
158160
97C146FD1CF9000F007C117D /* Assets.xcassets */,
159161
97C146FF1CF9000F007C117D /* LaunchScreen.storyboard */,
160162
97C147021CF9000F007C117D /* Info.plist */,
163+
51FDB9CF2A164225005F209C /* slow_spring_board.aiff */,
161164
1498D2321E8E86230040F4C2 /* GeneratedPluginRegistrant.h */,
162165
1498D2331E8E89220040F4C2 /* GeneratedPluginRegistrant.m */,
163166
74858FAE1ED2DC5600515810 /* AppDelegate.swift */,
@@ -260,6 +263,7 @@
260263
isa = PBXResourcesBuildPhase;
261264
buildActionMask = 2147483647;
262265
files = (
266+
51FDB9D02A164225005F209C /* slow_spring_board.aiff in Resources */,
263267
97C147011CF9000F007C117D /* LaunchScreen.storyboard in Resources */,
264268
3B3967161E833CAA004F5970 /* AppFrameworkInfo.plist in Resources */,
265269
97C146FE1CF9000F007C117D /* Assets.xcassets in Resources */,

flutter_local_notifications/example/macos/Runner.xcodeproj/project.pbxproj

Lines changed: 4 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -27,6 +27,7 @@
2727
33CC10F32044A3C60003C045 /* Assets.xcassets in Resources */ = {isa = PBXBuildFile; fileRef = 33CC10F22044A3C60003C045 /* Assets.xcassets */; };
2828
33CC10F62044A3C60003C045 /* MainMenu.xib in Resources */ = {isa = PBXBuildFile; fileRef = 33CC10F42044A3C60003C045 /* MainMenu.xib */; };
2929
33CC11132044BFA00003C045 /* MainFlutterWindow.swift in Sources */ = {isa = PBXBuildFile; fileRef = 33CC11122044BFA00003C045 /* MainFlutterWindow.swift */; };
30+
51E822AE2A1651DC001F46C8 /* slow_spring_board.aiff in Resources */ = {isa = PBXBuildFile; fileRef = 51E822AD2A1651DC001F46C8 /* slow_spring_board.aiff */; };
3031
657809547EB3AD4172B38459 /* Pods_RunnerTests.framework in Frameworks */ = {isa = PBXBuildFile; fileRef = 0069709919003DD140C8AD9F /* Pods_RunnerTests.framework */; };
3132
CD9BCC5ECA02DC53860B0BFB /* Pods_Runner.framework in Frameworks */ = {isa = PBXBuildFile; fileRef = CA68CEEE9BB4B28E560C3F7C /* Pods_Runner.framework */; };
3233
/* End PBXBuildFile section */
@@ -83,6 +84,7 @@
8384
33E5194F232828860026EE4D /* AppInfo.xcconfig */ = {isa = PBXFileReference; lastKnownFileType = text.xcconfig; path = AppInfo.xcconfig; sourceTree = "<group>"; };
8485
3BDD800640D907FE1E1D4888 /* Pods-Runner.debug.xcconfig */ = {isa = PBXFileReference; includeInIndex = 1; lastKnownFileType = text.xcconfig; name = "Pods-Runner.debug.xcconfig"; path = "Target Support Files/Pods-Runner/Pods-Runner.debug.xcconfig"; sourceTree = "<group>"; };
8586
4C8804F1C9052D291A328225 /* Pods-Runner.release.xcconfig */ = {isa = PBXFileReference; includeInIndex = 1; lastKnownFileType = text.xcconfig; name = "Pods-Runner.release.xcconfig"; path = "Target Support Files/Pods-Runner/Pods-Runner.release.xcconfig"; sourceTree = "<group>"; };
87+
51E822AD2A1651DC001F46C8 /* slow_spring_board.aiff */ = {isa = PBXFileReference; lastKnownFileType = audio.aiff; path = slow_spring_board.aiff; sourceTree = "<group>"; };
8688
7802D350CC555DD4C555B119 /* Pods-RunnerTests.profile.xcconfig */ = {isa = PBXFileReference; includeInIndex = 1; lastKnownFileType = text.xcconfig; name = "Pods-RunnerTests.profile.xcconfig"; path = "Target Support Files/Pods-RunnerTests/Pods-RunnerTests.profile.xcconfig"; sourceTree = "<group>"; };
8789
7AFA3C8E1D35360C0083082E /* Release.xcconfig */ = {isa = PBXFileReference; lastKnownFileType = text.xcconfig; path = Release.xcconfig; sourceTree = "<group>"; };
8890
9740EEB21CF90195004384FC /* Debug.xcconfig */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = text.xcconfig; path = Debug.xcconfig; sourceTree = "<group>"; };
@@ -120,7 +122,6 @@
120122
20D524D03B0EFE97FAD48BB9 /* Pods-RunnerTests.release.xcconfig */,
121123
7802D350CC555DD4C555B119 /* Pods-RunnerTests.profile.xcconfig */,
122124
);
123-
name = Pods;
124125
path = Pods;
125126
sourceTree = "<group>";
126127
};
@@ -167,6 +168,7 @@
167168
33CC11242044D66E0003C045 /* Resources */ = {
168169
isa = PBXGroup;
169170
children = (
171+
51E822AD2A1651DC001F46C8 /* slow_spring_board.aiff */,
170172
33CC10F22044A3C60003C045 /* Assets.xcassets */,
171173
33CC10F42044A3C60003C045 /* MainMenu.xib */,
172174
33CC10F72044A3C60003C045 /* Info.plist */,
@@ -314,6 +316,7 @@
314316
isa = PBXResourcesBuildPhase;
315317
buildActionMask = 2147483647;
316318
files = (
319+
51E822AE2A1651DC001F46C8 /* slow_spring_board.aiff in Resources */,
317320
33CC10F32044A3C60003C045 /* Assets.xcassets in Resources */,
318321
33CC10F62044A3C60003C045 /* MainMenu.xib in Resources */,
319322
);

0 commit comments

Comments
 (0)