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
1 change: 1 addition & 0 deletions .gitignore
Original file line number Diff line number Diff line change
Expand Up @@ -37,6 +37,7 @@ local.properties
#
**/Pods/
ios/MendixAppDelegate.m
ios/MendixAppDelegate.swift

# node.js
#
Expand Down
2 changes: 2 additions & 0 deletions CHANGELOG.md
Original file line number Diff line number Diff line change
Expand Up @@ -6,6 +6,8 @@ The format is based on [Keep a Changelog](https://keepachangelog.com/en/1.0.0/),

## [Unreleased]

- We have updated native template to support react native new architecture.

- We have migrated from `react-native-splash-screen@3.2.0` to `react-native-bootsplash@^7.7.0` for better splash screen support and autolinking compatibility.

- We added a new property to gradle.properties for scanning QR codes.
Expand Down
30 changes: 6 additions & 24 deletions capabilities-setup-config.json
Original file line number Diff line number Diff line change
Expand Up @@ -3,10 +3,10 @@
"ios": {
"AppDelegate": {
"imports": [
"#import \"React/RCTLinkingManager.h\""
"import React"
],
"boolean_openURLWithOptions": [
"return [RCTLinkingManager application:application openURL:url options:options];"
"return RCTLinkingManager.application(application, open: url, options: options)"
]
}
}
Expand Down Expand Up @@ -36,24 +36,6 @@
"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 All @@ -72,10 +54,10 @@
"ios": {
"AppDelegate": {
"imports": [
"#import <Firebase.h>"
"import FirebaseCore"
],
"didFinishLaunchingWithOptions": [
"[FIRApp configure];"
"FirebaseApp.configure()"
]
}
}
Expand All @@ -85,10 +67,10 @@
"ios": {
"AppDelegate": {
"imports": [
"#import <GoogleMaps/GoogleMaps.h>"
"import GoogleMaps"
],
"didFinishLaunchingWithOptions": [
"[GMSServices provideAPIKey:[[NSBundle mainBundle] objectForInfoDictionaryKey:@\"GoogleMapsApiKey\"] ?: @\"\"];"
"GMSServices.provideAPIKey(Bundle.main.object(forInfoDictionaryKey: \"GoogleMapsApiKey\") as? String ?? \"\")"
]
},
"pods": {
Expand Down
11 changes: 2 additions & 9 deletions ios/AppDelegate.swift
Original file line number Diff line number Diff line change
@@ -1,18 +1,15 @@
import MendixNative

@UIApplicationMain
class AppDelegate: ReactAppProvider, UNUserNotificationCenterDelegate {
class AppDelegate: ReactAppProvider {

var shouldOpenInLastApp = false
var hasHandledLaunchAppWithOptions = false

override func application(_ application: UIApplication, didFinishLaunchingWithOptions launchOptions: [UIApplicationLaunchOptionsKey : Any]? = nil) -> Bool {

setupApp(application: application, launchOptions: launchOptions)
MendixAppDelegate.delegate = self
UNUserNotificationCenter.current().delegate = self
MendixAppDelegate.application(application, didFinishLaunchingWithOptions: launchOptions)

setupApp(application: application, launchOptions: launchOptions)
changeRoot(to: UIViewController())

guard let url = Bundle.main.object(forInfoDictionaryKey: "Runtime url") as? String, !url.isEmpty else {
Expand Down Expand Up @@ -58,8 +55,4 @@ class AppDelegate: ReactAppProvider, UNUserNotificationCenterDelegate {
func getWarningFilterValue() -> WarningsFilter {
return .none
}

func userNotificationCenter(_ center: UNUserNotificationCenter, willPresent notification: UNNotification, withCompletionHandler completionHandler: @escaping (UNNotificationPresentationOptions) -> Void) {
MendixAppDelegate.userNotificationCenter(center, willPresentNotification: notification, withCompletionHandler: completionHandler)
}
}
10 changes: 0 additions & 10 deletions ios/Dev/AppDelegate.h

This file was deleted.

11 changes: 3 additions & 8 deletions ios/Dev/AppDelegate.swift
Original file line number Diff line number Diff line change
Expand Up @@ -2,16 +2,15 @@ import Foundation
import MendixNative

@UIApplicationMain
class AppDelegate: ReactAppProvider, UNUserNotificationCenterDelegate {
class AppDelegate: ReactAppProvider {

var shouldOpenInLastApp = false
var hasHandledLaunchAppWithOptions = false

override func application(_ application: UIApplication, didFinishLaunchingWithOptions launchOptions: [UIApplicationLaunchOptionsKey : Any]? = nil) -> Bool {
setupApp(application: application, launchOptions: launchOptions)
MendixAppDelegate.delegate = self
UNUserNotificationCenter.current().delegate = self

MendixAppDelegate.application(application, didFinishLaunchingWithOptions: launchOptions)
setupApp(application: application, launchOptions: launchOptions)

IQKeyboardManager.shared().isEnabled = false

Expand All @@ -22,10 +21,6 @@ class AppDelegate: ReactAppProvider, UNUserNotificationCenterDelegate {
return true
}

func userNotificationCenter(_ center: UNUserNotificationCenter, willPresent notification: UNNotification, withCompletionHandler completionHandler: @escaping (UNNotificationPresentationOptions) -> Void) {
MendixAppDelegate.userNotificationCenter(center, willPresentNotification: notification, withCompletionHandler: completionHandler)
}

func getWarningFilterValue() -> WarningsFilter {
#if DEBUG
return .all
Expand Down
42 changes: 0 additions & 42 deletions ios/MendixAppDelegate.swift

This file was deleted.

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

Expand Down Expand Up @@ -77,72 +72,42 @@ def generate_mendix_delegate
end
end

File.open("MendixAppDelegate.m", "w") do |file|
File.open("MendixAppDelegate.swift", "w") do |file|
mendix_app_delegate = mendix_app_delegate_template.sub("{{ imports }}", stringify(imports))
hooks.each { |name, hook| mendix_app_delegate.sub!("{{ #{name.to_s} }}", stringify(hook)) }
returnHooks.each { |name, hook| mendix_app_delegate.sub!("{{ #{name.to_s} }}", stringify(hook).length > 0 ? stringify(hook) : " return YES;") }
returnHooks.each { |name, hook| mendix_app_delegate.sub!("{{ #{name.to_s} }}", stringify(hook).length > 0 ? stringify(hook) : " return true") }
file << mendix_app_delegate
end
end

def mendix_app_delegate_template
%(// DO NOT EDIT BY HAND. THIS FILE IS AUTO-GENERATED
#import <Foundation/Foundation.h>
#import <MendixNative.h>
#import "MendixAppDelegate.h"
import Foundation
import MendixNative
{{ imports }}

@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 }}
}

+ (void) application:(UIApplication *)application openURL:(NSURL *)url sourceApplication:(NSString *)sourceApplication annotation:(id)annotation {
{{ 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;
}
/// Auto-generated implementation of MendixAppDelegate
/// Generated based on enabled capabilities in capabilities.ios.json
class MendixAppDelegate: NSObject {

static func application(_ application: UIApplication, didFinishLaunchingWithOptions launchOptions: [UIApplication.LaunchOptionsKey: Any]?) {
{{ didFinishLaunchingWithOptions }}
}

+ (NSURL *) getJSBundleFile {
{{ getJSBundleFile }}
return [ReactNative.instance getJSBundleFile];
static func application(_ application: UIApplication, openURL url: URL, options: [UIApplication.OpenURLOptionsKey: Any] = [:]) -> Bool {
{{ boolean_openURLWithOptions }}
}

static func application(_ application: UIApplication, openURL url: URL, sourceApplication: String?, annotation: Any) {
{{ openURL }}
}

static func getJSBundleFile() -> URL? {
{{ getJSBundleFile }}
return BundleHelper.getJSBundleFile()
}
}

@end\n)
)
end

def stringify(array)
Expand Down
6 changes: 6 additions & 0 deletions ios/nativeTemplate.xcodeproj/project.pbxproj
Original file line number Diff line number Diff line change
Expand Up @@ -692,6 +692,7 @@
DEAD_CODE_STRIPPING = YES;
DEVELOPMENT_TEAM = BC32QNM6AD;
ENABLE_BITCODE = "$(inherited)";
"EXCLUDED_ARCHS[sdk=iphonesimulator*]" = "";
FRAMEWORK_SEARCH_PATHS = (
"$(inherited)",
"\"${PODS_ROOT}/FirebaseAnalytics/Frameworks\"",
Expand Down Expand Up @@ -772,6 +773,7 @@
CURRENT_PROJECT_VERSION = 1;
DEVELOPMENT_TEAM = BC32QNM6AD;
ENABLE_BITCODE = "$(inherited)";
"EXCLUDED_ARCHS[sdk=iphonesimulator*]" = "";
FRAMEWORK_SEARCH_PATHS = (
"$(inherited)",
"\"${PODS_ROOT}/FirebaseAnalytics/Frameworks\"",
Expand Down Expand Up @@ -860,6 +862,7 @@
DEVELOPMENT_TEAM = "";
"DEVELOPMENT_TEAM[sdk=iphoneos*]" = BC32QNM6AD;
ENABLE_BITCODE = "$(inherited)";
"EXCLUDED_ARCHS[sdk=iphonesimulator*]" = "";
FRAMEWORK_SEARCH_PATHS = (
"$(inherited)",
"${SRCROOT}/../node_modules/@mendix/native/ios",
Expand Down Expand Up @@ -916,6 +919,7 @@
DEVELOPMENT_TEAM = "";
"DEVELOPMENT_TEAM[sdk=iphoneos*]" = BC32QNM6AD;
ENABLE_BITCODE = "$(inherited)";
"EXCLUDED_ARCHS[sdk=iphonesimulator*]" = "";
FRAMEWORK_SEARCH_PATHS = (
"$(inherited)",
"${SRCROOT}/../node_modules/@mendix/native/ios",
Expand Down Expand Up @@ -1029,6 +1033,7 @@
CURRENT_PROJECT_VERSION = 1;
DEVELOPMENT_TEAM = BC32QNM6AD;
ENABLE_BITCODE = "$(inherited)";
"EXCLUDED_ARCHS[sdk=iphonesimulator*]" = "";
FRAMEWORK_SEARCH_PATHS = (
"$(inherited)",
"\"${PODS_ROOT}/FirebaseAnalytics/Frameworks\"",
Expand Down Expand Up @@ -1118,6 +1123,7 @@
DEVELOPMENT_TEAM = "";
"DEVELOPMENT_TEAM[sdk=iphoneos*]" = BC32QNM6AD;
ENABLE_BITCODE = "$(inherited)";
"EXCLUDED_ARCHS[sdk=iphonesimulator*]" = "";
FRAMEWORK_SEARCH_PATHS = (
"$(inherited)",
"${SRCROOT}/../node_modules/@mendix/native/ios",
Expand Down
6 changes: 5 additions & 1 deletion mendix_version.json
Original file line number Diff line number Diff line change
@@ -1,6 +1,10 @@
{
">=11.0.0": {
">=11.5.0": {
"max": "*",
"min": "16.0.0"
},
">=11.0.0": {
"max": "15.*.*",
"min": "15.0.0"
},
">=10.24.0": {
Expand Down
1 change: 1 addition & 0 deletions package.json
Original file line number Diff line number Diff line change
Expand Up @@ -3,6 +3,7 @@
"version": "15.4.4",
"private": true,
"scripts": {
"preinstall": "node scripts/delete-stale-files.js",
"postinstall": "node patches/apply-patches.js && jetify",
"configure": "native-mobile-toolkit configure --config-path='./config.json' --verbose"
},
Expand Down
Loading