@momo-kits/native-kits 0.167.1-beta.10-debug → 0.167.1-beta.11-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.
@@ -40,7 +40,7 @@ kotlin {
40
40
  }
41
41
 
42
42
  cocoapods {
43
- version = "0.167.1-beta.10-debug"
43
+ version = "0.167.1-beta.11-debug"
44
44
  summary = "IOS Shared module"
45
45
  homepage = "https://momo.vn"
46
46
  ios.deploymentTarget = "15.0"
@@ -6,6 +6,8 @@ import androidx.compose.runtime.mutableStateOf
6
6
  import androidx.compose.runtime.setValue
7
7
  import androidx.compose.runtime.staticCompositionLocalOf
8
8
  import vn.momo.kits.components.TrustBannerData
9
+ import vn.momo.kits.const.KitDesignSystem
10
+ import vn.momo.kits.const.Theme
9
11
 
10
12
  @Immutable
11
13
  data class FeatureFlags(
@@ -30,6 +32,9 @@ object KitDesignSystemConfig {
30
32
  }
31
33
  }
32
34
 
35
+ internal fun Theme.withDesignSystemFont(): Theme =
36
+ copy(font = if (KitDesignSystem.isWhiteList) "MomoTrustSans" else "SFProText")
37
+
33
38
  @Immutable
34
39
  data class MiniAppContext(
35
40
  val appIcon: String = "",
@@ -96,7 +96,7 @@ fun ApplicationContainer(
96
96
 
97
97
  ProvideOsFontScale {
98
98
  CompositionLocalProvider(
99
- AppTheme provides appTheme,
99
+ AppTheme provides appTheme.withDesignSystemFont(),
100
100
  PlatformApi provides composeApi,
101
101
  AppStatusBar provides appStatusBarHeight,
102
102
  LocalContext provides applicationContext,
@@ -23,7 +23,7 @@ fun WidgetContainer(
23
23
  val mergedContext = remember(parentContext, miniAppContext) {
24
24
  MiniAppContext.merge(parentContext, miniAppContext)
25
25
  }
26
- val resolvedTheme = theme ?: AppTheme.current
26
+ val resolvedTheme = (theme ?: AppTheme.current).withDesignSystemFont()
27
27
  val resolvedLocalize = localize ?: LocalLocalize.current
28
28
  val resolvedMaxApi = maxApi ?: LocalMaxApi.current
29
29
 
@@ -121,8 +121,7 @@ private val hostFontFiles: Map<String, String> = mapOf(
121
121
 
122
122
  @Composable
123
123
  fun getFontFamily(fontFamily: String, fontWeight: FontWeight? = FontWeight.Normal): FontFamily {
124
- val family = if (KitDesignSystem.isWhiteList && fontFamily == "SFProText") "MomoTrustSans" else fontFamily
125
- val key = "$family-${fontWeight?.weight}"
124
+ val key = "$fontFamily-${fontWeight?.weight}"
126
125
  val fileName = hostFontFiles[key] ?: DEFAULT_FONT_FILE
127
126
  return hostFontFamily(fileName)
128
127
  ?: hostFontFamily(DEFAULT_FONT_FILE)
@@ -26,6 +26,7 @@ import vn.momo.kits.application.LocalDesignSystemConfig
26
26
  import vn.momo.kits.application.LocalLocalize
27
27
  import vn.momo.kits.application.Localize
28
28
  import vn.momo.kits.application.MiniAppContext
29
+ import vn.momo.kits.application.withDesignSystemFont
29
30
  import vn.momo.kits.const.AppNavigationBar
30
31
  import vn.momo.kits.const.AppStatusBar
31
32
  import vn.momo.kits.const.AppTheme
@@ -98,7 +99,7 @@ fun NavigationContainer(
98
99
  LocalNavigator provides navigator,
99
100
  LocalDynamicScreenRegistry provides registry,
100
101
  LocalMaxApi provides maxApi,
101
- AppTheme provides resolvedTheme,
102
+ AppTheme provides resolvedTheme.withDesignSystemFont(),
102
103
  AppStatusBar provides statusBarHeight,
103
104
  AppNavigationBar provides navigationBarHeight,
104
105
  LocalContext provides mergedContext,
@@ -43,6 +43,12 @@ public class KitConfig {
43
43
  public var headerGradient: String? = nil
44
44
  }
45
45
 
46
+ extension Theme {
47
+ func withDesignSystemFont() -> Theme {
48
+ copy(font: KitDesignSystem.shared.isWhiteList ? "MomoTrustSans" : "SFProText")
49
+ }
50
+ }
51
+
46
52
  public class ApplicationEnvironment: ObservableObject {
47
53
  // AI-GENERATED START: expose the host bridge to modules outside MoMoUIKits (e.g. the demo pod)
48
54
  public let applicationContext: MiniAppContext?
@@ -15,6 +15,7 @@ public struct NavigationContainer<Initial: View>: View {
15
15
  @StateObject private var navigator: Navigator
16
16
  @StateObject private var applicationEnvironment: ApplicationEnvironment
17
17
  @StateObject private var localize: Localize
18
+ @Environment(\.appTheme) private var theme
18
19
 
19
20
  private let setNavigator: ((Navigator) -> Void)?
20
21
  private let composeApi: KitComposeApi?
@@ -64,6 +65,7 @@ public struct NavigationContainer<Initial: View>: View {
64
65
  .environmentObject(navigator)
65
66
  .environmentObject(applicationEnvironment)
66
67
  .environment(\.applicationEnvironment, applicationEnvironment)
68
+ .environment(\.appTheme, theme.withDesignSystemFont())
67
69
  // AI-GENERATED START: route Localize + font-scale injection through the observing modifiers
68
70
  .momoLocalize(localize)
69
71
  .momoFontScale(context: applicationEnvironment.applicationContext)
@@ -73,6 +75,7 @@ public struct NavigationContainer<Initial: View>: View {
73
75
  .environmentObject(navigator)
74
76
  .environmentObject(applicationEnvironment)
75
77
  .environment(\.applicationEnvironment, applicationEnvironment)
78
+ .environment(\.appTheme, theme.withDesignSystemFont())
76
79
  // AI-GENERATED START: route Localize + font-scale injection through the observing modifiers
77
80
  .momoLocalize(localize)
78
81
  .momoFontScale(context: applicationEnvironment.applicationContext)
@@ -84,6 +87,7 @@ public struct NavigationContainer<Initial: View>: View {
84
87
  .environmentObject(navigator)
85
88
  .environmentObject(applicationEnvironment)
86
89
  .environment(\.applicationEnvironment, applicationEnvironment)
90
+ .environment(\.appTheme, theme.withDesignSystemFont())
87
91
  // AI-GENERATED START: route Localize + font-scale injection through the observing modifiers
88
92
  .momoLocalize(localize)
89
93
  .momoFontScale(context: applicationEnvironment.applicationContext)
@@ -221,7 +221,7 @@ public let defaultTheme = Theme(
221
221
  container: Colors.blue08
222
222
  )
223
223
  ),
224
- font: "MomoTrustSans",
224
+ font: "SFProText",
225
225
  assets: ThemeAssets(headerBackground: nil)
226
226
  )
227
227
 
@@ -277,7 +277,7 @@ public let darkTheme = Theme(
277
277
  container: Colors.blue08
278
278
  )
279
279
  ),
280
- font: "MomoTrustSans",
280
+ font: "SFProText",
281
281
  assets: ThemeAssets(headerBackground: nil)
282
282
  )
283
283
 
@@ -100,8 +100,6 @@ public extension TypographyStyle {
100
100
  }
101
101
 
102
102
  private func momoFontName(family: String, weight: Font.Weight) -> String? {
103
- // Ngoai whitelist thi tra nil de momoFont() roi ve .system(...), dung nhu truoc DS-791.
104
- guard KitDesignSystem.shared.isWhiteList else { return nil }
105
103
  guard family == "MomoTrustSans" else { return nil }
106
104
  switch weight {
107
105
  case .ultraLight, .thin: return "MomoTrustSans-ExtraLight"
package/package.json CHANGED
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "@momo-kits/native-kits",
3
- "version": "0.167.1-beta.10-debug",
3
+ "version": "0.167.1-beta.11-debug",
4
4
  "private": false,
5
5
  "dependeNavigationncies": {},
6
6
  "devDependencies": {},