@@ -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
@@ -77,72 +72,42 @@ def generate_mendix_delegate
7772 end
7873 end
7974
80- File . open ( "MendixAppDelegate.m " , "w" ) do |file |
75+ File . open ( "MendixAppDelegate.swift " , "w" ) do |file |
8176 mendix_app_delegate = mendix_app_delegate_template . sub ( "{{ imports }}" , stringify ( imports ) )
8277 hooks . each { |name , hook | mendix_app_delegate . sub! ( "{{ #{ name . to_s } }}" , stringify ( hook ) ) }
83- returnHooks . each { |name , hook | mendix_app_delegate . sub! ( "{{ #{ name . to_s } }}" , stringify ( hook ) . length > 0 ? stringify ( hook ) : " return YES; " ) }
78+ returnHooks . each { |name , hook | mendix_app_delegate . sub! ( "{{ #{ name . to_s } }}" , stringify ( hook ) . length > 0 ? stringify ( hook ) : " return true " ) }
8479 file << mendix_app_delegate
8580 end
8681end
8782
8883def mendix_app_delegate_template
8984 %(// DO NOT EDIT BY HAND. THIS FILE IS AUTO-GENERATED
90- #import <Foundation/Foundation.h>
91- #import <MendixNative.h>
92- #import "MendixAppDelegate.h"
85+ import Foundation
86+ import MendixNative
9387{{ imports }}
9488
95- @implementation MendixAppDelegate
96-
97- static UIResponder<UIApplicationDelegate, UNUserNotificationCenterDelegate> *_Nullable delegate;
98-
99- + (void) application:(UIApplication *)application didFinishLaunchingWithOptions:(NSDictionary *)launchOptions {
100- {{ didFinishLaunchingWithOptions }}
101- }
102-
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-
116- + (BOOL) application:(UIApplication *)application openURL:(NSURL *)url options:(NSDictionary<UIApplicationOpenURLOptionsKey,id> *)options {
117- {{ boolean_openURLWithOptions }}
118- }
119-
120- + (void) application:(UIApplication *)application openURL:(NSURL *)url sourceApplication:(NSString *)sourceApplication annotation:(id)annotation {
121- {{ openURL }}
122- }
123-
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- }
89+ /// Auto-generated implementation of MendixAppDelegate
90+ /// Generated based on enabled capabilities in capabilities.ios.json
91+ class MendixAppDelegate: NSObject {
92+
93+ static func application(_ application: UIApplication, didFinishLaunchingWithOptions launchOptions: [UIApplication.LaunchOptionsKey: Any]?) {
94+ {{ didFinishLaunchingWithOptions }}
95+ }
13996
140- + (NSURL *) getJSBundleFile {
141- {{ getJSBundleFile }}
142- return [ReactNative.instance getJSBundleFile];
97+ static func application(_ application: UIApplication, openURL url: URL, options: [UIApplication.OpenURLOptionsKey: Any] = [:]) -> Bool {
98+ {{ boolean_openURLWithOptions }}
99+ }
100+
101+ static func application(_ application: UIApplication, openURL url: URL, sourceApplication: String?, annotation: Any) {
102+ {{ openURL }}
103+ }
104+
105+ static func getJSBundleFile() -> URL? {
106+ {{ getJSBundleFile }}
107+ return BundleHelper.getJSBundleFile()
108+ }
143109}
144-
145- @end\n )
110+ )
146111end
147112
148113def stringify ( array )
0 commit comments