@momo-kits/native-kits 0.167.1-sizescale.2-debug → 0.300.1-debug
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.
- package/CLAUDE.md +4 -4
- package/README.md +10 -2
- package/build.gradle.kts +3 -1
- package/compose/build.gradle.kts +19 -20
- package/compose/build.gradle.kts.backup +18 -19
- package/compose/compose.podspec +1 -1
- package/compose/src/androidMain/kotlin/vn/momo/kits/platform/Platform.android.kt +1 -4
- package/compose/src/commonMain/kotlin/vn/momo/kits/application/LiteScreen.kt +2 -2
- package/compose/src/commonMain/kotlin/vn/momo/kits/application/NavigationContainer.kt +3 -3
- package/compose/src/commonMain/kotlin/vn/momo/kits/application/WidgetContainer.kt +25 -16
- package/compose/src/commonMain/kotlin/vn/momo/kits/components/Icon.kt +23 -13
- package/compose/src/commonMain/kotlin/vn/momo/kits/components/Image.kt +1 -1
- package/compose/src/commonMain/kotlin/vn/momo/kits/components/Slider.kt +3 -3
- package/compose/src/commonMain/kotlin/vn/momo/kits/components/Tooltip.kt +1 -1
- package/compose/src/commonMain/kotlin/vn/momo/kits/const/Spacing.kt +11 -15
- package/compose/src/commonMain/kotlin/vn/momo/kits/const/Theme.kt +10 -4
- package/compose/src/commonMain/kotlin/vn/momo/kits/const/Typography.kt +6 -23
- package/compose/src/commonMain/kotlin/vn/momo/kits/layout/Card.kt +13 -11
- package/compose/src/commonMain/kotlin/vn/momo/kits/layout/Item.kt +22 -9
- package/compose/src/commonMain/kotlin/vn/momo/kits/layout/Section.kt +11 -9
- package/compose/src/commonMain/kotlin/vn/momo/kits/navigation/NavigationContainer.kt +28 -21
- package/compose/src/commonMain/kotlin/vn/momo/kits/navigation/Navigator.kt +6 -1
- package/compose/src/commonMain/kotlin/vn/momo/kits/navigation/SwipeBackHaptic.kt +6 -1
- package/compose/src/commonMain/kotlin/vn/momo/kits/navigation/bottomtab/BottomTab.kt +26 -17
- package/compose/src/commonMain/kotlin/vn/momo/kits/navigation/component/Header.kt +4 -5
- package/compose/src/commonMain/kotlin/vn/momo/kits/navigation/component/HeaderRight.kt +47 -30
- package/compose/src/commonMain/kotlin/vn/momo/kits/navigation/component/HeaderTitle.kt +4 -2
- package/compose/src/commonMain/kotlin/vn/momo/kits/navigation/component/HeaderUser.kt +1 -1
- package/compose/src/commonMain/kotlin/vn/momo/kits/navigation/component/ToolkitRequests.kt +33 -0
- package/compose/src/commonMain/kotlin/vn/momo/kits/navigation/tracking/ScreenTracker.kt +40 -32
- package/compose/src/commonTest/kotlin/vn/momo/kits/navigation/component/ToolkitRequestsTest.kt +47 -0
- package/compose/src/iosMain/kotlin/vn/momo/kits/navigation/ScrollToTop.ios.kt +6 -2
- package/compose/src/iosMain/kotlin/vn/momo/kits/platform/OsFontScale.ios.kt +1 -3
- package/compose/src/iosMain/kotlin/vn/momo/kits/platform/Platform.ios.kt +6 -11
- package/gradle/libs.versions.toml +9 -3
- package/gradle/wrapper/gradle-wrapper.properties +3 -1
- package/gradle.properties +1 -1
- package/ios/native-kits.podspec +1 -1
- package/ios-demo/MoMoUIKitsDemo.podspec +1 -1
- package/package.json +1 -1
- package/compose/src/commonMain/kotlin/vn/momo/kits/const/KitSizeScale.kt +0 -56
- package/example/ios/Example.xcodeproj/xcuserdata/sonnguyen.xcuserdatad/xcschemes/Example.xcscheme +0 -32
- package/example/ios/Example.xcodeproj/xcuserdata/sonnguyen.xcuserdatad/xcschemes/xcschememanagement.plist +0 -14
- package/example/ios/Example.xcworkspace/xcuserdata/sonnguyen.xcuserdatad/UserInterfaceState.xcuserstate +0 -0
- package/example/ios/Example.xcworkspace/xcuserdata/sonnguyen.xcuserdatad/WorkspaceSettings.xcsettings +0 -16
- package/example/ios/Example.xcworkspace/xcuserdata/sonnguyen.xcuserdatad/xcdebugger/Breakpoints_v2.xcbkptlist +0 -6
- package/example/ios/Example.xcworkspace/xcuserdata/sonnguyen.xcuserdatad/xcschemes/xcschememanagement.plist +0 -5
- package/example/ios/Pods/Pods.xcodeproj/xcuserdata/sonnguyen.xcuserdatad/xcschemes/MoMoUIKits.xcscheme +0 -58
- package/example/ios/Pods/Pods.xcodeproj/xcuserdata/sonnguyen.xcuserdatad/xcschemes/Pods-Example.xcscheme +0 -58
- package/example/ios/Pods/Pods.xcodeproj/xcuserdata/sonnguyen.xcuserdatad/xcschemes/SDWebImage.xcscheme +0 -58
- package/example/ios/Pods/Pods.xcodeproj/xcuserdata/sonnguyen.xcuserdatad/xcschemes/SDWebImageSwiftUI.xcscheme +0 -58
- package/example/ios/Pods/Pods.xcodeproj/xcuserdata/sonnguyen.xcuserdatad/xcschemes/SkeletonUI.xcscheme +0 -58
- package/example/ios/Pods/Pods.xcodeproj/xcuserdata/sonnguyen.xcuserdatad/xcschemes/lottie-ios-LottiePrivacyInfo.xcscheme +0 -58
- package/example/ios/Pods/Pods.xcodeproj/xcuserdata/sonnguyen.xcuserdatad/xcschemes/lottie-ios.xcscheme +0 -58
- package/example/ios/Pods/Pods.xcodeproj/xcuserdata/sonnguyen.xcuserdatad/xcschemes/xcschememanagement.plist +0 -60
- package/local.properties +0 -8
|
@@ -2,6 +2,12 @@ package vn.momo.kits.navigation.tracking
|
|
|
2
2
|
|
|
3
3
|
import vn.momo.kits.application.MiniAppContext
|
|
4
4
|
import vn.momo.maxapi.IMaxApi
|
|
5
|
+
// AI-GENERATED START: serialize tracking attributes with their existing value types
|
|
6
|
+
import kotlinx.serialization.json.JsonNull
|
|
7
|
+
import kotlinx.serialization.json.JsonElement
|
|
8
|
+
import kotlinx.serialization.json.JsonObject
|
|
9
|
+
import kotlinx.serialization.json.JsonPrimitive
|
|
10
|
+
// AI-GENERATED END: serialize tracking attributes with their existing value types
|
|
5
11
|
import kotlin.time.Clock
|
|
6
12
|
import kotlin.time.ExperimentalTime
|
|
7
13
|
|
|
@@ -15,6 +21,7 @@ class ScreenTrackingState {
|
|
|
15
21
|
var action: String = "push"
|
|
16
22
|
}
|
|
17
23
|
|
|
24
|
+
// AI-GENERATED START: retain screen event names and typed tracking attributes
|
|
18
25
|
object ScreenTracker {
|
|
19
26
|
|
|
20
27
|
private var lastScreenName: String? = null
|
|
@@ -31,13 +38,13 @@ object ScreenTracker {
|
|
|
31
38
|
val previousScreen = lastScreenName
|
|
32
39
|
lastScreenName = screenName
|
|
33
40
|
|
|
34
|
-
maxApi?.
|
|
41
|
+
maxApi?.trackEvent(
|
|
35
42
|
eventName = "auto_screen_navigated",
|
|
36
|
-
|
|
37
|
-
put("pre_screen_name", previousScreen)
|
|
38
|
-
put("state", "navigated")
|
|
39
|
-
put("action", action)
|
|
40
|
-
}
|
|
43
|
+
attributes = JsonObject(buildBaseParams(context, screenName).apply {
|
|
44
|
+
put("pre_screen_name", JsonPrimitive(previousScreen))
|
|
45
|
+
put("state", JsonPrimitive("navigated"))
|
|
46
|
+
put("action", JsonPrimitive(action))
|
|
47
|
+
})
|
|
41
48
|
)
|
|
42
49
|
|
|
43
50
|
state.releaseNavigated = true
|
|
@@ -53,12 +60,12 @@ object ScreenTracker {
|
|
|
53
60
|
) {
|
|
54
61
|
if (state.releaseLoad) return
|
|
55
62
|
|
|
56
|
-
maxApi?.
|
|
63
|
+
maxApi?.trackEvent(
|
|
57
64
|
eventName = "auto_screen_displayed",
|
|
58
|
-
|
|
59
|
-
put("state", "load")
|
|
60
|
-
put("duration", duration)
|
|
61
|
-
}
|
|
65
|
+
attributes = JsonObject(buildBaseParams(context, screenName).apply {
|
|
66
|
+
put("state", JsonPrimitive("load"))
|
|
67
|
+
put("duration", JsonPrimitive(duration))
|
|
68
|
+
})
|
|
62
69
|
)
|
|
63
70
|
|
|
64
71
|
state.releaseLoad = true
|
|
@@ -74,13 +81,13 @@ object ScreenTracker {
|
|
|
74
81
|
) {
|
|
75
82
|
if (state.releaseInteraction) return
|
|
76
83
|
|
|
77
|
-
maxApi?.
|
|
84
|
+
maxApi?.trackEvent(
|
|
78
85
|
eventName = "auto_screen_interacted",
|
|
79
|
-
|
|
80
|
-
put("state", "interaction")
|
|
81
|
-
put("duration", duration)
|
|
82
|
-
put("total_duration", totalDuration)
|
|
83
|
-
}
|
|
86
|
+
attributes = JsonObject(buildBaseParams(context, screenName).apply {
|
|
87
|
+
put("state", JsonPrimitive("interaction"))
|
|
88
|
+
put("duration", JsonPrimitive(duration))
|
|
89
|
+
put("total_duration", JsonPrimitive(totalDuration))
|
|
90
|
+
})
|
|
84
91
|
)
|
|
85
92
|
|
|
86
93
|
state.releaseInteraction = true
|
|
@@ -90,13 +97,13 @@ object ScreenTracker {
|
|
|
90
97
|
context: MiniAppContext?,
|
|
91
98
|
screenName: String,
|
|
92
99
|
componentName: String = "Screen"
|
|
93
|
-
): MutableMap<String,
|
|
100
|
+
): MutableMap<String, JsonElement> {
|
|
94
101
|
return mutableMapOf(
|
|
95
|
-
"app_id" to context?.appId,
|
|
96
|
-
"feature_code" to context?.appCode,
|
|
97
|
-
"screen_name" to screenName,
|
|
98
|
-
"component_name" to componentName,
|
|
99
|
-
"tracking_source" to 1
|
|
102
|
+
"app_id" to JsonPrimitive(context?.appId),
|
|
103
|
+
"feature_code" to JsonPrimitive(context?.appCode),
|
|
104
|
+
"screen_name" to JsonPrimitive(screenName),
|
|
105
|
+
"component_name" to JsonPrimitive(componentName),
|
|
106
|
+
"tracking_source" to JsonPrimitive(1)
|
|
100
107
|
)
|
|
101
108
|
}
|
|
102
109
|
|
|
@@ -105,16 +112,16 @@ object ScreenTracker {
|
|
|
105
112
|
context: MiniAppContext?,
|
|
106
113
|
parentScreenName: String?
|
|
107
114
|
) {
|
|
108
|
-
maxApi?.
|
|
115
|
+
maxApi?.trackEvent(
|
|
109
116
|
eventName = "auto_popup_displayed",
|
|
110
|
-
|
|
111
|
-
"screen_name" to parentScreenName,
|
|
112
|
-
"tracking_source" to 1,
|
|
113
|
-
"app_id" to context?.appId,
|
|
114
|
-
"feature_code" to context?.appCode,
|
|
115
|
-
"kits_version" to
|
|
116
|
-
"component_name" to "Modal"
|
|
117
|
-
)
|
|
117
|
+
attributes = JsonObject(mapOf(
|
|
118
|
+
"screen_name" to JsonPrimitive(parentScreenName),
|
|
119
|
+
"tracking_source" to JsonPrimitive(1),
|
|
120
|
+
"app_id" to JsonPrimitive(context?.appId),
|
|
121
|
+
"feature_code" to JsonPrimitive(context?.appCode),
|
|
122
|
+
"kits_version" to JsonNull,
|
|
123
|
+
"component_name" to JsonPrimitive("Modal")
|
|
124
|
+
))
|
|
118
125
|
)
|
|
119
126
|
}
|
|
120
127
|
|
|
@@ -125,3 +132,4 @@ object ScreenTracker {
|
|
|
125
132
|
lastScreenName = null
|
|
126
133
|
}
|
|
127
134
|
}
|
|
135
|
+
// AI-GENERATED END: retain screen event names and typed tracking attributes
|
package/compose/src/commonTest/kotlin/vn/momo/kits/navigation/component/ToolkitRequestsTest.kt
ADDED
|
@@ -0,0 +1,47 @@
|
|
|
1
|
+
// File: ToolkitRequestsTest.kt
|
|
2
|
+
// Created At: 2026-10-12 +07:00 | Created By: AI | AI Agent: Codex | Model: GPT-6
|
|
3
|
+
// AI-GENERATED START: verify cancellation and late callback suppression for toolkit UI
|
|
4
|
+
package vn.momo.kits.navigation.component
|
|
5
|
+
|
|
6
|
+
import kotlin.test.Test
|
|
7
|
+
import kotlin.test.assertEquals
|
|
8
|
+
import vn.momo.maxapi.runtime.ApiCallback
|
|
9
|
+
import vn.momo.maxapi.runtime.ApiRequestHandle
|
|
10
|
+
import vn.momo.maxapi.runtime.ApiResult
|
|
11
|
+
|
|
12
|
+
class ToolkitRequestsTest {
|
|
13
|
+
@Test
|
|
14
|
+
fun closingCancelsPendingRequestsAndSuppressesLateCallbacks() {
|
|
15
|
+
val owner = ToolkitRequests()
|
|
16
|
+
val handle = Handle()
|
|
17
|
+
var callback: ApiCallback<Boolean> = {}
|
|
18
|
+
var results = 0
|
|
19
|
+
owner.launch<Boolean>({ callback = it; handle }) { results++ }
|
|
20
|
+
owner.close()
|
|
21
|
+
owner.close()
|
|
22
|
+
callback(ApiResult.Success(true))
|
|
23
|
+
assertEquals(1, handle.cancellations)
|
|
24
|
+
assertEquals(0, results)
|
|
25
|
+
}
|
|
26
|
+
|
|
27
|
+
@Test
|
|
28
|
+
fun completedRequestsAreReleasedAndClosedOwnersNeverStartNewRequests() {
|
|
29
|
+
val owner = ToolkitRequests()
|
|
30
|
+
val handle = Handle()
|
|
31
|
+
var starts = 0
|
|
32
|
+
var results = 0
|
|
33
|
+
owner.launch<Boolean>({ callback -> starts++; callback(ApiResult.Success(false)); handle }) { results++ }
|
|
34
|
+
owner.close()
|
|
35
|
+
owner.launch<Boolean>({ starts++; handle }) { results++ }
|
|
36
|
+
assertEquals(0, handle.cancellations)
|
|
37
|
+
assertEquals(1, starts)
|
|
38
|
+
assertEquals(1, results)
|
|
39
|
+
}
|
|
40
|
+
|
|
41
|
+
private class Handle : ApiRequestHandle {
|
|
42
|
+
override val requestId = "toolkit-test"
|
|
43
|
+
var cancellations = 0
|
|
44
|
+
override fun cancel() { cancellations++ }
|
|
45
|
+
}
|
|
46
|
+
}
|
|
47
|
+
// AI-GENERATED END: verify cancellation and late callback suppression for toolkit UI
|
|
@@ -12,7 +12,9 @@ private const val STATUS_BAR_TAPPED_NOTIFICATION = "statusBarSelected"
|
|
|
12
12
|
@Composable
|
|
13
13
|
internal actual fun RegisterScrollToTop(callback: (() -> Unit)?) {
|
|
14
14
|
val maxApi = LocalMaxApi.current
|
|
15
|
-
|
|
15
|
+
// AI-GENERATED START: capture the current typed logger client
|
|
16
|
+
DisposableEffect(callback, maxApi) {
|
|
17
|
+
// AI-GENERATED END: capture the current typed logger client
|
|
16
18
|
val token: NSObjectProtocol? = if (callback != null) {
|
|
17
19
|
NSNotificationCenter.defaultCenter.addObserverForName(
|
|
18
20
|
name = STATUS_BAR_TAPPED_NOTIFICATION,
|
|
@@ -20,7 +22,9 @@ internal actual fun RegisterScrollToTop(callback: (() -> Unit)?) {
|
|
|
20
22
|
queue = NSOperationQueue.mainQueue,
|
|
21
23
|
) { _: NSNotification? ->
|
|
22
24
|
runCatching { callback() }.onFailure {
|
|
23
|
-
|
|
25
|
+
// AI-GENERATED START: use typed host logging
|
|
26
|
+
maxApi?.writeLog("[ScrollToTop] callback threw: ${it.message}")
|
|
27
|
+
// AI-GENERATED END: use typed host logging
|
|
24
28
|
|
|
25
29
|
}
|
|
26
30
|
}
|
|
@@ -16,7 +16,6 @@ import platform.UIKit.UIContentSizeCategoryDidChangeNotification
|
|
|
16
16
|
import platform.UIKit.UIFont
|
|
17
17
|
import platform.UIKit.UIFontTextStyleBody
|
|
18
18
|
import platform.darwin.NSObject
|
|
19
|
-
import vn.momo.kits.const.LocalSizeScale
|
|
20
19
|
|
|
21
20
|
// Compose MP iOS reads LocalDensity.fontScale once at ComposeUIViewController creation and does not
|
|
22
21
|
// recompose it when UIContentSizeCategory changes (Android tracks Configuration.fontScale live). We
|
|
@@ -60,8 +59,7 @@ actual fun ProvideOsFontScale(content: @Composable () -> Unit) {
|
|
|
60
59
|
|
|
61
60
|
val density = LocalDensity.current
|
|
62
61
|
CompositionLocalProvider(
|
|
63
|
-
|
|
64
|
-
LocalDensity provides Density(density.density, osFontScale.value / LocalSizeScale.current),
|
|
62
|
+
LocalDensity provides Density(density.density, osFontScale.value),
|
|
65
63
|
) {
|
|
66
64
|
content()
|
|
67
65
|
}
|
|
@@ -39,7 +39,6 @@ import platform.Foundation.NSBundle
|
|
|
39
39
|
import platform.UIKit.UIColor
|
|
40
40
|
import platform.UIKit.UIDevice
|
|
41
41
|
import platform.UIKit.UIScreen
|
|
42
|
-
import vn.momo.kits.const.LocalSizeScale
|
|
43
42
|
import vn.momo.kits.navigation.AttachHostBackGesture
|
|
44
43
|
import vn.momo.kits.navigation.Navigator
|
|
45
44
|
|
|
@@ -47,16 +46,12 @@ actual fun getPlatformName(): String = "iOS"
|
|
|
47
46
|
|
|
48
47
|
@OptIn(ExperimentalForeignApi::class)
|
|
49
48
|
@Composable
|
|
50
|
-
actual fun getScreenDimensions(): ScreenDimension {
|
|
51
|
-
|
|
52
|
-
|
|
53
|
-
|
|
54
|
-
|
|
55
|
-
|
|
56
|
-
(config.size.width / sizeScale).toInt(),
|
|
57
|
-
(config.size.height / sizeScale).toInt()
|
|
58
|
-
)
|
|
59
|
-
}
|
|
49
|
+
actual fun getScreenDimensions(): ScreenDimension = memScoped {
|
|
50
|
+
val config = UIScreen.mainScreen.bounds.ptr[0]
|
|
51
|
+
return ScreenDimension(
|
|
52
|
+
config.size.width.toInt(),
|
|
53
|
+
config.size.height.toInt()
|
|
54
|
+
)
|
|
60
55
|
}
|
|
61
56
|
|
|
62
57
|
actual fun NativePaint.setMaskFilter(blurRadius: Float) {
|
|
@@ -9,7 +9,9 @@ kSerialize = "1.7.1"
|
|
|
9
9
|
compose = "1.10.3"
|
|
10
10
|
navigation-multiplatform = "2.9.2"
|
|
11
11
|
coil3-multiplatform = "3.0.0-alpha10"
|
|
12
|
-
|
|
12
|
+
# AI-GENERATED START: align the Android toolchain with the integrating app
|
|
13
|
+
androidGradlePlugin = "9.2.1"
|
|
14
|
+
# AI-GENERATED END: align the Android toolchain with the integrating app
|
|
13
15
|
r8 = "8.9.35"
|
|
14
16
|
kotlinx-datetime = "0.7.1"
|
|
15
17
|
airbnb-lottie = "5.2.0"
|
|
@@ -19,8 +21,8 @@ androidx-appcompat = "1.7.0"
|
|
|
19
21
|
material = "1.10.0"
|
|
20
22
|
maxapi = "0.1.1"
|
|
21
23
|
vanniktechMavenPublish = "0.34.0"
|
|
22
|
-
kits = "0.
|
|
23
|
-
nativemaxapi = "0.
|
|
24
|
+
kits = "0.300.1"
|
|
25
|
+
nativemaxapi = "0.3.1"
|
|
24
26
|
gif-image = "0.1.2"
|
|
25
27
|
|
|
26
28
|
[libraries]
|
|
@@ -67,3 +69,7 @@ compose = { id = "org.jetbrains.compose", version.ref = "compose" }
|
|
|
67
69
|
android-library = { id = "com.android.library", version.ref = "androidGradlePlugin" }
|
|
68
70
|
android-application = { id = "com.android.application", version.ref = "androidGradlePlugin" }
|
|
69
71
|
vanniktech-mavenPublish = { id = "com.vanniktech.maven.publish", version.ref = "vanniktechMavenPublish" }
|
|
72
|
+
|
|
73
|
+
# AI-GENERATED START: use the AGP Android target for Kotlin Multiplatform libraries
|
|
74
|
+
android-kotlin-multiplatform-library = { id = "com.android.kotlin.multiplatform.library", version.ref = "androidGradlePlugin" }
|
|
75
|
+
# AI-GENERATED END: use the AGP Android target for Kotlin Multiplatform libraries
|
|
@@ -1,7 +1,9 @@
|
|
|
1
1
|
#Thu Jul 31 17:05:40 ICT 2025
|
|
2
2
|
distributionBase=GRADLE_USER_HOME
|
|
3
3
|
distributionPath=wrapper/dists
|
|
4
|
-
|
|
4
|
+
# AI-GENERATED START: align the Gradle wrapper with the integrating app
|
|
5
|
+
distributionUrl=https\://services.gradle.org/distributions/gradle-9.5.0-bin.zip
|
|
6
|
+
# AI-GENERATED END: align the Gradle wrapper with the integrating app
|
|
5
7
|
networkTimeout=10000
|
|
6
8
|
validateDistributionUrl=true
|
|
7
9
|
zipStoreBase=GRADLE_USER_HOME
|
package/gradle.properties
CHANGED
package/ios/native-kits.podspec
CHANGED
package/package.json
CHANGED
|
@@ -1,56 +0,0 @@
|
|
|
1
|
-
package vn.momo.kits.const
|
|
2
|
-
|
|
3
|
-
import androidx.compose.runtime.Composable
|
|
4
|
-
import androidx.compose.runtime.CompositionLocalProvider
|
|
5
|
-
import androidx.compose.runtime.getValue
|
|
6
|
-
import androidx.compose.runtime.mutableStateOf
|
|
7
|
-
import androidx.compose.runtime.setValue
|
|
8
|
-
import androidx.compose.runtime.staticCompositionLocalOf
|
|
9
|
-
import androidx.compose.ui.platform.LocalDensity
|
|
10
|
-
import androidx.compose.ui.unit.Density
|
|
11
|
-
import vn.momo.kits.platform.ProvideOsFontScale
|
|
12
|
-
|
|
13
|
-
// App-wide size scale (OS-zoom like): sizes (width/height/radius/icon…) grow by [rate] while spacing
|
|
14
|
-
// and text keep their original size. Seeded by the host like KitFontScale; snapshot state, so a write
|
|
15
|
-
// recomposes every container and relayouts without remounting screens.
|
|
16
|
-
//
|
|
17
|
-
// How: containers multiply LocalDensity.density by [rate] (every .dp grows) and divide fontScale by
|
|
18
|
-
// [rate] (sp text unchanged). Spacing tokens divide by [rate] so padding/margin render unchanged.
|
|
19
|
-
object KitSizeScale {
|
|
20
|
-
var rate by mutableStateOf(1f)
|
|
21
|
-
private set
|
|
22
|
-
|
|
23
|
-
fun update(rate: Float) {
|
|
24
|
-
this.rate = if (rate > 0f) rate else 1f
|
|
25
|
-
}
|
|
26
|
-
}
|
|
27
|
-
|
|
28
|
-
// Scale already applied to LocalDensity by an enclosing container (1 = none), so nested containers
|
|
29
|
-
// don't apply it twice and platform values in real units (screen size, OS font scale) can be converted.
|
|
30
|
-
internal val LocalSizeScale = staticCompositionLocalOf { 1f }
|
|
31
|
-
|
|
32
|
-
// Extra scale the next ProvideSizeScale adds on top of the current density: KitSizeScale.rate at the
|
|
33
|
-
// root container, 1 inside an already scaled one. Divide real-unit Dp (host-passed insets) by it.
|
|
34
|
-
@Composable
|
|
35
|
-
internal fun pendingSizeScale(): Float = KitSizeScale.rate / LocalSizeScale.current
|
|
36
|
-
|
|
37
|
-
// Root wrapper of every container: live OS font scale first, then the size scale on top of it.
|
|
38
|
-
@Composable
|
|
39
|
-
internal fun ProvideKitScale(content: @Composable () -> Unit) {
|
|
40
|
-
ProvideOsFontScale { ProvideSizeScale(content) }
|
|
41
|
-
}
|
|
42
|
-
|
|
43
|
-
@Composable
|
|
44
|
-
private fun ProvideSizeScale(content: @Composable () -> Unit) {
|
|
45
|
-
val applied = LocalSizeScale.current
|
|
46
|
-
val rate = KitSizeScale.rate
|
|
47
|
-
val density = LocalDensity.current
|
|
48
|
-
CompositionLocalProvider(
|
|
49
|
-
LocalDensity provides Density(
|
|
50
|
-
density = density.density / applied * rate,
|
|
51
|
-
fontScale = density.fontScale * applied / rate,
|
|
52
|
-
),
|
|
53
|
-
LocalSizeScale provides rate,
|
|
54
|
-
content = content,
|
|
55
|
-
)
|
|
56
|
-
}
|
package/example/ios/Example.xcodeproj/xcuserdata/sonnguyen.xcuserdatad/xcschemes/Example.xcscheme
DELETED
|
@@ -1,32 +0,0 @@
|
|
|
1
|
-
<?xml version="1.0" encoding="UTF-8"?>
|
|
2
|
-
<Scheme
|
|
3
|
-
version = "1.3">
|
|
4
|
-
<BuildAction>
|
|
5
|
-
<BuildActionEntries>
|
|
6
|
-
<BuildActionEntry
|
|
7
|
-
buildForRunning = "YES">
|
|
8
|
-
<BuildableReference
|
|
9
|
-
BuildableIdentifier = "primary"
|
|
10
|
-
BlueprintIdentifier = "A6A920D22B2ADD1E00C1A11F"
|
|
11
|
-
BuildableName = "Example"
|
|
12
|
-
BlueprintName = "Example"
|
|
13
|
-
ReferencedContainer = "container:Example.xcodeproj">
|
|
14
|
-
</BuildableReference>
|
|
15
|
-
</BuildActionEntry>
|
|
16
|
-
</BuildActionEntries>
|
|
17
|
-
</BuildAction>
|
|
18
|
-
<LaunchAction
|
|
19
|
-
useCustomWorkingDirectory = "NO"
|
|
20
|
-
buildConfiguration = "Debug"
|
|
21
|
-
allowLocationSimulation = "YES">
|
|
22
|
-
<BuildableProductRunnable>
|
|
23
|
-
<BuildableReference
|
|
24
|
-
BuildableIdentifier = "primary"
|
|
25
|
-
BlueprintIdentifier = "A6A920D22B2ADD1E00C1A11F"
|
|
26
|
-
BuildableName = "Example"
|
|
27
|
-
BlueprintName = "Example"
|
|
28
|
-
ReferencedContainer = "container:Example.xcodeproj">
|
|
29
|
-
</BuildableReference>
|
|
30
|
-
</BuildableProductRunnable>
|
|
31
|
-
</LaunchAction>
|
|
32
|
-
</Scheme>
|
|
@@ -1,14 +0,0 @@
|
|
|
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>SchemeUserState</key>
|
|
6
|
-
<dict>
|
|
7
|
-
<key>Example.xcscheme</key>
|
|
8
|
-
<dict>
|
|
9
|
-
<key>orderHint</key>
|
|
10
|
-
<integer>7</integer>
|
|
11
|
-
</dict>
|
|
12
|
-
</dict>
|
|
13
|
-
</dict>
|
|
14
|
-
</plist>
|
|
Binary file
|
|
@@ -1,16 +0,0 @@
|
|
|
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>BuildLocationStyle</key>
|
|
6
|
-
<string>UseAppPreferences</string>
|
|
7
|
-
<key>CustomBuildLocationType</key>
|
|
8
|
-
<string>RelativeToDerivedData</string>
|
|
9
|
-
<key>DerivedDataCustomLocation</key>
|
|
10
|
-
<string>DerivedData</string>
|
|
11
|
-
<key>DerivedDataLocationStyle</key>
|
|
12
|
-
<string>WorkspaceRelativePath</string>
|
|
13
|
-
<key>ShowSharedSchemesAutomaticallyEnabled</key>
|
|
14
|
-
<true/>
|
|
15
|
-
</dict>
|
|
16
|
-
</plist>
|
|
@@ -1,58 +0,0 @@
|
|
|
1
|
-
<?xml version="1.0" encoding="UTF-8"?>
|
|
2
|
-
<Scheme
|
|
3
|
-
LastUpgradeVersion = "1600"
|
|
4
|
-
version = "1.3">
|
|
5
|
-
<BuildAction
|
|
6
|
-
parallelizeBuildables = "YES"
|
|
7
|
-
buildImplicitDependencies = "YES">
|
|
8
|
-
<BuildActionEntries>
|
|
9
|
-
<BuildActionEntry
|
|
10
|
-
buildForTesting = "YES"
|
|
11
|
-
buildForRunning = "YES"
|
|
12
|
-
buildForProfiling = "YES"
|
|
13
|
-
buildForArchiving = "YES"
|
|
14
|
-
buildForAnalyzing = "YES">
|
|
15
|
-
<BuildableReference
|
|
16
|
-
BuildableIdentifier = "primary"
|
|
17
|
-
BlueprintIdentifier = "3B6FB503A75BF5BC1FA6F30BC06B9D28"
|
|
18
|
-
BuildableName = "MoMoUIKits.framework"
|
|
19
|
-
BlueprintName = "MoMoUIKits"
|
|
20
|
-
ReferencedContainer = "container:Pods.xcodeproj">
|
|
21
|
-
</BuildableReference>
|
|
22
|
-
</BuildActionEntry>
|
|
23
|
-
</BuildActionEntries>
|
|
24
|
-
</BuildAction>
|
|
25
|
-
<TestAction
|
|
26
|
-
buildConfiguration = "Debug"
|
|
27
|
-
selectedDebuggerIdentifier = "Xcode.DebuggerFoundation.Debugger.LLDB"
|
|
28
|
-
selectedLauncherIdentifier = "Xcode.DebuggerFoundation.Launcher.LLDB"
|
|
29
|
-
shouldUseLaunchSchemeArgsEnv = "YES">
|
|
30
|
-
<Testables>
|
|
31
|
-
</Testables>
|
|
32
|
-
</TestAction>
|
|
33
|
-
<LaunchAction
|
|
34
|
-
buildConfiguration = "Debug"
|
|
35
|
-
selectedDebuggerIdentifier = "Xcode.DebuggerFoundation.Debugger.LLDB"
|
|
36
|
-
selectedLauncherIdentifier = "Xcode.DebuggerFoundation.Launcher.LLDB"
|
|
37
|
-
launchStyle = "0"
|
|
38
|
-
useCustomWorkingDirectory = "NO"
|
|
39
|
-
ignoresPersistentStateOnLaunch = "NO"
|
|
40
|
-
debugDocumentVersioning = "YES"
|
|
41
|
-
debugServiceExtension = "internal"
|
|
42
|
-
allowLocationSimulation = "YES">
|
|
43
|
-
</LaunchAction>
|
|
44
|
-
<ProfileAction
|
|
45
|
-
buildConfiguration = "Release"
|
|
46
|
-
shouldUseLaunchSchemeArgsEnv = "YES"
|
|
47
|
-
savedToolIdentifier = ""
|
|
48
|
-
useCustomWorkingDirectory = "NO"
|
|
49
|
-
debugDocumentVersioning = "YES">
|
|
50
|
-
</ProfileAction>
|
|
51
|
-
<AnalyzeAction
|
|
52
|
-
buildConfiguration = "Debug">
|
|
53
|
-
</AnalyzeAction>
|
|
54
|
-
<ArchiveAction
|
|
55
|
-
buildConfiguration = "Release"
|
|
56
|
-
revealArchiveInOrganizer = "YES">
|
|
57
|
-
</ArchiveAction>
|
|
58
|
-
</Scheme>
|
|
@@ -1,58 +0,0 @@
|
|
|
1
|
-
<?xml version="1.0" encoding="UTF-8"?>
|
|
2
|
-
<Scheme
|
|
3
|
-
LastUpgradeVersion = "1600"
|
|
4
|
-
version = "1.3">
|
|
5
|
-
<BuildAction
|
|
6
|
-
parallelizeBuildables = "YES"
|
|
7
|
-
buildImplicitDependencies = "YES">
|
|
8
|
-
<BuildActionEntries>
|
|
9
|
-
<BuildActionEntry
|
|
10
|
-
buildForTesting = "YES"
|
|
11
|
-
buildForRunning = "YES"
|
|
12
|
-
buildForProfiling = "YES"
|
|
13
|
-
buildForArchiving = "YES"
|
|
14
|
-
buildForAnalyzing = "YES">
|
|
15
|
-
<BuildableReference
|
|
16
|
-
BuildableIdentifier = "primary"
|
|
17
|
-
BlueprintIdentifier = "0AEE99A309977BD12A049FF48AF9BA4B"
|
|
18
|
-
BuildableName = "Pods_Example.framework"
|
|
19
|
-
BlueprintName = "Pods-Example"
|
|
20
|
-
ReferencedContainer = "container:Pods.xcodeproj">
|
|
21
|
-
</BuildableReference>
|
|
22
|
-
</BuildActionEntry>
|
|
23
|
-
</BuildActionEntries>
|
|
24
|
-
</BuildAction>
|
|
25
|
-
<TestAction
|
|
26
|
-
buildConfiguration = "Debug"
|
|
27
|
-
selectedDebuggerIdentifier = "Xcode.DebuggerFoundation.Debugger.LLDB"
|
|
28
|
-
selectedLauncherIdentifier = "Xcode.DebuggerFoundation.Launcher.LLDB"
|
|
29
|
-
shouldUseLaunchSchemeArgsEnv = "YES">
|
|
30
|
-
<Testables>
|
|
31
|
-
</Testables>
|
|
32
|
-
</TestAction>
|
|
33
|
-
<LaunchAction
|
|
34
|
-
buildConfiguration = "Debug"
|
|
35
|
-
selectedDebuggerIdentifier = "Xcode.DebuggerFoundation.Debugger.LLDB"
|
|
36
|
-
selectedLauncherIdentifier = "Xcode.DebuggerFoundation.Launcher.LLDB"
|
|
37
|
-
launchStyle = "0"
|
|
38
|
-
useCustomWorkingDirectory = "NO"
|
|
39
|
-
ignoresPersistentStateOnLaunch = "NO"
|
|
40
|
-
debugDocumentVersioning = "YES"
|
|
41
|
-
debugServiceExtension = "internal"
|
|
42
|
-
allowLocationSimulation = "YES">
|
|
43
|
-
</LaunchAction>
|
|
44
|
-
<ProfileAction
|
|
45
|
-
buildConfiguration = "Release"
|
|
46
|
-
shouldUseLaunchSchemeArgsEnv = "YES"
|
|
47
|
-
savedToolIdentifier = ""
|
|
48
|
-
useCustomWorkingDirectory = "NO"
|
|
49
|
-
debugDocumentVersioning = "YES">
|
|
50
|
-
</ProfileAction>
|
|
51
|
-
<AnalyzeAction
|
|
52
|
-
buildConfiguration = "Debug">
|
|
53
|
-
</AnalyzeAction>
|
|
54
|
-
<ArchiveAction
|
|
55
|
-
buildConfiguration = "Release"
|
|
56
|
-
revealArchiveInOrganizer = "YES">
|
|
57
|
-
</ArchiveAction>
|
|
58
|
-
</Scheme>
|
|
@@ -1,58 +0,0 @@
|
|
|
1
|
-
<?xml version="1.0" encoding="UTF-8"?>
|
|
2
|
-
<Scheme
|
|
3
|
-
LastUpgradeVersion = "1600"
|
|
4
|
-
version = "1.3">
|
|
5
|
-
<BuildAction
|
|
6
|
-
parallelizeBuildables = "YES"
|
|
7
|
-
buildImplicitDependencies = "YES">
|
|
8
|
-
<BuildActionEntries>
|
|
9
|
-
<BuildActionEntry
|
|
10
|
-
buildForTesting = "YES"
|
|
11
|
-
buildForRunning = "YES"
|
|
12
|
-
buildForProfiling = "YES"
|
|
13
|
-
buildForArchiving = "YES"
|
|
14
|
-
buildForAnalyzing = "YES">
|
|
15
|
-
<BuildableReference
|
|
16
|
-
BuildableIdentifier = "primary"
|
|
17
|
-
BlueprintIdentifier = "3847153A6E5EEFB86565BA840768F429"
|
|
18
|
-
BuildableName = "SDWebImage.framework"
|
|
19
|
-
BlueprintName = "SDWebImage"
|
|
20
|
-
ReferencedContainer = "container:Pods.xcodeproj">
|
|
21
|
-
</BuildableReference>
|
|
22
|
-
</BuildActionEntry>
|
|
23
|
-
</BuildActionEntries>
|
|
24
|
-
</BuildAction>
|
|
25
|
-
<TestAction
|
|
26
|
-
buildConfiguration = "Debug"
|
|
27
|
-
selectedDebuggerIdentifier = "Xcode.DebuggerFoundation.Debugger.LLDB"
|
|
28
|
-
selectedLauncherIdentifier = "Xcode.DebuggerFoundation.Launcher.LLDB"
|
|
29
|
-
shouldUseLaunchSchemeArgsEnv = "YES">
|
|
30
|
-
<Testables>
|
|
31
|
-
</Testables>
|
|
32
|
-
</TestAction>
|
|
33
|
-
<LaunchAction
|
|
34
|
-
buildConfiguration = "Debug"
|
|
35
|
-
selectedDebuggerIdentifier = "Xcode.DebuggerFoundation.Debugger.LLDB"
|
|
36
|
-
selectedLauncherIdentifier = "Xcode.DebuggerFoundation.Launcher.LLDB"
|
|
37
|
-
launchStyle = "0"
|
|
38
|
-
useCustomWorkingDirectory = "NO"
|
|
39
|
-
ignoresPersistentStateOnLaunch = "NO"
|
|
40
|
-
debugDocumentVersioning = "YES"
|
|
41
|
-
debugServiceExtension = "internal"
|
|
42
|
-
allowLocationSimulation = "YES">
|
|
43
|
-
</LaunchAction>
|
|
44
|
-
<ProfileAction
|
|
45
|
-
buildConfiguration = "Release"
|
|
46
|
-
shouldUseLaunchSchemeArgsEnv = "YES"
|
|
47
|
-
savedToolIdentifier = ""
|
|
48
|
-
useCustomWorkingDirectory = "NO"
|
|
49
|
-
debugDocumentVersioning = "YES">
|
|
50
|
-
</ProfileAction>
|
|
51
|
-
<AnalyzeAction
|
|
52
|
-
buildConfiguration = "Debug">
|
|
53
|
-
</AnalyzeAction>
|
|
54
|
-
<ArchiveAction
|
|
55
|
-
buildConfiguration = "Release"
|
|
56
|
-
revealArchiveInOrganizer = "YES">
|
|
57
|
-
</ArchiveAction>
|
|
58
|
-
</Scheme>
|