Skip to content

Commit 1072ce0

Browse files
Revert "migration from react-native-push-notification to notifee"
1 parent ebded84 commit 1072ce0

12 files changed

Lines changed: 178 additions & 34 deletions

CHANGELOG.md

Lines changed: 0 additions & 4 deletions
Original file line numberDiff line numberDiff line change
@@ -16,10 +16,6 @@ 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-
2319
## Fixes
2420

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

android/build.gradle

Lines changed: 0 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -80,9 +80,6 @@ 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-
}
8683
}
8784

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

capabilities-setup-config.json

Lines changed: 18 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -36,6 +36,24 @@
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+
}
3957
}
4058
},
4159
"firebaseAndroid": {

ios/AppDelegate.h

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

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

67
@property (nonatomic, strong) UIWindow *window;
78
@property BOOL shouldOpenInLastApp;

ios/AppDelegate.m

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

1212
- (BOOL) application:(UIApplication *)application didFinishLaunchingWithOptions:(NSDictionary *)launchOptions {
1313
[self clearKeychain];
14+
MendixAppDelegate.delegate = self;
1415
[MendixAppDelegate application:application didFinishLaunchingWithOptions:launchOptions];
1516
[self setupUI];
1617

@@ -38,6 +39,19 @@ - (BOOL) application:(UIApplication *)application didFinishLaunchingWithOptions:
3839
return YES;
3940
}
4041

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+
4155
- (BOOL) application:(UIApplication *)app openURL:(NSURL *)url options:(NSDictionary<UIApplicationOpenURLOptionsKey,id> *)options {
4256
return [MendixAppDelegate application:app openURL:url options:options];
4357
}
@@ -60,6 +74,18 @@ - (void) setupUI {
6074
}
6175
}
6276

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+
6389
- (void) clearKeychain {
6490
if ([NSUserDefaults.standardUserDefaults boolForKey:@"HAS_RUN_BEFORE"] == NO) {
6591
[NSUserDefaults.standardUserDefaults setBool:YES forKey:@"HAS_RUN_BEFORE"];

ios/Dev/AppDelegate.m

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

1212
- (BOOL) application:(UIApplication *)application didFinishLaunchingWithOptions:(NSDictionary *)launchOptions {
1313
[self clearKeychain];
14+
MendixAppDelegate.delegate = self;
1415
[MendixAppDelegate application:application didFinishLaunchingWithOptions:launchOptions];
1516
[self setupUI];
1617

@@ -24,6 +25,19 @@ - (BOOL) application:(UIApplication *)application didFinishLaunchingWithOptions:
2425
return YES;
2526
}
2627

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+
2741
- (BOOL) application:(UIApplication *)application openURL:(NSURL *)url options:(NSDictionary<UIApplicationOpenURLOptionsKey,id> *)options {
2842
BOOL isHandled = [MendixAppDelegate application:application openURL:url options:options];
2943

@@ -68,6 +82,18 @@ - (void) setupUI {
6882
}
6983
}
7084

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+
7197
- (void) clearKeychain {
7298
if ([NSUserDefaults.standardUserDefaults boolForKey:@"HAS_RUN_BEFORE"] == NO) {
7399
[NSUserDefaults.standardUserDefaults setBool:YES forKey:@"HAS_RUN_BEFORE"];

ios/MendixAppDelegate.h

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

34
@interface MendixAppDelegate : NSObject
45

56
+ (void) application:(UIApplication *)application didFinishLaunchingWithOptions:(NSDictionary *)launchOptions;
67

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+
715
+ (BOOL) application:(UIApplication *)application openURL:(NSURL *)url options:(NSDictionary<UIApplicationOpenURLOptionsKey,id> *)options;
816

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

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+
1127
+ (NSURL *) getJSBundleFile;
1228
@end

ios/Podfile.lock

Lines changed: 7 additions & 10 deletions
Original file line numberDiff line numberDiff line change
@@ -1636,6 +1636,8 @@ PODS:
16361636
- React-Core
16371637
- RNCPicker (2.11.0):
16381638
- React-Core
1639+
- RNCPushNotificationIOS (1.10.1):
1640+
- React-Core
16391641
- RNDateTimePicker (8.2.0):
16401642
- React-Core
16411643
- RNDeviceInfo (13.0.0):
@@ -1667,11 +1669,6 @@ PODS:
16671669
- Yoga
16681670
- RNLocalize (3.2.1):
16691671
- 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
16751672
- RNPermissions (4.1.5):
16761673
- React-Core
16771674
- RNReanimated (3.16.1):
@@ -1898,12 +1895,12 @@ DEPENDENCIES:
18981895
- "RNCAsyncStorage (from `../node_modules/@react-native-async-storage/async-storage`)"
18991896
- "RNCMaskedView (from `../node_modules/@react-native-masked-view/masked-view`)"
19001897
- "RNCPicker (from `../node_modules/@react-native-picker/picker`)"
1898+
- "RNCPushNotificationIOS (from `../node_modules/@react-native-community/push-notification-ios`)"
19011899
- "RNDateTimePicker (from `../node_modules/@react-native-community/datetimepicker`)"
19021900
- RNDeviceInfo (from `../node_modules/react-native-device-info`)
19031901
- RNFastImage (from `../node_modules/react-native-fast-image`)
19041902
- RNGestureHandler (from `../node_modules/react-native-gesture-handler`)
19051903
- RNLocalize (from `../node_modules/react-native-localize`)
1906-
- "RNNotifee (from `../node_modules/@notifee/react-native`)"
19071904
- RNPermissions (from `../node_modules/react-native-permissions`)
19081905
- RNReanimated (from `../node_modules/react-native-reanimated`)
19091906
- RNScreens (from `../node_modules/react-native-screens`)
@@ -2077,6 +2074,8 @@ EXTERNAL SOURCES:
20772074
:path: "../node_modules/@react-native-masked-view/masked-view"
20782075
RNCPicker:
20792076
:path: "../node_modules/@react-native-picker/picker"
2077+
RNCPushNotificationIOS:
2078+
:path: "../node_modules/@react-native-community/push-notification-ios"
20802079
RNDateTimePicker:
20812080
:path: "../node_modules/@react-native-community/datetimepicker"
20822081
RNDeviceInfo:
@@ -2087,8 +2086,6 @@ EXTERNAL SOURCES:
20872086
:path: "../node_modules/react-native-gesture-handler"
20882087
RNLocalize:
20892088
:path: "../node_modules/react-native-localize"
2090-
RNNotifee:
2091-
:path: "../node_modules/@notifee/react-native"
20922089
RNPermissions:
20932090
:path: "../node_modules/react-native-permissions"
20942091
RNReanimated:
@@ -2184,12 +2181,12 @@ SPEC CHECKSUMS:
21842181
RNCAsyncStorage: 40367e8d25522dca9c3513c7b9815a184669bd97
21852182
RNCMaskedView: de80352547bd4f0d607bf6bab363d826822bd126
21862183
RNCPicker: 124b4fb5859ba1a3fd53a91e16d1e7a0fc016e59
2184+
RNCPushNotificationIOS: 778dc253960de7b6544abe6cee86fea1e2c590ab
21872185
RNDateTimePicker: 818460dc31b0dc5ec58289003e27dd8d022fb79c
21882186
RNDeviceInfo: ae4e1a9b955b2a65314588cc7251795631925668
21892187
RNFastImage: 462a183c4b0b6b26fdfd639e1ed6ba37536c3b87
21902188
RNGestureHandler: 9bf6e8f72d2e72c8f7eb45986fe71a5005fb072d
21912189
RNLocalize: e7378161f0b6a6365407eb2377aab46cc38047d8
2192-
RNNotifee: 5e3b271e8ea7456a36eec994085543c9adca9168
21932190
RNPermissions: 6a02e3cb2c65fbcdceb5111131e7725cda40efd2
21942191
RNReanimated: 20f0d150af988258289b2d6cda655bd14945a769
21952192
RNScreens: 86e5c168cdd055a8feead28eb756ca7103918b6a
@@ -2202,6 +2199,6 @@ SPEC CHECKSUMS:
22022199
SSZipArchive: 8a6ee5677c8e304bebc109e39cf0da91ccef22ea
22032200
Yoga: 92f3bb322c40a86b7233b815854730442e01b8c4
22042201

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

22072204
COCOAPODS: 1.16.2

ios/mendix_utils.rb

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

@@ -89,10 +94,25 @@ def mendix_app_delegate_template
8994
9095
@implementation MendixAppDelegate
9196
97+
static UIResponder<UIApplicationDelegate, UNUserNotificationCenterDelegate> *_Nullable delegate;
98+
9299
+ (void) application:(UIApplication *)application didFinishLaunchingWithOptions:(NSDictionary *)launchOptions {
93100
{{ didFinishLaunchingWithOptions }}
94101
}
95102
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+
96116
+ (BOOL) application:(UIApplication *)application openURL:(NSURL *)url options:(NSDictionary<UIApplicationOpenURLOptionsKey,id> *)options {
97117
{{ boolean_openURLWithOptions }}
98118
}
@@ -101,6 +121,22 @@ def mendix_app_delegate_template
101121
{{ openURL }}
102122
}
103123
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+
104140
+ (NSURL *) getJSBundleFile {
105141
{{ getJSBundleFile }}
106142
return [ReactNative.instance getJSBundleFile];

0 commit comments

Comments
 (0)