张跃

0.1

Showing 102 changed files with 2925 additions and 0 deletions
1 +
2 +[android]
3 + target = Google Inc.:Google APIs:23
4 +
5 +[maven_repositories]
6 + central = https://repo1.maven.org/maven2
1 +BUNDLE_PATH: "vendor/bundle"
2 +BUNDLE_FORCE_RUBY_PLATFORM: 1
1 +module.exports = {
2 + root: true,
3 + extends: '@react-native-community',
4 +};
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 +; Flow doesn't support platforms
12 +.*/Libraries/Utilities/LoadingView.js
13 +
14 +.*/node_modules/resolve/test/resolver/malformed_package_json/package\.json$
15 +
16 +[untyped]
17 +.*/node_modules/@react-native-community/cli/.*/.*
18 +
19 +[include]
20 +
21 +[libs]
22 +node_modules/react-native/interface.js
23 +node_modules/react-native/flow/
24 +
25 +[options]
26 +emoji=true
27 +
28 +exact_by_default=true
29 +
30 +format.bracket_spacing=false
31 +
32 +module.file_ext=.js
33 +module.file_ext=.json
34 +module.file_ext=.ios.js
35 +
36 +munge_underscores=true
37 +
38 +module.name_mapper='^react-native/\(.*\)$' -> '<PROJECT_ROOT>/node_modules/react-native/\1'
39 +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'
40 +
41 +suppress_type=$FlowIssue
42 +suppress_type=$FlowFixMe
43 +suppress_type=$FlowFixMeProps
44 +suppress_type=$FlowFixMeState
45 +
46 +[lints]
47 +sketchy-null-number=warn
48 +sketchy-null-mixed=warn
49 +sketchy-number=warn
50 +untyped-type-import=warn
51 +nonstrict-import=warn
52 +deprecated-type=warn
53 +unsafe-getters-setters=warn
54 +unnecessary-invariant=warn
55 +signature-verification-failure=warn
56 +
57 +[strict]
58 +deprecated-type
59 +nonstrict-import
60 +sketchy-null
61 +unclear-type
62 +unsafe-getters-setters
63 +untyped-import
64 +untyped-type-import
65 +
66 +[version]
67 +^0.170.0
1 +# OSX
2 +#
3 +.DS_Store
4 +
5 +# Xcode
6 +#
7 +build/
8 +*.pbxuser
9 +!default.pbxuser
10 +*.mode1v3
11 +!default.mode1v3
12 +*.mode2v3
13 +!default.mode2v3
14 +*.perspectivev3
15 +!default.perspectivev3
16 +xcuserdata
17 +*.xccheckout
18 +*.moved-aside
19 +DerivedData
20 +*.hmap
21 +*.ipa
22 +*.xcuserstate
23 +
24 +# Android/IntelliJ
25 +#
26 +build/
27 +.idea
28 +.gradle
29 +local.properties
30 +*.iml
31 +*.hprof
32 +
33 +# node.js
34 +#
35 +node_modules/
36 +npm-debug.log
37 +yarn-error.log
38 +
39 +# BUCK
40 +buck-out/
41 +\.buckd/
42 +*.keystore
43 +!debug.keystore
44 +
45 +# fastlane
46 +#
47 +# It is recommended to not store the screenshots in the git repo. Instead, use fastlane to re-generate the
48 +# screenshots whenever they are needed.
49 +# For more information about the recommended setup visit:
50 +# https://docs.fastlane.tools/best-practices/source-control/
51 +
52 +*/fastlane/report.xml
53 +*/fastlane/Preview.html
54 +*/fastlane/screenshots
55 +
56 +# Bundle artifact
57 +*.jsbundle
58 +
59 +# Ruby / CocoaPods
60 +/ios/Pods/
61 +/vendor/bundle/
1 +module.exports = {
2 + arrowParens: 'avoid',
3 + bracketSameLine: true,
4 + bracketSpacing: false,
5 + singleQuote: true,
6 + trailingComma: 'all',
7 +};
1 +{}
...\ No newline at end of file ...\ No newline at end of file
1 +/**
2 + * Sample React Native App
3 + * https://github.com/facebook/react-native
4 + *
5 + * @format
6 + * @flow strict-local
7 + */
8 +
9 +import React from 'react';
10 +import type {Node} from 'react';
11 +import {
12 + SafeAreaView,
13 + ScrollView,
14 + StatusBar,
15 + StyleSheet,
16 + Text,
17 + useColorScheme,
18 + View,
19 +} from 'react-native';
20 +
21 +import {
22 + Colors,
23 + DebugInstructions,
24 + Header,
25 + LearnMoreLinks,
26 + ReloadInstructions,
27 +} from 'react-native/Libraries/NewAppScreen';
28 +
29 +const Section = ({children, title}): Node => {
30 + const isDarkMode = useColorScheme() === 'dark';
31 + return (
32 + <View style={styles.sectionContainer}>
33 + <Text
34 + style={[
35 + styles.sectionTitle,
36 + {
37 + color: isDarkMode ? Colors.white : Colors.black,
38 + },
39 + ]}>
40 + {title}
41 + </Text>
42 + <Text
43 + style={[
44 + styles.sectionDescription,
45 + {
46 + color: isDarkMode ? Colors.light : Colors.dark,
47 + },
48 + ]}>
49 + {children}
50 + </Text>
51 + </View>
52 + );
53 +};
54 +
55 +const App: () => Node = () => {
56 + const isDarkMode = useColorScheme() === 'dark';
57 +
58 + const backgroundStyle = {
59 + backgroundColor: isDarkMode ? Colors.darker : Colors.lighter,
60 + };
61 +
62 + return (
63 + <SafeAreaView style={backgroundStyle}>
64 + <StatusBar barStyle={isDarkMode ? 'light-content' : 'dark-content'} />
65 + <ScrollView
66 + contentInsetAdjustmentBehavior="automatic"
67 + style={backgroundStyle}>
68 + <Header />
69 + <View
70 + style={{
71 + backgroundColor: isDarkMode ? Colors.black : Colors.white,
72 + }}>
73 + <Section title="Step One">
74 + Edit <Text style={styles.highlight}>App.js</Text> to change this
75 + screen and then come back to see your edits.
76 + </Section>
77 + <Section title="See Your Changes">
78 + <ReloadInstructions />
79 + </Section>
80 + <Section title="Debug">
81 + <DebugInstructions />
82 + </Section>
83 + <Section title="Learn More">
84 + Read the docs to discover what to do next:
85 + </Section>
86 + <LearnMoreLinks />
87 + </View>
88 + </ScrollView>
89 + </SafeAreaView>
90 + );
91 +};
92 +
93 +const styles = StyleSheet.create({
94 + sectionContainer: {
95 + marginTop: 32,
96 + paddingHorizontal: 24,
97 + },
98 + sectionTitle: {
99 + fontSize: 24,
100 + fontWeight: '600',
101 + },
102 + sectionDescription: {
103 + marginTop: 8,
104 + fontSize: 18,
105 + fontWeight: '400',
106 + },
107 + highlight: {
108 + fontWeight: '700',
109 + },
110 +});
111 +
112 +export default App;
1 +source 'https://rubygems.org'
2 +
3 +# You may use http://rbenv.org/ or https://rvm.io/ to install and use this version
4 +ruby '2.7.4'
5 +
6 +gem 'cocoapods', '~> 1.11', '>= 1.11.2'
1 +GEM
2 + remote: https://rubygems.org/
3 + specs:
4 + CFPropertyList (3.0.5)
5 + rexml
6 + activesupport (6.1.5.1)
7 + concurrent-ruby (~> 1.0, >= 1.0.2)
8 + i18n (>= 1.6, < 2)
9 + minitest (>= 5.1)
10 + tzinfo (~> 2.0)
11 + zeitwerk (~> 2.3)
12 + addressable (2.8.0)
13 + public_suffix (>= 2.0.2, < 5.0)
14 + algoliasearch (1.27.5)
15 + httpclient (~> 2.8, >= 2.8.3)
16 + json (>= 1.5.1)
17 + atomos (0.1.3)
18 + claide (1.1.0)
19 + cocoapods (1.11.3)
20 + addressable (~> 2.8)
21 + claide (>= 1.0.2, < 2.0)
22 + cocoapods-core (= 1.11.3)
23 + cocoapods-deintegrate (>= 1.0.3, < 2.0)
24 + cocoapods-downloader (>= 1.4.0, < 2.0)
25 + cocoapods-plugins (>= 1.0.0, < 2.0)
26 + cocoapods-search (>= 1.0.0, < 2.0)
27 + cocoapods-trunk (>= 1.4.0, < 2.0)
28 + cocoapods-try (>= 1.1.0, < 2.0)
29 + colored2 (~> 3.1)
30 + escape (~> 0.0.4)
31 + fourflusher (>= 2.3.0, < 3.0)
32 + gh_inspector (~> 1.0)
33 + molinillo (~> 0.8.0)
34 + nap (~> 1.0)
35 + ruby-macho (>= 1.0, < 3.0)
36 + xcodeproj (>= 1.21.0, < 2.0)
37 + cocoapods-core (1.11.3)
38 + activesupport (>= 5.0, < 7)
39 + addressable (~> 2.8)
40 + algoliasearch (~> 1.0)
41 + concurrent-ruby (~> 1.1)
42 + fuzzy_match (~> 2.0.4)
43 + nap (~> 1.0)
44 + netrc (~> 0.11)
45 + public_suffix (~> 4.0)
46 + typhoeus (~> 1.0)
47 + cocoapods-deintegrate (1.0.5)
48 + cocoapods-downloader (1.6.3)
49 + cocoapods-plugins (1.0.0)
50 + nap
51 + cocoapods-search (1.0.1)
52 + cocoapods-trunk (1.6.0)
53 + nap (>= 0.8, < 2.0)
54 + netrc (~> 0.11)
55 + cocoapods-try (1.2.0)
56 + colored2 (3.1.2)
57 + concurrent-ruby (1.1.10)
58 + escape (0.0.4)
59 + ethon (0.15.0)
60 + ffi (>= 1.15.0)
61 + ffi (1.15.5)
62 + fourflusher (2.3.1)
63 + fuzzy_match (2.0.4)
64 + gh_inspector (1.1.3)
65 + httpclient (2.8.3)
66 + i18n (1.10.0)
67 + concurrent-ruby (~> 1.0)
68 + json (2.6.1)
69 + minitest (5.15.0)
70 + molinillo (0.8.0)
71 + nanaimo (0.3.0)
72 + nap (1.1.0)
73 + netrc (0.11.0)
74 + public_suffix (4.0.7)
75 + rexml (3.2.5)
76 + ruby-macho (2.5.1)
77 + typhoeus (1.4.0)
78 + ethon (>= 0.9.0)
79 + tzinfo (2.0.4)
80 + concurrent-ruby (~> 1.0)
81 + xcodeproj (1.21.0)
82 + CFPropertyList (>= 2.3.3, < 4.0)
83 + atomos (~> 0.1.3)
84 + claide (>= 1.0.2, < 2.0)
85 + colored2 (~> 3.1)
86 + nanaimo (~> 0.3.0)
87 + rexml (~> 3.2.4)
88 + zeitwerk (2.5.4)
89 +
90 +PLATFORMS
91 + ruby
92 +
93 +DEPENDENCIES
94 + cocoapods (~> 1.11, >= 1.11.2)
95 +
96 +RUBY VERSION
97 + ruby 2.7.4p191
98 +
99 +BUNDLED WITH
100 + 2.2.27
1 +密钥口令
2 +
3 +shipcamera
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 +});
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.shipcamera",
39 +)
40 +
41 +android_resource(
42 + name = "res",
43 + package = "com.shipcamera",
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 +)
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 + )
No preview for this file type
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:
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
8 + android:usesCleartextTraffic="true"
9 + tools:targetApi="28"
10 + tools:ignore="GoogleAppIndexingWarning">
11 + <activity android:name="com.facebook.react.devsupport.DevSettingsActivity" android:exported="false" />
12 + </application>
13 +</manifest>
1 +/**
2 + * Copyright (c) Meta Platforms, Inc. and affiliates.
3 + *
4 + * <p>This source code is licensed under the MIT license found in the LICENSE file in the root
5 + * directory of this source tree.
6 + */
7 +package com.shipcamera;
8 +
9 +import android.content.Context;
10 +import com.facebook.flipper.android.AndroidFlipperClient;
11 +import com.facebook.flipper.android.utils.FlipperUtils;
12 +import com.facebook.flipper.core.FlipperClient;
13 +import com.facebook.flipper.plugins.crashreporter.CrashReporterPlugin;
14 +import com.facebook.flipper.plugins.databases.DatabasesFlipperPlugin;
15 +import com.facebook.flipper.plugins.fresco.FrescoFlipperPlugin;
16 +import com.facebook.flipper.plugins.inspector.DescriptorMapping;
17 +import com.facebook.flipper.plugins.inspector.InspectorFlipperPlugin;
18 +import com.facebook.flipper.plugins.network.FlipperOkhttpInterceptor;
19 +import com.facebook.flipper.plugins.network.NetworkFlipperPlugin;
20 +import com.facebook.flipper.plugins.react.ReactFlipperPlugin;
21 +import com.facebook.flipper.plugins.sharedpreferences.SharedPreferencesFlipperPlugin;
22 +import com.facebook.react.ReactInstanceEventListener;
23 +import com.facebook.react.ReactInstanceManager;
24 +import com.facebook.react.bridge.ReactContext;
25 +import com.facebook.react.modules.network.NetworkingModule;
26 +import okhttp3.OkHttpClient;
27 +
28 +public class ReactNativeFlipper {
29 + public static void initializeFlipper(Context context, ReactInstanceManager reactInstanceManager) {
30 + if (FlipperUtils.shouldEnableFlipper(context)) {
31 + final FlipperClient client = AndroidFlipperClient.getInstance(context);
32 +
33 + client.addPlugin(new InspectorFlipperPlugin(context, DescriptorMapping.withDefaults()));
34 + client.addPlugin(new ReactFlipperPlugin());
35 + client.addPlugin(new DatabasesFlipperPlugin(context));
36 + client.addPlugin(new SharedPreferencesFlipperPlugin(context));
37 + client.addPlugin(CrashReporterPlugin.getInstance());
38 +
39 + NetworkFlipperPlugin networkFlipperPlugin = new NetworkFlipperPlugin();
40 + NetworkingModule.setCustomClientBuilder(
41 + new NetworkingModule.CustomClientBuilder() {
42 + @Override
43 + public void apply(OkHttpClient.Builder builder) {
44 + builder.addNetworkInterceptor(new FlipperOkhttpInterceptor(networkFlipperPlugin));
45 + }
46 + });
47 + client.addPlugin(networkFlipperPlugin);
48 + client.start();
49 +
50 + // Fresco Plugin needs to ensure that ImagePipelineFactory is initialized
51 + // Hence we run if after all native modules have been initialized
52 + ReactContext reactContext = reactInstanceManager.getCurrentReactContext();
53 + if (reactContext == null) {
54 + reactInstanceManager.addReactInstanceEventListener(
55 + new ReactInstanceEventListener() {
56 + @Override
57 + public void onReactContextInitialized(ReactContext reactContext) {
58 + reactInstanceManager.removeReactInstanceEventListener(this);
59 + reactContext.runOnNativeModulesQueueThread(
60 + new Runnable() {
61 + @Override
62 + public void run() {
63 + client.addPlugin(new FrescoFlipperPlugin());
64 + }
65 + });
66 + }
67 + });
68 + } else {
69 + client.addPlugin(new FrescoFlipperPlugin());
70 + }
71 + }
72 + }
73 +}
1 +<manifest xmlns:android="http://schemas.android.com/apk/res/android"
2 + package="com.shipcamera">
3 +
4 + <uses-permission android:name="android.permission.INTERNET" />
5 +
6 + <application
7 + android:name=".MainApplication"
8 + android:label="@string/app_name"
9 + android:icon="@mipmap/ic_launcher"
10 + android:usesCleartextTraffic="true"
11 + android:roundIcon="@mipmap/ic_launcher_round"
12 + android:allowBackup="false"
13 + android:theme="@style/AppTheme">
14 + <activity
15 + android:name=".MainActivity"
16 + android:label="@string/app_name"
17 + android:configChanges="keyboard|keyboardHidden|orientation|screenLayout|screenSize|smallestScreenSize|uiMode"
18 + android:launchMode="singleTask"
19 + android:windowSoftInputMode="stateAlwaysHidden|adjustPan"
20 + android:exported="true">
21 + <intent-filter>
22 + <action android:name="android.intent.action.MAIN" />
23 + <category android:name="android.intent.category.LAUNCHER" />
24 + </intent-filter>
25 + </activity>
26 + </application>
27 +</manifest>
No preview for this file type
No preview for this file type
No preview for this file type
No preview for this file type
No preview for this file type
No preview for this file type
1 +package com.shipcamera;
2 +
3 +import com.facebook.react.ReactActivity;
4 +import com.facebook.react.ReactActivityDelegate;
5 +import com.facebook.react.ReactRootView;
6 +
7 +public class MainActivity extends ReactActivity {
8 +
9 + /**
10 + * Returns the name of the main component registered from JavaScript. This is used to schedule
11 + * rendering of the component.
12 + */
13 + @Override
14 + protected String getMainComponentName() {
15 + return "shipCamera";
16 + }
17 +
18 + /**
19 + * Returns the instance of the {@link ReactActivityDelegate}. There the RootView is created and
20 + * you can specify the rendered you wish to use (Fabric or the older renderer).
21 + */
22 + @Override
23 + protected ReactActivityDelegate createReactActivityDelegate() {
24 + return new MainActivityDelegate(this, getMainComponentName());
25 + }
26 +
27 + public static class MainActivityDelegate extends ReactActivityDelegate {
28 + public MainActivityDelegate(ReactActivity activity, String mainComponentName) {
29 + super(activity, mainComponentName);
30 + }
31 +
32 + @Override
33 + protected ReactRootView createRootView() {
34 + ReactRootView reactRootView = new ReactRootView(getContext());
35 + // If you opted-in for the New Architecture, we enable the Fabric Renderer.
36 + reactRootView.setIsFabric(BuildConfig.IS_NEW_ARCHITECTURE_ENABLED);
37 + return reactRootView;
38 + }
39 + }
40 +}
1 +package com.shipcamera;
2 +
3 +import android.app.Application;
4 +import android.content.Context;
5 +import com.facebook.react.PackageList;
6 +import com.facebook.react.ReactApplication;
7 +import com.oblador.vectoricons.VectorIconsPackage;
8 +import com.facebook.react.ReactInstanceManager;
9 +import com.facebook.react.ReactNativeHost;
10 +import com.facebook.react.ReactPackage;
11 +import com.facebook.react.config.ReactFeatureFlags;
12 +import com.facebook.soloader.SoLoader;
13 +import com.shipcamera.newarchitecture.MainApplicationReactNativeHost;
14 +import java.lang.reflect.InvocationTargetException;
15 +import java.util.List;
16 +
17 +public class MainApplication extends Application implements ReactApplication {
18 +
19 + private final ReactNativeHost mReactNativeHost =
20 + new ReactNativeHost(this) {
21 + @Override
22 + public boolean getUseDeveloperSupport() {
23 + return BuildConfig.DEBUG;
24 + }
25 +
26 + @Override
27 + protected List<ReactPackage> getPackages() {
28 + @SuppressWarnings("UnnecessaryLocalVariable")
29 + List<ReactPackage> packages = new PackageList(this).getPackages();
30 + // Packages that cannot be autolinked yet can be added manually here, for example:
31 + // packages.add(new MyReactNativePackage());
32 + return packages;
33 + }
34 +
35 + @Override
36 + protected String getJSMainModuleName() {
37 + return "index";
38 + }
39 + };
40 +
41 + private final ReactNativeHost mNewArchitectureNativeHost =
42 + new MainApplicationReactNativeHost(this);
43 +
44 + @Override
45 + public ReactNativeHost getReactNativeHost() {
46 + if (BuildConfig.IS_NEW_ARCHITECTURE_ENABLED) {
47 + return mNewArchitectureNativeHost;
48 + } else {
49 + return mReactNativeHost;
50 + }
51 + }
52 +
53 + @Override
54 + public void onCreate() {
55 + super.onCreate();
56 + // If you opted-in for the New Architecture, we enable the TurboModule system
57 + ReactFeatureFlags.useTurboModules = BuildConfig.IS_NEW_ARCHITECTURE_ENABLED;
58 + SoLoader.init(this, /* native exopackage */ false);
59 + initializeFlipper(this, getReactNativeHost().getReactInstanceManager());
60 + }
61 +
62 + /**
63 + * Loads Flipper in React Native templates. Call this in the onCreate method with something like
64 + * initializeFlipper(this, getReactNativeHost().getReactInstanceManager());
65 + *
66 + * @param context
67 + * @param reactInstanceManager
68 + */
69 + private static void initializeFlipper(
70 + Context context, ReactInstanceManager reactInstanceManager) {
71 + if (BuildConfig.DEBUG) {
72 + try {
73 + /*
74 + We use reflection here to pick up the class that initializes Flipper,
75 + since Flipper library is not available in release mode
76 + */
77 + Class<?> aClass = Class.forName("com.shipcamera.ReactNativeFlipper");
78 + aClass
79 + .getMethod("initializeFlipper", Context.class, ReactInstanceManager.class)
80 + .invoke(null, context, reactInstanceManager);
81 + } catch (ClassNotFoundException e) {
82 + e.printStackTrace();
83 + } catch (NoSuchMethodException e) {
84 + e.printStackTrace();
85 + } catch (IllegalAccessException e) {
86 + e.printStackTrace();
87 + } catch (InvocationTargetException e) {
88 + e.printStackTrace();
89 + }
90 + }
91 + }
92 +}
1 +package com.shipcamera.newarchitecture;
2 +
3 +import android.app.Application;
4 +import androidx.annotation.NonNull;
5 +import com.facebook.react.PackageList;
6 +import com.facebook.react.ReactInstanceManager;
7 +import com.facebook.react.ReactNativeHost;
8 +import com.facebook.react.ReactPackage;
9 +import com.facebook.react.ReactPackageTurboModuleManagerDelegate;
10 +import com.facebook.react.bridge.JSIModulePackage;
11 +import com.facebook.react.bridge.JSIModuleProvider;
12 +import com.facebook.react.bridge.JSIModuleSpec;
13 +import com.facebook.react.bridge.JSIModuleType;
14 +import com.facebook.react.bridge.JavaScriptContextHolder;
15 +import com.facebook.react.bridge.ReactApplicationContext;
16 +import com.facebook.react.bridge.UIManager;
17 +import com.facebook.react.fabric.ComponentFactory;
18 +import com.facebook.react.fabric.CoreComponentsRegistry;
19 +import com.facebook.react.fabric.EmptyReactNativeConfig;
20 +import com.facebook.react.fabric.FabricJSIModuleProvider;
21 +import com.facebook.react.uimanager.ViewManagerRegistry;
22 +import com.shipcamera.BuildConfig;
23 +import com.shipcamera.newarchitecture.components.MainComponentsRegistry;
24 +import com.shipcamera.newarchitecture.modules.MainApplicationTurboModuleManagerDelegate;
25 +import java.util.ArrayList;
26 +import java.util.List;
27 +
28 +/**
29 + * A {@link ReactNativeHost} that helps you load everything needed for the New Architecture, both
30 + * TurboModule delegates and the Fabric Renderer.
31 + *
32 + * <p>Please note that this class is used ONLY if you opt-in for the New Architecture (see the
33 + * `newArchEnabled` property). Is ignored otherwise.
34 + */
35 +public class MainApplicationReactNativeHost extends ReactNativeHost {
36 + public MainApplicationReactNativeHost(Application application) {
37 + super(application);
38 + }
39 +
40 + @Override
41 + public boolean getUseDeveloperSupport() {
42 + return BuildConfig.DEBUG;
43 + }
44 +
45 + @Override
46 + protected List<ReactPackage> getPackages() {
47 + List<ReactPackage> packages = new PackageList(this).getPackages();
48 + // Packages that cannot be autolinked yet can be added manually here, for example:
49 + // packages.add(new MyReactNativePackage());
50 + // TurboModules must also be loaded here providing a valid TurboReactPackage implementation:
51 + // packages.add(new TurboReactPackage() { ... });
52 + // If you have custom Fabric Components, their ViewManagers should also be loaded here
53 + // inside a ReactPackage.
54 + return packages;
55 + }
56 +
57 + @Override
58 + protected String getJSMainModuleName() {
59 + return "index";
60 + }
61 +
62 + @NonNull
63 + @Override
64 + protected ReactPackageTurboModuleManagerDelegate.Builder
65 + getReactPackageTurboModuleManagerDelegateBuilder() {
66 + // Here we provide the ReactPackageTurboModuleManagerDelegate Builder. This is necessary
67 + // for the new architecture and to use TurboModules correctly.
68 + return new MainApplicationTurboModuleManagerDelegate.Builder();
69 + }
70 +
71 + @Override
72 + protected JSIModulePackage getJSIModulePackage() {
73 + return new JSIModulePackage() {
74 + @Override
75 + public List<JSIModuleSpec> getJSIModules(
76 + final ReactApplicationContext reactApplicationContext,
77 + final JavaScriptContextHolder jsContext) {
78 + final List<JSIModuleSpec> specs = new ArrayList<>();
79 +
80 + // Here we provide a new JSIModuleSpec that will be responsible of providing the
81 + // custom Fabric Components.
82 + specs.add(
83 + new JSIModuleSpec() {
84 + @Override
85 + public JSIModuleType getJSIModuleType() {
86 + return JSIModuleType.UIManager;
87 + }
88 +
89 + @Override
90 + public JSIModuleProvider<UIManager> getJSIModuleProvider() {
91 + final ComponentFactory componentFactory = new ComponentFactory();
92 + CoreComponentsRegistry.register(componentFactory);
93 +
94 + // Here we register a Components Registry.
95 + // The one that is generated with the template contains no components
96 + // and just provides you the one from React Native core.
97 + MainComponentsRegistry.register(componentFactory);
98 +
99 + final ReactInstanceManager reactInstanceManager = getReactInstanceManager();
100 +
101 + ViewManagerRegistry viewManagerRegistry =
102 + new ViewManagerRegistry(
103 + reactInstanceManager.getOrCreateViewManagers(reactApplicationContext));
104 +
105 + return new FabricJSIModuleProvider(
106 + reactApplicationContext,
107 + componentFactory,
108 + new EmptyReactNativeConfig(),
109 + viewManagerRegistry);
110 + }
111 + });
112 + return specs;
113 + }
114 + };
115 + }
116 +}
1 +package com.shipcamera.newarchitecture.components;
2 +
3 +import com.facebook.jni.HybridData;
4 +import com.facebook.proguard.annotations.DoNotStrip;
5 +import com.facebook.react.fabric.ComponentFactory;
6 +import com.facebook.soloader.SoLoader;
7 +
8 +/**
9 + * Class responsible to load the custom Fabric Components. This class has native methods and needs a
10 + * corresponding C++ implementation/header file to work correctly (already placed inside the jni/
11 + * folder for you).
12 + *
13 + * <p>Please note that this class is used ONLY if you opt-in for the New Architecture (see the
14 + * `newArchEnabled` property). Is ignored otherwise.
15 + */
16 +@DoNotStrip
17 +public class MainComponentsRegistry {
18 + static {
19 + SoLoader.loadLibrary("fabricjni");
20 + }
21 +
22 + @DoNotStrip private final HybridData mHybridData;
23 +
24 + @DoNotStrip
25 + private native HybridData initHybrid(ComponentFactory componentFactory);
26 +
27 + @DoNotStrip
28 + private MainComponentsRegistry(ComponentFactory componentFactory) {
29 + mHybridData = initHybrid(componentFactory);
30 + }
31 +
32 + @DoNotStrip
33 + public static MainComponentsRegistry register(ComponentFactory componentFactory) {
34 + return new MainComponentsRegistry(componentFactory);
35 + }
36 +}
1 +package com.shipcamera.newarchitecture.modules;
2 +
3 +import com.facebook.jni.HybridData;
4 +import com.facebook.react.ReactPackage;
5 +import com.facebook.react.ReactPackageTurboModuleManagerDelegate;
6 +import com.facebook.react.bridge.ReactApplicationContext;
7 +import com.facebook.soloader.SoLoader;
8 +import java.util.List;
9 +
10 +/**
11 + * Class responsible to load the TurboModules. This class has native methods and needs a
12 + * corresponding C++ implementation/header file to work correctly (already placed inside the jni/
13 + * folder for you).
14 + *
15 + * <p>Please note that this class is used ONLY if you opt-in for the New Architecture (see the
16 + * `newArchEnabled` property). Is ignored otherwise.
17 + */
18 +public class MainApplicationTurboModuleManagerDelegate
19 + extends ReactPackageTurboModuleManagerDelegate {
20 +
21 + private static volatile boolean sIsSoLibraryLoaded;
22 +
23 + protected MainApplicationTurboModuleManagerDelegate(
24 + ReactApplicationContext reactApplicationContext, List<ReactPackage> packages) {
25 + super(reactApplicationContext, packages);
26 + }
27 +
28 + protected native HybridData initHybrid();
29 +
30 + native boolean canCreateTurboModule(String moduleName);
31 +
32 + public static class Builder extends ReactPackageTurboModuleManagerDelegate.Builder {
33 + protected MainApplicationTurboModuleManagerDelegate build(
34 + ReactApplicationContext context, List<ReactPackage> packages) {
35 + return new MainApplicationTurboModuleManagerDelegate(context, packages);
36 + }
37 + }
38 +
39 + @Override
40 + protected synchronized void maybeLoadOtherSoLibraries() {
41 + if (!sIsSoLibraryLoaded) {
42 + // If you change the name of your application .so file in the Android.mk file,
43 + // make sure you update the name here as well.
44 + SoLoader.loadLibrary("shipcamera_appmodules");
45 + sIsSoLibraryLoaded = true;
46 + }
47 + }
48 +}
1 +THIS_DIR := $(call my-dir)
2 +
3 +include $(REACT_ANDROID_DIR)/Android-prebuilt.mk
4 +
5 +# If you wish to add a custom TurboModule or Fabric component in your app you
6 +# will have to include the following autogenerated makefile.
7 +# include $(GENERATED_SRC_DIR)/codegen/jni/Android.mk
8 +include $(CLEAR_VARS)
9 +
10 +LOCAL_PATH := $(THIS_DIR)
11 +
12 +# You can customize the name of your application .so file here.
13 +LOCAL_MODULE := shipcamera_appmodules
14 +
15 +LOCAL_C_INCLUDES := $(LOCAL_PATH)
16 +LOCAL_SRC_FILES := $(wildcard $(LOCAL_PATH)/*.cpp)
17 +LOCAL_EXPORT_C_INCLUDES := $(LOCAL_PATH)
18 +
19 +# If you wish to add a custom TurboModule or Fabric component in your app you
20 +# will have to uncomment those lines to include the generated source
21 +# files from the codegen (placed in $(GENERATED_SRC_DIR)/codegen/jni)
22 +#
23 +# LOCAL_C_INCLUDES += $(GENERATED_SRC_DIR)/codegen/jni
24 +# LOCAL_SRC_FILES += $(wildcard $(GENERATED_SRC_DIR)/codegen/jni/*.cpp)
25 +# LOCAL_EXPORT_C_INCLUDES += $(GENERATED_SRC_DIR)/codegen/jni
26 +
27 +# Here you should add any native library you wish to depend on.
28 +LOCAL_SHARED_LIBRARIES := \
29 + libfabricjni \
30 + libfbjni \
31 + libfolly_futures \
32 + libfolly_json \
33 + libglog \
34 + libjsi \
35 + libreact_codegen_rncore \
36 + libreact_debug \
37 + libreact_nativemodule_core \
38 + libreact_render_componentregistry \
39 + libreact_render_core \
40 + libreact_render_debug \
41 + libreact_render_graphics \
42 + librrc_view \
43 + libruntimeexecutor \
44 + libturbomodulejsijni \
45 + libyoga
46 +
47 +LOCAL_CFLAGS := -DLOG_TAG=\"ReactNative\" -fexceptions -frtti -std=c++17 -Wall
48 +
49 +include $(BUILD_SHARED_LIBRARY)
1 +#include "MainApplicationModuleProvider.h"
2 +
3 +#include <rncore.h>
4 +
5 +namespace facebook {
6 +namespace react {
7 +
8 +std::shared_ptr<TurboModule> MainApplicationModuleProvider(
9 + const std::string moduleName,
10 + const JavaTurboModule::InitParams &params) {
11 + // Here you can provide your own module provider for TurboModules coming from
12 + // either your application or from external libraries. The approach to follow
13 + // is similar to the following (for a library called `samplelibrary`:
14 + //
15 + // auto module = samplelibrary_ModuleProvider(moduleName, params);
16 + // if (module != nullptr) {
17 + // return module;
18 + // }
19 + // return rncore_ModuleProvider(moduleName, params);
20 + return rncore_ModuleProvider(moduleName, params);
21 +}
22 +
23 +} // namespace react
24 +} // namespace facebook
1 +#pragma once
2 +
3 +#include <memory>
4 +#include <string>
5 +
6 +#include <ReactCommon/JavaTurboModule.h>
7 +
8 +namespace facebook {
9 +namespace react {
10 +
11 +std::shared_ptr<TurboModule> MainApplicationModuleProvider(
12 + const std::string moduleName,
13 + const JavaTurboModule::InitParams &params);
14 +
15 +} // namespace react
16 +} // namespace facebook
1 +#include "MainApplicationTurboModuleManagerDelegate.h"
2 +#include "MainApplicationModuleProvider.h"
3 +
4 +namespace facebook {
5 +namespace react {
6 +
7 +jni::local_ref<MainApplicationTurboModuleManagerDelegate::jhybriddata>
8 +MainApplicationTurboModuleManagerDelegate::initHybrid(
9 + jni::alias_ref<jhybridobject>) {
10 + return makeCxxInstance();
11 +}
12 +
13 +void MainApplicationTurboModuleManagerDelegate::registerNatives() {
14 + registerHybrid({
15 + makeNativeMethod(
16 + "initHybrid", MainApplicationTurboModuleManagerDelegate::initHybrid),
17 + makeNativeMethod(
18 + "canCreateTurboModule",
19 + MainApplicationTurboModuleManagerDelegate::canCreateTurboModule),
20 + });
21 +}
22 +
23 +std::shared_ptr<TurboModule>
24 +MainApplicationTurboModuleManagerDelegate::getTurboModule(
25 + const std::string name,
26 + const std::shared_ptr<CallInvoker> jsInvoker) {
27 + // Not implemented yet: provide pure-C++ NativeModules here.
28 + return nullptr;
29 +}
30 +
31 +std::shared_ptr<TurboModule>
32 +MainApplicationTurboModuleManagerDelegate::getTurboModule(
33 + const std::string name,
34 + const JavaTurboModule::InitParams &params) {
35 + return MainApplicationModuleProvider(name, params);
36 +}
37 +
38 +bool MainApplicationTurboModuleManagerDelegate::canCreateTurboModule(
39 + std::string name) {
40 + return getTurboModule(name, nullptr) != nullptr ||
41 + getTurboModule(name, {.moduleName = name}) != nullptr;
42 +}
43 +
44 +} // namespace react
45 +} // namespace facebook
1 +#include <memory>
2 +#include <string>
3 +
4 +#include <ReactCommon/TurboModuleManagerDelegate.h>
5 +#include <fbjni/fbjni.h>
6 +
7 +namespace facebook {
8 +namespace react {
9 +
10 +class MainApplicationTurboModuleManagerDelegate
11 + : public jni::HybridClass<
12 + MainApplicationTurboModuleManagerDelegate,
13 + TurboModuleManagerDelegate> {
14 + public:
15 + // Adapt it to the package you used for your Java class.
16 + static constexpr auto kJavaDescriptor =
17 + "Lcom/shipcamera/newarchitecture/modules/MainApplicationTurboModuleManagerDelegate;";
18 +
19 + static jni::local_ref<jhybriddata> initHybrid(jni::alias_ref<jhybridobject>);
20 +
21 + static void registerNatives();
22 +
23 + std::shared_ptr<TurboModule> getTurboModule(
24 + const std::string name,
25 + const std::shared_ptr<CallInvoker> jsInvoker) override;
26 + std::shared_ptr<TurboModule> getTurboModule(
27 + const std::string name,
28 + const JavaTurboModule::InitParams &params) override;
29 +
30 + /**
31 + * Test-only method. Allows user to verify whether a TurboModule can be
32 + * created by instances of this class.
33 + */
34 + bool canCreateTurboModule(std::string name);
35 +};
36 +
37 +} // namespace react
38 +} // namespace facebook
1 +#include "MainComponentsRegistry.h"
2 +
3 +#include <CoreComponentsRegistry.h>
4 +#include <fbjni/fbjni.h>
5 +#include <react/renderer/componentregistry/ComponentDescriptorProviderRegistry.h>
6 +#include <react/renderer/components/rncore/ComponentDescriptors.h>
7 +
8 +namespace facebook {
9 +namespace react {
10 +
11 +MainComponentsRegistry::MainComponentsRegistry(ComponentFactory *delegate) {}
12 +
13 +std::shared_ptr<ComponentDescriptorProviderRegistry const>
14 +MainComponentsRegistry::sharedProviderRegistry() {
15 + auto providerRegistry = CoreComponentsRegistry::sharedProviderRegistry();
16 +
17 + // Custom Fabric Components go here. You can register custom
18 + // components coming from your App or from 3rd party libraries here.
19 + //
20 + // providerRegistry->add(concreteComponentDescriptorProvider<
21 + // AocViewerComponentDescriptor>());
22 + return providerRegistry;
23 +}
24 +
25 +jni::local_ref<MainComponentsRegistry::jhybriddata>
26 +MainComponentsRegistry::initHybrid(
27 + jni::alias_ref<jclass>,
28 + ComponentFactory *delegate) {
29 + auto instance = makeCxxInstance(delegate);
30 +
31 + auto buildRegistryFunction =
32 + [](EventDispatcher::Weak const &eventDispatcher,
33 + ContextContainer::Shared const &contextContainer)
34 + -> ComponentDescriptorRegistry::Shared {
35 + auto registry = MainComponentsRegistry::sharedProviderRegistry()
36 + ->createComponentDescriptorRegistry(
37 + {eventDispatcher, contextContainer});
38 +
39 + auto mutableRegistry =
40 + std::const_pointer_cast<ComponentDescriptorRegistry>(registry);
41 +
42 + mutableRegistry->setFallbackComponentDescriptor(
43 + std::make_shared<UnimplementedNativeViewComponentDescriptor>(
44 + ComponentDescriptorParameters{
45 + eventDispatcher, contextContainer, nullptr}));
46 +
47 + return registry;
48 + };
49 +
50 + delegate->buildRegistryFunction = buildRegistryFunction;
51 + return instance;
52 +}
53 +
54 +void MainComponentsRegistry::registerNatives() {
55 + registerHybrid({
56 + makeNativeMethod("initHybrid", MainComponentsRegistry::initHybrid),
57 + });
58 +}
59 +
60 +} // namespace react
61 +} // namespace facebook
1 +#pragma once
2 +
3 +#include <ComponentFactory.h>
4 +#include <fbjni/fbjni.h>
5 +#include <react/renderer/componentregistry/ComponentDescriptorProviderRegistry.h>
6 +#include <react/renderer/componentregistry/ComponentDescriptorRegistry.h>
7 +
8 +namespace facebook {
9 +namespace react {
10 +
11 +class MainComponentsRegistry
12 + : public facebook::jni::HybridClass<MainComponentsRegistry> {
13 + public:
14 + // Adapt it to the package you used for your Java class.
15 + constexpr static auto kJavaDescriptor =
16 + "Lcom/shipcamera/newarchitecture/components/MainComponentsRegistry;";
17 +
18 + static void registerNatives();
19 +
20 + MainComponentsRegistry(ComponentFactory *delegate);
21 +
22 + private:
23 + static std::shared_ptr<ComponentDescriptorProviderRegistry const>
24 + sharedProviderRegistry();
25 +
26 + static jni::local_ref<jhybriddata> initHybrid(
27 + jni::alias_ref<jclass>,
28 + ComponentFactory *delegate);
29 +};
30 +
31 +} // namespace react
32 +} // namespace facebook
1 +#include <fbjni/fbjni.h>
2 +#include "MainApplicationTurboModuleManagerDelegate.h"
3 +#include "MainComponentsRegistry.h"
4 +
5 +JNIEXPORT jint JNICALL JNI_OnLoad(JavaVM *vm, void *) {
6 + return facebook::jni::initialize(vm, [] {
7 + facebook::react::MainApplicationTurboModuleManagerDelegate::
8 + registerNatives();
9 + facebook::react::MainComponentsRegistry::registerNatives();
10 + });
11 +}
1 +<?xml version="1.0" encoding="utf-8"?>
2 +<!-- Copyright (C) 2014 The Android Open Source Project
3 +
4 + Licensed under the Apache License, Version 2.0 (the "License");
5 + you may not use this file except in compliance with the License.
6 + You may obtain a copy of the License at
7 +
8 + http://www.apache.org/licenses/LICENSE-2.0
9 +
10 + Unless required by applicable law or agreed to in writing, software
11 + distributed under the License is distributed on an "AS IS" BASIS,
12 + WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
13 + See the License for the specific language governing permissions and
14 + limitations under the License.
15 +-->
16 +<inset xmlns:android="http://schemas.android.com/apk/res/android"
17 + android:insetLeft="@dimen/abc_edit_text_inset_horizontal_material"
18 + android:insetRight="@dimen/abc_edit_text_inset_horizontal_material"
19 + android:insetTop="@dimen/abc_edit_text_inset_top_material"
20 + android:insetBottom="@dimen/abc_edit_text_inset_bottom_material">
21 +
22 + <selector>
23 + <!--
24 + This file is a copy of abc_edit_text_material (https://bit.ly/3k8fX7I).
25 + The item below with state_pressed="false" and state_focused="false" causes a NullPointerException.
26 + NullPointerException:tempt to invoke virtual method 'android.graphics.drawable.Drawable android.graphics.drawable.Drawable$ConstantState.newDrawable(android.content.res.Resources)'
27 +
28 + <item android:state_pressed="false" android:state_focused="false" android:drawable="@drawable/abc_textfield_default_mtrl_alpha"/>
29 +
30 + For more info, see https://bit.ly/3CdLStv (react-native/pull/29452) and https://bit.ly/3nxOMoR.
31 + -->
32 + <item android:state_enabled="false" android:drawable="@drawable/abc_textfield_default_mtrl_alpha"/>
33 + <item android:drawable="@drawable/abc_textfield_activated_mtrl_alpha"/>
34 + </selector>
35 +
36 +</inset>
1 +<resources>
2 + <string name="app_name">shipCamera</string>
3 +</resources>
1 +<resources>
2 +
3 + <!-- Base application theme. -->
4 + <style name="AppTheme" parent="Theme.AppCompat.DayNight.NoActionBar">
5 + <!-- Customize your theme here. -->
6 + <item name="android:editTextBackground">@drawable/rn_edit_text_material</item>
7 + </style>
8 +
9 +</resources>
1 +import org.apache.tools.ant.taskdefs.condition.Os
2 +
3 +// Top-level build file where you can add configuration options common to all sub-projects/modules.
4 +
5 +buildscript {
6 + ext {
7 + buildToolsVersion = "31.0.0"
8 + minSdkVersion = 21
9 + compileSdkVersion = 31
10 + targetSdkVersion = 31
11 +
12 + if (System.properties['os.arch'] == "aarch64") {
13 + // For M1 Users we need to use the NDK 24 which added support for aarch64
14 + ndkVersion = "24.0.8215888"
15 + } else {
16 + // Otherwise we default to the side-by-side NDK version from AGP.
17 + ndkVersion = "21.4.7075529"
18 + }
19 + }
20 + repositories {
21 + google()
22 + mavenCentral()
23 + }
24 + dependencies {
25 + classpath("com.android.tools.build:gradle:7.0.4")
26 + classpath("com.facebook.react:react-native-gradle-plugin")
27 + classpath("de.undercouch:gradle-download-task:4.1.2")
28 + // NOTE: Do not place your application dependencies here; they belong
29 + // in the individual module build.gradle files
30 + }
31 +}
32 +
33 +allprojects {
34 + repositories {
35 + maven {
36 + // All of React Native (JS, Obj-C sources, Android binaries) is installed from npm
37 + url("$rootDir/../node_modules/react-native/android")
38 + }
39 + maven {
40 + // Android JSC is installed from npm
41 + url("$rootDir/../node_modules/jsc-android/dist")
42 + }
43 + mavenCentral {
44 + // We don't want to fetch react-native from Maven Central as there are
45 + // older versions over there.
46 + content {
47 + excludeGroup "com.facebook.react"
48 + }
49 + }
50 + google()
51 + maven { url 'https://www.jitpack.io' }
52 + }
53 +}
1 +# Project-wide Gradle settings.
2 +
3 +# IDE (e.g. Android Studio) users:
4 +# Gradle settings configured through the IDE *will override*
5 +# any settings specified in this file.
6 +
7 +# For more details on how to configure your build environment visit
8 +# http://www.gradle.org/docs/current/userguide/build_environment.html
9 +
10 +# Specifies the JVM arguments used for the daemon process.
11 +# The setting is particularly useful for tweaking memory settings.
12 +# Default value: -Xmx512m -XX:MaxMetaspaceSize=256m
13 +org.gradle.jvmargs=-Xmx2048m -XX:MaxMetaspaceSize=512m
14 +
15 +# When configured, Gradle will run in incubating parallel mode.
16 +# This option should only be used with decoupled projects. More details, visit
17 +# http://www.gradle.org/docs/current/userguide/multi_project_builds.html#sec:decoupled_projects
18 +# org.gradle.parallel=true
19 +
20 +# AndroidX package structure to make it clearer which packages are bundled with the
21 +# Android operating system, and which are packaged with your app's APK
22 +# https://developer.android.com/topic/libraries/support-library/androidx-rn
23 +android.useAndroidX=true
24 +# Automatically convert third-party libraries to use AndroidX
25 +android.enableJetifier=true
26 +
27 +# Version of flipper SDK to use with React Native
28 +FLIPPER_VERSION=0.125.0
29 +
30 +# Use this property to specify which architecture you want to build.
31 +# You can also override it from the CLI using
32 +# ./gradlew <task> -PreactNativeArchitectures=x86_64
33 +reactNativeArchitectures=armeabi-v7a,arm64-v8a,x86,x86_64
34 +
35 +# Use this property to enable support to the new architecture.
36 +# This will allow you to use TurboModules and the Fabric render in
37 +# your application. You should enable this flag either if you want
38 +# to write custom TurboModules/Fabric components OR use libraries that
39 +# are providing them.
40 +newArchEnabled=false
41 +
42 +MYAPP_UPLOAD_STORE_FILE=my-upload-key.keystore
43 +MYAPP_UPLOAD_KEY_ALIAS=ship-camera-key-alias
44 +MYAPP_UPLOAD_STORE_PASSWORD=shipcamera
45 +MYAPP_UPLOAD_KEY_PASSWORD=shipcamera
No preview for this file type
1 +distributionBase=GRADLE_USER_HOME
2 +distributionPath=wrapper/dists
3 +distributionUrl=https\://services.gradle.org/distributions/gradle-7.3.3-all.zip
4 +zipStoreBase=GRADLE_USER_HOME
5 +zipStorePath=wrapper/dists
1 +#!/bin/sh
2 +
3 +#
4 +# Copyright © 2015-2021 the original authors.
5 +#
6 +# Licensed under the Apache License, Version 2.0 (the "License");
7 +# you may not use this file except in compliance with the License.
8 +# You may obtain a copy of the License at
9 +#
10 +# https://www.apache.org/licenses/LICENSE-2.0
11 +#
12 +# Unless required by applicable law or agreed to in writing, software
13 +# distributed under the License is distributed on an "AS IS" BASIS,
14 +# WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
15 +# See the License for the specific language governing permissions and
16 +# limitations under the License.
17 +#
18 +
19 +##############################################################################
20 +#
21 +# Gradle start up script for POSIX generated by Gradle.
22 +#
23 +# Important for running:
24 +#
25 +# (1) You need a POSIX-compliant shell to run this script. If your /bin/sh is
26 +# noncompliant, but you have some other compliant shell such as ksh or
27 +# bash, then to run this script, type that shell name before the whole
28 +# command line, like:
29 +#
30 +# ksh Gradle
31 +#
32 +# Busybox and similar reduced shells will NOT work, because this script
33 +# requires all of these POSIX shell features:
34 +# * functions;
35 +# * expansions «$var», «${var}», «${var:-default}», «${var+SET}»,
36 +# «${var#prefix}», «${var%suffix}», and «$( cmd )»;
37 +# * compound commands having a testable exit status, especially «case»;
38 +# * various built-in commands including «command», «set», and «ulimit».
39 +#
40 +# Important for patching:
41 +#
42 +# (2) This script targets any POSIX shell, so it avoids extensions provided
43 +# by Bash, Ksh, etc; in particular arrays are avoided.
44 +#
45 +# The "traditional" practice of packing multiple parameters into a
46 +# space-separated string is a well documented source of bugs and security
47 +# problems, so this is (mostly) avoided, by progressively accumulating
48 +# options in "$@", and eventually passing that to Java.
49 +#
50 +# Where the inherited environment variables (DEFAULT_JVM_OPTS, JAVA_OPTS,
51 +# and GRADLE_OPTS) rely on word-splitting, this is performed explicitly;
52 +# see the in-line comments for details.
53 +#
54 +# There are tweaks for specific operating systems such as AIX, CygWin,
55 +# Darwin, MinGW, and NonStop.
56 +#
57 +# (3) This script is generated from the Groovy template
58 +# https://github.com/gradle/gradle/blob/master/subprojects/plugins/src/main/resources/org/gradle/api/internal/plugins/unixStartScript.txt
59 +# within the Gradle project.
60 +#
61 +# You can find Gradle at https://github.com/gradle/gradle/.
62 +#
63 +##############################################################################
64 +
65 +# Attempt to set APP_HOME
66 +
67 +# Resolve links: $0 may be a link
68 +app_path=$0
69 +
70 +# Need this for daisy-chained symlinks.
71 +while
72 + APP_HOME=${app_path%"${app_path##*/}"} # leaves a trailing /; empty if no leading path
73 + [ -h "$app_path" ]
74 +do
75 + ls=$( ls -ld "$app_path" )
76 + link=${ls#*' -> '}
77 + case $link in #(
78 + /*) app_path=$link ;; #(
79 + *) app_path=$APP_HOME$link ;;
80 + esac
81 +done
82 +
83 +APP_HOME=$( cd "${APP_HOME:-./}" && pwd -P ) || exit
84 +
85 +APP_NAME="Gradle"
86 +APP_BASE_NAME=${0##*/}
87 +
88 +# Add default JVM options here. You can also use JAVA_OPTS and GRADLE_OPTS to pass JVM options to this script.
89 +DEFAULT_JVM_OPTS='"-Xmx64m" "-Xms64m"'
90 +
91 +# Use the maximum available, or set MAX_FD != -1 to use that value.
92 +MAX_FD=maximum
93 +
94 +warn () {
95 + echo "$*"
96 +} >&2
97 +
98 +die () {
99 + echo
100 + echo "$*"
101 + echo
102 + exit 1
103 +} >&2
104 +
105 +# OS specific support (must be 'true' or 'false').
106 +cygwin=false
107 +msys=false
108 +darwin=false
109 +nonstop=false
110 +case "$( uname )" in #(
111 + CYGWIN* ) cygwin=true ;; #(
112 + Darwin* ) darwin=true ;; #(
113 + MSYS* | MINGW* ) msys=true ;; #(
114 + NONSTOP* ) nonstop=true ;;
115 +esac
116 +
117 +CLASSPATH=$APP_HOME/gradle/wrapper/gradle-wrapper.jar
118 +
119 +
120 +# Determine the Java command to use to start the JVM.
121 +if [ -n "$JAVA_HOME" ] ; then
122 + if [ -x "$JAVA_HOME/jre/sh/java" ] ; then
123 + # IBM's JDK on AIX uses strange locations for the executables
124 + JAVACMD=$JAVA_HOME/jre/sh/java
125 + else
126 + JAVACMD=$JAVA_HOME/bin/java
127 + fi
128 + if [ ! -x "$JAVACMD" ] ; then
129 + die "ERROR: JAVA_HOME is set to an invalid directory: $JAVA_HOME
130 +
131 +Please set the JAVA_HOME variable in your environment to match the
132 +location of your Java installation."
133 + fi
134 +else
135 + JAVACMD=java
136 + which java >/dev/null 2>&1 || die "ERROR: JAVA_HOME is not set and no 'java' command could be found in your PATH.
137 +
138 +Please set the JAVA_HOME variable in your environment to match the
139 +location of your Java installation."
140 +fi
141 +
142 +# Increase the maximum file descriptors if we can.
143 +if ! "$cygwin" && ! "$darwin" && ! "$nonstop" ; then
144 + case $MAX_FD in #(
145 + max*)
146 + MAX_FD=$( ulimit -H -n ) ||
147 + warn "Could not query maximum file descriptor limit"
148 + esac
149 + case $MAX_FD in #(
150 + '' | soft) :;; #(
151 + *)
152 + ulimit -n "$MAX_FD" ||
153 + warn "Could not set maximum file descriptor limit to $MAX_FD"
154 + esac
155 +fi
156 +
157 +# Collect all arguments for the java command, stacking in reverse order:
158 +# * args from the command line
159 +# * the main class name
160 +# * -classpath
161 +# * -D...appname settings
162 +# * --module-path (only if needed)
163 +# * DEFAULT_JVM_OPTS, JAVA_OPTS, and GRADLE_OPTS environment variables.
164 +
165 +# For Cygwin or MSYS, switch paths to Windows format before running java
166 +if "$cygwin" || "$msys" ; then
167 + APP_HOME=$( cygpath --path --mixed "$APP_HOME" )
168 + CLASSPATH=$( cygpath --path --mixed "$CLASSPATH" )
169 +
170 + JAVACMD=$( cygpath --unix "$JAVACMD" )
171 +
172 + # Now convert the arguments - kludge to limit ourselves to /bin/sh
173 + for arg do
174 + if
175 + case $arg in #(
176 + -*) false ;; # don't mess with options #(
177 + /?*) t=${arg#/} t=/${t%%/*} # looks like a POSIX filepath
178 + [ -e "$t" ] ;; #(
179 + *) false ;;
180 + esac
181 + then
182 + arg=$( cygpath --path --ignore --mixed "$arg" )
183 + fi
184 + # Roll the args list around exactly as many times as the number of
185 + # args, so each arg winds up back in the position where it started, but
186 + # possibly modified.
187 + #
188 + # NB: a `for` loop captures its iteration list before it begins, so
189 + # changing the positional parameters here affects neither the number of
190 + # iterations, nor the values presented in `arg`.
191 + shift # remove old arg
192 + set -- "$@" "$arg" # push replacement arg
193 + done
194 +fi
195 +
196 +# Collect all arguments for the java command;
197 +# * $DEFAULT_JVM_OPTS, $JAVA_OPTS, and $GRADLE_OPTS can contain fragments of
198 +# shell script including quotes and variable substitutions, so put them in
199 +# double quotes to make sure that they get re-expanded; and
200 +# * put everything else in single quotes, so that it's not re-expanded.
201 +
202 +set -- \
203 + "-Dorg.gradle.appname=$APP_BASE_NAME" \
204 + -classpath "$CLASSPATH" \
205 + org.gradle.wrapper.GradleWrapperMain \
206 + "$@"
207 +
208 +# Use "xargs" to parse quoted args.
209 +#
210 +# With -n1 it outputs one arg per line, with the quotes and backslashes removed.
211 +#
212 +# In Bash we could simply go:
213 +#
214 +# readarray ARGS < <( xargs -n1 <<<"$var" ) &&
215 +# set -- "${ARGS[@]}" "$@"
216 +#
217 +# but POSIX shell has neither arrays nor command substitution, so instead we
218 +# post-process each arg (as a line of input to sed) to backslash-escape any
219 +# character that might be a shell metacharacter, then use eval to reverse
220 +# that process (while maintaining the separation between arguments), and wrap
221 +# the whole thing up as a single "set" statement.
222 +#
223 +# This will of course break if any of these variables contains a newline or
224 +# an unmatched quote.
225 +#
226 +
227 +eval "set -- $(
228 + printf '%s\n' "$DEFAULT_JVM_OPTS $JAVA_OPTS $GRADLE_OPTS" |
229 + xargs -n1 |
230 + sed ' s~[^-[:alnum:]+,./:=@_]~\\&~g; ' |
231 + tr '\n' ' '
232 + )" '"$@"'
233 +
234 +exec "$JAVACMD" "$@"
1 +@rem
2 +@rem Copyright 2015 the original author or authors.
3 +@rem
4 +@rem Licensed under the Apache License, Version 2.0 (the "License");
5 +@rem you may not use this file except in compliance with the License.
6 +@rem You may obtain a copy of the License at
7 +@rem
8 +@rem https://www.apache.org/licenses/LICENSE-2.0
9 +@rem
10 +@rem Unless required by applicable law or agreed to in writing, software
11 +@rem distributed under the License is distributed on an "AS IS" BASIS,
12 +@rem WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
13 +@rem See the License for the specific language governing permissions and
14 +@rem limitations under the License.
15 +@rem
16 +
17 +@if "%DEBUG%" == "" @echo off
18 +@rem ##########################################################################
19 +@rem
20 +@rem Gradle startup script for Windows
21 +@rem
22 +@rem ##########################################################################
23 +
24 +@rem Set local scope for the variables with windows NT shell
25 +if "%OS%"=="Windows_NT" setlocal
26 +
27 +set DIRNAME=%~dp0
28 +if "%DIRNAME%" == "" set DIRNAME=.
29 +set APP_BASE_NAME=%~n0
30 +set APP_HOME=%DIRNAME%
31 +
32 +@rem Resolve any "." and ".." in APP_HOME to make it shorter.
33 +for %%i in ("%APP_HOME%") do set APP_HOME=%%~fi
34 +
35 +@rem Add default JVM options here. You can also use JAVA_OPTS and GRADLE_OPTS to pass JVM options to this script.
36 +set DEFAULT_JVM_OPTS="-Xmx64m" "-Xms64m"
37 +
38 +@rem Find java.exe
39 +if defined JAVA_HOME goto findJavaFromJavaHome
40 +
41 +set JAVA_EXE=java.exe
42 +%JAVA_EXE% -version >NUL 2>&1
43 +if "%ERRORLEVEL%" == "0" goto execute
44 +
45 +echo.
46 +echo ERROR: JAVA_HOME is not set and no 'java' command could be found in your PATH.
47 +echo.
48 +echo Please set the JAVA_HOME variable in your environment to match the
49 +echo location of your Java installation.
50 +
51 +goto fail
52 +
53 +:findJavaFromJavaHome
54 +set JAVA_HOME=%JAVA_HOME:"=%
55 +set JAVA_EXE=%JAVA_HOME%/bin/java.exe
56 +
57 +if exist "%JAVA_EXE%" goto execute
58 +
59 +echo.
60 +echo ERROR: JAVA_HOME is set to an invalid directory: %JAVA_HOME%
61 +echo.
62 +echo Please set the JAVA_HOME variable in your environment to match the
63 +echo location of your Java installation.
64 +
65 +goto fail
66 +
67 +:execute
68 +@rem Setup the command line
69 +
70 +set CLASSPATH=%APP_HOME%\gradle\wrapper\gradle-wrapper.jar
71 +
72 +
73 +@rem Execute Gradle
74 +"%JAVA_EXE%" %DEFAULT_JVM_OPTS% %JAVA_OPTS% %GRADLE_OPTS% "-Dorg.gradle.appname=%APP_BASE_NAME%" -classpath "%CLASSPATH%" org.gradle.wrapper.GradleWrapperMain %*
75 +
76 +:end
77 +@rem End local scope for the variables with windows NT shell
78 +if "%ERRORLEVEL%"=="0" goto mainEnd
79 +
80 +:fail
81 +rem Set variable GRADLE_EXIT_CONSOLE if you need the _script_ return code instead of
82 +rem the _cmd.exe /c_ return code!
83 +if not "" == "%GRADLE_EXIT_CONSOLE%" exit 1
84 +exit /b 1
85 +
86 +:mainEnd
87 +if "%OS%"=="Windows_NT" endlocal
88 +
89 +:omega
1 +rootProject.name = 'shipCamera'
2 +include ':react-native-vector-icons'
3 +project(':react-native-vector-icons').projectDir = new File(rootProject.projectDir, '../node_modules/react-native-vector-icons/android')
4 +apply from: file("../node_modules/@react-native-community/cli-platform-android/native_modules.gradle"); applyNativeModulesSettingsGradle(settings)
5 +include ':app'
6 +includeBuild('../node_modules/react-native-gradle-plugin')
7 +
8 +if (settings.hasProperty("newArchEnabled") && settings.newArchEnabled == "true") {
9 + include(":ReactAndroid")
10 + project(":ReactAndroid").projectDir = file('../node_modules/react-native/ReactAndroid')
11 +}
1 +{
2 + "name": "shipCamera",
3 + "displayName": "shipCamera"
4 +}
...\ No newline at end of file ...\ No newline at end of file
1 +import React from 'react';
2 +import {Provider} from 'react-redux';
3 +import store from './store/store';
4 +import {SafeAreaProvider} from 'react-native-safe-area-context';
5 +import {RootSiblingParent} from 'react-native-root-siblings';
6 +import RouterScreen from './RouterScreen';
7 +import {injectStore} from './utils/request';
8 +
9 +injectStore(store);
10 +
11 +const App = () => {
12 + return (
13 + <Provider store={store}>
14 + <RootSiblingParent>
15 + <SafeAreaProvider>
16 + <RouterScreen />
17 + </SafeAreaProvider>
18 + </RootSiblingParent>
19 + </Provider>
20 + );
21 +};
22 +
23 +export default App;
1 +import React from 'react';
2 +import {NavigationContainer} from '@react-navigation/native';
3 +import Home from './pages/Home';
4 +import {Icon} from '@rneui/themed';
5 +import Mine from './pages/Mine';
6 +import SignIn from './pages/SignIn';
7 +import {useSelector} from 'react-redux';
8 +import {selectToken} from './pages/Mine/userSlice';
9 +import {createBottomTabNavigator} from '@react-navigation/bottom-tabs';
10 +import {createNativeStackNavigator} from '@react-navigation/native-stack';
11 +
12 +const Tab = createBottomTabNavigator();
13 +const Stack = createNativeStackNavigator();
14 +
15 +const RouterScreen = () => {
16 + const token = useSelector(selectToken);
17 + return (
18 + <NavigationContainer>
19 + {token ? (
20 + <Tab.Navigator
21 + screenOptions={{
22 + headerShown: false,
23 + }}>
24 + <Tab.Screen
25 + name="home"
26 + component={Home}
27 + options={{
28 + title: '首页',
29 + tabBarIcon: ({color}) => {
30 + return <Icon color={color} name="dehaze" />;
31 + },
32 + }}
33 + />
34 + <Tab.Screen
35 + name="mine"
36 + component={Mine}
37 + options={{
38 + title: '设置',
39 + tabBarIcon: ({color}) => {
40 + return <Icon color={color} name="person" />;
41 + },
42 + }}
43 + />
44 + </Tab.Navigator>
45 + ) : (
46 + <Stack.Navigator
47 + screenOptions={{
48 + headerShown: false,
49 + }}>
50 + <Stack.Screen name="SignIn" component={SignIn} />
51 + </Stack.Navigator>
52 + )}
53 + </NavigationContainer>
54 + );
55 +};
56 +
57 +export default RouterScreen;
1 +import servers from '../utils/request';
2 +
3 +const getCameras = () => {
4 + return servers('/platform/device/query', {
5 + method: 'POST',
6 + data: {},
7 + });
8 +};
9 +
10 +const getChannels = deviceId => {
11 + return servers('/platform/device/channelList', {
12 + method: 'GET',
13 + params: {
14 + deviceId,
15 + },
16 + });
17 +};
18 +
19 +const getStream = deviceInfo => {
20 + return servers('/platform/openStream', {
21 + method: 'GET',
22 + params: {
23 + ...deviceInfo,
24 + },
25 + });
26 +};
27 +
28 +/**
29 + *
30 + * @param ptzControlInfo
31 + * deviceId,
32 + * channelId,
33 + * command up,down,left,right,stop,
34 + */
35 +const ptzControl = ptzControlInfo => {
36 + return servers('/platform/ptzControl', {
37 + method: 'POST',
38 + data: {
39 + ...ptzControlInfo,
40 + },
41 + });
42 +};
43 +
44 +export default {
45 + getCameras,
46 + getChannels,
47 + getStream,
48 + ptzControl
49 +};
1 +import user from './user';
2 +import cameras from './cameras';
3 +
4 +export default {
5 + user,
6 + cameras,
7 +};
1 +import axios from 'axios';
2 +import servers from '../utils/request';
3 +
4 +const getJwt = async loginInfo => {
5 + return axios.post('https://wxapp.jjskj.com.cn/sso/auth', {
6 + ...loginInfo,
7 + });
8 +};
9 +
10 +const getUser = async jwt => {
11 + return servers('/login/userAuth', {
12 + method: 'GET',
13 + params: {
14 + jwt,
15 + },
16 + });
17 +};
18 +
19 +export default {
20 + getJwt,
21 + getUser,
22 +};
1 +import React, {useState} from 'react';
2 +import {StyleSheet, View} from 'react-native';
3 +import {SafeAreaView} from 'react-native-safe-area-context';
4 +import {
5 + BottomSheet,
6 + Divider,
7 + Icon,
8 + ListItem,
9 + Skeleton,
10 + Text,
11 +} from '@rneui/themed';
12 +import {Button, Chip} from '@rneui/base';
13 +import api from '../../../api';
14 +import {NodePlayerView} from 'react-native-nodemediaclient';
15 +import {useSelector} from 'react-redux';
16 +import {selectCameraById} from '../cameraSlice';
17 +
18 +const Camera = ({route}) => {
19 + const [bottomSheetVisible, setBottomSheetVisible] = useState(false);
20 + const [channelList, setChannelList] = useState([]);
21 + const [channelInfo, setChannelInfo] = useState({});
22 + const [videoUri, setVideoUri] = useState(null);
23 + const [iconDisabled, setIconDisabled] = useState(false);
24 + const camera = useSelector(state => selectCameraById(state, route.params.id));
25 +
26 + const handleShowChannelList = async () => {
27 + if (route.params.deviceId) {
28 + const data = await api.cameras.getChannels(route.params.deviceId);
29 + if (data.code === 200) {
30 + setChannelList(data.results);
31 + setBottomSheetVisible(true);
32 + }
33 + }
34 + };
35 +
36 + const onSelectChannel = async channelItem => {
37 + setBottomSheetVisible(false);
38 + setChannelInfo(channelItem);
39 + const data = await api.cameras.getStream({
40 + deviceId: channelItem.deviceId,
41 + channelId: channelItem.channelId,
42 + });
43 + if (data.code === 200) {
44 + setVideoUri(data.result);
45 + }
46 + };
47 +
48 + const handlePtzControl = async direction => {
49 + const ptzInfo = {
50 + deviceId: route.params.deviceId,
51 + channelId: channelInfo.channelId,
52 + command: direction,
53 + };
54 + setIconDisabled(true);
55 + if (direction === 'stop') {
56 + const data = await api.cameras.ptzControl(ptzInfo);
57 + if (data?.code === 200) {
58 + setIconDisabled(false);
59 + }
60 + } else {
61 + const data = await api.cameras.ptzControl(direction);
62 + if (data?.code === 200) {
63 + setTimeout(async () => {
64 + const data1 = await api.cameras.ptzControl({
65 + deviceId: route.params.deviceId,
66 + channelId: channelInfo.channelId,
67 + command: 'stop',
68 + });
69 + if (data1?.code === 200) {
70 + setIconDisabled(false);
71 + }
72 + }, 1500);
73 + } else {
74 + setIconDisabled(false);
75 + }
76 + }
77 + };
78 +
79 + return (
80 + <SafeAreaView style={styles.contain}>
81 + <Text style={styles.title}>{camera.name || camera.deviceId}</Text>
82 + <Divider />
83 + <View style={styles.channel}>
84 + <Text style={styles.text}>通道:{channelInfo?.name}</Text>
85 + <Chip
86 + type="clear"
87 + title="选择通道"
88 + onPress={() => handleShowChannelList()}
89 + />
90 + </View>
91 + <Divider />
92 + {videoUri ? (
93 + <View style={styles.videoBox}>
94 + <NodePlayerView
95 + style={styles.video}
96 + inputUrl={videoUri}
97 + scaleMode={'ScaleAspectFit'}
98 + bufferTime={300}
99 + maxBufferTime={1000}
100 + autoplay={true}
101 + />
102 + <View style={styles.iconBox1}>
103 + <Icon
104 + name="keyboard-arrow-up"
105 + size={30}
106 + color="#1890ff"
107 + reverse
108 + disabled={iconDisabled}
109 + onPress={() => handlePtzControl('up')}
110 + />
111 + </View>
112 + <View style={styles.iconBox2}>
113 + <Icon
114 + name="keyboard-arrow-left"
115 + size={30}
116 + reverse
117 + color="#1890ff"
118 + disabled={iconDisabled}
119 + onPress={() => handlePtzControl('left')}
120 + />
121 + <Icon
122 + name="pause"
123 + size={40}
124 + onPress={() => handlePtzControl('stop')}
125 + />
126 + <Icon
127 + name="keyboard-arrow-right"
128 + size={30}
129 + reverse
130 + color="#1890ff"
131 + disabled={iconDisabled}
132 + onPress={() => handlePtzControl('right')}
133 + />
134 + </View>
135 + <View style={styles.iconBox1}>
136 + <Icon
137 + name="keyboard-arrow-down"
138 + size={30}
139 + reverse
140 + color="#1890ff"
141 + disabled={iconDisabled}
142 + onPress={() => handlePtzControl('right')}
143 + />
144 + </View>
145 + </View>
146 + ) : (
147 + <Skeleton height={350} animation="none" />
148 + )}
149 + <BottomSheet modalProps={{}} isVisible={bottomSheetVisible}>
150 + {channelList.map(l => (
151 + <ListItem key={l.channelId} onPress={() => onSelectChannel(l)}>
152 + <ListItem.Content>
153 + <ListItem.Title>{l?.name}</ListItem.Title>
154 + </ListItem.Content>
155 + </ListItem>
156 + ))}
157 + <Button title="取消" onPress={() => setBottomSheetVisible(false)} />
158 + </BottomSheet>
159 + </SafeAreaView>
160 + );
161 +};
162 +
163 +const styles = StyleSheet.create({
164 + contain: {
165 + backgroundColor: '#fff',
166 + minHeight: '100%',
167 + },
168 + title: {
169 + paddingLeft: 10,
170 + fontSize: 20,
171 + margin: 10,
172 + },
173 + channel: {
174 + flexDirection: 'row',
175 + alignItems: 'center',
176 + paddingLeft: 20,
177 + paddingRight: 20,
178 + justifyContent: 'space-between',
179 + },
180 + text: {
181 + fontSize: 16,
182 + },
183 + videoBox: {
184 + padding: 10,
185 + },
186 + video: {
187 + height: 230,
188 + },
189 + iconBox1: {
190 + justifyContent: 'center',
191 + alignItems: 'center',
192 + },
193 + iconBox2: {
194 + padding: 20,
195 + flexDirection: 'row',
196 + alignItems: 'center',
197 + justifyContent: 'space-around',
198 + },
199 +});
200 +
201 +export default Camera;
1 +import React, {useEffect} from 'react';
2 +import {SafeAreaView} from 'react-native-safe-area-context';
3 +import {Divider, Icon, ListItem, Text} from '@rneui/themed';
4 +import {useDispatch, useSelector} from 'react-redux';
5 +import {fetchCameras, selectAllCameras} from '../cameraSlice';
6 +import {FlatList} from 'react-native';
7 +import {StyleSheet} from 'react-native';
8 +
9 +const List = ({navigation}) => {
10 + const dispatch = useDispatch();
11 + const cameras = useSelector(selectAllCameras);
12 + const cameraStatus = useSelector(state => state.cameras.status);
13 + const error = useSelector(state => state.cameras.error);
14 +
15 + useEffect(() => {
16 + if (cameraStatus === 'idle') {
17 + dispatch(fetchCameras());
18 + }
19 + }, [cameraStatus, dispatch]);
20 +
21 + let content;
22 +
23 + if (cameraStatus === 'loading') {
24 + content = <Text>loading</Text>;
25 + } else if (cameraStatus === 'succeeded') {
26 + content = (
27 + <FlatList
28 + data={cameras}
29 + keyExtractor={item => item.id}
30 + renderItem={({item}) => {
31 + return (
32 + <ListItem
33 + bottomDivider
34 + onPress={() => {
35 + if (item?.onlineStatus === 1) {
36 + navigation.navigate('Camera', {
37 + deviceId: item.deviceId,
38 + id: item.id,
39 + });
40 + }
41 + }}>
42 + <Icon
43 + name="circle"
44 + color={item?.onlineStatus === 1 ? '#52c41a' : '#ff4d4f'}
45 + />
46 + <ListItem.Content>
47 + <ListItem.Title>{item?.name}</ListItem.Title>
48 + </ListItem.Content>
49 + <ListItem.Chevron />
50 + </ListItem>
51 + );
52 + }}
53 + />
54 + );
55 + } else if (cameraStatus === 'failed') {
56 + content = <Text>{error}</Text>;
57 + }
58 +
59 + return (
60 + <SafeAreaView>
61 + {/*<Text style={styles.title}>设备列表</Text>*/}
62 + <Divider />
63 + {content}
64 + </SafeAreaView>
65 + );
66 +};
67 +
68 +const styles = StyleSheet.create({
69 + title: {
70 + backgroundColor: '#fff',
71 + padding: 10,
72 + fontSize: 20,
73 + paddingLeft: 26,
74 + },
75 +});
76 +
77 +export default List;
1 +import {
2 + createAsyncThunk,
3 + createEntityAdapter,
4 + createSlice,
5 +} from '@reduxjs/toolkit';
6 +import api from '../../api';
7 +
8 +export const fetchCameras = createAsyncThunk(
9 + 'cameras/fetchCameras',
10 + async () => {
11 + return api.cameras.getCameras();
12 + },
13 +);
14 +
15 +const cameraAdapter = createEntityAdapter();
16 +
17 +const initialState = cameraAdapter.getInitialState({
18 + status: 'idle',
19 + error: null,
20 +});
21 +
22 +const camerasSlice = createSlice({
23 + name: 'cameras',
24 + initialState,
25 + reducers: {},
26 + extraReducers(builder) {
27 + builder
28 + .addCase(fetchCameras.pending, state => {
29 + state.status = 'loading';
30 + })
31 + .addCase(fetchCameras.fulfilled, (state, action) => {
32 + state.status = 'succeeded';
33 + console.log(action.payload);
34 + // state.cameras = state.cameras.concat(action.payload.results);
35 + cameraAdapter.upsertMany(state, action.payload.results);
36 + })
37 + .addCase(fetchCameras.rejected, (state, action) => {
38 + state.status = 'failed';
39 + state.error = action.payload.message;
40 + });
41 + },
42 +});
43 +
44 +export default camerasSlice.reducer;
45 +
46 +// export const selectAllCameras = (state) => state.cameras.cameras;
47 +export const {selectAll: selectAllCameras, selectById: selectCameraById} =
48 + cameraAdapter.getSelectors(state => state.cameras);
1 +import React from 'react';
2 +import List from './List';
3 +import {createNativeStackNavigator} from '@react-navigation/native-stack';
4 +import Camera from './Camera';
5 +
6 +const HomeStack = createNativeStackNavigator();
7 +
8 +const Home = () => {
9 + return (
10 + <HomeStack.Navigator>
11 + <HomeStack.Screen
12 + name="List"
13 + component={List}
14 + options={{
15 + title: '摄像头列表',
16 + }}
17 + />
18 + <HomeStack.Screen
19 + name="Camera"
20 + component={Camera}
21 + options={{
22 + title: '详情',
23 + }}
24 + />
25 + </HomeStack.Navigator>
26 + );
27 +};
28 +
29 +export default Home;
1 +import React from 'react';
2 +import {SafeAreaView} from 'react-native-safe-area-context';
3 +import {Text} from '@rneui/themed';
4 +import {Button} from '@rneui/base';
5 +import {useDispatch} from 'react-redux';
6 +import {signOut} from './userSlice';
7 +
8 +const Mine = () => {
9 + const dispatch = useDispatch();
10 + return (
11 + <SafeAreaView>
12 + <Text>我的信息</Text>
13 + <Button
14 + title="退出登录"
15 + onPress={() => {
16 + dispatch(signOut());
17 + }}
18 + />
19 + </SafeAreaView>
20 + );
21 +};
22 +
23 +export default Mine;
1 +import { createAsyncThunk, createSlice } from "@reduxjs/toolkit";
2 +import api from "../../api";
3 +import Toast from "react-native-root-toast";
4 +
5 +export const fetchUser = createAsyncThunk('user/fetchUser', async loginInfo => {
6 + const jwtResponse = await api.user.getJwt(loginInfo);
7 + return api.user.getUser(jwtResponse?.data?.access_token);
8 +});
9 +
10 +const initialState = {
11 + token: null,
12 + userInfo: null,
13 +};
14 +
15 +const userSlice = createSlice({
16 + name: 'user',
17 + initialState,
18 + reducers: {
19 + signOut(state) {
20 + state.token = null;
21 + state.userInfo = null;
22 + },
23 + },
24 + extraReducers(builder) {
25 + builder.addCase(fetchUser.fulfilled, (state, action) => {
26 + Toast.show('登录成功', {
27 + duration: Toast.durations.SHORT,
28 + });
29 + state.token = action.payload.result.token;
30 + state.userInfo = action.payload.result;
31 + });
32 + },
33 +});
34 +
35 +export const {signOut} = userSlice.actions;
36 +
37 +export const selectToken = state => state.user.token;
38 +
39 +export const selectUser = state => state.user.userInfo;
40 +
41 +export default userSlice.reducer;
1 +import React, {useState} from 'react';
2 +import { StyleSheet, View } from "react-native";
3 +import {SafeAreaView} from 'react-native-safe-area-context';
4 +import {Input, Text} from '@rneui/themed';
5 +import {Button} from '@rneui/base';
6 +import {useDispatch} from 'react-redux';
7 +import {fetchUser} from '../Mine/userSlice';
8 +
9 +const SignIn = () => {
10 + const dispatch = useDispatch();
11 +
12 + const [username, setUsername] = useState('staff');
13 + const [password, setPassword] = useState('staff');
14 +
15 + return (
16 + <SafeAreaView>
17 + <View style={styles.container}>
18 + <Text h4 style={styles.title}>
19 + 船舶视频监控
20 + </Text>
21 + <Input
22 + inputContainerStyle={styles.inputEle}
23 + value={username}
24 + placeholder="用户名"
25 + onChangeText={text => setUsername(text)}
26 + />
27 + <Input
28 + inputContainerStyle={styles.inputEle}
29 + value={password}
30 + placeholder="密码"
31 + onChangeText={text => setPassword(text)}
32 + secureTextEntry={true}
33 + />
34 + <Button
35 + title="登录"
36 + containerStyle={styles.submitButton}
37 + onPress={() => {
38 + dispatch(
39 + fetchUser({
40 + email: username,
41 + password,
42 + }),
43 + );
44 + }}
45 + />
46 + </View>
47 + </SafeAreaView>
48 + );
49 +};
50 +
51 +const styles = StyleSheet.create({
52 + container: {
53 + height: '100%',
54 + padding: 20,
55 + },
56 + title: {
57 + marginTop: '30%',
58 + marginBottom: 30,
59 + textAlign: 'center',
60 + },
61 + inputEle: {
62 + borderWidth: 1,
63 + borderRadius: 10,
64 + },
65 + submitButton: {
66 + marginLeft: 5,
67 + padding: 5,
68 + },
69 +});
70 +
71 +export default SignIn;
1 +import {configureStore} from '@reduxjs/toolkit';
2 +import userReducer from '../pages/Mine/userSlice';
3 +import camerasReducer from '../pages/Home/cameraSlice';
4 +
5 +export default configureStore({
6 + reducer: {
7 + user: userReducer,
8 + cameras: camerasReducer,
9 + },
10 +});
1 +import axios from 'axios';
2 +import Toast from 'react-native-root-toast';
3 +
4 +let store;
5 +
6 +export const injectStore = _store => {
7 + store = _store;
8 +};
9 +
10 +const servers = axios.create({
11 + baseURL: 'http://114.55.111.91:8499/api',
12 + timeout: 5000,
13 +});
14 +
15 +servers.interceptors.request.use(
16 + config => {
17 + if (store.getState().user?.token) {
18 + config.headers.Authorization = `${store.getState().user?.token}`;
19 + }
20 + return config;
21 + },
22 + error => {
23 + return Promise.reject(error);
24 + },
25 +);
26 +
27 +servers.interceptors.response.use(
28 + response => {
29 + return response.data;
30 + },
31 + error => {
32 + Toast.show(JSON.stringify(error));
33 + return Promise.reject(error);
34 + },
35 +);
36 +
37 +export default servers;
1 +module.exports = {
2 + presets: ['module:metro-react-native-babel-preset'],
3 +};
1 +/**
2 + * @format
3 + */
4 +
5 +import {AppRegistry} from 'react-native';
6 +import App from './app/App';
7 +import {name as appName} from './app.json';
8 +
9 +AppRegistry.registerComponent(appName, () => App);
1 +require_relative '../node_modules/react-native/scripts/react_native_pods'
2 +require_relative '../node_modules/@react-native-community/cli-platform-ios/native_modules'
3 +
4 +platform :ios, '11.0'
5 +install! 'cocoapods', :deterministic_uuids => false
6 +
7 +target 'shipCamera' do
8 + config = use_native_modules!
9 +
10 + # Flags change depending on the env values.
11 + flags = get_default_flags()
12 +
13 + use_react_native!(
14 + :path => config[:reactNativePath],
15 + # to enable hermes on iOS, change `false` to `true` and then install pods
16 + :hermes_enabled => flags[:hermes_enabled],
17 + :fabric_enabled => flags[:fabric_enabled],
18 + # An absolute path to your application root.
19 + :app_path => "#{Pod::Config.instance.installation_root}/.."
20 + )
21 +
22 + pod 'RNVectorIcons', :path => '../node_modules/react-native-vector-icons'
23 +
24 + target 'shipCameraTests' do
25 + inherit! :complete
26 + # Pods for testing
27 + end
28 +
29 + # Enables Flipper.
30 + #
31 + # Note that if you have use_frameworks! enabled, Flipper will not work and
32 + # you should disable the next line.
33 + use_flipper!()
34 +
35 + post_install do |installer|
36 + react_native_post_install(installer)
37 + __apply_Xcode_12_5_M1_post_install_workaround(installer)
38 + end
39 +end
1 +<?xml version="1.0" encoding="UTF-8"?>
2 +<Scheme
3 + LastUpgradeVersion = "1210"
4 + version = "1.3">
5 + <BuildAction
6 + parallelizeBuildables = "YES"
7 + buildImplicitDependencies = "YES">
8 + <BuildActionEntries>
9 + <BuildActionEntry
10 + buildForTesting = "YES"
11 + buildForRunning = "YES"
12 + buildForProfiling = "YES"
13 + buildForArchiving = "YES"
14 + buildForAnalyzing = "YES">
15 + <BuildableReference
16 + BuildableIdentifier = "primary"
17 + BlueprintIdentifier = "13B07F861A680F5B00A75B9A"
18 + BuildableName = "shipCamera.app"
19 + BlueprintName = "shipCamera"
20 + ReferencedContainer = "container:shipCamera.xcodeproj">
21 + </BuildableReference>
22 + </BuildActionEntry>
23 + </BuildActionEntries>
24 + </BuildAction>
25 + <TestAction
26 + buildConfiguration = "Debug"
27 + selectedDebuggerIdentifier = "Xcode.DebuggerFoundation.Debugger.LLDB"
28 + selectedLauncherIdentifier = "Xcode.DebuggerFoundation.Launcher.LLDB"
29 + shouldUseLaunchSchemeArgsEnv = "YES">
30 + <Testables>
31 + <TestableReference
32 + skipped = "NO">
33 + <BuildableReference
34 + BuildableIdentifier = "primary"
35 + BlueprintIdentifier = "00E356ED1AD99517003FC87E"
36 + BuildableName = "shipCameraTests.xctest"
37 + BlueprintName = "shipCameraTests"
38 + ReferencedContainer = "container:shipCamera.xcodeproj">
39 + </BuildableReference>
40 + </TestableReference>
41 + </Testables>
42 + </TestAction>
43 + <LaunchAction
44 + buildConfiguration = "Debug"
45 + selectedDebuggerIdentifier = "Xcode.DebuggerFoundation.Debugger.LLDB"
46 + selectedLauncherIdentifier = "Xcode.DebuggerFoundation.Launcher.LLDB"
47 + launchStyle = "0"
48 + useCustomWorkingDirectory = "NO"
49 + ignoresPersistentStateOnLaunch = "NO"
50 + debugDocumentVersioning = "YES"
51 + debugServiceExtension = "internal"
52 + allowLocationSimulation = "YES">
53 + <BuildableProductRunnable
54 + runnableDebuggingMode = "0">
55 + <BuildableReference
56 + BuildableIdentifier = "primary"
57 + BlueprintIdentifier = "13B07F861A680F5B00A75B9A"
58 + BuildableName = "shipCamera.app"
59 + BlueprintName = "shipCamera"
60 + ReferencedContainer = "container:shipCamera.xcodeproj">
61 + </BuildableReference>
62 + </BuildableProductRunnable>
63 + </LaunchAction>
64 + <ProfileAction
65 + buildConfiguration = "Release"
66 + shouldUseLaunchSchemeArgsEnv = "YES"
67 + savedToolIdentifier = ""
68 + useCustomWorkingDirectory = "NO"
69 + debugDocumentVersioning = "YES">
70 + <BuildableProductRunnable
71 + runnableDebuggingMode = "0">
72 + <BuildableReference
73 + BuildableIdentifier = "primary"
74 + BlueprintIdentifier = "13B07F861A680F5B00A75B9A"
75 + BuildableName = "shipCamera.app"
76 + BlueprintName = "shipCamera"
77 + ReferencedContainer = "container:shipCamera.xcodeproj">
78 + </BuildableReference>
79 + </BuildableProductRunnable>
80 + </ProfileAction>
81 + <AnalyzeAction
82 + buildConfiguration = "Debug">
83 + </AnalyzeAction>
84 + <ArchiveAction
85 + buildConfiguration = "Release"
86 + revealArchiveInOrganizer = "YES">
87 + </ArchiveAction>
88 +</Scheme>
1 +#import <React/RCTBridgeDelegate.h>
2 +#import <UIKit/UIKit.h>
3 +
4 +@interface AppDelegate : UIResponder <UIApplicationDelegate, RCTBridgeDelegate>
5 +
6 +@property (nonatomic, strong) UIWindow *window;
7 +
8 +@end
1 +#import "AppDelegate.h"
2 +
3 +#import <React/RCTBridge.h>
4 +#import <React/RCTBundleURLProvider.h>
5 +#import <React/RCTRootView.h>
6 +
7 +#import <React/RCTAppSetupUtils.h>
8 +
9 +#if RCT_NEW_ARCH_ENABLED
10 +#import <React/CoreModulesPlugins.h>
11 +#import <React/RCTCxxBridgeDelegate.h>
12 +#import <React/RCTFabricSurfaceHostingProxyRootView.h>
13 +#import <React/RCTSurfacePresenter.h>
14 +#import <React/RCTSurfacePresenterBridgeAdapter.h>
15 +#import <ReactCommon/RCTTurboModuleManager.h>
16 +
17 +#import <react/config/ReactNativeConfig.h>
18 +
19 +@interface AppDelegate () <RCTCxxBridgeDelegate, RCTTurboModuleManagerDelegate> {
20 + RCTTurboModuleManager *_turboModuleManager;
21 + RCTSurfacePresenterBridgeAdapter *_bridgeAdapter;
22 + std::shared_ptr<const facebook::react::ReactNativeConfig> _reactNativeConfig;
23 + facebook::react::ContextContainer::Shared _contextContainer;
24 +}
25 +@end
26 +#endif
27 +
28 +@implementation AppDelegate
29 +
30 +- (BOOL)application:(UIApplication *)application didFinishLaunchingWithOptions:(NSDictionary *)launchOptions
31 +{
32 + RCTAppSetupPrepareApp(application);
33 +
34 + RCTBridge *bridge = [[RCTBridge alloc] initWithDelegate:self launchOptions:launchOptions];
35 +
36 +#if RCT_NEW_ARCH_ENABLED
37 + _contextContainer = std::make_shared<facebook::react::ContextContainer const>();
38 + _reactNativeConfig = std::make_shared<facebook::react::EmptyReactNativeConfig const>();
39 + _contextContainer->insert("ReactNativeConfig", _reactNativeConfig);
40 + _bridgeAdapter = [[RCTSurfacePresenterBridgeAdapter alloc] initWithBridge:bridge contextContainer:_contextContainer];
41 + bridge.surfacePresenter = _bridgeAdapter.surfacePresenter;
42 +#endif
43 +
44 + UIView *rootView = RCTAppSetupDefaultRootView(bridge, @"shipCamera", nil);
45 +
46 + if (@available(iOS 13.0, *)) {
47 + rootView.backgroundColor = [UIColor systemBackgroundColor];
48 + } else {
49 + rootView.backgroundColor = [UIColor whiteColor];
50 + }
51 +
52 + self.window = [[UIWindow alloc] initWithFrame:[UIScreen mainScreen].bounds];
53 + UIViewController *rootViewController = [UIViewController new];
54 + rootViewController.view = rootView;
55 + self.window.rootViewController = rootViewController;
56 + [self.window makeKeyAndVisible];
57 + return YES;
58 +}
59 +
60 +- (NSURL *)sourceURLForBridge:(RCTBridge *)bridge
61 +{
62 +#if DEBUG
63 + return [[RCTBundleURLProvider sharedSettings] jsBundleURLForBundleRoot:@"index"];
64 +#else
65 + return [[NSBundle mainBundle] URLForResource:@"main" withExtension:@"jsbundle"];
66 +#endif
67 +}
68 +
69 +#if RCT_NEW_ARCH_ENABLED
70 +
71 +#pragma mark - RCTCxxBridgeDelegate
72 +
73 +- (std::unique_ptr<facebook::react::JSExecutorFactory>)jsExecutorFactoryForBridge:(RCTBridge *)bridge
74 +{
75 + _turboModuleManager = [[RCTTurboModuleManager alloc] initWithBridge:bridge
76 + delegate:self
77 + jsInvoker:bridge.jsCallInvoker];
78 + return RCTAppSetupDefaultJsExecutorFactory(bridge, _turboModuleManager);
79 +}
80 +
81 +#pragma mark RCTTurboModuleManagerDelegate
82 +
83 +- (Class)getModuleClassFromName:(const char *)name
84 +{
85 + return RCTCoreModulesClassProvider(name);
86 +}
87 +
88 +- (std::shared_ptr<facebook::react::TurboModule>)getTurboModule:(const std::string &)name
89 + jsInvoker:(std::shared_ptr<facebook::react::CallInvoker>)jsInvoker
90 +{
91 + return nullptr;
92 +}
93 +
94 +- (std::shared_ptr<facebook::react::TurboModule>)getTurboModule:(const std::string &)name
95 + initParams:
96 + (const facebook::react::ObjCTurboModule::InitParams &)params
97 +{
98 + return nullptr;
99 +}
100 +
101 +- (id<RCTTurboModule>)getModuleInstanceFromClass:(Class)moduleClass
102 +{
103 + return RCTAppSetupDefaultModuleFromClass(moduleClass);
104 +}
105 +
106 +#endif
107 +
108 +@end
1 +{
2 + "images" : [
3 + {
4 + "idiom" : "iphone",
5 + "scale" : "2x",
6 + "size" : "20x20"
7 + },
8 + {
9 + "idiom" : "iphone",
10 + "scale" : "3x",
11 + "size" : "20x20"
12 + },
13 + {
14 + "idiom" : "iphone",
15 + "scale" : "2x",
16 + "size" : "29x29"
17 + },
18 + {
19 + "idiom" : "iphone",
20 + "scale" : "3x",
21 + "size" : "29x29"
22 + },
23 + {
24 + "idiom" : "iphone",
25 + "scale" : "2x",
26 + "size" : "40x40"
27 + },
28 + {
29 + "idiom" : "iphone",
30 + "scale" : "3x",
31 + "size" : "40x40"
32 + },
33 + {
34 + "idiom" : "iphone",
35 + "scale" : "2x",
36 + "size" : "60x60"
37 + },
38 + {
39 + "idiom" : "iphone",
40 + "scale" : "3x",
41 + "size" : "60x60"
42 + },
43 + {
44 + "idiom" : "ios-marketing",
45 + "scale" : "1x",
46 + "size" : "1024x1024"
47 + }
48 + ],
49 + "info" : {
50 + "author" : "xcode",
51 + "version" : 1
52 + }
53 +}
1 +{
2 + "info" : {
3 + "version" : 1,
4 + "author" : "xcode"
5 + }
6 +}
1 +<?xml version="1.0" encoding="UTF-8"?>
2 +<!DOCTYPE plist PUBLIC "-//Apple//DTD PLIST 1.0//EN" "http://www.apple.com/DTDs/PropertyList-1.0.dtd">
3 +<plist version="1.0">
4 +<dict>
5 + <key>CFBundleDevelopmentRegion</key>
6 + <string>en</string>
7 + <key>CFBundleDisplayName</key>
8 + <string>shipCamera</string>
9 + <key>CFBundleExecutable</key>
10 + <string>$(EXECUTABLE_NAME)</string>
11 + <key>CFBundleIdentifier</key>
12 + <string>$(PRODUCT_BUNDLE_IDENTIFIER)</string>
13 + <key>CFBundleInfoDictionaryVersion</key>
14 + <string>6.0</string>
15 + <key>CFBundleName</key>
16 + <string>$(PRODUCT_NAME)</string>
17 + <key>CFBundlePackageType</key>
18 + <string>APPL</string>
19 + <key>CFBundleShortVersionString</key>
20 + <string>1.0</string>
21 + <key>CFBundleSignature</key>
22 + <string>????</string>
23 + <key>CFBundleVersion</key>
24 + <string>1</string>
25 + <key>LSRequiresIPhoneOS</key>
26 + <true/>
27 + <key>NSAppTransportSecurity</key>
28 + <dict>
29 + <key>NSExceptionDomains</key>
30 + <dict>
31 + <key>localhost</key>
32 + <dict>
33 + <key>NSExceptionAllowsInsecureHTTPLoads</key>
34 + <true/>
35 + </dict>
36 + </dict>
37 + </dict>
38 + <key>NSLocationWhenInUseUsageDescription</key>
39 + <string/>
40 + <key>UILaunchStoryboardName</key>
41 + <string>LaunchScreen</string>
42 + <key>UIRequiredDeviceCapabilities</key>
43 + <array>
44 + <string>armv7</string>
45 + </array>
46 + <key>UISupportedInterfaceOrientations</key>
47 + <array>
48 + <string>UIInterfaceOrientationPortrait</string>
49 + <string>UIInterfaceOrientationLandscapeLeft</string>
50 + <string>UIInterfaceOrientationLandscapeRight</string>
51 + </array>
52 + <key>UIViewControllerBasedStatusBarAppearance</key>
53 + <false/>
54 + <key>UIAppFonts</key>
55 + <array>
56 + <string>AntDesign.ttf</string>
57 + <string>Entypo.ttf</string>
58 + <string>EvilIcons.ttf</string>
59 + <string>Feather.ttf</string>
60 + <string>FontAwesome.ttf</string>
61 + <string>FontAwesome5_Brands.ttf</string>
62 + <string>FontAwesome5_Regular.ttf</string>
63 + <string>FontAwesome5_Solid.ttf</string>
64 + <string>Fontisto.ttf</string>
65 + <string>Foundation.ttf</string>
66 + <string>Ionicons.ttf</string>
67 + <string>MaterialCommunityIcons.ttf</string>
68 + <string>MaterialIcons.ttf</string>
69 + <string>Octicons.ttf</string>
70 + <string>SimpleLineIcons.ttf</string>
71 + <string>Zocial.ttf</string>
72 + </array>
73 +</dict>
74 +</plist>
1 +<?xml version="1.0" encoding="UTF-8"?>
2 +<document type="com.apple.InterfaceBuilder3.CocoaTouch.Storyboard.XIB" version="3.0" toolsVersion="15702" targetRuntime="iOS.CocoaTouch" propertyAccessControl="none" useAutolayout="YES" launchScreen="YES" useTraitCollections="YES" useSafeAreas="YES" colorMatched="YES" initialViewController="01J-lp-oVM">
3 + <device id="retina4_7" orientation="portrait" appearance="light"/>
4 + <dependencies>
5 + <deployment identifier="iOS"/>
6 + <plugIn identifier="com.apple.InterfaceBuilder.IBCocoaTouchPlugin" version="15704"/>
7 + <capability name="Safe area layout guides" minToolsVersion="9.0"/>
8 + <capability name="documents saved in the Xcode 8 format" minToolsVersion="8.0"/>
9 + </dependencies>
10 + <scenes>
11 + <!--View Controller-->
12 + <scene sceneID="EHf-IW-A2E">
13 + <objects>
14 + <viewController id="01J-lp-oVM" sceneMemberID="viewController">
15 + <view key="view" contentMode="scaleToFill" id="Ze5-6b-2t3">
16 + <rect key="frame" x="0.0" y="0.0" width="375" height="667"/>
17 + <autoresizingMask key="autoresizingMask" widthSizable="YES" heightSizable="YES"/>
18 + <subviews>
19 + <label opaque="NO" clipsSubviews="YES" userInteractionEnabled="NO" contentMode="left" horizontalHuggingPriority="251" verticalHuggingPriority="251" text="shipCamera" textAlignment="center" lineBreakMode="middleTruncation" baselineAdjustment="alignBaselines" minimumFontSize="18" translatesAutoresizingMaskIntoConstraints="NO" id="GJd-Yh-RWb">
20 + <rect key="frame" x="0.0" y="202" width="375" height="43"/>
21 + <fontDescription key="fontDescription" type="boldSystem" pointSize="36"/>
22 + <nil key="highlightedColor"/>
23 + </label>
24 + <label opaque="NO" clipsSubviews="YES" userInteractionEnabled="NO" contentMode="left" horizontalHuggingPriority="251" verticalHuggingPriority="251" text="Powered by React Native" textAlignment="center" lineBreakMode="tailTruncation" baselineAdjustment="alignBaselines" minimumFontSize="9" translatesAutoresizingMaskIntoConstraints="NO" id="MN2-I3-ftu">
25 + <rect key="frame" x="0.0" y="626" width="375" height="21"/>
26 + <fontDescription key="fontDescription" type="system" pointSize="17"/>
27 + <nil key="highlightedColor"/>
28 + </label>
29 + </subviews>
30 + <color key="backgroundColor" systemColor="systemBackgroundColor" cocoaTouchSystemColor="whiteColor"/>
31 + <constraints>
32 + <constraint firstItem="Bcu-3y-fUS" firstAttribute="bottom" secondItem="MN2-I3-ftu" secondAttribute="bottom" constant="20" id="OZV-Vh-mqD"/>
33 + <constraint firstItem="Bcu-3y-fUS" firstAttribute="centerX" secondItem="GJd-Yh-RWb" secondAttribute="centerX" id="Q3B-4B-g5h"/>
34 + <constraint firstItem="MN2-I3-ftu" firstAttribute="centerX" secondItem="Bcu-3y-fUS" secondAttribute="centerX" id="akx-eg-2ui"/>
35 + <constraint firstItem="MN2-I3-ftu" firstAttribute="leading" secondItem="Bcu-3y-fUS" secondAttribute="leading" id="i1E-0Y-4RG"/>
36 + <constraint firstItem="GJd-Yh-RWb" firstAttribute="centerY" secondItem="Ze5-6b-2t3" secondAttribute="bottom" multiplier="1/3" constant="1" id="moa-c2-u7t"/>
37 + <constraint firstItem="GJd-Yh-RWb" firstAttribute="leading" secondItem="Bcu-3y-fUS" secondAttribute="leading" symbolic="YES" id="x7j-FC-K8j"/>
38 + </constraints>
39 + <viewLayoutGuide key="safeArea" id="Bcu-3y-fUS"/>
40 + </view>
41 + </viewController>
42 + <placeholder placeholderIdentifier="IBFirstResponder" id="iYj-Kq-Ea1" userLabel="First Responder" sceneMemberID="firstResponder"/>
43 + </objects>
44 + <point key="canvasLocation" x="52.173913043478265" y="375"/>
45 + </scene>
46 + </scenes>
47 +</document>
1 +#import <UIKit/UIKit.h>
2 +
3 +#import "AppDelegate.h"
4 +
5 +int main(int argc, char *argv[])
6 +{
7 + @autoreleasepool {
8 + return UIApplicationMain(argc, argv, nil, NSStringFromClass([AppDelegate class]));
9 + }
10 +}
1 +<?xml version="1.0" encoding="UTF-8"?>
2 +<!DOCTYPE plist PUBLIC "-//Apple//DTD PLIST 1.0//EN" "http://www.apple.com/DTDs/PropertyList-1.0.dtd">
3 +<plist version="1.0">
4 +<dict>
5 + <key>CFBundleDevelopmentRegion</key>
6 + <string>en</string>
7 + <key>CFBundleExecutable</key>
8 + <string>$(EXECUTABLE_NAME)</string>
9 + <key>CFBundleIdentifier</key>
10 + <string>$(PRODUCT_BUNDLE_IDENTIFIER)</string>
11 + <key>CFBundleInfoDictionaryVersion</key>
12 + <string>6.0</string>
13 + <key>CFBundleName</key>
14 + <string>$(PRODUCT_NAME)</string>
15 + <key>CFBundlePackageType</key>
16 + <string>BNDL</string>
17 + <key>CFBundleShortVersionString</key>
18 + <string>1.0</string>
19 + <key>CFBundleSignature</key>
20 + <string>????</string>
21 + <key>CFBundleVersion</key>
22 + <string>1</string>
23 +</dict>
24 +</plist>
1 +#import <UIKit/UIKit.h>
2 +#import <XCTest/XCTest.h>
3 +
4 +#import <React/RCTLog.h>
5 +#import <React/RCTRootView.h>
6 +
7 +#define TIMEOUT_SECONDS 600
8 +#define TEXT_TO_LOOK_FOR @"Welcome to React"
9 +
10 +@interface shipCameraTests : XCTestCase
11 +
12 +@end
13 +
14 +@implementation shipCameraTests
15 +
16 +- (BOOL)findSubviewInView:(UIView *)view matching:(BOOL (^)(UIView *view))test
17 +{
18 + if (test(view)) {
19 + return YES;
20 + }
21 + for (UIView *subview in [view subviews]) {
22 + if ([self findSubviewInView:subview matching:test]) {
23 + return YES;
24 + }
25 + }
26 + return NO;
27 +}
28 +
29 +- (void)testRendersWelcomeScreen
30 +{
31 + UIViewController *vc = [[[RCTSharedApplication() delegate] window] rootViewController];
32 + NSDate *date = [NSDate dateWithTimeIntervalSinceNow:TIMEOUT_SECONDS];
33 + BOOL foundElement = NO;
34 +
35 + __block NSString *redboxError = nil;
36 +#ifdef DEBUG
37 + RCTSetLogFunction(
38 + ^(RCTLogLevel level, RCTLogSource source, NSString *fileName, NSNumber *lineNumber, NSString *message) {
39 + if (level >= RCTLogLevelError) {
40 + redboxError = message;
41 + }
42 + });
43 +#endif
44 +
45 + while ([date timeIntervalSinceNow] > 0 && !foundElement && !redboxError) {
46 + [[NSRunLoop mainRunLoop] runMode:NSDefaultRunLoopMode beforeDate:[NSDate dateWithTimeIntervalSinceNow:0.1]];
47 + [[NSRunLoop mainRunLoop] runMode:NSRunLoopCommonModes beforeDate:[NSDate dateWithTimeIntervalSinceNow:0.1]];
48 +
49 + foundElement = [self findSubviewInView:vc.view
50 + matching:^BOOL(UIView *view) {
51 + if ([view.accessibilityLabel isEqualToString:TEXT_TO_LOOK_FOR]) {
52 + return YES;
53 + }
54 + return NO;
55 + }];
56 + }
57 +
58 +#ifdef DEBUG
59 + RCTSetLogFunction(RCTDefaultLogFunction);
60 +#endif
61 +
62 + XCTAssertNil(redboxError, @"RedBox error: %@", redboxError);
63 + XCTAssertTrue(foundElement, @"Couldn't find element with text '%@' in %d seconds", TEXT_TO_LOOK_FOR, TIMEOUT_SECONDS);
64 +}
65 +
66 +@end
1 +/**
2 + * Metro configuration for React Native
3 + * https://github.com/facebook/react-native
4 + *
5 + * @format
6 + */
7 +
8 +module.exports = {
9 + transformer: {
10 + getTransformOptions: async () => ({
11 + transform: {
12 + experimentalImportSupport: false,
13 + inlineRequires: true,
14 + },
15 + }),
16 + },
17 +};
This diff is collapsed. Click to expand it.
This diff could not be displayed because it is too large.