@momo-kits/native-kits 0.152.4-beta.6 → 0.152.4-maxapi

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 (155) hide show
  1. package/CODE_OF_CONDUCT.md +133 -0
  2. package/CONTRIBUTING.md +114 -0
  3. package/LICENSE +20 -0
  4. package/README.md +7 -0
  5. package/build.gradle.kts +32 -0
  6. package/compose/MoMoComposeKits.podspec +54 -0
  7. package/compose/build.gradle.kts +149 -0
  8. package/compose/src/androidMain/AndroidManifest.xml +2 -0
  9. package/compose/src/androidMain/kotlin/vn/momo/kits/platform/Platform.android.kt +105 -0
  10. package/compose/src/commonMain/composeResources/files/lottie_circle_loader.json +1 -0
  11. package/compose/src/commonMain/composeResources/font/momosignature.otf +0 -0
  12. package/compose/src/commonMain/composeResources/font/momotrustdisplay.otf +0 -0
  13. package/compose/src/commonMain/composeResources/font/sfprotext_black.otf +0 -0
  14. package/compose/src/commonMain/composeResources/font/sfprotext_black.ttf +0 -0
  15. package/compose/src/commonMain/composeResources/font/sfprotext_bold.ttf +0 -0
  16. package/compose/src/commonMain/composeResources/font/sfprotext_heavy.ttf +0 -0
  17. package/compose/src/commonMain/composeResources/font/sfprotext_light.ttf +0 -0
  18. package/compose/src/commonMain/composeResources/font/sfprotext_medium.ttf +0 -0
  19. package/compose/src/commonMain/composeResources/font/sfprotext_regular.ttf +0 -0
  20. package/compose/src/commonMain/composeResources/font/sfprotext_semibold.ttf +0 -0
  21. package/compose/src/commonMain/composeResources/font/sfprotext_thin.otf +0 -0
  22. package/compose/src/commonMain/composeResources/font/sfprotext_thin.ttf +0 -0
  23. package/compose/src/commonMain/composeResources/font/sfprotext_ultralight.otf +0 -0
  24. package/compose/src/commonMain/composeResources/font/sfprotext_ultralight.ttf +0 -0
  25. package/compose/src/commonMain/kotlin/vn/momo/kits/application/AnimationSearchInput.kt +57 -0
  26. package/compose/src/commonMain/kotlin/vn/momo/kits/application/FloatingButton.kt +201 -0
  27. package/compose/src/commonMain/kotlin/vn/momo/kits/application/Header.kt +222 -0
  28. package/compose/src/commonMain/kotlin/vn/momo/kits/application/HeaderAnimated.kt +48 -0
  29. package/compose/src/commonMain/kotlin/vn/momo/kits/application/HeaderBackground.kt +86 -0
  30. package/compose/src/commonMain/kotlin/vn/momo/kits/application/HeaderDefault.kt +76 -0
  31. package/compose/src/commonMain/kotlin/vn/momo/kits/application/HeaderExtended.kt +76 -0
  32. package/compose/src/commonMain/kotlin/vn/momo/kits/application/HeaderRight.kt +306 -0
  33. package/compose/src/commonMain/kotlin/vn/momo/kits/application/HeaderTitle.kt +33 -0
  34. package/compose/src/commonMain/kotlin/vn/momo/kits/application/LiteScreen.kt +715 -0
  35. package/compose/src/commonMain/kotlin/vn/momo/kits/application/NavigationContainer.kt +214 -0
  36. package/compose/src/commonMain/kotlin/vn/momo/kits/application/Screen.kt +236 -0
  37. package/compose/src/commonMain/kotlin/vn/momo/kits/application/useHeaderSearchAnimation.kt +69 -0
  38. package/compose/src/commonMain/kotlin/vn/momo/kits/components/Badge.kt +77 -0
  39. package/compose/src/commonMain/kotlin/vn/momo/kits/components/BadgeDot.kt +27 -0
  40. package/compose/src/commonMain/kotlin/vn/momo/kits/components/BadgeRibbon.kt +334 -0
  41. package/compose/src/commonMain/kotlin/vn/momo/kits/components/Button.kt +345 -0
  42. package/compose/src/commonMain/kotlin/vn/momo/kits/components/CheckBox.kt +90 -0
  43. package/compose/src/commonMain/kotlin/vn/momo/kits/components/Chip.kt +131 -0
  44. package/compose/src/commonMain/kotlin/vn/momo/kits/components/CupertinoOverscroll.kt +543 -0
  45. package/compose/src/commonMain/kotlin/vn/momo/kits/components/Divider.kt +23 -0
  46. package/compose/src/commonMain/kotlin/vn/momo/kits/components/Icon.kt +58 -0
  47. package/compose/src/commonMain/kotlin/vn/momo/kits/components/IconButton.kt +143 -0
  48. package/compose/src/commonMain/kotlin/vn/momo/kits/components/Image.kt +179 -0
  49. package/compose/src/commonMain/kotlin/vn/momo/kits/components/Information.kt +111 -0
  50. package/compose/src/commonMain/kotlin/vn/momo/kits/components/Input.kt +384 -0
  51. package/compose/src/commonMain/kotlin/vn/momo/kits/components/InputDropDown.kt +160 -0
  52. package/compose/src/commonMain/kotlin/vn/momo/kits/components/InputMoney.kt +234 -0
  53. package/compose/src/commonMain/kotlin/vn/momo/kits/components/InputOTP.kt +223 -0
  54. package/compose/src/commonMain/kotlin/vn/momo/kits/components/InputPhoneNumber.kt +232 -0
  55. package/compose/src/commonMain/kotlin/vn/momo/kits/components/InputSearch.kt +236 -0
  56. package/compose/src/commonMain/kotlin/vn/momo/kits/components/InputTextArea.kt +228 -0
  57. package/compose/src/commonMain/kotlin/vn/momo/kits/components/LazyColumnWithBouncing.kt +364 -0
  58. package/compose/src/commonMain/kotlin/vn/momo/kits/components/PaginationDot.kt +50 -0
  59. package/compose/src/commonMain/kotlin/vn/momo/kits/components/PaginationNumber.kt +34 -0
  60. package/compose/src/commonMain/kotlin/vn/momo/kits/components/PaginationScroll.kt +85 -0
  61. package/compose/src/commonMain/kotlin/vn/momo/kits/components/PaginationWhiteDot.kt +33 -0
  62. package/compose/src/commonMain/kotlin/vn/momo/kits/components/PopupNotify.kt +338 -0
  63. package/compose/src/commonMain/kotlin/vn/momo/kits/components/PopupPromotion.kt +95 -0
  64. package/compose/src/commonMain/kotlin/vn/momo/kits/components/Radio.kt +64 -0
  65. package/compose/src/commonMain/kotlin/vn/momo/kits/components/Skeleton.kt +89 -0
  66. package/compose/src/commonMain/kotlin/vn/momo/kits/components/Switch.kt +91 -0
  67. package/compose/src/commonMain/kotlin/vn/momo/kits/components/Tag.kt +86 -0
  68. package/compose/src/commonMain/kotlin/vn/momo/kits/components/Text.kt +84 -0
  69. package/compose/src/commonMain/kotlin/vn/momo/kits/components/Title.kt +208 -0
  70. package/compose/src/commonMain/kotlin/vn/momo/kits/components/TrustBanner.kt +172 -0
  71. package/compose/src/commonMain/kotlin/vn/momo/kits/components/datetimepicker/DateTimePicker.kt +199 -0
  72. package/compose/src/commonMain/kotlin/vn/momo/kits/components/datetimepicker/DateTimePickerTypes.kt +29 -0
  73. package/compose/src/commonMain/kotlin/vn/momo/kits/components/datetimepicker/DateTimePickerUtils.kt +237 -0
  74. package/compose/src/commonMain/kotlin/vn/momo/kits/components/datetimepicker/WheelPicker.kt +191 -0
  75. package/compose/src/commonMain/kotlin/vn/momo/kits/const/Colors.kt +306 -0
  76. package/compose/src/commonMain/kotlin/vn/momo/kits/const/Radius.kt +12 -0
  77. package/compose/src/commonMain/kotlin/vn/momo/kits/const/Spacing.kt +13 -0
  78. package/compose/src/commonMain/kotlin/vn/momo/kits/const/Theme.kt +191 -0
  79. package/compose/src/commonMain/kotlin/vn/momo/kits/const/Typography.kt +258 -0
  80. package/compose/src/commonMain/kotlin/vn/momo/kits/layout/Card.kt +2 -0
  81. package/compose/src/commonMain/kotlin/vn/momo/kits/layout/Item.kt +35 -0
  82. package/compose/src/commonMain/kotlin/vn/momo/kits/layout/Section.kt +2 -0
  83. package/compose/src/commonMain/kotlin/vn/momo/kits/modifier/AutomationId.kt +59 -0
  84. package/compose/src/commonMain/kotlin/vn/momo/kits/modifier/Clickable.kt +68 -0
  85. package/compose/src/commonMain/kotlin/vn/momo/kits/modifier/Conditional.kt +11 -0
  86. package/compose/src/commonMain/kotlin/vn/momo/kits/modifier/Shadow.kt +49 -0
  87. package/compose/src/commonMain/kotlin/vn/momo/kits/modifier/Size.kt +51 -0
  88. package/compose/src/commonMain/kotlin/vn/momo/kits/navigation/BottomSheet.kt +232 -0
  89. package/compose/src/commonMain/kotlin/vn/momo/kits/navigation/ModalScreen.kt +111 -0
  90. package/compose/src/commonMain/kotlin/vn/momo/kits/navigation/Navigation.kt +94 -0
  91. package/compose/src/commonMain/kotlin/vn/momo/kits/navigation/NavigationContainer.kt +159 -0
  92. package/compose/src/commonMain/kotlin/vn/momo/kits/navigation/Navigator.kt +232 -0
  93. package/compose/src/commonMain/kotlin/vn/momo/kits/navigation/ScaleSizeScope.kt +17 -0
  94. package/compose/src/commonMain/kotlin/vn/momo/kits/navigation/StackScreen.kt +459 -0
  95. package/compose/src/commonMain/kotlin/vn/momo/kits/navigation/bottomtab/BottomTab.kt +169 -0
  96. package/compose/src/commonMain/kotlin/vn/momo/kits/navigation/bottomtab/BottomTabBar.kt +216 -0
  97. package/compose/src/commonMain/kotlin/vn/momo/kits/navigation/bottomtab/CurvedContainer.kt +86 -0
  98. package/compose/src/commonMain/kotlin/vn/momo/kits/navigation/component/FloatingButton.kt +180 -0
  99. package/compose/src/commonMain/kotlin/vn/momo/kits/navigation/component/Header.kt +251 -0
  100. package/compose/src/commonMain/kotlin/vn/momo/kits/navigation/component/HeaderBackground.kt +80 -0
  101. package/compose/src/commonMain/kotlin/vn/momo/kits/navigation/component/HeaderRight.kt +306 -0
  102. package/compose/src/commonMain/kotlin/vn/momo/kits/navigation/component/HeaderTitle.kt +31 -0
  103. package/compose/src/commonMain/kotlin/vn/momo/kits/navigation/component/HeaderUser.kt +385 -0
  104. package/compose/src/commonMain/kotlin/vn/momo/kits/platform/Platform.kt +38 -0
  105. package/compose/src/commonMain/kotlin/vn/momo/kits/utils/Icons.kt +1329 -0
  106. package/compose/src/commonMain/kotlin/vn/momo/kits/utils/Resources.kt +62 -0
  107. package/compose/src/commonMain/kotlin/vn/momo/kits/utils/Utils.kt +88 -0
  108. package/compose/src/iosMain/kotlin/vn/momo/kits/platform/Platform.ios.kt +144 -0
  109. package/gradle.properties +19 -0
  110. package/gradlew +240 -0
  111. package/gradlew.bat +91 -0
  112. package/ios/Application/ApplicationEnvironment.swift +50 -0
  113. package/ios/Application/Components.swift +263 -0
  114. package/ios/Application/ComposeApi.swift +22 -0
  115. package/ios/Application/FloatingButton.swift +172 -0
  116. package/ios/Application/HeaderRight.swift +271 -0
  117. package/ios/Application/Screen.swift +249 -0
  118. package/ios/Badge/BadgeDot.swift +31 -0
  119. package/ios/Button/Button.swift +211 -0
  120. package/ios/CalculatorKeyboard/CalculatorKeyboard.swift +126 -0
  121. package/ios/Checkbox/Checkbox.swift +81 -0
  122. package/ios/Chip/Chip.swift +96 -0
  123. package/ios/Colors+Radius+Spacing/Colors.swift +172 -0
  124. package/ios/Colors+Radius+Spacing/Radius.swift +22 -0
  125. package/ios/Colors+Radius+Spacing/Spacing.swift +12 -0
  126. package/ios/Extensions/Color++.swift +25 -0
  127. package/ios/Icon/Icon.swift +51 -0
  128. package/ios/Image/Image.swift +70 -0
  129. package/ios/Input/Input.swift +207 -0
  130. package/ios/Input/InputPhoneNumber.swift +176 -0
  131. package/ios/Input/InputSearch.swift +238 -0
  132. package/ios/Input/InputTextArea.swift +242 -0
  133. package/ios/Lottie/LottieView.swift +86 -0
  134. package/ios/OTPKeyboard/KeyboardButton.swift +41 -0
  135. package/ios/OTPKeyboard/OTPKeyboard.swift +145 -0
  136. package/ios/Popup/PopupDisplay.swift +284 -0
  137. package/ios/Popup/PopupInput.swift +96 -0
  138. package/ios/Popup/PopupPromotion.swift +73 -0
  139. package/ios/PopupView/FullscreenPopup.swift +251 -0
  140. package/ios/PopupView/Modifiers.swift +158 -0
  141. package/ios/PopupView/PopupView.swift +289 -0
  142. package/ios/PopupView/Utils++.swift +281 -0
  143. package/ios/ScrollIndicator/ScrollIndicator.swift +110 -0
  144. package/ios/Swipeable/SwipeCell.swift +278 -0
  145. package/ios/Swipeable/SwipeCellModel.swift +86 -0
  146. package/ios/Switch/Switch.swift +44 -0
  147. package/ios/Template/Logo/Logo.swift +75 -0
  148. package/ios/Template/TrustBanner/TrustBanner.swift +120 -0
  149. package/ios/Theme.md +18 -0
  150. package/ios/Typography/Text.swift +140 -0
  151. package/ios/Typography/Typography.swift +95 -0
  152. package/ios/native-kits.podspec +18 -0
  153. package/package.json +6 -7
  154. package/settings.gradle.kts +25 -0
  155. package/shared/build.gradle.kts +0 -74
@@ -0,0 +1,133 @@
1
+
2
+ # Contributor Covenant Code of Conduct
3
+
4
+ ## Our Pledge
5
+
6
+ We as members, contributors, and leaders pledge to make participation in our
7
+ community a harassment-free experience for everyone, regardless of age, body
8
+ size, visible or invisible disability, ethnicity, sex characteristics, gender
9
+ identity and expression, level of experience, education, socio-economic status,
10
+ nationality, personal appearance, race, caste, color, religion, or sexual
11
+ identity and orientation.
12
+
13
+ We pledge to act and interact in ways that contribute to an open, welcoming,
14
+ diverse, inclusive, and healthy community.
15
+
16
+ ## Our Standards
17
+
18
+ Examples of behavior that contributes to a positive environment for our
19
+ community include:
20
+
21
+ * Demonstrating empathy and kindness toward other people
22
+ * Being respectful of differing opinions, viewpoints, and experiences
23
+ * Giving and gracefully accepting constructive feedback
24
+ * Accepting responsibility and apologizing to those affected by our mistakes,
25
+ and learning from the experience
26
+ * Focusing on what is best not just for us as individuals, but for the overall
27
+ community
28
+
29
+ Examples of unacceptable behavior include:
30
+
31
+ * The use of sexualized language or imagery, and sexual attention or advances of
32
+ any kind
33
+ * Trolling, insulting or derogatory comments, and personal or political attacks
34
+ * Public or private harassment
35
+ * Publishing others' private information, such as a physical or email address,
36
+ without their explicit permission
37
+ * Other conduct which could reasonably be considered inappropriate in a
38
+ professional setting
39
+
40
+ ## Enforcement Responsibilities
41
+
42
+ Community leaders are responsible for clarifying and enforcing our standards of
43
+ acceptable behavior and will take appropriate and fair corrective action in
44
+ response to any behavior that they deem inappropriate, threatening, offensive,
45
+ or harmful.
46
+
47
+ Community leaders have the right and responsibility to remove, edit, or reject
48
+ comments, commits, code, wiki edits, issues, and other contributions that are
49
+ not aligned to this Code of Conduct, and will communicate reasons for moderation
50
+ decisions when appropriate.
51
+
52
+ ## Scope
53
+
54
+ This Code of Conduct applies within all community spaces, and also applies when
55
+ an individual is officially representing the community in public spaces.
56
+ Examples of representing our community include using an official e-mail address,
57
+ posting via an official social media account, or acting as an appointed
58
+ representative at an online or offline event.
59
+
60
+ ## Enforcement
61
+
62
+ Instances of abusive, harassing, or otherwise unacceptable behavior may be
63
+ reported to the community leaders responsible for enforcement at
64
+ [INSERT CONTACT METHOD].
65
+ All complaints will be reviewed and investigated promptly and fairly.
66
+
67
+ All community leaders are obligated to respect the privacy and security of the
68
+ reporter of any incident.
69
+
70
+ ## Enforcement Guidelines
71
+
72
+ Community leaders will follow these Community Impact Guidelines in determining
73
+ the consequences for any action they deem in violation of this Code of Conduct:
74
+
75
+ ### 1. Correction
76
+
77
+ **Community Impact**: Use of inappropriate language or other behavior deemed
78
+ unprofessional or unwelcome in the community.
79
+
80
+ **Consequence**: A private, written warning from community leaders, providing
81
+ clarity around the nature of the violation and an explanation of why the
82
+ behavior was inappropriate. A public apology may be requested.
83
+
84
+ ### 2. Warning
85
+
86
+ **Community Impact**: A violation through a single incident or series of
87
+ actions.
88
+
89
+ **Consequence**: A warning with consequences for continued behavior. No
90
+ interaction with the people involved, including unsolicited interaction with
91
+ those enforcing the Code of Conduct, for a specified period of time. This
92
+ includes avoiding interactions in community spaces as well as external channels
93
+ like social media. Violating these terms may lead to a temporary or permanent
94
+ ban.
95
+
96
+ ### 3. Temporary Ban
97
+
98
+ **Community Impact**: A serious violation of community standards, including
99
+ sustained inappropriate behavior.
100
+
101
+ **Consequence**: A temporary ban from any sort of interaction or public
102
+ communication with the community for a specified period of time. No public or
103
+ private interaction with the people involved, including unsolicited interaction
104
+ with those enforcing the Code of Conduct, is allowed during this period.
105
+ Violating these terms may lead to a permanent ban.
106
+
107
+ ### 4. Permanent Ban
108
+
109
+ **Community Impact**: Demonstrating a pattern of violation of community
110
+ standards, including sustained inappropriate behavior, harassment of an
111
+ individual, or aggression toward or disparagement of classes of individuals.
112
+
113
+ **Consequence**: A permanent ban from any sort of public interaction within the
114
+ community.
115
+
116
+ ## Attribution
117
+
118
+ This Code of Conduct is adapted from the [Contributor Covenant][homepage],
119
+ version 2.1, available at
120
+ [https://www.contributor-covenant.org/version/2/1/code_of_conduct.html][v2.1].
121
+
122
+ Community Impact Guidelines were inspired by
123
+ [Mozilla's code of conduct enforcement ladder][Mozilla CoC].
124
+
125
+ For answers to common questions about this code of conduct, see the FAQ at
126
+ [https://www.contributor-covenant.org/faq][FAQ]. Translations are available at
127
+ [https://www.contributor-covenant.org/translations][translations].
128
+
129
+ [homepage]: https://www.contributor-covenant.org
130
+ [v2.1]: https://www.contributor-covenant.org/version/2/1/code_of_conduct.html
131
+ [Mozilla CoC]: https://github.com/mozilla/diversity
132
+ [FAQ]: https://www.contributor-covenant.org/faq
133
+ [translations]: https://www.contributor-covenant.org/translations
@@ -0,0 +1,114 @@
1
+ # Contributing
2
+
3
+ Contributions are always welcome, no matter how large or small!
4
+
5
+ We want this community to be friendly and respectful to each other. Please follow it in all your interactions with the project. Before contributing, please read the [code of conduct](./CODE_OF_CONDUCT.md).
6
+
7
+ ## Development workflow
8
+
9
+ To get started with the project, run `yarn` in the root directory to install the required dependencies for each package:
10
+
11
+ ```sh
12
+ yarn
13
+ ```
14
+
15
+ > While it's possible to use [`npm`](https://github.com/npm/cli), the tooling is built around [`yarn`](https://classic.yarnpkg.com/), so you'll have an easier time if you use `yarn` for development.
16
+
17
+ While developing, you can run the [example app](/example/) to test your changes. Any changes you make in your library's JavaScript code will be reflected in the example app without a rebuild. If you change any native code, then you'll need to rebuild the example app.
18
+
19
+ To start the packager:
20
+
21
+ ```sh
22
+ yarn example start
23
+ ```
24
+
25
+ To run the example app on Android:
26
+
27
+ ```sh
28
+ yarn example android
29
+ ```
30
+
31
+ To run the example app on iOS:
32
+
33
+ ```sh
34
+ yarn example ios
35
+ ```
36
+
37
+ Make sure your code passes TypeScript and ESLint. Run the following to verify:
38
+
39
+ ```sh
40
+ yarn typecheck
41
+ yarn lint
42
+ ```
43
+
44
+ To fix formatting errors, run the following:
45
+
46
+ ```sh
47
+ yarn lint --fix
48
+ ```
49
+
50
+ Remember to add tests for your change if possible. Run the unit tests by:
51
+
52
+ ```sh
53
+ yarn test
54
+ ```
55
+
56
+ To edit the Objective-C or Swift files, open `example/ios/NativeKitsExample.xcworkspace` in XCode and find the source files at `Pods > Development Pods > @momo-platform/native-kits`.
57
+
58
+ To edit the Java or Kotlin files, open `example/android` in Android studio and find the source files at `momo-platform-native-kits` under `Android`.
59
+
60
+
61
+ ### Commit message convention
62
+
63
+ We follow the [conventional commits specification](https://www.conventionalcommits.org/en) for our commit messages:
64
+
65
+ - `fix`: bug fixes, e.g. fix crash due to deprecated method.
66
+ - `feat`: new features, e.g. add new method to the module.
67
+ - `refactor`: code refactor, e.g. migrate from class components to hooks.
68
+ - `docs`: changes into documentation, e.g. add usage example for the module..
69
+ - `test`: adding or updating tests, e.g. add integration tests using detox.
70
+ - `chore`: tooling changes, e.g. change CI config.
71
+
72
+ Our pre-commit hooks verify that your commit message matches this format when committing.
73
+
74
+ ### Linting and tests
75
+
76
+ [ESLint](https://eslint.org/), [Prettier](https://prettier.io/), [TypeScript](https://www.typescriptlang.org/)
77
+
78
+ We use [TypeScript](https://www.typescriptlang.org/) for type checking, [ESLint](https://eslint.org/) with [Prettier](https://prettier.io/) for linting and formatting the code, and [Jest](https://jestjs.io/) for testing.
79
+
80
+ Our pre-commit hooks verify that the linter and tests pass when committing.
81
+
82
+ ### Publishing to npm
83
+
84
+ We use [release-it](https://github.com/release-it/release-it) to make it easier to publish new versions. It handles common tasks like bumping version based on semver, creating tags and releases etc.
85
+
86
+ To publish new versions, run the following:
87
+
88
+ ```sh
89
+ yarn release
90
+ ```
91
+
92
+ ### Scripts
93
+
94
+ The `package.json` file contains various scripts for common tasks:
95
+
96
+ - `yarn bootstrap`: setup project by installing all dependencies and pods.
97
+ - `yarn typecheck`: type-check files with TypeScript.
98
+ - `yarn lint`: lint files with ESLint.
99
+ - `yarn test`: run unit tests with Jest.
100
+ - `yarn example start`: start the Metro server for the example app.
101
+ - `yarn example android`: run the example app on Android.
102
+ - `yarn example ios`: run the example app on iOS.
103
+
104
+ ### Sending a pull request
105
+
106
+ > **Working on your first pull request?** You can learn how from this _free_ series: [How to Contribute to an Open Source Project on GitHub](https://app.egghead.io/playlists/how-to-contribute-to-an-open-source-project-on-github).
107
+
108
+ When you're sending a pull request:
109
+
110
+ - Prefer small pull requests focused on one change.
111
+ - Verify that linters and tests are passing.
112
+ - Review the documentation to make sure it looks good.
113
+ - Follow the pull request template when opening a pull request.
114
+ - For pull requests that change the API or implementation, discuss with maintainers first by opening an issue.
package/LICENSE ADDED
@@ -0,0 +1,20 @@
1
+ MIT License
2
+
3
+ Copyright (c) 2022 dung.huynh1
4
+ Permission is hereby granted, free of charge, to any person obtaining a copy
5
+ of this software and associated documentation files (the "Software"), to deal
6
+ in the Software without restriction, including without limitation the rights
7
+ to use, copy, modify, merge, publish, distribute, sublicense, and/or sell
8
+ copies of the Software, and to permit persons to whom the Software is
9
+ furnished to do so, subject to the following conditions:
10
+
11
+ The above copyright notice and this permission notice shall be included in all
12
+ copies or substantial portions of the Software.
13
+
14
+ THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR
15
+ IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY,
16
+ FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE
17
+ AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER
18
+ LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM,
19
+ OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN THE
20
+ SOFTWARE.
package/README.md ADDED
@@ -0,0 +1,7 @@
1
+ ## 🛠 Installation
2
+ ### Using Cocoapods
3
+ Add it inside your `Podfile`.
4
+ ```ruby
5
+ pod 'MoMoUIKits', '../node_modules/@momo-platform/native-kits/ios'
6
+ ```
7
+
@@ -0,0 +1,32 @@
1
+ plugins {
2
+ // this is necessary to avoid the plugins to be loaded multiple times
3
+ // in each subproject's classloader
4
+ alias(libs.plugins.jetbrains.kotlin.jvm) apply false
5
+ alias(libs.plugins.jetbrains.kotlin.multiplatform) apply false
6
+ alias(libs.plugins.jetbrains.kotlin.android) apply false
7
+ alias(libs.plugins.jetbrains.kotlin.serialization) apply false
8
+ alias(libs.plugins.kotlin.compose.compiler)
9
+ alias(libs.plugins.compose) apply false
10
+ alias(libs.plugins.android.library) apply false
11
+ alias(libs.plugins.android.application) apply false
12
+ }
13
+
14
+ buildscript {
15
+ repositories {
16
+ maven("https://storage.googleapis.com/r8-releases/raw")
17
+ }
18
+
19
+ dependencies {
20
+ classpath(libs.r8)
21
+ }
22
+ }
23
+
24
+ subprojects {
25
+
26
+ }
27
+
28
+ tasks.register<Copy>("setUpGitHooks") {
29
+ group = "help"
30
+ from("$rootDir/.hooks")
31
+ into("$rootDir/.git/hooks")
32
+ }
@@ -0,0 +1,54 @@
1
+ Pod::Spec.new do |spec|
2
+ spec.name = 'MoMoComposeKits'
3
+ spec.version = '0.0.1'
4
+ spec.homepage = 'MoMoComposeKits'
5
+ spec.source = { :http=> ''}
6
+ spec.authors = 'M_SERVICE'
7
+ spec.license = ''
8
+ spec.summary = 'MoMoComposeKits'
9
+ spec.vendored_frameworks = 'build/cocoapods/framework/compose.framework'
10
+ spec.libraries = 'c++'
11
+ spec.ios.deployment_target = '13.0'
12
+ spec.dependency 'lottie-ios', '4.4.3'
13
+
14
+ if !Dir.exist?('build/cocoapods/framework/compose.framework') || Dir.empty?('build/cocoapods/framework/compose.framework')
15
+ raise "
16
+
17
+ Kotlin framework 'compose' doesn't exist yet, so a proper Xcode project can't be generated.
18
+ 'pod install' should be executed after running ':generateDummyFramework' Gradle task:
19
+
20
+ ./gradlew :compose:generateDummyFramework
21
+
22
+ Alternatively, proper pod installation is performed during Gradle sync in the IDE (if Podfile location is set)"
23
+ end
24
+
25
+ spec.xcconfig = {
26
+ 'ENABLE_USER_SCRIPT_SANDBOXING' => 'NO',
27
+ }
28
+
29
+ spec.pod_target_xcconfig = {
30
+ 'KOTLIN_PROJECT_PATH' => ':compose',
31
+ 'PRODUCT_MODULE_NAME' => 'compose',
32
+ }
33
+
34
+ spec.script_phases = [
35
+ {
36
+ :name => 'Build MoMoComposeKits',
37
+ :execution_position => :before_compile,
38
+ :shell_path => '/bin/sh',
39
+ :script => <<-SCRIPT
40
+ if [ "YES" = "$OVERRIDE_KOTLIN_BUILD_IDE_SUPPORTED" ]; then
41
+ echo "Skipping Gradle build task invocation due to OVERRIDE_KOTLIN_BUILD_IDE_SUPPORTED environment variable set to \"YES\""
42
+ exit 0
43
+ fi
44
+ set -ev
45
+ REPO_ROOT="$PODS_TARGET_SRCROOT"
46
+ "$REPO_ROOT/../gradlew" -p "$REPO_ROOT" $KOTLIN_PROJECT_PATH:syncFramework \
47
+ -Pkotlin.native.cocoapods.platform=$PLATFORM_NAME \
48
+ -Pkotlin.native.cocoapods.archs="$ARCHS" \
49
+ -Pkotlin.native.cocoapods.configuration="$CONFIGURATION"
50
+ SCRIPT
51
+ }
52
+ ]
53
+ spec.resources = ['build/compose/cocoapods/compose-resources']
54
+ end
@@ -0,0 +1,149 @@
1
+ plugins {
2
+ alias(libs.plugins.android.library)
3
+ alias(libs.plugins.jetbrains.kotlin.multiplatform)
4
+ alias(libs.plugins.compose)
5
+ alias(libs.plugins.kotlin.compose.compiler)
6
+ id(libs.plugins.jetbrains.kotlin.cocoapods.get().pluginId)
7
+ kotlin("plugin.serialization")
8
+ id("maven-publish")
9
+ }
10
+ fun getVersionFromPackageJson(): String {
11
+ val packageJsonFile = file("../package.json")
12
+ val packageJsonText = packageJsonFile.readText()
13
+ val versionRegex = "\"version\"\\s*:\\s*\"([^\"]*)\"".toRegex()
14
+ val matchResult = versionRegex.find(packageJsonText)
15
+ return matchResult?.groupValues?.get(1) ?: throw IllegalStateException("Version not found in package.json")
16
+ }
17
+
18
+ val libName = "MoMoComposeKits"
19
+ val libGroup = "vn.momo.kits"
20
+ val libVersion = "0.0.1"
21
+
22
+ version = getVersionFromPackageJson()
23
+ kotlin {
24
+ androidTarget {
25
+ publishLibraryVariants("release")
26
+ }
27
+
28
+ val isDebug = (project.findProperty("kotlin.native.cocoapods.platform") as? String)
29
+ ?.contains("iphoneos", ignoreCase = true) == false
30
+
31
+ val iosTargets = if (isDebug) {
32
+ listOf(iosX64(), iosSimulatorArm64())
33
+ } else {
34
+ listOf(iosArm64())
35
+ }
36
+
37
+ iosTargets.forEach { iosTarget ->
38
+ iosTarget.binaries.framework {
39
+ baseName = libName
40
+ isStatic = true
41
+ }
42
+ }
43
+
44
+ cocoapods {
45
+ name = libName
46
+ summary = libName
47
+ homepage = libName
48
+ authors = "M_SERVICE"
49
+ ios.deploymentTarget = "13.0"
50
+
51
+ framework {
52
+ isStatic = true
53
+ }
54
+
55
+ pod("lottie-ios") {
56
+ moduleName = "Lottie"
57
+ version = "4.4.3"
58
+ extraOpts += listOf("-compiler-option", "-fmodules")
59
+ }
60
+ }
61
+
62
+
63
+ sourceSets {
64
+ val commonMain by getting {
65
+ dependencies {
66
+ implementation(compose.runtime)
67
+ implementation(compose.foundation)
68
+ implementation(compose.material)
69
+ implementation(compose.material3)
70
+ implementation(compose.components.resources)
71
+ implementation(libs.ktor.client.core)
72
+ implementation(libs.jetbrains.coroutines.core)
73
+ implementation(libs.navigation.multiplatform)
74
+ implementation(libs.coil.multiplatform.compose)
75
+ implementation(libs.coil.multiplatform.core)
76
+ implementation(libs.coil.multiplatform.network.ktor)
77
+ implementation(libs.jetbrains.serialization.json)
78
+ implementation(libs.kotlinx.datetime)
79
+ api(libs.native.max.api)
80
+ }
81
+ }
82
+ val androidMain by getting {
83
+ dependencies {
84
+ implementation(libs.ktor.client.okhttp)
85
+ implementation(libs.jetbrains.coroutines.android)
86
+ api("androidx.activity:activity-compose:1.8.2")
87
+ implementation(libs.airbnb.lottie)
88
+ }
89
+ }
90
+ if (isDebug) {
91
+ val iosX64Main by getting
92
+ val iosSimulatorArm64Main by getting
93
+ } else {
94
+ val iosArm64Main by getting
95
+ }
96
+ iosMain.dependencies {
97
+ implementation(libs.ktor.client.darwin)
98
+ }
99
+ }
100
+
101
+ task("testClasses")
102
+ }
103
+
104
+ publishing {
105
+ repositories {
106
+ maven {
107
+ group = libGroup
108
+ version = libVersion
109
+
110
+ name = "GitLab"
111
+ url = uri("https://gitlab.mservice.com.vn/api/v4/projects/2374/packages/maven")
112
+ credentials(PasswordCredentials::class) {
113
+ username = "gitlab+deploy-token-74"
114
+ password = "L3zudJhxiPsQi9hZ1YLX"
115
+ }
116
+ authentication {
117
+ create<BasicAuthentication>("basic")
118
+ }
119
+ }
120
+ }
121
+ }
122
+
123
+ android {
124
+ compileSdk = 34
125
+ namespace = "com.myapplication.common"
126
+
127
+ sourceSets["main"].manifest.srcFile("src/androidMain/AndroidManifest.xml")
128
+ sourceSets["main"].res.srcDirs("src/androidMain/res")
129
+ sourceSets["main"].resources.srcDirs("src/commonMain/resources")
130
+
131
+ defaultConfig {
132
+ minSdk = 23
133
+ }
134
+ compileOptions {
135
+ sourceCompatibility = JavaVersion.VERSION_17
136
+ targetCompatibility = JavaVersion.VERSION_17
137
+ }
138
+ kotlin {
139
+ jvmToolchain(17)
140
+ }
141
+ }
142
+
143
+ compose {
144
+ resources {
145
+ publicResClass = true
146
+ packageOfResClass = "vn.momo.uikits.resources"
147
+ generateResClass = always
148
+ }
149
+ }
@@ -0,0 +1,2 @@
1
+ <?xml version="1.0" encoding="utf-8"?>
2
+ <manifest />
@@ -0,0 +1,105 @@
1
+ package vn.momo.kits.platform
2
+
3
+ import android.annotation.SuppressLint
4
+ import android.content.res.Resources
5
+ import android.graphics.BlurMaskFilter
6
+ import android.graphics.PorterDuff
7
+ import android.graphics.PorterDuffColorFilter
8
+ import android.os.Build
9
+ import androidx.compose.foundation.layout.Box
10
+ import androidx.compose.runtime.Composable
11
+ import androidx.compose.runtime.getValue
12
+ import androidx.compose.ui.Modifier
13
+ import androidx.compose.ui.graphics.Color
14
+ import androidx.compose.ui.graphics.NativePaint
15
+ import androidx.compose.ui.graphics.toArgb
16
+ import androidx.compose.ui.platform.LocalConfiguration
17
+ import androidx.compose.ui.unit.Dp
18
+ import androidx.compose.ui.unit.dp
19
+ import com.airbnb.lottie.LottieProperty
20
+ import com.airbnb.lottie.compose.LottieAnimation
21
+ import com.airbnb.lottie.compose.LottieCompositionSpec
22
+ import com.airbnb.lottie.compose.LottieConstants
23
+ import com.airbnb.lottie.compose.rememberLottieComposition
24
+ import com.airbnb.lottie.compose.rememberLottieDynamicProperties
25
+ import com.airbnb.lottie.compose.rememberLottieDynamicProperty
26
+ import vn.momo.kits.const.AppNavigationBar
27
+ import vn.momo.kits.const.AppStatusBar
28
+ import vn.momo.kits.utils.readJson
29
+ import androidx.activity.compose.BackHandler as AndroidBackHandler
30
+
31
+ actual fun getPlatformName(): String = "Android"
32
+
33
+ @Composable
34
+ actual fun getScreenDimensions(): ScreenDimension {
35
+ val config = LocalConfiguration.current
36
+ return ScreenDimension(
37
+ config.screenWidthDp, config.screenHeightDp
38
+ )
39
+ }
40
+
41
+ actual fun NativePaint.setMaskFilter(blurRadius: Float) {
42
+ this.maskFilter = BlurMaskFilter(blurRadius, BlurMaskFilter.Blur.NORMAL)
43
+ }
44
+
45
+ @SuppressLint("InternalInsetResource")
46
+ @Composable
47
+ actual fun getStatusBarHeight(): Dp {
48
+ val resourceId = Resources.getSystem().getIdentifier(
49
+ "status_bar_height",
50
+ "dimen",
51
+ "android"
52
+ )
53
+ return if(resourceId > 0) Resources.getSystem().getDimensionPixelSize(resourceId).dp else 0.dp
54
+ }
55
+
56
+ @Composable
57
+ actual fun BackHandler(enabled: Boolean, onBack: () -> Unit) {
58
+ AndroidBackHandler(enabled = enabled, onBack = onBack)
59
+ }
60
+
61
+ @Composable
62
+ actual fun getScreenHeight(): Dp {
63
+ return getScreenDimensions().height.dp + if (getAndroidBuildVersion() >= 35) 0.dp else AppStatusBar.current + AppNavigationBar.current
64
+ }
65
+
66
+ actual fun getAndroidBuildVersion(): Int = Build.VERSION.SDK_INT
67
+
68
+ @Composable
69
+ actual fun LottieAnimation(
70
+ path: String,
71
+ tintColor: Color?,
72
+ bgColor: Color?,
73
+ modifier: Modifier
74
+ ) {
75
+ val json = readJson(path)
76
+
77
+ if (json.isEmpty()) {
78
+ Box(modifier)
79
+ return
80
+ }
81
+
82
+ val composition by rememberLottieComposition(
83
+ LottieCompositionSpec.JsonString(json)
84
+ )
85
+
86
+ val colorFilter = PorterDuffColorFilter(
87
+ tintColor?.toArgb() ?: Color.White.toArgb(),
88
+ PorterDuff.Mode.SRC_ATOP
89
+ )
90
+
91
+ val dynamicProperties = rememberLottieDynamicProperties(
92
+ rememberLottieDynamicProperty(
93
+ property = LottieProperty.COLOR_FILTER,
94
+ value = colorFilter,
95
+ keyPath = arrayOf("**")
96
+ )
97
+ )
98
+
99
+ LottieAnimation(
100
+ composition = composition,
101
+ iterations = LottieConstants.IterateForever,
102
+ dynamicProperties = if (tintColor != null) dynamicProperties else null,
103
+ modifier = modifier
104
+ )
105
+ }
@@ -0,0 +1 @@
1
+ {"v":"5.10.2","fr":30,"ip":0,"op":20,"w":100,"h":100,"nm":"Spinner3.1_Refine","ddd":0,"assets":[],"layers":[{"ddd":0,"ind":12,"ty":4,"nm":"loading 2","sr":1,"ks":{"o":{"a":0,"k":100,"ix":11},"r":{"a":1,"k":[{"i":{"x":[0.833],"y":[0.833]},"o":{"x":[0.167],"y":[0.167]},"t":0,"s":[0],"e":[360]},{"t":20}],"ix":10},"p":{"a":0,"k":[50,50,0],"ix":2,"l":2},"a":{"a":0,"k":[44.124,44.124,0],"ix":1,"l":2},"s":{"a":0,"k":[100,100,100],"ix":6,"l":2}},"ao":0,"shapes":[{"ty":"gr","it":[{"d":1,"ty":"el","s":{"a":0,"k":[90,90],"ix":2},"p":{"a":0,"k":[0,0],"ix":3},"nm":"Ellipse Path 1","mn":"ADBE Vector Shape - Ellipse","hd":false},{"ty":"st","c":{"a":0,"k":[0.996078431373,0.956862745098,0.980392156863,1],"ix":3},"o":{"a":0,"k":100,"ix":4},"w":{"a":0,"k":9,"ix":5},"lc":2,"lj":1,"ml":4,"bm":0,"nm":"Stroke 1","mn":"ADBE Vector Graphic - Stroke","hd":false},{"ty":"tr","p":{"a":0,"k":[44.124,44.124],"ix":2},"a":{"a":0,"k":[0,0],"ix":1},"s":{"a":0,"k":[100,100],"ix":3},"r":{"a":0,"k":0,"ix":6},"o":{"a":0,"k":100,"ix":7},"sk":{"a":0,"k":0,"ix":4},"sa":{"a":0,"k":0,"ix":5},"nm":"Transform"}],"nm":"Ellipse 1","np":3,"cix":2,"bm":0,"ix":1,"mn":"ADBE Vector Group","hd":false},{"ty":"tm","s":{"a":1,"k":[{"i":{"x":[0.667],"y":[1]},"o":{"x":[0.167],"y":[0.167]},"t":0,"s":[0],"e":[20]},{"i":{"x":[0.833],"y":[0.833]},"o":{"x":[0.333],"y":[0]},"t":10,"s":[20],"e":[0]},{"t":20}],"ix":1},"e":{"a":1,"k":[{"i":{"x":[0.667],"y":[1]},"o":{"x":[0.167],"y":[0.167]},"t":0,"s":[35],"e":[50]},{"i":{"x":[0.833],"y":[0.833]},"o":{"x":[0.333],"y":[0]},"t":10,"s":[50],"e":[35]},{"t":20}],"ix":2},"o":{"a":0,"k":0,"ix":3},"m":1,"ix":2,"nm":"Trim Paths 1","mn":"ADBE Vector Filter - Trim","hd":false}],"ip":0,"op":20,"st":0,"ct":1,"bm":0},{"ddd":0,"ind":13,"ty":4,"nm":"loading 3","sr":1,"ks":{"o":{"a":0,"k":100,"ix":11},"r":{"a":1,"k":[{"i":{"x":[0.833],"y":[0.833]},"o":{"x":[0.167],"y":[0.167]},"t":2,"s":[0],"e":[360]},{"t":20}],"ix":10},"p":{"a":0,"k":[50,50,0],"ix":2,"l":2},"a":{"a":0,"k":[44.124,44.124,0],"ix":1,"l":2},"s":{"a":0,"k":[100,100,100],"ix":6,"l":2}},"ao":0,"shapes":[{"ty":"gr","it":[{"d":1,"ty":"el","s":{"a":0,"k":[90,90],"ix":2},"p":{"a":0,"k":[0,0],"ix":3},"nm":"Ellipse Path 1","mn":"ADBE Vector Shape - Ellipse","hd":false},{"ty":"st","c":{"a":0,"k":[0.98431372549,0.835294117647,0.917647058824,1],"ix":3},"o":{"a":0,"k":100,"ix":4},"w":{"a":0,"k":9,"ix":5},"lc":2,"lj":1,"ml":4,"bm":0,"nm":"Stroke 1","mn":"ADBE Vector Graphic - Stroke","hd":false},{"ty":"tr","p":{"a":0,"k":[44.124,44.124],"ix":2},"a":{"a":0,"k":[0,0],"ix":1},"s":{"a":0,"k":[100,100],"ix":3},"r":{"a":0,"k":0,"ix":6},"o":{"a":0,"k":100,"ix":7},"sk":{"a":0,"k":0,"ix":4},"sa":{"a":0,"k":0,"ix":5},"nm":"Transform"}],"nm":"Ellipse 1","np":3,"cix":2,"bm":0,"ix":1,"mn":"ADBE Vector Group","hd":false},{"ty":"tm","s":{"a":1,"k":[{"i":{"x":[0.667],"y":[1]},"o":{"x":[0.167],"y":[0.167]},"t":2,"s":[0],"e":[20]},{"i":{"x":[0.833],"y":[0.833]},"o":{"x":[0.333],"y":[0]},"t":12,"s":[20],"e":[0]},{"t":20}],"ix":1},"e":{"a":1,"k":[{"i":{"x":[0.667],"y":[1]},"o":{"x":[0.167],"y":[0.167]},"t":2,"s":[35],"e":[50]},{"i":{"x":[0.833],"y":[0.833]},"o":{"x":[0.333],"y":[0]},"t":12,"s":[50],"e":[35]},{"t":20}],"ix":2},"o":{"a":0,"k":0,"ix":3},"m":1,"ix":2,"nm":"Trim Paths 1","mn":"ADBE Vector Filter - Trim","hd":false}],"ip":0,"op":20,"st":0,"ct":1,"bm":0},{"ddd":0,"ind":14,"ty":4,"nm":"base pink 2","sr":1,"ks":{"o":{"a":0,"k":40,"ix":11},"r":{"a":0,"k":0,"ix":10},"p":{"a":0,"k":[50,50,0],"ix":2,"l":2},"a":{"a":0,"k":[44.124,44.124,0],"ix":1,"l":2},"s":{"a":0,"k":[100,100,100],"ix":6,"l":2}},"ao":0,"shapes":[{"ty":"gr","it":[{"d":1,"ty":"el","s":{"a":0,"k":[90,90],"ix":2},"p":{"a":0,"k":[0,0],"ix":3},"nm":"Ellipse Path 1","mn":"ADBE Vector Shape - Ellipse","hd":false},{"ty":"st","c":{"a":0,"k":[0.996078431373,0.972549019608,0.988235294118,1],"ix":3},"o":{"a":0,"k":100,"ix":4},"w":{"a":0,"k":9,"ix":5},"lc":1,"lj":1,"ml":4,"bm":0,"nm":"Stroke 1","mn":"ADBE Vector Graphic - Stroke","hd":false},{"ty":"tr","p":{"a":0,"k":[44.124,44.124],"ix":2},"a":{"a":0,"k":[0,0],"ix":1},"s":{"a":0,"k":[100,100],"ix":3},"r":{"a":0,"k":0,"ix":6},"o":{"a":0,"k":100,"ix":7},"sk":{"a":0,"k":0,"ix":4},"sa":{"a":0,"k":0,"ix":5},"nm":"Transform"}],"nm":"Ellipse 1","np":3,"cix":2,"bm":0,"ix":1,"mn":"ADBE Vector Group","hd":false}],"ip":0,"op":20,"st":0,"ct":1,"bm":0}],"markers":[]}