@momo-kits/native-kits 0.162.2-sp.6-debug → 0.162.2-sp.7-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.162.2-sp.6-debug"
43
+ version = "0.162.2-sp.7-debug"
44
44
  summary = "IOS Shared module"
45
45
  homepage = "https://momo.vn"
46
46
  ios.deploymentTarget = "15.0"
@@ -132,6 +132,29 @@ compose {
132
132
  }
133
133
  }
134
134
 
135
+ val disableSyntheticPodsDebugDylib by tasks.registering {
136
+ dependsOn("podInstallSyntheticIos")
137
+
138
+ doLast {
139
+ val syntheticPodsDir = layout.buildDirectory.dir("cocoapods/synthetic/ios/Pods").get().asFile
140
+ val xcconfigFiles = syntheticPodsDir
141
+ .resolve("Target Support Files")
142
+ .walkTopDown()
143
+ .filter { it.isFile && it.extension == "xcconfig" }
144
+
145
+ xcconfigFiles.forEach { file ->
146
+ val text = file.readText()
147
+ if (!text.contains("ENABLE_DEBUG_DYLIB")) {
148
+ file.appendText("\nENABLE_DEBUG_DYLIB = NO\n")
149
+ }
150
+ }
151
+ }
152
+ }
153
+
154
+ tasks.matching { it.name.startsWith("podBuild") }.configureEach {
155
+ dependsOn(disableSyntheticPodsDebugDylib)
156
+ }
157
+
135
158
  // publishing {
136
159
  // repositories {
137
160
  // maven {
@@ -132,6 +132,29 @@ compose {
132
132
  }
133
133
  }
134
134
 
135
+ val disableSyntheticPodsDebugDylib by tasks.registering {
136
+ dependsOn("podInstallSyntheticIos")
137
+
138
+ doLast {
139
+ val syntheticPodsDir = layout.buildDirectory.dir("cocoapods/synthetic/ios/Pods").get().asFile
140
+ val xcconfigFiles = syntheticPodsDir
141
+ .resolve("Target Support Files")
142
+ .walkTopDown()
143
+ .filter { it.isFile && it.extension == "xcconfig" }
144
+
145
+ xcconfigFiles.forEach { file ->
146
+ val text = file.readText()
147
+ if (!text.contains("ENABLE_DEBUG_DYLIB")) {
148
+ file.appendText("\nENABLE_DEBUG_DYLIB = NO\n")
149
+ }
150
+ }
151
+ }
152
+ }
153
+
154
+ tasks.matching { it.name.startsWith("podBuild") }.configureEach {
155
+ dependsOn(disableSyntheticPodsDebugDylib)
156
+ }
157
+
135
158
  publishing {
136
159
  repositories {
137
160
  maven {
@@ -1,6 +1,6 @@
1
1
  Pod::Spec.new do |spec|
2
2
  spec.name = 'compose'
3
- spec.version = '0.162.2-sp.6-debug'
3
+ spec.version = '0.162.2-sp.7-debug'
4
4
  spec.homepage = 'https://momo.vn'
5
5
  spec.source = { :http=> ''}
6
6
  spec.authors = ''
package/gradle.properties CHANGED
@@ -18,7 +18,7 @@ kotlin.apple.xcodeCompatibility.nowarn=true
18
18
  name="ComposeKits"
19
19
  group=vn.momo.kits
20
20
  artifact.id=kits
21
- version=0.162.2-sp.6
21
+ version=0.162.2-sp.7
22
22
 
23
23
  repo=GitLab
24
24
  url=https://gitlab.mservice.com.vn/api/v4/projects/5400/packages/maven
@@ -48,3 +48,14 @@ public class ApplicationEnvironment: ObservableObject {
48
48
  self.config = config
49
49
  }
50
50
  }
51
+
52
+ private struct ApplicationEnvironmentKey: EnvironmentKey {
53
+ static let defaultValue = ApplicationEnvironment()
54
+ }
55
+
56
+ public extension EnvironmentValues {
57
+ var applicationEnvironment: ApplicationEnvironment {
58
+ get { self[ApplicationEnvironmentKey.self] }
59
+ set { self[ApplicationEnvironmentKey.self] = newValue }
60
+ }
61
+ }
@@ -101,7 +101,7 @@ struct ToolkitHeaderRight: View {
101
101
  var tintColor: Color?
102
102
  @State private var isFavorite: Bool = false
103
103
  @State private var isLoading: Bool = false
104
- @EnvironmentObject private var environment: ApplicationEnvironment
104
+ @Environment(\.applicationEnvironment) private var environment
105
105
 
106
106
  private func apiValue(_ value: Any?) -> Any {
107
107
  value ?? NSNull()
@@ -13,6 +13,7 @@ import SwiftUI
13
13
  @available(iOS 16.0, *)
14
14
  public struct NavigationContainer<Initial: View>: View {
15
15
  @StateObject private var navigator: Navigator
16
+ @StateObject private var applicationEnvironment: ApplicationEnvironment
16
17
 
17
18
  private let setNavigator: ((Navigator) -> Void)?
18
19
  private let composeApi: KitComposeApi?
@@ -21,7 +22,9 @@ public struct NavigationContainer<Initial: View>: View {
21
22
  initialScreenName: String = "",
22
23
  @ViewBuilder initialScreen: @escaping () -> Initial,
23
24
  options: NavigationOptions? = nil,
25
+ applicationContext: MiniAppContext? = nil,
24
26
  composeApi: KitComposeApi? = nil,
27
+ config: KitConfig? = nil,
25
28
  setNavigator: ((Navigator) -> Void)? = nil
26
29
  ) {
27
30
  let nav = Navigator(
@@ -31,6 +34,13 @@ public struct NavigationContainer<Initial: View>: View {
31
34
  composeApi: composeApi
32
35
  )
33
36
  _navigator = StateObject(wrappedValue: nav)
37
+ _applicationEnvironment = StateObject(
38
+ wrappedValue: ApplicationEnvironment(
39
+ applicationContext: applicationContext,
40
+ composeApi: composeApi,
41
+ config: config
42
+ )
43
+ )
34
44
  self.composeApi = composeApi
35
45
  self.setNavigator = setNavigator
36
46
  }
@@ -43,14 +53,20 @@ public struct NavigationContainer<Initial: View>: View {
43
53
  }
44
54
  }
45
55
  .environmentObject(navigator)
56
+ .environmentObject(applicationEnvironment)
57
+ .environment(\.applicationEnvironment, applicationEnvironment)
46
58
  .fullScreenCover(item: $navigator.presented) { route in
47
59
  screenView(forDialog: route)
48
60
  .environmentObject(navigator)
61
+ .environmentObject(applicationEnvironment)
62
+ .environment(\.applicationEnvironment, applicationEnvironment)
49
63
  }
50
64
  .overlay {
51
65
  if let item = navigator.overplay {
52
66
  OverplayHost(item: item)
53
67
  .environmentObject(navigator)
68
+ .environmentObject(applicationEnvironment)
69
+ .environment(\.applicationEnvironment, applicationEnvironment)
54
70
  }
55
71
  }
56
72
  .onAppear {
@@ -1,32 +1,2 @@
1
- import Foundation
2
- import SwiftUI
3
-
4
- private final class MoMoUIKitsBundleToken {}
5
-
6
- enum MoMoUIKitsResources {
7
- static let bundle: Bundle = {
8
- let bundleName = "MoMoUIKitsResources"
9
- let tokenBundle = Bundle(for: MoMoUIKitsBundleToken.self)
10
- let candidates = [
11
- Bundle.main.resourceURL,
12
- tokenBundle.resourceURL,
13
- tokenBundle.bundleURL
14
- ]
15
-
16
- for candidate in candidates {
17
- guard let bundleURL = candidate?.appendingPathComponent("\(bundleName).bundle"),
18
- let bundle = Bundle(url: bundleURL) else {
19
- continue
20
- }
21
- return bundle
22
- }
23
-
24
- return tokenBundle
25
- }()
26
- }
27
-
28
- extension Color {
29
- static func momoAsset(_ name: String) -> Color {
30
- Color(name, bundle: MoMoUIKitsResources.bundle)
31
- }
32
- }
1
+ // Resource bundle lookup lives in Extensions/Color++.swift so existing Pods
2
+ // projects that already include the color extension can resolve Color.momoAsset.
@@ -1,6 +1,35 @@
1
1
  import SwiftUI
2
+ import Foundation
3
+
4
+ private final class MoMoUIKitsBundleToken {}
5
+
6
+ enum MoMoUIKitsResources {
7
+ static let bundle: Bundle = {
8
+ let bundleName = "MoMoUIKitsResources"
9
+ let tokenBundle = Bundle(for: MoMoUIKitsBundleToken.self)
10
+ let candidates = [
11
+ Bundle.main.resourceURL,
12
+ tokenBundle.resourceURL,
13
+ tokenBundle.bundleURL
14
+ ]
15
+
16
+ for candidate in candidates {
17
+ guard let bundleURL = candidate?.appendingPathComponent("\(bundleName).bundle"),
18
+ let bundle = Bundle(url: bundleURL) else {
19
+ continue
20
+ }
21
+ return bundle
22
+ }
23
+
24
+ return tokenBundle
25
+ }()
26
+ }
2
27
 
3
28
  public extension Color {
29
+ static func momoAsset(_ name: String) -> Color {
30
+ Color(name, bundle: MoMoUIKitsResources.bundle)
31
+ }
32
+
4
33
  init(hex: UInt, alpha: Double = 1) {
5
34
  self.init(
6
35
  .sRGB,
@@ -1,6 +1,6 @@
1
1
  Pod::Spec.new do |s|
2
2
  s.name = 'MoMoUIKits'
3
- s.version = '0.162.2-sp.6'
3
+ s.version = '0.162.2-sp.7'
4
4
  s.summary = 'MoMoUIKits for iOS'
5
5
  s.homepage = 'https://momo.vn'
6
6
  s.license = { :type => 'MIT' }
@@ -1,6 +1,6 @@
1
1
  Pod::Spec.new do |s|
2
2
  s.name = 'MoMoUIKitsDemo'
3
- s.version = '0.162.2-sp.6'
3
+ s.version = '0.162.2-sp.7'
4
4
  s.summary = 'Demo browser for MoMoUIKits SwiftUI components'
5
5
  s.homepage = 'https://momo.vn'
6
6
  s.license = { :type => 'MIT' }
@@ -97,9 +97,20 @@ public struct HomeView: View {
97
97
  // forwarded into the content for filtering.
98
98
  @State private var searchText = ""
99
99
  private let onOpenCompose: () -> Void
100
+ private let applicationContext: MiniAppContext?
101
+ private let composeApi: KitComposeApi?
102
+ private let config: KitConfig?
100
103
 
101
- public init(onOpenCompose: @escaping () -> Void = {}) {
104
+ public init(
105
+ onOpenCompose: @escaping () -> Void = {},
106
+ applicationContext: MiniAppContext? = nil,
107
+ composeApi: KitComposeApi? = nil,
108
+ config: KitConfig? = nil
109
+ ) {
102
110
  self.onOpenCompose = onOpenCompose
111
+ self.applicationContext = applicationContext
112
+ self.composeApi = composeApi
113
+ self.config = config
103
114
  }
104
115
 
105
116
  public var body: some View {
@@ -182,7 +193,10 @@ public struct HomeView: View {
182
193
  position: .right,
183
194
  bottomPadding: nil
184
195
  )
185
- )
196
+ ),
197
+ applicationContext: applicationContext,
198
+ composeApi: composeApi,
199
+ config: config
186
200
  )
187
201
  }
188
202
  }
@@ -9,15 +9,15 @@ struct SwiftUIDemoBrowserView: View {
9
9
  var body: some View {
10
10
  Group {
11
11
  if #available(iOS 16.0, *) {
12
- HomeView(onOpenCompose: onOpenCompose)
12
+ HomeView(
13
+ onOpenCompose: onOpenCompose,
14
+ applicationContext: context.miniAppContext
15
+ )
13
16
  } else {
14
17
  fallbackBrowser
15
18
  }
16
19
  }
17
20
  .environment(\.appTheme, defaultTheme)
18
- .environmentObject(
19
- ApplicationEnvironment(applicationContext: context.miniAppContext)
20
- )
21
21
  }
22
22
 
23
23
  private var fallbackBrowser: some View {
package/package.json CHANGED
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "@momo-kits/native-kits",
3
- "version": "0.162.2-sp.6-debug",
3
+ "version": "0.162.2-sp.7-debug",
4
4
  "private": false,
5
5
  "dependencies": {},
6
6
  "devDependencies": {},