@momo-kits/native-kits 0.161.1-beta.15-debug → 0.161.2-beta.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.
Files changed (35) hide show
  1. package/compose/build.gradle.kts +9 -3
  2. package/compose/build.gradle.kts.backup +8 -2
  3. package/compose/compose.podspec +1 -1
  4. package/compose/src/androidMain/kotlin/vn/momo/kits/navigation/ScrollToTop.android.kt +6 -0
  5. package/compose/src/androidMain/kotlin/vn/momo/kits/platform/Platform.android.kt +9 -2
  6. package/compose/src/commonMain/kotlin/vn/momo/kits/application/Context.kt +8 -14
  7. package/compose/src/commonMain/kotlin/vn/momo/kits/application/LiteScreen.kt +324 -117
  8. package/compose/src/commonMain/kotlin/vn/momo/kits/application/Screen.kt +4 -3
  9. package/compose/src/commonMain/kotlin/vn/momo/kits/components/BaselineView.kt +4 -0
  10. package/compose/src/commonMain/kotlin/vn/momo/kits/components/Input.kt +5 -1
  11. package/compose/src/commonMain/kotlin/vn/momo/kits/components/InputOTP.kt +5 -1
  12. package/compose/src/commonMain/kotlin/vn/momo/kits/components/InputSearch.kt +19 -14
  13. package/compose/src/commonMain/kotlin/vn/momo/kits/components/ScaleSizeScope.kt +17 -0
  14. package/compose/src/commonMain/kotlin/vn/momo/kits/const/Typography.kt +27 -12
  15. package/compose/src/commonMain/kotlin/vn/momo/kits/navigation/Navigation.kt +1 -0
  16. package/compose/src/commonMain/kotlin/vn/momo/kits/navigation/NavigationContainer.kt +1 -28
  17. package/compose/src/commonMain/kotlin/vn/momo/kits/navigation/ScrollToTop.kt +8 -0
  18. package/compose/src/commonMain/kotlin/vn/momo/kits/navigation/StackScreen.kt +63 -49
  19. package/compose/src/commonMain/kotlin/vn/momo/kits/platform/ComposeLottieAnimation.kt +62 -0
  20. package/compose/src/commonMain/kotlin/vn/momo/kits/platform/Platform.kt +23 -2
  21. package/compose/src/commonMain/kotlin/vn/momo/kits/utils/Resources.kt +12 -4
  22. package/compose/src/iosMain/kotlin/vn/momo/kits/navigation/ScrollToTop.ios.kt +33 -0
  23. package/compose/src/iosMain/kotlin/vn/momo/kits/platform/Platform.ios.kt +18 -8
  24. package/gradle/libs.versions.toml +3 -1
  25. package/gradle.properties +1 -1
  26. package/ios/Application/ApplicationEnvironment.swift +2 -6
  27. package/ios/Input/Input.swift +50 -21
  28. package/ios/Input/InputPhoneNumber.swift +17 -17
  29. package/ios/StatusBarTap/StatusBarTap.h +13 -0
  30. package/ios/StatusBarTap/StatusBarTap.m +75 -0
  31. package/ios/Typography/Text.swift +19 -14
  32. package/ios/Typography/Typography.swift +22 -1
  33. package/ios/native-kits.podspec +2 -1
  34. package/package.json +1 -1
  35. package/settings.gradle.kts +15 -3
@@ -1,25 +1,30 @@
1
1
  import SwiftUI
2
2
 
3
- private let DEFAULT_SCREEN_SIZE: CGFloat = 375
4
- private let MAX_FONT_SCALE: CGFloat = 1.2
3
+ public func scaleSize(_ size: CGFloat, _ scaleRate: CGFloat? = nil) -> CGFloat {
4
+ let defaultScreenSize: CGFloat = 375
5
+ let maxFontScale: CGFloat = scaleRate ?? 1.5
6
+ let maxDeviceScale: CGFloat = 5
5
7
 
6
- public func scaleSize(_ size: CGFloat) -> CGFloat {
7
- if UseFontScaleSystem {
8
- let deviceWidth = UIScreen.main.bounds.width
9
- let deviceScale = deviceWidth / DEFAULT_SCREEN_SIZE
8
+ let deviceWidth = UIScreen.main.bounds.width
9
+ let deviceScale = deviceWidth / defaultScreenSize
10
10
 
11
- let defaultFont = UIFont.systemFont(ofSize: UIFont.labelFontSize)
12
- let scaledFont = UIFontMetrics.default.scaledFont(for: defaultFont)
13
- let fontScale = scaledFont.pointSize / defaultFont.pointSize
11
+ let defaultFont = UIFont.systemFont(ofSize: UIFont.labelFontSize)
12
+ let scaledFont = UIFontMetrics.default.scaledFont(for: defaultFont)
13
+ let fontScale = scaledFont.pointSize / defaultFont.pointSize
14
14
 
15
- let maxSize = size * MAX_FONT_SCALE
16
- let fontSizeScaleDevice = deviceScale > 1 ? deviceScale * size : size
17
- let fontSizeScaleOS = fontScale > 1 ? fontScale * size : size
15
+ var fontSizeDeviceScale = size
16
+ var fontSizeOSScale = size
18
17
 
19
- return min(max(fontSizeScaleDevice, fontSizeScaleOS), maxSize)
18
+
19
+ if deviceScale > 1 {
20
+ fontSizeDeviceScale = min(fontSizeDeviceScale * deviceScale, fontSizeDeviceScale + maxDeviceScale)
21
+ }
22
+
23
+ if fontScale > 1 {
24
+ fontSizeOSScale = min(fontSizeOSScale * fontScale, fontSizeOSScale * maxFontScale)
20
25
  }
21
26
 
22
- return size
27
+ return max(fontSizeDeviceScale, fontSizeOSScale)
23
28
  }
24
29
 
25
30
  public enum TypographyStyle {
@@ -2,7 +2,28 @@ import SwiftUI
2
2
 
3
3
  public extension Font {
4
4
  static func appFont(size: CGFloat) -> Font {
5
- return Font.system(size: scaleSize(size))
5
+ let defaultScreenSize: CGFloat = 375
6
+ let maxFontScale: CGFloat = 1.5
7
+ let maxDeviceScale: CGFloat = 5
8
+
9
+ let deviceWidth = UIScreen.main.bounds.width
10
+ let deviceScale = deviceWidth / defaultScreenSize
11
+
12
+ let defaultFont = UIFont.systemFont(ofSize: UIFont.labelFontSize)
13
+ let scaledFont = UIFontMetrics.default.scaledFont(for: defaultFont)
14
+ let fontScale = scaledFont.pointSize / defaultFont.pointSize
15
+
16
+ var fontSize = size
17
+
18
+ if deviceScale > 1 {
19
+ fontSize = min(fontSize * deviceScale, fontSize + maxDeviceScale)
20
+ }
21
+
22
+ if fontScale > 1 {
23
+ fontSize = min(fontSize * fontScale, fontSize * maxFontScale)
24
+ }
25
+
26
+ return Font.system(size: fontSize)
6
27
  }
7
28
 
8
29
  // New supported typography styles
@@ -10,7 +10,8 @@ Pod::Spec.new do |s|
10
10
  s.ios.deployment_target = '15.0'
11
11
  s.swift_version = '5.0'
12
12
 
13
- s.source_files = "**/*.swift"
13
+ s.source_files = "**/*.{swift,m,h}"
14
+ s.public_header_files = "StatusBarTap/*.h"
14
15
  s.framework = 'SwiftUI', 'Combine'
15
16
  s.dependency 'SDWebImageSwiftUI'
16
17
  s.dependency 'lottie-ios'
package/package.json CHANGED
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "@momo-kits/native-kits",
3
- "version": "0.161.1-beta.15-debug",
3
+ "version": "0.161.2-beta.1-debug",
4
4
  "private": false,
5
5
  "dependencies": {},
6
6
  "devDependencies": {},
@@ -19,7 +19,11 @@ pluginManagement {
19
19
  credentials {username = "download_packages"; password = "gldt-bjDqLpU_sPcHDuXau2ws" }
20
20
  }
21
21
  maven {
22
- url = uri("http://nexus.mservice.com.vn:8081/repository/maven-public/")
22
+ url = uri("https://artifacts.mservice.com.vn/repository/maven-momo-app/")
23
+ credentials {
24
+ username = "viewer"
25
+ password = "viewer"
26
+ }
23
27
  isAllowInsecureProtocol = true
24
28
  }
25
29
  }
@@ -35,12 +39,20 @@ dependencyResolutionManagement {
35
39
  }
36
40
  }
37
41
  mavenCentral()
42
+ maven { url = uri("https://maven.pkg.jetbrains.space/public/p/compose/dev") }
38
43
  maven {
39
44
  url = uri("https://gitlab.mservice.com.vn/api/v4/projects/5400/packages/maven")
40
- credentials {username = "download_packages"; password = "gldt-bjDqLpU_sPcHDuXau2ws" }
45
+ credentials {
46
+ username = "download_packages";
47
+ password = "gldt-bjDqLpU_sPcHDuXau2ws"
48
+ }
41
49
  }
42
50
  maven {
43
- url = uri("http://nexus.mservice.com.vn:8081/repository/maven-public/")
51
+ url = uri("https://artifacts.mservice.com.vn/repository/maven-momo-app/")
52
+ credentials {
53
+ username = "viewer"
54
+ password = "viewer"
55
+ }
44
56
  isAllowInsecureProtocol = true
45
57
  }
46
58
  }