Skip to content

Commit 6123968

Browse files
refactor: update getConstants and getTypedExportedConstants to use nullable types
1 parent 54358b3 commit 6123968

2 files changed

Lines changed: 3 additions & 6 deletions

File tree

android/src/main/java/com/mendix/mendixnative/react/MxConfiguration.kt

Lines changed: 2 additions & 5 deletions
Original file line numberDiff line numberDiff line change
@@ -8,7 +8,7 @@ import com.mendix.mendixnative.react.ota.getOtaManifestFilepath
88

99
class MxConfiguration(val reactContext: ReactApplicationContext) {
1010

11-
fun getConstants(): Map<String, Any> {
11+
fun getConstants(): Map<String, Any?> {
1212
val application = (reactContext.applicationContext as MendixApplication)
1313
if (runtimeUrl == null) {
1414
if (warningsFilter != WarningsFilter.none) {
@@ -27,6 +27,7 @@ class MxConfiguration(val reactContext: ReactApplicationContext) {
2727

2828
val constants = mutableMapOf(
2929
"RUNTIME_URL" to AppUrl.forRuntime(runtimeUrl),
30+
"APP_NAME" to defaultAppName,
3031
"DATABASE_NAME" to defaultDatabaseName,
3132
"FILES_DIRECTORY_NAME" to defaultFilesDirectoryName,
3233
"WARNINGS_FILTER_LEVEL" to warningsFilter.toString(),
@@ -36,10 +37,6 @@ class MxConfiguration(val reactContext: ReactApplicationContext) {
3637
"APP_SESSION_ID" to application.getAppSessionId(),
3738
"NATIVE_DEPENDENCIES" to getNativeDependencies(reactContext)
3839
)
39-
defaultAppName?.let {
40-
constants.put("APP_NAME", it)
41-
}
42-
4340
return constants
4441
}
4542

android/src/main/java/com/mendixnative/configuration/MxConfigurationModule.kt

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -13,7 +13,7 @@ class MxConfigurationModule(reactContext: ReactApplicationContext) :
1313

1414
override fun getName(): String = NAME
1515

16-
override fun getTypedExportedConstants(): Map<String, Any> {
16+
override fun getTypedExportedConstants(): Map<String, Any?> {
1717
return configuration.getConstants()
1818
}
1919

0 commit comments

Comments
 (0)