Skip to content

Commit ebded84

Browse files
Merge pull request #1115 from mendix/moo/notifee-migration
migration from react-native-push-notification to notifee
2 parents e5e8678 + ec118e7 commit ebded84

12 files changed

Lines changed: 34 additions & 178 deletions

CHANGELOG.md

Lines changed: 4 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -16,6 +16,10 @@ The format is based on [Keep a Changelog](https://keepachangelog.com/en/1.0.0/),
1616

1717
- We have improved the styling where edge-to-edge mode is enabled.
1818

19+
### Changed
20+
21+
- We have migrated from `react-native-push-notification` to `@notifee/react-native` for better new architecture compatibility and enhanced push notification features.
22+
1923
## Fixes
2024

2125
- We have upgraded `@mendix/native` to version 9.0.1

android/build.gradle

Lines changed: 3 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -80,6 +80,9 @@ allprojects {
8080
url "https://maven.scijava.org/content/repositories/jcenter/"
8181
}
8282
maven { url "https://packages.rnd.mendix.com/jcenter" }
83+
maven {
84+
url "$rootDir/../node_modules/@notifee/react-native/android/libs"
85+
}
8386
}
8487

8588
// Build all modules with Android 16KB pages enabled

capabilities-setup-config.json

Lines changed: 0 additions & 18 deletions
Original file line numberDiff line numberDiff line change
@@ -36,24 +36,6 @@
3636
"externalDependencies": [
3737
"me.leolin:ShortcutBadger:1.1.22@aar"
3838
]
39-
},
40-
"ios": {
41-
"AppDelegate": {
42-
"imports": [
43-
"#import <RNCPushNotificationIOS.h>"
44-
],
45-
"didFinishLaunchingWithOptions": [
46-
"UNUserNotificationCenter *center = [UNUserNotificationCenter currentNotificationCenter];",
47-
"center.delegate = MendixAppDelegate.delegate;"
48-
],
49-
"willPresentNotification": [
50-
"completionHandler(UNNotificationPresentationOptionSound | UNNotificationPresentationOptionAlert | UNNotificationPresentationOptionBadge);"
51-
],
52-
"didReceiveNotificationResponse": [
53-
"[RNCPushNotificationIOS didReceiveNotificationResponse:response];",
54-
"completionHandler();"
55-
]
56-
}
5739
}
5840
},
5941
"firebaseAndroid": {

ios/AppDelegate.h

Lines changed: 1 addition & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -1,8 +1,7 @@
11
#import <Foundation/Foundation.h>
22
#import <UIKit/UIKit.h>
3-
#import <UserNotifications/UNUserNotificationCenter.h>
43

5-
@interface AppDelegate : UIResponder<UIApplicationDelegate, UNUserNotificationCenterDelegate>
4+
@interface AppDelegate : UIResponder<UIApplicationDelegate>
65

76
@property (nonatomic, strong) UIWindow *window;
87
@property BOOL shouldOpenInLastApp;

ios/AppDelegate.m

Lines changed: 0 additions & 26 deletions
Original file line numberDiff line numberDiff line change
@@ -11,7 +11,6 @@ @implementation AppDelegate
1111

1212
- (BOOL) application:(UIApplication *)application didFinishLaunchingWithOptions:(NSDictionary *)launchOptions {
1313
[self clearKeychain];
14-
MendixAppDelegate.delegate = self;
1514
[MendixAppDelegate application:application didFinishLaunchingWithOptions:launchOptions];
1615
[self setupUI];
1716

@@ -39,19 +38,6 @@ - (BOOL) application:(UIApplication *)application didFinishLaunchingWithOptions:
3938
return YES;
4039
}
4140

42-
- (void) application:(UIApplication *)application didReceiveLocalNotification:(UILocalNotification *)notification {
43-
[MendixAppDelegate application:application didReceiveLocalNotification:notification];
44-
}
45-
46-
- (void) application:(UIApplication *)application didReceiveRemoteNotification:(nonnull NSDictionary *)userInfo
47-
fetchCompletionHandler:(nonnull void (^)(UIBackgroundFetchResult))completionHandler{
48-
[MendixAppDelegate application:application didReceiveRemoteNotification:userInfo fetchCompletionHandler:completionHandler];
49-
}
50-
51-
- (void) application:(UIApplication *)application didRegisterUserNotificationSettings:(UIUserNotificationSettings *)notificationSettings {
52-
[MendixAppDelegate application:application didRegisterUserNotificationSettings:notificationSettings];
53-
}
54-
5541
- (BOOL) application:(UIApplication *)app openURL:(NSURL *)url options:(NSDictionary<UIApplicationOpenURLOptionsKey,id> *)options {
5642
return [MendixAppDelegate application:app openURL:url options:options];
5743
}
@@ -74,18 +60,6 @@ - (void) setupUI {
7460
}
7561
}
7662

77-
- (void) userNotificationCenter:(UNUserNotificationCenter *)center
78-
willPresentNotification:(UNNotification *)notification
79-
withCompletionHandler:(void (^)(UNNotificationPresentationOptions options))completionHandler {
80-
[MendixAppDelegate userNotificationCenter:center willPresentNotification:notification withCompletionHandler:completionHandler];
81-
}
82-
83-
- (void) userNotificationCenter:(UNUserNotificationCenter *)center
84-
didReceiveNotificationResponse:(UNNotificationResponse *)response
85-
withCompletionHandler:(void (^)(void))completionHandler {
86-
[MendixAppDelegate userNotificationCenter:center didReceiveNotificationResponse:response withCompletionHandler:completionHandler];
87-
}
88-
8963
- (void) clearKeychain {
9064
if ([NSUserDefaults.standardUserDefaults boolForKey:@"HAS_RUN_BEFORE"] == NO) {
9165
[NSUserDefaults.standardUserDefaults setBool:YES forKey:@"HAS_RUN_BEFORE"];

ios/Dev/AppDelegate.m

Lines changed: 0 additions & 26 deletions
Original file line numberDiff line numberDiff line change
@@ -11,7 +11,6 @@ @implementation AppDelegate
1111

1212
- (BOOL) application:(UIApplication *)application didFinishLaunchingWithOptions:(NSDictionary *)launchOptions {
1313
[self clearKeychain];
14-
MendixAppDelegate.delegate = self;
1514
[MendixAppDelegate application:application didFinishLaunchingWithOptions:launchOptions];
1615
[self setupUI];
1716

@@ -25,19 +24,6 @@ - (BOOL) application:(UIApplication *)application didFinishLaunchingWithOptions:
2524
return YES;
2625
}
2726

28-
- (void) application:(UIApplication *)application didReceiveLocalNotification:(UILocalNotification *)notification {
29-
[MendixAppDelegate application:application didReceiveLocalNotification:notification];
30-
}
31-
32-
- (void) application:(UIApplication *)application didReceiveRemoteNotification:(nonnull NSDictionary *)userInfo
33-
fetchCompletionHandler:(nonnull void (^)(UIBackgroundFetchResult))completionHandler{
34-
[MendixAppDelegate application:application didReceiveRemoteNotification:userInfo fetchCompletionHandler:completionHandler];
35-
}
36-
37-
- (void) application:(UIApplication *)application didRegisterUserNotificationSettings:(UIUserNotificationSettings *)notificationSettings {
38-
[MendixAppDelegate application:application didRegisterUserNotificationSettings:notificationSettings];
39-
}
40-
4127
- (BOOL) application:(UIApplication *)application openURL:(NSURL *)url options:(NSDictionary<UIApplicationOpenURLOptionsKey,id> *)options {
4228
BOOL isHandled = [MendixAppDelegate application:application openURL:url options:options];
4329

@@ -82,18 +68,6 @@ - (void) setupUI {
8268
}
8369
}
8470

85-
- (void) userNotificationCenter:(UNUserNotificationCenter *)center
86-
willPresentNotification:(UNNotification *)notification
87-
withCompletionHandler:(void (^)(UNNotificationPresentationOptions options))completionHandler {
88-
[MendixAppDelegate userNotificationCenter:center willPresentNotification:notification withCompletionHandler:completionHandler];
89-
}
90-
91-
- (void) userNotificationCenter:(UNUserNotificationCenter *)center
92-
didReceiveNotificationResponse:(UNNotificationResponse *)response
93-
withCompletionHandler:(void (^)(void))completionHandler {
94-
[MendixAppDelegate userNotificationCenter:center didReceiveNotificationResponse:response withCompletionHandler:completionHandler];
95-
}
96-
9771
- (void) clearKeychain {
9872
if ([NSUserDefaults.standardUserDefaults boolForKey:@"HAS_RUN_BEFORE"] == NO) {
9973
[NSUserDefaults.standardUserDefaults setBool:YES forKey:@"HAS_RUN_BEFORE"];

ios/MendixAppDelegate.h

Lines changed: 0 additions & 16 deletions
Original file line numberDiff line numberDiff line change
@@ -1,28 +1,12 @@
11
#import <UIKit/UIKit.h>
2-
#import <UserNotifications/UserNotifications.h>
32

43
@interface MendixAppDelegate : NSObject
54

65
+ (void) application:(UIApplication *)application didFinishLaunchingWithOptions:(NSDictionary *)launchOptions;
76

8-
+ (void) application:(UIApplication *)application didReceiveLocalNotification:(UILocalNotification *)notification;
9-
10-
+ (void) application:(UIApplication *)application didReceiveRemoteNotification:(nonnull NSDictionary *)userInfo
11-
fetchCompletionHandler:(nonnull void (^)(UIBackgroundFetchResult))completionHandler;
12-
13-
+ (void) application:(UIApplication *)application didRegisterUserNotificationSettings:(UIUserNotificationSettings *)notificationSettings;
14-
157
+ (BOOL) application:(UIApplication *)application openURL:(NSURL *)url options:(NSDictionary<UIApplicationOpenURLOptionsKey,id> *)options;
168

179
+ (void) application:(UIApplication *)application openURL:(NSURL *)url sourceApplication:(NSString *)sourceApplication annotation:(id)annotation;
1810

19-
+ (void) userNotificationCenter:(UNUserNotificationCenter *)center willPresentNotification:(UNNotification *)notification withCompletionHandler:(void (^)(UNNotificationPresentationOptions options))completionHandler;
20-
21-
+ (void) userNotificationCenter:(UNUserNotificationCenter *)center didReceiveNotificationResponse:(UNNotificationResponse *)response withCompletionHandler:(void (^)(void))completionHandler;
22-
23-
+ (UIResponder<UIApplicationDelegate, UNUserNotificationCenterDelegate> *_Nullable) delegate;
24-
25-
+ (void) setDelegate:(UIResponder<UIApplicationDelegate, UNUserNotificationCenterDelegate> *_Nonnull)value;
26-
2711
+ (NSURL *) getJSBundleFile;
2812
@end

ios/Podfile.lock

Lines changed: 10 additions & 7 deletions
Original file line numberDiff line numberDiff line change
@@ -1636,8 +1636,6 @@ PODS:
16361636
- React-Core
16371637
- RNCPicker (2.11.0):
16381638
- React-Core
1639-
- RNCPushNotificationIOS (1.10.1):
1640-
- React-Core
16411639
- RNDateTimePicker (8.2.0):
16421640
- React-Core
16431641
- RNDeviceInfo (13.0.0):
@@ -1669,6 +1667,11 @@ PODS:
16691667
- Yoga
16701668
- RNLocalize (3.2.1):
16711669
- React-Core
1670+
- RNNotifee (9.1.8):
1671+
- React-Core
1672+
- RNNotifee/NotifeeCore (= 9.1.8)
1673+
- RNNotifee/NotifeeCore (9.1.8):
1674+
- React-Core
16721675
- RNPermissions (4.1.5):
16731676
- React-Core
16741677
- RNReanimated (3.16.1):
@@ -1895,12 +1898,12 @@ DEPENDENCIES:
18951898
- "RNCAsyncStorage (from `../node_modules/@react-native-async-storage/async-storage`)"
18961899
- "RNCMaskedView (from `../node_modules/@react-native-masked-view/masked-view`)"
18971900
- "RNCPicker (from `../node_modules/@react-native-picker/picker`)"
1898-
- "RNCPushNotificationIOS (from `../node_modules/@react-native-community/push-notification-ios`)"
18991901
- "RNDateTimePicker (from `../node_modules/@react-native-community/datetimepicker`)"
19001902
- RNDeviceInfo (from `../node_modules/react-native-device-info`)
19011903
- RNFastImage (from `../node_modules/react-native-fast-image`)
19021904
- RNGestureHandler (from `../node_modules/react-native-gesture-handler`)
19031905
- RNLocalize (from `../node_modules/react-native-localize`)
1906+
- "RNNotifee (from `../node_modules/@notifee/react-native`)"
19041907
- RNPermissions (from `../node_modules/react-native-permissions`)
19051908
- RNReanimated (from `../node_modules/react-native-reanimated`)
19061909
- RNScreens (from `../node_modules/react-native-screens`)
@@ -2074,8 +2077,6 @@ EXTERNAL SOURCES:
20742077
:path: "../node_modules/@react-native-masked-view/masked-view"
20752078
RNCPicker:
20762079
:path: "../node_modules/@react-native-picker/picker"
2077-
RNCPushNotificationIOS:
2078-
:path: "../node_modules/@react-native-community/push-notification-ios"
20792080
RNDateTimePicker:
20802081
:path: "../node_modules/@react-native-community/datetimepicker"
20812082
RNDeviceInfo:
@@ -2086,6 +2087,8 @@ EXTERNAL SOURCES:
20862087
:path: "../node_modules/react-native-gesture-handler"
20872088
RNLocalize:
20882089
:path: "../node_modules/react-native-localize"
2090+
RNNotifee:
2091+
:path: "../node_modules/@notifee/react-native"
20892092
RNPermissions:
20902093
:path: "../node_modules/react-native-permissions"
20912094
RNReanimated:
@@ -2181,12 +2184,12 @@ SPEC CHECKSUMS:
21812184
RNCAsyncStorage: 40367e8d25522dca9c3513c7b9815a184669bd97
21822185
RNCMaskedView: de80352547bd4f0d607bf6bab363d826822bd126
21832186
RNCPicker: 124b4fb5859ba1a3fd53a91e16d1e7a0fc016e59
2184-
RNCPushNotificationIOS: 778dc253960de7b6544abe6cee86fea1e2c590ab
21852187
RNDateTimePicker: 818460dc31b0dc5ec58289003e27dd8d022fb79c
21862188
RNDeviceInfo: ae4e1a9b955b2a65314588cc7251795631925668
21872189
RNFastImage: 462a183c4b0b6b26fdfd639e1ed6ba37536c3b87
21882190
RNGestureHandler: 9bf6e8f72d2e72c8f7eb45986fe71a5005fb072d
21892191
RNLocalize: e7378161f0b6a6365407eb2377aab46cc38047d8
2192+
RNNotifee: 5e3b271e8ea7456a36eec994085543c9adca9168
21902193
RNPermissions: 6a02e3cb2c65fbcdceb5111131e7725cda40efd2
21912194
RNReanimated: 20f0d150af988258289b2d6cda655bd14945a769
21922195
RNScreens: 86e5c168cdd055a8feead28eb756ca7103918b6a
@@ -2199,6 +2202,6 @@ SPEC CHECKSUMS:
21992202
SSZipArchive: 8a6ee5677c8e304bebc109e39cf0da91ccef22ea
22002203
Yoga: 92f3bb322c40a86b7233b815854730442e01b8c4
22012204

2202-
PODFILE CHECKSUM: 0721d8defdcee9bbb168ccd39c73b4972842a2af
2205+
PODFILE CHECKSUM: d2c49e3c6af7627753459536d224c58f75141533
22032206

22042207
COCOAPODS: 1.16.2

ios/mendix_utils.rb

Lines changed: 0 additions & 36 deletions
Original file line numberDiff line numberDiff line change
@@ -37,12 +37,7 @@ def generate_mendix_delegate
3737
imports = []
3838
hooks = {
3939
didFinishLaunchingWithOptions: [],
40-
didReceiveLocalNotification: [],
41-
didReceiveRemoteNotification: [],
42-
didRegisterUserNotificationSettings: [],
4340
openURL: [],
44-
willPresentNotification: [],
45-
didReceiveNotificationResponse: [],
4641
getJSBundleFile: [],
4742
}
4843

@@ -94,25 +89,10 @@ def mendix_app_delegate_template
9489
9590
@implementation MendixAppDelegate
9691
97-
static UIResponder<UIApplicationDelegate, UNUserNotificationCenterDelegate> *_Nullable delegate;
98-
9992
+ (void) application:(UIApplication *)application didFinishLaunchingWithOptions:(NSDictionary *)launchOptions {
10093
{{ didFinishLaunchingWithOptions }}
10194
}
10295
103-
+ (void) application:(UIApplication *)application didReceiveLocalNotification:(UILocalNotification *)notification {
104-
{{ didReceiveLocalNotification }}
105-
}
106-
107-
+ (void) application:(UIApplication *)application didReceiveRemoteNotification:(nonnull NSDictionary *)userInfo
108-
fetchCompletionHandler:(nonnull void (^)(UIBackgroundFetchResult))completionHandler{
109-
{{ didReceiveRemoteNotification }}
110-
}
111-
112-
+ (void) application:(UIApplication *)application didRegisterUserNotificationSettings:(UIUserNotificationSettings *)notificationSettings {
113-
{{ didRegisterUserNotificationSettings }}
114-
}
115-
11696
+ (BOOL) application:(UIApplication *)application openURL:(NSURL *)url options:(NSDictionary<UIApplicationOpenURLOptionsKey,id> *)options {
11797
{{ boolean_openURLWithOptions }}
11898
}
@@ -121,22 +101,6 @@ def mendix_app_delegate_template
121101
{{ openURL }}
122102
}
123103
124-
+ (void) userNotificationCenter:(UNUserNotificationCenter *)center willPresentNotification:(UNNotification *)notification withCompletionHandler:(void (^)(UNNotificationPresentationOptions options))completionHandler {
125-
{{ willPresentNotification }}
126-
}
127-
128-
+ (void) userNotificationCenter:(UNUserNotificationCenter *)center didReceiveNotificationResponse:(UNNotificationResponse *)response withCompletionHandler:(void (^)(void))completionHandler {
129-
{{ didReceiveNotificationResponse }}
130-
}
131-
132-
+ (UIResponder<UIApplicationDelegate, UNUserNotificationCenterDelegate> *_Nullable) delegate {
133-
return delegate;
134-
}
135-
136-
+ (void) setDelegate:(UIResponder<UIApplicationDelegate, UNUserNotificationCenterDelegate> *_Nonnull)value {
137-
delegate = value;
138-
}
139-
140104
+ (NSURL *) getJSBundleFile {
141105
{{ getJSBundleFile }}
142106
return [ReactNative.instance getJSBundleFile];

0 commit comments

Comments
 (0)