react-native-legal 1.6.5 → 1.7.0
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/Package.swift +56 -0
- package/android/build.gradle +8 -1
- package/bare-plugin/tsconfig.json +4 -3
- package/ios/ReactNativeLegalDetailViewController.swift +2 -0
- package/ios/ReactNativeLegalModule.mm +12 -1
- package/ios/ReactNativeLegalModuleImpl.swift +5 -2
- package/ios/ReactNativeLegalTableViewController.swift +2 -0
- package/package.json +4 -1
- package/plugin-utils/build/ios.js +13 -3
- package/plugin-utils/src/ios.ts +19 -3
- package/plugin-utils/tsconfig.json +5 -4
- package/swift-tools/Package.resolved +96 -0
- package/swift-tools/Package.swift +15 -0
package/Package.swift
ADDED
|
@@ -0,0 +1,56 @@
|
|
|
1
|
+
// swift-tools-version: 6.0
|
|
2
|
+
import PackageDescription
|
|
3
|
+
|
|
4
|
+
let package = Package(
|
|
5
|
+
name: "ReactNativeLegal",
|
|
6
|
+
platforms: [.iOS(.v15), .tvOS(.v15)],
|
|
7
|
+
products: [
|
|
8
|
+
.library(name: "ReactNativeLegal", targets: ["ReactNativeLegalObjC"]),
|
|
9
|
+
],
|
|
10
|
+
dependencies: [
|
|
11
|
+
.package(name: "ReactNative", path: "../../../../xcframeworks"),
|
|
12
|
+
.package(name: "React-GeneratedCode", path: "../../../ios"),
|
|
13
|
+
],
|
|
14
|
+
targets: [
|
|
15
|
+
.target(
|
|
16
|
+
name: "ReactNativeLegalSwift",
|
|
17
|
+
path: ".",
|
|
18
|
+
sources: [
|
|
19
|
+
"ios/ReactNativeLegalDetailViewController.swift",
|
|
20
|
+
"ios/ReactNativeLegalLicenseMetadata.swift",
|
|
21
|
+
"ios/ReactNativeLegalModuleImpl.swift",
|
|
22
|
+
"ios/ReactNativeLegalTableViewController.swift",
|
|
23
|
+
],
|
|
24
|
+
publicHeadersPath: "ios",
|
|
25
|
+
cSettings: [.headerSearchPath("ios")],
|
|
26
|
+
cxxSettings: [.headerSearchPath("ios"), .define("DEBUG", .when(configuration: .debug)), .define("NDEBUG", .when(configuration: .release))],
|
|
27
|
+
linkerSettings: [.linkedFramework("UIKit"), .linkedFramework("Foundation"), .linkedFramework("CoreGraphics")]
|
|
28
|
+
),
|
|
29
|
+
.target(
|
|
30
|
+
name: "ReactNativeLegalObjC",
|
|
31
|
+
dependencies: [
|
|
32
|
+
"ReactNativeLegalSwift",
|
|
33
|
+
.product(name: "ReactHeaders", package: "ReactNative"),
|
|
34
|
+
.product(name: "ReactNativeHeaders", package: "ReactNative"),
|
|
35
|
+
.product(name: "ReactNativeDependenciesHeaders", package: "ReactNative"),
|
|
36
|
+
.product(name: "ReactAppHeaders", package: "React-GeneratedCode"),
|
|
37
|
+
],
|
|
38
|
+
path: ".",
|
|
39
|
+
sources: [
|
|
40
|
+
"ios/ReactNativeLegalModule.h",
|
|
41
|
+
"ios/ReactNativeLegalModule.mm",
|
|
42
|
+
],
|
|
43
|
+
publicHeadersPath: "ios",
|
|
44
|
+
cSettings: [.headerSearchPath("ios"), .define("REACT_NATIVE_LEGAL_USING_SPM")],
|
|
45
|
+
cxxSettings: [
|
|
46
|
+
.headerSearchPath("ios"),
|
|
47
|
+
.define("REACT_NATIVE_LEGAL_USING_SPM"),
|
|
48
|
+
.define("DEBUG", .when(configuration: .debug)),
|
|
49
|
+
.define("NDEBUG", .when(configuration: .release)),
|
|
50
|
+
.unsafeFlags(["-fmodules", "-fcxx-modules"])
|
|
51
|
+
],
|
|
52
|
+
linkerSettings: [.linkedFramework("UIKit"), .linkedFramework("Foundation"), .linkedFramework("CoreGraphics")]
|
|
53
|
+
)
|
|
54
|
+
],
|
|
55
|
+
cxxLanguageStandard: .cxx20
|
|
56
|
+
)
|
package/android/build.gradle
CHANGED
|
@@ -25,7 +25,14 @@ if (project == rootProject) {
|
|
|
25
25
|
}
|
|
26
26
|
|
|
27
27
|
apply plugin: 'com.android.library'
|
|
28
|
-
|
|
28
|
+
// AGP 9 ships built-in Kotlin support and registers the `kotlin` extension
|
|
29
|
+
// itself. Applying the Kotlin plugin on top of it fails configuration with
|
|
30
|
+
// "Cannot add extension with name 'kotlin'". Only apply it when nothing has
|
|
31
|
+
// registered that extension yet.
|
|
32
|
+
if (project.extensions.findByName('kotlin') == null) {
|
|
33
|
+
apply plugin: 'kotlin-android'
|
|
34
|
+
}
|
|
35
|
+
|
|
29
36
|
if (isNewArchitectureEnabled()) {
|
|
30
37
|
apply plugin: "com.facebook.react"
|
|
31
38
|
}
|
|
@@ -2,18 +2,19 @@
|
|
|
2
2
|
"compilerOptions": {
|
|
3
3
|
"declaration": true,
|
|
4
4
|
"lib": ["es2020"],
|
|
5
|
-
"module": "
|
|
5
|
+
"module": "node16",
|
|
6
6
|
"target": "es2020",
|
|
7
7
|
|
|
8
8
|
"strict": true,
|
|
9
9
|
"esModuleInterop": true,
|
|
10
10
|
"skipLibCheck": true,
|
|
11
11
|
"forceConsistentCasingInFileNames": true,
|
|
12
|
-
"moduleResolution": "
|
|
12
|
+
"moduleResolution": "node16",
|
|
13
13
|
|
|
14
14
|
"outDir": "build",
|
|
15
15
|
"rootDir": "src",
|
|
16
|
-
"typeRoots": ["../types-definitions", "../../../node_modules/@types"]
|
|
16
|
+
"typeRoots": ["../types-definitions", "../../../node_modules/@types"],
|
|
17
|
+
"types": ["node", "xcode"]
|
|
17
18
|
},
|
|
18
19
|
"include": ["./src"],
|
|
19
20
|
"exclude": ["**/__mocks__/*", "**/__tests__/*"]
|
|
@@ -1,11 +1,19 @@
|
|
|
1
1
|
#import "ReactNativeLegalModule.h"
|
|
2
2
|
|
|
3
|
+
#import <React/RCTUtils.h>
|
|
4
|
+
|
|
5
|
+
#ifdef REACT_NATIVE_LEGAL_USING_SPM
|
|
6
|
+
@import ReactNativeLegalSwift;
|
|
7
|
+
#else
|
|
8
|
+
|
|
3
9
|
#if __has_include(<ReactNativeLegal/ReactNativeLegal-Swift.h>)
|
|
4
10
|
#import <ReactNativeLegal/ReactNativeLegal-Swift.h>
|
|
5
11
|
#else
|
|
6
12
|
#import "ReactNativeLegal-Swift.h"
|
|
7
13
|
#endif
|
|
8
14
|
|
|
15
|
+
#endif
|
|
16
|
+
|
|
9
17
|
#if RCT_NEW_ARCH_ENABLED
|
|
10
18
|
#import "ReactNativeLegal.h"
|
|
11
19
|
|
|
@@ -19,7 +27,10 @@ RCT_EXPORT_MODULE(ReactNativeLegalModule)
|
|
|
19
27
|
|
|
20
28
|
RCT_EXPORT_METHOD(launchLicenseListScreen : (NSString *)licenseHeaderText)
|
|
21
29
|
{
|
|
22
|
-
[ReactNativeLegalModuleImpl launchLicenseListScreenWithLicenseHeaderText:licenseHeaderText
|
|
30
|
+
[ReactNativeLegalModuleImpl launchLicenseListScreenWithLicenseHeaderText:licenseHeaderText
|
|
31
|
+
getPresentedViewController:^{
|
|
32
|
+
return RCTPresentedViewController();
|
|
33
|
+
}];
|
|
23
34
|
}
|
|
24
35
|
|
|
25
36
|
RCT_EXPORT_METHOD(getLibrariesAsync : (RCTPromiseResolveBlock)resolve reject : (RCTPromiseRejectBlock)reject)
|
|
@@ -2,7 +2,10 @@ import UIKit
|
|
|
2
2
|
|
|
3
3
|
@objc(ReactNativeLegalModuleImpl)
|
|
4
4
|
public class ReactNativeLegalModuleImpl: NSObject {
|
|
5
|
-
@objc public static func launchLicenseListScreen(
|
|
5
|
+
@objc public static func launchLicenseListScreen(
|
|
6
|
+
licenseHeaderText: String,
|
|
7
|
+
getPresentedViewController: @Sendable @escaping () -> UIViewController?
|
|
8
|
+
) {
|
|
6
9
|
guard
|
|
7
10
|
let settingsBundleUrl = Bundle.main.url(forResource: "Settings", withExtension: "bundle"),
|
|
8
11
|
let settingsBundle = Bundle(url: settingsBundleUrl),
|
|
@@ -19,7 +22,7 @@ public class ReactNativeLegalModuleImpl: NSObject {
|
|
|
19
22
|
)
|
|
20
23
|
|
|
21
24
|
DispatchQueue.main.async {
|
|
22
|
-
guard let presentedViewController =
|
|
25
|
+
guard let presentedViewController = getPresentedViewController() else {
|
|
23
26
|
return
|
|
24
27
|
}
|
|
25
28
|
|
package/package.json
CHANGED
|
@@ -1,6 +1,6 @@
|
|
|
1
1
|
{
|
|
2
2
|
"name": "react-native-legal",
|
|
3
|
-
"version": "1.
|
|
3
|
+
"version": "1.7.0",
|
|
4
4
|
"description": "Acknowledge OSS libraries used in your React Native app",
|
|
5
5
|
"keywords": [
|
|
6
6
|
"react-native",
|
|
@@ -37,8 +37,11 @@
|
|
|
37
37
|
"plugin",
|
|
38
38
|
"plugin-utils",
|
|
39
39
|
"src",
|
|
40
|
+
"swift-tools/Package.resolved",
|
|
41
|
+
"swift-tools/Package.swift",
|
|
40
42
|
"LICENSE",
|
|
41
43
|
"app.plugin.js",
|
|
44
|
+
"Package.swift",
|
|
42
45
|
"react-native.config.js",
|
|
43
46
|
"ReactNativeLegal.podspec"
|
|
44
47
|
],
|
|
@@ -34,10 +34,20 @@ function addSettingsBundleUtil(iosProjectPath, addResourceFileToGroup) {
|
|
|
34
34
|
* Creates a shell script build phase (if needed) and links it to native targets build phases
|
|
35
35
|
*/
|
|
36
36
|
function registerLicensePlistBuildPhaseUtil(projectTargetId, pbxproj) {
|
|
37
|
+
const licensePlistFlags = '--add-version-numbers --output-path ./Settings.bundle';
|
|
38
|
+
const licensePlistShellScript = `set -e\\n\\nif [[ -n \${PODS_ROOT} ]]; then \${PODS_ROOT}/LicensePlist/license-plist ${licensePlistFlags}; else /usr/bin/env xcrun --sdk macosx swift run -c release --package-path ./build/generated/autolinking/libs/ReactNativeLegal/swift-tools license-plist ${licensePlistFlags}; fi\\n`;
|
|
37
39
|
const nativeTargetSection = pbxproj.pbxNativeTargetSection();
|
|
38
40
|
const nativeTarget = nativeTargetSection[projectTargetId];
|
|
39
|
-
|
|
40
|
-
|
|
41
|
+
const existingBuildPhase = pbxproj.buildPhaseObject('PBXShellScriptBuildPhase', GENERATE_LICENSE_PLIST_BUILD_PHASE_COMMENT, projectTargetId);
|
|
42
|
+
if (existingBuildPhase) {
|
|
43
|
+
const licensePlistShellScriptWithDoubleQuotes = '"' + licensePlistShellScript + '"';
|
|
44
|
+
if (existingBuildPhase.shellScript === licensePlistShellScriptWithDoubleQuotes) {
|
|
45
|
+
console.log(`LicensePlist buildPhase already added in "${nativeTarget.name}" - SKIP`);
|
|
46
|
+
}
|
|
47
|
+
else {
|
|
48
|
+
existingBuildPhase.shellScript = licensePlistShellScriptWithDoubleQuotes;
|
|
49
|
+
console.log(`LicensePlist buildPhase in "${nativeTarget.name}" - MODIFIED`);
|
|
50
|
+
}
|
|
41
51
|
return pbxproj;
|
|
42
52
|
}
|
|
43
53
|
/**
|
|
@@ -47,7 +57,7 @@ function registerLicensePlistBuildPhaseUtil(projectTargetId, pbxproj) {
|
|
|
47
57
|
*/
|
|
48
58
|
const newBuildPhase = pbxproj.addBuildPhase([], 'PBXShellScriptBuildPhase', GENERATE_LICENSE_PLIST_BUILD_PHASE_COMMENT, projectTargetId, {
|
|
49
59
|
shellPath: '/bin/sh',
|
|
50
|
-
shellScript:
|
|
60
|
+
shellScript: licensePlistShellScript,
|
|
51
61
|
});
|
|
52
62
|
/**
|
|
53
63
|
* In order to correctly link all metadata from `Settings.bundle` to the app
|
package/plugin-utils/src/ios.ts
CHANGED
|
@@ -39,11 +39,27 @@ export function registerLicensePlistBuildPhaseUtil(
|
|
|
39
39
|
projectTargetId: string,
|
|
40
40
|
pbxproj: XcodeProject, // Xcode Pbxproj
|
|
41
41
|
) {
|
|
42
|
+
const licensePlistFlags = '--add-version-numbers --output-path ./Settings.bundle';
|
|
43
|
+
const licensePlistShellScript = `set -e\\n\\nif [[ -n \${PODS_ROOT} ]]; then \${PODS_ROOT}/LicensePlist/license-plist ${licensePlistFlags}; else /usr/bin/env xcrun --sdk macosx swift run -c release --package-path ./build/generated/autolinking/libs/ReactNativeLegal/swift-tools license-plist ${licensePlistFlags}; fi\\n`;
|
|
42
44
|
const nativeTargetSection = pbxproj.pbxNativeTargetSection();
|
|
43
45
|
const nativeTarget = nativeTargetSection[projectTargetId];
|
|
44
46
|
|
|
45
|
-
|
|
46
|
-
|
|
47
|
+
const existingBuildPhase = pbxproj.buildPhaseObject(
|
|
48
|
+
'PBXShellScriptBuildPhase',
|
|
49
|
+
GENERATE_LICENSE_PLIST_BUILD_PHASE_COMMENT,
|
|
50
|
+
projectTargetId,
|
|
51
|
+
);
|
|
52
|
+
|
|
53
|
+
if (existingBuildPhase) {
|
|
54
|
+
const licensePlistShellScriptWithDoubleQuotes = '"' + licensePlistShellScript + '"';
|
|
55
|
+
|
|
56
|
+
if (existingBuildPhase.shellScript === licensePlistShellScriptWithDoubleQuotes) {
|
|
57
|
+
console.log(`LicensePlist buildPhase already added in "${nativeTarget.name}" - SKIP`);
|
|
58
|
+
} else {
|
|
59
|
+
existingBuildPhase.shellScript = licensePlistShellScriptWithDoubleQuotes;
|
|
60
|
+
console.log(`LicensePlist buildPhase in "${nativeTarget.name}" - MODIFIED`);
|
|
61
|
+
}
|
|
62
|
+
|
|
47
63
|
return pbxproj;
|
|
48
64
|
}
|
|
49
65
|
|
|
@@ -59,7 +75,7 @@ export function registerLicensePlistBuildPhaseUtil(
|
|
|
59
75
|
projectTargetId,
|
|
60
76
|
{
|
|
61
77
|
shellPath: '/bin/sh',
|
|
62
|
-
shellScript:
|
|
78
|
+
shellScript: licensePlistShellScript,
|
|
63
79
|
},
|
|
64
80
|
);
|
|
65
81
|
/**
|
|
@@ -1,19 +1,20 @@
|
|
|
1
1
|
{
|
|
2
2
|
"compilerOptions": {
|
|
3
3
|
"declaration": true,
|
|
4
|
-
"lib": ["es2020"],
|
|
5
|
-
"module": "
|
|
4
|
+
"lib": ["es2020", "DOM"],
|
|
5
|
+
"module": "node16",
|
|
6
6
|
"target": "es2020",
|
|
7
7
|
|
|
8
8
|
"strict": true,
|
|
9
9
|
"esModuleInterop": true,
|
|
10
10
|
"skipLibCheck": true,
|
|
11
11
|
"forceConsistentCasingInFileNames": true,
|
|
12
|
-
"moduleResolution": "
|
|
12
|
+
"moduleResolution": "node16",
|
|
13
13
|
|
|
14
14
|
"outDir": "build",
|
|
15
15
|
"rootDir": "src",
|
|
16
|
-
"typeRoots": ["../types-definitions", "../../../node_modules/@types"]
|
|
16
|
+
"typeRoots": ["../types-definitions", "../../../node_modules/@types"],
|
|
17
|
+
"types": ["node", "xcode"]
|
|
17
18
|
},
|
|
18
19
|
"include": ["./src"],
|
|
19
20
|
"exclude": ["**/__mocks__/*", "**/__tests__/*"]
|
|
@@ -0,0 +1,96 @@
|
|
|
1
|
+
{
|
|
2
|
+
"originHash" : "cee7bf8ff6206ef1f83a8d7f34e0a0b8ad3e2b2f0097d8f6864806fc464ba4ed",
|
|
3
|
+
"pins" : [
|
|
4
|
+
{
|
|
5
|
+
"identity" : "apikit",
|
|
6
|
+
"kind" : "remoteSourceControl",
|
|
7
|
+
"location" : "https://github.com/ishkawa/APIKit.git",
|
|
8
|
+
"state" : {
|
|
9
|
+
"revision" : "b839e53b870104798035b279d2a6168b0a2227b1",
|
|
10
|
+
"version" : "5.4.0"
|
|
11
|
+
}
|
|
12
|
+
},
|
|
13
|
+
{
|
|
14
|
+
"identity" : "heliumlogger",
|
|
15
|
+
"kind" : "remoteSourceControl",
|
|
16
|
+
"location" : "https://github.com/Kitura/HeliumLogger.git",
|
|
17
|
+
"state" : {
|
|
18
|
+
"revision" : "fc2a71597ae974da5282d751bcc11965964bccce",
|
|
19
|
+
"version" : "2.0.0"
|
|
20
|
+
}
|
|
21
|
+
},
|
|
22
|
+
{
|
|
23
|
+
"identity" : "licenseplist",
|
|
24
|
+
"kind" : "remoteSourceControl",
|
|
25
|
+
"location" : "https://github.com/mono0926/LicensePlist",
|
|
26
|
+
"state" : {
|
|
27
|
+
"revision" : "af8dd93bcf798fc70e648f489a14423ea9105334",
|
|
28
|
+
"version" : "3.28.0"
|
|
29
|
+
}
|
|
30
|
+
},
|
|
31
|
+
{
|
|
32
|
+
"identity" : "loggerapi",
|
|
33
|
+
"kind" : "remoteSourceControl",
|
|
34
|
+
"location" : "https://github.com/Kitura/LoggerAPI.git",
|
|
35
|
+
"state" : {
|
|
36
|
+
"revision" : "c26d5ef0009fbc0945326933e0f790bd33fe9062",
|
|
37
|
+
"version" : "2.1.0"
|
|
38
|
+
}
|
|
39
|
+
},
|
|
40
|
+
{
|
|
41
|
+
"identity" : "swift-argument-parser",
|
|
42
|
+
"kind" : "remoteSourceControl",
|
|
43
|
+
"location" : "https://github.com/apple/swift-argument-parser.git",
|
|
44
|
+
"state" : {
|
|
45
|
+
"revision" : "6a52f3251125d74daf04fcbd5e6f08a75d074382",
|
|
46
|
+
"version" : "1.8.2"
|
|
47
|
+
}
|
|
48
|
+
},
|
|
49
|
+
{
|
|
50
|
+
"identity" : "swift-html-entities",
|
|
51
|
+
"kind" : "remoteSourceControl",
|
|
52
|
+
"location" : "https://github.com/Kitura/swift-html-entities.git",
|
|
53
|
+
"state" : {
|
|
54
|
+
"revision" : "d8ca73197f59ce260c71bd6d7f6eb8bbdccf508b",
|
|
55
|
+
"version" : "4.0.1"
|
|
56
|
+
}
|
|
57
|
+
},
|
|
58
|
+
{
|
|
59
|
+
"identity" : "swift-log",
|
|
60
|
+
"kind" : "remoteSourceControl",
|
|
61
|
+
"location" : "https://github.com/apple/swift-log.git",
|
|
62
|
+
"state" : {
|
|
63
|
+
"revision" : "3ffafb9722d5d918c614feb496c8789a3b59d222",
|
|
64
|
+
"version" : "1.15.0"
|
|
65
|
+
}
|
|
66
|
+
},
|
|
67
|
+
{
|
|
68
|
+
"identity" : "tomlkit",
|
|
69
|
+
"kind" : "remoteSourceControl",
|
|
70
|
+
"location" : "https://github.com/LebJe/TOMLKit.git",
|
|
71
|
+
"state" : {
|
|
72
|
+
"revision" : "ec6198d37d495efc6acd4dffbd262cdca7ff9b3f",
|
|
73
|
+
"version" : "0.6.0"
|
|
74
|
+
}
|
|
75
|
+
},
|
|
76
|
+
{
|
|
77
|
+
"identity" : "xcodeedit",
|
|
78
|
+
"kind" : "remoteSourceControl",
|
|
79
|
+
"location" : "https://github.com/tomlokhorst/XcodeEdit.git",
|
|
80
|
+
"state" : {
|
|
81
|
+
"revision" : "0e550cdee72844b35431afc3a1e176042be6d0f0",
|
|
82
|
+
"version" : "2.13.0"
|
|
83
|
+
}
|
|
84
|
+
},
|
|
85
|
+
{
|
|
86
|
+
"identity" : "yams",
|
|
87
|
+
"kind" : "remoteSourceControl",
|
|
88
|
+
"location" : "https://github.com/jpsim/Yams.git",
|
|
89
|
+
"state" : {
|
|
90
|
+
"revision" : "a27b21e0c81c5bf42049b897a62aaf387e80f279",
|
|
91
|
+
"version" : "6.2.2"
|
|
92
|
+
}
|
|
93
|
+
}
|
|
94
|
+
],
|
|
95
|
+
"version" : 3
|
|
96
|
+
}
|
|
@@ -0,0 +1,15 @@
|
|
|
1
|
+
// swift-tools-version: 6.0
|
|
2
|
+
import PackageDescription
|
|
3
|
+
|
|
4
|
+
let package = Package(
|
|
5
|
+
name: "Tools",
|
|
6
|
+
platforms: [
|
|
7
|
+
.macOS(.v11)
|
|
8
|
+
],
|
|
9
|
+
dependencies: [
|
|
10
|
+
.package(url: "https://github.com/mono0926/LicensePlist", from: "3.28.0")
|
|
11
|
+
],
|
|
12
|
+
targets: [
|
|
13
|
+
.target(name: "Tools", path: "")
|
|
14
|
+
]
|
|
15
|
+
)
|