react-native-legal 1.3.1 → 1.4.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/README.md +1 -1
- package/android/src/main/java/com/reactnativelegal/ReactNativeLegalModuleImpl.kt +43 -0
- package/android/src/newarch/java/com/reactnativelegal/ReactNativeLegalModule.kt +9 -0
- package/android/src/oldarch/java/com/reactnativelegal/ReactNativeLegalModule.kt +9 -0
- package/bare-plugin/build/android/androidCommand.js +2 -2
- package/bare-plugin/build/android/utils.js +5 -5
- package/bare-plugin/build/ios/iosCommand.js +2 -2
- package/bare-plugin/build/ios/utils.js +3 -3
- package/bare-plugin/src/android/androidCommand.ts +1 -1
- package/bare-plugin/src/android/utils.ts +1 -1
- package/bare-plugin/src/ios/iosCommand.ts +1 -1
- package/bare-plugin/src/ios/utils.ts +1 -1
- package/ios/ReactNativeLegalModule.mm +9 -0
- package/ios/ReactNativeLegalModuleImpl.swift +26 -0
- package/lib/commonjs/NativeReactNativeLegal.js.map +1 -1
- package/lib/commonjs/ReactNativeLegal.android.js +3 -0
- package/lib/commonjs/ReactNativeLegal.android.js.map +1 -1
- package/lib/commonjs/ReactNativeLegal.ios.js +3 -0
- package/lib/commonjs/ReactNativeLegal.ios.js.map +1 -1
- package/lib/commonjs/ReactNativeLegal.js +5 -0
- package/lib/commonjs/ReactNativeLegal.js.map +1 -1
- package/lib/module/NativeReactNativeLegal.js.map +1 -1
- package/lib/module/ReactNativeLegal.android.js +3 -0
- package/lib/module/ReactNativeLegal.android.js.map +1 -1
- package/lib/module/ReactNativeLegal.ios.js +3 -0
- package/lib/module/ReactNativeLegal.ios.js.map +1 -1
- package/lib/module/ReactNativeLegal.js +5 -0
- package/lib/module/ReactNativeLegal.js.map +1 -1
- package/lib/typescript/NativeReactNativeLegal.d.ts +40 -0
- package/lib/typescript/NativeReactNativeLegal.d.ts.map +1 -1
- package/lib/typescript/ReactNativeLegal.android.d.ts +1 -0
- package/lib/typescript/ReactNativeLegal.android.d.ts.map +1 -1
- package/lib/typescript/ReactNativeLegal.d.ts +2 -0
- package/lib/typescript/ReactNativeLegal.d.ts.map +1 -1
- package/lib/typescript/ReactNativeLegal.ios.d.ts +1 -0
- package/lib/typescript/ReactNativeLegal.ios.d.ts.map +1 -1
- package/lib/typescript/index.d.ts +1 -0
- package/lib/typescript/index.d.ts.map +1 -1
- package/package.json +1 -1
- package/plugin/build/android/withAndroidLegal.js +2 -2
- package/plugin/build/ios/withIosLegal.js +2 -2
- package/plugin/src/android/withAndroidLegal.ts +1 -1
- package/plugin/src/ios/withIosLegal.ts +1 -1
- package/plugin-utils/build/ios.js +8 -8
- package/plugin-utils/src/ios.ts +2 -2
- package/src/NativeReactNativeLegal.ts +43 -0
- package/src/ReactNativeLegal.android.ts +3 -0
- package/src/ReactNativeLegal.ios.ts +3 -0
- package/src/ReactNativeLegal.ts +5 -0
- package/src/index.ts +1 -0
package/README.md
CHANGED
|
@@ -190,7 +190,7 @@ You can use the `@callstack/licenses` package to access the core functionalities
|
|
|
190
190
|
|
|
191
191
|
## Contributing
|
|
192
192
|
|
|
193
|
-
See the [contributing guide](./CONTRIBUTING) to learn how to contribute to the repository and the development workflow.
|
|
193
|
+
See the [contributing guide](./CONTRIBUTING.md) to learn how to contribute to the repository and the development workflow.
|
|
194
194
|
|
|
195
195
|
## Acknowledgements
|
|
196
196
|
|
|
@@ -1,12 +1,20 @@
|
|
|
1
1
|
package com.reactnativelegal
|
|
2
2
|
|
|
3
3
|
import android.content.Intent
|
|
4
|
+
import android.os.Bundle
|
|
5
|
+
import androidx.core.os.bundleOf
|
|
6
|
+
import com.facebook.react.bridge.Arguments
|
|
4
7
|
import com.facebook.react.bridge.ReactApplicationContext
|
|
8
|
+
import com.facebook.react.bridge.WritableMap
|
|
9
|
+
import com.mikepenz.aboutlibraries.Libs
|
|
5
10
|
import com.mikepenz.aboutlibraries.LibsBuilder
|
|
11
|
+
import com.mikepenz.aboutlibraries.util.withContext
|
|
6
12
|
|
|
7
13
|
object ReactNativeLegalModuleImpl {
|
|
8
14
|
const val NAME = "ReactNativeLegalModule"
|
|
9
15
|
|
|
16
|
+
private var cachedData: List<Bundle>? = null
|
|
17
|
+
|
|
10
18
|
fun launchLicenseListScreen(reactContext: ReactApplicationContext, licenseHeaderText: String) {
|
|
11
19
|
val context = reactContext.currentActivity ?: return
|
|
12
20
|
val intent =
|
|
@@ -17,4 +25,39 @@ object ReactNativeLegalModuleImpl {
|
|
|
17
25
|
|
|
18
26
|
context.startActivity(intent)
|
|
19
27
|
}
|
|
28
|
+
|
|
29
|
+
fun getLibraries(reactContext: ReactApplicationContext): WritableMap {
|
|
30
|
+
if (cachedData == null) {
|
|
31
|
+
cachedData = retrieveLibrariesArray(reactContext)
|
|
32
|
+
}
|
|
33
|
+
|
|
34
|
+
val libraries = cachedData ?: emptyList<Bundle>()
|
|
35
|
+
return Arguments.createMap().apply { putArray("data", Arguments.fromList(libraries)) }
|
|
36
|
+
}
|
|
37
|
+
|
|
38
|
+
private fun retrieveLibrariesArray(reactContext: ReactApplicationContext): List<Bundle>? {
|
|
39
|
+
val context = reactContext.currentActivity ?: return null
|
|
40
|
+
|
|
41
|
+
val libraries = Libs.Builder().withContext(context).build().libraries
|
|
42
|
+
|
|
43
|
+
return libraries.map { library ->
|
|
44
|
+
bundleOf(
|
|
45
|
+
"id" to library.uniqueId,
|
|
46
|
+
"name" to library.name,
|
|
47
|
+
"description" to library.description,
|
|
48
|
+
"website" to library.website,
|
|
49
|
+
"developers" to library.developers.joinToString(),
|
|
50
|
+
"organization" to library.organization?.name,
|
|
51
|
+
"licenses" to
|
|
52
|
+
library.licenses.map { license ->
|
|
53
|
+
bundleOf(
|
|
54
|
+
"name" to license.name,
|
|
55
|
+
"url" to license.url,
|
|
56
|
+
"year" to license.year,
|
|
57
|
+
"licenseContent" to (license.licenseContent ?: ""),
|
|
58
|
+
)
|
|
59
|
+
},
|
|
60
|
+
)
|
|
61
|
+
}
|
|
62
|
+
}
|
|
20
63
|
}
|
|
@@ -1,5 +1,6 @@
|
|
|
1
1
|
package com.reactnativelegal
|
|
2
2
|
|
|
3
|
+
import com.facebook.react.bridge.Promise
|
|
3
4
|
import com.facebook.react.bridge.ReactApplicationContext
|
|
4
5
|
import com.facebook.react.module.annotations.ReactModule
|
|
5
6
|
|
|
@@ -13,6 +14,14 @@ class ReactNativeLegalModule(reactContext: ReactApplicationContext) :
|
|
|
13
14
|
)
|
|
14
15
|
}
|
|
15
16
|
|
|
17
|
+
override fun getLibrariesAsync(promise: Promise?) {
|
|
18
|
+
try {
|
|
19
|
+
promise?.resolve(ReactNativeLegalModuleImpl.getLibraries(reactApplicationContext))
|
|
20
|
+
} catch (e: Exception) {
|
|
21
|
+
promise?.reject(e)
|
|
22
|
+
}
|
|
23
|
+
}
|
|
24
|
+
|
|
16
25
|
companion object {
|
|
17
26
|
const val NAME = ReactNativeLegalModuleImpl.NAME
|
|
18
27
|
}
|
|
@@ -18,6 +18,15 @@ class ReactNativeLegalModule(private val reactContext: ReactApplicationContext)
|
|
|
18
18
|
)
|
|
19
19
|
}
|
|
20
20
|
|
|
21
|
+
@ReactMethod
|
|
22
|
+
fun getLibrariesAsync(promise: Promise?) {
|
|
23
|
+
try {
|
|
24
|
+
promise?.resolve(ReactNativeLegalModuleImpl.getLibraries(reactApplicationContext))
|
|
25
|
+
} catch (e: Exception) {
|
|
26
|
+
promise?.reject(e)
|
|
27
|
+
}
|
|
28
|
+
}
|
|
29
|
+
|
|
21
30
|
companion object {
|
|
22
31
|
const val NAME = ReactNativeLegalModuleImpl.NAME
|
|
23
32
|
}
|
|
@@ -4,7 +4,7 @@ var __importDefault = (this && this.__importDefault) || function (mod) {
|
|
|
4
4
|
};
|
|
5
5
|
Object.defineProperty(exports, "__esModule", { value: true });
|
|
6
6
|
exports.androidCommand = void 0;
|
|
7
|
-
const
|
|
7
|
+
const node_path_1 = __importDefault(require("node:path"));
|
|
8
8
|
const licenses_1 = require("@callstack/licenses");
|
|
9
9
|
const addListActivity_1 = require("./addListActivity");
|
|
10
10
|
const applyAndConfigureAboutLibrariesPlugin_1 = require("./applyAndConfigureAboutLibrariesPlugin");
|
|
@@ -16,7 +16,7 @@ const declareAboutLibrariesPlugin_1 = require("./declareAboutLibrariesPlugin");
|
|
|
16
16
|
* installs & configures AboutLibraries Gradle plugin and adds Android Activity with a list of dependencies and their licenses
|
|
17
17
|
*/
|
|
18
18
|
function androidCommand(androidProjectPath) {
|
|
19
|
-
const licenses = (0, licenses_1.scanDependencies)(
|
|
19
|
+
const licenses = (0, licenses_1.scanDependencies)(node_path_1.default.join(node_path_1.default.resolve(androidProjectPath, '..'), 'package.json'));
|
|
20
20
|
(0, licenses_1.writeAboutLibrariesNPMOutput)(licenses, androidProjectPath);
|
|
21
21
|
(0, declareAboutLibrariesPlugin_1.declareAboutLibrariesPlugin)(androidProjectPath);
|
|
22
22
|
(0, applyAndConfigureAboutLibrariesPlugin_1.applyAndConfigureAboutLibrariesPlugin)(androidProjectPath);
|
|
@@ -4,7 +4,7 @@ var __importDefault = (this && this.__importDefault) || function (mod) {
|
|
|
4
4
|
};
|
|
5
5
|
Object.defineProperty(exports, "__esModule", { value: true });
|
|
6
6
|
exports.modifyXMLFileContent = exports.modifyFileContent = void 0;
|
|
7
|
-
const
|
|
7
|
+
const node_fs_1 = __importDefault(require("node:fs"));
|
|
8
8
|
const xml2js_1 = __importDefault(require("xml2js"));
|
|
9
9
|
/**
|
|
10
10
|
* Used to modify a file at a specified file path
|
|
@@ -13,9 +13,9 @@ const xml2js_1 = __importDefault(require("xml2js"));
|
|
|
13
13
|
* The modified result should be returned from a callback parameter as a utf-8 string
|
|
14
14
|
*/
|
|
15
15
|
function modifyFileContent(filepath, transformFile) {
|
|
16
|
-
const content =
|
|
16
|
+
const content = node_fs_1.default.readFileSync(filepath, { encoding: 'utf-8' });
|
|
17
17
|
const modifiedContent = transformFile(content);
|
|
18
|
-
|
|
18
|
+
node_fs_1.default.writeFileSync(filepath, modifiedContent);
|
|
19
19
|
}
|
|
20
20
|
exports.modifyFileContent = modifyFileContent;
|
|
21
21
|
/**
|
|
@@ -26,12 +26,12 @@ exports.modifyFileContent = modifyFileContent;
|
|
|
26
26
|
*/
|
|
27
27
|
// eslint-disable-next-line @typescript-eslint/no-explicit-any
|
|
28
28
|
async function modifyXMLFileContent(filepath, transformXMLFile) {
|
|
29
|
-
const content =
|
|
29
|
+
const content = node_fs_1.default.readFileSync(filepath, { encoding: 'utf-8' });
|
|
30
30
|
const parser = new xml2js_1.default.Parser();
|
|
31
31
|
const obj = await parser.parseStringPromise(content);
|
|
32
32
|
const modifiedObj = transformXMLFile(obj);
|
|
33
33
|
const builder = new xml2js_1.default.Builder({ headless: true });
|
|
34
34
|
const modifiedContent = builder.buildObject(modifiedObj);
|
|
35
|
-
|
|
35
|
+
node_fs_1.default.writeFileSync(filepath, modifiedContent);
|
|
36
36
|
}
|
|
37
37
|
exports.modifyXMLFileContent = modifyXMLFileContent;
|
|
@@ -4,7 +4,7 @@ var __importDefault = (this && this.__importDefault) || function (mod) {
|
|
|
4
4
|
};
|
|
5
5
|
Object.defineProperty(exports, "__esModule", { value: true });
|
|
6
6
|
exports.iosCommand = void 0;
|
|
7
|
-
const
|
|
7
|
+
const node_path_1 = __importDefault(require("node:path"));
|
|
8
8
|
const licenses_1 = require("@callstack/licenses");
|
|
9
9
|
const addSettingsBundle_1 = require("./addSettingsBundle");
|
|
10
10
|
const registerLicensePlistBuildPhase_1 = require("./registerLicensePlistBuildPhase");
|
|
@@ -15,7 +15,7 @@ const registerLicensePlistBuildPhase_1 = require("./registerLicensePlistBuildPha
|
|
|
15
15
|
* configures Settings.bundle and registers a shell script generating LicensePlist metadata for iOS dependencies
|
|
16
16
|
*/
|
|
17
17
|
function iosCommand(iosProjectPath) {
|
|
18
|
-
const licenses = (0, licenses_1.scanDependencies)(
|
|
18
|
+
const licenses = (0, licenses_1.scanDependencies)(node_path_1.default.join(node_path_1.default.resolve(iosProjectPath, '..'), 'package.json'));
|
|
19
19
|
(0, licenses_1.writeLicensePlistNPMOutput)(licenses, iosProjectPath);
|
|
20
20
|
(0, addSettingsBundle_1.addSettingsBundle)(iosProjectPath);
|
|
21
21
|
(0, registerLicensePlistBuildPhase_1.registerLicensePlistBuildPhase)(iosProjectPath);
|
|
@@ -4,7 +4,7 @@ var __importDefault = (this && this.__importDefault) || function (mod) {
|
|
|
4
4
|
};
|
|
5
5
|
Object.defineProperty(exports, "__esModule", { value: true });
|
|
6
6
|
exports.getIOSPbxProj = exports.getIOSProjectName = exports.addToAllPbxResourcesBuildPhases = exports.getAllApplicationNativeTargets = exports.getFirstApplicationNativeTarget = void 0;
|
|
7
|
-
const
|
|
7
|
+
const node_path_1 = __importDefault(require("node:path"));
|
|
8
8
|
const glob_1 = __importDefault(require("glob"));
|
|
9
9
|
const xcode_1 = __importDefault(require("xcode"));
|
|
10
10
|
const ignoredPaths = ['**/@(Carthage|Pods|vendor|node_modules)/**'];
|
|
@@ -74,7 +74,7 @@ function getIOSProjectName(iosProjectPath) {
|
|
|
74
74
|
nodir: true,
|
|
75
75
|
ignore: ignoredPaths,
|
|
76
76
|
});
|
|
77
|
-
return
|
|
77
|
+
return node_path_1.default.basename(node_path_1.default.dirname(appDelegatePath));
|
|
78
78
|
}
|
|
79
79
|
exports.getIOSProjectName = getIOSProjectName;
|
|
80
80
|
/**
|
|
@@ -88,7 +88,7 @@ function getIOSPbxProj(iosProjectPath) {
|
|
|
88
88
|
nodir: false,
|
|
89
89
|
ignore: ignoredPaths,
|
|
90
90
|
});
|
|
91
|
-
const pbxprojPath =
|
|
91
|
+
const pbxprojPath = node_path_1.default.join(xcodeprojPath, 'project.pbxproj');
|
|
92
92
|
const pbxproj = xcode_1.default.project(pbxprojPath);
|
|
93
93
|
pbxproj.parseSync();
|
|
94
94
|
return { pbxproj, pbxprojPath };
|
|
@@ -22,6 +22,15 @@ RCT_EXPORT_METHOD(launchLicenseListScreen : (NSString *)licenseHeaderText)
|
|
|
22
22
|
[ReactNativeLegalModuleImpl launchLicenseListScreenWithLicenseHeaderText:licenseHeaderText];
|
|
23
23
|
}
|
|
24
24
|
|
|
25
|
+
RCT_EXPORT_METHOD(getLibrariesAsync : (RCTPromiseResolveBlock)resolve reject : (RCTPromiseRejectBlock)reject)
|
|
26
|
+
{
|
|
27
|
+
@try {
|
|
28
|
+
resolve([ReactNativeLegalModuleImpl getLibraries]);
|
|
29
|
+
} @catch (NSException *err) {
|
|
30
|
+
reject(err.name, err.reason, nil);
|
|
31
|
+
}
|
|
32
|
+
}
|
|
33
|
+
|
|
25
34
|
#if RCT_NEW_ARCH_ENABLED
|
|
26
35
|
- (std::shared_ptr<facebook::react::TurboModule>)getTurboModule:
|
|
27
36
|
(const facebook::react::ObjCTurboModule::InitParams &)params
|
|
@@ -31,6 +31,32 @@ public class ReactNativeLegalModuleImpl: NSObject {
|
|
|
31
31
|
}
|
|
32
32
|
}
|
|
33
33
|
|
|
34
|
+
@objc public static func getLibraries() -> [String: Any] {
|
|
35
|
+
guard
|
|
36
|
+
let settingsBundleUrl = Bundle.main.url(forResource: "Settings", withExtension: "bundle"),
|
|
37
|
+
let settingsBundle = Bundle(url: settingsBundleUrl),
|
|
38
|
+
let licensePlistUrl = settingsBundle.url(
|
|
39
|
+
forResource: "com.mono0926.LicensePlist", withExtension: "plist"),
|
|
40
|
+
let dictArray = parsePlistToDictArray(fileUrl: licensePlistUrl)
|
|
41
|
+
else {
|
|
42
|
+
return [:]
|
|
43
|
+
}
|
|
44
|
+
|
|
45
|
+
let libraries = parseRawLicenseMetadataToArray(
|
|
46
|
+
rawLicenses: getChildPaneSpecifiers(dictArray: dictArray),
|
|
47
|
+
licensePlistUrl: licensePlistUrl
|
|
48
|
+
)
|
|
49
|
+
|
|
50
|
+
return [
|
|
51
|
+
"data": libraries.map({ library in
|
|
52
|
+
[
|
|
53
|
+
"id": "library-\(library.name ?? "")", "name": library.name ?? "",
|
|
54
|
+
"licenses": [["licenseContent": library.content ?? ""]],
|
|
55
|
+
]
|
|
56
|
+
})
|
|
57
|
+
]
|
|
58
|
+
}
|
|
59
|
+
|
|
34
60
|
private static func getChildPaneSpecifiers(dictArray: [[String: Any]]) -> [[String: Any]] {
|
|
35
61
|
return
|
|
36
62
|
dictArray
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"names":["_reactNative","require","_default","TurboModuleRegistry","getEnforcing","exports","default"],"sourceRoot":"../../src","sources":["NativeReactNativeLegal.ts"],"mappings":";;;;;;AACA,IAAAA,YAAA,GAAAC,OAAA;AAAmD,IAAAC,QAAA,
|
|
1
|
+
{"version":3,"names":["_reactNative","require","_default","TurboModuleRegistry","getEnforcing","exports","default"],"sourceRoot":"../../src","sources":["NativeReactNativeLegal.ts"],"mappings":";;;;;;AACA,IAAAA,YAAA,GAAAC,OAAA;AAAmD,IAAAC,QAAA,GAiDpCC,gCAAmB,CAACC,YAAY,CAAO,wBAAwB,CAAC;AAAAC,OAAA,CAAAC,OAAA,GAAAJ,QAAA"}
|
|
@@ -7,6 +7,9 @@ exports.ReactNativeLegal = void 0;
|
|
|
7
7
|
var _NativeReactNativeLegal = _interopRequireDefault(require("./NativeReactNativeLegal"));
|
|
8
8
|
function _interopRequireDefault(obj) { return obj && obj.__esModule ? obj : { default: obj }; }
|
|
9
9
|
const ReactNativeLegal = {
|
|
10
|
+
getLibrariesAsync: () => {
|
|
11
|
+
return _NativeReactNativeLegal.default.getLibrariesAsync();
|
|
12
|
+
},
|
|
10
13
|
launchLicenseListScreen: licenseHeaderText => {
|
|
11
14
|
/**
|
|
12
15
|
* On Android, the licenses list is displayed as a custom activity
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"names":["_NativeReactNativeLegal","_interopRequireDefault","require","obj","__esModule","default","ReactNativeLegal","
|
|
1
|
+
{"version":3,"names":["_NativeReactNativeLegal","_interopRequireDefault","require","obj","__esModule","default","ReactNativeLegal","getLibrariesAsync","NativeReactNativeLegal","launchLicenseListScreen","licenseHeaderText","exports"],"sourceRoot":"../../src","sources":["ReactNativeLegal.android.ts"],"mappings":";;;;;;AAAA,IAAAA,uBAAA,GAAAC,sBAAA,CAAAC,OAAA;AAA8D,SAAAD,uBAAAE,GAAA,WAAAA,GAAA,IAAAA,GAAA,CAAAC,UAAA,GAAAD,GAAA,KAAAE,OAAA,EAAAF,GAAA;AAEvD,MAAMG,gBAAgB,GAAG;EAC9BC,iBAAiB,EAAEA,CAAA,KAAM;IACvB,OAAOC,+BAAsB,CAACD,iBAAiB,CAAC,CAAC;EACnD,CAAC;EACDE,uBAAuB,EAAGC,iBAA0B,IAAK;IACvD;AACJ;AACA;IACIF,+BAAsB,CAACC,uBAAuB,CAACC,iBAAiB,IAAI,cAAc,CAAC;EACrF;AACF,CAAC;AAACC,OAAA,CAAAL,gBAAA,GAAAA,gBAAA"}
|
|
@@ -7,6 +7,9 @@ exports.ReactNativeLegal = void 0;
|
|
|
7
7
|
var _NativeReactNativeLegal = _interopRequireDefault(require("./NativeReactNativeLegal"));
|
|
8
8
|
function _interopRequireDefault(obj) { return obj && obj.__esModule ? obj : { default: obj }; }
|
|
9
9
|
const ReactNativeLegal = {
|
|
10
|
+
getLibrariesAsync: () => {
|
|
11
|
+
return _NativeReactNativeLegal.default.getLibrariesAsync();
|
|
12
|
+
},
|
|
10
13
|
launchLicenseListScreen: licenseHeaderText => {
|
|
11
14
|
/**
|
|
12
15
|
* On iOS, the licenses list is displayed as a custom table view controller
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"names":["_NativeReactNativeLegal","_interopRequireDefault","require","obj","__esModule","default","ReactNativeLegal","
|
|
1
|
+
{"version":3,"names":["_NativeReactNativeLegal","_interopRequireDefault","require","obj","__esModule","default","ReactNativeLegal","getLibrariesAsync","NativeReactNativeLegal","launchLicenseListScreen","licenseHeaderText","exports"],"sourceRoot":"../../src","sources":["ReactNativeLegal.ios.ts"],"mappings":";;;;;;AAAA,IAAAA,uBAAA,GAAAC,sBAAA,CAAAC,OAAA;AAA8D,SAAAD,uBAAAE,GAAA,WAAAA,GAAA,IAAAA,GAAA,CAAAC,UAAA,GAAAD,GAAA,KAAAE,OAAA,EAAAF,GAAA;AAEvD,MAAMG,gBAAgB,GAAG;EAC9BC,iBAAiB,EAAEA,CAAA,KAAM;IACvB,OAAOC,+BAAsB,CAACD,iBAAiB,CAAC,CAAC;EACnD,CAAC;EACDE,uBAAuB,EAAGC,iBAA0B,IAAK;IACvD;AACJ;AACA;IACIF,+BAAsB,CAACC,uBAAuB,CAACC,iBAAiB,IAAI,cAAc,CAAC;EACrF;AACF,CAAC;AAACC,OAAA,CAAAL,gBAAA,GAAAA,gBAAA"}
|
|
@@ -5,6 +5,11 @@ Object.defineProperty(exports, "__esModule", {
|
|
|
5
5
|
});
|
|
6
6
|
exports.ReactNativeLegal = void 0;
|
|
7
7
|
const ReactNativeLegal = {
|
|
8
|
+
getLibrariesAsync: () => {
|
|
9
|
+
return Promise.resolve({
|
|
10
|
+
data: []
|
|
11
|
+
});
|
|
12
|
+
},
|
|
8
13
|
launchLicenseListScreen: _licenseHeaderText => {
|
|
9
14
|
//
|
|
10
15
|
}
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"names":["ReactNativeLegal","launchLicenseListScreen","_licenseHeaderText","exports"],"sourceRoot":"../../src","sources":["ReactNativeLegal.ts"],"mappings":";;;;;;
|
|
1
|
+
{"version":3,"names":["ReactNativeLegal","getLibrariesAsync","Promise","resolve","data","launchLicenseListScreen","_licenseHeaderText","exports"],"sourceRoot":"../../src","sources":["ReactNativeLegal.ts"],"mappings":";;;;;;AAEO,MAAMA,gBAAgB,GAAG;EAC9BC,iBAAiB,EAAEA,CAAA,KAAM;IACvB,OAAOC,OAAO,CAACC,OAAO,CAAkB;MAAEC,IAAI,EAAE;IAAG,CAAC,CAAC;EACvD,CAAC;EACDC,uBAAuB,EAAGC,kBAA2B,IAAK;IACxD;EAAA;AAEJ,CAAC;AAACC,OAAA,CAAAP,gBAAA,GAAAA,gBAAA"}
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"names":["TurboModuleRegistry","getEnforcing"],"sourceRoot":"../../src","sources":["NativeReactNativeLegal.ts"],"mappings":"AACA,SAASA,mBAAmB,QAAQ,cAAc;
|
|
1
|
+
{"version":3,"names":["TurboModuleRegistry","getEnforcing"],"sourceRoot":"../../src","sources":["NativeReactNativeLegal.ts"],"mappings":"AACA,SAASA,mBAAmB,QAAQ,cAAc;AAiDlD,eAAeA,mBAAmB,CAACC,YAAY,CAAO,wBAAwB,CAAC"}
|
|
@@ -1,5 +1,8 @@
|
|
|
1
1
|
import NativeReactNativeLegal from './NativeReactNativeLegal';
|
|
2
2
|
export const ReactNativeLegal = {
|
|
3
|
+
getLibrariesAsync: () => {
|
|
4
|
+
return NativeReactNativeLegal.getLibrariesAsync();
|
|
5
|
+
},
|
|
3
6
|
launchLicenseListScreen: licenseHeaderText => {
|
|
4
7
|
/**
|
|
5
8
|
* On Android, the licenses list is displayed as a custom activity
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"names":["NativeReactNativeLegal","ReactNativeLegal","launchLicenseListScreen","licenseHeaderText"],"sourceRoot":"../../src","sources":["ReactNativeLegal.android.ts"],"mappings":"AAAA,OAAOA,sBAAsB,MAAM,0BAA0B;AAE7D,OAAO,MAAMC,gBAAgB,GAAG;EAC9BC,uBAAuB,EAAGC,iBAA0B,IAAK;IACvD;AACJ;AACA;
|
|
1
|
+
{"version":3,"names":["NativeReactNativeLegal","ReactNativeLegal","getLibrariesAsync","launchLicenseListScreen","licenseHeaderText"],"sourceRoot":"../../src","sources":["ReactNativeLegal.android.ts"],"mappings":"AAAA,OAAOA,sBAAsB,MAAM,0BAA0B;AAE7D,OAAO,MAAMC,gBAAgB,GAAG;EAC9BC,iBAAiB,EAAEA,CAAA,KAAM;IACvB,OAAOF,sBAAsB,CAACE,iBAAiB,CAAC,CAAC;EACnD,CAAC;EACDC,uBAAuB,EAAGC,iBAA0B,IAAK;IACvD;AACJ;AACA;IACIJ,sBAAsB,CAACG,uBAAuB,CAACC,iBAAiB,IAAI,cAAc,CAAC;EACrF;AACF,CAAC"}
|
|
@@ -1,5 +1,8 @@
|
|
|
1
1
|
import NativeReactNativeLegal from './NativeReactNativeLegal';
|
|
2
2
|
export const ReactNativeLegal = {
|
|
3
|
+
getLibrariesAsync: () => {
|
|
4
|
+
return NativeReactNativeLegal.getLibrariesAsync();
|
|
5
|
+
},
|
|
3
6
|
launchLicenseListScreen: licenseHeaderText => {
|
|
4
7
|
/**
|
|
5
8
|
* On iOS, the licenses list is displayed as a custom table view controller
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"names":["NativeReactNativeLegal","ReactNativeLegal","launchLicenseListScreen","licenseHeaderText"],"sourceRoot":"../../src","sources":["ReactNativeLegal.ios.ts"],"mappings":"AAAA,OAAOA,sBAAsB,MAAM,0BAA0B;AAE7D,OAAO,MAAMC,gBAAgB,GAAG;EAC9BC,uBAAuB,EAAGC,iBAA0B,IAAK;IACvD;AACJ;AACA;
|
|
1
|
+
{"version":3,"names":["NativeReactNativeLegal","ReactNativeLegal","getLibrariesAsync","launchLicenseListScreen","licenseHeaderText"],"sourceRoot":"../../src","sources":["ReactNativeLegal.ios.ts"],"mappings":"AAAA,OAAOA,sBAAsB,MAAM,0BAA0B;AAE7D,OAAO,MAAMC,gBAAgB,GAAG;EAC9BC,iBAAiB,EAAEA,CAAA,KAAM;IACvB,OAAOF,sBAAsB,CAACE,iBAAiB,CAAC,CAAC;EACnD,CAAC;EACDC,uBAAuB,EAAGC,iBAA0B,IAAK;IACvD;AACJ;AACA;IACIJ,sBAAsB,CAACG,uBAAuB,CAACC,iBAAiB,IAAI,cAAc,CAAC;EACrF;AACF,CAAC"}
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"names":["ReactNativeLegal","launchLicenseListScreen","_licenseHeaderText"],"sourceRoot":"../../src","sources":["ReactNativeLegal.ts"],"mappings":"
|
|
1
|
+
{"version":3,"names":["ReactNativeLegal","getLibrariesAsync","Promise","resolve","data","launchLicenseListScreen","_licenseHeaderText"],"sourceRoot":"../../src","sources":["ReactNativeLegal.ts"],"mappings":"AAEA,OAAO,MAAMA,gBAAgB,GAAG;EAC9BC,iBAAiB,EAAEA,CAAA,KAAM;IACvB,OAAOC,OAAO,CAACC,OAAO,CAAkB;MAAEC,IAAI,EAAE;IAAG,CAAC,CAAC;EACvD,CAAC;EACDC,uBAAuB,EAAGC,kBAA2B,IAAK;IACxD;EAAA;AAEJ,CAAC"}
|
|
@@ -1,5 +1,45 @@
|
|
|
1
1
|
import type { TurboModule } from 'react-native';
|
|
2
|
+
export interface License {
|
|
3
|
+
licenseContent: string;
|
|
4
|
+
/**
|
|
5
|
+
* @platform Android
|
|
6
|
+
*/
|
|
7
|
+
name?: string;
|
|
8
|
+
/**
|
|
9
|
+
* @platform Android
|
|
10
|
+
*/
|
|
11
|
+
url?: string;
|
|
12
|
+
/**
|
|
13
|
+
* @platform Android
|
|
14
|
+
*/
|
|
15
|
+
year?: string;
|
|
16
|
+
}
|
|
17
|
+
export interface Library {
|
|
18
|
+
id: string;
|
|
19
|
+
name: string;
|
|
20
|
+
licenses: License[];
|
|
21
|
+
/**
|
|
22
|
+
* @platform Android
|
|
23
|
+
*/
|
|
24
|
+
description?: string;
|
|
25
|
+
/**
|
|
26
|
+
* @platform Android
|
|
27
|
+
*/
|
|
28
|
+
developers?: string;
|
|
29
|
+
/**
|
|
30
|
+
* @platform Android
|
|
31
|
+
*/
|
|
32
|
+
website?: string;
|
|
33
|
+
/**
|
|
34
|
+
* @platform Android
|
|
35
|
+
*/
|
|
36
|
+
organization?: string;
|
|
37
|
+
}
|
|
38
|
+
export interface LibrariesResult {
|
|
39
|
+
data: Library[];
|
|
40
|
+
}
|
|
2
41
|
export interface Spec extends TurboModule {
|
|
42
|
+
getLibrariesAsync(): Promise<LibrariesResult>;
|
|
3
43
|
launchLicenseListScreen(licenseHeaderText: string): void;
|
|
4
44
|
}
|
|
5
45
|
declare const _default: Spec;
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"NativeReactNativeLegal.d.ts","sourceRoot":"","sources":["../../src/NativeReactNativeLegal.ts"],"names":[],"mappings":"AAAA,OAAO,KAAK,EAAE,WAAW,EAAE,MAAM,cAAc,CAAC;AAGhD,MAAM,WAAW,IAAK,SAAQ,WAAW;IACvC,uBAAuB,CAAC,iBAAiB,EAAE,MAAM,GAAG,IAAI,CAAC;CAC1D;;AAED,wBAAgF"}
|
|
1
|
+
{"version":3,"file":"NativeReactNativeLegal.d.ts","sourceRoot":"","sources":["../../src/NativeReactNativeLegal.ts"],"names":[],"mappings":"AAAA,OAAO,KAAK,EAAE,WAAW,EAAE,MAAM,cAAc,CAAC;AAGhD,MAAM,WAAW,OAAO;IACtB,cAAc,EAAE,MAAM,CAAC;IACvB;;OAEG;IACH,IAAI,CAAC,EAAE,MAAM,CAAC;IACd;;OAEG;IACH,GAAG,CAAC,EAAE,MAAM,CAAC;IACb;;OAEG;IACH,IAAI,CAAC,EAAE,MAAM,CAAC;CACf;AAED,MAAM,WAAW,OAAO;IACtB,EAAE,EAAE,MAAM,CAAC;IACX,IAAI,EAAE,MAAM,CAAC;IACb,QAAQ,EAAE,OAAO,EAAE,CAAC;IACpB;;OAEG;IACH,WAAW,CAAC,EAAE,MAAM,CAAC;IACrB;;OAEG;IACH,UAAU,CAAC,EAAE,MAAM,CAAC;IACpB;;OAEG;IACH,OAAO,CAAC,EAAE,MAAM,CAAC;IACjB;;OAEG;IACH,YAAY,CAAC,EAAE,MAAM,CAAC;CACvB;AAED,MAAM,WAAW,eAAe;IAC9B,IAAI,EAAE,OAAO,EAAE,CAAC;CACjB;AAED,MAAM,WAAW,IAAK,SAAQ,WAAW;IACvC,iBAAiB,IAAI,OAAO,CAAC,eAAe,CAAC,CAAC;IAC9C,uBAAuB,CAAC,iBAAiB,EAAE,MAAM,GAAG,IAAI,CAAC;CAC1D;;AAED,wBAAgF"}
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"ReactNativeLegal.android.d.ts","sourceRoot":"","sources":["../../src/ReactNativeLegal.android.ts"],"names":[],"mappings":"AAEA,eAAO,MAAM,gBAAgB
|
|
1
|
+
{"version":3,"file":"ReactNativeLegal.android.d.ts","sourceRoot":"","sources":["../../src/ReactNativeLegal.android.ts"],"names":[],"mappings":"AAEA,eAAO,MAAM,gBAAgB;;kDAImB,MAAM;CAMrD,CAAC"}
|
|
@@ -1,4 +1,6 @@
|
|
|
1
|
+
import type { LibrariesResult } from './NativeReactNativeLegal';
|
|
1
2
|
export declare const ReactNativeLegal: {
|
|
3
|
+
getLibrariesAsync: () => Promise<LibrariesResult>;
|
|
2
4
|
launchLicenseListScreen: (_licenseHeaderText?: string) => void;
|
|
3
5
|
};
|
|
4
6
|
//# sourceMappingURL=ReactNativeLegal.d.ts.map
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"ReactNativeLegal.d.ts","sourceRoot":"","sources":["../../src/ReactNativeLegal.ts"],"names":[],"mappings":"AAAA,eAAO,MAAM,gBAAgB
|
|
1
|
+
{"version":3,"file":"ReactNativeLegal.d.ts","sourceRoot":"","sources":["../../src/ReactNativeLegal.ts"],"names":[],"mappings":"AAAA,OAAO,KAAK,EAAE,eAAe,EAAE,MAAM,0BAA0B,CAAC;AAEhE,eAAO,MAAM,gBAAgB;;mDAIoB,MAAM;CAGtD,CAAC"}
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"ReactNativeLegal.ios.d.ts","sourceRoot":"","sources":["../../src/ReactNativeLegal.ios.ts"],"names":[],"mappings":"AAEA,eAAO,MAAM,gBAAgB
|
|
1
|
+
{"version":3,"file":"ReactNativeLegal.ios.d.ts","sourceRoot":"","sources":["../../src/ReactNativeLegal.ios.ts"],"names":[],"mappings":"AAEA,eAAO,MAAM,gBAAgB;;kDAImB,MAAM;CAMrD,CAAC"}
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"index.d.ts","sourceRoot":"","sources":["../../src/index.ts"],"names":[],"mappings":"AAAA,OAAO,EAAE,gBAAgB,EAAE,MAAM,oBAAoB,CAAC"}
|
|
1
|
+
{"version":3,"file":"index.d.ts","sourceRoot":"","sources":["../../src/index.ts"],"names":[],"mappings":"AAAA,OAAO,EAAE,gBAAgB,EAAE,MAAM,oBAAoB,CAAC;AACtD,YAAY,EAAE,eAAe,EAAE,OAAO,EAAE,OAAO,EAAE,MAAM,0BAA0B,CAAC"}
|
package/package.json
CHANGED
|
@@ -4,7 +4,7 @@ var __importDefault = (this && this.__importDefault) || function (mod) {
|
|
|
4
4
|
};
|
|
5
5
|
Object.defineProperty(exports, "__esModule", { value: true });
|
|
6
6
|
exports.withAndroidLegal = void 0;
|
|
7
|
-
const
|
|
7
|
+
const node_path_1 = __importDefault(require("node:path"));
|
|
8
8
|
const licenses_1 = require("@callstack/licenses");
|
|
9
9
|
const config_plugins_1 = require("expo/config-plugins");
|
|
10
10
|
const addListActivity_1 = require("./addListActivity");
|
|
@@ -18,7 +18,7 @@ const declareAboutLibrariesPlugin_1 = require("./declareAboutLibrariesPlugin");
|
|
|
18
18
|
*/
|
|
19
19
|
const withAndroidLegal = (config) => {
|
|
20
20
|
(0, config_plugins_1.withAndroidManifest)(config, async (exportedConfig) => {
|
|
21
|
-
const licenses = (0, licenses_1.scanDependencies)(
|
|
21
|
+
const licenses = (0, licenses_1.scanDependencies)(node_path_1.default.join(exportedConfig.modRequest.projectRoot, 'package.json'));
|
|
22
22
|
(0, licenses_1.writeAboutLibrariesNPMOutput)(licenses, exportedConfig.modRequest.platformProjectRoot);
|
|
23
23
|
return exportedConfig;
|
|
24
24
|
});
|
|
@@ -4,7 +4,7 @@ var __importDefault = (this && this.__importDefault) || function (mod) {
|
|
|
4
4
|
};
|
|
5
5
|
Object.defineProperty(exports, "__esModule", { value: true });
|
|
6
6
|
exports.withIosLegal = void 0;
|
|
7
|
-
const
|
|
7
|
+
const node_path_1 = __importDefault(require("node:path"));
|
|
8
8
|
const licenses_1 = require("@callstack/licenses");
|
|
9
9
|
const config_plugins_1 = require("expo/config-plugins");
|
|
10
10
|
const addSettingsBundle_1 = require("./addSettingsBundle");
|
|
@@ -17,7 +17,7 @@ const registerLicensePlistBuildPhase_1 = require("./registerLicensePlistBuildPha
|
|
|
17
17
|
*/
|
|
18
18
|
const withIosLegal = (config) => {
|
|
19
19
|
(0, config_plugins_1.withXcodeProject)(config, async (exportedConfig) => {
|
|
20
|
-
const licenses = (0, licenses_1.scanDependencies)(
|
|
20
|
+
const licenses = (0, licenses_1.scanDependencies)(node_path_1.default.join(exportedConfig.modRequest.projectRoot, 'package.json'));
|
|
21
21
|
(0, licenses_1.writeLicensePlistNPMOutput)(licenses, exportedConfig.modRequest.platformProjectRoot);
|
|
22
22
|
return exportedConfig;
|
|
23
23
|
});
|
|
@@ -4,23 +4,23 @@ var __importDefault = (this && this.__importDefault) || function (mod) {
|
|
|
4
4
|
};
|
|
5
5
|
Object.defineProperty(exports, "__esModule", { value: true });
|
|
6
6
|
exports.registerLicensePlistBuildPhaseUtil = exports.addSettingsBundleUtil = void 0;
|
|
7
|
-
const
|
|
8
|
-
const
|
|
7
|
+
const node_fs_1 = __importDefault(require("node:fs"));
|
|
8
|
+
const node_path_1 = __importDefault(require("node:path"));
|
|
9
9
|
/**
|
|
10
10
|
* Creates a Settings.bundle from a template and invokes a callback responsible for linking new file to the iOS project
|
|
11
11
|
*/
|
|
12
12
|
function addSettingsBundleUtil(iosProjectPath, addResourceFileToGroup) {
|
|
13
13
|
const settingsBundleFilename = 'Settings.bundle';
|
|
14
14
|
const settingsBundleRootPlistFilename = 'Root.plist';
|
|
15
|
-
const settingsBundlePath =
|
|
16
|
-
const settingsBundleRootPlistPath =
|
|
17
|
-
if (!
|
|
15
|
+
const settingsBundlePath = node_path_1.default.join(iosProjectPath, settingsBundleFilename);
|
|
16
|
+
const settingsBundleRootPlistPath = node_path_1.default.join(settingsBundlePath, settingsBundleRootPlistFilename);
|
|
17
|
+
if (!node_fs_1.default.existsSync(settingsBundleRootPlistPath)) {
|
|
18
18
|
// Create `Settings.bundle` directory
|
|
19
|
-
if (!
|
|
20
|
-
|
|
19
|
+
if (!node_fs_1.default.existsSync(settingsBundlePath)) {
|
|
20
|
+
node_fs_1.default.mkdirSync(settingsBundlePath, { recursive: true });
|
|
21
21
|
}
|
|
22
22
|
// Create `Settings.bundle/Root.plist`
|
|
23
|
-
|
|
23
|
+
node_fs_1.default.writeFileSync(settingsBundleRootPlistPath, SETTINGS_BUNDLE_ROOT_PLIST_CONTENT);
|
|
24
24
|
// Link `Settings.bundle` to the resources
|
|
25
25
|
addResourceFileToGroup({ settingsBundleFilename });
|
|
26
26
|
console.log('Settings.bundle/Root.plist - ADDED');
|
package/plugin-utils/src/ios.ts
CHANGED
|
@@ -1,7 +1,50 @@
|
|
|
1
1
|
import type { TurboModule } from 'react-native';
|
|
2
2
|
import { TurboModuleRegistry } from 'react-native';
|
|
3
3
|
|
|
4
|
+
export interface License {
|
|
5
|
+
licenseContent: string;
|
|
6
|
+
/**
|
|
7
|
+
* @platform Android
|
|
8
|
+
*/
|
|
9
|
+
name?: string;
|
|
10
|
+
/**
|
|
11
|
+
* @platform Android
|
|
12
|
+
*/
|
|
13
|
+
url?: string;
|
|
14
|
+
/**
|
|
15
|
+
* @platform Android
|
|
16
|
+
*/
|
|
17
|
+
year?: string;
|
|
18
|
+
}
|
|
19
|
+
|
|
20
|
+
export interface Library {
|
|
21
|
+
id: string;
|
|
22
|
+
name: string;
|
|
23
|
+
licenses: License[];
|
|
24
|
+
/**
|
|
25
|
+
* @platform Android
|
|
26
|
+
*/
|
|
27
|
+
description?: string;
|
|
28
|
+
/**
|
|
29
|
+
* @platform Android
|
|
30
|
+
*/
|
|
31
|
+
developers?: string;
|
|
32
|
+
/**
|
|
33
|
+
* @platform Android
|
|
34
|
+
*/
|
|
35
|
+
website?: string;
|
|
36
|
+
/**
|
|
37
|
+
* @platform Android
|
|
38
|
+
*/
|
|
39
|
+
organization?: string;
|
|
40
|
+
}
|
|
41
|
+
|
|
42
|
+
export interface LibrariesResult {
|
|
43
|
+
data: Library[];
|
|
44
|
+
}
|
|
45
|
+
|
|
4
46
|
export interface Spec extends TurboModule {
|
|
47
|
+
getLibrariesAsync(): Promise<LibrariesResult>;
|
|
5
48
|
launchLicenseListScreen(licenseHeaderText: string): void;
|
|
6
49
|
}
|
|
7
50
|
|
|
@@ -1,6 +1,9 @@
|
|
|
1
1
|
import NativeReactNativeLegal from './NativeReactNativeLegal';
|
|
2
2
|
|
|
3
3
|
export const ReactNativeLegal = {
|
|
4
|
+
getLibrariesAsync: () => {
|
|
5
|
+
return NativeReactNativeLegal.getLibrariesAsync();
|
|
6
|
+
},
|
|
4
7
|
launchLicenseListScreen: (licenseHeaderText?: string) => {
|
|
5
8
|
/**
|
|
6
9
|
* On Android, the licenses list is displayed as a custom activity
|
|
@@ -1,6 +1,9 @@
|
|
|
1
1
|
import NativeReactNativeLegal from './NativeReactNativeLegal';
|
|
2
2
|
|
|
3
3
|
export const ReactNativeLegal = {
|
|
4
|
+
getLibrariesAsync: () => {
|
|
5
|
+
return NativeReactNativeLegal.getLibrariesAsync();
|
|
6
|
+
},
|
|
4
7
|
launchLicenseListScreen: (licenseHeaderText?: string) => {
|
|
5
8
|
/**
|
|
6
9
|
* On iOS, the licenses list is displayed as a custom table view controller
|
package/src/ReactNativeLegal.ts
CHANGED
|
@@ -1,4 +1,9 @@
|
|
|
1
|
+
import type { LibrariesResult } from './NativeReactNativeLegal';
|
|
2
|
+
|
|
1
3
|
export const ReactNativeLegal = {
|
|
4
|
+
getLibrariesAsync: () => {
|
|
5
|
+
return Promise.resolve<LibrariesResult>({ data: [] });
|
|
6
|
+
},
|
|
2
7
|
launchLicenseListScreen: (_licenseHeaderText?: string) => {
|
|
3
8
|
//
|
|
4
9
|
},
|
package/src/index.ts
CHANGED