@mux/mux-data-react-native-video 0.5.7
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/.eslintrc +9 -0
- package/CHANGELOG.md +124 -0
- package/DemoApp/.buckconfig +6 -0
- package/DemoApp/.eslintrc.js +4 -0
- package/DemoApp/.flowconfig +75 -0
- package/DemoApp/.gitattributes +1 -0
- package/DemoApp/.prettierrc.js +6 -0
- package/DemoApp/.watchmanconfig +1 -0
- package/DemoApp/App.js +121 -0
- package/DemoApp/README.md +17 -0
- package/DemoApp/__tests__/App-test.js +14 -0
- package/DemoApp/android/app/BUCK +55 -0
- package/DemoApp/android/app/build.gradle +201 -0
- package/DemoApp/android/app/build_defs.bzl +19 -0
- package/DemoApp/android/app/debug.keystore +0 -0
- package/DemoApp/android/app/proguard-rules.pro +10 -0
- package/DemoApp/android/app/src/debug/AndroidManifest.xml +8 -0
- package/DemoApp/android/app/src/main/AndroidManifest.xml +26 -0
- package/DemoApp/android/app/src/main/java/com/demoapp/MainActivity.java +15 -0
- package/DemoApp/android/app/src/main/java/com/demoapp/MainApplication.java +74 -0
- package/DemoApp/android/app/src/main/res/mipmap-hdpi/ic_launcher.png +0 -0
- package/DemoApp/android/app/src/main/res/mipmap-hdpi/ic_launcher_round.png +0 -0
- package/DemoApp/android/app/src/main/res/mipmap-mdpi/ic_launcher.png +0 -0
- package/DemoApp/android/app/src/main/res/mipmap-mdpi/ic_launcher_round.png +0 -0
- package/DemoApp/android/app/src/main/res/mipmap-xhdpi/ic_launcher.png +0 -0
- package/DemoApp/android/app/src/main/res/mipmap-xhdpi/ic_launcher_round.png +0 -0
- package/DemoApp/android/app/src/main/res/mipmap-xxhdpi/ic_launcher.png +0 -0
- package/DemoApp/android/app/src/main/res/mipmap-xxhdpi/ic_launcher_round.png +0 -0
- package/DemoApp/android/app/src/main/res/mipmap-xxxhdpi/ic_launcher.png +0 -0
- package/DemoApp/android/app/src/main/res/mipmap-xxxhdpi/ic_launcher_round.png +0 -0
- package/DemoApp/android/app/src/main/res/values/strings.xml +3 -0
- package/DemoApp/android/app/src/main/res/values/styles.xml +9 -0
- package/DemoApp/android/build.gradle +38 -0
- package/DemoApp/android/gradle/wrapper/gradle-wrapper.jar +0 -0
- package/DemoApp/android/gradle/wrapper/gradle-wrapper.properties +5 -0
- package/DemoApp/android/gradle.properties +21 -0
- package/DemoApp/android/gradlew +188 -0
- package/DemoApp/android/gradlew.bat +100 -0
- package/DemoApp/android/settings.gradle +3 -0
- package/DemoApp/app.json +4 -0
- package/DemoApp/babel.config.js +3 -0
- package/DemoApp/index.js +9 -0
- package/DemoApp/ios/DemoApp/AppDelegate.h +15 -0
- package/DemoApp/ios/DemoApp/AppDelegate.m +42 -0
- package/DemoApp/ios/DemoApp/Base.lproj/LaunchScreen.xib +42 -0
- package/DemoApp/ios/DemoApp/Images.xcassets/AppIcon.appiconset/Contents.json +38 -0
- package/DemoApp/ios/DemoApp/Images.xcassets/Contents.json +6 -0
- package/DemoApp/ios/DemoApp/Info.plist +57 -0
- package/DemoApp/ios/DemoApp/main.m +16 -0
- package/DemoApp/ios/DemoApp-tvOS/Info.plist +53 -0
- package/DemoApp/ios/DemoApp-tvOSTests/Info.plist +24 -0
- package/DemoApp/ios/DemoApp.xcodeproj/project.pbxproj +942 -0
- package/DemoApp/ios/DemoApp.xcodeproj/xcshareddata/xcschemes/DemoApp-tvOS.xcscheme +129 -0
- package/DemoApp/ios/DemoApp.xcodeproj/xcshareddata/xcschemes/DemoApp.xcscheme +129 -0
- package/DemoApp/ios/DemoApp.xcworkspace/contents.xcworkspacedata +10 -0
- package/DemoApp/ios/DemoAppTests/DemoAppTests.m +72 -0
- package/DemoApp/ios/DemoAppTests/Info.plist +24 -0
- package/DemoApp/ios/Podfile +59 -0
- package/DemoApp/ios/Podfile.lock +429 -0
- package/DemoApp/metro.config.js +17 -0
- package/DemoApp/package.json +32 -0
- package/DemoApp/yarn.lock +7143 -0
- package/README.md +96 -0
- package/README_INTERNAL.md +11 -0
- package/mux-react-native-video-sdk.podspec +19 -0
- package/package.json +27 -0
- package/src/index.js +258 -0
package/.eslintrc
ADDED
package/CHANGELOG.md
ADDED
|
@@ -0,0 +1,124 @@
|
|
|
1
|
+
# mux-react-native-video-sdk
|
|
2
|
+
|
|
3
|
+
## 0.5.7
|
|
4
|
+
|
|
5
|
+
### Patch Changes
|
|
6
|
+
|
|
7
|
+
- Updated dependencies [aaf3b01]
|
|
8
|
+
- mux-embed@4.12.1
|
|
9
|
+
|
|
10
|
+
## 0.5.6
|
|
11
|
+
|
|
12
|
+
### Patch Changes
|
|
13
|
+
|
|
14
|
+
- Updated dependencies [856b2df]
|
|
15
|
+
- mux-embed@4.12.0
|
|
16
|
+
|
|
17
|
+
## 0.5.5
|
|
18
|
+
|
|
19
|
+
### Patch Changes
|
|
20
|
+
|
|
21
|
+
- Updated dependencies [b2499f4]
|
|
22
|
+
- mux-embed@4.11.0
|
|
23
|
+
|
|
24
|
+
## 0.5.4
|
|
25
|
+
|
|
26
|
+
### Patch Changes
|
|
27
|
+
|
|
28
|
+
- Updated dependencies [a59a3ee]
|
|
29
|
+
- Updated dependencies [a59a3ee]
|
|
30
|
+
- mux-embed@4.10.0
|
|
31
|
+
|
|
32
|
+
## 0.5.3
|
|
33
|
+
|
|
34
|
+
### Patch Changes
|
|
35
|
+
|
|
36
|
+
- Updated dependencies [91c4794]
|
|
37
|
+
- mux-embed@4.9.4
|
|
38
|
+
|
|
39
|
+
## 0.5.2
|
|
40
|
+
|
|
41
|
+
### Patch Changes
|
|
42
|
+
|
|
43
|
+
- ecf1447: Use common function for generating short IDs
|
|
44
|
+
- Updated dependencies [139c6a2]
|
|
45
|
+
- Updated dependencies [ecf1447]
|
|
46
|
+
- mux-embed@4.9.3
|
|
47
|
+
|
|
48
|
+
## 0.5.1
|
|
49
|
+
|
|
50
|
+
### Patch Changes
|
|
51
|
+
|
|
52
|
+
- Updated dependencies [0323215]
|
|
53
|
+
- mux-embed@4.9.2
|
|
54
|
+
|
|
55
|
+
## 0.5.0
|
|
56
|
+
|
|
57
|
+
### Minor Changes
|
|
58
|
+
|
|
59
|
+
- 6e2b890: We now expose the emit function the SDK uses which allows developers to manually invoke an event emission.
|
|
60
|
+
|
|
61
|
+
## 0.4.6
|
|
62
|
+
|
|
63
|
+
### Patch Changes
|
|
64
|
+
|
|
65
|
+
- Updated dependencies [e4b3b16]
|
|
66
|
+
- mux-embed@4.9.1
|
|
67
|
+
|
|
68
|
+
## 0.4.5
|
|
69
|
+
|
|
70
|
+
### Patch Changes
|
|
71
|
+
|
|
72
|
+
- Updated dependencies [28af90d]
|
|
73
|
+
- Updated dependencies [6fc81db]
|
|
74
|
+
- mux-embed@4.9.0
|
|
75
|
+
|
|
76
|
+
## 0.4.4
|
|
77
|
+
|
|
78
|
+
### Patch Changes
|
|
79
|
+
|
|
80
|
+
- Updated dependencies [2572844]
|
|
81
|
+
- Updated dependencies [5b57b38]
|
|
82
|
+
- Updated dependencies [6bd4336]
|
|
83
|
+
- mux-embed@4.8.0
|
|
84
|
+
|
|
85
|
+
## 0.4.3
|
|
86
|
+
|
|
87
|
+
### Patch Changes
|
|
88
|
+
|
|
89
|
+
- Updated dependencies [d2c2670]
|
|
90
|
+
- mux-embed@4.7.0
|
|
91
|
+
|
|
92
|
+
## 0.4.2
|
|
93
|
+
|
|
94
|
+
### Patch Changes
|
|
95
|
+
|
|
96
|
+
- Updated dependencies [4f2187c]
|
|
97
|
+
- mux-embed@4.6.2
|
|
98
|
+
|
|
99
|
+
## 0.4.1
|
|
100
|
+
|
|
101
|
+
### Patch Changes
|
|
102
|
+
|
|
103
|
+
- Updated dependencies [51476cc]
|
|
104
|
+
- mux-embed@4.6.1
|
|
105
|
+
|
|
106
|
+
## 0.4.0
|
|
107
|
+
|
|
108
|
+
### Minor Changes
|
|
109
|
+
|
|
110
|
+
- ffaf7f5: Bump mux-embed to 4.6.0
|
|
111
|
+
|
|
112
|
+
## 0.3.0
|
|
113
|
+
|
|
114
|
+
- Fix an issue where `playerID` is `null` when wrapping the component with react-native-video-controls.
|
|
115
|
+
|
|
116
|
+
## 0.2.0
|
|
117
|
+
|
|
118
|
+
- Update `mux-embed` to v4.2.0
|
|
119
|
+
- Fix an issue where views that resulted from `programchange` may not have been tracked correctly
|
|
120
|
+
- Fix an issue where if `destroy` was called multiple times, it would raise an exception
|
|
121
|
+
|
|
122
|
+
## 0.1.0
|
|
123
|
+
|
|
124
|
+
- Initial release
|
|
@@ -0,0 +1,75 @@
|
|
|
1
|
+
[ignore]
|
|
2
|
+
; We fork some components by platform
|
|
3
|
+
.*/*[.]android.js
|
|
4
|
+
|
|
5
|
+
; Ignore "BUCK" generated dirs
|
|
6
|
+
<PROJECT_ROOT>/\.buckd/
|
|
7
|
+
|
|
8
|
+
; Ignore polyfills
|
|
9
|
+
node_modules/react-native/Libraries/polyfills/.*
|
|
10
|
+
|
|
11
|
+
; These should not be required directly
|
|
12
|
+
; require from fbjs/lib instead: require('fbjs/lib/warning')
|
|
13
|
+
node_modules/warning/.*
|
|
14
|
+
|
|
15
|
+
; Flow doesn't support platforms
|
|
16
|
+
.*/Libraries/Utilities/LoadingView.js
|
|
17
|
+
|
|
18
|
+
[untyped]
|
|
19
|
+
.*/node_modules/@react-native-community/cli/.*/.*
|
|
20
|
+
|
|
21
|
+
[include]
|
|
22
|
+
|
|
23
|
+
[libs]
|
|
24
|
+
node_modules/react-native/Libraries/react-native/react-native-interface.js
|
|
25
|
+
node_modules/react-native/flow/
|
|
26
|
+
|
|
27
|
+
[options]
|
|
28
|
+
emoji=true
|
|
29
|
+
|
|
30
|
+
esproposal.optional_chaining=enable
|
|
31
|
+
esproposal.nullish_coalescing=enable
|
|
32
|
+
|
|
33
|
+
module.file_ext=.js
|
|
34
|
+
module.file_ext=.json
|
|
35
|
+
module.file_ext=.ios.js
|
|
36
|
+
|
|
37
|
+
munge_underscores=true
|
|
38
|
+
|
|
39
|
+
module.name_mapper='^react-native$' -> '<PROJECT_ROOT>/node_modules/react-native/Libraries/react-native/react-native-implementation'
|
|
40
|
+
module.name_mapper='^react-native/\(.*\)$' -> '<PROJECT_ROOT>/node_modules/react-native/\1'
|
|
41
|
+
module.name_mapper='^[./a-zA-Z0-9$_-]+\.\(bmp\|gif\|jpg\|jpeg\|png\|psd\|svg\|webp\|m4v\|mov\|mp4\|mpeg\|mpg\|webm\|aac\|aiff\|caf\|m4a\|mp3\|wav\|html\|pdf\)$' -> '<PROJECT_ROOT>/node_modules/react-native/Libraries/Image/RelativeImageStub'
|
|
42
|
+
|
|
43
|
+
suppress_type=$FlowIssue
|
|
44
|
+
suppress_type=$FlowFixMe
|
|
45
|
+
suppress_type=$FlowFixMeProps
|
|
46
|
+
suppress_type=$FlowFixMeState
|
|
47
|
+
|
|
48
|
+
suppress_comment=\\(.\\|\n\\)*\\$FlowFixMe\\($\\|[^(]\\|(\\(<VERSION>\\)? *\\(site=[a-z,_]*react_native\\(_ios\\)?_\\(oss\\|fb\\)[a-z,_]*\\)?)\\)
|
|
49
|
+
suppress_comment=\\(.\\|\n\\)*\\$FlowIssue\\((\\(<VERSION>\\)? *\\(site=[a-z,_]*react_native\\(_ios\\)?_\\(oss\\|fb\\)[a-z,_]*\\)?)\\)?:? #[0-9]+
|
|
50
|
+
suppress_comment=\\(.\\|\n\\)*\\$FlowExpectedError
|
|
51
|
+
|
|
52
|
+
[lints]
|
|
53
|
+
sketchy-null-number=warn
|
|
54
|
+
sketchy-null-mixed=warn
|
|
55
|
+
sketchy-number=warn
|
|
56
|
+
untyped-type-import=warn
|
|
57
|
+
nonstrict-import=warn
|
|
58
|
+
deprecated-type=warn
|
|
59
|
+
unsafe-getters-setters=warn
|
|
60
|
+
inexact-spread=warn
|
|
61
|
+
unnecessary-invariant=warn
|
|
62
|
+
signature-verification-failure=warn
|
|
63
|
+
deprecated-utility=error
|
|
64
|
+
|
|
65
|
+
[strict]
|
|
66
|
+
deprecated-type
|
|
67
|
+
nonstrict-import
|
|
68
|
+
sketchy-null
|
|
69
|
+
unclear-type
|
|
70
|
+
unsafe-getters-setters
|
|
71
|
+
untyped-import
|
|
72
|
+
untyped-type-import
|
|
73
|
+
|
|
74
|
+
[version]
|
|
75
|
+
^0.105.0
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
*.pbxproj -text
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{}
|
package/DemoApp/App.js
ADDED
|
@@ -0,0 +1,121 @@
|
|
|
1
|
+
/**
|
|
2
|
+
* Sample React Native App
|
|
3
|
+
* https://github.com/facebook/react-native
|
|
4
|
+
*
|
|
5
|
+
* @format
|
|
6
|
+
* @flow
|
|
7
|
+
*/
|
|
8
|
+
|
|
9
|
+
import React, {useState, useEffect} from 'react';
|
|
10
|
+
import {
|
|
11
|
+
SafeAreaView,
|
|
12
|
+
StyleSheet,
|
|
13
|
+
ScrollView,
|
|
14
|
+
View,
|
|
15
|
+
Text,
|
|
16
|
+
StatusBar,
|
|
17
|
+
Button,
|
|
18
|
+
} from 'react-native';
|
|
19
|
+
|
|
20
|
+
import {Colors} from 'react-native/Libraries/NewAppScreen';
|
|
21
|
+
import Video from 'react-native-video';
|
|
22
|
+
import muxReactNativeVideo from 'mux-react-native-video-sdk';
|
|
23
|
+
import app from './package.json';
|
|
24
|
+
|
|
25
|
+
const MuxVideo = muxReactNativeVideo(Video);
|
|
26
|
+
|
|
27
|
+
const App: () => React$Node = () => {
|
|
28
|
+
const [showVideo, setShowVideo] = useState(false);
|
|
29
|
+
|
|
30
|
+
useEffect(() => {}, []);
|
|
31
|
+
|
|
32
|
+
return (
|
|
33
|
+
<>
|
|
34
|
+
<StatusBar barStyle="dark-content" />
|
|
35
|
+
<SafeAreaView>
|
|
36
|
+
<ScrollView
|
|
37
|
+
contentInsetAdjustmentBehavior="automatic"
|
|
38
|
+
style={styles.scrollView}>
|
|
39
|
+
{global.HermesInternal == null ? null : (
|
|
40
|
+
<View style={styles.engine}>
|
|
41
|
+
<Text style={styles.footer}>Engine: Hermes</Text>
|
|
42
|
+
</View>
|
|
43
|
+
)}
|
|
44
|
+
<View style={styles.body}>
|
|
45
|
+
<Button
|
|
46
|
+
title={showVideo ? 'Hide Player' : 'Show Player'}
|
|
47
|
+
onPress={() => setShowVideo(!showVideo)}
|
|
48
|
+
/>
|
|
49
|
+
{showVideo && (
|
|
50
|
+
<MuxVideo
|
|
51
|
+
style={styles.video}
|
|
52
|
+
source={{
|
|
53
|
+
uri:
|
|
54
|
+
'https://bitdash-a.akamaihd.net/content/MI201109210084_1/m3u8s/f08e80da-bf1d-4e3d-8899-f0f6155f6efa.m3u8',
|
|
55
|
+
}}
|
|
56
|
+
controls
|
|
57
|
+
muted
|
|
58
|
+
muxOptions={{
|
|
59
|
+
debug: true,
|
|
60
|
+
application_name: app.name,
|
|
61
|
+
application_version: app.version,
|
|
62
|
+
data: {
|
|
63
|
+
env_key: 'cqtqt2jfbq235huvso0djbn56',
|
|
64
|
+
player_name: 'Test player',
|
|
65
|
+
video_id: 'video-id-1',
|
|
66
|
+
video_title: 'Big buck bunny',
|
|
67
|
+
},
|
|
68
|
+
}}
|
|
69
|
+
/>
|
|
70
|
+
)}
|
|
71
|
+
</View>
|
|
72
|
+
</ScrollView>
|
|
73
|
+
</SafeAreaView>
|
|
74
|
+
</>
|
|
75
|
+
);
|
|
76
|
+
};
|
|
77
|
+
|
|
78
|
+
const styles = StyleSheet.create({
|
|
79
|
+
scrollView: {
|
|
80
|
+
backgroundColor: Colors.lighter,
|
|
81
|
+
},
|
|
82
|
+
video: {
|
|
83
|
+
width: 400,
|
|
84
|
+
height: 500,
|
|
85
|
+
},
|
|
86
|
+
engine: {
|
|
87
|
+
position: 'absolute',
|
|
88
|
+
right: 0,
|
|
89
|
+
},
|
|
90
|
+
body: {
|
|
91
|
+
backgroundColor: Colors.white,
|
|
92
|
+
},
|
|
93
|
+
sectionContainer: {
|
|
94
|
+
marginTop: 32,
|
|
95
|
+
paddingHorizontal: 24,
|
|
96
|
+
},
|
|
97
|
+
sectionTitle: {
|
|
98
|
+
fontSize: 24,
|
|
99
|
+
fontWeight: '600',
|
|
100
|
+
color: Colors.black,
|
|
101
|
+
},
|
|
102
|
+
sectionDescription: {
|
|
103
|
+
marginTop: 8,
|
|
104
|
+
fontSize: 18,
|
|
105
|
+
fontWeight: '400',
|
|
106
|
+
color: Colors.dark,
|
|
107
|
+
},
|
|
108
|
+
highlight: {
|
|
109
|
+
fontWeight: '700',
|
|
110
|
+
},
|
|
111
|
+
footer: {
|
|
112
|
+
color: Colors.dark,
|
|
113
|
+
fontSize: 12,
|
|
114
|
+
fontWeight: '600',
|
|
115
|
+
padding: 4,
|
|
116
|
+
paddingRight: 12,
|
|
117
|
+
textAlign: 'right',
|
|
118
|
+
},
|
|
119
|
+
});
|
|
120
|
+
|
|
121
|
+
export default App;
|
|
@@ -0,0 +1,17 @@
|
|
|
1
|
+
# DemoApp
|
|
2
|
+
|
|
3
|
+
This is a demo react-native app for using:
|
|
4
|
+
|
|
5
|
+
* [react-native-video](https://www.npmjs.com/package/react-native-video)
|
|
6
|
+
* [mux-react-native-video](https://github.com/muxinc/mux-stats-sdk-react-native-video)
|
|
7
|
+
|
|
8
|
+
Mux provides QoS monitoring for video playback.
|
|
9
|
+
|
|
10
|
+
This project was generated with `npx react-native init`
|
|
11
|
+
|
|
12
|
+
# Setup
|
|
13
|
+
|
|
14
|
+
1. `yarn install`
|
|
15
|
+
1. `yarn start`- in one terminal window
|
|
16
|
+
1. `yarn ios` - (new terminal window) - runs the app in the ios simulator. You will have to have XCode and simulators installed.
|
|
17
|
+
1. `yarn android` - (new terminal window) - runs the app in the android emulator. You will have to have Android Studio and emulators involved
|
|
@@ -0,0 +1,14 @@
|
|
|
1
|
+
/**
|
|
2
|
+
* @format
|
|
3
|
+
*/
|
|
4
|
+
|
|
5
|
+
import 'react-native';
|
|
6
|
+
import React from 'react';
|
|
7
|
+
import App from '../App';
|
|
8
|
+
|
|
9
|
+
// Note: test renderer must be required after react-native.
|
|
10
|
+
import renderer from 'react-test-renderer';
|
|
11
|
+
|
|
12
|
+
it('renders correctly', () => {
|
|
13
|
+
renderer.create(<App />);
|
|
14
|
+
});
|
|
@@ -0,0 +1,55 @@
|
|
|
1
|
+
# To learn about Buck see [Docs](https://buckbuild.com/).
|
|
2
|
+
# To run your application with Buck:
|
|
3
|
+
# - install Buck
|
|
4
|
+
# - `npm start` - to start the packager
|
|
5
|
+
# - `cd android`
|
|
6
|
+
# - `keytool -genkey -v -keystore keystores/debug.keystore -storepass android -alias androiddebugkey -keypass android -dname "CN=Android Debug,O=Android,C=US"`
|
|
7
|
+
# - `./gradlew :app:copyDownloadableDepsToLibs` - make all Gradle compile dependencies available to Buck
|
|
8
|
+
# - `buck install -r android/app` - compile, install and run application
|
|
9
|
+
#
|
|
10
|
+
|
|
11
|
+
load(":build_defs.bzl", "create_aar_targets", "create_jar_targets")
|
|
12
|
+
|
|
13
|
+
lib_deps = []
|
|
14
|
+
|
|
15
|
+
create_aar_targets(glob(["libs/*.aar"]))
|
|
16
|
+
|
|
17
|
+
create_jar_targets(glob(["libs/*.jar"]))
|
|
18
|
+
|
|
19
|
+
android_library(
|
|
20
|
+
name = "all-libs",
|
|
21
|
+
exported_deps = lib_deps,
|
|
22
|
+
)
|
|
23
|
+
|
|
24
|
+
android_library(
|
|
25
|
+
name = "app-code",
|
|
26
|
+
srcs = glob([
|
|
27
|
+
"src/main/java/**/*.java",
|
|
28
|
+
]),
|
|
29
|
+
deps = [
|
|
30
|
+
":all-libs",
|
|
31
|
+
":build_config",
|
|
32
|
+
":res",
|
|
33
|
+
],
|
|
34
|
+
)
|
|
35
|
+
|
|
36
|
+
android_build_config(
|
|
37
|
+
name = "build_config",
|
|
38
|
+
package = "com.demoapp",
|
|
39
|
+
)
|
|
40
|
+
|
|
41
|
+
android_resource(
|
|
42
|
+
name = "res",
|
|
43
|
+
package = "com.demoapp",
|
|
44
|
+
res = "src/main/res",
|
|
45
|
+
)
|
|
46
|
+
|
|
47
|
+
android_binary(
|
|
48
|
+
name = "app",
|
|
49
|
+
keystore = "//android/keystores:debug",
|
|
50
|
+
manifest = "src/main/AndroidManifest.xml",
|
|
51
|
+
package_type = "debug",
|
|
52
|
+
deps = [
|
|
53
|
+
":app-code",
|
|
54
|
+
],
|
|
55
|
+
)
|
|
@@ -0,0 +1,201 @@
|
|
|
1
|
+
apply plugin: "com.android.application"
|
|
2
|
+
|
|
3
|
+
import com.android.build.OutputFile
|
|
4
|
+
|
|
5
|
+
/**
|
|
6
|
+
* The react.gradle file registers a task for each build variant (e.g. bundleDebugJsAndAssets
|
|
7
|
+
* and bundleReleaseJsAndAssets).
|
|
8
|
+
* These basically call `react-native bundle` with the correct arguments during the Android build
|
|
9
|
+
* cycle. By default, bundleDebugJsAndAssets is skipped, as in debug/dev mode we prefer to load the
|
|
10
|
+
* bundle directly from the development server. Below you can see all the possible configurations
|
|
11
|
+
* and their defaults. If you decide to add a configuration block, make sure to add it before the
|
|
12
|
+
* `apply from: "../../node_modules/react-native/react.gradle"` line.
|
|
13
|
+
*
|
|
14
|
+
* project.ext.react = [
|
|
15
|
+
* // the name of the generated asset file containing your JS bundle
|
|
16
|
+
* bundleAssetName: "index.android.bundle",
|
|
17
|
+
*
|
|
18
|
+
* // the entry file for bundle generation
|
|
19
|
+
* entryFile: "index.android.js",
|
|
20
|
+
*
|
|
21
|
+
* // https://facebook.github.io/react-native/docs/performance#enable-the-ram-format
|
|
22
|
+
* bundleCommand: "ram-bundle",
|
|
23
|
+
*
|
|
24
|
+
* // whether to bundle JS and assets in debug mode
|
|
25
|
+
* bundleInDebug: false,
|
|
26
|
+
*
|
|
27
|
+
* // whether to bundle JS and assets in release mode
|
|
28
|
+
* bundleInRelease: true,
|
|
29
|
+
*
|
|
30
|
+
* // whether to bundle JS and assets in another build variant (if configured).
|
|
31
|
+
* // See http://tools.android.com/tech-docs/new-build-system/user-guide#TOC-Build-Variants
|
|
32
|
+
* // The configuration property can be in the following formats
|
|
33
|
+
* // 'bundleIn${productFlavor}${buildType}'
|
|
34
|
+
* // 'bundleIn${buildType}'
|
|
35
|
+
* // bundleInFreeDebug: true,
|
|
36
|
+
* // bundleInPaidRelease: true,
|
|
37
|
+
* // bundleInBeta: true,
|
|
38
|
+
*
|
|
39
|
+
* // whether to disable dev mode in custom build variants (by default only disabled in release)
|
|
40
|
+
* // for example: to disable dev mode in the staging build type (if configured)
|
|
41
|
+
* devDisabledInStaging: true,
|
|
42
|
+
* // The configuration property can be in the following formats
|
|
43
|
+
* // 'devDisabledIn${productFlavor}${buildType}'
|
|
44
|
+
* // 'devDisabledIn${buildType}'
|
|
45
|
+
*
|
|
46
|
+
* // the root of your project, i.e. where "package.json" lives
|
|
47
|
+
* root: "../../",
|
|
48
|
+
*
|
|
49
|
+
* // where to put the JS bundle asset in debug mode
|
|
50
|
+
* jsBundleDirDebug: "$buildDir/intermediates/assets/debug",
|
|
51
|
+
*
|
|
52
|
+
* // where to put the JS bundle asset in release mode
|
|
53
|
+
* jsBundleDirRelease: "$buildDir/intermediates/assets/release",
|
|
54
|
+
*
|
|
55
|
+
* // where to put drawable resources / React Native assets, e.g. the ones you use via
|
|
56
|
+
* // require('./image.png')), in debug mode
|
|
57
|
+
* resourcesDirDebug: "$buildDir/intermediates/res/merged/debug",
|
|
58
|
+
*
|
|
59
|
+
* // where to put drawable resources / React Native assets, e.g. the ones you use via
|
|
60
|
+
* // require('./image.png')), in release mode
|
|
61
|
+
* resourcesDirRelease: "$buildDir/intermediates/res/merged/release",
|
|
62
|
+
*
|
|
63
|
+
* // by default the gradle tasks are skipped if none of the JS files or assets change; this means
|
|
64
|
+
* // that we don't look at files in android/ or ios/ to determine whether the tasks are up to
|
|
65
|
+
* // date; if you have any other folders that you want to ignore for performance reasons (gradle
|
|
66
|
+
* // indexes the entire tree), add them here. Alternatively, if you have JS files in android/
|
|
67
|
+
* // for example, you might want to remove it from here.
|
|
68
|
+
* inputExcludes: ["android/**", "ios/**"],
|
|
69
|
+
*
|
|
70
|
+
* // override which node gets called and with what additional arguments
|
|
71
|
+
* nodeExecutableAndArgs: ["node"],
|
|
72
|
+
*
|
|
73
|
+
* // supply additional arguments to the packager
|
|
74
|
+
* extraPackagerArgs: []
|
|
75
|
+
* ]
|
|
76
|
+
*/
|
|
77
|
+
|
|
78
|
+
project.ext.react = [
|
|
79
|
+
entryFile: "index.js",
|
|
80
|
+
enableHermes: false, // clean and rebuild if changing
|
|
81
|
+
]
|
|
82
|
+
|
|
83
|
+
apply from: "../../node_modules/react-native/react.gradle"
|
|
84
|
+
|
|
85
|
+
/**
|
|
86
|
+
* Set this to true to create two separate APKs instead of one:
|
|
87
|
+
* - An APK that only works on ARM devices
|
|
88
|
+
* - An APK that only works on x86 devices
|
|
89
|
+
* The advantage is the size of the APK is reduced by about 4MB.
|
|
90
|
+
* Upload all the APKs to the Play Store and people will download
|
|
91
|
+
* the correct one based on the CPU architecture of their device.
|
|
92
|
+
*/
|
|
93
|
+
def enableSeparateBuildPerCPUArchitecture = false
|
|
94
|
+
|
|
95
|
+
/**
|
|
96
|
+
* Run Proguard to shrink the Java bytecode in release builds.
|
|
97
|
+
*/
|
|
98
|
+
def enableProguardInReleaseBuilds = false
|
|
99
|
+
|
|
100
|
+
/**
|
|
101
|
+
* The preferred build flavor of JavaScriptCore.
|
|
102
|
+
*
|
|
103
|
+
* For example, to use the international variant, you can use:
|
|
104
|
+
* `def jscFlavor = 'org.webkit:android-jsc-intl:+'`
|
|
105
|
+
*
|
|
106
|
+
* The international variant includes ICU i18n library and necessary data
|
|
107
|
+
* allowing to use e.g. `Date.toLocaleString` and `String.localeCompare` that
|
|
108
|
+
* give correct results when using with locales other than en-US. Note that
|
|
109
|
+
* this variant is about 6MiB larger per architecture than default.
|
|
110
|
+
*/
|
|
111
|
+
def jscFlavor = 'org.webkit:android-jsc:+'
|
|
112
|
+
|
|
113
|
+
/**
|
|
114
|
+
* Whether to enable the Hermes VM.
|
|
115
|
+
*
|
|
116
|
+
* This should be set on project.ext.react and mirrored here. If it is not set
|
|
117
|
+
* on project.ext.react, JavaScript will not be compiled to Hermes Bytecode
|
|
118
|
+
* and the benefits of using Hermes will therefore be sharply reduced.
|
|
119
|
+
*/
|
|
120
|
+
def enableHermes = project.ext.react.get("enableHermes", false);
|
|
121
|
+
|
|
122
|
+
android {
|
|
123
|
+
compileSdkVersion rootProject.ext.compileSdkVersion
|
|
124
|
+
|
|
125
|
+
compileOptions {
|
|
126
|
+
sourceCompatibility JavaVersion.VERSION_1_8
|
|
127
|
+
targetCompatibility JavaVersion.VERSION_1_8
|
|
128
|
+
}
|
|
129
|
+
|
|
130
|
+
defaultConfig {
|
|
131
|
+
applicationId "com.demoapp"
|
|
132
|
+
minSdkVersion rootProject.ext.minSdkVersion
|
|
133
|
+
targetSdkVersion rootProject.ext.targetSdkVersion
|
|
134
|
+
versionCode 1
|
|
135
|
+
versionName "1.0"
|
|
136
|
+
}
|
|
137
|
+
splits {
|
|
138
|
+
abi {
|
|
139
|
+
reset()
|
|
140
|
+
enable enableSeparateBuildPerCPUArchitecture
|
|
141
|
+
universalApk false // If true, also generate a universal APK
|
|
142
|
+
include "armeabi-v7a", "x86", "arm64-v8a", "x86_64"
|
|
143
|
+
}
|
|
144
|
+
}
|
|
145
|
+
signingConfigs {
|
|
146
|
+
debug {
|
|
147
|
+
storeFile file('debug.keystore')
|
|
148
|
+
storePassword 'android'
|
|
149
|
+
keyAlias 'androiddebugkey'
|
|
150
|
+
keyPassword 'android'
|
|
151
|
+
}
|
|
152
|
+
}
|
|
153
|
+
buildTypes {
|
|
154
|
+
debug {
|
|
155
|
+
signingConfig signingConfigs.debug
|
|
156
|
+
}
|
|
157
|
+
release {
|
|
158
|
+
// Caution! In production, you need to generate your own keystore file.
|
|
159
|
+
// see https://facebook.github.io/react-native/docs/signed-apk-android.
|
|
160
|
+
signingConfig signingConfigs.debug
|
|
161
|
+
minifyEnabled enableProguardInReleaseBuilds
|
|
162
|
+
proguardFiles getDefaultProguardFile("proguard-android.txt"), "proguard-rules.pro"
|
|
163
|
+
}
|
|
164
|
+
}
|
|
165
|
+
// applicationVariants are e.g. debug, release
|
|
166
|
+
applicationVariants.all { variant ->
|
|
167
|
+
variant.outputs.each { output ->
|
|
168
|
+
// For each separate APK per architecture, set a unique version code as described here:
|
|
169
|
+
// https://developer.android.com/studio/build/configure-apk-splits.html
|
|
170
|
+
def versionCodes = ["armeabi-v7a": 1, "x86": 2, "arm64-v8a": 3, "x86_64": 4]
|
|
171
|
+
def abi = output.getFilter(OutputFile.ABI)
|
|
172
|
+
if (abi != null) { // null for the universal-debug, universal-release variants
|
|
173
|
+
output.versionCodeOverride =
|
|
174
|
+
versionCodes.get(abi) * 1048576 + defaultConfig.versionCode
|
|
175
|
+
}
|
|
176
|
+
|
|
177
|
+
}
|
|
178
|
+
}
|
|
179
|
+
}
|
|
180
|
+
|
|
181
|
+
dependencies {
|
|
182
|
+
implementation fileTree(dir: "libs", include: ["*.jar"])
|
|
183
|
+
implementation "com.facebook.react:react-native:+" // From node_modules
|
|
184
|
+
|
|
185
|
+
if (enableHermes) {
|
|
186
|
+
def hermesPath = "../../node_modules/hermes-engine/android/";
|
|
187
|
+
debugImplementation files(hermesPath + "hermes-debug.aar")
|
|
188
|
+
releaseImplementation files(hermesPath + "hermes-release.aar")
|
|
189
|
+
} else {
|
|
190
|
+
implementation jscFlavor
|
|
191
|
+
}
|
|
192
|
+
}
|
|
193
|
+
|
|
194
|
+
// Run this once to be able to run the application with BUCK
|
|
195
|
+
// puts all compile dependencies into folder libs for BUCK to use
|
|
196
|
+
task copyDownloadableDepsToLibs(type: Copy) {
|
|
197
|
+
from configurations.compile
|
|
198
|
+
into 'libs'
|
|
199
|
+
}
|
|
200
|
+
|
|
201
|
+
apply from: file("../../node_modules/@react-native-community/cli-platform-android/native_modules.gradle"); applyNativeModulesAppBuildGradle(project)
|
|
@@ -0,0 +1,19 @@
|
|
|
1
|
+
"""Helper definitions to glob .aar and .jar targets"""
|
|
2
|
+
|
|
3
|
+
def create_aar_targets(aarfiles):
|
|
4
|
+
for aarfile in aarfiles:
|
|
5
|
+
name = "aars__" + aarfile[aarfile.rindex("/") + 1:aarfile.rindex(".aar")]
|
|
6
|
+
lib_deps.append(":" + name)
|
|
7
|
+
android_prebuilt_aar(
|
|
8
|
+
name = name,
|
|
9
|
+
aar = aarfile,
|
|
10
|
+
)
|
|
11
|
+
|
|
12
|
+
def create_jar_targets(jarfiles):
|
|
13
|
+
for jarfile in jarfiles:
|
|
14
|
+
name = "jars__" + jarfile[jarfile.rindex("/") + 1:jarfile.rindex(".jar")]
|
|
15
|
+
lib_deps.append(":" + name)
|
|
16
|
+
prebuilt_jar(
|
|
17
|
+
name = name,
|
|
18
|
+
binary_jar = jarfile,
|
|
19
|
+
)
|
|
Binary file
|
|
@@ -0,0 +1,10 @@
|
|
|
1
|
+
# Add project specific ProGuard rules here.
|
|
2
|
+
# By default, the flags in this file are appended to flags specified
|
|
3
|
+
# in /usr/local/Cellar/android-sdk/24.3.3/tools/proguard/proguard-android.txt
|
|
4
|
+
# You can edit the include path and order by changing the proguardFiles
|
|
5
|
+
# directive in build.gradle.
|
|
6
|
+
#
|
|
7
|
+
# For more details, see
|
|
8
|
+
# http://developer.android.com/guide/developing/tools/proguard.html
|
|
9
|
+
|
|
10
|
+
# Add any project specific keep options here:
|
|
@@ -0,0 +1,8 @@
|
|
|
1
|
+
<?xml version="1.0" encoding="utf-8"?>
|
|
2
|
+
<manifest xmlns:android="http://schemas.android.com/apk/res/android"
|
|
3
|
+
xmlns:tools="http://schemas.android.com/tools">
|
|
4
|
+
|
|
5
|
+
<uses-permission android:name="android.permission.SYSTEM_ALERT_WINDOW"/>
|
|
6
|
+
|
|
7
|
+
<application android:usesCleartextTraffic="true" tools:targetApi="28" tools:ignore="GoogleAppIndexingWarning" />
|
|
8
|
+
</manifest>
|