@momo-kits/native-kits 0.120.0-beta.20 → 0.120.0-beta.21
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.
|
@@ -97,9 +97,10 @@ data class KitConfig(
|
|
|
97
97
|
val trustBanner: TrustBannerData? = null,
|
|
98
98
|
val headerBar: String? = null,
|
|
99
99
|
val headerGradient: String? = null,
|
|
100
|
-
val isWhiteList: Boolean = false
|
|
101
100
|
)
|
|
102
101
|
|
|
102
|
+
internal var DesignSystemWhiteList: Boolean? = null
|
|
103
|
+
|
|
103
104
|
@Composable
|
|
104
105
|
fun ApplicationContainer(
|
|
105
106
|
theme: Theme = defaultTheme,
|
|
@@ -108,11 +109,13 @@ fun ApplicationContainer(
|
|
|
108
109
|
applicationContext: MiniAppContext? = null,
|
|
109
110
|
config: KitConfig? = null,
|
|
110
111
|
language: String? = null,
|
|
112
|
+
isWhiteList: Boolean = false,
|
|
111
113
|
content: @Composable () -> Unit,
|
|
112
114
|
) {
|
|
113
115
|
var appTheme by remember { mutableStateOf(theme) }
|
|
114
116
|
|
|
115
117
|
LaunchedEffect(Unit) {
|
|
118
|
+
DesignSystemWhiteList = isWhiteList
|
|
116
119
|
try {
|
|
117
120
|
val headerBar = config?.headerBar
|
|
118
121
|
if (headerBar != null && appTheme.assets.headerBackground == null) {
|
|
@@ -12,8 +12,7 @@ import org.jetbrains.compose.resources.Font
|
|
|
12
12
|
import org.jetbrains.compose.resources.FontResource
|
|
13
13
|
import org.jetbrains.compose.resources.InternalResourceApi
|
|
14
14
|
import org.jetbrains.compose.resources.ResourceItem
|
|
15
|
-
import vn.momo.kits.application.
|
|
16
|
-
import vn.momo.kits.application.KitConfig
|
|
15
|
+
import vn.momo.kits.application.DesignSystemWhiteList
|
|
17
16
|
import vn.momo.kits.platform.getScreenDimensions
|
|
18
17
|
import kotlin.math.max
|
|
19
18
|
import kotlin.math.min
|
|
@@ -23,8 +22,7 @@ const val MAX_FONT_SCALE = 1.5f
|
|
|
23
22
|
const val MAX_DEVICE_SCALE = 5
|
|
24
23
|
|
|
25
24
|
@Composable
|
|
26
|
-
fun scaleSize(size: Float
|
|
27
|
-
val isWhiteList = config?.isWhiteList ?: false
|
|
25
|
+
fun scaleSize(size: Float): Float {
|
|
28
26
|
val deviceWidth = getScreenDimensions().width
|
|
29
27
|
val deviceScale = deviceWidth / DEFAULT_SCREEN_SIZE
|
|
30
28
|
|
|
@@ -44,7 +42,10 @@ fun scaleSize(size: Float, config: KitConfig? = AppConfig.current): Float {
|
|
|
44
42
|
fontSizeScaleOS = min(fontScale * fontSizeScaleOS, fontSizeScaleOS * MAX_FONT_SCALE)
|
|
45
43
|
}
|
|
46
44
|
|
|
47
|
-
return if (
|
|
45
|
+
return if (DesignSystemWhiteList == true) max(
|
|
46
|
+
fontSizeScaleDevice,
|
|
47
|
+
fontSizeScaleOS
|
|
48
|
+
) else fontSizeScaleDevice
|
|
48
49
|
}
|
|
49
50
|
|
|
50
51
|
@OptIn(InternalResourceApi::class)
|