Skip to content

Commit

Permalink
[flutter_local_notifications] fixed custom sound not working in examp…
Browse files Browse the repository at this point in the history
…le 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
  • Loading branch information
MaikuB committed May 18, 2023
1 parent ee0c200 commit cb07cdd
Show file tree
Hide file tree
Showing 5 changed files with 15 additions and 2 deletions.
2 changes: 2 additions & 0 deletions flutter_local_notifications/CHANGELOG.md
Original file line number Diff line number Diff line change
@@ -1,6 +1,8 @@
# [14.0.1]

* [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
* [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 []
* 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

# [14.0.0+2]

Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -209,6 +209,7 @@ static void rescheduleNotifications(Context context) {
scheduleNotification(context, notificationDetails, false);
}
} catch (ExactAlarmPermissionException e) {
// TODO: update tag used to match name of class
Log.e("notification", e.getMessage());
removeNotificationFromCache(context, notificationDetails.id);
}
Expand All @@ -227,6 +228,7 @@ static void scheduleNextNotification(Context context, NotificationDetails notifi
removeNotificationFromCache(context, notificationDetails.id);
}
} catch (ExactAlarmPermissionException e) {
// TODO: update tag used to match name of class
Log.e("notification", e.getMessage());
removeNotificationFromCache(context, notificationDetails.id);
}
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -20,6 +20,8 @@
@Keep
public class ScheduledNotificationReceiver extends BroadcastReceiver {

private static final String TAG = "ScheduledNotificationReceiver";

@Override
@SuppressWarnings("deprecation")
public void onReceive(final Context context, Intent intent) {
Expand All @@ -40,7 +42,7 @@ public void onReceive(final Context context, Intent intent) {
if (notification == null) {
// This means the notification is corrupt
FlutterLocalNotificationsPlugin.removeNotificationFromCache(context, notificationId);
Log.e("notification", "Failed to parse a notification from Intent. ID: " + notificationId);
Log.e(TAG, "Failed to parse a notification from Intent. ID: " + notificationId);
return;
}

Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -10,6 +10,7 @@
1498D2341E8E89220040F4C2 /* GeneratedPluginRegistrant.m in Sources */ = {isa = PBXBuildFile; fileRef = 1498D2331E8E89220040F4C2 /* GeneratedPluginRegistrant.m */; };
331C808B294A63AB00263BE5 /* RunnerTests.swift in Sources */ = {isa = PBXBuildFile; fileRef = 331C807B294A618700263BE5 /* RunnerTests.swift */; };
3B3967161E833CAA004F5970 /* AppFrameworkInfo.plist in Resources */ = {isa = PBXBuildFile; fileRef = 3B3967151E833CAA004F5970 /* AppFrameworkInfo.plist */; };
51FDB9D02A164225005F209C /* slow_spring_board.aiff in Resources */ = {isa = PBXBuildFile; fileRef = 51FDB9CF2A164225005F209C /* slow_spring_board.aiff */; };
63B386FB12F6C421C8C4FA12 /* Pods_Runner.framework in Frameworks */ = {isa = PBXBuildFile; fileRef = 0BF8A02F46B02144A4EE82AD /* Pods_Runner.framework */; };
74858FAF1ED2DC5600515810 /* AppDelegate.swift in Sources */ = {isa = PBXBuildFile; fileRef = 74858FAE1ED2DC5600515810 /* AppDelegate.swift */; };
97C146FC1CF9000F007C117D /* Main.storyboard in Resources */ = {isa = PBXBuildFile; fileRef = 97C146FA1CF9000F007C117D /* Main.storyboard */; };
Expand Down Expand Up @@ -49,6 +50,7 @@
331C8081294A63A400263BE5 /* RunnerTests.xctest */ = {isa = PBXFileReference; explicitFileType = wrapper.cfbundle; includeInIndex = 0; path = RunnerTests.xctest; sourceTree = BUILT_PRODUCTS_DIR; };
3B3967151E833CAA004F5970 /* AppFrameworkInfo.plist */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = text.plist.xml; name = AppFrameworkInfo.plist; path = Flutter/AppFrameworkInfo.plist; sourceTree = "<group>"; };
519146162A0D159A0093315A /* Runner.entitlements */ = {isa = PBXFileReference; lastKnownFileType = text.plist.entitlements; path = Runner.entitlements; sourceTree = "<group>"; };
51FDB9CF2A164225005F209C /* slow_spring_board.aiff */ = {isa = PBXFileReference; lastKnownFileType = audio.aiff; path = slow_spring_board.aiff; sourceTree = SOURCE_ROOT; };
74858FAD1ED2DC5600515810 /* Runner-Bridging-Header.h */ = {isa = PBXFileReference; lastKnownFileType = sourcecode.c.h; path = "Runner-Bridging-Header.h"; sourceTree = "<group>"; };
74858FAE1ED2DC5600515810 /* AppDelegate.swift */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = sourcecode.swift; path = AppDelegate.swift; sourceTree = "<group>"; };
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>"; };
Expand Down Expand Up @@ -158,6 +160,7 @@
97C146FD1CF9000F007C117D /* Assets.xcassets */,
97C146FF1CF9000F007C117D /* LaunchScreen.storyboard */,
97C147021CF9000F007C117D /* Info.plist */,
51FDB9CF2A164225005F209C /* slow_spring_board.aiff */,
1498D2321E8E86230040F4C2 /* GeneratedPluginRegistrant.h */,
1498D2331E8E89220040F4C2 /* GeneratedPluginRegistrant.m */,
74858FAE1ED2DC5600515810 /* AppDelegate.swift */,
Expand Down Expand Up @@ -260,6 +263,7 @@
isa = PBXResourcesBuildPhase;
buildActionMask = 2147483647;
files = (
51FDB9D02A164225005F209C /* slow_spring_board.aiff in Resources */,
97C147011CF9000F007C117D /* LaunchScreen.storyboard in Resources */,
3B3967161E833CAA004F5970 /* AppFrameworkInfo.plist in Resources */,
97C146FE1CF9000F007C117D /* Assets.xcassets in Resources */,
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -27,6 +27,7 @@
33CC10F32044A3C60003C045 /* Assets.xcassets in Resources */ = {isa = PBXBuildFile; fileRef = 33CC10F22044A3C60003C045 /* Assets.xcassets */; };
33CC10F62044A3C60003C045 /* MainMenu.xib in Resources */ = {isa = PBXBuildFile; fileRef = 33CC10F42044A3C60003C045 /* MainMenu.xib */; };
33CC11132044BFA00003C045 /* MainFlutterWindow.swift in Sources */ = {isa = PBXBuildFile; fileRef = 33CC11122044BFA00003C045 /* MainFlutterWindow.swift */; };
51E822AE2A1651DC001F46C8 /* slow_spring_board.aiff in Resources */ = {isa = PBXBuildFile; fileRef = 51E822AD2A1651DC001F46C8 /* slow_spring_board.aiff */; };
657809547EB3AD4172B38459 /* Pods_RunnerTests.framework in Frameworks */ = {isa = PBXBuildFile; fileRef = 0069709919003DD140C8AD9F /* Pods_RunnerTests.framework */; };
CD9BCC5ECA02DC53860B0BFB /* Pods_Runner.framework in Frameworks */ = {isa = PBXBuildFile; fileRef = CA68CEEE9BB4B28E560C3F7C /* Pods_Runner.framework */; };
/* End PBXBuildFile section */
Expand Down Expand Up @@ -83,6 +84,7 @@
33E5194F232828860026EE4D /* AppInfo.xcconfig */ = {isa = PBXFileReference; lastKnownFileType = text.xcconfig; path = AppInfo.xcconfig; sourceTree = "<group>"; };
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>"; };
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>"; };
51E822AD2A1651DC001F46C8 /* slow_spring_board.aiff */ = {isa = PBXFileReference; lastKnownFileType = audio.aiff; path = slow_spring_board.aiff; sourceTree = "<group>"; };
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>"; };
7AFA3C8E1D35360C0083082E /* Release.xcconfig */ = {isa = PBXFileReference; lastKnownFileType = text.xcconfig; path = Release.xcconfig; sourceTree = "<group>"; };
9740EEB21CF90195004384FC /* Debug.xcconfig */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = text.xcconfig; path = Debug.xcconfig; sourceTree = "<group>"; };
Expand Down Expand Up @@ -120,7 +122,6 @@
20D524D03B0EFE97FAD48BB9 /* Pods-RunnerTests.release.xcconfig */,
7802D350CC555DD4C555B119 /* Pods-RunnerTests.profile.xcconfig */,
);
name = Pods;
path = Pods;
sourceTree = "<group>";
};
Expand Down Expand Up @@ -167,6 +168,7 @@
33CC11242044D66E0003C045 /* Resources */ = {
isa = PBXGroup;
children = (
51E822AD2A1651DC001F46C8 /* slow_spring_board.aiff */,
33CC10F22044A3C60003C045 /* Assets.xcassets */,
33CC10F42044A3C60003C045 /* MainMenu.xib */,
33CC10F72044A3C60003C045 /* Info.plist */,
Expand Down Expand Up @@ -314,6 +316,7 @@
isa = PBXResourcesBuildPhase;
buildActionMask = 2147483647;
files = (
51E822AE2A1651DC001F46C8 /* slow_spring_board.aiff in Resources */,
33CC10F32044A3C60003C045 /* Assets.xcassets in Resources */,
33CC10F62044A3C60003C045 /* MainMenu.xib in Resources */,
);
Expand Down

0 comments on commit cb07cdd

Please sign in to comment.