@momo-kits/native-kits 0.112.1-beta.15 → 0.112.1-beta.16
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.
|
@@ -6,14 +6,9 @@ import androidx.compose.runtime.LaunchedEffect
|
|
|
6
6
|
import androidx.compose.runtime.getValue
|
|
7
7
|
import androidx.compose.runtime.mutableStateOf
|
|
8
8
|
import androidx.compose.runtime.remember
|
|
9
|
-
import androidx.compose.runtime.rememberCoroutineScope
|
|
10
9
|
import androidx.compose.runtime.setValue
|
|
11
10
|
import androidx.compose.runtime.staticCompositionLocalOf
|
|
12
11
|
import androidx.compose.ui.unit.Dp
|
|
13
|
-
import kotlinx.coroutines.launch
|
|
14
|
-
import kotlinx.serialization.json.Json
|
|
15
|
-
import kotlinx.serialization.json.jsonObject
|
|
16
|
-
import kotlinx.serialization.json.jsonPrimitive
|
|
17
12
|
import vn.momo.kits.const.AppStatusBar
|
|
18
13
|
import vn.momo.kits.const.AppTheme
|
|
19
14
|
import vn.momo.kits.const.Theme
|
|
@@ -70,33 +65,23 @@ fun ApplicationContainer(
|
|
|
70
65
|
composeApi: ComposeApi? = null,
|
|
71
66
|
statusBarHeight: Dp? = null,
|
|
72
67
|
applicationContext: MiniAppContext? = null,
|
|
68
|
+
config: Map<String, Any?>? = null,
|
|
73
69
|
content: @Composable () -> Unit,
|
|
74
70
|
) {
|
|
75
71
|
var appTheme by remember { mutableStateOf(theme) }
|
|
76
|
-
val coroutineScope = rememberCoroutineScope()
|
|
77
72
|
|
|
78
73
|
LaunchedEffect(Unit) {
|
|
79
74
|
try {
|
|
80
|
-
|
|
81
|
-
|
|
82
|
-
|
|
83
|
-
|
|
84
|
-
|
|
85
|
-
|
|
86
|
-
|
|
87
|
-
?.content
|
|
88
|
-
if (headerBar != null && appTheme.assets.headerBackground == null) {
|
|
89
|
-
coroutineScope.launch {
|
|
90
|
-
appTheme = appTheme.copy(
|
|
91
|
-
assets = ThemeAssets(
|
|
92
|
-
headerBackground = headerBar
|
|
93
|
-
)
|
|
94
|
-
)
|
|
95
|
-
}
|
|
96
|
-
}
|
|
75
|
+
val headerBar = config?.get("headerBar")?.toString()
|
|
76
|
+
if (headerBar != null && appTheme.assets.headerBackground == null) {
|
|
77
|
+
appTheme = appTheme.copy(
|
|
78
|
+
assets = ThemeAssets(
|
|
79
|
+
headerBackground = headerBar
|
|
80
|
+
)
|
|
81
|
+
)
|
|
97
82
|
}
|
|
98
83
|
} catch (e: Exception) {
|
|
99
|
-
print("@@ == NavigationContainer
|
|
84
|
+
print("@@ == NavigationContainer get config error $e")
|
|
100
85
|
}
|
|
101
86
|
}
|
|
102
87
|
|
|
@@ -23,8 +23,8 @@ import vn.momo.kits.modifier.noFeedbackClickable
|
|
|
23
23
|
|
|
24
24
|
val defaultBanner = TrustBannerData(
|
|
25
25
|
content = mapOf(
|
|
26
|
-
"vi" to "
|
|
27
|
-
"en" to "
|
|
26
|
+
"vi" to "An toàn tài sản & Bảo mật thông tin của bạn là ưu tiên hàng đầu của MoMo.",
|
|
27
|
+
"en" to "Ensuring financial security and data privacy is MoMo's highest priority."
|
|
28
28
|
),
|
|
29
29
|
subContent = mapOf(
|
|
30
30
|
"vi" to "Tìm hiểu thêm",
|
package/ios/Icon/Icon.swift
CHANGED
|
@@ -44,9 +44,7 @@ public struct Icon: View {
|
|
|
44
44
|
|
|
45
45
|
public var body: some View {
|
|
46
46
|
if let uri = iconSources[source]?.uri {
|
|
47
|
-
ImageView(uri)
|
|
48
|
-
.frame(width: size, height: size)
|
|
49
|
-
.foregroundColor(color)
|
|
47
|
+
ImageView(uri, color: color).frame(width: size, height: size)
|
|
50
48
|
}
|
|
51
49
|
}
|
|
52
50
|
}
|
package/ios/Image/Image.swift
CHANGED
|
@@ -8,11 +8,12 @@ import SwiftUI
|
|
|
8
8
|
public struct ImageView: View {
|
|
9
9
|
// MARK: Lifecycle
|
|
10
10
|
|
|
11
|
-
public init(_ url: String, aspectRatio: CGFloat? = nil, contentMode: ContentMode = ContentMode.fit, placeholder: AnyView? = nil) {
|
|
11
|
+
public init(_ url: String, aspectRatio: CGFloat? = nil, contentMode: ContentMode = ContentMode.fit, placeholder: AnyView? = nil, color: Color? = nil) {
|
|
12
12
|
self.url = url
|
|
13
13
|
self.aspectRatio = aspectRatio
|
|
14
14
|
self.contentMode = contentMode
|
|
15
15
|
self.placeholder = placeholder
|
|
16
|
+
self.color = color
|
|
16
17
|
}
|
|
17
18
|
|
|
18
19
|
// MARK: Public
|
|
@@ -26,6 +27,7 @@ public struct ImageView: View {
|
|
|
26
27
|
error = false
|
|
27
28
|
}
|
|
28
29
|
.resizable()
|
|
30
|
+
.renderingMode(.template)
|
|
29
31
|
.placeholder {
|
|
30
32
|
Rectangle().foregroundColor(.gray)
|
|
31
33
|
VStack(alignment: .center, content: {
|
|
@@ -47,6 +49,7 @@ public struct ImageView: View {
|
|
|
47
49
|
.scaledToFit()
|
|
48
50
|
.transition(.fade)
|
|
49
51
|
.aspectRatio(aspectRatio, contentMode: contentMode)
|
|
52
|
+
.modifier(ColorMultiplyModifier(color: color))
|
|
50
53
|
}
|
|
51
54
|
|
|
52
55
|
// MARK: Internal
|
|
@@ -54,7 +57,20 @@ public struct ImageView: View {
|
|
|
54
57
|
var aspectRatio: CGFloat?
|
|
55
58
|
var contentMode: ContentMode
|
|
56
59
|
var placeholder: AnyView?
|
|
60
|
+
var color: Color?
|
|
57
61
|
|
|
58
62
|
@State var error: Bool = false
|
|
59
63
|
var url: String
|
|
60
64
|
}
|
|
65
|
+
|
|
66
|
+
private struct ColorMultiplyModifier: ViewModifier {
|
|
67
|
+
let color: Color?
|
|
68
|
+
|
|
69
|
+
func body(content: Content) -> some View {
|
|
70
|
+
if let color {
|
|
71
|
+
content.colorMultiply(color)
|
|
72
|
+
} else {
|
|
73
|
+
content
|
|
74
|
+
}
|
|
75
|
+
}
|
|
76
|
+
}
|