react-native-mmkv 2.12.2 → 3.0.0-beta.1
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/LICENSE +1 -200
- package/MMKV/Core/Core.xcodeproj/project.pbxproj +4 -2
- package/MMKV/Core/MMKVPredef.h +1 -1
- package/MMKV/Core/MMKV_IO.cpp +5 -1
- package/MMKV/Core/MemoryFile.cpp +1 -0
- package/MMKV/Core/MemoryFile_OSX.cpp +2 -1
- package/MMKV/README.md +8 -8
- package/README.md +7 -1
- package/android/CMakeLists.txt +20 -28
- package/android/build.gradle +59 -89
- package/android/gradle.properties +4 -5
- package/android/src/main/AndroidManifest.xml +2 -2
- package/android/src/{hasNamespace/AndroidManifest.xml → main/AndroidManifestNew.xml} +0 -1
- package/android/src/main/cpp/AndroidLogger.cpp +16 -0
- package/android/src/main/cpp/cpp-adapter.cpp +4 -80
- package/android/src/main/java/com/mrousavy/mmkv/MmkvPackage.java +44 -0
- package/android/src/main/java/com/mrousavy/mmkv/MmkvPlatformContextModule.java +17 -0
- package/cpp/Logger.h +35 -0
- package/cpp/MMKVManagedBuffer.h +37 -0
- package/{android/src/main/cpp → cpp}/MmkvHostObject.cpp +126 -63
- package/{android/src/main/cpp → cpp}/MmkvHostObject.h +14 -3
- package/cpp/NativeMmkvModule.cpp +40 -0
- package/cpp/NativeMmkvModule.h +37 -0
- package/ios/AppleLogger.mm +16 -0
- package/ios/MmkvOnLoad.mm +25 -0
- package/ios/MmkvPlatformContext.h +19 -0
- package/ios/MmkvPlatformContextModule.mm +37 -0
- package/lib/commonjs/MMKV.js +34 -4
- package/lib/commonjs/MMKV.js.map +1 -1
- package/lib/commonjs/NativeMmkv.js +66 -0
- package/lib/commonjs/NativeMmkv.js.map +1 -0
- package/lib/commonjs/NativeMmkvPlatformContext.js +9 -0
- package/lib/commonjs/NativeMmkvPlatformContext.js.map +1 -0
- package/lib/commonjs/PlatformChecker.js.map +1 -1
- package/lib/commonjs/createMMKV.js +7 -43
- package/lib/commonjs/createMMKV.js.map +1 -1
- package/lib/commonjs/createMMKV.mock.js +5 -1
- package/lib/commonjs/createMMKV.mock.js.map +1 -1
- package/lib/commonjs/createMMKV.web.js +8 -4
- package/lib/commonjs/createMMKV.web.js.map +1 -1
- package/lib/commonjs/createTextEncoder.js.map +1 -1
- package/lib/commonjs/hooks.js +11 -10
- package/lib/commonjs/hooks.js.map +1 -1
- package/lib/commonjs/index.js.map +1 -1
- package/lib/module/MMKV.js +23 -4
- package/lib/module/MMKV.js.map +1 -1
- package/lib/module/NativeMmkv.js +63 -0
- package/lib/module/NativeMmkv.js.map +1 -0
- package/lib/module/NativeMmkvPlatformContext.js +3 -0
- package/lib/module/NativeMmkvPlatformContext.js.map +1 -0
- package/lib/module/PlatformChecker.js.map +1 -1
- package/lib/module/createMMKV.js +7 -43
- package/lib/module/createMMKV.js.map +1 -1
- package/lib/module/createMMKV.mock.js +5 -1
- package/lib/module/createMMKV.mock.js.map +1 -1
- package/lib/module/createMMKV.web.js +6 -4
- package/lib/module/createMMKV.web.js.map +1 -1
- package/lib/module/createTextEncoder.js.map +1 -1
- package/lib/module/hooks.js +7 -2
- package/lib/module/hooks.js.map +1 -1
- package/lib/module/index.js.map +1 -1
- package/lib/typescript/{MMKV.d.ts → src/MMKV.d.ts} +26 -49
- package/lib/typescript/src/MMKV.d.ts.map +1 -0
- package/lib/typescript/src/NativeMmkv.d.ts +79 -0
- package/lib/typescript/src/NativeMmkv.d.ts.map +1 -0
- package/lib/typescript/src/NativeMmkvPlatformContext.d.ts +9 -0
- package/lib/typescript/src/NativeMmkvPlatformContext.d.ts.map +1 -0
- package/lib/typescript/src/PlatformChecker.d.ts.map +1 -0
- package/lib/typescript/src/__tests__/hooks.test.d.ts +2 -0
- package/lib/typescript/src/__tests__/hooks.test.d.ts.map +1 -0
- package/lib/typescript/src/createMMKV.d.ts +3 -0
- package/lib/typescript/src/createMMKV.d.ts.map +1 -0
- package/lib/typescript/src/createMMKV.mock.d.ts +3 -0
- package/lib/typescript/src/createMMKV.mock.d.ts.map +1 -0
- package/lib/typescript/src/createMMKV.web.d.ts +3 -0
- package/lib/typescript/src/createMMKV.web.d.ts.map +1 -0
- package/lib/typescript/src/createTextEncoder.d.ts.map +1 -0
- package/lib/typescript/{hooks.d.ts → src/hooks.d.ts} +7 -4
- package/lib/typescript/src/hooks.d.ts.map +1 -0
- package/lib/typescript/src/index.d.ts.map +1 -0
- package/package.json +49 -40
- package/react-native-mmkv.podspec +17 -18
- package/src/MMKV.ts +40 -62
- package/src/NativeMmkv.ts +132 -0
- package/src/NativeMmkvPlatformContext.ts +12 -0
- package/src/__tests__/hooks.test.tsx +88 -0
- package/src/createMMKV.mock.ts +7 -3
- package/src/createMMKV.ts +9 -63
- package/src/createMMKV.web.ts +6 -2
- package/src/hooks.ts +17 -11
- package/android/src/main/java/com/reactnativemmkv/MmkvModule.java +0 -49
- package/android/src/main/java/com/reactnativemmkv/MmkvPackage.java +0 -26
- package/cpp/TypedArray.cpp +0 -322
- package/cpp/TypedArray.h +0 -153
- package/ios/JSIUtils.h +0 -38
- package/ios/JSIUtils.mm +0 -167
- package/ios/Mmkv.xcodeproj/project.pbxproj +0 -291
- package/ios/MmkvHostObject.h +0 -27
- package/ios/MmkvHostObject.mm +0 -295
- package/ios/MmkvModule.h +0 -5
- package/ios/MmkvModule.mm +0 -101
- package/lib/typescript/MMKV.d.ts.map +0 -1
- package/lib/typescript/PlatformChecker.d.ts.map +0 -1
- package/lib/typescript/createMMKV.d.ts +0 -7
- package/lib/typescript/createMMKV.d.ts.map +0 -1
- package/lib/typescript/createMMKV.mock.d.ts +0 -3
- package/lib/typescript/createMMKV.mock.d.ts.map +0 -1
- package/lib/typescript/createMMKV.web.d.ts +0 -3
- package/lib/typescript/createMMKV.web.d.ts.map +0 -1
- package/lib/typescript/createTextEncoder.d.ts.map +0 -1
- package/lib/typescript/hooks.d.ts.map +0 -1
- package/lib/typescript/index.d.ts.map +0 -1
- /package/lib/typescript/{PlatformChecker.d.ts → src/PlatformChecker.d.ts} +0 -0
- /package/lib/typescript/{createTextEncoder.d.ts → src/createTextEncoder.d.ts} +0 -0
- /package/lib/typescript/{index.d.ts → src/index.d.ts} +0 -0
- /package/src/{index.ts → index.tsx} +0 -0
package/LICENSE
CHANGED
|
@@ -1,9 +1,6 @@
|
|
|
1
|
-
react-native-mmkv LICENSE:
|
|
2
|
-
|
|
3
1
|
MIT License
|
|
4
2
|
|
|
5
|
-
Copyright (c)
|
|
6
|
-
|
|
3
|
+
Copyright (c) 2024 Marc Rousavy
|
|
7
4
|
Permission is hereby granted, free of charge, to any person obtaining a copy
|
|
8
5
|
of this software and associated documentation files (the "Software"), to deal
|
|
9
6
|
in the Software without restriction, including without limitation the rights
|
|
@@ -21,199 +18,3 @@ AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER
|
|
|
21
18
|
LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM,
|
|
22
19
|
OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN THE
|
|
23
20
|
SOFTWARE.
|
|
24
|
-
|
|
25
|
-
MMKV LICENSE:
|
|
26
|
-
|
|
27
|
-
Tencent is pleased to support the open source community by making MMKV available.
|
|
28
|
-
Copyright (C) 2018 THL A29 Limited, a Tencent company. All rights reserved.
|
|
29
|
-
If you have downloaded a copy of the MMKV binary from Tencent, please note that the MMKV binary is licensed under the BSD 3-Clause License.
|
|
30
|
-
If you have downloaded a copy of the MMKV source code from Tencent, please note that MMKV source code is licensed under the BSD 3-Clause License, except for the third-party components listed below which are subject to different license terms. Your integration of MMKV into your own projects may require compliance with the BSD 3-Clause License, as well as the other licenses applicable to the third-party components included within MMKV.
|
|
31
|
-
A copy of the BSD 3-Clause License is included in this file.
|
|
32
|
-
|
|
33
|
-
Other dependencies and licenses:
|
|
34
|
-
|
|
35
|
-
Open Source Software Licensed Under the OpenSSL License:
|
|
36
|
-
----------------------------------------------------------------------------------------
|
|
37
|
-
1. OpenSSL 1.1.0i
|
|
38
|
-
Copyright (c) 1998-2018 The OpenSSL Project.
|
|
39
|
-
All rights reserved.
|
|
40
|
-
Copyright (C) 1995-1998 Eric Young (eay@cryptsoft.com)
|
|
41
|
-
All rights reserved.
|
|
42
|
-
|
|
43
|
-
|
|
44
|
-
Terms of the OpenSSL License:
|
|
45
|
-
---------------------------------------------------
|
|
46
|
-
LICENSE ISSUES:
|
|
47
|
-
--------------------------------------------------------------------
|
|
48
|
-
|
|
49
|
-
The OpenSSL toolkit stays under a dual license, i.e. both the conditions of the OpenSSL License and the original SSLeay license apply to the toolkit.
|
|
50
|
-
See below for the actual license texts.
|
|
51
|
-
|
|
52
|
-
OpenSSL License:
|
|
53
|
-
--------------------------------------------------------------------
|
|
54
|
-
Copyright (c) 1998-2018 The OpenSSL Project. All rights reserved.
|
|
55
|
-
|
|
56
|
-
Redistribution and use in source and binary forms, with or without modification, are permitted provided that the following conditions are met:
|
|
57
|
-
|
|
58
|
-
1. Redistributions of source code must retain the above copyright notice, this list of conditions and the following disclaimer.
|
|
59
|
-
|
|
60
|
-
2. Redistributions in binary form must reproduce the above copyright notice, this list of conditions and the following disclaimer in the documentation and/or other materials provided with the distribution.
|
|
61
|
-
|
|
62
|
-
3. All advertising materials mentioning features or use of this software must display the following acknowledgment:
|
|
63
|
-
"This product includes software developed by the OpenSSL Project for use in the OpenSSL Toolkit. (http://www.openssl.org/)"
|
|
64
|
-
|
|
65
|
-
4. The names "OpenSSL Toolkit" and "OpenSSL Project" must not be used to endorse or promote products derived from this software without prior written permission. For written permission, please contact openssl-core@openssl.org.
|
|
66
|
-
|
|
67
|
-
5. Products derived from this software may not be called "OpenSSL" nor may "OpenSSL" appear in their names without prior written permission of the OpenSSL Project.
|
|
68
|
-
|
|
69
|
-
6. Redistributions of any form whatsoever must retain the following acknowledgment: "This product includes software developed by the OpenSSL Project for use in the OpenSSL Toolkit (http://www.openssl.org/)"
|
|
70
|
-
|
|
71
|
-
THIS SOFTWARE IS PROVIDED BY THE OpenSSL PROJECT ``AS IS'' AND ANY EXPRESSED OR IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE ARE DISCLAIMED. IN NO EVENT SHALL THE OpenSSL PROJECT OR ITS CONTRIBUTORS BE LIABLE FOR ANY DIRECT, INDIRECT, INCIDENTAL, SPECIAL, EXEMPLARY, OR CONSEQUENTIAL DAMAGES (INCLUDING, BUT NOT LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES; LOSS OF USE, DATA, OR PROFITS; OR BUSINESS INTERRUPTION) HOWEVER CAUSED AND ON ANY THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT LIABILITY, OR TORT (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY OUT OF THE USE OF THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE.
|
|
72
|
-
====================================================================
|
|
73
|
-
* This product includes cryptographic software written by Eric Young (eay@cryptsoft.com). This product includes software written by Tim Hudson (tjh@cryptsoft.com).
|
|
74
|
-
|
|
75
|
-
|
|
76
|
-
Original SSLeay License:
|
|
77
|
-
--------------------------------------------------------------------
|
|
78
|
-
Copyright (C) 1995-1998 Eric Young (eay@cryptsoft.com)
|
|
79
|
-
All rights reserved.
|
|
80
|
-
|
|
81
|
-
This package is an SSL implementation written by Eric Young (eay@cryptsoft.com).
|
|
82
|
-
The implementation was written so as to conform with Netscapes SSL.
|
|
83
|
-
|
|
84
|
-
This library is free for commercial and non-commercial use as long as the following conditions are aheared to. The following conditions apply to all code found in this distribution, be it the RC4, RSA, lhash, DES, etc., code; not just the SSL code. The SSL documentation included with this distribution is covered by the same copyright terms except that the holder is Tim Hudson (tjh@cryptsoft.com).
|
|
85
|
-
|
|
86
|
-
Copyright remains Eric Young's, and as such any Copyright notices in the code are not to be removed. If this package is used in a product, Eric Young should be given attribution as the author of the parts of the library used. This can be in the form of a textual message at program startup or in documentation (online or textual) provided with the package.
|
|
87
|
-
|
|
88
|
-
Redistribution and use in source and binary forms, with or without modification, are permitted provided that the following conditions are met:
|
|
89
|
-
1. Redistributions of source code must retain the copyright notice, this list of conditions and the following disclaimer.
|
|
90
|
-
2. Redistributions in binary form must reproduce the above copyright notice, this list of conditions and the following disclaimer in the documentation and/or other materials provided with the distribution.
|
|
91
|
-
3. All advertising materials mentioning features or use of this software must display the following acknowledgement:" This product includes cryptographic software written by Eric Young (eay@cryptsoft.com)" The word 'cryptographic' can be left out if the rouines from the library being used are not cryptographic related :-).
|
|
92
|
-
4. If you include any Windows specific code (or a derivative thereof) from the apps directory (application code) you must include an acknowledgement: "This product includes software written by Tim Hudson (tjh@cryptsoft.com)"
|
|
93
|
-
|
|
94
|
-
THIS SOFTWARE IS PROVIDED BY ERIC YOUNG ``AS IS'' AND ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE ARE DISCLAIMED. IN NO EVENT SHALL THE AUTHOR OR CONTRIBUTORS BE LIABLE FOR ANY DIRECT, INDIRECT, INCIDENTAL, SPECIAL, EXEMPLARY, OR CONSEQUENTIAL DAMAGES (INCLUDING, BUT NOT LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES; LOSS OF USE, DATA, OR PROFITS; OR BUSINESS INTERRUPTION) HOWEVER CAUSED AND ON ANY THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT LIABILITY, OR TORT (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY OUT OF THE USE OF THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE.
|
|
95
|
-
|
|
96
|
-
The licence and distribution terms for any publically available version or derivative of this code cannot be changed. i.e. this code cannot simply be copied and put under another distribution licence [including the GNU Public Licence.]
|
|
97
|
-
|
|
98
|
-
|
|
99
|
-
|
|
100
|
-
Open Source Software Licensed Under the Apache License, Version 2.0:
|
|
101
|
-
The below software in this distribution may have been modified by THL A29 Limited (“Tencent Modifications”). All Tencent Modifications are Copyright (C) 2018 THL A29 Limited.
|
|
102
|
-
----------------------------------------------------------------------------------------
|
|
103
|
-
1. MultiprocessSharedPreferences v1.0
|
|
104
|
-
Copyright (C) 2014 seven456@gmail.com
|
|
105
|
-
|
|
106
|
-
|
|
107
|
-
Terms of the Apache License, Version 2.0:
|
|
108
|
-
--------------------------------------------------------------------
|
|
109
|
-
Apache License Version 2.0, January 2004 http://www.apache.org/licenses/
|
|
110
|
-
|
|
111
|
-
TERMS AND CONDITIONS FOR USE, REPRODUCTION, AND DISTRIBUTION
|
|
112
|
-
|
|
113
|
-
1. Definitions.
|
|
114
|
-
|
|
115
|
-
“License” shall mean the terms and conditions for use, reproduction, and distribution as defined by Sections 1 through 9 of this document.
|
|
116
|
-
|
|
117
|
-
“Licensor” shall mean the copyright owner or entity authorized by the copyright owner that is granting the License.
|
|
118
|
-
|
|
119
|
-
“Legal Entity” shall mean the union of the acting entity and all other entities that control, are controlled by, or are under common control with that entity. For the purposes of this definition, “control” means (i) the power, direct or indirect, to cause the direction or management of such entity, whether by contract or otherwise, or (ii) ownership of fifty percent (50%) or more of the outstanding shares, or (iii) beneficial ownership of such entity.
|
|
120
|
-
|
|
121
|
-
“You” (or “Your”) shall mean an individual or Legal Entity exercising permissions granted by this License.
|
|
122
|
-
|
|
123
|
-
“Source” form shall mean the preferred form for making modifications, including but not limited to software source code, documentation source, and configuration files.
|
|
124
|
-
|
|
125
|
-
“Object” form shall mean any form resulting from mechanical transformation or translation of a Source form, including but not limited to compiled object code, generated documentation, and conversions to other media types.
|
|
126
|
-
|
|
127
|
-
“Work” shall mean the work of authorship, whether in Source or Object form, made available under the License, as indicated by a copyright notice that is included in or attached to the work (an example is provided in the Appendix below).
|
|
128
|
-
|
|
129
|
-
“Derivative Works” shall mean any work, whether in Source or Object form, that is based on (or derived from) the Work and for which the editorial revisions, annotations, elaborations, or other modifications represent, as a whole, an original work of authorship. For the purposes of this License, Derivative Works shall not include works that remain separable from, or merely link (or bind by name) to the interfaces of, the Work and Derivative Works thereof.
|
|
130
|
-
|
|
131
|
-
“Contribution” shall mean any work of authorship, including the original version of the Work and any modifications or additions to that Work or Derivative Works thereof, that is intentionally submitted to Licensor for inclusion in the Work by the copyright owner or by an individual or Legal Entity authorized to submit on behalf of the copyright owner. For the purposes of this definition, “submitted” means any form of electronic, verbal, or written communication sent to the Licensor or its representatives, including but not limited to communication on electronic mailing lists, source code control systems, and issue tracking systems that are managed by, or on behalf of, the Licensor for the purpose of discussing and improving the Work, but excluding communication that is conspicuously marked or otherwise designated in writing by the copyright owner as “Not a Contribution.”
|
|
132
|
-
|
|
133
|
-
“Contributor” shall mean Licensor and any individual or Legal Entity on behalf of whom a Contribution has been received by Licensor and subsequently incorporated within the Work.
|
|
134
|
-
|
|
135
|
-
2. Grant of Copyright License. Subject to the terms and conditions of this License, each Contributor hereby grants to You a perpetual, worldwide, non-exclusive, no-charge, royalty-free, irrevocable copyright license to reproduce, prepare Derivative Works of, publicly display, publicly perform, sublicense, and distribute the Work and such Derivative Works in Source or Object form.
|
|
136
|
-
|
|
137
|
-
3. Grant of Patent License. Subject to the terms and conditions of this License, each Contributor hereby grants to You a perpetual, worldwide, non-exclusive, no-charge, royalty-free, irrevocable (except as stated in this section) patent license to make, have made, use, offer to sell, sell, import, and otherwise transfer the Work, where such license applies only to those patent claims licensable by such Contributor that are necessarily infringed by their Contribution(s) alone or by combination of their Contribution(s) with the Work to which such Contribution(s) was submitted. If You institute patent litigation against any entity (including a cross-claim or counterclaim in a lawsuit) alleging that the Work or a Contribution incorporated within the Work constitutes direct or contributory patent infringement, then any patent licenses granted to You under this License for that Work shall terminate as of the date such litigation is filed.
|
|
138
|
-
|
|
139
|
-
4. Redistribution. You may reproduce and distribute copies of the Work or Derivative Works thereof in any medium, with or without modifications, and in Source or Object form, provided that You meet the following conditions:
|
|
140
|
-
|
|
141
|
-
a) You must give any other recipients of the Work or Derivative Works a copy of this License; and
|
|
142
|
-
|
|
143
|
-
b) You must cause any modified files to carry prominent notices stating that You changed the files; and
|
|
144
|
-
|
|
145
|
-
c) You must retain, in the Source form of any Derivative Works that You distribute, all copyright, patent, trademark, and attribution notices from the Source form of the Work, excluding those notices that do not pertain to any part of the Derivative Works; and
|
|
146
|
-
|
|
147
|
-
d) If the Work includes a “NOTICE” text file as part of its distribution, then any Derivative Works that You distribute must include a readable copy of the attribution notices contained within such NOTICE file, excluding those notices that do not pertain to any part of the Derivative Works, in at least one of the following places: within a NOTICE text file distributed as part of the Derivative Works; within the Source form or documentation, if provided along with the Derivative Works; or, within a display generated by the Derivative Works, if and wherever such third-party notices normally appear. The contents of the NOTICE file are for informational purposes only and do not modify the License. You may add Your own attribution notices within Derivative Works that You distribute, alongside or as an addendum to the NOTICE text from the Work, provided that such additional attribution notices cannot be construed as modifying the License.
|
|
148
|
-
|
|
149
|
-
You may add Your own copyright statement to Your modifications and may provide additional or different license terms and conditions for use, reproduction, or distribution of Your modifications, or for any such Derivative Works as a whole, provided Your use, reproduction, and distribution of the Work otherwise complies with the conditions stated in this License.
|
|
150
|
-
|
|
151
|
-
5. Submission of Contributions. Unless You explicitly state otherwise, any Contribution intentionally submitted for inclusion in the Work by You to the Licensor shall be under the terms and conditions of this License, without any additional terms or conditions. Notwithstanding the above, nothing herein shall supersede or modify the terms of any separate license agreement you may have executed with Licensor regarding such Contributions.
|
|
152
|
-
|
|
153
|
-
6. Trademarks. This License does not grant permission to use the trade names, trademarks, service marks, or product names of the Licensor, except as required for reasonable and customary use in describing the origin of the Work and reproducing the content of the NOTICE file.
|
|
154
|
-
|
|
155
|
-
7. Disclaimer of Warranty. Unless required by applicable law or agreed to in writing, Licensor provides the Work (and each Contributor provides its Contributions) on an “AS IS” BASIS, WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied, including, without limitation, any warranties or conditions of TITLE, NON-INFRINGEMENT, MERCHANTABILITY, or FITNESS FOR A PARTICULAR PURPOSE. You are solely responsible for determining the appropriateness of using or redistributing the Work and assume any risks associated with Your exercise of permissions under this License.
|
|
156
|
-
|
|
157
|
-
8. Limitation of Liability. In no event and under no legal theory, whether in tort (including negligence), contract, or otherwise, unless required by applicable law (such as deliberate and grossly negligent acts) or agreed to in writing, shall any Contributor be liable to You for damages, including any direct, indirect, special, incidental, or consequential damages of any character arising as a result of this License or out of the use or inability to use the Work (including but not limited to damages for loss of goodwill, work stoppage, computer failure or malfunction, or any and all other commercial damages or losses), even if such Contributor has been advised of the possibility of such damages.
|
|
158
|
-
9. Accepting Warranty or Additional Liability. While redistributing the Work or Derivative Works thereof, You may choose to offer, and charge a fee for, acceptance of support, warranty, indemnity, or other liability obligations and/or rights consistent with this License. However, in accepting such obligations, You may act only on Your own behalf and on Your sole responsibility, not on behalf of any other Contributor, and only if You agree to indemnify, defend, and hold each Contributor harmless for any liability incurred by, or claims asserted against, such Contributor by reason of your accepting any such warranty or additional liability.
|
|
159
|
-
|
|
160
|
-
END OF TERMS AND CONDITIONS
|
|
161
|
-
|
|
162
|
-
APPENDIX: How to apply the Apache License to your work
|
|
163
|
-
To apply the Apache License to your work, attach the following boilerplate notice, with the fields enclosed by brackets "[]" replaced with your own identifying information. (Don't include the brackets!) The text should be enclosed in the appropriate comment syntax for the file format. We also recommend that a file or class name and description of purpose be included on the same "printed page" as the copyright notice for easier identification within third-party archives.
|
|
164
|
-
|
|
165
|
-
Copyright [yyyy] [name of copyright owner]
|
|
166
|
-
|
|
167
|
-
Licensed under the Apache License, Version 2.0 (the "License");
|
|
168
|
-
you may not use this file except in compliance with the License.
|
|
169
|
-
You may obtain a copy of the License at
|
|
170
|
-
http://www.apache.org/licenses/LICENSE-2.0
|
|
171
|
-
Unless required by applicable law or agreed to in writing, software
|
|
172
|
-
distributed under the License is distributed on an "AS IS" BASIS,
|
|
173
|
-
WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
|
|
174
|
-
See the License for the specific language governing permissions and
|
|
175
|
-
limitations under the License.
|
|
176
|
-
|
|
177
|
-
|
|
178
|
-
|
|
179
|
-
Open Source Software Licensed Under the zlib License:
|
|
180
|
-
The below software in this distribution may have been modified by THL A29 Limited (“Tencent Modifications”). All Tencent Modifications are Copyright (C) 2018 THL A29 Limited.
|
|
181
|
-
----------------------------------------------------------------------------------------
|
|
182
|
-
1. zlib v1.2.11
|
|
183
|
-
Copyright (C) 1995-2017 Jean-loup Gailly and Mark Adler
|
|
184
|
-
|
|
185
|
-
Terms of the zlib License:
|
|
186
|
-
--------------------------------------------------------------------
|
|
187
|
-
|
|
188
|
-
This software is provided 'as-is', without any express or implied
|
|
189
|
-
warranty. In no event will the authors be held liable for any damages
|
|
190
|
-
arising from the use of this software.
|
|
191
|
-
|
|
192
|
-
Permission is granted to anyone to use this software for any purpose,
|
|
193
|
-
including commercial applications, and to alter it and redistribute it
|
|
194
|
-
freely, subject to the following restrictions:
|
|
195
|
-
|
|
196
|
-
1. The origin of this software must not be misrepresented; you must not
|
|
197
|
-
claim that you wrote the original software. If you use this software
|
|
198
|
-
in a product, an acknowledgment in the product documentation would be
|
|
199
|
-
appreciated but is not required.
|
|
200
|
-
2. Altered source versions must be plainly marked as such, and must not be
|
|
201
|
-
misrepresented as being the original software.
|
|
202
|
-
3. This notice may not be removed or altered from any source distribution.
|
|
203
|
-
|
|
204
|
-
|
|
205
|
-
Open Source Software Licensed Under the BSD 3-Clause License:
|
|
206
|
-
----------------------------------------------------------------------------------------
|
|
207
|
-
1. pybind11 v2.5.0
|
|
208
|
-
Copyright (c) 2016 Wenzel Jakob <wenzel.jakob@epfl.ch>, All rights reserved.
|
|
209
|
-
|
|
210
|
-
Terms of the BSD 3-Clause License:
|
|
211
|
-
--------------------------------------------------------------------
|
|
212
|
-
|
|
213
|
-
Redistribution and use in source and binary forms, with or without modification, are permitted provided that the following conditions are met:
|
|
214
|
-
|
|
215
|
-
Redistributions of source code must retain the above copyright notice, this list of conditions and the following disclaimer.
|
|
216
|
-
Redistributions in binary form must reproduce the above copyright notice, this list of conditions and the following disclaimer in the documentation and/or other materials provided with the distribution.
|
|
217
|
-
Neither the name of [copyright holder] nor the names of its contributors may be used to endorse or promote products derived from this software without specific prior written permission.
|
|
218
|
-
|
|
219
|
-
THIS SOFTWARE IS PROVIDED BY THE COPYRIGHT HOLDERS AND CONTRIBUTORS "AS IS" AND ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE ARE DISCLAIMED. IN NO EVENT SHALL THE COPYRIGHT HOLDER OR CONTRIBUTORS BE LIABLE FOR ANY DIRECT, INDIRECT, INCIDENTAL, SPECIAL, EXEMPLARY, OR CONSEQUENTIAL DAMAGES (INCLUDING, BUT NOT LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES; LOSS OF USE, DATA, OR PROFITS; OR BUSINESS INTERRUPTION) HOWEVER CAUSED AND ON ANY THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT LIABILITY, OR TORT (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY OUT OF THE USE OF THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE.
|
|
@@ -503,6 +503,7 @@
|
|
|
503
503
|
SDKROOT = iphoneos;
|
|
504
504
|
TVOS_DEPLOYMENT_TARGET = 13.0;
|
|
505
505
|
WATCHOS_DEPLOYMENT_TARGET = 4.0;
|
|
506
|
+
XROS_DEPLOYMENT_TARGET = 1.0;
|
|
506
507
|
};
|
|
507
508
|
name = Debug;
|
|
508
509
|
};
|
|
@@ -559,6 +560,7 @@
|
|
|
559
560
|
TVOS_DEPLOYMENT_TARGET = 13.0;
|
|
560
561
|
VALIDATE_PRODUCT = YES;
|
|
561
562
|
WATCHOS_DEPLOYMENT_TARGET = 4.0;
|
|
563
|
+
XROS_DEPLOYMENT_TARGET = 1.0;
|
|
562
564
|
};
|
|
563
565
|
name = Release;
|
|
564
566
|
};
|
|
@@ -582,7 +584,7 @@
|
|
|
582
584
|
PRODUCT_NAME = "$(TARGET_NAME)";
|
|
583
585
|
SDKROOT = "";
|
|
584
586
|
SKIP_INSTALL = YES;
|
|
585
|
-
SUPPORTED_PLATFORMS = "iphonesimulator iphoneos macosx appletvsimulator appletvos";
|
|
587
|
+
SUPPORTED_PLATFORMS = "iphonesimulator iphoneos macosx appletvsimulator appletvos xrsimulator xros";
|
|
586
588
|
TARGETED_DEVICE_FAMILY = "1,2,3";
|
|
587
589
|
};
|
|
588
590
|
name = Debug;
|
|
@@ -608,7 +610,7 @@
|
|
|
608
610
|
PRODUCT_NAME = "$(TARGET_NAME)";
|
|
609
611
|
SDKROOT = "";
|
|
610
612
|
SKIP_INSTALL = YES;
|
|
611
|
-
SUPPORTED_PLATFORMS = "iphonesimulator iphoneos macosx appletvsimulator appletvos";
|
|
613
|
+
SUPPORTED_PLATFORMS = "iphonesimulator iphoneos macosx appletvsimulator appletvos xrsimulator xros";
|
|
612
614
|
TARGETED_DEVICE_FAMILY = "1,2,3";
|
|
613
615
|
};
|
|
614
616
|
name = Release;
|
package/MMKV/Core/MMKVPredef.h
CHANGED
package/MMKV/Core/MMKV_IO.cpp
CHANGED
|
@@ -49,6 +49,10 @@
|
|
|
49
49
|
# endif
|
|
50
50
|
#endif // MMKV_APPLE
|
|
51
51
|
|
|
52
|
+
#ifndef MMKV_WIN32
|
|
53
|
+
# include <unistd.h>
|
|
54
|
+
#endif
|
|
55
|
+
|
|
52
56
|
using namespace std;
|
|
53
57
|
using namespace mmkv;
|
|
54
58
|
using KVHolderRet_t = std::pair<bool, KeyValueHolder>;
|
|
@@ -1384,6 +1388,7 @@ void MMKV::trim() {
|
|
|
1384
1388
|
SCOPED_LOCK(m_lock);
|
|
1385
1389
|
MMKVInfo("prepare to trim %s", m_mmapID.c_str());
|
|
1386
1390
|
|
|
1391
|
+
SCOPED_LOCK(m_exclusiveProcessLock);
|
|
1387
1392
|
checkLoadData();
|
|
1388
1393
|
if (!isFileValid()) {
|
|
1389
1394
|
MMKVWarning("[%s] file not valid", m_mmapID.c_str());
|
|
@@ -1396,7 +1401,6 @@ void MMKV::trim() {
|
|
|
1396
1401
|
} else if (m_file->getFileSize() <= m_expectedCapacity) {
|
|
1397
1402
|
return;
|
|
1398
1403
|
}
|
|
1399
|
-
SCOPED_LOCK(m_exclusiveProcessLock);
|
|
1400
1404
|
|
|
1401
1405
|
fullWriteback();
|
|
1402
1406
|
auto oldSize = m_file->getFileSize();
|
package/MMKV/Core/MemoryFile.cpp
CHANGED
|
@@ -53,6 +53,7 @@ void tryResetFileProtection(const string &path) {
|
|
|
53
53
|
#ifdef MMKV_APPLE
|
|
54
54
|
|
|
55
55
|
#include <copyfile.h>
|
|
56
|
+
#include <unistd.h>
|
|
56
57
|
|
|
57
58
|
namespace mmkv {
|
|
58
59
|
|
|
@@ -77,7 +78,7 @@ bool tryAtomicRename(const char *src, const char *dst) {
|
|
|
77
78
|
}
|
|
78
79
|
}
|
|
79
80
|
|
|
80
|
-
unlink(src);
|
|
81
|
+
::unlink(src);
|
|
81
82
|
|
|
82
83
|
return true;
|
|
83
84
|
}
|
package/MMKV/README.md
CHANGED
|
@@ -1,6 +1,6 @@
|
|
|
1
1
|
[](https://github.com/Tencent/MMKV/blob/master/LICENSE.TXT)
|
|
2
2
|
[](https://github.com/Tencent/MMKV/pulls)
|
|
3
|
-
[](https://github.com/Tencent/MMKV/releases)
|
|
4
4
|
[](https://github.com/Tencent/MMKV/wiki/home)
|
|
5
5
|
|
|
6
6
|
中文版本请参看[这里](./README_CN.md)
|
|
@@ -28,8 +28,8 @@ Add the following lines to `build.gradle` on your app module:
|
|
|
28
28
|
|
|
29
29
|
```gradle
|
|
30
30
|
dependencies {
|
|
31
|
-
implementation 'com.tencent:mmkv:1.3.
|
|
32
|
-
// replace "1.3.
|
|
31
|
+
implementation 'com.tencent:mmkv:1.3.4'
|
|
32
|
+
// replace "1.3.4" with any available version
|
|
33
33
|
}
|
|
34
34
|
```
|
|
35
35
|
|
|
@@ -157,11 +157,11 @@ For more benchmark data, please refer to [our benchmark](https://github.com/Tenc
|
|
|
157
157
|
git clone https://github.com/Tencent/MMKV.git
|
|
158
158
|
```
|
|
159
159
|
|
|
160
|
-
2. Add `
|
|
160
|
+
2. Add `Core/core.vcxproj` to your solution;
|
|
161
161
|
3. Add `MMKV` project to your project's dependencies;
|
|
162
162
|
4. Add `$(OutDir)include` to your project's `C/C++` -> `General` -> `Additional Include Directories`;
|
|
163
163
|
5. Add `$(OutDir)` to your project's `Linker` -> `General` -> `Additional Library Directories`;
|
|
164
|
-
6. Add `
|
|
164
|
+
6. Add `mmkv.lib` to your project's `Linker` -> `Input` -> `Additional Dependencies`;
|
|
165
165
|
7. Add `#include <MMKV/MMKV.h>` to your source file and we are done.
|
|
166
166
|
|
|
167
167
|
|
|
@@ -285,6 +285,6 @@ To give clarity of what is expected of our members, MMKV has adopted the code of
|
|
|
285
285
|
|
|
286
286
|
## FAQ & Feedback
|
|
287
287
|
Check out the [FAQ](https://github.com/Tencent/MMKV/wiki/FAQ) first. Should there be any questions, don't hesitate to create [issues](https://github.com/Tencent/MMKV/issues).
|
|
288
|
-
|
|
289
|
-
## Personal Information Protection Rules
|
|
290
|
-
User privacy is taken very seriously: MMKV does not obtain, collect or upload any personal information. Please refer to the [MMKV SDK Personal Information Protection Rules](https://support.weixin.qq.com/cgi-bin/mmsupportacctnodeweb-bin/pages/aY5BAtRiO1BpoHxo) for details.
|
|
288
|
+
|
|
289
|
+
## Personal Information Protection Rules
|
|
290
|
+
User privacy is taken very seriously: MMKV does not obtain, collect or upload any personal information. Please refer to the [MMKV SDK Personal Information Protection Rules](https://support.weixin.qq.com/cgi-bin/mmsupportacctnodeweb-bin/pages/aY5BAtRiO1BpoHxo) for details.
|
package/README.md
CHANGED
|
@@ -186,7 +186,13 @@ storage.recrypt(undefined)
|
|
|
186
186
|
### Buffers
|
|
187
187
|
|
|
188
188
|
```js
|
|
189
|
-
|
|
189
|
+
const buffer = new ArrayBuffer(3)
|
|
190
|
+
const dataWriter = new Uint8Array(buffer)
|
|
191
|
+
dataWriter[0] = 1
|
|
192
|
+
dataWriter[1] = 100
|
|
193
|
+
dataWriter[2] = 255
|
|
194
|
+
storage.set('someToken', buffer)
|
|
195
|
+
|
|
190
196
|
const buffer = storage.getBuffer('someToken')
|
|
191
197
|
console.log(buffer) // [1, 100, 255]
|
|
192
198
|
```
|
package/android/CMakeLists.txt
CHANGED
|
@@ -1,41 +1,33 @@
|
|
|
1
|
-
project(ReactNativeMMKV)
|
|
2
1
|
cmake_minimum_required(VERSION 3.9.0)
|
|
2
|
+
project(ReactNativeMmkv)
|
|
3
3
|
|
|
4
|
-
set (PACKAGE_NAME "react-native-mmkv")
|
|
5
|
-
set (BUILD_DIR ${CMAKE_SOURCE_DIR}/build)
|
|
6
4
|
set(CMAKE_VERBOSE_MAKEFILE ON)
|
|
7
5
|
set(CMAKE_CXX_STANDARD 17)
|
|
8
6
|
|
|
9
|
-
#
|
|
10
|
-
|
|
11
|
-
|
|
12
|
-
../cpp
|
|
13
|
-
)
|
|
14
|
-
|
|
15
|
-
# Add MMKV core sources
|
|
16
|
-
add_subdirectory(../MMKV/Core core)
|
|
17
|
-
# Add react-native-mmkv sources
|
|
18
|
-
add_library(reactnativemmkv # <-- Library name
|
|
7
|
+
# Compile sources
|
|
8
|
+
add_library(
|
|
9
|
+
react-native-mmkv
|
|
19
10
|
SHARED
|
|
11
|
+
src/main/cpp/AndroidLogger.cpp
|
|
20
12
|
src/main/cpp/cpp-adapter.cpp
|
|
21
|
-
|
|
22
|
-
../cpp/
|
|
23
|
-
)
|
|
24
|
-
# Configure C++ 17
|
|
25
|
-
set_target_properties(
|
|
26
|
-
reactnativemmkv PROPERTIES
|
|
27
|
-
CXX_STANDARD 17
|
|
28
|
-
CXX_EXTENSIONS OFF
|
|
29
|
-
POSITION_INDEPENDENT_CODE ON
|
|
13
|
+
../cpp/MmkvHostObject.cpp
|
|
14
|
+
../cpp/NativeMmkvModule.cpp
|
|
30
15
|
)
|
|
31
16
|
|
|
32
|
-
|
|
17
|
+
# Add headers search paths
|
|
18
|
+
target_include_directories(react-native-mmkv PUBLIC ../MMKV/Core)
|
|
19
|
+
target_include_directories(react-native-mmkv PUBLIC ../cpp)
|
|
20
|
+
|
|
21
|
+
# Add MMKV core dependency
|
|
22
|
+
add_subdirectory(../MMKV/Core core)
|
|
23
|
+
|
|
24
|
+
# Add android/log dependency
|
|
33
25
|
find_library(log-lib log)
|
|
34
26
|
|
|
35
27
|
target_link_libraries(
|
|
36
|
-
|
|
37
|
-
core
|
|
38
|
-
${log-lib}
|
|
39
|
-
|
|
40
|
-
|
|
28
|
+
react-native-mmkv
|
|
29
|
+
core # <-- MMKV core
|
|
30
|
+
${log-lib} # <-- Logcat logger
|
|
31
|
+
android # <-- Android JNI core
|
|
32
|
+
react_codegen_RNMmkvSpec # <-- Generated Specs from CodeGen
|
|
41
33
|
)
|
package/android/build.gradle
CHANGED
|
@@ -1,139 +1,109 @@
|
|
|
1
|
-
import com.android.Version
|
|
2
|
-
|
|
3
|
-
def agpVersion = com.android.Version.ANDROID_GRADLE_PLUGIN_VERSION
|
|
4
|
-
def agpVersionMajor = agpVersion.tokenize('.')[0].toInteger()
|
|
5
|
-
def androidManifestPath = agpVersionMajor >= 7 ? 'src/main/AndroidManifest.xml' : 'src/hasNamespace/AndroidManifest.xml'
|
|
6
|
-
|
|
7
1
|
buildscript {
|
|
8
2
|
repositories {
|
|
9
|
-
maven {
|
|
10
|
-
url "https://plugins.gradle.org/m2/"
|
|
11
|
-
}
|
|
12
|
-
mavenCentral()
|
|
13
3
|
google()
|
|
4
|
+
mavenCentral()
|
|
14
5
|
}
|
|
15
6
|
|
|
16
7
|
dependencies {
|
|
17
|
-
classpath
|
|
8
|
+
classpath "com.android.tools.build:gradle:7.2.1"
|
|
18
9
|
}
|
|
19
10
|
}
|
|
20
11
|
|
|
21
|
-
def resolveBuildType() {
|
|
22
|
-
Gradle gradle = getGradle()
|
|
23
|
-
String tskReqStr = gradle.getStartParameter().getTaskRequests()['args'].toString()
|
|
24
|
-
|
|
25
|
-
return tskReqStr.contains('Release') ? 'release' : 'debug'
|
|
26
|
-
}
|
|
27
|
-
|
|
28
12
|
def isNewArchitectureEnabled() {
|
|
29
|
-
|
|
30
|
-
// - Set `newArchEnabled` to true inside the `gradle.properties` file
|
|
31
|
-
// - Invoke gradle with `-newArchEnabled=true`
|
|
32
|
-
// - Set an environment variable `ORG_GRADLE_PROJECT_newArchEnabled=true`
|
|
33
|
-
return project.hasProperty("newArchEnabled") && project.newArchEnabled == "true"
|
|
13
|
+
return rootProject.hasProperty("newArchEnabled") && rootProject.getProperty("newArchEnabled") == "true"
|
|
34
14
|
}
|
|
35
15
|
|
|
16
|
+
apply plugin: "com.android.library"
|
|
17
|
+
|
|
36
18
|
if (isNewArchitectureEnabled()) {
|
|
37
|
-
apply plugin:
|
|
19
|
+
apply plugin: "com.facebook.react"
|
|
38
20
|
}
|
|
39
|
-
apply plugin: 'com.android.library'
|
|
40
21
|
|
|
41
|
-
def
|
|
42
|
-
rootProject.ext.has(
|
|
22
|
+
def getExtOrDefault(name) {
|
|
23
|
+
return rootProject.ext.has(name) ? rootProject.ext.get(name) : project.properties["Mmkv_" + name]
|
|
43
24
|
}
|
|
44
25
|
|
|
45
|
-
def
|
|
46
|
-
|
|
47
|
-
return value ? value.split(",") : ["armeabi-v7a", "x86", "x86_64", "arm64-v8a"]
|
|
26
|
+
def getExtOrIntegerDefault(name) {
|
|
27
|
+
return rootProject.ext.has(name) ? rootProject.ext.get(name) : (project.properties["Mmkv_" + name]).toInteger()
|
|
48
28
|
}
|
|
49
29
|
|
|
50
|
-
|
|
51
|
-
|
|
30
|
+
def supportsNamespace() {
|
|
31
|
+
def parsed = com.android.Version.ANDROID_GRADLE_PLUGIN_VERSION.tokenize('.')
|
|
32
|
+
def major = parsed[0].toInteger()
|
|
33
|
+
def minor = parsed[1].toInteger()
|
|
34
|
+
|
|
35
|
+
// Namespace support was added in 7.3.0
|
|
36
|
+
return (major == 7 && minor >= 3) || major >= 8
|
|
52
37
|
}
|
|
53
38
|
|
|
54
39
|
android {
|
|
55
|
-
|
|
56
|
-
|
|
57
|
-
namespace = "com.reactnativemmkv"
|
|
58
|
-
}
|
|
40
|
+
if (supportsNamespace()) {
|
|
41
|
+
namespace "com.mrousavy.mmkv"
|
|
59
42
|
|
|
60
|
-
|
|
61
|
-
|
|
62
|
-
|
|
43
|
+
sourceSets {
|
|
44
|
+
main {
|
|
45
|
+
manifest.srcFile "src/main/AndroidManifestNew.xml"
|
|
63
46
|
}
|
|
64
|
-
}
|
|
65
|
-
|
|
66
|
-
sourceSets {
|
|
67
|
-
main {
|
|
68
|
-
manifest.srcFile androidManifestPath
|
|
69
47
|
}
|
|
70
48
|
}
|
|
71
49
|
|
|
72
|
-
|
|
73
|
-
|
|
74
|
-
|
|
75
|
-
|
|
76
|
-
|
|
77
|
-
|
|
78
|
-
|
|
50
|
+
ndkVersion getExtOrDefault("ndkVersion")
|
|
51
|
+
compileSdkVersion getExtOrIntegerDefault("compileSdkVersion")
|
|
52
|
+
|
|
53
|
+
defaultConfig {
|
|
54
|
+
minSdkVersion getExtOrIntegerDefault("minSdkVersion")
|
|
55
|
+
targetSdkVersion getExtOrIntegerDefault("targetSdkVersion")
|
|
56
|
+
buildConfigField "boolean", "IS_NEW_ARCHITECTURE_ENABLED", isNewArchitectureEnabled().toString()
|
|
79
57
|
}
|
|
80
58
|
|
|
81
59
|
buildFeatures {
|
|
82
|
-
|
|
60
|
+
buildConfig true
|
|
83
61
|
}
|
|
84
62
|
|
|
85
|
-
|
|
86
|
-
|
|
87
|
-
|
|
88
|
-
versionCode 1
|
|
89
|
-
versionName "1.0"
|
|
90
|
-
buildConfigField "boolean", "IS_NEW_ARCHITECTURE_ENABLED", isNewArchitectureEnabled().toString()
|
|
91
|
-
externalNativeBuild {
|
|
92
|
-
cmake {
|
|
93
|
-
cppFlags "-O2 -frtti -fexceptions -Wall -Wno-unused-variable -fstack-protector-all"
|
|
94
|
-
arguments "-DANDROID_STL=c++_shared"
|
|
95
|
-
abiFilters (*reactNativeArchitectures())
|
|
96
|
-
}
|
|
63
|
+
buildTypes {
|
|
64
|
+
release {
|
|
65
|
+
minifyEnabled false
|
|
97
66
|
}
|
|
98
67
|
}
|
|
99
68
|
|
|
69
|
+
lintOptions {
|
|
70
|
+
disable "GradleCompatible"
|
|
71
|
+
}
|
|
72
|
+
|
|
100
73
|
compileOptions {
|
|
101
74
|
sourceCompatibility JavaVersion.VERSION_1_8
|
|
102
75
|
targetCompatibility JavaVersion.VERSION_1_8
|
|
103
76
|
}
|
|
104
77
|
|
|
105
|
-
|
|
106
|
-
|
|
107
|
-
|
|
78
|
+
sourceSets {
|
|
79
|
+
main {
|
|
80
|
+
if (isNewArchitectureEnabled()) {
|
|
81
|
+
java.srcDirs += [
|
|
82
|
+
// This is needed to build Kotlin project with NewArch enabled
|
|
83
|
+
"${project.buildDir}/generated/source/codegen/java"
|
|
84
|
+
]
|
|
85
|
+
}
|
|
108
86
|
}
|
|
109
87
|
}
|
|
110
|
-
packagingOptions {
|
|
111
|
-
doNotStrip resolveBuildType() == 'debug' ? "**/**/*.so" : ''
|
|
112
|
-
excludes = [
|
|
113
|
-
"META-INF",
|
|
114
|
-
"META-INF/**",
|
|
115
|
-
"**/libjsi.so",
|
|
116
|
-
"**/libc++_shared.so"
|
|
117
|
-
]
|
|
118
|
-
}
|
|
119
88
|
}
|
|
120
89
|
|
|
90
|
+
repositories {
|
|
91
|
+
mavenCentral()
|
|
92
|
+
google()
|
|
93
|
+
}
|
|
94
|
+
|
|
95
|
+
|
|
121
96
|
dependencies {
|
|
97
|
+
// For < 0.71, this will be from the local maven repo
|
|
98
|
+
// For > 0.71, this will be replaced by `com.facebook.react:react-android:$version` by react gradle plugin
|
|
122
99
|
//noinspection GradleDynamicVersion
|
|
123
|
-
implementation
|
|
100
|
+
implementation "com.facebook.react:react-native:+"
|
|
124
101
|
}
|
|
125
102
|
|
|
126
|
-
|
|
127
|
-
|
|
128
|
-
|
|
129
|
-
|
|
130
|
-
|
|
131
|
-
}
|
|
132
|
-
}
|
|
133
|
-
// We want to add a dependency for both configureCMakeRelease and configureCMakeRelWithDebInfo
|
|
134
|
-
if (task.name.contains("configureCMakeRel")) {
|
|
135
|
-
rootProject.getTasksByName("packageReactNdkReleaseLibs", true).forEach {
|
|
136
|
-
task.dependsOn(it)
|
|
137
|
-
}
|
|
103
|
+
if (isNewArchitectureEnabled()) {
|
|
104
|
+
react {
|
|
105
|
+
jsRootDir = file("../src/")
|
|
106
|
+
libraryName = "Mmkv"
|
|
107
|
+
codegenJavaPackageName = "com.mrousavy.mmkv"
|
|
138
108
|
}
|
|
139
109
|
}
|
|
@@ -1,6 +1,5 @@
|
|
|
1
|
-
|
|
2
|
-
|
|
1
|
+
Mmkv_kotlinVersion=1.7.0
|
|
2
|
+
Mmkv_minSdkVersion=21
|
|
3
3
|
Mmkv_targetSdkVersion=31
|
|
4
|
-
|
|
5
|
-
|
|
6
|
-
org.gradle.jvmargs=-Xmx2048m -XX:MaxPermSize=512m -XX:+HeapDumpOnOutOfMemoryError -Dfile.encoding=UTF-8
|
|
4
|
+
Mmkv_compileSdkVersion=31
|
|
5
|
+
Mmkv_ndkversion=21.4.7075529
|