Skip to content
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension


Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
4 changes: 0 additions & 4 deletions CHANGELOG.md
Original file line number Diff line number Diff line change
Expand Up @@ -16,10 +16,6 @@ The format is based on [Keep a Changelog](https://keepachangelog.com/en/1.0.0/),

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

### Changed

- We have migrated from `react-native-push-notification` to `@notifee/react-native` for better new architecture compatibility and enhanced push notification features.

## Fixes

- We have upgraded `@mendix/native` to version 9.0.1
Expand Down
3 changes: 0 additions & 3 deletions android/build.gradle
Original file line number Diff line number Diff line change
Expand Up @@ -80,9 +80,6 @@ allprojects {
url "https://maven.scijava.org/content/repositories/jcenter/"
}
maven { url "https://packages.rnd.mendix.com/jcenter" }
maven {
url "$rootDir/../node_modules/@notifee/react-native/android/libs"
}
}

// Build all modules with Android 16KB pages enabled
Expand Down
18 changes: 18 additions & 0 deletions capabilities-setup-config.json
Original file line number Diff line number Diff line change
Expand Up @@ -36,6 +36,24 @@
"externalDependencies": [
"me.leolin:ShortcutBadger:1.1.22@aar"
]
},
"ios": {
"AppDelegate": {
"imports": [
"#import <RNCPushNotificationIOS.h>"
],
"didFinishLaunchingWithOptions": [
"UNUserNotificationCenter *center = [UNUserNotificationCenter currentNotificationCenter];",
"center.delegate = MendixAppDelegate.delegate;"
],
"willPresentNotification": [
"completionHandler(UNNotificationPresentationOptionSound | UNNotificationPresentationOptionAlert | UNNotificationPresentationOptionBadge);"
],
"didReceiveNotificationResponse": [
"[RNCPushNotificationIOS didReceiveNotificationResponse:response];",
"completionHandler();"
]
}
}
},
"firebaseAndroid": {
Expand Down
3 changes: 2 additions & 1 deletion ios/AppDelegate.h
Original file line number Diff line number Diff line change
@@ -1,7 +1,8 @@
#import <Foundation/Foundation.h>
#import <UIKit/UIKit.h>
#import <UserNotifications/UNUserNotificationCenter.h>

@interface AppDelegate : UIResponder<UIApplicationDelegate>
@interface AppDelegate : UIResponder<UIApplicationDelegate, UNUserNotificationCenterDelegate>

@property (nonatomic, strong) UIWindow *window;
@property BOOL shouldOpenInLastApp;
Expand Down
26 changes: 26 additions & 0 deletions ios/AppDelegate.m
Original file line number Diff line number Diff line change
Expand Up @@ -11,6 +11,7 @@ @implementation AppDelegate

- (BOOL) application:(UIApplication *)application didFinishLaunchingWithOptions:(NSDictionary *)launchOptions {
[self clearKeychain];
MendixAppDelegate.delegate = self;
[MendixAppDelegate application:application didFinishLaunchingWithOptions:launchOptions];
[self setupUI];

Expand Down Expand Up @@ -38,6 +39,19 @@ - (BOOL) application:(UIApplication *)application didFinishLaunchingWithOptions:
return YES;
}

- (void) application:(UIApplication *)application didReceiveLocalNotification:(UILocalNotification *)notification {
[MendixAppDelegate application:application didReceiveLocalNotification:notification];
}

- (void) application:(UIApplication *)application didReceiveRemoteNotification:(nonnull NSDictionary *)userInfo
fetchCompletionHandler:(nonnull void (^)(UIBackgroundFetchResult))completionHandler{
[MendixAppDelegate application:application didReceiveRemoteNotification:userInfo fetchCompletionHandler:completionHandler];
}

- (void) application:(UIApplication *)application didRegisterUserNotificationSettings:(UIUserNotificationSettings *)notificationSettings {
[MendixAppDelegate application:application didRegisterUserNotificationSettings:notificationSettings];
}

- (BOOL) application:(UIApplication *)app openURL:(NSURL *)url options:(NSDictionary<UIApplicationOpenURLOptionsKey,id> *)options {
return [MendixAppDelegate application:app openURL:url options:options];
}
Expand All @@ -60,6 +74,18 @@ - (void) setupUI {
}
}

- (void) userNotificationCenter:(UNUserNotificationCenter *)center
willPresentNotification:(UNNotification *)notification
withCompletionHandler:(void (^)(UNNotificationPresentationOptions options))completionHandler {
[MendixAppDelegate userNotificationCenter:center willPresentNotification:notification withCompletionHandler:completionHandler];
}

- (void) userNotificationCenter:(UNUserNotificationCenter *)center
didReceiveNotificationResponse:(UNNotificationResponse *)response
withCompletionHandler:(void (^)(void))completionHandler {
[MendixAppDelegate userNotificationCenter:center didReceiveNotificationResponse:response withCompletionHandler:completionHandler];
}

- (void) clearKeychain {
if ([NSUserDefaults.standardUserDefaults boolForKey:@"HAS_RUN_BEFORE"] == NO) {
[NSUserDefaults.standardUserDefaults setBool:YES forKey:@"HAS_RUN_BEFORE"];
Expand Down
26 changes: 26 additions & 0 deletions ios/Dev/AppDelegate.m
Original file line number Diff line number Diff line change
Expand Up @@ -11,6 +11,7 @@ @implementation AppDelegate

- (BOOL) application:(UIApplication *)application didFinishLaunchingWithOptions:(NSDictionary *)launchOptions {
[self clearKeychain];
MendixAppDelegate.delegate = self;
[MendixAppDelegate application:application didFinishLaunchingWithOptions:launchOptions];
[self setupUI];

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

- (void) application:(UIApplication *)application didReceiveLocalNotification:(UILocalNotification *)notification {
[MendixAppDelegate application:application didReceiveLocalNotification:notification];
}

- (void) application:(UIApplication *)application didReceiveRemoteNotification:(nonnull NSDictionary *)userInfo
fetchCompletionHandler:(nonnull void (^)(UIBackgroundFetchResult))completionHandler{
[MendixAppDelegate application:application didReceiveRemoteNotification:userInfo fetchCompletionHandler:completionHandler];
}

- (void) application:(UIApplication *)application didRegisterUserNotificationSettings:(UIUserNotificationSettings *)notificationSettings {
[MendixAppDelegate application:application didRegisterUserNotificationSettings:notificationSettings];
}

- (BOOL) application:(UIApplication *)application openURL:(NSURL *)url options:(NSDictionary<UIApplicationOpenURLOptionsKey,id> *)options {
BOOL isHandled = [MendixAppDelegate application:application openURL:url options:options];

Expand Down Expand Up @@ -68,6 +82,18 @@ - (void) setupUI {
}
}

- (void) userNotificationCenter:(UNUserNotificationCenter *)center
willPresentNotification:(UNNotification *)notification
withCompletionHandler:(void (^)(UNNotificationPresentationOptions options))completionHandler {
[MendixAppDelegate userNotificationCenter:center willPresentNotification:notification withCompletionHandler:completionHandler];
}

- (void) userNotificationCenter:(UNUserNotificationCenter *)center
didReceiveNotificationResponse:(UNNotificationResponse *)response
withCompletionHandler:(void (^)(void))completionHandler {
[MendixAppDelegate userNotificationCenter:center didReceiveNotificationResponse:response withCompletionHandler:completionHandler];
}

- (void) clearKeychain {
if ([NSUserDefaults.standardUserDefaults boolForKey:@"HAS_RUN_BEFORE"] == NO) {
[NSUserDefaults.standardUserDefaults setBool:YES forKey:@"HAS_RUN_BEFORE"];
Expand Down
16 changes: 16 additions & 0 deletions ios/MendixAppDelegate.h
Original file line number Diff line number Diff line change
@@ -1,12 +1,28 @@
#import <UIKit/UIKit.h>
#import <UserNotifications/UserNotifications.h>

@interface MendixAppDelegate : NSObject

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

+ (void) application:(UIApplication *)application didReceiveLocalNotification:(UILocalNotification *)notification;

+ (void) application:(UIApplication *)application didReceiveRemoteNotification:(nonnull NSDictionary *)userInfo
fetchCompletionHandler:(nonnull void (^)(UIBackgroundFetchResult))completionHandler;

+ (void) application:(UIApplication *)application didRegisterUserNotificationSettings:(UIUserNotificationSettings *)notificationSettings;

+ (BOOL) application:(UIApplication *)application openURL:(NSURL *)url options:(NSDictionary<UIApplicationOpenURLOptionsKey,id> *)options;

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

+ (void) userNotificationCenter:(UNUserNotificationCenter *)center willPresentNotification:(UNNotification *)notification withCompletionHandler:(void (^)(UNNotificationPresentationOptions options))completionHandler;

+ (void) userNotificationCenter:(UNUserNotificationCenter *)center didReceiveNotificationResponse:(UNNotificationResponse *)response withCompletionHandler:(void (^)(void))completionHandler;

+ (UIResponder<UIApplicationDelegate, UNUserNotificationCenterDelegate> *_Nullable) delegate;

+ (void) setDelegate:(UIResponder<UIApplicationDelegate, UNUserNotificationCenterDelegate> *_Nonnull)value;

+ (NSURL *) getJSBundleFile;
@end
17 changes: 7 additions & 10 deletions ios/Podfile.lock
Original file line number Diff line number Diff line change
Expand Up @@ -1636,6 +1636,8 @@ PODS:
- React-Core
- RNCPicker (2.11.0):
- React-Core
- RNCPushNotificationIOS (1.10.1):
- React-Core
- RNDateTimePicker (8.2.0):
- React-Core
- RNDeviceInfo (13.0.0):
Expand Down Expand Up @@ -1667,11 +1669,6 @@ PODS:
- Yoga
- RNLocalize (3.2.1):
- React-Core
- RNNotifee (9.1.8):
- React-Core
- RNNotifee/NotifeeCore (= 9.1.8)
- RNNotifee/NotifeeCore (9.1.8):
- React-Core
- RNPermissions (4.1.5):
- React-Core
- RNReanimated (3.16.1):
Expand Down Expand Up @@ -1898,12 +1895,12 @@ DEPENDENCIES:
- "RNCAsyncStorage (from `../node_modules/@react-native-async-storage/async-storage`)"
- "RNCMaskedView (from `../node_modules/@react-native-masked-view/masked-view`)"
- "RNCPicker (from `../node_modules/@react-native-picker/picker`)"
- "RNCPushNotificationIOS (from `../node_modules/@react-native-community/push-notification-ios`)"
- "RNDateTimePicker (from `../node_modules/@react-native-community/datetimepicker`)"
- RNDeviceInfo (from `../node_modules/react-native-device-info`)
- RNFastImage (from `../node_modules/react-native-fast-image`)
- RNGestureHandler (from `../node_modules/react-native-gesture-handler`)
- RNLocalize (from `../node_modules/react-native-localize`)
- "RNNotifee (from `../node_modules/@notifee/react-native`)"
- RNPermissions (from `../node_modules/react-native-permissions`)
- RNReanimated (from `../node_modules/react-native-reanimated`)
- RNScreens (from `../node_modules/react-native-screens`)
Expand Down Expand Up @@ -2077,6 +2074,8 @@ EXTERNAL SOURCES:
:path: "../node_modules/@react-native-masked-view/masked-view"
RNCPicker:
:path: "../node_modules/@react-native-picker/picker"
RNCPushNotificationIOS:
:path: "../node_modules/@react-native-community/push-notification-ios"
RNDateTimePicker:
:path: "../node_modules/@react-native-community/datetimepicker"
RNDeviceInfo:
Expand All @@ -2087,8 +2086,6 @@ EXTERNAL SOURCES:
:path: "../node_modules/react-native-gesture-handler"
RNLocalize:
:path: "../node_modules/react-native-localize"
RNNotifee:
:path: "../node_modules/@notifee/react-native"
RNPermissions:
:path: "../node_modules/react-native-permissions"
RNReanimated:
Expand Down Expand Up @@ -2184,12 +2181,12 @@ SPEC CHECKSUMS:
RNCAsyncStorage: 40367e8d25522dca9c3513c7b9815a184669bd97
RNCMaskedView: de80352547bd4f0d607bf6bab363d826822bd126
RNCPicker: 124b4fb5859ba1a3fd53a91e16d1e7a0fc016e59
RNCPushNotificationIOS: 778dc253960de7b6544abe6cee86fea1e2c590ab
RNDateTimePicker: 818460dc31b0dc5ec58289003e27dd8d022fb79c
RNDeviceInfo: ae4e1a9b955b2a65314588cc7251795631925668
RNFastImage: 462a183c4b0b6b26fdfd639e1ed6ba37536c3b87
RNGestureHandler: 9bf6e8f72d2e72c8f7eb45986fe71a5005fb072d
RNLocalize: e7378161f0b6a6365407eb2377aab46cc38047d8
RNNotifee: 5e3b271e8ea7456a36eec994085543c9adca9168
RNPermissions: 6a02e3cb2c65fbcdceb5111131e7725cda40efd2
RNReanimated: 20f0d150af988258289b2d6cda655bd14945a769
RNScreens: 86e5c168cdd055a8feead28eb756ca7103918b6a
Expand All @@ -2202,6 +2199,6 @@ SPEC CHECKSUMS:
SSZipArchive: 8a6ee5677c8e304bebc109e39cf0da91ccef22ea
Yoga: 92f3bb322c40a86b7233b815854730442e01b8c4

PODFILE CHECKSUM: d2c49e3c6af7627753459536d224c58f75141533
PODFILE CHECKSUM: 0721d8defdcee9bbb168ccd39c73b4972842a2af

COCOAPODS: 1.16.2
36 changes: 36 additions & 0 deletions ios/mendix_utils.rb
Original file line number Diff line number Diff line change
Expand Up @@ -37,7 +37,12 @@ def generate_mendix_delegate
imports = []
hooks = {
didFinishLaunchingWithOptions: [],
didReceiveLocalNotification: [],
didReceiveRemoteNotification: [],
didRegisterUserNotificationSettings: [],
openURL: [],
willPresentNotification: [],
didReceiveNotificationResponse: [],
getJSBundleFile: [],
}

Expand Down Expand Up @@ -89,10 +94,25 @@ def mendix_app_delegate_template

@implementation MendixAppDelegate

static UIResponder<UIApplicationDelegate, UNUserNotificationCenterDelegate> *_Nullable delegate;

+ (void) application:(UIApplication *)application didFinishLaunchingWithOptions:(NSDictionary *)launchOptions {
{{ didFinishLaunchingWithOptions }}
}

+ (void) application:(UIApplication *)application didReceiveLocalNotification:(UILocalNotification *)notification {
{{ didReceiveLocalNotification }}
}

+ (void) application:(UIApplication *)application didReceiveRemoteNotification:(nonnull NSDictionary *)userInfo
fetchCompletionHandler:(nonnull void (^)(UIBackgroundFetchResult))completionHandler{
{{ didReceiveRemoteNotification }}
}

+ (void) application:(UIApplication *)application didRegisterUserNotificationSettings:(UIUserNotificationSettings *)notificationSettings {
{{ didRegisterUserNotificationSettings }}
}

+ (BOOL) application:(UIApplication *)application openURL:(NSURL *)url options:(NSDictionary<UIApplicationOpenURLOptionsKey,id> *)options {
{{ boolean_openURLWithOptions }}
}
Expand All @@ -101,6 +121,22 @@ def mendix_app_delegate_template
{{ openURL }}
}

+ (void) userNotificationCenter:(UNUserNotificationCenter *)center willPresentNotification:(UNNotification *)notification withCompletionHandler:(void (^)(UNNotificationPresentationOptions options))completionHandler {
{{ willPresentNotification }}
}

+ (void) userNotificationCenter:(UNUserNotificationCenter *)center didReceiveNotificationResponse:(UNNotificationResponse *)response withCompletionHandler:(void (^)(void))completionHandler {
{{ didReceiveNotificationResponse }}
}

+ (UIResponder<UIApplicationDelegate, UNUserNotificationCenterDelegate> *_Nullable) delegate {
return delegate;
}

+ (void) setDelegate:(UIResponder<UIApplicationDelegate, UNUserNotificationCenterDelegate> *_Nonnull)value {
delegate = value;
}

+ (NSURL *) getJSBundleFile {
{{ getJSBundleFile }}
return [ReactNative.instance getJSBundleFile];
Expand Down
Loading
Loading