react-native-legal 1.0.0-next.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 +21 -0
- package/README.md +113 -0
- package/ReactNativeLegal.podspec +46 -0
- package/android/build.gradle +75 -0
- package/android/react-native-helpers.gradle +45 -0
- package/android/src/main/java/com/reactnativelegal/ReactNativeLegalActivity.kt +98 -0
- package/android/src/main/java/com/reactnativelegal/ReactNativeLegalModuleImpl.kt +19 -0
- package/android/src/main/java/com/reactnativelegal/ReactNativeLegalTurboPackage.kt +38 -0
- package/android/src/main/res/layout/activity_licenses.xml +28 -0
- package/android/src/main/res/values/styles.xml +7 -0
- package/android/src/main/res/values-v29/styles.xml +8 -0
- package/android/src/newarch/java/com/reactnativelegal/ReactNativeLegalModule.kt +17 -0
- package/android/src/oldarch/java/com/reactnativelegal/ReactNativeLegalModule.kt +23 -0
- package/app.plugin.js +1 -0
- package/bare-plugin/build/android/addListActivity.d.ts +4 -0
- package/bare-plugin/build/android/addListActivity.js +22 -0
- package/bare-plugin/build/android/androidCommand.d.ts +7 -0
- package/bare-plugin/build/android/androidCommand.js +25 -0
- package/bare-plugin/build/android/applyAndConfigureAboutLibrariesPlugin.d.ts +6 -0
- package/bare-plugin/build/android/applyAndConfigureAboutLibrariesPlugin.js +27 -0
- package/bare-plugin/build/android/declareAboutLibrariesPlugin.d.ts +6 -0
- package/bare-plugin/build/android/declareAboutLibrariesPlugin.js +27 -0
- package/bare-plugin/build/android/utils.d.ts +14 -0
- package/bare-plugin/build/android/utils.js +37 -0
- package/bare-plugin/build/index.d.ts +2 -0
- package/bare-plugin/build/index.js +9 -0
- package/bare-plugin/build/ios/addSettingsBundle.d.ts +4 -0
- package/bare-plugin/build/ios/addSettingsBundle.js +27 -0
- package/bare-plugin/build/ios/iosCommand.d.ts +7 -0
- package/bare-plugin/build/ios/iosCommand.js +23 -0
- package/bare-plugin/build/ios/registerLicensePlistBuildPhase.d.ts +7 -0
- package/bare-plugin/build/ios/registerLicensePlistBuildPhase.js +24 -0
- package/bare-plugin/build/ios/utils.d.ts +33 -0
- package/bare-plugin/build/ios/utils.js +98 -0
- package/bare-plugin/src/android/addListActivity.ts +22 -0
- package/bare-plugin/src/android/androidCommand.ts +23 -0
- package/bare-plugin/src/android/applyAndConfigureAboutLibrariesPlugin.ts +21 -0
- package/bare-plugin/src/android/declareAboutLibrariesPlugin.ts +21 -0
- package/bare-plugin/src/android/utils.ts +34 -0
- package/bare-plugin/src/index.ts +9 -0
- package/bare-plugin/src/ios/addSettingsBundle.ts +27 -0
- package/bare-plugin/src/ios/iosCommand.ts +21 -0
- package/bare-plugin/src/ios/registerLicensePlistBuildPhase.ts +22 -0
- package/bare-plugin/src/ios/utils.ts +120 -0
- package/bare-plugin/tsconfig.json +20 -0
- package/ios/ReactNativeLegal-Bridging-Header.h +1 -0
- package/ios/ReactNativeLegalDetailViewController.swift +156 -0
- package/ios/ReactNativeLegalLicenseMetadata.swift +4 -0
- package/ios/ReactNativeLegalModule.h +7 -0
- package/ios/ReactNativeLegalModule.mm +29 -0
- package/ios/ReactNativeLegalModuleImpl.swift +78 -0
- package/ios/ReactNativeLegalTableViewController.swift +72 -0
- package/lib/commonjs/NativeReactNativeLegal.js +10 -0
- package/lib/commonjs/NativeReactNativeLegal.js.map +1 -0
- package/lib/commonjs/ReactNativeLegal.android.js +18 -0
- package/lib/commonjs/ReactNativeLegal.android.js.map +1 -0
- package/lib/commonjs/ReactNativeLegal.ios.js +18 -0
- package/lib/commonjs/ReactNativeLegal.ios.js.map +1 -0
- package/lib/commonjs/ReactNativeLegal.js +13 -0
- package/lib/commonjs/ReactNativeLegal.js.map +1 -0
- package/lib/commonjs/index.js +13 -0
- package/lib/commonjs/index.js.map +1 -0
- package/lib/module/NativeReactNativeLegal.js +3 -0
- package/lib/module/NativeReactNativeLegal.js.map +1 -0
- package/lib/module/ReactNativeLegal.android.js +10 -0
- package/lib/module/ReactNativeLegal.android.js.map +1 -0
- package/lib/module/ReactNativeLegal.ios.js +10 -0
- package/lib/module/ReactNativeLegal.ios.js.map +1 -0
- package/lib/module/ReactNativeLegal.js +6 -0
- package/lib/module/ReactNativeLegal.js.map +1 -0
- package/lib/module/index.js +2 -0
- package/lib/module/index.js.map +1 -0
- package/lib/typescript/NativeReactNativeLegal.d.ts +7 -0
- package/lib/typescript/NativeReactNativeLegal.d.ts.map +1 -0
- package/lib/typescript/ReactNativeLegal.android.d.ts +4 -0
- package/lib/typescript/ReactNativeLegal.android.d.ts.map +1 -0
- package/lib/typescript/ReactNativeLegal.d.ts +4 -0
- package/lib/typescript/ReactNativeLegal.d.ts.map +1 -0
- package/lib/typescript/ReactNativeLegal.ios.d.ts +4 -0
- package/lib/typescript/ReactNativeLegal.ios.d.ts.map +1 -0
- package/lib/typescript/index.d.ts +2 -0
- package/lib/typescript/index.d.ts.map +1 -0
- package/package.json +97 -0
- package/plugin/build/android/addListActivity.d.ts +5 -0
- package/plugin/build/android/addListActivity.js +17 -0
- package/plugin/build/android/applyAndConfigureAboutLibrariesPlugin.d.ts +7 -0
- package/plugin/build/android/applyAndConfigureAboutLibrariesPlugin.js +22 -0
- package/plugin/build/android/declareAboutLibrariesPlugin.d.ts +7 -0
- package/plugin/build/android/declareAboutLibrariesPlugin.js +22 -0
- package/plugin/build/android/withAndroidLegal.d.ts +8 -0
- package/plugin/build/android/withAndroidLegal.js +30 -0
- package/plugin/build/index.d.ts +3 -0
- package/plugin/build/index.js +11 -0
- package/plugin/build/ios/addSettingsBundle.d.ts +5 -0
- package/plugin/build/ios/addSettingsBundle.js +28 -0
- package/plugin/build/ios/registerLicensePlistBuildPhase.d.ts +8 -0
- package/plugin/build/ios/registerLicensePlistBuildPhase.js +23 -0
- package/plugin/build/ios/withIosLegal.d.ts +8 -0
- package/plugin/build/ios/withIosLegal.js +28 -0
- package/plugin/jest.config.js +1 -0
- package/plugin/src/android/addListActivity.ts +19 -0
- package/plugin/src/android/applyAndConfigureAboutLibrariesPlugin.ts +23 -0
- package/plugin/src/android/declareAboutLibrariesPlugin.ts +21 -0
- package/plugin/src/android/withAndroidLegal.ts +28 -0
- package/plugin/src/index.ts +14 -0
- package/plugin/src/ios/addSettingsBundle.ts +29 -0
- package/plugin/src/ios/registerLicensePlistBuildPhase.ts +24 -0
- package/plugin/src/ios/withIosLegal.ts +26 -0
- package/plugin/tsconfig.json +9 -0
- package/plugin-utils/build/android.d.ts +12 -0
- package/plugin-utils/build/android.js +91 -0
- package/plugin-utils/build/common.d.ts +45 -0
- package/plugin-utils/build/common.js +312 -0
- package/plugin-utils/build/ios.d.ts +11 -0
- package/plugin-utils/build/ios.js +86 -0
- package/plugin-utils/src/android.ts +99 -0
- package/plugin-utils/src/common.ts +398 -0
- package/plugin-utils/src/ios.ts +102 -0
- package/plugin-utils/tsconfig.json +20 -0
- package/react-native.config.js +13 -0
- package/src/NativeReactNativeLegal.ts +8 -0
- package/src/ReactNativeLegal.android.ts +10 -0
- package/src/ReactNativeLegal.ios.ts +10 -0
- package/src/ReactNativeLegal.ts +5 -0
- package/src/index.ts +1 -0
|
@@ -0,0 +1,20 @@
|
|
|
1
|
+
{
|
|
2
|
+
"compilerOptions": {
|
|
3
|
+
"declaration": true,
|
|
4
|
+
"lib": ["es2020"],
|
|
5
|
+
"module": "commonjs",
|
|
6
|
+
"target": "es2020",
|
|
7
|
+
|
|
8
|
+
"strict": true,
|
|
9
|
+
"esModuleInterop": true,
|
|
10
|
+
"skipLibCheck": true,
|
|
11
|
+
"forceConsistentCasingInFileNames": true,
|
|
12
|
+
"moduleResolution": "node",
|
|
13
|
+
|
|
14
|
+
"outDir": "build",
|
|
15
|
+
"rootDir": "src",
|
|
16
|
+
"typeRoots": ["../types-definitions", "../../../node_modules/@types"]
|
|
17
|
+
},
|
|
18
|
+
"include": ["./src"],
|
|
19
|
+
"exclude": ["**/__mocks__/*", "**/__tests__/*"]
|
|
20
|
+
}
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
#import <React/RCTUtils.h>
|
|
@@ -0,0 +1,156 @@
|
|
|
1
|
+
class ReactNativeLegalDetailViewController: UIViewController {
|
|
2
|
+
private var licenseContentTextView: UITextView = {
|
|
3
|
+
let textView = UITextView()
|
|
4
|
+
|
|
5
|
+
#if os(tvOS)
|
|
6
|
+
let fontSize: CGFloat = 40
|
|
7
|
+
let horizontalContentInset: CGFloat = 100
|
|
8
|
+
let bottomContentInset: CGFloat = 100
|
|
9
|
+
#else
|
|
10
|
+
let fontSize: CGFloat = 13.3
|
|
11
|
+
let horizontalContentInset: CGFloat = 26
|
|
12
|
+
let bottomContentInset: CGFloat = 16
|
|
13
|
+
#endif
|
|
14
|
+
|
|
15
|
+
textView.alwaysBounceVertical = true
|
|
16
|
+
#if os(iOS)
|
|
17
|
+
textView.dataDetectorTypes = .link
|
|
18
|
+
#endif
|
|
19
|
+
textView.font = UIFont.systemFont(ofSize: fontSize)
|
|
20
|
+
#if os(iOS)
|
|
21
|
+
textView.isEditable = false
|
|
22
|
+
#endif
|
|
23
|
+
#if os(tvOS)
|
|
24
|
+
textView.isSelectable = true
|
|
25
|
+
textView.isUserInteractionEnabled = true
|
|
26
|
+
#endif
|
|
27
|
+
textView.textContainerInset = UIEdgeInsets(top: 0, left: horizontalContentInset, bottom: bottomContentInset, right: horizontalContentInset)
|
|
28
|
+
textView.translatesAutoresizingMaskIntoConstraints = false
|
|
29
|
+
|
|
30
|
+
if #available(iOS 13.0, tvOS 13.0, *) {
|
|
31
|
+
#if os(iOS)
|
|
32
|
+
textView.backgroundColor = .systemBackground
|
|
33
|
+
#endif
|
|
34
|
+
textView.textColor = .secondaryLabel
|
|
35
|
+
}
|
|
36
|
+
|
|
37
|
+
return textView
|
|
38
|
+
}()
|
|
39
|
+
|
|
40
|
+
private var metadata: ReactNativeLegalLicenseMetadata
|
|
41
|
+
|
|
42
|
+
init(metadata: ReactNativeLegalLicenseMetadata) {
|
|
43
|
+
self.metadata = metadata
|
|
44
|
+
super.init(nibName: nil, bundle: nil)
|
|
45
|
+
self.title = metadata.name
|
|
46
|
+
}
|
|
47
|
+
|
|
48
|
+
required init?(coder: NSCoder) {
|
|
49
|
+
fatalError("init(coder:) has not been implemented")
|
|
50
|
+
}
|
|
51
|
+
|
|
52
|
+
#if os(iOS)
|
|
53
|
+
private var scrolledToTopOnMount = false
|
|
54
|
+
|
|
55
|
+
override func viewDidLayoutSubviews() {
|
|
56
|
+
super.viewDidLayoutSubviews()
|
|
57
|
+
|
|
58
|
+
if scrolledToTopOnMount {
|
|
59
|
+
return
|
|
60
|
+
}
|
|
61
|
+
|
|
62
|
+
licenseContentTextView.setContentOffset(CGPoint.zero, animated: false)
|
|
63
|
+
scrolledToTopOnMount = true
|
|
64
|
+
}
|
|
65
|
+
#endif
|
|
66
|
+
|
|
67
|
+
override func viewDidLoad() {
|
|
68
|
+
super.viewDidLoad()
|
|
69
|
+
|
|
70
|
+
view.addSubview(licenseContentTextView)
|
|
71
|
+
#if os(iOS)
|
|
72
|
+
if #available(iOS 13.0, *) {
|
|
73
|
+
view.backgroundColor = .systemBackground
|
|
74
|
+
}
|
|
75
|
+
#endif
|
|
76
|
+
|
|
77
|
+
NSLayoutConstraint.activate([
|
|
78
|
+
licenseContentTextView.topAnchor.constraint(equalToSystemSpacingBelow: view.safeAreaLayoutGuide.topAnchor, multiplier: 1.0),
|
|
79
|
+
licenseContentTextView.bottomAnchor.constraint(equalToSystemSpacingBelow: view.safeAreaLayoutGuide.bottomAnchor, multiplier: 1.0),
|
|
80
|
+
licenseContentTextView.leadingAnchor.constraint(equalToSystemSpacingAfter: view.safeAreaLayoutGuide.leadingAnchor, multiplier: 1.0),
|
|
81
|
+
licenseContentTextView.trailingAnchor.constraint(equalToSystemSpacingAfter: view.safeAreaLayoutGuide.trailingAnchor, multiplier: 1.0)
|
|
82
|
+
])
|
|
83
|
+
|
|
84
|
+
licenseContentTextView.text = metadata.content
|
|
85
|
+
}
|
|
86
|
+
|
|
87
|
+
#if os(tvOS)
|
|
88
|
+
private var tvRemoteGestureRecognizers: [String : UISwipeGestureRecognizer] = [:]
|
|
89
|
+
|
|
90
|
+
override func didUpdateFocus(in context: UIFocusUpdateContext, with coordinator: UIFocusAnimationCoordinator) {
|
|
91
|
+
if context.previouslyFocusedView == context.nextFocusedView {
|
|
92
|
+
return
|
|
93
|
+
}
|
|
94
|
+
|
|
95
|
+
if context.nextFocusedView == licenseContentTextView {
|
|
96
|
+
licenseContentTextView.becomeFirstResponder()
|
|
97
|
+
self.addSwipeGestureRecognizers()
|
|
98
|
+
} else if context.previouslyFocusedView == licenseContentTextView {
|
|
99
|
+
self.removeSwipeGestureRecognizers()
|
|
100
|
+
licenseContentTextView.resignFirstResponder()
|
|
101
|
+
}
|
|
102
|
+
}
|
|
103
|
+
|
|
104
|
+
private func addSwipeGestureRecognizers() {
|
|
105
|
+
let recognizerUp = UISwipeGestureRecognizer(target: self, action: #selector(swipedUp))
|
|
106
|
+
recognizerUp.direction = .up
|
|
107
|
+
|
|
108
|
+
let recognizerDown = UISwipeGestureRecognizer(target: self, action: #selector(swipedDown))
|
|
109
|
+
recognizerDown.direction = .down
|
|
110
|
+
|
|
111
|
+
tvRemoteGestureRecognizers["swipedUp"] = recognizerUp
|
|
112
|
+
tvRemoteGestureRecognizers["swipedDown"] = recognizerDown
|
|
113
|
+
|
|
114
|
+
for recognizer in tvRemoteGestureRecognizers.values {
|
|
115
|
+
licenseContentTextView.addGestureRecognizer(recognizer)
|
|
116
|
+
}
|
|
117
|
+
}
|
|
118
|
+
|
|
119
|
+
private func removeSwipeGestureRecognizers() {
|
|
120
|
+
if let recognizerUp = tvRemoteGestureRecognizers["swipedUp"] {
|
|
121
|
+
licenseContentTextView.removeGestureRecognizer(recognizerUp)
|
|
122
|
+
}
|
|
123
|
+
|
|
124
|
+
if let recognizerDown = tvRemoteGestureRecognizers["swipedDown"] {
|
|
125
|
+
licenseContentTextView.removeGestureRecognizer(recognizerDown)
|
|
126
|
+
}
|
|
127
|
+
|
|
128
|
+
tvRemoteGestureRecognizers.removeAll()
|
|
129
|
+
}
|
|
130
|
+
|
|
131
|
+
@objc private func swipedUp() {
|
|
132
|
+
let offset = licenseContentTextView.contentOffset.y - licenseContentTextView.visibleSize.height / 2
|
|
133
|
+
|
|
134
|
+
self.swipeVertical(with: offset)
|
|
135
|
+
}
|
|
136
|
+
|
|
137
|
+
@objc private func swipedDown() {
|
|
138
|
+
let offset = licenseContentTextView.contentOffset.y + licenseContentTextView.visibleSize.height / 2
|
|
139
|
+
|
|
140
|
+
self.swipeVertical(with: offset)
|
|
141
|
+
}
|
|
142
|
+
|
|
143
|
+
@objc private func swipeVertical(with offset: CGFloat) {
|
|
144
|
+
DispatchQueue.main.async {
|
|
145
|
+
let newOffset = min(max(offset, 0), self.licenseContentTextView.contentSize.height - self.licenseContentTextView.visibleSize.height)
|
|
146
|
+
|
|
147
|
+
UIView.animate(withDuration: 0.5) {
|
|
148
|
+
self.licenseContentTextView.contentOffset = CGPoint(
|
|
149
|
+
x: self.licenseContentTextView.contentOffset.x,
|
|
150
|
+
y: newOffset
|
|
151
|
+
)
|
|
152
|
+
}
|
|
153
|
+
}
|
|
154
|
+
}
|
|
155
|
+
#endif
|
|
156
|
+
}
|
|
@@ -0,0 +1,29 @@
|
|
|
1
|
+
#import "ReactNativeLegalModule.h"
|
|
2
|
+
|
|
3
|
+
#import "ReactNativeLegal-Swift.h"
|
|
4
|
+
|
|
5
|
+
#if RCT_NEW_ARCH_ENABLED
|
|
6
|
+
#import "ReactNativeLegal.h"
|
|
7
|
+
|
|
8
|
+
@interface ReactNativeLegalModule () <NativeReactNativeLegalSpec>
|
|
9
|
+
@end
|
|
10
|
+
#endif
|
|
11
|
+
|
|
12
|
+
@implementation ReactNativeLegalModule
|
|
13
|
+
|
|
14
|
+
RCT_EXPORT_MODULE(ReactNativeLegalModule)
|
|
15
|
+
|
|
16
|
+
RCT_EXPORT_METHOD(launchLicenseListScreen : (NSString *)licenseHeaderText)
|
|
17
|
+
{
|
|
18
|
+
[ReactNativeLegalModuleImpl launchLicenseListScreenWithLicenseHeaderText:licenseHeaderText];
|
|
19
|
+
}
|
|
20
|
+
|
|
21
|
+
#if RCT_NEW_ARCH_ENABLED
|
|
22
|
+
- (std::shared_ptr<facebook::react::TurboModule>)getTurboModule:
|
|
23
|
+
(const facebook::react::ObjCTurboModule::InitParams &)params
|
|
24
|
+
{
|
|
25
|
+
return std::make_shared<facebook::react::NativeReactNativeLegalSpecJSI>(params);
|
|
26
|
+
}
|
|
27
|
+
#endif
|
|
28
|
+
|
|
29
|
+
@end
|
|
@@ -0,0 +1,78 @@
|
|
|
1
|
+
import UIKit
|
|
2
|
+
|
|
3
|
+
@objc(ReactNativeLegalModuleImpl)
|
|
4
|
+
public class ReactNativeLegalModuleImpl : NSObject {
|
|
5
|
+
@objc public static func launchLicenseListScreen(licenseHeaderText: String) {
|
|
6
|
+
guard
|
|
7
|
+
let settingsBundleUrl = Bundle.main.url(forResource: "Settings", withExtension: "bundle"),
|
|
8
|
+
let settingsBundle = Bundle(url: settingsBundleUrl),
|
|
9
|
+
let licensePlistUrl = settingsBundle.url(forResource: "com.mono0926.LicensePlist", withExtension: "plist"),
|
|
10
|
+
let dictArray = parsePlistToDictArray(fileUrl: licensePlistUrl) else {
|
|
11
|
+
return
|
|
12
|
+
}
|
|
13
|
+
|
|
14
|
+
let licenses = parseRawLicenseMetadataToArray(
|
|
15
|
+
rawLicenses: getChildPaneSpecifiers(dictArray: dictArray),
|
|
16
|
+
licensePlistUrl: licensePlistUrl
|
|
17
|
+
)
|
|
18
|
+
|
|
19
|
+
DispatchQueue.main.async {
|
|
20
|
+
guard let presentedViewController = RCTPresentedViewController() else {
|
|
21
|
+
return
|
|
22
|
+
}
|
|
23
|
+
|
|
24
|
+
let tableViewController = ReactNativeLegalTableViewController(title: licenseHeaderText, data: licenses)
|
|
25
|
+
let navController = UINavigationController(rootViewController: tableViewController)
|
|
26
|
+
navController.modalPresentationStyle = .fullScreen
|
|
27
|
+
presentedViewController.present(navController, animated: true)
|
|
28
|
+
}
|
|
29
|
+
}
|
|
30
|
+
|
|
31
|
+
private static func getChildPaneSpecifiers(dictArray: Array<Dictionary<String, Any>>) -> Array<Dictionary<String, Any>> {
|
|
32
|
+
return dictArray
|
|
33
|
+
.filter { $0["Type"] as? String == "PSChildPaneSpecifier" }
|
|
34
|
+
}
|
|
35
|
+
|
|
36
|
+
private static func parseRawLicenseMetadataToArray(rawLicenses: Array<Dictionary<String, Any>>, licensePlistUrl: URL) -> [ReactNativeLegalLicenseMetadata] {
|
|
37
|
+
return rawLicenses
|
|
38
|
+
.map { licenseObj in
|
|
39
|
+
guard
|
|
40
|
+
let file = licenseObj["File"] as? String,
|
|
41
|
+
let title = licenseObj["Title"] as? String else {
|
|
42
|
+
return ReactNativeLegalLicenseMetadata()
|
|
43
|
+
}
|
|
44
|
+
|
|
45
|
+
let fileUrl = licensePlistUrl.deletingLastPathComponent().addPathComponent(file).appendingPathExtension("plist")
|
|
46
|
+
|
|
47
|
+
guard
|
|
48
|
+
let data = parsePlistToDictArray(fileUrl: fileUrl),
|
|
49
|
+
let item = data.first(where: { $0["FooterText"] != nil }),
|
|
50
|
+
let footerText = item["FooterText"] as? String else {
|
|
51
|
+
return ReactNativeLegalLicenseMetadata(name: title)
|
|
52
|
+
}
|
|
53
|
+
|
|
54
|
+
return ReactNativeLegalLicenseMetadata(name: title, content: footerText)
|
|
55
|
+
}
|
|
56
|
+
.filter { $0.name != nil }
|
|
57
|
+
}
|
|
58
|
+
|
|
59
|
+
private static func parsePlistToDictArray(fileUrl: URL) -> Array<Dictionary<String, Any>>? {
|
|
60
|
+
guard
|
|
61
|
+
let data = try? NSDictionary(contentsOf: fileUrl, error: ()),
|
|
62
|
+
let array = data["PreferenceSpecifiers"] as? [Any] else {
|
|
63
|
+
return nil
|
|
64
|
+
}
|
|
65
|
+
|
|
66
|
+
return array.compactMap { $0 as? Dictionary<String, Any> }
|
|
67
|
+
}
|
|
68
|
+
}
|
|
69
|
+
|
|
70
|
+
extension URL {
|
|
71
|
+
func addPathComponent(_ component: String) -> URL {
|
|
72
|
+
if #available(iOS 16.0, tvOS 16.0, *) {
|
|
73
|
+
return self.appending(component: component)
|
|
74
|
+
}
|
|
75
|
+
|
|
76
|
+
return self.appendingPathComponent(component)
|
|
77
|
+
}
|
|
78
|
+
}
|
|
@@ -0,0 +1,72 @@
|
|
|
1
|
+
class ReactNativeLegalTableViewController: UITableViewController {
|
|
2
|
+
private let CELL_IDENTIFIER = "OSSNoticeCell"
|
|
3
|
+
|
|
4
|
+
private var data: [ReactNativeLegalLicenseMetadata] = [] {
|
|
5
|
+
didSet {
|
|
6
|
+
tableView.reloadData()
|
|
7
|
+
}
|
|
8
|
+
}
|
|
9
|
+
|
|
10
|
+
public convenience init(title: String, data: Array<ReactNativeLegalLicenseMetadata>) {
|
|
11
|
+
#if os(iOS)
|
|
12
|
+
if #available(iOS 13.0, *) {
|
|
13
|
+
self.init(style: .insetGrouped)
|
|
14
|
+
} else {
|
|
15
|
+
self.init(style: .grouped)
|
|
16
|
+
}
|
|
17
|
+
#else
|
|
18
|
+
self.init(style: .grouped)
|
|
19
|
+
#endif
|
|
20
|
+
self.title = title
|
|
21
|
+
self.data = data
|
|
22
|
+
}
|
|
23
|
+
|
|
24
|
+
#if os(iOS)
|
|
25
|
+
override func viewDidLoad() {
|
|
26
|
+
super.viewDidLoad()
|
|
27
|
+
|
|
28
|
+
setupCloseButton()
|
|
29
|
+
}
|
|
30
|
+
#endif
|
|
31
|
+
|
|
32
|
+
@objc func dismissTableViewController(_ sender: AnyObject) {
|
|
33
|
+
self.navigationController?.dismiss(animated: true)
|
|
34
|
+
}
|
|
35
|
+
|
|
36
|
+
override func tableView(_ tableView: UITableView, cellForRowAt indexPath: IndexPath) -> UITableViewCell {
|
|
37
|
+
let dequeuedCell = tableView.dequeueReusableCell(withIdentifier: CELL_IDENTIFIER) ?? UITableViewCell(style: UITableViewCell.CellStyle.default, reuseIdentifier: CELL_IDENTIFIER)
|
|
38
|
+
|
|
39
|
+
let metadata = data[indexPath.row]
|
|
40
|
+
|
|
41
|
+
dequeuedCell.textLabel?.text = metadata.name
|
|
42
|
+
dequeuedCell.accessoryType = UITableViewCell.AccessoryType.disclosureIndicator
|
|
43
|
+
|
|
44
|
+
return dequeuedCell
|
|
45
|
+
}
|
|
46
|
+
|
|
47
|
+
override func tableView(_ tableView: UITableView, numberOfRowsInSection section: Int) -> Int {
|
|
48
|
+
return data.count
|
|
49
|
+
}
|
|
50
|
+
|
|
51
|
+
override func tableView(_ tableView: UITableView, didSelectRowAt indexPath: IndexPath) {
|
|
52
|
+
let metadata = data[indexPath.row]
|
|
53
|
+
let detailViewController = ReactNativeLegalDetailViewController(metadata: metadata)
|
|
54
|
+
|
|
55
|
+
self.navigationController?.pushViewController(detailViewController, animated: true)
|
|
56
|
+
}
|
|
57
|
+
|
|
58
|
+
#if os(iOS)
|
|
59
|
+
private func setupCloseButton() {
|
|
60
|
+
var barButtonSystemItem: UIBarButtonItem.SystemItem = .done
|
|
61
|
+
if #available(iOS 13.0, *) {
|
|
62
|
+
barButtonSystemItem = .close
|
|
63
|
+
}
|
|
64
|
+
|
|
65
|
+
self.navigationItem.leftBarButtonItem = UIBarButtonItem(
|
|
66
|
+
barButtonSystemItem: barButtonSystemItem,
|
|
67
|
+
target: self,
|
|
68
|
+
action: #selector(dismissTableViewController(_:))
|
|
69
|
+
)
|
|
70
|
+
}
|
|
71
|
+
#endif
|
|
72
|
+
}
|
|
@@ -0,0 +1,10 @@
|
|
|
1
|
+
"use strict";
|
|
2
|
+
|
|
3
|
+
Object.defineProperty(exports, "__esModule", {
|
|
4
|
+
value: true
|
|
5
|
+
});
|
|
6
|
+
exports.default = void 0;
|
|
7
|
+
var _reactNative = require("react-native");
|
|
8
|
+
var _default = _reactNative.TurboModuleRegistry.getEnforcing('ReactNativeLegalModule');
|
|
9
|
+
exports.default = _default;
|
|
10
|
+
//# sourceMappingURL=NativeReactNativeLegal.js.map
|
|
@@ -0,0 +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,GAMpCC,gCAAmB,CAACC,YAAY,CAAO,wBAAwB,CAAC;AAAAC,OAAA,CAAAC,OAAA,GAAAJ,QAAA"}
|
|
@@ -0,0 +1,18 @@
|
|
|
1
|
+
"use strict";
|
|
2
|
+
|
|
3
|
+
Object.defineProperty(exports, "__esModule", {
|
|
4
|
+
value: true
|
|
5
|
+
});
|
|
6
|
+
exports.ReactNativeLegal = void 0;
|
|
7
|
+
var _NativeReactNativeLegal = _interopRequireDefault(require("./NativeReactNativeLegal"));
|
|
8
|
+
function _interopRequireDefault(obj) { return obj && obj.__esModule ? obj : { default: obj }; }
|
|
9
|
+
const ReactNativeLegal = {
|
|
10
|
+
launchLicenseListScreen: licenseHeaderText => {
|
|
11
|
+
/**
|
|
12
|
+
* On Android, the licenses list is displayed as a custom activity
|
|
13
|
+
*/
|
|
14
|
+
_NativeReactNativeLegal.default.launchLicenseListScreen(licenseHeaderText ?? 'OSS Licenses');
|
|
15
|
+
}
|
|
16
|
+
};
|
|
17
|
+
exports.ReactNativeLegal = ReactNativeLegal;
|
|
18
|
+
//# sourceMappingURL=ReactNativeLegal.android.js.map
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"names":["_NativeReactNativeLegal","_interopRequireDefault","require","obj","__esModule","default","ReactNativeLegal","launchLicenseListScreen","licenseHeaderText","NativeReactNativeLegal","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,uBAAuB,EAAGC,iBAA0B,IAAK;IACvD;AACJ;AACA;IACIC,+BAAsB,CAACF,uBAAuB,CAACC,iBAAiB,IAAI,cAAc,CAAC;EACrF;AACF,CAAC;AAACE,OAAA,CAAAJ,gBAAA,GAAAA,gBAAA"}
|
|
@@ -0,0 +1,18 @@
|
|
|
1
|
+
"use strict";
|
|
2
|
+
|
|
3
|
+
Object.defineProperty(exports, "__esModule", {
|
|
4
|
+
value: true
|
|
5
|
+
});
|
|
6
|
+
exports.ReactNativeLegal = void 0;
|
|
7
|
+
var _NativeReactNativeLegal = _interopRequireDefault(require("./NativeReactNativeLegal"));
|
|
8
|
+
function _interopRequireDefault(obj) { return obj && obj.__esModule ? obj : { default: obj }; }
|
|
9
|
+
const ReactNativeLegal = {
|
|
10
|
+
launchLicenseListScreen: licenseHeaderText => {
|
|
11
|
+
/**
|
|
12
|
+
* On iOS, the licenses list is displayed as a custom table view controller
|
|
13
|
+
*/
|
|
14
|
+
_NativeReactNativeLegal.default.launchLicenseListScreen(licenseHeaderText ?? 'OSS Licenses');
|
|
15
|
+
}
|
|
16
|
+
};
|
|
17
|
+
exports.ReactNativeLegal = ReactNativeLegal;
|
|
18
|
+
//# sourceMappingURL=ReactNativeLegal.ios.js.map
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"names":["_NativeReactNativeLegal","_interopRequireDefault","require","obj","__esModule","default","ReactNativeLegal","launchLicenseListScreen","licenseHeaderText","NativeReactNativeLegal","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,uBAAuB,EAAGC,iBAA0B,IAAK;IACvD;AACJ;AACA;IACIC,+BAAsB,CAACF,uBAAuB,CAACC,iBAAiB,IAAI,cAAc,CAAC;EACrF;AACF,CAAC;AAACE,OAAA,CAAAJ,gBAAA,GAAAA,gBAAA"}
|
|
@@ -0,0 +1,13 @@
|
|
|
1
|
+
"use strict";
|
|
2
|
+
|
|
3
|
+
Object.defineProperty(exports, "__esModule", {
|
|
4
|
+
value: true
|
|
5
|
+
});
|
|
6
|
+
exports.ReactNativeLegal = void 0;
|
|
7
|
+
const ReactNativeLegal = {
|
|
8
|
+
launchLicenseListScreen: _licenseHeaderText => {
|
|
9
|
+
//
|
|
10
|
+
}
|
|
11
|
+
};
|
|
12
|
+
exports.ReactNativeLegal = ReactNativeLegal;
|
|
13
|
+
//# sourceMappingURL=ReactNativeLegal.js.map
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"names":["ReactNativeLegal","launchLicenseListScreen","_licenseHeaderText","exports"],"sourceRoot":"../../src","sources":["ReactNativeLegal.ts"],"mappings":";;;;;;AAAO,MAAMA,gBAAgB,GAAG;EAC9BC,uBAAuB,EAAGC,kBAA2B,IAAK;IACxD;EAAA;AAEJ,CAAC;AAACC,OAAA,CAAAH,gBAAA,GAAAA,gBAAA"}
|
|
@@ -0,0 +1,13 @@
|
|
|
1
|
+
"use strict";
|
|
2
|
+
|
|
3
|
+
Object.defineProperty(exports, "__esModule", {
|
|
4
|
+
value: true
|
|
5
|
+
});
|
|
6
|
+
Object.defineProperty(exports, "ReactNativeLegal", {
|
|
7
|
+
enumerable: true,
|
|
8
|
+
get: function () {
|
|
9
|
+
return _ReactNativeLegal.ReactNativeLegal;
|
|
10
|
+
}
|
|
11
|
+
});
|
|
12
|
+
var _ReactNativeLegal = require("./ReactNativeLegal");
|
|
13
|
+
//# sourceMappingURL=index.js.map
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"names":["_ReactNativeLegal","require"],"sourceRoot":"../../src","sources":["index.ts"],"mappings":";;;;;;;;;;;AAAA,IAAAA,iBAAA,GAAAC,OAAA"}
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"names":["TurboModuleRegistry","getEnforcing"],"sourceRoot":"../../src","sources":["NativeReactNativeLegal.ts"],"mappings":"AACA,SAASA,mBAAmB,QAAQ,cAAc;AAMlD,eAAeA,mBAAmB,CAACC,YAAY,CAAO,wBAAwB,CAAC"}
|
|
@@ -0,0 +1,10 @@
|
|
|
1
|
+
import NativeReactNativeLegal from './NativeReactNativeLegal';
|
|
2
|
+
export const ReactNativeLegal = {
|
|
3
|
+
launchLicenseListScreen: licenseHeaderText => {
|
|
4
|
+
/**
|
|
5
|
+
* On Android, the licenses list is displayed as a custom activity
|
|
6
|
+
*/
|
|
7
|
+
NativeReactNativeLegal.launchLicenseListScreen(licenseHeaderText ?? 'OSS Licenses');
|
|
8
|
+
}
|
|
9
|
+
};
|
|
10
|
+
//# sourceMappingURL=ReactNativeLegal.android.js.map
|
|
@@ -0,0 +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;IACIH,sBAAsB,CAACE,uBAAuB,CAACC,iBAAiB,IAAI,cAAc,CAAC;EACrF;AACF,CAAC"}
|
|
@@ -0,0 +1,10 @@
|
|
|
1
|
+
import NativeReactNativeLegal from './NativeReactNativeLegal';
|
|
2
|
+
export const ReactNativeLegal = {
|
|
3
|
+
launchLicenseListScreen: licenseHeaderText => {
|
|
4
|
+
/**
|
|
5
|
+
* On iOS, the licenses list is displayed as a custom table view controller
|
|
6
|
+
*/
|
|
7
|
+
NativeReactNativeLegal.launchLicenseListScreen(licenseHeaderText ?? 'OSS Licenses');
|
|
8
|
+
}
|
|
9
|
+
};
|
|
10
|
+
//# sourceMappingURL=ReactNativeLegal.ios.js.map
|
|
@@ -0,0 +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;IACIH,sBAAsB,CAACE,uBAAuB,CAACC,iBAAiB,IAAI,cAAc,CAAC;EACrF;AACF,CAAC"}
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"names":["ReactNativeLegal","launchLicenseListScreen","_licenseHeaderText"],"sourceRoot":"../../src","sources":["ReactNativeLegal.ts"],"mappings":"AAAA,OAAO,MAAMA,gBAAgB,GAAG;EAC9BC,uBAAuB,EAAGC,kBAA2B,IAAK;IACxD;EAAA;AAEJ,CAAC"}
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"names":["ReactNativeLegal"],"sourceRoot":"../../src","sources":["index.ts"],"mappings":"AAAA,SAASA,gBAAgB,QAAQ,oBAAoB"}
|
|
@@ -0,0 +1,7 @@
|
|
|
1
|
+
import type { TurboModule } from 'react-native';
|
|
2
|
+
export interface Spec extends TurboModule {
|
|
3
|
+
launchLicenseListScreen(licenseHeaderText: string): void;
|
|
4
|
+
}
|
|
5
|
+
declare const _default: Spec;
|
|
6
|
+
export default _default;
|
|
7
|
+
//# sourceMappingURL=NativeReactNativeLegal.d.ts.map
|
|
@@ -0,0 +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"}
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"ReactNativeLegal.android.d.ts","sourceRoot":"","sources":["../../src/ReactNativeLegal.android.ts"],"names":[],"mappings":"AAEA,eAAO,MAAM,gBAAgB;kDACmB,MAAM;CAMrD,CAAC"}
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"ReactNativeLegal.d.ts","sourceRoot":"","sources":["../../src/ReactNativeLegal.ts"],"names":[],"mappings":"AAAA,eAAO,MAAM,gBAAgB;mDACoB,MAAM;CAGtD,CAAC"}
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"ReactNativeLegal.ios.d.ts","sourceRoot":"","sources":["../../src/ReactNativeLegal.ios.ts"],"names":[],"mappings":"AAEA,eAAO,MAAM,gBAAgB;kDACmB,MAAM;CAMrD,CAAC"}
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"index.d.ts","sourceRoot":"","sources":["../../src/index.ts"],"names":[],"mappings":"AAAA,OAAO,EAAE,gBAAgB,EAAE,MAAM,oBAAoB,CAAC"}
|