@mendix/native 1.0.0

This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
Files changed (55) hide show
  1. package/LICENSE.md +19 -0
  2. package/android/build.gradle +2 -0
  3. package/android/mendix.gradle +438 -0
  4. package/android/mendixnative-release.aar +0 -0
  5. package/ios/.keep +0 -0
  6. package/ios/mendixnative.xcframework/Info.plist +44 -0
  7. package/ios/mendixnative.xcframework/ios-arm64/Headers/AppMenuProtocol.h +10 -0
  8. package/ios/mendixnative.xcframework/ios-arm64/Headers/AppPreferences.h +18 -0
  9. package/ios/mendixnative.xcframework/ios-arm64/Headers/AppUrl.h +16 -0
  10. package/ios/mendixnative.xcframework/ios-arm64/Headers/DevAppMenuUIAlertController.h +7 -0
  11. package/ios/mendixnative.xcframework/ios-arm64/Headers/JSBundleFileProviderProtocol.h +9 -0
  12. package/ios/mendixnative.xcframework/ios-arm64/Headers/MendixApp.h +33 -0
  13. package/ios/mendixnative.xcframework/ios-arm64/Headers/MendixBackwardsCompatUtility.h +14 -0
  14. package/ios/mendixnative.xcframework/ios-arm64/Headers/MendixNative.h +20 -0
  15. package/ios/mendixnative.xcframework/ios-arm64/Headers/MendixReactWindow.h +10 -0
  16. package/ios/mendixnative.xcframework/ios-arm64/Headers/MxConfiguration.h +26 -0
  17. package/ios/mendixnative.xcframework/ios-arm64/Headers/NativeDownloadHandler.h +26 -0
  18. package/ios/mendixnative.xcframework/ios-arm64/Headers/NativeOtaModule.h +14 -0
  19. package/ios/mendixnative.xcframework/ios-arm64/Headers/NativeReloadHandler.h +12 -0
  20. package/ios/mendixnative.xcframework/ios-arm64/Headers/OtaConstants.h +35 -0
  21. package/ios/mendixnative.xcframework/ios-arm64/Headers/OtaHelpers.h +13 -0
  22. package/ios/mendixnative.xcframework/ios-arm64/Headers/OtaJSBundleFileProvider.h +10 -0
  23. package/ios/mendixnative.xcframework/ios-arm64/Headers/ReactNative.h +54 -0
  24. package/ios/mendixnative.xcframework/ios-arm64/Headers/RuntimeInfo.h +14 -0
  25. package/ios/mendixnative.xcframework/ios-arm64/Headers/RuntimeInfoProvider.h +10 -0
  26. package/ios/mendixnative.xcframework/ios-arm64/Headers/RuntimeInfoResponse.h +13 -0
  27. package/ios/mendixnative.xcframework/ios-arm64/Headers/SplashScreenPresenterProtocol.h +10 -0
  28. package/ios/mendixnative.xcframework/ios-arm64/Headers/UnsupportedFeatures.h +12 -0
  29. package/ios/mendixnative.xcframework/ios-arm64/Headers/WarningsFilter.h +12 -0
  30. package/ios/mendixnative.xcframework/ios-arm64/libMendixNative.a +0 -0
  31. package/ios/mendixnative.xcframework/ios-arm64_x86_64-simulator/Headers/AppMenuProtocol.h +10 -0
  32. package/ios/mendixnative.xcframework/ios-arm64_x86_64-simulator/Headers/AppPreferences.h +18 -0
  33. package/ios/mendixnative.xcframework/ios-arm64_x86_64-simulator/Headers/AppUrl.h +16 -0
  34. package/ios/mendixnative.xcframework/ios-arm64_x86_64-simulator/Headers/DevAppMenuUIAlertController.h +7 -0
  35. package/ios/mendixnative.xcframework/ios-arm64_x86_64-simulator/Headers/JSBundleFileProviderProtocol.h +9 -0
  36. package/ios/mendixnative.xcframework/ios-arm64_x86_64-simulator/Headers/MendixApp.h +33 -0
  37. package/ios/mendixnative.xcframework/ios-arm64_x86_64-simulator/Headers/MendixBackwardsCompatUtility.h +14 -0
  38. package/ios/mendixnative.xcframework/ios-arm64_x86_64-simulator/Headers/MendixNative.h +20 -0
  39. package/ios/mendixnative.xcframework/ios-arm64_x86_64-simulator/Headers/MendixReactWindow.h +10 -0
  40. package/ios/mendixnative.xcframework/ios-arm64_x86_64-simulator/Headers/MxConfiguration.h +26 -0
  41. package/ios/mendixnative.xcframework/ios-arm64_x86_64-simulator/Headers/NativeDownloadHandler.h +26 -0
  42. package/ios/mendixnative.xcframework/ios-arm64_x86_64-simulator/Headers/NativeOtaModule.h +14 -0
  43. package/ios/mendixnative.xcframework/ios-arm64_x86_64-simulator/Headers/NativeReloadHandler.h +12 -0
  44. package/ios/mendixnative.xcframework/ios-arm64_x86_64-simulator/Headers/OtaConstants.h +35 -0
  45. package/ios/mendixnative.xcframework/ios-arm64_x86_64-simulator/Headers/OtaHelpers.h +13 -0
  46. package/ios/mendixnative.xcframework/ios-arm64_x86_64-simulator/Headers/OtaJSBundleFileProvider.h +10 -0
  47. package/ios/mendixnative.xcframework/ios-arm64_x86_64-simulator/Headers/ReactNative.h +54 -0
  48. package/ios/mendixnative.xcframework/ios-arm64_x86_64-simulator/Headers/RuntimeInfo.h +14 -0
  49. package/ios/mendixnative.xcframework/ios-arm64_x86_64-simulator/Headers/RuntimeInfoProvider.h +10 -0
  50. package/ios/mendixnative.xcframework/ios-arm64_x86_64-simulator/Headers/RuntimeInfoResponse.h +13 -0
  51. package/ios/mendixnative.xcframework/ios-arm64_x86_64-simulator/Headers/SplashScreenPresenterProtocol.h +10 -0
  52. package/ios/mendixnative.xcframework/ios-arm64_x86_64-simulator/Headers/UnsupportedFeatures.h +12 -0
  53. package/ios/mendixnative.xcframework/ios-arm64_x86_64-simulator/Headers/WarningsFilter.h +12 -0
  54. package/ios/mendixnative.xcframework/ios-arm64_x86_64-simulator/libMendixNative.a +0 -0
  55. package/package.json +18 -0
package/LICENSE.md ADDED
@@ -0,0 +1,19 @@
1
+ Copyright (c) Mendix
2
+
3
+ Permission is hereby granted, free of charge, to any person obtaining a copy
4
+ of this software and associated documentation files (the "Software"), to deal
5
+ in the Software without restriction, including without limitation the rights
6
+ to use, copy, modify, merge, publish, distribute, sublicense, and/or sell
7
+ copies of the Software, and to permit persons to whom the Software is
8
+ furnished to do so, subject to the following conditions:
9
+
10
+ The above copyright notice and this permission notice shall be included in all
11
+ copies or substantial portions of the Software.
12
+
13
+ THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR
14
+ IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY,
15
+ FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE
16
+ AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER
17
+ LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM,
18
+ OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN THE
19
+ SOFTWARE.
@@ -0,0 +1,2 @@
1
+ configurations.maybeCreate("default")
2
+ artifacts.add("default", file("mendixnative-release.aar"))
@@ -0,0 +1,438 @@
1
+ import groovy.json.JsonSlurper
2
+
3
+ def LOG_PREFIX = ":Mendix: "
4
+
5
+ def rootDir = buildscript.sourceFile.toString().split("node_modules")[0]
6
+ def cliBinPath = "${rootDir}/node_modules/.bin/react-native${System.properties['os.name'].toLowerCase().contains('windows') ? ".cmd" : ""}"
7
+
8
+ def generatedFilePackage = "com.mendix.nativetemplate"
9
+ def mainActivityObserverFileName = "MendixActivityObserver.java"
10
+ def mainActivityObserverTemplate = """package $generatedFilePackage;
11
+
12
+ import android.content.Context;
13
+
14
+ import androidx.lifecycle.Lifecycle;
15
+ import androidx.lifecycle.LifecycleObserver;
16
+ import androidx.lifecycle.OnLifecycleEvent;
17
+ {{imports}}
18
+
19
+ public class MendixActivityObserver implements LifecycleObserver {
20
+ private final Context context;
21
+
22
+ public MendixActivityObserver(Context activity) {
23
+ this.context = activity;
24
+ }
25
+
26
+ @OnLifecycleEvent(Lifecycle.Event.ON_CREATE)
27
+ void onCreate() {
28
+ {{onCreate}}
29
+ }
30
+
31
+ @OnLifecycleEvent(Lifecycle.Event.ON_RESUME)
32
+ void onResume() {
33
+ {{onResume}}
34
+ }
35
+
36
+ @OnLifecycleEvent(Lifecycle.Event.ON_START)
37
+ void onStart() {
38
+ {{onStart}}
39
+ }
40
+
41
+ @OnLifecycleEvent(Lifecycle.Event.ON_PAUSE)
42
+ void onPause() {
43
+ {{onPause}}
44
+ }
45
+
46
+ @OnLifecycleEvent(Lifecycle.Event.ON_STOP)
47
+ void onStop() {
48
+ {{onStop}}
49
+ }
50
+
51
+ @OnLifecycleEvent(Lifecycle.Event.ON_DESTROY)
52
+ void onDestroy() {
53
+ {{onDestroy}}
54
+ }
55
+ }
56
+ """
57
+ def mendixPackageListFileName = "MendixPackageList.java"
58
+ def mendixPackageListTemplate = """package $generatedFilePackage;
59
+
60
+ import android.app.Application;
61
+ import android.content.Context;
62
+ import android.content.res.Resources;
63
+
64
+ import com.facebook.react.ReactPackage;
65
+ import com.facebook.react.shell.MainPackageConfig;
66
+ import com.facebook.react.shell.MainReactPackage;
67
+ import java.util.Arrays;
68
+ import java.util.ArrayList;
69
+
70
+ {{imports}}
71
+
72
+ public class MendixPackageList {
73
+ private Application application;
74
+
75
+ public MendixPackageList(Application application) {
76
+ this.application = application;
77
+ }
78
+
79
+ private Resources getResources() {
80
+ return this.getApplication().getResources();
81
+ }
82
+
83
+ private Application getApplication() {
84
+ return this.application;
85
+ }
86
+
87
+ private Context getApplicationContext() {
88
+ return this.getApplication().getApplicationContext();
89
+ }
90
+
91
+ public ArrayList<ReactPackage> getPackages() {
92
+ return new ArrayList<>(Arrays.<ReactPackage>asList(
93
+ {{packageClassInstances}}
94
+ ));
95
+ }
96
+ }
97
+ """
98
+
99
+ class MendixModules {
100
+ private static String LINE_ENDING_CHAR = "\n"
101
+
102
+ private String cliBinPath
103
+ private String rootDir
104
+ private String logPrefix
105
+ private Logger logger
106
+ private ArrayList<HashMap<String, String>> reactNativeModules
107
+ private Map dependenciesConfig = [:]
108
+ private File capabilitiesConfigFile
109
+ private File projectCapabilitiesFile
110
+ private File nodeModulesDependenciesConfigFile
111
+
112
+ MendixModules(File capabilitiesConfigFile, File nodeModulesDependenciesConfigFile, File projectCapabilitiesFile, String cliBinPath, String rootDir, Logger logger, String logPrefix) {
113
+ this.logger = logger
114
+ this.rootDir = rootDir
115
+ this.cliBinPath = cliBinPath
116
+ this.logPrefix = logPrefix
117
+ this.capabilitiesConfigFile = capabilitiesConfigFile
118
+ this.nodeModulesDependenciesConfigFile = nodeModulesDependenciesConfigFile
119
+ this.projectCapabilitiesFile = projectCapabilitiesFile
120
+
121
+ def (nativeModules) = this.getReactNativeConfig()
122
+ this.reactNativeModules = nativeModules
123
+ parseDependenciesConfig()
124
+ }
125
+
126
+ void printDependencies() {
127
+ this.reactNativeModules.each {
128
+ logDebug(it["name"])
129
+ }
130
+ }
131
+
132
+ void parseDependenciesConfig() {
133
+ def dependenciesConfig = [:]
134
+ def capabilitiesConfig = [:]
135
+
136
+ try {
137
+ capabilitiesConfig = new JsonSlurper().parse(this.capabilitiesConfigFile)
138
+ def projectCapabilities = new JsonSlurper().parse(this.projectCapabilitiesFile)
139
+ capabilitiesConfig.retainAll { capabilityConfig ->
140
+ projectCapabilities.find { enabledCapability ->
141
+ enabledCapability.key == capabilityConfig.key && enabledCapability.value == true
142
+ } && capabilityConfig.value["android"] != null
143
+ }
144
+ } catch (ignored) {
145
+ this.logLifecycle("Failed parsing the capabilities file. Error?")
146
+ }
147
+
148
+ if (this.nodeModulesDependenciesConfigFile.exists()) {
149
+ try {
150
+ dependenciesConfig = new JsonSlurper().parse(this.nodeModulesDependenciesConfigFile)
151
+ (dependenciesConfig as Map).retainAll { dependencyConfig ->
152
+ this.reactNativeModules.find { nativeModule ->
153
+ nativeModule.get("name") == dependencyConfig.key
154
+ } && dependencyConfig.value["android"] != null
155
+ }
156
+ } catch (ignored) {
157
+ this.logLifecycle("Failed parsing the configuration for unlinked node_modules. Error?")
158
+ }
159
+ }
160
+
161
+ this.dependenciesConfig = capabilitiesConfig + dependenciesConfig
162
+ printDependencies()
163
+ }
164
+
165
+ void generateMainActivityObserver(File outDir, String fileName, String template) {
166
+ def activityImports = []
167
+ def activityOnCreateEntries = []
168
+ def activityOnStartEntries = []
169
+ def activityOnResumeEntries = []
170
+ def activityOnPauseEntries = []
171
+ def activityOnStopEntries = []
172
+ def activityOnDestroyEntries = []
173
+
174
+ dependenciesConfig.each {
175
+ def mainActivityDelegateEntry = it.value["android"]["MainActivity"]
176
+ if (!mainActivityDelegateEntry)
177
+ return
178
+
179
+ def imports = mainActivityDelegateEntry.get("imports")
180
+ if (imports)
181
+ activityImports.addAll(imports)
182
+
183
+ def onCreateEntries = mainActivityDelegateEntry.get("onCreate")
184
+ if (onCreateEntries)
185
+ activityOnCreateEntries.addAll(onCreateEntries)
186
+
187
+ def onStartEntries = mainActivityDelegateEntry.get("onStart")
188
+ if (onStartEntries)
189
+ activityOnStartEntries.addAll(onStartEntries)
190
+
191
+ def onResumeEntries = mainActivityDelegateEntry.get("onResume")
192
+ if (onResumeEntries)
193
+ activityOnResumeEntries.addAll(onResumeEntries)
194
+
195
+ def onPauseEntries = mainActivityDelegateEntry.get("onPause")
196
+ if (onPauseEntries)
197
+ activityOnPauseEntries.addAll(onPauseEntries)
198
+
199
+ def onStopEntries = mainActivityDelegateEntry.get("onStop")
200
+ if (onStopEntries)
201
+ activityOnStopEntries.addAll(onStopEntries)
202
+
203
+ def onDestroyEntries = mainActivityDelegateEntry.get("onDestroy")
204
+ if (onDestroyEntries)
205
+ activityOnDestroyEntries.addAll(onDestroyEntries)
206
+ }
207
+
208
+ String CODE_PADDING = "${LINE_ENDING_CHAR} "
209
+ String generatedFileContents = template
210
+ .replace("{{imports}}", activityImports.join(LINE_ENDING_CHAR))
211
+ .replace("{{onCreate}}", activityOnCreateEntries.join(CODE_PADDING))
212
+ .replace("{{onStart}}", activityOnStartEntries.join(CODE_PADDING))
213
+ .replace("{{onResume}}", activityOnResumeEntries.join(CODE_PADDING))
214
+ .replace("{{onPause}}", activityOnPauseEntries.join(CODE_PADDING))
215
+ .replace("{{onStop}}", activityOnStopEntries.join(CODE_PADDING))
216
+ .replace("{{onDestroy}}", activityOnDestroyEntries.join(CODE_PADDING))
217
+
218
+ outDir.mkdirs()
219
+ new FileTreeBuilder(outDir).file(fileName).newWriter().withWriter {
220
+ w ->
221
+ w << generatedFileContents
222
+ }
223
+ }
224
+
225
+ void generateMendixPackageList(File outDir, String fileName, String template) {
226
+ String CODE_PADDING = "${LINE_ENDING_CHAR} "
227
+ def imports = []
228
+ def entries = []
229
+ def entrySeparator = "," + CODE_PADDING
230
+ dependenciesConfig.each {
231
+ def packageListEntry = it.value["android"]["packageListEntries"]
232
+ if (packageListEntry) {
233
+ def importsEntry = packageListEntry["imports"]
234
+ def packageClassInstances = packageListEntry["packageClassInstances"]
235
+ if (importsEntry)
236
+ imports.addAll(importsEntry)
237
+ if (packageClassInstances)
238
+ entries.addAll(packageClassInstances)
239
+ }
240
+ }
241
+
242
+ String generatedFileContents = template.replace("{{imports}}", imports.join(CODE_PADDING)).replace("{{packageClassInstances}}", entries.join(entrySeparator))
243
+
244
+ outDir.mkdirs()
245
+ new FileTreeBuilder(outDir).file(fileName).newWriter().withWriter {
246
+ w ->
247
+ w << generatedFileContents
248
+ }
249
+ }
250
+
251
+ void addClassPaths(Project project) {
252
+ project.buildscript {
253
+ dependencies {
254
+ dependenciesConfig.each {
255
+ def gradle = (it.value as Object)["android"]["gradle"]
256
+ if (!gradle) {
257
+ return
258
+ }
259
+ def customClassPaths = gradle.get("classpaths") as ArrayList<String>
260
+ customClassPaths.each { customClassPath ->
261
+ this.logLifecycle("Adding classPath ${customClassPath}")
262
+ classpath(customClassPath)
263
+ }
264
+ }
265
+ }
266
+ }
267
+ }
268
+
269
+ void addExtraDependencies(Project project) {
270
+ project.dependencies {
271
+ dependenciesConfig.each {
272
+ def dependencies = it.value["android"]["externalDependencies"] as ArrayList<String>
273
+ dependencies.each { dependency ->
274
+ this.logLifecycle("Registering extra library ${dependency}")
275
+ implementation(dependency)
276
+ }
277
+ }
278
+ }
279
+ }
280
+
281
+ void addAndroidPlugins(Project project) {
282
+ dependenciesConfig.each {
283
+ def gradleConfig = it.value["android"]["gradle"]
284
+ if (!gradleConfig)
285
+ return
286
+
287
+ def dependencies = gradleConfig["plugins"] as ArrayList<String>
288
+ if (!dependencies)
289
+ return
290
+
291
+ dependencies.each { plugin ->
292
+ this.logLifecycle("Adding plugin ${plugin}")
293
+ project.getPluginManager().apply(plugin)
294
+ }
295
+ }
296
+ }
297
+
298
+ void logDebug(String message) {
299
+ this.logger.debug("${this.logPrefix}${message}")
300
+ }
301
+
302
+ void logLifecycle(String message) {
303
+ this.logger.lifecycle("${this.logPrefix}${message}")
304
+ }
305
+
306
+ void logError(String message) {
307
+ this.logger.error("${this.logPrefix}${message}")
308
+ }
309
+
310
+ /**
311
+ * Runs a specified command using Runtime exec() in a specified directory.
312
+ * Throws when the command result is empty.
313
+ */
314
+ String getCommandOutput(String[] command) {
315
+ try {
316
+ def output = ""
317
+ def cmdProcess = Runtime.getRuntime().exec(command)
318
+ def bufferedReader = new BufferedReader(new InputStreamReader(cmdProcess.getInputStream()))
319
+ def buff = ""
320
+ def readBuffer = new StringBuffer()
321
+ while ((buff = bufferedReader.readLine()) != null) {
322
+ readBuffer.append(buff)
323
+ }
324
+ output = readBuffer.toString()
325
+ if (!output) {
326
+ this.logger.error("${logPrefix}Unexpected empty result of running '${command}' command.")
327
+ def bufferedErrorReader = new BufferedReader(new InputStreamReader(cmdProcess.getErrorStream()))
328
+ def errBuff = ""
329
+ def readErrorBuffer = new StringBuffer()
330
+ while ((errBuff = bufferedErrorReader.readLine()) != null) {
331
+ readErrorBuffer.append(errBuff)
332
+ }
333
+ throw new Exception(readErrorBuffer.toString())
334
+ }
335
+ return output
336
+ } catch (Exception exception) {
337
+ this.logError("Running '${command}' command failed.")
338
+ throw exception
339
+ }
340
+ }
341
+
342
+ /**
343
+ * Runs a process to call the React Native CLI Config command and parses the output
344
+ */
345
+ ArrayList<HashMap<String, String>> getReactNativeConfig() {
346
+ if (this.reactNativeModules != null) return this.reactNativeModules
347
+
348
+ ArrayList<HashMap<String, String>> reactNativeModules = new ArrayList<HashMap<String, String>>()
349
+
350
+ String[] reactNativeConfigCommand = [this.cliBinPath, "config"]
351
+ def reactNativeConfigOutput = this.getCommandOutput(reactNativeConfigCommand)
352
+
353
+ def json
354
+ try {
355
+ json = new JsonSlurper().parseText(reactNativeConfigOutput)
356
+ } catch (Exception exception) {
357
+ throw new Exception("Calling `${reactNativeConfigCommand}` finished with an exception. Error message: ${exception.toString()}. Output: ${reactNativeConfigOutput}");
358
+ }
359
+ def dependencies = json["dependencies"]
360
+ def project = json["project"]["android"]
361
+
362
+ if (project == null) {
363
+ throw new Exception("React Native CLI failed to determine Android project configuration. This is likely due to misconfiguration. Config output:\n${json.toMapString()}")
364
+ }
365
+
366
+ dependencies.each { name, value ->
367
+ def platformsConfig = value["platforms"];
368
+ def androidConfig = platformsConfig["android"]
369
+
370
+ if (androidConfig != null && androidConfig["sourceDir"] != null) {
371
+ this.logger.info("${logPrefix}Automatically adding native module '${name}'")
372
+
373
+ HashMap reactNativeModuleConfig = new HashMap<String, String>()
374
+ reactNativeModuleConfig.put("name", name)
375
+ reactNativeModuleConfig.put("nameCleansed", name.replaceAll('^@([\\w-]+)/', '$1_'))
376
+ reactNativeModuleConfig.put("androidSourceDir", androidConfig["sourceDir"])
377
+ reactNativeModuleConfig.put("packageInstance", androidConfig["packageInstance"])
378
+ reactNativeModuleConfig.put("packageImportPath", androidConfig["packageImportPath"])
379
+ this.logger.trace("${logPrefix}'${name}': ${reactNativeModuleConfig.toMapString()}")
380
+
381
+ reactNativeModules.add(reactNativeModuleConfig)
382
+ } else {
383
+ this.logger.info("${logPrefix}Skipping native module '${name}'")
384
+ }
385
+ }
386
+
387
+ return [reactNativeModules, json["project"]["android"]["packageName"]];
388
+ }
389
+ }
390
+
391
+ def generatedSrcDir = new File(buildDir, "generated/mendix/src/main/java")
392
+ def generatedCodeDir = new File(generatedSrcDir, generatedFilePackage.replace('.', '/'))
393
+
394
+ def capabilitiesConfig = new File("${rootDir}capabilities-setup-config.json")
395
+ def unlinkedDependenciesConfigFile = new File("${rootDir}unlinked-dependency-config.json")
396
+ def capabilitiesFile = new File("${rootDir}capabilities.android.json")
397
+ def mendixModules = new MendixModules(capabilitiesConfig, unlinkedDependenciesConfigFile, capabilitiesFile, cliBinPath, rootDir, logger, LOG_PREFIX)
398
+
399
+ def logLifecycle = { String message -> logger.lifecycle("${LOG_PREFIX}${message}") }
400
+
401
+
402
+ ext.applyMendixGradle = { Project project ->
403
+ logLifecycle("Registering extra dependencies")
404
+ mendixModules.addExtraDependencies(project)
405
+
406
+ logLifecycle("Registering plugins")
407
+ mendixModules.addAndroidPlugins(project)
408
+ task generateMendixDependencies {
409
+ doLast {
410
+ logLifecycle("Executing Mendix Module Generator")
411
+ logLifecycle("App root: ${rootDir}")
412
+ logLifecycle("CLI path: ${cliBinPath}")
413
+
414
+ logLifecycle("Generating ${mainActivityObserverFileName}")
415
+ mendixModules.generateMainActivityObserver(generatedCodeDir, mainActivityObserverFileName, mainActivityObserverTemplate)
416
+
417
+ logLifecycle("Generating ${mendixPackageListFileName}")
418
+ mendixModules.generateMendixPackageList(generatedCodeDir, mendixPackageListFileName, mendixPackageListTemplate)
419
+ }
420
+ }
421
+
422
+ preBuild.dependsOn generateMendixDependencies
423
+
424
+ android {
425
+ sourceSets {
426
+ main {
427
+ java {
428
+ srcDirs += generatedSrcDir
429
+ }
430
+ }
431
+ }
432
+ }
433
+ }
434
+
435
+ ext.applyMendixClassPaths = { Project project ->
436
+ logLifecycle("Registering class paths")
437
+ mendixModules.addClassPaths(project)
438
+ }
Binary file
package/ios/.keep ADDED
File without changes
@@ -0,0 +1,44 @@
1
+ <?xml version="1.0" encoding="UTF-8"?>
2
+ <!DOCTYPE plist PUBLIC "-//Apple//DTD PLIST 1.0//EN" "http://www.apple.com/DTDs/PropertyList-1.0.dtd">
3
+ <plist version="1.0">
4
+ <dict>
5
+ <key>AvailableLibraries</key>
6
+ <array>
7
+ <dict>
8
+ <key>HeadersPath</key>
9
+ <string>Headers</string>
10
+ <key>LibraryIdentifier</key>
11
+ <string>ios-arm64</string>
12
+ <key>LibraryPath</key>
13
+ <string>libMendixNative.a</string>
14
+ <key>SupportedArchitectures</key>
15
+ <array>
16
+ <string>arm64</string>
17
+ </array>
18
+ <key>SupportedPlatform</key>
19
+ <string>ios</string>
20
+ </dict>
21
+ <dict>
22
+ <key>HeadersPath</key>
23
+ <string>Headers</string>
24
+ <key>LibraryIdentifier</key>
25
+ <string>ios-arm64_x86_64-simulator</string>
26
+ <key>LibraryPath</key>
27
+ <string>libMendixNative.a</string>
28
+ <key>SupportedArchitectures</key>
29
+ <array>
30
+ <string>arm64</string>
31
+ <string>x86_64</string>
32
+ </array>
33
+ <key>SupportedPlatform</key>
34
+ <string>ios</string>
35
+ <key>SupportedPlatformVariant</key>
36
+ <string>simulator</string>
37
+ </dict>
38
+ </array>
39
+ <key>CFBundlePackageType</key>
40
+ <string>XFWK</string>
41
+ <key>XCFrameworkFormatVersion</key>
42
+ <string>1.0</string>
43
+ </dict>
44
+ </plist>
@@ -0,0 +1,10 @@
1
+ //
2
+ // Copyright (c) Mendix, Inc. All rights reserved.
3
+ //
4
+
5
+ #import <Foundation/Foundation.h>
6
+
7
+ @protocol AppMenuProtocol
8
+ @required
9
+ -(void) show:(BOOL)devMode;
10
+ @end
@@ -0,0 +1,18 @@
1
+ //
2
+ // Copyright (c) Mendix, Inc. All rights reserved.
3
+ //
4
+
5
+ #import <Foundation/Foundation.h>
6
+
7
+ @interface AppPreferences : NSObject
8
+ + (NSString *) getAppUrl;
9
+ + (void) setAppUrl:(NSString *)url;
10
+ + (BOOL) devModeEnabled;
11
+ + (void) devMode:(BOOL)enable;
12
+ + (BOOL) remoteDebuggingEnabled;
13
+ + (void) remoteDebugging:(BOOL)enable;
14
+ + (void) setRemoteDebuggingPackagerPort:(NSInteger)port;
15
+ + (int) getRemoteDebuggingPackagerPort;
16
+ + (BOOL) isElementInspectorEnabled;
17
+ + (void) setElementInspector:(BOOL)enable;
18
+ @end
@@ -0,0 +1,16 @@
1
+ //
2
+ // Copyright (c) Mendix, Inc. All rights reserved.
3
+ //
4
+
5
+ #import <Foundation/Foundation.h>
6
+
7
+ @interface AppUrl: NSObject
8
+ + (int) defaultPackagerPort;
9
+
10
+ + (NSURL *) forBundle:(NSString *)url port:(int)port isDebuggingRemotely:(BOOL)isDebuggingRemotely isDevModeEnabled:(BOOL)isDevModeEnabled;
11
+ + (NSURL *) forRuntime:(NSString *)url;
12
+ + (NSURL *) forValidation:(NSString*)url;
13
+ + (NSURL *) forRuntimeInfo:(NSString*)url;
14
+ + (NSURL *) forPackagerStatus:(NSString*)url port:(int)port;
15
+ + (BOOL) isValid:(NSString*)url;
16
+ @end
@@ -0,0 +1,7 @@
1
+ //
2
+ // Copyright (c) Mendix, Inc. All rights reserved.
3
+ //
4
+ #import <UIKit/UIKit.h>
5
+
6
+ @interface DevAppMenuUIAlertController : UIAlertController
7
+ @end
@@ -0,0 +1,9 @@
1
+ //
2
+ // Copyright (c) Mendix, Inc. All rights reserved.
3
+ //
4
+
5
+ @protocol JSBundleFileProviderProtocol <NSObject>
6
+
7
+ + (nullable NSURL *)getBundleUrl;
8
+
9
+ @end
@@ -0,0 +1,33 @@
1
+ //
2
+ // Copyright (c) Mendix, Inc. All rights reserved.
3
+ //
4
+
5
+ #import <Foundation/Foundation.h>
6
+ #import <UIKit/UIKit.h>
7
+ #import "AppMenuProtocol.h"
8
+ #import "SplashScreenPresenterProtocol.h"
9
+ #import "WarningsFilter.h"
10
+
11
+ @interface MendixApp : NSObject
12
+ @property NSURL * _Nonnull bundleUrl;
13
+ @property NSURL * _Nonnull runtimeUrl;
14
+ @property WarningsFilter warningsFilter;
15
+ @property NSString * _Nullable identifier;
16
+ @property BOOL isDeveloperApp;
17
+ @property BOOL clearDataAtLaunch;
18
+ @property id<AppMenuProtocol> _Nullable appMenu;
19
+ @property id<SplashScreenPresenterProtocol> _Nullable splashScreenPresenter;
20
+ @property UIStoryboard * _Nullable reactLoading;
21
+ @property BOOL enableThreeFingerGestures;
22
+
23
+ -(id _Nonnull)init:(NSString * _Nullable)identifier bundleUrl:(NSURL * _Nonnull)bundleUrl runtimeUrl:(NSURL * _Nonnull)runtimeUrl warningsFilter:(WarningsFilter)warningsFilter isDeveloperApp:(BOOL)enableGestures clearDataAtLaunch:(BOOL)clearDataAtLaunch splashScreenPresenter:(id<SplashScreenPresenterProtocol> _Nonnull)splashScreenPresenter;
24
+
25
+ -(id _Nonnull)init:(NSString * _Nullable)identifier bundleUrl:(NSURL * _Nonnull)bundleUrl runtimeUrl:(NSURL * _Nonnull)runtimeUrl warningsFilter:(WarningsFilter)warningsFilter isDeveloperApp:(BOOL)enableGestures clearDataAtLaunch:(BOOL)clearDataAtLaunch reactLoading:(UIStoryboard * _Nonnull)reactLoading;
26
+
27
+ -(id _Nonnull)init:(NSString * _Nullable)identifier bundleUrl:(NSURL * _Nonnull)bundleUrl runtimeUrl:(NSURL * _Nonnull)runtimeUrl warningsFilter:(WarningsFilter)warningsFilter isDeveloperApp:(BOOL)enableGestures clearDataAtLaunch:(BOOL)clearDataAtLaunch splashScreenPresenter:(id<SplashScreenPresenterProtocol> _Nonnull)splashScreenPresenter enableThreeFingerGestures:(BOOL)enableThreeFingerGestures ;
28
+
29
+ -(id _Nonnull)init:(NSString * _Nullable)identifier bundleUrl:(NSURL * _Nonnull)bundleUrl runtimeUrl:(NSURL * _Nonnull)runtimeUrl warningsFilter:(WarningsFilter)warningsFilter isDeveloperApp:(BOOL)enableGestures clearDataAtLaunch:(BOOL)clearDataAtLaunch reactLoading:(UIStoryboard * _Nonnull)reactLoading enableThreeFingerGestures:(BOOL)enableThreeFingerGestures;
30
+
31
+ -(id _Nonnull)init:(NSString * _Nullable)identifier bundleUrl:(NSURL * _Nonnull)bundleUrl runtimeUrl:(NSURL * _Nonnull)runtimeUrl warningsFilter:(WarningsFilter)warningsFilter isDeveloperApp:(BOOL)enableGestures clearDataAtLaunch:(BOOL)clearDataAtLaunch;
32
+
33
+ @end
@@ -0,0 +1,14 @@
1
+ //
2
+ // Copyright (c) Mendix, Inc. All rights reserved.
3
+ //
4
+
5
+ #import <Foundation/Foundation.h>
6
+ #import "UnsupportedFeatures.h"
7
+
8
+ extern const UnsupportedFeatures *DEFAULT_UNSUPPORTED_FEATURES;
9
+
10
+ @interface MendixBackwardsCompatUtility: NSObject
11
+ + (NSDictionary<NSString *, UnsupportedFeatures *> *) versionDictionary;
12
+ + (UnsupportedFeatures *) unsupportedFeatures;
13
+ + (void) update:(NSString *)forVersion;
14
+ @end
@@ -0,0 +1,20 @@
1
+ //
2
+ // Copyright (c) Mendix B.V., Inc. All rights reserved.
3
+ //
4
+
5
+ #import "AppMenuProtocol.h"
6
+ #import "AppPreferences.h"
7
+ #import "AppUrl.h"
8
+ #import "MxConfiguration.h"
9
+ #import "MendixApp.h"
10
+ #import "NativeReloadHandler.h"
11
+ #import "ReactNative.h"
12
+ #import "WarningsFilter.h"
13
+ #import "SplashScreenPresenterProtocol.h"
14
+ #import "MendixReactWindow.h"
15
+ #import "MendixBackwardsCompatUtility.h"
16
+ #import "RuntimeInfoProvider.h"
17
+ #import "NativeDownloadHandler.h"
18
+ #import "DevAppMenuUIAlertController.h"
19
+ #import "JSBundleFileProviderProtocol.h"
20
+ #import "OtaJSBundleFileProvider.h"
@@ -0,0 +1,10 @@
1
+ //
2
+ // Copyright (c) Mendix, Inc. All rights reserved.
3
+ //
4
+
5
+ #import <Foundation/Foundation.h>
6
+ #import "UIKit/UIKit.h"
7
+
8
+ @interface MendixReactWindow : UIWindow
9
+
10
+ @end