@momo-kits/native-kits 0.162.1-sp.1 → 0.162.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.
- package/build.gradle.kts +11 -0
- package/compose/build.gradle.kts +186 -0
- package/compose/build.gradle.kts.backup +186 -0
- package/compose/compose.podspec +47 -0
- package/compose/src/androidMain/kotlin/vn/momo/kits/navigation/ScrollToTop.android.kt +6 -0
- package/compose/src/androidMain/kotlin/vn/momo/kits/platform/Platform.android.kt +123 -0
- package/compose/src/commonMain/composeResources/font/momosignature.otf +0 -0
- package/compose/src/commonMain/composeResources/font/momotrustdisplay.otf +0 -0
- package/compose/src/commonMain/composeResources/font/sfprotext_black.otf +0 -0
- package/compose/src/commonMain/composeResources/font/sfprotext_black.ttf +0 -0
- package/compose/src/commonMain/composeResources/font/sfprotext_bold.ttf +0 -0
- package/compose/src/commonMain/composeResources/font/sfprotext_heavy.ttf +0 -0
- package/compose/src/commonMain/composeResources/font/sfprotext_light.ttf +0 -0
- package/compose/src/commonMain/composeResources/font/sfprotext_medium.ttf +0 -0
- package/compose/src/commonMain/composeResources/font/sfprotext_regular.ttf +0 -0
- package/compose/src/commonMain/composeResources/font/sfprotext_semibold.ttf +0 -0
- package/compose/src/commonMain/composeResources/font/sfprotext_thin.otf +0 -0
- package/compose/src/commonMain/composeResources/font/sfprotext_thin.ttf +0 -0
- package/compose/src/commonMain/composeResources/font/sfprotext_ultralight.otf +0 -0
- package/compose/src/commonMain/composeResources/font/sfprotext_ultralight.ttf +0 -0
- package/compose/src/commonMain/kotlin/vn/momo/kits/application/AnimationSearchInput.kt +57 -0
- package/compose/src/commonMain/kotlin/vn/momo/kits/application/Context.kt +117 -0
- package/compose/src/commonMain/kotlin/vn/momo/kits/application/FloatingButton.kt +201 -0
- package/compose/src/commonMain/kotlin/vn/momo/kits/application/Header.kt +222 -0
- package/compose/src/commonMain/kotlin/vn/momo/kits/application/HeaderAnimated.kt +48 -0
- package/compose/src/commonMain/kotlin/vn/momo/kits/application/HeaderBackground.kt +86 -0
- package/compose/src/commonMain/kotlin/vn/momo/kits/application/HeaderDefault.kt +76 -0
- package/compose/src/commonMain/kotlin/vn/momo/kits/application/HeaderExtended.kt +76 -0
- package/compose/src/commonMain/kotlin/vn/momo/kits/application/HeaderRight.kt +305 -0
- package/compose/src/commonMain/kotlin/vn/momo/kits/application/HeaderTitle.kt +33 -0
- package/compose/src/commonMain/kotlin/vn/momo/kits/application/LiteScreen.kt +921 -0
- package/compose/src/commonMain/kotlin/vn/momo/kits/application/NavigationContainer.kt +121 -0
- package/compose/src/commonMain/kotlin/vn/momo/kits/application/Screen.kt +403 -0
- package/compose/src/commonMain/kotlin/vn/momo/kits/application/useHeaderSearchAnimation.kt +69 -0
- package/compose/src/commonMain/kotlin/vn/momo/kits/components/Avatar.kt +157 -0
- package/compose/src/commonMain/kotlin/vn/momo/kits/components/Badge.kt +85 -0
- package/compose/src/commonMain/kotlin/vn/momo/kits/components/BadgeDot.kt +32 -0
- package/compose/src/commonMain/kotlin/vn/momo/kits/components/BadgeRibbon.kt +340 -0
- package/compose/src/commonMain/kotlin/vn/momo/kits/components/BaselineView.kt +198 -0
- package/compose/src/commonMain/kotlin/vn/momo/kits/components/Button.kt +357 -0
- package/compose/src/commonMain/kotlin/vn/momo/kits/components/Carousel.kt +123 -0
- package/compose/src/commonMain/kotlin/vn/momo/kits/components/CheckBox.kt +94 -0
- package/compose/src/commonMain/kotlin/vn/momo/kits/components/Chip.kt +136 -0
- package/compose/src/commonMain/kotlin/vn/momo/kits/components/Collapse.kt +224 -0
- package/compose/src/commonMain/kotlin/vn/momo/kits/components/CupertinoOverscroll.kt +543 -0
- package/compose/src/commonMain/kotlin/vn/momo/kits/components/Divider.kt +23 -0
- package/compose/src/commonMain/kotlin/vn/momo/kits/components/Icon.kt +76 -0
- package/compose/src/commonMain/kotlin/vn/momo/kits/components/IconButton.kt +148 -0
- package/compose/src/commonMain/kotlin/vn/momo/kits/components/Image.kt +188 -0
- package/compose/src/commonMain/kotlin/vn/momo/kits/components/Information.kt +116 -0
- package/compose/src/commonMain/kotlin/vn/momo/kits/components/Input.kt +452 -0
- package/compose/src/commonMain/kotlin/vn/momo/kits/components/InputDropDown.kt +172 -0
- package/compose/src/commonMain/kotlin/vn/momo/kits/components/InputMoney.kt +255 -0
- package/compose/src/commonMain/kotlin/vn/momo/kits/components/InputOTP.kt +235 -0
- package/compose/src/commonMain/kotlin/vn/momo/kits/components/InputPhoneNumber.kt +233 -0
- package/compose/src/commonMain/kotlin/vn/momo/kits/components/InputSearch.kt +259 -0
- package/compose/src/commonMain/kotlin/vn/momo/kits/components/InputTextArea.kt +241 -0
- package/compose/src/commonMain/kotlin/vn/momo/kits/components/LazyColumnWithBouncing.kt +364 -0
- package/compose/src/commonMain/kotlin/vn/momo/kits/components/Loader.kt +108 -0
- package/compose/src/commonMain/kotlin/vn/momo/kits/components/PaginationDot.kt +56 -0
- package/compose/src/commonMain/kotlin/vn/momo/kits/components/PaginationNumber.kt +41 -0
- package/compose/src/commonMain/kotlin/vn/momo/kits/components/PaginationScroll.kt +92 -0
- package/compose/src/commonMain/kotlin/vn/momo/kits/components/PaginationWhiteDot.kt +40 -0
- package/compose/src/commonMain/kotlin/vn/momo/kits/components/PopupNotify.kt +352 -0
- package/compose/src/commonMain/kotlin/vn/momo/kits/components/PopupPromotion.kt +103 -0
- package/compose/src/commonMain/kotlin/vn/momo/kits/components/ProgressInfo.kt +338 -0
- package/compose/src/commonMain/kotlin/vn/momo/kits/components/Radio.kt +70 -0
- package/compose/src/commonMain/kotlin/vn/momo/kits/components/Rating.kt +87 -0
- package/compose/src/commonMain/kotlin/vn/momo/kits/components/ScaleSizeScope.kt +23 -0
- package/compose/src/commonMain/kotlin/vn/momo/kits/components/Skeleton.kt +96 -0
- package/compose/src/commonMain/kotlin/vn/momo/kits/components/Slider.kt +348 -0
- package/compose/src/commonMain/kotlin/vn/momo/kits/components/Stepper.kt +256 -0
- package/compose/src/commonMain/kotlin/vn/momo/kits/components/Steps.kt +494 -0
- package/compose/src/commonMain/kotlin/vn/momo/kits/components/SuggestAction.kt +131 -0
- package/compose/src/commonMain/kotlin/vn/momo/kits/components/Swipe.kt +215 -0
- package/compose/src/commonMain/kotlin/vn/momo/kits/components/Switch.kt +96 -0
- package/compose/src/commonMain/kotlin/vn/momo/kits/components/TabView.kt +531 -0
- package/compose/src/commonMain/kotlin/vn/momo/kits/components/Tag.kt +92 -0
- package/compose/src/commonMain/kotlin/vn/momo/kits/components/Text.kt +135 -0
- package/compose/src/commonMain/kotlin/vn/momo/kits/components/Title.kt +214 -0
- package/compose/src/commonMain/kotlin/vn/momo/kits/components/Tooltip.kt +590 -0
- package/compose/src/commonMain/kotlin/vn/momo/kits/components/TrustBanner.kt +177 -0
- package/compose/src/commonMain/kotlin/vn/momo/kits/components/Uploader.kt +192 -0
- package/compose/src/commonMain/kotlin/vn/momo/kits/components/datetimepicker/DateTimePicker.kt +205 -0
- package/compose/src/commonMain/kotlin/vn/momo/kits/components/datetimepicker/DateTimePickerTypes.kt +29 -0
- package/compose/src/commonMain/kotlin/vn/momo/kits/components/datetimepicker/DateTimePickerUtils.kt +239 -0
- package/compose/src/commonMain/kotlin/vn/momo/kits/components/datetimepicker/WheelPicker.kt +191 -0
- package/compose/src/commonMain/kotlin/vn/momo/kits/const/Colors.kt +306 -0
- package/compose/src/commonMain/kotlin/vn/momo/kits/const/Radius.kt +12 -0
- package/compose/src/commonMain/kotlin/vn/momo/kits/const/Spacing.kt +16 -0
- package/compose/src/commonMain/kotlin/vn/momo/kits/const/Theme.kt +188 -0
- package/compose/src/commonMain/kotlin/vn/momo/kits/const/Typography.kt +295 -0
- package/compose/src/commonMain/kotlin/vn/momo/kits/layout/Card.kt +2 -0
- package/compose/src/commonMain/kotlin/vn/momo/kits/layout/Item.kt +35 -0
- package/compose/src/commonMain/kotlin/vn/momo/kits/layout/Section.kt +2 -0
- package/compose/src/commonMain/kotlin/vn/momo/kits/modifier/AutomationId.kt +57 -0
- package/compose/src/commonMain/kotlin/vn/momo/kits/modifier/Clickable.kt +68 -0
- package/compose/src/commonMain/kotlin/vn/momo/kits/modifier/Conditional.kt +11 -0
- package/compose/src/commonMain/kotlin/vn/momo/kits/modifier/DeprecatedModifier.kt +14 -0
- package/compose/src/commonMain/kotlin/vn/momo/kits/modifier/Shadow.kt +50 -0
- package/compose/src/commonMain/kotlin/vn/momo/kits/modifier/Size.kt +51 -0
- package/compose/src/commonMain/kotlin/vn/momo/kits/navigation/BottomSheet.kt +253 -0
- package/compose/src/commonMain/kotlin/vn/momo/kits/navigation/ModalScreen.kt +133 -0
- package/compose/src/commonMain/kotlin/vn/momo/kits/navigation/Navigation.kt +104 -0
- package/compose/src/commonMain/kotlin/vn/momo/kits/navigation/NavigationContainer.kt +147 -0
- package/compose/src/commonMain/kotlin/vn/momo/kits/navigation/Navigator.kt +345 -0
- package/compose/src/commonMain/kotlin/vn/momo/kits/navigation/ScrollToTop.kt +8 -0
- package/compose/src/commonMain/kotlin/vn/momo/kits/navigation/StackScreen.kt +556 -0
- package/compose/src/commonMain/kotlin/vn/momo/kits/navigation/bottomtab/BottomTab.kt +161 -0
- package/compose/src/commonMain/kotlin/vn/momo/kits/navigation/bottomtab/BottomTabBar.kt +243 -0
- package/compose/src/commonMain/kotlin/vn/momo/kits/navigation/bottomtab/CurvedContainer.kt +86 -0
- package/compose/src/commonMain/kotlin/vn/momo/kits/navigation/component/FloatingButton.kt +187 -0
- package/compose/src/commonMain/kotlin/vn/momo/kits/navigation/component/Header.kt +315 -0
- package/compose/src/commonMain/kotlin/vn/momo/kits/navigation/component/HeaderBackground.kt +80 -0
- package/compose/src/commonMain/kotlin/vn/momo/kits/navigation/component/HeaderRight.kt +306 -0
- package/compose/src/commonMain/kotlin/vn/momo/kits/navigation/component/HeaderTitle.kt +34 -0
- package/compose/src/commonMain/kotlin/vn/momo/kits/navigation/component/HeaderUser.kt +370 -0
- package/compose/src/commonMain/kotlin/vn/momo/kits/navigation/component/SnackBar.kt +131 -0
- package/compose/src/commonMain/kotlin/vn/momo/kits/navigation/tracking/ScreenTracker.kt +167 -0
- package/compose/src/commonMain/kotlin/vn/momo/kits/platform/ComposeLottieAnimation.kt +72 -0
- package/compose/src/commonMain/kotlin/vn/momo/kits/platform/Platform.kt +66 -0
- package/compose/src/commonMain/kotlin/vn/momo/kits/utils/Icons.kt +1329 -0
- package/compose/src/commonMain/kotlin/vn/momo/kits/utils/Resources.kt +70 -0
- package/compose/src/commonMain/kotlin/vn/momo/kits/utils/Tracking.kt +15 -0
- package/compose/src/commonMain/kotlin/vn/momo/kits/utils/Utils.kt +105 -0
- package/compose/src/iosMain/kotlin/vn/momo/kits/navigation/ScrollToTop.ios.kt +33 -0
- package/compose/src/iosMain/kotlin/vn/momo/kits/platform/Platform.ios.kt +186 -0
- package/example/ios/Example.xcodeproj/xcuserdata/sonnguyen.xcuserdatad/xcschemes/Example.xcscheme +32 -0
- package/example/ios/Example.xcodeproj/xcuserdata/sonnguyen.xcuserdatad/xcschemes/xcschememanagement.plist +14 -0
- package/example/ios/Example.xcworkspace/xcuserdata/sonnguyen.xcuserdatad/UserInterfaceState.xcuserstate +0 -0
- package/example/ios/Example.xcworkspace/xcuserdata/sonnguyen.xcuserdatad/WorkspaceSettings.xcsettings +16 -0
- package/example/ios/Example.xcworkspace/xcuserdata/sonnguyen.xcuserdatad/xcdebugger/Breakpoints_v2.xcbkptlist +6 -0
- package/example/ios/Example.xcworkspace/xcuserdata/sonnguyen.xcuserdatad/xcschemes/xcschememanagement.plist +5 -0
- package/example/ios/Pods/Pods.xcodeproj/xcuserdata/sonnguyen.xcuserdatad/xcschemes/MoMoUIKits.xcscheme +58 -0
- package/example/ios/Pods/Pods.xcodeproj/xcuserdata/sonnguyen.xcuserdatad/xcschemes/Pods-Example.xcscheme +58 -0
- package/example/ios/Pods/Pods.xcodeproj/xcuserdata/sonnguyen.xcuserdatad/xcschemes/SDWebImage.xcscheme +58 -0
- package/example/ios/Pods/Pods.xcodeproj/xcuserdata/sonnguyen.xcuserdatad/xcschemes/SDWebImageSwiftUI.xcscheme +58 -0
- package/example/ios/Pods/Pods.xcodeproj/xcuserdata/sonnguyen.xcuserdatad/xcschemes/SkeletonUI.xcscheme +58 -0
- package/example/ios/Pods/Pods.xcodeproj/xcuserdata/sonnguyen.xcuserdatad/xcschemes/lottie-ios-LottiePrivacyInfo.xcscheme +58 -0
- package/example/ios/Pods/Pods.xcodeproj/xcuserdata/sonnguyen.xcuserdatad/xcschemes/lottie-ios.xcscheme +58 -0
- package/example/ios/Pods/Pods.xcodeproj/xcuserdata/sonnguyen.xcuserdatad/xcschemes/xcschememanagement.plist +60 -0
- package/gradle/libs.versions.toml +67 -0
- package/gradle/wrapper/gradle-wrapper.jar +0 -0
- package/gradle/wrapper/gradle-wrapper.properties +8 -0
- package/gradle.properties +26 -0
- package/gradlew +252 -0
- package/gradlew.bat +94 -0
- package/ios/Typography/MomoFontScale.swift +36 -0
- package/ios/Typography/Text.swift +19 -9
- package/ios/Typography/Typography.swift +6 -22
- package/local.properties +8 -0
- package/package.json +1 -1
- package/settings.gradle.kts +64 -0
- package/.claude/settings.local.json +0 -35
- package/ios/Information/Information.swift +0 -151
package/gradlew.bat
ADDED
|
@@ -0,0 +1,94 @@
|
|
|
1
|
+
@rem
|
|
2
|
+
@rem Copyright 2015 the original author or authors.
|
|
3
|
+
@rem
|
|
4
|
+
@rem Licensed under the Apache License, Version 2.0 (the "License");
|
|
5
|
+
@rem you may not use this file except in compliance with the License.
|
|
6
|
+
@rem You may obtain a copy of the License at
|
|
7
|
+
@rem
|
|
8
|
+
@rem https://www.apache.org/licenses/LICENSE-2.0
|
|
9
|
+
@rem
|
|
10
|
+
@rem Unless required by applicable law or agreed to in writing, software
|
|
11
|
+
@rem distributed under the License is distributed on an "AS IS" BASIS,
|
|
12
|
+
@rem WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
|
|
13
|
+
@rem See the License for the specific language governing permissions and
|
|
14
|
+
@rem limitations under the License.
|
|
15
|
+
@rem
|
|
16
|
+
@rem SPDX-License-Identifier: Apache-2.0
|
|
17
|
+
@rem
|
|
18
|
+
|
|
19
|
+
@if "%DEBUG%"=="" @echo off
|
|
20
|
+
@rem ##########################################################################
|
|
21
|
+
@rem
|
|
22
|
+
@rem Gradle startup script for Windows
|
|
23
|
+
@rem
|
|
24
|
+
@rem ##########################################################################
|
|
25
|
+
|
|
26
|
+
@rem Set local scope for the variables with windows NT shell
|
|
27
|
+
if "%OS%"=="Windows_NT" setlocal
|
|
28
|
+
|
|
29
|
+
set DIRNAME=%~dp0
|
|
30
|
+
if "%DIRNAME%"=="" set DIRNAME=.
|
|
31
|
+
@rem This is normally unused
|
|
32
|
+
set APP_BASE_NAME=%~n0
|
|
33
|
+
set APP_HOME=%DIRNAME%
|
|
34
|
+
|
|
35
|
+
@rem Resolve any "." and ".." in APP_HOME to make it shorter.
|
|
36
|
+
for %%i in ("%APP_HOME%") do set APP_HOME=%%~fi
|
|
37
|
+
|
|
38
|
+
@rem Add default JVM options here. You can also use JAVA_OPTS and GRADLE_OPTS to pass JVM options to this script.
|
|
39
|
+
set DEFAULT_JVM_OPTS="-Xmx64m" "-Xms64m"
|
|
40
|
+
|
|
41
|
+
@rem Find java.exe
|
|
42
|
+
if defined JAVA_HOME goto findJavaFromJavaHome
|
|
43
|
+
|
|
44
|
+
set JAVA_EXE=java.exe
|
|
45
|
+
%JAVA_EXE% -version >NUL 2>&1
|
|
46
|
+
if %ERRORLEVEL% equ 0 goto execute
|
|
47
|
+
|
|
48
|
+
echo. 1>&2
|
|
49
|
+
echo ERROR: JAVA_HOME is not set and no 'java' command could be found in your PATH. 1>&2
|
|
50
|
+
echo. 1>&2
|
|
51
|
+
echo Please set the JAVA_HOME variable in your environment to match the 1>&2
|
|
52
|
+
echo location of your Java installation. 1>&2
|
|
53
|
+
|
|
54
|
+
goto fail
|
|
55
|
+
|
|
56
|
+
:findJavaFromJavaHome
|
|
57
|
+
set JAVA_HOME=%JAVA_HOME:"=%
|
|
58
|
+
set JAVA_EXE=%JAVA_HOME%/bin/java.exe
|
|
59
|
+
|
|
60
|
+
if exist "%JAVA_EXE%" goto execute
|
|
61
|
+
|
|
62
|
+
echo. 1>&2
|
|
63
|
+
echo ERROR: JAVA_HOME is set to an invalid directory: %JAVA_HOME% 1>&2
|
|
64
|
+
echo. 1>&2
|
|
65
|
+
echo Please set the JAVA_HOME variable in your environment to match the 1>&2
|
|
66
|
+
echo location of your Java installation. 1>&2
|
|
67
|
+
|
|
68
|
+
goto fail
|
|
69
|
+
|
|
70
|
+
:execute
|
|
71
|
+
@rem Setup the command line
|
|
72
|
+
|
|
73
|
+
set CLASSPATH=%APP_HOME%\gradle\wrapper\gradle-wrapper.jar
|
|
74
|
+
|
|
75
|
+
|
|
76
|
+
@rem Execute Gradle
|
|
77
|
+
"%JAVA_EXE%" %DEFAULT_JVM_OPTS% %JAVA_OPTS% %GRADLE_OPTS% "-Dorg.gradle.appname=%APP_BASE_NAME%" -classpath "%CLASSPATH%" org.gradle.wrapper.GradleWrapperMain %*
|
|
78
|
+
|
|
79
|
+
:end
|
|
80
|
+
@rem End local scope for the variables with windows NT shell
|
|
81
|
+
if %ERRORLEVEL% equ 0 goto mainEnd
|
|
82
|
+
|
|
83
|
+
:fail
|
|
84
|
+
rem Set variable GRADLE_EXIT_CONSOLE if you need the _script_ return code instead of
|
|
85
|
+
rem the _cmd.exe /c_ return code!
|
|
86
|
+
set EXIT_CODE=%ERRORLEVEL%
|
|
87
|
+
if %EXIT_CODE% equ 0 set EXIT_CODE=1
|
|
88
|
+
if not ""=="%GRADLE_EXIT_CONSOLE%" exit %EXIT_CODE%
|
|
89
|
+
exit /b %EXIT_CODE%
|
|
90
|
+
|
|
91
|
+
:mainEnd
|
|
92
|
+
if "%OS%"=="Windows_NT" endlocal
|
|
93
|
+
|
|
94
|
+
:omega
|
|
@@ -0,0 +1,36 @@
|
|
|
1
|
+
import SwiftUI
|
|
2
|
+
|
|
3
|
+
/// Process-wide holder for the user's in-app font-size preference.
|
|
4
|
+
///
|
|
5
|
+
/// `momo-native-kits` is a UI library; it does not read persistent storage
|
|
6
|
+
/// itself. The host app (momo-app) reads the persisted setting from the shared
|
|
7
|
+
/// Observable Storage and pushes it here at launch and on every change via
|
|
8
|
+
/// `update(followOSScale:ratio:)`. All native typography (`scaleSize`,
|
|
9
|
+
/// `Font.appFont`, `MomoText`) reads from this single source so the three
|
|
10
|
+
/// render stacks (RN / Compose / SwiftUI) stay in sync.
|
|
11
|
+
///
|
|
12
|
+
/// Live update: `MomoText` observes this object, so changing the setting
|
|
13
|
+
/// re-renders typed text immediately. Views built from the `Font.appFont`
|
|
14
|
+
/// static constants pick up the value at launch (static `let` is evaluated
|
|
15
|
+
/// once); making those live would require turning them into functions.
|
|
16
|
+
public final class MomoFontScale: ObservableObject {
|
|
17
|
+
public static let shared = MomoFontScale()
|
|
18
|
+
|
|
19
|
+
/// When true, follow the OS font scale (capped). `ratio` is ignored.
|
|
20
|
+
@Published public private(set) var followOSScale: Bool = false
|
|
21
|
+
|
|
22
|
+
/// In-app font-size ratio (e.g. 1.0 / 1.1 / 1.2). Ignored when
|
|
23
|
+
/// `followOSScale` is true.
|
|
24
|
+
@Published public private(set) var ratio: CGFloat = 1
|
|
25
|
+
|
|
26
|
+
private init() {}
|
|
27
|
+
|
|
28
|
+
public func update(followOSScale: Bool, ratio: CGFloat) {
|
|
29
|
+
if self.followOSScale != followOSScale {
|
|
30
|
+
self.followOSScale = followOSScale
|
|
31
|
+
}
|
|
32
|
+
if self.ratio != ratio {
|
|
33
|
+
self.ratio = ratio
|
|
34
|
+
}
|
|
35
|
+
}
|
|
36
|
+
}
|
|
@@ -8,23 +8,30 @@ public func scaleSize(_ size: CGFloat, _ scaleRate: CGFloat? = nil) -> CGFloat {
|
|
|
8
8
|
let deviceWidth = UIScreen.main.bounds.width
|
|
9
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
|
|
14
|
-
|
|
15
11
|
var fontSizeDeviceScale = size
|
|
16
|
-
var
|
|
17
|
-
|
|
12
|
+
var fontSizeUserScale = size
|
|
18
13
|
|
|
19
14
|
if deviceScale > 1 {
|
|
20
15
|
fontSizeDeviceScale = min(fontSizeDeviceScale * deviceScale, fontSizeDeviceScale + maxDeviceScale)
|
|
21
16
|
}
|
|
22
17
|
|
|
23
|
-
if
|
|
24
|
-
|
|
18
|
+
if MomoFontScale.shared.followOSScale {
|
|
19
|
+
// Follow OS font scale (capped). User ratio is ignored in this mode.
|
|
20
|
+
let defaultFont = UIFont.systemFont(ofSize: UIFont.labelFontSize)
|
|
21
|
+
let scaledFont = UIFontMetrics.default.scaledFont(for: defaultFont)
|
|
22
|
+
let fontScale = scaledFont.pointSize / defaultFont.pointSize
|
|
23
|
+
if fontScale > 1 {
|
|
24
|
+
fontSizeUserScale = min(fontSizeUserScale * fontScale, fontSizeUserScale * maxFontScale)
|
|
25
|
+
}
|
|
26
|
+
} else {
|
|
27
|
+
// Custom in-app ratio. OS font scale is ignored.
|
|
28
|
+
let ratio = MomoFontScale.shared.ratio
|
|
29
|
+
if ratio > 1 {
|
|
30
|
+
fontSizeUserScale = fontSizeUserScale * ratio
|
|
31
|
+
}
|
|
25
32
|
}
|
|
26
33
|
|
|
27
|
-
return max(fontSizeDeviceScale,
|
|
34
|
+
return max(fontSizeDeviceScale, fontSizeUserScale)
|
|
28
35
|
}
|
|
29
36
|
|
|
30
37
|
public enum TypographyStyle {
|
|
@@ -118,6 +125,9 @@ public struct MomoText: View {
|
|
|
118
125
|
private let content: String
|
|
119
126
|
private let typography: TypographyStyle
|
|
120
127
|
private let color: Color
|
|
128
|
+
// Observe so the text re-renders immediately when the user changes the
|
|
129
|
+
// font-size setting (live update, no app restart).
|
|
130
|
+
@ObservedObject private var fontScale = MomoFontScale.shared
|
|
121
131
|
|
|
122
132
|
public init(
|
|
123
133
|
_ content: String,
|
|
@@ -1,29 +1,13 @@
|
|
|
1
1
|
import SwiftUI
|
|
2
2
|
|
|
3
3
|
public extension Font {
|
|
4
|
+
// Shares the same scaling logic as `scaleSize` so it honors the user's
|
|
5
|
+
// font-size preference (follow-OS vs in-app ratio).
|
|
6
|
+
// NOTE: the `static let` constants below are evaluated once on first
|
|
7
|
+
// access, so they reflect the setting at launch but do not live-update.
|
|
8
|
+
// Components that need live updates should use `MomoText` / `scaleSize`.
|
|
4
9
|
static func appFont(size: CGFloat) -> Font {
|
|
5
|
-
|
|
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)
|
|
10
|
+
return Font.system(size: scaleSize(size))
|
|
27
11
|
}
|
|
28
12
|
|
|
29
13
|
// New supported typography styles
|
package/local.properties
ADDED
|
@@ -0,0 +1,8 @@
|
|
|
1
|
+
## This file must *NOT* be checked into Version Control Systems,
|
|
2
|
+
# as it contains information specific to your local configuration.
|
|
3
|
+
#
|
|
4
|
+
# Location of the SDK. This is only used by Gradle.
|
|
5
|
+
# For customization when using a Version Control System, please read the
|
|
6
|
+
# header note.
|
|
7
|
+
#Tue Apr 08 11:13:31 ICT 2025
|
|
8
|
+
sdk.dir=/Users/sonnguyen/Library/Android/sdk
|
package/package.json
CHANGED
|
@@ -0,0 +1,64 @@
|
|
|
1
|
+
import org.gradle.kotlin.dsl.maven
|
|
2
|
+
|
|
3
|
+
rootProject.name = "momo-native-kits"
|
|
4
|
+
enableFeaturePreview("TYPESAFE_PROJECT_ACCESSORS")
|
|
5
|
+
|
|
6
|
+
pluginManagement {
|
|
7
|
+
repositories {
|
|
8
|
+
google {
|
|
9
|
+
mavenContent {
|
|
10
|
+
includeGroupAndSubgroups("androidx")
|
|
11
|
+
includeGroupAndSubgroups("com.android")
|
|
12
|
+
includeGroupAndSubgroups("com.google")
|
|
13
|
+
}
|
|
14
|
+
}
|
|
15
|
+
mavenCentral()
|
|
16
|
+
gradlePluginPortal()
|
|
17
|
+
maven {
|
|
18
|
+
url = uri("https://gitlab.mservice.com.vn/api/v4/projects/5400/packages/maven")
|
|
19
|
+
credentials {username = "download_packages"; password = "gldt-bjDqLpU_sPcHDuXau2ws" }
|
|
20
|
+
}
|
|
21
|
+
maven {
|
|
22
|
+
url = uri("https://artifacts.mservice.com.vn/repository/maven-momo-app/")
|
|
23
|
+
credentials {
|
|
24
|
+
username = "viewer"
|
|
25
|
+
password = "viewer"
|
|
26
|
+
}
|
|
27
|
+
isAllowInsecureProtocol = true
|
|
28
|
+
}
|
|
29
|
+
}
|
|
30
|
+
}
|
|
31
|
+
|
|
32
|
+
dependencyResolutionManagement {
|
|
33
|
+
repositories {
|
|
34
|
+
google {
|
|
35
|
+
mavenContent {
|
|
36
|
+
includeGroupAndSubgroups("androidx")
|
|
37
|
+
includeGroupAndSubgroups("com.android")
|
|
38
|
+
includeGroupAndSubgroups("com.google")
|
|
39
|
+
}
|
|
40
|
+
}
|
|
41
|
+
mavenCentral()
|
|
42
|
+
maven { url = uri("https://maven.pkg.jetbrains.space/public/p/compose/dev") }
|
|
43
|
+
maven {
|
|
44
|
+
url = uri("https://gitlab.mservice.com.vn/api/v4/projects/5400/packages/maven")
|
|
45
|
+
credentials {
|
|
46
|
+
username = "download_packages";
|
|
47
|
+
password = "gldt-bjDqLpU_sPcHDuXau2ws"
|
|
48
|
+
}
|
|
49
|
+
}
|
|
50
|
+
maven {
|
|
51
|
+
url = uri("https://artifacts.mservice.com.vn/repository/maven-momo-app/")
|
|
52
|
+
credentials {
|
|
53
|
+
username = "viewer"
|
|
54
|
+
password = "viewer"
|
|
55
|
+
}
|
|
56
|
+
isAllowInsecureProtocol = true
|
|
57
|
+
}
|
|
58
|
+
}
|
|
59
|
+
}
|
|
60
|
+
|
|
61
|
+
include(":compose")
|
|
62
|
+
|
|
63
|
+
include(":sample:androidApp")
|
|
64
|
+
include(":sample:shared")
|
|
@@ -1,35 +0,0 @@
|
|
|
1
|
-
{
|
|
2
|
-
"permissions": {
|
|
3
|
-
"allow": [
|
|
4
|
-
"Bash(curl -s -o /dev/null -w \"%{http_code}\" \"https://repo.maven.apache.org/maven2/org/jetbrains/skiko/skiko-android/0.144.6/skiko-android-0.144.6.pom\")",
|
|
5
|
-
"Bash(curl -s \"https://repo.maven.apache.org/maven2/org/jetbrains/skiko/skiko-android/maven-metadata.xml\")",
|
|
6
|
-
"Bash(curl -s \"https://repo.maven.apache.org/maven2/org/jetbrains/skiko/skiko/maven-metadata.xml\")",
|
|
7
|
-
"Bash(curl -s \"https://repo.maven.apache.org/maven2/org/jetbrains/skiko/skiko/0.144.6/skiko-0.144.6.module\")",
|
|
8
|
-
"Bash(curl -s -o /dev/null -w '%{http_code}' https://repo.maven.apache.org/maven2/org/jetbrains/skiko/skiko-android/0.144.6/skiko-android-0.144.6.__TRACKED_VAR__)",
|
|
9
|
-
"Bash(curl -s \"https://repo.maven.apache.org/maven2/org/jetbrains/skiko/skiko-android/0.144.6/\")",
|
|
10
|
-
"Bash(curl -s \"https://repo.maven.apache.org/maven2/org/jetbrains/skiko/skiko-android/\")",
|
|
11
|
-
"Bash(curl -s -o /dev/null -w \"%{http_code}\\\\n\" \"https://repo.maven.apache.org/maven2/org/jetbrains/skiko/skiko-android/0.148.1/skiko-android-0.148.1.pom\")",
|
|
12
|
-
"Bash(curl -s -o /dev/null -w \"%{http_code}\\\\n\" \"https://repo.maven.apache.org/maven2/org/jetbrains/skiko/skiko-android/0.144.5/skiko-android-0.144.5.pom\")",
|
|
13
|
-
"Bash(curl -s -o /dev/null -w \"%{http_code}\\\\n\" \"https://dl.google.com/dl/android/maven2/org/jetbrains/skiko/skiko-android/0.144.6/skiko-android-0.144.6.pom\")",
|
|
14
|
-
"Bash(curl -s \"https://search.maven.org/solrsearch/select?q=a:skiko-android&rows=5&wt=json\")",
|
|
15
|
-
"Bash(curl -sL -o /dev/null -w \"%{http_code} %{url_effective}\\\\n\" \"https://repo1.maven.org/maven2/org/jetbrains/skiko/skiko-android/0.144.6/skiko-android-0.144.6.pom\")",
|
|
16
|
-
"Bash(curl *)",
|
|
17
|
-
"Bash(./gradlew :sample:androidApp:dependencies --configuration debugRuntimeClasspath)",
|
|
18
|
-
"Bash(./gradlew :sample:shared:compileDebugKotlinAndroid)",
|
|
19
|
-
"Bash(./gradlew :sample:androidApp:compileDebugKotlin)",
|
|
20
|
-
"Bash(ls -d *.xcodeproj)",
|
|
21
|
-
"Bash(grep -c ChipDemo.swift __TRACKED_VAR__/project.pbxproj)",
|
|
22
|
-
"Bash(grep -c PBXFileSystemSynchronizedRootGroup __TRACKED_VAR__/project.pbxproj)",
|
|
23
|
-
"Bash(grep -c InformationDemo.swift __TRACKED_VAR__/project.pbxproj)",
|
|
24
|
-
"Bash(plutil -lint project.pbxproj)",
|
|
25
|
-
"Bash(xcode-select -p)",
|
|
26
|
-
"Bash(/usr/bin/xcrun xcodebuild *)",
|
|
27
|
-
"Bash(echo \"exit: $?\")",
|
|
28
|
-
"Bash(/Applications/Xcode26.app/Contents/Developer/usr/bin/xcodebuild -version)",
|
|
29
|
-
"Bash(./gradlew :compose:tasks --all)",
|
|
30
|
-
"Bash(grep -n \"vanniktech\\\\|mavenPublishing\\\\|^publishing\\\\|version = gitlabVersion\\\\|namespace =\\\\|compileSdk =\\\\|minSdk =\\\\|GitLabPackages\\\\|name = \\\\\"\\\\${gitlabRepo}Packages\\\\\"\")",
|
|
31
|
-
"Bash(git checkout *)",
|
|
32
|
-
"Bash(./gradlew :compose:publishAllPublicationsToGitLabPackagesRepository --dry-run)"
|
|
33
|
-
]
|
|
34
|
-
}
|
|
35
|
-
}
|
|
@@ -1,151 +0,0 @@
|
|
|
1
|
-
import SwiftUI
|
|
2
|
-
|
|
3
|
-
public enum InformationState {
|
|
4
|
-
case `default`
|
|
5
|
-
case warning
|
|
6
|
-
case error
|
|
7
|
-
}
|
|
8
|
-
|
|
9
|
-
public struct Information: View {
|
|
10
|
-
private let title: String?
|
|
11
|
-
private let description: String
|
|
12
|
-
private let state: InformationState
|
|
13
|
-
private let image: String?
|
|
14
|
-
private let onPressAction: (() -> Void)?
|
|
15
|
-
private let showIcon: Bool
|
|
16
|
-
private let action: String?
|
|
17
|
-
private let showIconClose: Bool
|
|
18
|
-
private let onPressClose: (() -> Void)?
|
|
19
|
-
|
|
20
|
-
public init(
|
|
21
|
-
title: String? = nil,
|
|
22
|
-
description: String = "Description",
|
|
23
|
-
state: InformationState = .default,
|
|
24
|
-
image: String? = nil,
|
|
25
|
-
onPressAction: (() -> Void)? = nil,
|
|
26
|
-
showIcon: Bool = true,
|
|
27
|
-
action: String? = nil,
|
|
28
|
-
showIconClose: Bool = true,
|
|
29
|
-
onPressClose: (() -> Void)? = nil
|
|
30
|
-
) {
|
|
31
|
-
self.title = title
|
|
32
|
-
self.description = description
|
|
33
|
-
self.state = state
|
|
34
|
-
self.image = image
|
|
35
|
-
self.onPressAction = onPressAction
|
|
36
|
-
self.showIcon = showIcon
|
|
37
|
-
self.action = action
|
|
38
|
-
self.showIconClose = showIconClose
|
|
39
|
-
self.onPressClose = onPressClose
|
|
40
|
-
}
|
|
41
|
-
|
|
42
|
-
private var borderColor: Color {
|
|
43
|
-
switch state {
|
|
44
|
-
case .default: return Colors.blue07
|
|
45
|
-
case .warning: return Colors.yellow06
|
|
46
|
-
case .error: return Colors.red07
|
|
47
|
-
}
|
|
48
|
-
}
|
|
49
|
-
|
|
50
|
-
private var backgroundColor: Color {
|
|
51
|
-
switch state {
|
|
52
|
-
case .default: return Colors.blue10
|
|
53
|
-
case .warning: return Colors.yellow09
|
|
54
|
-
case .error: return Colors.red10
|
|
55
|
-
}
|
|
56
|
-
}
|
|
57
|
-
|
|
58
|
-
private var accentColor: Color {
|
|
59
|
-
switch state {
|
|
60
|
-
case .default: return Colors.blue03
|
|
61
|
-
case .warning: return Colors.orange03
|
|
62
|
-
case .error: return Colors.red03
|
|
63
|
-
}
|
|
64
|
-
}
|
|
65
|
-
|
|
66
|
-
private var iconSource: String {
|
|
67
|
-
switch state {
|
|
68
|
-
case .default: return "notifications_info"
|
|
69
|
-
case .warning: return "24_notifications_alert_triangle"
|
|
70
|
-
case .error: return "24_notifications_alert_octagon"
|
|
71
|
-
}
|
|
72
|
-
}
|
|
73
|
-
|
|
74
|
-
public var body: some View {
|
|
75
|
-
VStack(alignment: .leading, spacing: 0) {
|
|
76
|
-
HStack(alignment: .top, spacing: 0) {
|
|
77
|
-
if let image {
|
|
78
|
-
ImageView(image)
|
|
79
|
-
.frame(width: 40, height: 40)
|
|
80
|
-
.clipShape(RoundedRectangle(cornerRadius: Radius.S))
|
|
81
|
-
.padding(.trailing, Spacing.S)
|
|
82
|
-
} else if showIcon {
|
|
83
|
-
Icon(source: iconSource, size: 16, color: accentColor)
|
|
84
|
-
.padding(.trailing, Spacing.S)
|
|
85
|
-
}
|
|
86
|
-
|
|
87
|
-
VStack(alignment: .leading, spacing: 0) {
|
|
88
|
-
if let title {
|
|
89
|
-
MomoText(title, typography: .labelDefaultMedium)
|
|
90
|
-
}
|
|
91
|
-
MomoText(description, typography: .descriptionDefaultRegular)
|
|
92
|
-
}
|
|
93
|
-
.frame(maxWidth: .infinity, alignment: .leading)
|
|
94
|
-
|
|
95
|
-
if let onPressClose, showIconClose {
|
|
96
|
-
Icon(source: "navigation_close", size: 16, color: Colors.black17)
|
|
97
|
-
.contentShape(Rectangle())
|
|
98
|
-
.onTapGesture(perform: onPressClose)
|
|
99
|
-
}
|
|
100
|
-
}
|
|
101
|
-
|
|
102
|
-
if let action, let onPressAction {
|
|
103
|
-
MomoText(action, typography: .actionXsBold, color: accentColor)
|
|
104
|
-
.frame(maxWidth: .infinity, alignment: .trailing)
|
|
105
|
-
.contentShape(Rectangle())
|
|
106
|
-
.onTapGesture(perform: onPressAction)
|
|
107
|
-
.padding(.top, Spacing.S)
|
|
108
|
-
}
|
|
109
|
-
}
|
|
110
|
-
.padding(Spacing.M)
|
|
111
|
-
.background(
|
|
112
|
-
RoundedRectangle(cornerRadius: Radius.S)
|
|
113
|
-
.fill(backgroundColor)
|
|
114
|
-
)
|
|
115
|
-
.overlay(
|
|
116
|
-
RoundedRectangle(cornerRadius: Radius.S)
|
|
117
|
-
.stroke(borderColor, lineWidth: 0.5)
|
|
118
|
-
)
|
|
119
|
-
}
|
|
120
|
-
}
|
|
121
|
-
|
|
122
|
-
// MARK: - Preview
|
|
123
|
-
#if DEBUG
|
|
124
|
-
struct Information_Previews: PreviewProvider {
|
|
125
|
-
static var previews: some View {
|
|
126
|
-
VStack(spacing: 16) {
|
|
127
|
-
Information(
|
|
128
|
-
title: "Information",
|
|
129
|
-
description: "This is a default information message."
|
|
130
|
-
)
|
|
131
|
-
Information(
|
|
132
|
-
title: "Warning",
|
|
133
|
-
description: "This is a warning message.",
|
|
134
|
-
state: .warning
|
|
135
|
-
)
|
|
136
|
-
Information(
|
|
137
|
-
title: "Error",
|
|
138
|
-
description: "This is an error message.",
|
|
139
|
-
state: .error,
|
|
140
|
-
onPressAction: {}, action: "Retry"
|
|
141
|
-
)
|
|
142
|
-
Information(
|
|
143
|
-
description: "Dismissible information.",
|
|
144
|
-
onPressClose: {}
|
|
145
|
-
)
|
|
146
|
-
}
|
|
147
|
-
.padding()
|
|
148
|
-
.previewLayout(.sizeThatFits)
|
|
149
|
-
}
|
|
150
|
-
}
|
|
151
|
-
#endif
|