@momo-kits/native-kits 0.154.1-beta.8 → 0.154.1-beta.9
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.
|
@@ -4,18 +4,6 @@ import androidx.compose.runtime.Immutable
|
|
|
4
4
|
import androidx.compose.runtime.staticCompositionLocalOf
|
|
5
5
|
import vn.momo.kits.components.TrustBannerData
|
|
6
6
|
|
|
7
|
-
|
|
8
|
-
private fun Map<String, Any?>?.string(key: String): String? =
|
|
9
|
-
(this?.get(key) as? String)
|
|
10
|
-
|
|
11
|
-
@Suppress("UNCHECKED_CAST")
|
|
12
|
-
private fun Map<String, Any?>?.mapStringAny(key: String): Map<String, Any?> =
|
|
13
|
-
(this?.get(key) as? Map<String, Any?>) ?: emptyMap()
|
|
14
|
-
|
|
15
|
-
@Suppress("UNCHECKED_CAST")
|
|
16
|
-
private fun Map<String, Any?>?.listOfMapStringAny(key: String): List<Map<String, Any>> =
|
|
17
|
-
(this?.get(key) as? List<Map<String, Any>>) ?: emptyList()
|
|
18
|
-
|
|
19
7
|
@Immutable
|
|
20
8
|
data class FeatureFlags(
|
|
21
9
|
val showBaseLineDebug: Boolean? = false,
|
|
@@ -64,30 +52,37 @@ data class MiniAppContext(
|
|
|
64
52
|
"permissions" to (context?.permissions ?: emptyList()),
|
|
65
53
|
)
|
|
66
54
|
|
|
67
|
-
fun
|
|
68
|
-
|
|
69
|
-
|
|
70
|
-
|
|
71
|
-
|
|
72
|
-
|
|
73
|
-
|
|
74
|
-
|
|
75
|
-
|
|
76
|
-
|
|
77
|
-
|
|
78
|
-
|
|
79
|
-
|
|
80
|
-
|
|
55
|
+
fun merge(parent: MiniAppContext?, child: MiniAppContext?): MiniAppContext? {
|
|
56
|
+
if (parent == null && child == null) return null
|
|
57
|
+
if (parent == null) return child
|
|
58
|
+
if (child == null) return parent
|
|
59
|
+
|
|
60
|
+
return MiniAppContext(
|
|
61
|
+
appIcon = parent.appIcon.ifBlank { child.appIcon },
|
|
62
|
+
appName = parent.appName ?: child.appName,
|
|
63
|
+
appId = parent.appId.ifBlank { child.appId },
|
|
64
|
+
appCode = parent.appCode.ifBlank { child.appCode },
|
|
65
|
+
description = parent.description ?: child.description,
|
|
66
|
+
support = mergeMaps(parent.support, child.support),
|
|
67
|
+
toolkitConfig = mergeMaps(parent.toolkitConfig, child.toolkitConfig),
|
|
68
|
+
providerId = parent.providerId.ifBlank { child.providerId },
|
|
69
|
+
permissions = if (!parent.permissions.isNullOrEmpty()) parent.permissions else child.permissions,
|
|
70
|
+
features = mergeFeatureFlags(parent.features, child.features)
|
|
71
|
+
)
|
|
72
|
+
}
|
|
73
|
+
|
|
74
|
+
private fun mergeMaps(parent: Map<String, Any?>, child: Map<String, Any?>): Map<String, Any?> {
|
|
75
|
+
return child + parent
|
|
76
|
+
}
|
|
81
77
|
|
|
82
|
-
private fun
|
|
83
|
-
|
|
84
|
-
|
|
85
|
-
|
|
86
|
-
else -> null
|
|
87
|
-
} ?: return "unknown"
|
|
78
|
+
private fun mergeFeatureFlags(parent: FeatureFlags?, child: FeatureFlags?): FeatureFlags? {
|
|
79
|
+
if (parent == null && child == null) return null
|
|
80
|
+
if (parent == null) return child
|
|
81
|
+
if (child == null) return parent
|
|
88
82
|
|
|
89
|
-
|
|
90
|
-
|
|
83
|
+
return FeatureFlags(
|
|
84
|
+
showBaseLineDebug = parent.showBaseLineDebug ?: child.showBaseLineDebug
|
|
85
|
+
)
|
|
91
86
|
}
|
|
92
87
|
}
|
|
93
88
|
}
|
|
@@ -58,6 +58,9 @@ fun NavigationContainer(
|
|
|
58
58
|
AppNavigationBar.current
|
|
59
59
|
}
|
|
60
60
|
|
|
61
|
+
val parentContext = ApplicationContext.current
|
|
62
|
+
val mergedContext = MiniAppContext.merge(parentContext, applicationContext)
|
|
63
|
+
|
|
61
64
|
val theme = remember { mutableStateOf(initialTheme) }
|
|
62
65
|
|
|
63
66
|
LaunchedEffect(Unit) {
|
|
@@ -80,7 +83,7 @@ fun NavigationContainer(
|
|
|
80
83
|
AppThemeController provides { theme.value = it },
|
|
81
84
|
AppStatusBar provides statusBarHeight,
|
|
82
85
|
AppNavigationBar provides navigationBarHeight,
|
|
83
|
-
ApplicationContext provides
|
|
86
|
+
ApplicationContext provides mergedContext,
|
|
84
87
|
AppConfig provides config,
|
|
85
88
|
AppLanguage provides language,
|
|
86
89
|
) {
|