`
58 |
59 | #### Gets the shared data this Share Extension was opened with.
60 |
61 | #### Where `ShareData`
62 |
63 | | Result | Type | Description |
64 | | -------- | ------ | ---------------------------------------------------------- |
65 | | mimeType | String | The mime type of the shared data |
66 | | data | String | Either the shared text, or the location of the shared file |
67 |
--------------------------------------------------------------------------------
/example/Share.js:
--------------------------------------------------------------------------------
1 | import React, {useEffect, useState} from 'react';
2 | import {View, Text, Pressable, Image, StyleSheet} from 'react-native';
3 | import {ShareMenuReactView} from 'react-native-share-menu';
4 |
5 | const Button = ({onPress, title, style}) => (
6 |
7 | {title}
8 |
9 | )
10 |
11 | const Share = () => {
12 | const [sharedData, setSharedData] = useState('');
13 | const [sharedMimeType, setSharedMimeType] = useState('');
14 | const [sending, setSending] = useState(false);
15 |
16 | useEffect(() => {
17 | ShareMenuReactView.data().then(({mimeType, data}) => {
18 | setSharedData(data);
19 | setSharedMimeType(mimeType);
20 | });
21 | }, []);
22 |
23 | return (
24 |
25 |
26 |
46 | {sharedMimeType === 'text/plain' && {sharedData}}
47 | {sharedMimeType.startsWith('image/') && (
48 |
53 | )}
54 |
55 | {
58 | ShareMenuReactView.dismissExtension('Dismissed with error');
59 | }}
60 | style={styles.destructive}
61 | />
62 | {
65 | ShareMenuReactView.continueInApp();
66 | }}
67 | />
68 | {
71 | ShareMenuReactView.continueInApp({hello: 'from the other side'});
72 | }}
73 | />
74 |
75 |
76 | );
77 | };
78 |
79 | const styles = StyleSheet.create({
80 | container: {
81 | flex: 1,
82 | backgroundColor: 'white',
83 | },
84 | header: {
85 | flexDirection: 'row',
86 | justifyContent: 'space-between',
87 | },
88 | destructive: {
89 | color: 'red',
90 | },
91 | send: {
92 | color: 'blue',
93 | },
94 | sending: {
95 | color: 'grey',
96 | },
97 | image: {
98 | width: '100%',
99 | height: 200,
100 | },
101 | buttonGroup: {
102 | alignItems: 'center',
103 | },
104 | });
105 |
106 | export default Share;
107 |
--------------------------------------------------------------------------------
/example/android/gradlew.bat:
--------------------------------------------------------------------------------
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 init
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 init
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 | :init
68 | @rem Get command-line arguments, handling Windows variants
69 |
70 | if not "%OS%" == "Windows_NT" goto win9xME_args
71 |
72 | :win9xME_args
73 | @rem Slurp the command line arguments.
74 | set CMD_LINE_ARGS=
75 | set _SKIP=2
76 |
77 | :win9xME_args_slurp
78 | if "x%~1" == "x" goto execute
79 |
80 | set CMD_LINE_ARGS=%*
81 |
82 | :execute
83 | @rem Setup the command line
84 |
85 | set CLASSPATH=%APP_HOME%\gradle\wrapper\gradle-wrapper.jar
86 |
87 | @rem Execute Gradle
88 | "%JAVA_EXE%" %DEFAULT_JVM_OPTS% %JAVA_OPTS% %GRADLE_OPTS% "-Dorg.gradle.appname=%APP_BASE_NAME%" -classpath "%CLASSPATH%" org.gradle.wrapper.GradleWrapperMain %CMD_LINE_ARGS%
89 |
90 | :end
91 | @rem End local scope for the variables with windows NT shell
92 | if "%ERRORLEVEL%"=="0" goto mainEnd
93 |
94 | :fail
95 | rem Set variable GRADLE_EXIT_CONSOLE if you need the _script_ return code instead of
96 | rem the _cmd.exe /c_ return code!
97 | if not "" == "%GRADLE_EXIT_CONSOLE%" exit 1
98 | exit /b 1
99 |
100 | :mainEnd
101 | if "%OS%"=="Windows_NT" endlocal
102 |
103 | :omega
104 |
--------------------------------------------------------------------------------
/example/android/app/src/debug/java/com/github/meedaan/ReactNativeFlipper.java:
--------------------------------------------------------------------------------
1 | /**
2 | * Copyright (c) Facebook, Inc. and its affiliates.
3 | *
4 | * 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.github.meedaan;
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.ReactInstanceManager;
23 | import com.facebook.react.bridge.ReactContext;
24 | import com.facebook.react.modules.network.NetworkingModule;
25 | import okhttp3.OkHttpClient;
26 |
27 | public class ReactNativeFlipper {
28 | public static void initializeFlipper(Context context, ReactInstanceManager reactInstanceManager) {
29 | if (FlipperUtils.shouldEnableFlipper(context)) {
30 | final FlipperClient client = AndroidFlipperClient.getInstance(context);
31 |
32 | client.addPlugin(new InspectorFlipperPlugin(context, DescriptorMapping.withDefaults()));
33 | client.addPlugin(new ReactFlipperPlugin());
34 | client.addPlugin(new DatabasesFlipperPlugin(context));
35 | client.addPlugin(new SharedPreferencesFlipperPlugin(context));
36 | client.addPlugin(CrashReporterPlugin.getInstance());
37 |
38 | NetworkFlipperPlugin networkFlipperPlugin = new NetworkFlipperPlugin();
39 | NetworkingModule.setCustomClientBuilder(
40 | new NetworkingModule.CustomClientBuilder() {
41 | @Override
42 | public void apply(OkHttpClient.Builder builder) {
43 | builder.addNetworkInterceptor(new FlipperOkhttpInterceptor(networkFlipperPlugin));
44 | }
45 | });
46 | client.addPlugin(networkFlipperPlugin);
47 | client.start();
48 |
49 | // Fresco Plugin needs to ensure that ImagePipelineFactory is initialized
50 | // Hence we run if after all native modules have been initialized
51 | ReactContext reactContext = reactInstanceManager.getCurrentReactContext();
52 | if (reactContext == null) {
53 | reactInstanceManager.addReactInstanceEventListener(
54 | new ReactInstanceManager.ReactInstanceEventListener() {
55 | @Override
56 | public void onReactContextInitialized(ReactContext reactContext) {
57 | reactInstanceManager.removeReactInstanceEventListener(this);
58 | reactContext.runOnNativeModulesQueueThread(
59 | new Runnable() {
60 | @Override
61 | public void run() {
62 | client.addPlugin(new FrescoFlipperPlugin());
63 | }
64 | });
65 | }
66 | });
67 | } else {
68 | client.addPlugin(new FrescoFlipperPlugin());
69 | }
70 | }
71 | }
72 | }
73 |
--------------------------------------------------------------------------------
/example/ios/Test.xcodeproj/xcshareddata/xcschemes/Test.xcscheme:
--------------------------------------------------------------------------------
1 |
2 |
5 |
8 |
9 |
15 |
21 |
22 |
23 |
24 |
25 |
30 |
31 |
33 |
39 |
40 |
41 |
42 |
43 |
53 |
55 |
61 |
62 |
63 |
64 |
70 |
72 |
78 |
79 |
80 |
81 |
83 |
84 |
87 |
88 |
89 |
--------------------------------------------------------------------------------
/example/ios/Test.xcodeproj/xcshareddata/xcschemes/Test-tvOS.xcscheme:
--------------------------------------------------------------------------------
1 |
2 |
5 |
8 |
9 |
15 |
21 |
22 |
23 |
24 |
25 |
30 |
31 |
33 |
39 |
40 |
41 |
42 |
43 |
53 |
55 |
61 |
62 |
63 |
64 |
70 |
72 |
78 |
79 |
80 |
81 |
83 |
84 |
87 |
88 |
89 |
--------------------------------------------------------------------------------
/SHARE_EXTENSION_VIEW.md:
--------------------------------------------------------------------------------
1 | # Custom iOS Share View
2 |
3 | ### If you want a custom sharing view, do these steps
4 |
5 | ## Create Bridging Header
6 |
7 | Right click on your Share Extension folder, and choose `New File...`
8 |
9 | Select Objective-C, make sure the target is your Share Extension
10 |
11 | Create the file and say yes when prompted to create a Bridging Header
12 |
13 | Delete the created `.m` file
14 |
15 | Add the following to the new `Bridging-Header.h` file:
16 |
17 | ```Objective-c
18 | #import
19 | #import
20 | #import
21 | #import
22 | ```
23 |
24 | ## Add React View Controller
25 |
26 | Right click on your Share Extension folder, and choose `Add Files to "ProjectName"`
27 |
28 | On the pop-up, select `node_modules/react-native-share-menu/ios/ReactShareViewController.swift`. Make sure `Copy items if needed` is NOT selected and that the selected target is your newly created Share Extension
29 |
30 | 
31 |
32 | Now go to your `MainInterface.storyboard` and:
33 |
34 | 1. Select the first item in the storyboard inspector
35 |
36 | 2. Select `Show the Identity Inspector` on the right
37 |
38 | 3. Replace the value in `Class` with `ReactShareViewController`
39 |
40 | 
41 |
42 | ## Edit Info.plist
43 |
44 | Open your Share Extension's `Info.plist` and add the following:
45 |
46 | ```OpenStep Property List
47 | ReactShareViewBackgroundColor
48 |
49 | Red
50 | 1
51 | Green
52 | 1
53 | Blue
54 | 1
55 | Alpha
56 | 1
57 | Transparent
58 |
59 |
60 | NSAppTransportSecurity
61 |
62 | NSAllowsArbitraryLoads
63 |
64 | NSExceptionDomains
65 |
66 | localhost
67 |
68 | NSExceptionAllowsInsecureHTTPLoads
69 |
70 |
71 |
72 |
73 | ```
74 |
75 | Feel free to change the values in ReactShareViewBackgroundColor to whatever you want.
76 |
77 | ## Bundle JS code and assets in your Share Extension
78 |
79 | If you're planning to run builds outside the simulator, or to make Release builds, add a `Run Script Phase` to your Share Extension target:
80 |
81 | - Go to your Share Extension target's `Build Phases` settings
82 |
83 | - Add a new `Build Phase` and select `New Run Script Phase`
84 |
85 | - Rename it to `Bundle React Native code and images`
86 |
87 | - Leave the shell as `/bin/sh` and paste the following as the script:
88 |
89 | ```shell
90 | export NODE_BINARY=node
91 | export ENTRY_FILE=index.share.js
92 | ../node_modules/react-native/scripts/react-native-xcode.sh
93 | ```
94 |
95 | - Drag it behind `[CP] Copy Pods Resources`
96 |
97 | You should end up with something like this:
98 |
99 | 
100 |
101 | ## Register Component
102 |
103 | Finally, create an `index.share.js` file, register the component you want to render in your Share Extension view:
104 |
105 | ```javascript
106 | import { AppRegistry } from "react-native";
107 |
108 | AppRegistry.registerComponent(
109 | "ShareMenuModuleComponent",
110 | () => MyShareComponent
111 | );
112 | ```
113 |
114 | ## Example
115 |
116 | If you're rendering an empty component, you should be seeing something similar to this when you share to your app:
117 |
118 | 
119 |
--------------------------------------------------------------------------------
/ios/Modules/ShareMenu.swift:
--------------------------------------------------------------------------------
1 | @objc(ShareMenu)
2 | class ShareMenu: RCTEventEmitter {
3 |
4 | private(set) static var _shared: ShareMenu?
5 | @objc public static var shared: ShareMenu
6 | {
7 | get {
8 | return ShareMenu._shared!
9 | }
10 | }
11 |
12 | var sharedData: [[String:String]]?
13 |
14 | static var initialShare: (UIApplication, URL, [UIApplication.OpenURLOptionsKey : Any])?
15 |
16 | var hasListeners = false
17 |
18 | var _targetUrlScheme: String?
19 | var targetUrlScheme: String
20 | {
21 | get {
22 | return _targetUrlScheme!
23 | }
24 | }
25 |
26 | public override init() {
27 | super.init()
28 | ShareMenu._shared = self
29 |
30 | if let (app, url, options) = ShareMenu.initialShare {
31 | share(application: app, openUrl: url, options: options)
32 | }
33 | }
34 |
35 | override static public func requiresMainQueueSetup() -> Bool {
36 | return false
37 | }
38 |
39 | open override func supportedEvents() -> [String]! {
40 | return [NEW_SHARE_EVENT]
41 | }
42 |
43 | open override func startObserving() {
44 | hasListeners = true
45 | }
46 |
47 | open override func stopObserving() {
48 | hasListeners = false
49 | }
50 |
51 | public static func messageShare(
52 | application app: UIApplication,
53 | openUrl url: URL,
54 | options: [UIApplication.OpenURLOptionsKey : Any]
55 | ) {
56 | guard (ShareMenu._shared != nil) else {
57 | initialShare = (app, url, options)
58 | return
59 | }
60 |
61 | ShareMenu.shared.share(application: app, openUrl: url, options: options)
62 | }
63 |
64 | func share(
65 | application app: UIApplication,
66 | openUrl url: URL,
67 | options: [UIApplication.OpenURLOptionsKey : Any]) {
68 | if _targetUrlScheme == nil {
69 | guard let bundleUrlTypes = Bundle.main.object(forInfoDictionaryKey: "CFBundleURLTypes") as? [NSDictionary] else {
70 | print("Error: \(NO_URL_TYPES_ERROR_MESSAGE)")
71 | return
72 | }
73 | guard let bundleUrlSchemes = bundleUrlTypes.first?.value(forKey: "CFBundleURLSchemes") as? [String] else {
74 | print("Error: \(NO_URL_SCHEMES_ERROR_MESSAGE)")
75 | return
76 | }
77 | guard let expectedUrlScheme = bundleUrlSchemes.first else {
78 | print("Error \(NO_URL_SCHEMES_ERROR_MESSAGE)")
79 | return
80 | }
81 |
82 | _targetUrlScheme = expectedUrlScheme
83 | }
84 |
85 | guard let scheme = url.scheme, scheme == targetUrlScheme else { return }
86 | guard let bundleId = Bundle.main.bundleIdentifier else { return }
87 | guard let userDefaults = UserDefaults(suiteName: "group.\(bundleId)") else {
88 | print("Error: \(NO_APP_GROUP_ERROR)")
89 | return
90 | }
91 |
92 | let extraData = userDefaults.object(forKey: USER_DEFAULTS_EXTRA_DATA_KEY) as? [String:Any]
93 |
94 | if let data = userDefaults.object(forKey: USER_DEFAULTS_KEY) as? [[String:String]] {
95 | sharedData = data
96 | dispatchEvent(with: sharedData!, and: extraData)
97 | userDefaults.removeObject(forKey: USER_DEFAULTS_KEY)
98 | }
99 | }
100 |
101 | @objc(getSharedText:)
102 | func getSharedText(callback: RCTResponseSenderBlock) {
103 | guard var data: [[String:String]] = sharedData else {
104 | callback([])
105 | return
106 | }
107 |
108 | if let bundleId = Bundle.main.bundleIdentifier, let userDefaults = UserDefaults(suiteName: "group.\(bundleId)") {
109 | if let tmp = userDefaults.object(forKey: USER_DEFAULTS_EXTRA_DATA_KEY) as? [String:String] {
110 | data.append( tmp)
111 | }
112 | } else {
113 | print("Error: \(NO_APP_GROUP_ERROR)")
114 | }
115 |
116 | callback(data)
117 | sharedData = nil
118 | }
119 |
120 | func dispatchEvent(with data: [[String:String]], and extraData: [String:Any]?) {
121 | guard hasListeners else { return }
122 |
123 | var finalData = data as [[String:Any]]
124 | if (extraData != nil) {
125 | finalData.append(extraData!)
126 | }
127 | sendEvent(withName: NEW_SHARE_EVENT, body: finalData)
128 | }
129 | }
130 |
--------------------------------------------------------------------------------
/android/src/main/java/com/meedan/ShareMenuModule.java:
--------------------------------------------------------------------------------
1 | package com.meedan;
2 |
3 | import com.facebook.react.bridge.ActivityEventListener;
4 | import com.facebook.react.bridge.Arguments;
5 | import com.facebook.react.bridge.ReactApplicationContext;
6 | import com.facebook.react.bridge.ReactContext;
7 | import com.facebook.react.bridge.ReactContextBaseJavaModule;
8 | import com.facebook.react.bridge.ReactMethod;
9 | import com.facebook.react.bridge.Callback;
10 | import com.facebook.react.bridge.ReadableMap;
11 | import com.facebook.react.bridge.WritableArray;
12 | import com.facebook.react.bridge.WritableMap;
13 | import com.facebook.react.modules.core.DeviceEventManagerModule;
14 |
15 | import android.app.Activity;
16 | import android.content.Intent;
17 | import android.net.Uri;
18 |
19 | import androidx.annotation.NonNull;
20 | import androidx.annotation.Nullable;
21 |
22 | import java.util.ArrayList;
23 |
24 | public class ShareMenuModule extends ReactContextBaseJavaModule implements ActivityEventListener {
25 |
26 | // Events
27 | final String NEW_SHARE_EVENT = "NewShareEvent";
28 |
29 | // Keys
30 | final String MIME_TYPE_KEY = "mimeType";
31 | final String DATA_KEY = "data";
32 |
33 | private ReactContext mReactContext;
34 |
35 | public ShareMenuModule(ReactApplicationContext reactContext) {
36 | super(reactContext);
37 | mReactContext = reactContext;
38 |
39 | mReactContext.addActivityEventListener(this);
40 | }
41 |
42 | @NonNull
43 | @Override
44 | public String getName() {
45 | return "ShareMenu";
46 | }
47 |
48 | @Nullable
49 | private ReadableMap extractShared(Intent intent) {
50 | String type = intent.getType();
51 |
52 | if (type == null) {
53 | return null;
54 | }
55 |
56 | String action = intent.getAction();
57 |
58 | WritableMap data = Arguments.createMap();
59 | data.putString(MIME_TYPE_KEY, type);
60 |
61 | if (Intent.ACTION_SEND.equals(action)) {
62 | if ("text/plain".equals(type)) {
63 | data.putString(DATA_KEY, intent.getStringExtra(Intent.EXTRA_TEXT));
64 | return data;
65 | }
66 |
67 | Uri fileUri = intent.getParcelableExtra(Intent.EXTRA_STREAM);
68 | if (fileUri != null) {
69 | data.putString(DATA_KEY, fileUri.toString());
70 | return data;
71 | }
72 | } else if (Intent.ACTION_SEND_MULTIPLE.equals(action)) {
73 | ArrayList fileUris = intent.getParcelableArrayListExtra(Intent.EXTRA_STREAM);
74 | if (fileUris != null) {
75 | WritableArray uriArr = Arguments.createArray();
76 | for (Uri uri : fileUris) {
77 | uriArr.pushString(uri.toString());
78 | }
79 | data.putArray(DATA_KEY, uriArr);
80 | return data;
81 | }
82 | }
83 |
84 | return null;
85 | }
86 |
87 | @ReactMethod
88 | public void getSharedText(Callback successCallback) {
89 | Activity currentActivity = getCurrentActivity();
90 |
91 | if (currentActivity == null) {
92 | successCallback.invoke(null);
93 | return;
94 | }
95 |
96 | Intent intent = currentActivity.getIntent();
97 |
98 | ReadableMap shared = extractShared(intent);
99 | successCallback.invoke(shared);
100 | clearSharedText();
101 | }
102 |
103 | private void dispatchEvent(ReadableMap shared) {
104 | if (mReactContext == null || !mReactContext.hasActiveCatalystInstance()) {
105 | return;
106 | }
107 |
108 | mReactContext
109 | .getJSModule(DeviceEventManagerModule.RCTDeviceEventEmitter.class)
110 | .emit(NEW_SHARE_EVENT, shared);
111 | }
112 |
113 | public void clearSharedText() {
114 | Activity mActivity = getCurrentActivity();
115 |
116 | if(mActivity == null) { return; }
117 |
118 | Intent intent = mActivity.getIntent();
119 | String type = intent.getType();
120 |
121 | if (type == null) {
122 | return;
123 | }
124 |
125 | if ("text/plain".equals(type)) {
126 | intent.removeExtra(Intent.EXTRA_TEXT);
127 | return;
128 | }
129 |
130 | intent.removeExtra(Intent.EXTRA_STREAM);
131 | }
132 |
133 | @Override
134 | public void onActivityResult(Activity activity, int requestCode, int resultCode, Intent data) {
135 | // DO nothing
136 | }
137 |
138 | @Override
139 | public void onNewIntent(Intent intent) {
140 | // Possibly received a new share while the app was already running
141 |
142 | Activity currentActivity = getCurrentActivity();
143 |
144 | if (currentActivity == null) {
145 | return;
146 | }
147 |
148 | ReadableMap shared = extractShared(intent);
149 | dispatchEvent(shared);
150 |
151 | // Update intent in case the user calls `getSharedText` again
152 | currentActivity.setIntent(intent);
153 | }
154 | }
155 |
--------------------------------------------------------------------------------
/README.md:
--------------------------------------------------------------------------------
1 | # react-native-share-menu
2 |
3 | [](https://www.npmjs.com/package/react-native-share-menu)
4 |
5 | Add your app as a target for sharing from other apps and write iOS Share Extensions in React Native.
6 |
7 | ## Installation
8 |
9 | ```bash
10 | npm i --save react-native-share-menu
11 | ```
12 |
13 | ### Automatic Linking (React Native 0.60+)
14 |
15 | At the command line, in the ios directory:
16 |
17 | ```bash
18 | pod install
19 | ```
20 |
21 | ### Manual Linking (React Native 0.36+)
22 |
23 | At the command line, in the project directory:
24 |
25 | ```bash
26 | react-native link
27 | ```
28 |
29 | ## [Android Instructions](ANDROID_INSTRUCTIONS.md)
30 |
31 | ## [iOS Instructions](IOS_INSTRUCTIONS.md)
32 |
33 | ## [Custom iOS Share View (optional)](SHARE_EXTENSION_VIEW.md)
34 |
35 | ## [API Docs](API_DOCS.md)
36 |
37 | ## [Example Project](example/)
38 |
39 | ### Example Usage
40 |
41 | ```javascript
42 | import React, { useState, useEffect, useCallback } from "react";
43 | import { AppRegistry, Text, View, Image, Button } from "react-native";
44 | import ShareMenu, { ShareMenuReactView } from "react-native-share-menu";
45 |
46 | type SharedItem = {
47 | mimeType: string,
48 | data: string,
49 | extraData: any,
50 | };
51 |
52 | const Test = () => {
53 | const [sharedData, setSharedData] = useState(null);
54 | const [sharedMimeType, setSharedMimeType] = useState(null);
55 |
56 | const handleShare = useCallback((item: ?SharedItem) => {
57 | if (!item) {
58 | return;
59 | }
60 |
61 | const { mimeType, data, extraData } = item;
62 |
63 | setSharedData(data);
64 | setSharedMimeType(mimeType);
65 | // You can receive extra data from your custom Share View
66 | console.log(extraData);
67 | }, []);
68 |
69 | useEffect(() => {
70 | ShareMenu.getInitialShare(handleShare);
71 | }, []);
72 |
73 | useEffect(() => {
74 | const listener = ShareMenu.addNewShareListener(handleShare);
75 |
76 | return () => {
77 | listener.remove();
78 | };
79 | }, []);
80 |
81 | if (!sharedMimeType && !sharedData) {
82 | // The user hasn't shared anything yet
83 | return null;
84 | }
85 |
86 | if (sharedMimeType === "text/plain") {
87 | // The user shared text
88 | return Shared text: {sharedData};
89 | }
90 |
91 | if (sharedMimeType.startsWith("image/")) {
92 | // The user shared an image
93 | return (
94 |
95 | Shared image:
96 |
97 |
98 | );
99 | }
100 |
101 | // The user shared a file in general
102 | return (
103 |
104 | Shared mime type: {sharedMimeType}
105 | Shared file location: {sharedData}
106 |
107 | );
108 | };
109 |
110 | const Share = () => {
111 | const [sharedData, setSharedData] = useState("");
112 | const [sharedMimeType, setSharedMimeType] = useState("");
113 |
114 | useEffect(() => {
115 | ShareMenuReactView.data().then(({ mimeType, data }) => {
116 | setSharedData(data);
117 | setSharedMimeType(mimeType);
118 | });
119 | }, []);
120 |
121 | return (
122 |
123 | {
126 | ShareMenuReactView.dismissExtension();
127 | }}
128 | />
129 | {
132 | // Share something before dismissing
133 | ShareMenuReactView.dismissExtension();
134 | }}
135 | />
136 | {
139 | ShareMenuReactView.dismissExtension("Something went wrong!");
140 | }}
141 | />
142 | {
145 | ShareMenuReactView.continueInApp();
146 | }}
147 | />
148 | {
151 | ShareMenuReactView.continueInApp({ hello: "from the other side" });
152 | }}
153 | />
154 | {sharedMimeType === "text/plain" && {sharedData}}
155 | {sharedMimeType.startsWith("image/") && (
156 |
157 | )}
158 |
159 | );
160 | };
161 |
162 | AppRegistry.registerComponent("Test", () => Test);
163 | AppRegistry.registerComponent("ShareMenuModuleComponent", () => Share);
164 | ```
165 |
166 | Or check the "example" directory for an example application.
167 |
168 | ## How it looks
169 |
170 | ### Android
171 |
172 |
173 |
174 | ### iOS
175 |
176 |
177 |
178 | ## Releasing a new version
179 |
180 | `$ npm version && npm publish`
181 |
182 | ## Credits
183 |
184 | Sponsored and developed by [Meedan](http://meedan.com).
185 |
186 | iOS version maintained by [Gustavo Parreira](https://github.com/Gustash).
187 |
--------------------------------------------------------------------------------
/IOS_INSTRUCTIONS.md:
--------------------------------------------------------------------------------
1 | # iOS Installation
2 |
3 | ## Create Share Extension
4 |
5 | Create a Share Extension by going to your project settings
6 |
7 | 
8 |
9 | Then creating a new target
10 |
11 | 
12 |
13 | And choosing Share Extension
14 |
15 | 
16 |
17 | Name your extension and make sure you've selected Swift as the language to use
18 |
19 | Select your new target, go to `Build Settings`, search for `iOS Deployment Target` and make sure it matches your app's target (iOS 10.0 in RN 0.63)
20 |
21 | When your extension has been created, delete the `ShareViewController.swift` file generated by Xcode in the extension folder, right click on the folder, and choose `Add Files to "ProjectName"`
22 |
23 | On the pop-up, select `node_modules/react-native-share-menu/ios/ShareViewController.swift`. Make sure `Copy items if needed` is NOT selected and that the selected target is your newly created Share Extension
24 |
25 | 
26 |
27 | ## Edit Podfile
28 |
29 | Make these changes to your Podfile:
30 |
31 | ```diff
32 | target '' do
33 | config = use_native_modules!
34 |
35 | use_react_native!(:path => config["reactNativePath"])
36 |
37 | target 'Tests' do
38 | inherit! :complete
39 | # Pods for testing
40 | end
41 |
42 | # Enables Flipper.
43 | #
44 | # Note that if you have use_frameworks! enabled, Flipper will not work and
45 | # you should disable these next few lines.
46 | use_flipper!
47 | post_install do |installer|
48 | flipper_post_install(installer)
49 | + installer.pods_project.targets.each do |target|
50 | + target.build_configurations.each do |config|
51 | + config.build_settings['APPLICATION_EXTENSION_API_ONLY'] = 'NO'
52 | + end
53 | + end
54 | end
55 | end
56 |
57 | +target '' do
58 | + use_react_native!
59 | +
60 | + pod 'RNShareMenu', :path => '../node_modules/react-native-share-menu'
61 | + # Manually link packages here to keep your extension bundle size minimal
62 | +end
63 | ```
64 |
65 | Run `pod install` in your `ios/` directory.
66 |
67 |
68 | If you're using React Native < 0.62
69 |
70 | Create a bridging header by right clicking on your project folder:
71 |
72 | - Selecting New File...
73 | - Choose Swift
74 | - Make sure the selected target is your main app target
75 | - Create the file and say yes to creating a Bridging Header file
76 | - Delete everything in the Swift file, but keep the file around
77 |
78 |
79 | ## Create App Group and URL Scheme
80 |
81 | Create an App Group to be able to share data between your extension and your app. To do so, go to your app target's settings, go to `Signing & Capabilities`, press `+ Capability` and select `App Groups`
82 |
83 | 
84 |
85 | At the bottom of the window on Xcode you should see an `App Groups` section. Press the `+` button and add a group named `group.YOUR_APP_BUNDLE_ID`.
86 |
87 | Repeat this process for the Share Extension target, with the exact same group name.
88 |
89 | Add the following to your app's `Info.plist` (if you already had other URL Schemes, make sure the one you're adding now is the FIRST one):
90 |
91 | ```OpenStep Property List
92 | CFBundleURLTypes
93 |
94 |
95 | CFBundleTypeRole
96 | Editor
97 | CFBundleURLSchemes
98 |
99 | A_URL_SCHEME_UNIQUE_TO_YOUR_APP
100 |
101 |
102 |
103 | ```
104 |
105 | Add the following to your Share Extension's `Info.plist`:
106 |
107 | ```OpenStep Property List
108 | HostAppBundleIdentifier
109 | YOUR_APP_TARGET_BUNDLE_ID
110 | HostAppURLScheme
111 | YOUR_APP_URL_SCHEME_DEFINED_ABOVE
112 | NSExtension
113 |
114 | NSExtensionAttributes
115 |
116 | NSExtensionActivationRule
117 |
118 |
119 | NSExtensionActivationSupportsImageWithMaxCount
120 | 1
121 | NSExtensionActivationSupportsText
122 |
123 | NSExtensionActivationSupportsWebURLWithMaxCount
124 | 1
125 |
126 |
127 | NSExtensionMainStoryboard
128 | MainInterface
129 | NSExtensionPointIdentifier
130 | com.apple.share-services
131 |
132 | ```
133 |
134 | ## Edit AppDelegate.m
135 |
136 | Finally, in your `AppDelegate.m` add the following:
137 |
138 | ```Objective-c
139 | ...
140 | #import
141 |
142 | ...
143 |
144 | @implementation AppDelegate
145 | ...
146 |
147 | - (BOOL)application:(UIApplication *)app
148 | openURL:(NSURL *)url
149 | options:(NSDictionary *)options
150 | {
151 | return [ShareMenuManager application:app openURL:url options:options];
152 | }
153 | @end
154 | ```
155 |
--------------------------------------------------------------------------------
/example/ios/Test/LaunchScreen.storyboard:
--------------------------------------------------------------------------------
1 |
2 |
3 |
4 |
5 |
6 |
7 |
8 |
9 |
10 |
11 |
12 |
13 |
14 |
15 |
16 |
17 |
18 |
19 |
25 |
31 |
37 |
38 |
39 |
40 |
41 |
42 |
43 |
44 |
45 |
46 |
47 |
48 |
49 |
50 |
51 |
52 |
53 |
54 |
55 |
56 |
57 |
58 |
59 |
--------------------------------------------------------------------------------
/example/android/gradlew:
--------------------------------------------------------------------------------
1 | #!/usr/bin/env sh
2 |
3 | #
4 | # Copyright 2015 the original author or 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 UN*X
22 | ##
23 | ##############################################################################
24 |
25 | # Attempt to set APP_HOME
26 | # Resolve links: $0 may be a link
27 | PRG="$0"
28 | # Need this for relative symlinks.
29 | while [ -h "$PRG" ] ; do
30 | ls=`ls -ld "$PRG"`
31 | link=`expr "$ls" : '.*-> \(.*\)$'`
32 | if expr "$link" : '/.*' > /dev/null; then
33 | PRG="$link"
34 | else
35 | PRG=`dirname "$PRG"`"/$link"
36 | fi
37 | done
38 | SAVED="`pwd`"
39 | cd "`dirname \"$PRG\"`/" >/dev/null
40 | APP_HOME="`pwd -P`"
41 | cd "$SAVED" >/dev/null
42 |
43 | APP_NAME="Gradle"
44 | APP_BASE_NAME=`basename "$0"`
45 |
46 | # Add default JVM options here. You can also use JAVA_OPTS and GRADLE_OPTS to pass JVM options to this script.
47 | DEFAULT_JVM_OPTS='"-Xmx64m" "-Xms64m"'
48 |
49 | # Use the maximum available, or set MAX_FD != -1 to use that value.
50 | MAX_FD="maximum"
51 |
52 | warn () {
53 | echo "$*"
54 | }
55 |
56 | die () {
57 | echo
58 | echo "$*"
59 | echo
60 | exit 1
61 | }
62 |
63 | # OS specific support (must be 'true' or 'false').
64 | cygwin=false
65 | msys=false
66 | darwin=false
67 | nonstop=false
68 | case "`uname`" in
69 | CYGWIN* )
70 | cygwin=true
71 | ;;
72 | Darwin* )
73 | darwin=true
74 | ;;
75 | MINGW* )
76 | msys=true
77 | ;;
78 | NONSTOP* )
79 | nonstop=true
80 | ;;
81 | esac
82 |
83 | CLASSPATH=$APP_HOME/gradle/wrapper/gradle-wrapper.jar
84 |
85 | # Determine the Java command to use to start the JVM.
86 | if [ -n "$JAVA_HOME" ] ; then
87 | if [ -x "$JAVA_HOME/jre/sh/java" ] ; then
88 | # IBM's JDK on AIX uses strange locations for the executables
89 | JAVACMD="$JAVA_HOME/jre/sh/java"
90 | else
91 | JAVACMD="$JAVA_HOME/bin/java"
92 | fi
93 | if [ ! -x "$JAVACMD" ] ; then
94 | die "ERROR: JAVA_HOME is set to an invalid directory: $JAVA_HOME
95 |
96 | Please set the JAVA_HOME variable in your environment to match the
97 | location of your Java installation."
98 | fi
99 | else
100 | JAVACMD="java"
101 | which java >/dev/null 2>&1 || die "ERROR: JAVA_HOME is not set and no 'java' command could be found in your PATH.
102 |
103 | Please set the JAVA_HOME variable in your environment to match the
104 | location of your Java installation."
105 | fi
106 |
107 | # Increase the maximum file descriptors if we can.
108 | if [ "$cygwin" = "false" -a "$darwin" = "false" -a "$nonstop" = "false" ] ; then
109 | MAX_FD_LIMIT=`ulimit -H -n`
110 | if [ $? -eq 0 ] ; then
111 | if [ "$MAX_FD" = "maximum" -o "$MAX_FD" = "max" ] ; then
112 | MAX_FD="$MAX_FD_LIMIT"
113 | fi
114 | ulimit -n $MAX_FD
115 | if [ $? -ne 0 ] ; then
116 | warn "Could not set maximum file descriptor limit: $MAX_FD"
117 | fi
118 | else
119 | warn "Could not query maximum file descriptor limit: $MAX_FD_LIMIT"
120 | fi
121 | fi
122 |
123 | # For Darwin, add options to specify how the application appears in the dock
124 | if $darwin; then
125 | GRADLE_OPTS="$GRADLE_OPTS \"-Xdock:name=$APP_NAME\" \"-Xdock:icon=$APP_HOME/media/gradle.icns\""
126 | fi
127 |
128 | # For Cygwin or MSYS, switch paths to Windows format before running java
129 | if [ "$cygwin" = "true" -o "$msys" = "true" ] ; then
130 | APP_HOME=`cygpath --path --mixed "$APP_HOME"`
131 | CLASSPATH=`cygpath --path --mixed "$CLASSPATH"`
132 | JAVACMD=`cygpath --unix "$JAVACMD"`
133 |
134 | # We build the pattern for arguments to be converted via cygpath
135 | ROOTDIRSRAW=`find -L / -maxdepth 1 -mindepth 1 -type d 2>/dev/null`
136 | SEP=""
137 | for dir in $ROOTDIRSRAW ; do
138 | ROOTDIRS="$ROOTDIRS$SEP$dir"
139 | SEP="|"
140 | done
141 | OURCYGPATTERN="(^($ROOTDIRS))"
142 | # Add a user-defined pattern to the cygpath arguments
143 | if [ "$GRADLE_CYGPATTERN" != "" ] ; then
144 | OURCYGPATTERN="$OURCYGPATTERN|($GRADLE_CYGPATTERN)"
145 | fi
146 | # Now convert the arguments - kludge to limit ourselves to /bin/sh
147 | i=0
148 | for arg in "$@" ; do
149 | CHECK=`echo "$arg"|egrep -c "$OURCYGPATTERN" -`
150 | CHECK2=`echo "$arg"|egrep -c "^-"` ### Determine if an option
151 |
152 | if [ $CHECK -ne 0 ] && [ $CHECK2 -eq 0 ] ; then ### Added a condition
153 | eval `echo args$i`=`cygpath --path --ignore --mixed "$arg"`
154 | else
155 | eval `echo args$i`="\"$arg\""
156 | fi
157 | i=`expr $i + 1`
158 | done
159 | case $i in
160 | 0) set -- ;;
161 | 1) set -- "$args0" ;;
162 | 2) set -- "$args0" "$args1" ;;
163 | 3) set -- "$args0" "$args1" "$args2" ;;
164 | 4) set -- "$args0" "$args1" "$args2" "$args3" ;;
165 | 5) set -- "$args0" "$args1" "$args2" "$args3" "$args4" ;;
166 | 6) set -- "$args0" "$args1" "$args2" "$args3" "$args4" "$args5" ;;
167 | 7) set -- "$args0" "$args1" "$args2" "$args3" "$args4" "$args5" "$args6" ;;
168 | 8) set -- "$args0" "$args1" "$args2" "$args3" "$args4" "$args5" "$args6" "$args7" ;;
169 | 9) set -- "$args0" "$args1" "$args2" "$args3" "$args4" "$args5" "$args6" "$args7" "$args8" ;;
170 | esac
171 | fi
172 |
173 | # Escape application args
174 | save () {
175 | for i do printf %s\\n "$i" | sed "s/'/'\\\\''/g;1s/^/'/;\$s/\$/' \\\\/" ; done
176 | echo " "
177 | }
178 | APP_ARGS=`save "$@"`
179 |
180 | # Collect all arguments for the java command, following the shell quoting and substitution rules
181 | eval set -- $DEFAULT_JVM_OPTS $JAVA_OPTS $GRADLE_OPTS "\"-Dorg.gradle.appname=$APP_BASE_NAME\"" -classpath "\"$CLASSPATH\"" org.gradle.wrapper.GradleWrapperMain "$APP_ARGS"
182 |
183 | exec "$JAVACMD" "$@"
184 |
--------------------------------------------------------------------------------
/ios/Modules/ShareMenuReactView.swift:
--------------------------------------------------------------------------------
1 | //
2 | // ShareMenuReactView.swift
3 | // RNShareMenu
4 | //
5 | // Created by Gustavo Parreira on 28/07/2020.
6 | //
7 |
8 | import MobileCoreServices
9 |
10 | @objc(ShareMenuReactView)
11 | public class ShareMenuReactView: NSObject {
12 | static var viewDelegate: ReactShareViewDelegate?
13 |
14 | @objc
15 | static public func requiresMainQueueSetup() -> Bool {
16 | return false
17 | }
18 |
19 | public static func attachViewDelegate(_ delegate: ReactShareViewDelegate!) {
20 | guard (ShareMenuReactView.viewDelegate == nil) else { return }
21 |
22 | ShareMenuReactView.viewDelegate = delegate
23 | }
24 |
25 | public static func detachViewDelegate() {
26 | ShareMenuReactView.viewDelegate = nil
27 | }
28 |
29 | @objc(dismissExtension:)
30 | func dismissExtension(_ error: String?) {
31 | guard let extensionContext = ShareMenuReactView.viewDelegate?.loadExtensionContext() else {
32 | print("Error: \(NO_EXTENSION_CONTEXT_ERROR)")
33 | return
34 | }
35 |
36 | if error != nil {
37 | let exception = NSError(
38 | domain: Bundle.main.bundleIdentifier!,
39 | code: DISMISS_SHARE_EXTENSION_WITH_ERROR_CODE,
40 | userInfo: ["error": error!]
41 | )
42 | extensionContext.cancelRequest(withError: exception)
43 | return
44 | }
45 |
46 | extensionContext.completeRequest(returningItems: [], completionHandler: nil)
47 | }
48 |
49 | @objc
50 | func openApp() {
51 | guard let viewDelegate = ShareMenuReactView.viewDelegate else {
52 | print("Error: \(NO_DELEGATE_ERROR)")
53 | return
54 | }
55 |
56 | viewDelegate.openApp()
57 | }
58 |
59 | @objc(continueInApp:)
60 | func continueInApp(_ extraData: [String:Any]?) {
61 | guard let viewDelegate = ShareMenuReactView.viewDelegate else {
62 | print("Error: \(NO_DELEGATE_ERROR)")
63 | return
64 | }
65 |
66 | let extensionContext = viewDelegate.loadExtensionContext()
67 |
68 | guard let item = extensionContext.inputItems.first as? NSExtensionItem else {
69 | print("Error: \(COULD_NOT_FIND_ITEM_ERROR)")
70 | return
71 | }
72 |
73 | viewDelegate.continueInApp(with: item, and: extraData)
74 | }
75 |
76 | @objc(data:reject:)
77 | func data(_
78 | resolve: @escaping RCTPromiseResolveBlock,
79 | reject: @escaping RCTPromiseRejectBlock) {
80 | guard let extensionContext = ShareMenuReactView.viewDelegate?.loadExtensionContext() else {
81 | print("Error: \(NO_EXTENSION_CONTEXT_ERROR)")
82 | return
83 | }
84 |
85 | extractDataFromContext(context: extensionContext) { (items, error) in
86 | guard (error == nil) else {
87 | reject("error", error?.description, nil)
88 | return
89 | }
90 | resolve(items)
91 | }
92 | }
93 |
94 | func saveAndOpen(url:URL) -> String? {
95 | guard let hostAppId = Bundle.main.object(forInfoDictionaryKey: HOST_APP_IDENTIFIER_INFO_PLIST_KEY) as? String else {
96 | return url.absoluteString
97 | }
98 | guard let groupFileManagerContainer = FileManager.default
99 | .containerURL(forSecurityApplicationGroupIdentifier: "group.\(hostAppId)")
100 | else {
101 | return url.absoluteString
102 | }
103 | if let tmp = NSData(contentsOf: url) {
104 | let fileName = url.pathComponents.last ?? UUID().uuidString
105 | let filePath = groupFileManagerContainer
106 | .appendingPathComponent("\(fileName)")
107 | do {
108 | try tmp.write(to: filePath)
109 | return filePath.absoluteString
110 | }
111 | catch (let error) {
112 | print("Could not save image to \(filePath): \(error)")
113 | }
114 | }
115 | return url.absoluteString
116 | }
117 |
118 | func extractDataFromContext(context: NSExtensionContext, withCallback callback: @escaping ([[String: String]], NSException?) -> Void) {
119 | let item:NSExtensionItem! = context.inputItems.first as? NSExtensionItem
120 | let attachments:[AnyObject]! = item.attachments
121 | var readCount = 0
122 | var type:String = ""
123 | var items = [[String: String]]()
124 | for provider in attachments {
125 | if provider.hasItemConformingToTypeIdentifier(kUTTypeURL as String) {
126 | type = kUTTypeURL as String
127 | } else if provider.hasItemConformingToTypeIdentifier(kUTTypeText as String) {
128 | type = kUTTypeText as String
129 | } else if provider.hasItemConformingToTypeIdentifier(kUTTypeImage as String) {
130 | type = kUTTypeImage as String
131 | } else if provider.hasItemConformingToTypeIdentifier(kUTTypeData as String) {
132 | type = kUTTypeData as String
133 | } else if provider.hasItemConformingToTypeIdentifier(kUTTypeVideo as String) {
134 | type = kUTTypeVideo as String
135 | }
136 | provider.loadItem(forTypeIdentifier: type , options: nil) { (item, error) in
137 | readCount = readCount + 1
138 | var mimeType:String? = nil
139 | var content:String? = nil
140 | if error != nil {
141 | if readCount == attachments.count {
142 | callback(items,nil)
143 | }
144 | return
145 | }
146 | if let url = item as? URL {
147 | content = url.absoluteString
148 | mimeType = self.extractMimeType(from: url)
149 | if url.isFileURL {
150 | content = self.saveAndOpen(url:url)
151 | }
152 | } else if let text = item as? String {
153 | content = text
154 | mimeType = "text/plain"
155 | } else if let image = item as? UIImage {
156 | let imageData = image.pngData()
157 | let fileExtension = "png"
158 | let fileName = UUID().uuidString
159 | if let hostAppId = Bundle.main.object(forInfoDictionaryKey: HOST_APP_IDENTIFIER_INFO_PLIST_KEY) as? String {
160 | if let groupFileManagerContainer = FileManager.default
161 | .containerURL(forSecurityApplicationGroupIdentifier: "group.\(hostAppId)") {
162 | let filePath = groupFileManagerContainer
163 | .appendingPathComponent("\(fileName).\(fileExtension)")
164 | do {
165 | try imageData?.write(to: filePath)
166 | content = filePath.absoluteString
167 | mimeType = "image/png"
168 | }
169 | catch (let error) {
170 | print("Could not save image to \(filePath): \(error)")
171 | }
172 | }
173 | }
174 | }
175 | if content != nil {
176 | items.append(["data":content!, "mimeType":mimeType!])
177 | }
178 | if readCount == attachments.count {
179 | callback(items,nil)
180 | }
181 | }
182 | }
183 | }
184 |
185 | func extractMimeType(from url: URL) -> String {
186 | let fileExtension: CFString = url.pathExtension as CFString
187 | guard let extUTI = UTTypeCreatePreferredIdentifierForTag(
188 | kUTTagClassFilenameExtension,
189 | fileExtension,
190 | nil
191 | )?.takeUnretainedValue() else { return "" }
192 |
193 | guard let mimeUTI = UTTypeCopyPreferredTagWithClass(extUTI, kUTTagClassMIMEType)
194 | else { return "" }
195 |
196 | return mimeUTI.takeUnretainedValue() as String
197 | }
198 | }
199 |
--------------------------------------------------------------------------------
/example/android/app/build.gradle:
--------------------------------------------------------------------------------
1 | apply plugin: "com.android.application"
2 |
3 | import com.android.build.OutputFile
4 |
5 | /**
6 | * The react.gradle file registers a task for each build variant (e.g. bundleDebugJsAndAssets
7 | * and bundleReleaseJsAndAssets).
8 | * These basically call `react-native bundle` with the correct arguments during the Android build
9 | * cycle. By default, bundleDebugJsAndAssets is skipped, as in debug/dev mode we prefer to load the
10 | * bundle directly from the development server. Below you can see all the possible configurations
11 | * and their defaults. If you decide to add a configuration block, make sure to add it before the
12 | * `apply from: "../../node_modules/react-native/react.gradle"` line.
13 | *
14 | * project.ext.react = [
15 | * // the name of the generated asset file containing your JS bundle
16 | * bundleAssetName: "index.android.bundle",
17 | *
18 | * // the entry file for bundle generation. If none specified and
19 | * // "index.android.js" exists, it will be used. Otherwise "index.js" is
20 | * // default. Can be overridden with ENTRY_FILE environment variable.
21 | * entryFile: "index.android.js",
22 | *
23 | * // https://reactnative.dev/docs/performance#enable-the-ram-format
24 | * bundleCommand: "ram-bundle",
25 | *
26 | * // whether to bundle JS and assets in debug mode
27 | * bundleInDebug: false,
28 | *
29 | * // whether to bundle JS and assets in release mode
30 | * bundleInRelease: true,
31 | *
32 | * // whether to bundle JS and assets in another build variant (if configured).
33 | * // See http://tools.android.com/tech-docs/new-build-system/user-guide#TOC-Build-Variants
34 | * // The configuration property can be in the following formats
35 | * // 'bundleIn${productFlavor}${buildType}'
36 | * // 'bundleIn${buildType}'
37 | * // bundleInFreeDebug: true,
38 | * // bundleInPaidRelease: true,
39 | * // bundleInBeta: true,
40 | *
41 | * // whether to disable dev mode in custom build variants (by default only disabled in release)
42 | * // for example: to disable dev mode in the staging build type (if configured)
43 | * devDisabledInStaging: true,
44 | * // The configuration property can be in the following formats
45 | * // 'devDisabledIn${productFlavor}${buildType}'
46 | * // 'devDisabledIn${buildType}'
47 | *
48 | * // the root of your project, i.e. where "package.json" lives
49 | * root: "../../",
50 | *
51 | * // where to put the JS bundle asset in debug mode
52 | * jsBundleDirDebug: "$buildDir/intermediates/assets/debug",
53 | *
54 | * // where to put the JS bundle asset in release mode
55 | * jsBundleDirRelease: "$buildDir/intermediates/assets/release",
56 | *
57 | * // where to put drawable resources / React Native assets, e.g. the ones you use via
58 | * // require('./image.png')), in debug mode
59 | * resourcesDirDebug: "$buildDir/intermediates/res/merged/debug",
60 | *
61 | * // where to put drawable resources / React Native assets, e.g. the ones you use via
62 | * // require('./image.png')), in release mode
63 | * resourcesDirRelease: "$buildDir/intermediates/res/merged/release",
64 | *
65 | * // by default the gradle tasks are skipped if none of the JS files or assets change; this means
66 | * // that we don't look at files in android/ or ios/ to determine whether the tasks are up to
67 | * // date; if you have any other folders that you want to ignore for performance reasons (gradle
68 | * // indexes the entire tree), add them here. Alternatively, if you have JS files in android/
69 | * // for example, you might want to remove it from here.
70 | * inputExcludes: ["android/**", "ios/**"],
71 | *
72 | * // override which node gets called and with what additional arguments
73 | * nodeExecutableAndArgs: ["node"],
74 | *
75 | * // supply additional arguments to the packager
76 | * extraPackagerArgs: []
77 | * ]
78 | */
79 |
80 | project.ext.react = [
81 | enableHermes: false, // clean and rebuild if changing
82 | ]
83 |
84 | apply from: "../../node_modules/react-native/react.gradle"
85 |
86 | /**
87 | * Set this to true to create two separate APKs instead of one:
88 | * - An APK that only works on ARM devices
89 | * - An APK that only works on x86 devices
90 | * The advantage is the size of the APK is reduced by about 4MB.
91 | * Upload all the APKs to the Play Store and people will download
92 | * the correct one based on the CPU architecture of their device.
93 | */
94 | def enableSeparateBuildPerCPUArchitecture = false
95 |
96 | /**
97 | * Run Proguard to shrink the Java bytecode in release builds.
98 | */
99 | def enableProguardInReleaseBuilds = false
100 |
101 | /**
102 | * The preferred build flavor of JavaScriptCore.
103 | *
104 | * For example, to use the international variant, you can use:
105 | * `def jscFlavor = 'org.webkit:android-jsc-intl:+'`
106 | *
107 | * The international variant includes ICU i18n library and necessary data
108 | * allowing to use e.g. `Date.toLocaleString` and `String.localeCompare` that
109 | * give correct results when using with locales other than en-US. Note that
110 | * this variant is about 6MiB larger per architecture than default.
111 | */
112 | def jscFlavor = 'org.webkit:android-jsc:+'
113 |
114 | /**
115 | * Whether to enable the Hermes VM.
116 | *
117 | * This should be set on project.ext.react and mirrored here. If it is not set
118 | * on project.ext.react, JavaScript will not be compiled to Hermes Bytecode
119 | * and the benefits of using Hermes will therefore be sharply reduced.
120 | */
121 | def enableHermes = project.ext.react.get("enableHermes", false);
122 |
123 | android {
124 | compileSdkVersion rootProject.ext.compileSdkVersion
125 |
126 | compileOptions {
127 | sourceCompatibility JavaVersion.VERSION_1_8
128 | targetCompatibility JavaVersion.VERSION_1_8
129 | }
130 |
131 | defaultConfig {
132 | applicationId "com.github.meedaan"
133 | minSdkVersion rootProject.ext.minSdkVersion
134 | targetSdkVersion rootProject.ext.targetSdkVersion
135 | versionCode 1
136 | versionName "1.0"
137 | }
138 | splits {
139 | abi {
140 | reset()
141 | enable enableSeparateBuildPerCPUArchitecture
142 | universalApk false // If true, also generate a universal APK
143 | include "armeabi-v7a", "x86", "arm64-v8a", "x86_64"
144 | }
145 | }
146 | signingConfigs {
147 | debug {
148 | storeFile file('debug.keystore')
149 | storePassword 'android'
150 | keyAlias 'androiddebugkey'
151 | keyPassword 'android'
152 | }
153 | }
154 | buildTypes {
155 | debug {
156 | signingConfig signingConfigs.debug
157 | }
158 | release {
159 | // Caution! In production, you need to generate your own keystore file.
160 | // see https://reactnative.dev/docs/signed-apk-android.
161 | signingConfig signingConfigs.debug
162 | minifyEnabled enableProguardInReleaseBuilds
163 | proguardFiles getDefaultProguardFile("proguard-android.txt"), "proguard-rules.pro"
164 | }
165 | }
166 |
167 | // applicationVariants are e.g. debug, release
168 | applicationVariants.all { variant ->
169 | variant.outputs.each { output ->
170 | // For each separate APK per architecture, set a unique version code as described here:
171 | // https://developer.android.com/studio/build/configure-apk-splits.html
172 | def versionCodes = ["armeabi-v7a": 1, "x86": 2, "arm64-v8a": 3, "x86_64": 4]
173 | def abi = output.getFilter(OutputFile.ABI)
174 | if (abi != null) { // null for the universal-debug, universal-release variants
175 | output.versionCodeOverride =
176 | versionCodes.get(abi) * 1048576 + defaultConfig.versionCode
177 | }
178 |
179 | }
180 | }
181 | }
182 |
183 | dependencies {
184 | implementation fileTree(dir: "libs", include: ["*.jar"])
185 | //noinspection GradleDynamicVersion
186 | implementation "com.facebook.react:react-native:+" // From node_modules
187 |
188 | implementation "androidx.swiperefreshlayout:swiperefreshlayout:1.0.0"
189 |
190 | debugImplementation("com.facebook.flipper:flipper:${FLIPPER_VERSION}") {
191 | exclude group:'com.facebook.fbjni'
192 | }
193 |
194 | debugImplementation("com.facebook.flipper:flipper-network-plugin:${FLIPPER_VERSION}") {
195 | exclude group:'com.facebook.flipper'
196 | exclude group:'com.squareup.okhttp3', module:'okhttp'
197 | }
198 |
199 | debugImplementation("com.facebook.flipper:flipper-fresco-plugin:${FLIPPER_VERSION}") {
200 | exclude group:'com.facebook.flipper'
201 | }
202 |
203 | if (enableHermes) {
204 | def hermesPath = "../../node_modules/hermes-engine/android/";
205 | debugImplementation files(hermesPath + "hermes-debug.aar")
206 | releaseImplementation files(hermesPath + "hermes-release.aar")
207 | } else {
208 | implementation jscFlavor
209 | }
210 | }
211 |
212 | // Run this once to be able to run the application with BUCK
213 | // puts all compile dependencies into folder libs for BUCK to use
214 | task copyDownloadableDepsToLibs(type: Copy) {
215 | from configurations.compile
216 | into 'libs'
217 | }
218 |
219 | apply from: file("../../node_modules/@react-native-community/cli-platform-android/native_modules.gradle"); applyNativeModulesAppBuildGradle(project)
220 |
--------------------------------------------------------------------------------
/ios/ShareMenu.xcodeproj/project.pbxproj:
--------------------------------------------------------------------------------
1 | // !$*UTF8*$!
2 | {
3 | archiveVersion = 1;
4 | classes = {
5 | };
6 | objectVersion = 46;
7 | objects = {
8 |
9 | /* Begin PBXBuildFile section */
10 |
11 |
12 | F4FF95D7245B92E800C19C63 /* ShareMenu.swift in Sources */ = {isa = PBXBuildFile; fileRef = F4FF95D6245B92E800C19C63 /* ShareMenu.swift */; };
13 |
14 | 5E555C0D2413F4C50049A1A2 /* ShareMenu.mm in Sources */ = {isa = PBXBuildFile; fileRef = B3E7B5891CC2AC0600A0062D /* ShareMenu.mm */; };
15 | /* End PBXBuildFile section */
16 |
17 | /* Begin PBXCopyFilesBuildPhase section */
18 | 58B511D91A9E6C8500147676 /* CopyFiles */ = {
19 | isa = PBXCopyFilesBuildPhase;
20 | buildActionMask = 2147483647;
21 | dstPath = "include/$(PRODUCT_NAME)";
22 | dstSubfolderSpec = 16;
23 | files = (
24 | );
25 | runOnlyForDeploymentPostprocessing = 0;
26 | };
27 | /* End PBXCopyFilesBuildPhase section */
28 |
29 | /* Begin PBXFileReference section */
30 | 134814201AA4EA6300B7C361 /* libShareMenu.a */ = {isa = PBXFileReference; explicitFileType = archive.ar; includeInIndex = 0; path = libShareMenu.a; sourceTree = BUILT_PRODUCTS_DIR; };
31 |
32 |
33 | B3E7B5891CC2AC0600A0062D /* ShareMenu.m */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = sourcecode.c.objc; path = ShareMenu.m; sourceTree = ""; };
34 | F4FF95D5245B92E700C19C63 /* ShareMenu-Bridging-Header.h */ = {isa = PBXFileReference; lastKnownFileType = sourcecode.c.h; path = "ShareMenu-Bridging-Header.h"; sourceTree = ""; };
35 | F4FF95D6245B92E800C19C63 /* ShareMenu.swift */ = {isa = PBXFileReference; lastKnownFileType = sourcecode.swift; path = ShareMenu.swift; sourceTree = ""; };
36 |
37 | /* End PBXFileReference section */
38 |
39 | /* Begin PBXFrameworksBuildPhase section */
40 | 58B511D81A9E6C8500147676 /* Frameworks */ = {
41 | isa = PBXFrameworksBuildPhase;
42 | buildActionMask = 2147483647;
43 | files = (
44 | );
45 | runOnlyForDeploymentPostprocessing = 0;
46 | };
47 | /* End PBXFrameworksBuildPhase section */
48 |
49 | /* Begin PBXGroup section */
50 | 134814211AA4EA7D00B7C361 /* Products */ = {
51 | isa = PBXGroup;
52 | children = (
53 | 134814201AA4EA6300B7C361 /* libShareMenu.a */,
54 | );
55 | name = Products;
56 | sourceTree = "";
57 | };
58 | 58B511D21A9E6C8500147676 = {
59 | isa = PBXGroup;
60 | children = (
61 |
62 |
63 | F4FF95D6245B92E800C19C63 /* ShareMenu.swift */,
64 | B3E7B5891CC2AC0600A0062D /* ShareMenu.m */,
65 | F4FF95D5245B92E700C19C63 /* ShareMenu-Bridging-Header.h */,
66 |
67 | 134814211AA4EA7D00B7C361 /* Products */,
68 | );
69 | sourceTree = "";
70 | };
71 | /* End PBXGroup section */
72 |
73 | /* Begin PBXNativeTarget section */
74 | 58B511DA1A9E6C8500147676 /* ShareMenu */ = {
75 | isa = PBXNativeTarget;
76 | buildConfigurationList = 58B511EF1A9E6C8500147676 /* Build configuration list for PBXNativeTarget "ShareMenu" */;
77 | buildPhases = (
78 | 58B511D71A9E6C8500147676 /* Sources */,
79 | 58B511D81A9E6C8500147676 /* Frameworks */,
80 | 58B511D91A9E6C8500147676 /* CopyFiles */,
81 | );
82 | buildRules = (
83 | );
84 | dependencies = (
85 | );
86 | name = ShareMenu;
87 | productName = RCTDataManager;
88 | productReference = 134814201AA4EA6300B7C361 /* libShareMenu.a */;
89 | productType = "com.apple.product-type.library.static";
90 | };
91 | /* End PBXNativeTarget section */
92 |
93 | /* Begin PBXProject section */
94 | 58B511D31A9E6C8500147676 /* Project object */ = {
95 | isa = PBXProject;
96 | attributes = {
97 | LastUpgradeCheck = 0920;
98 | ORGANIZATIONNAME = Facebook;
99 | TargetAttributes = {
100 | 58B511DA1A9E6C8500147676 = {
101 | CreatedOnToolsVersion = 6.1.1;
102 | };
103 | };
104 | };
105 | buildConfigurationList = 58B511D61A9E6C8500147676 /* Build configuration list for PBXProject "ShareMenu" */;
106 | compatibilityVersion = "Xcode 3.2";
107 | developmentRegion = English;
108 | hasScannedForEncodings = 0;
109 | knownRegions = (
110 | English,
111 | en,
112 | );
113 | mainGroup = 58B511D21A9E6C8500147676;
114 | productRefGroup = 58B511D21A9E6C8500147676;
115 | projectDirPath = "";
116 | projectRoot = "";
117 | targets = (
118 | 58B511DA1A9E6C8500147676 /* ShareMenu */,
119 | );
120 | };
121 | /* End PBXProject section */
122 |
123 | /* Begin PBXSourcesBuildPhase section */
124 | 58B511D71A9E6C8500147676 /* Sources */ = {
125 | isa = PBXSourcesBuildPhase;
126 | buildActionMask = 2147483647;
127 | files = (
128 |
129 |
130 | F4FF95D7245B92E800C19C63 /* ShareMenu.swift in Sources */,
131 | B3E7B58A1CC2AC0600A0062D /* ShareMenu.m in Sources */,
132 |
133 | );
134 | runOnlyForDeploymentPostprocessing = 0;
135 | };
136 | /* End PBXSourcesBuildPhase section */
137 |
138 | /* Begin XCBuildConfiguration section */
139 | 58B511ED1A9E6C8500147676 /* Debug */ = {
140 | isa = XCBuildConfiguration;
141 | buildSettings = {
142 | ALWAYS_SEARCH_USER_PATHS = NO;
143 | CLANG_CXX_LANGUAGE_STANDARD = "gnu++0x";
144 | CLANG_CXX_LIBRARY = "libc++";
145 | CLANG_ENABLE_MODULES = YES;
146 | CLANG_ENABLE_OBJC_ARC = YES;
147 | CLANG_WARN_BLOCK_CAPTURE_AUTORELEASING = YES;
148 | CLANG_WARN_BOOL_CONVERSION = YES;
149 | CLANG_WARN_COMMA = YES;
150 | CLANG_WARN_CONSTANT_CONVERSION = YES;
151 | CLANG_WARN_DIRECT_OBJC_ISA_USAGE = YES_ERROR;
152 | CLANG_WARN_EMPTY_BODY = YES;
153 | CLANG_WARN_ENUM_CONVERSION = YES;
154 | CLANG_WARN_INFINITE_RECURSION = YES;
155 | CLANG_WARN_INT_CONVERSION = YES;
156 | CLANG_WARN_NON_LITERAL_NULL_CONVERSION = YES;
157 | CLANG_WARN_OBJC_LITERAL_CONVERSION = YES;
158 | CLANG_WARN_OBJC_ROOT_CLASS = YES_ERROR;
159 | CLANG_WARN_RANGE_LOOP_ANALYSIS = YES;
160 | CLANG_WARN_STRICT_PROTOTYPES = YES;
161 | CLANG_WARN_SUSPICIOUS_MOVE = YES;
162 | CLANG_WARN_UNREACHABLE_CODE = YES;
163 | CLANG_WARN__DUPLICATE_METHOD_MATCH = YES;
164 | COPY_PHASE_STRIP = NO;
165 | ENABLE_STRICT_OBJC_MSGSEND = YES;
166 | ENABLE_TESTABILITY = YES;
167 | GCC_C_LANGUAGE_STANDARD = gnu99;
168 | GCC_DYNAMIC_NO_PIC = NO;
169 | GCC_NO_COMMON_BLOCKS = YES;
170 | GCC_OPTIMIZATION_LEVEL = 0;
171 | GCC_PREPROCESSOR_DEFINITIONS = (
172 | "DEBUG=1",
173 | "$(inherited)",
174 | );
175 | GCC_SYMBOLS_PRIVATE_EXTERN = NO;
176 | GCC_WARN_64_TO_32_BIT_CONVERSION = YES;
177 | GCC_WARN_ABOUT_RETURN_TYPE = YES_ERROR;
178 | GCC_WARN_UNDECLARED_SELECTOR = YES;
179 | GCC_WARN_UNINITIALIZED_AUTOS = YES_AGGRESSIVE;
180 | GCC_WARN_UNUSED_FUNCTION = YES;
181 | GCC_WARN_UNUSED_VARIABLE = YES;
182 | IPHONEOS_DEPLOYMENT_TARGET = 8.0;
183 | MTL_ENABLE_DEBUG_INFO = YES;
184 | ONLY_ACTIVE_ARCH = YES;
185 | SDKROOT = iphoneos;
186 | };
187 | name = Debug;
188 | };
189 | 58B511EE1A9E6C8500147676 /* Release */ = {
190 | isa = XCBuildConfiguration;
191 | buildSettings = {
192 | ALWAYS_SEARCH_USER_PATHS = NO;
193 | CLANG_CXX_LANGUAGE_STANDARD = "gnu++0x";
194 | CLANG_CXX_LIBRARY = "libc++";
195 | CLANG_ENABLE_MODULES = YES;
196 | CLANG_ENABLE_OBJC_ARC = YES;
197 | CLANG_WARN_BLOCK_CAPTURE_AUTORELEASING = YES;
198 | CLANG_WARN_BOOL_CONVERSION = YES;
199 | CLANG_WARN_COMMA = YES;
200 | CLANG_WARN_CONSTANT_CONVERSION = YES;
201 | CLANG_WARN_DIRECT_OBJC_ISA_USAGE = YES_ERROR;
202 | CLANG_WARN_EMPTY_BODY = YES;
203 | CLANG_WARN_ENUM_CONVERSION = YES;
204 | CLANG_WARN_INFINITE_RECURSION = YES;
205 | CLANG_WARN_INT_CONVERSION = YES;
206 | CLANG_WARN_NON_LITERAL_NULL_CONVERSION = YES;
207 | CLANG_WARN_OBJC_LITERAL_CONVERSION = YES;
208 | CLANG_WARN_OBJC_ROOT_CLASS = YES_ERROR;
209 | CLANG_WARN_RANGE_LOOP_ANALYSIS = YES;
210 | CLANG_WARN_STRICT_PROTOTYPES = YES;
211 | CLANG_WARN_SUSPICIOUS_MOVE = YES;
212 | CLANG_WARN_UNREACHABLE_CODE = YES;
213 | CLANG_WARN__DUPLICATE_METHOD_MATCH = YES;
214 | COPY_PHASE_STRIP = YES;
215 | ENABLE_NS_ASSERTIONS = NO;
216 | ENABLE_STRICT_OBJC_MSGSEND = YES;
217 | GCC_C_LANGUAGE_STANDARD = gnu99;
218 | GCC_NO_COMMON_BLOCKS = YES;
219 | GCC_WARN_64_TO_32_BIT_CONVERSION = YES;
220 | GCC_WARN_ABOUT_RETURN_TYPE = YES_ERROR;
221 | GCC_WARN_UNDECLARED_SELECTOR = YES;
222 | GCC_WARN_UNINITIALIZED_AUTOS = YES_AGGRESSIVE;
223 | GCC_WARN_UNUSED_FUNCTION = YES;
224 | GCC_WARN_UNUSED_VARIABLE = YES;
225 | IPHONEOS_DEPLOYMENT_TARGET = 8.0;
226 | MTL_ENABLE_DEBUG_INFO = NO;
227 | SDKROOT = iphoneos;
228 | VALIDATE_PRODUCT = YES;
229 | };
230 | name = Release;
231 | };
232 | 58B511F01A9E6C8500147676 /* Debug */ = {
233 | isa = XCBuildConfiguration;
234 | buildSettings = {
235 | HEADER_SEARCH_PATHS = (
236 | "$(inherited)",
237 | /Applications/Xcode.app/Contents/Developer/Toolchains/XcodeDefault.xctoolchain/usr/include,
238 | "$(SRCROOT)/../../../React/**",
239 | "$(SRCROOT)/../../react-native/React/**",
240 | );
241 | LIBRARY_SEARCH_PATHS = "$(inherited)";
242 | OTHER_LDFLAGS = "-ObjC";
243 | PRODUCT_NAME = ShareMenu;
244 | SKIP_INSTALL = YES;
245 |
246 | SWIFT_OBJC_BRIDGING_HEADER = "ShareMenu-Bridging-Header.h";
247 | SWIFT_OPTIMIZATION_LEVEL = "-Onone";
248 | SWIFT_VERSION = 5.0;
249 |
250 | };
251 | name = Debug;
252 | };
253 | 58B511F11A9E6C8500147676 /* Release */ = {
254 | isa = XCBuildConfiguration;
255 | buildSettings = {
256 | HEADER_SEARCH_PATHS = (
257 | "$(inherited)",
258 | /Applications/Xcode.app/Contents/Developer/Toolchains/XcodeDefault.xctoolchain/usr/include,
259 | "$(SRCROOT)/../../../React/**",
260 | "$(SRCROOT)/../../react-native/React/**",
261 | );
262 | LIBRARY_SEARCH_PATHS = "$(inherited)";
263 | OTHER_LDFLAGS = "-ObjC";
264 | PRODUCT_NAME = ShareMenu;
265 | SKIP_INSTALL = YES;
266 |
267 | SWIFT_OBJC_BRIDGING_HEADER = "ShareMenu-Bridging-Header.h";
268 | SWIFT_VERSION = 5.0;
269 |
270 | };
271 | name = Release;
272 | };
273 | /* End XCBuildConfiguration section */
274 |
275 | /* Begin XCConfigurationList section */
276 | 58B511D61A9E6C8500147676 /* Build configuration list for PBXProject "ShareMenu" */ = {
277 | isa = XCConfigurationList;
278 | buildConfigurations = (
279 | 58B511ED1A9E6C8500147676 /* Debug */,
280 | 58B511EE1A9E6C8500147676 /* Release */,
281 | );
282 | defaultConfigurationIsVisible = 0;
283 | defaultConfigurationName = Release;
284 | };
285 | 58B511EF1A9E6C8500147676 /* Build configuration list for PBXNativeTarget "ShareMenu" */ = {
286 | isa = XCConfigurationList;
287 | buildConfigurations = (
288 | 58B511F01A9E6C8500147676 /* Debug */,
289 | 58B511F11A9E6C8500147676 /* Release */,
290 | );
291 | defaultConfigurationIsVisible = 0;
292 | defaultConfigurationName = Release;
293 | };
294 | /* End XCConfigurationList section */
295 | };
296 | rootObject = 58B511D31A9E6C8500147676 /* Project object */;
297 | }
298 |
--------------------------------------------------------------------------------
/ios/ShareViewController.swift:
--------------------------------------------------------------------------------
1 | import MobileCoreServices
2 | import UIKit
3 | import Social
4 | import RNShareMenu
5 |
6 | extension Collection where Iterator.Element == [String:String] {
7 | func toJSONString(options: JSONSerialization.WritingOptions = .prettyPrinted) -> String {
8 | if let arr = self as? [[String:String]],
9 | let dat = try? JSONSerialization.data(withJSONObject: arr, options: options),
10 | let str = String(data: dat, encoding: String.Encoding.utf8) {
11 | return str
12 | }
13 | return "[]"
14 | }
15 | }
16 | class ShareViewController: SLComposeServiceViewController {
17 | var hostAppId: String?
18 | var hostAppUrlScheme: String?
19 | var shareDataStr:String?
20 | var items:[[String:String]]?
21 | var itemCount:Int = 0
22 | override func viewDidLoad() {
23 | super.viewDidLoad()
24 |
25 | if let hostAppId = Bundle.main.object(forInfoDictionaryKey: HOST_APP_IDENTIFIER_INFO_PLIST_KEY) as? String {
26 | self.hostAppId = hostAppId
27 | } else {
28 | print("Error: \(NO_INFO_PLIST_INDENTIFIER_ERROR)")
29 | }
30 |
31 | if let hostAppUrlScheme = Bundle.main.object(forInfoDictionaryKey: HOST_URL_SCHEME_INFO_PLIST_KEY) as? String {
32 | self.hostAppUrlScheme = hostAppUrlScheme
33 | } else {
34 | print("Error: \(NO_INFO_PLIST_URL_SCHEME_ERROR)")
35 | }
36 | }
37 |
38 | override func isContentValid() -> Bool {
39 | // Do validation of contentText and/or NSExtensionContext attachments here
40 | return true
41 | }
42 |
43 | override func configurationItems() -> [Any]! {
44 | // To add configuration options via table cells at the bottom of the sheet, return an array of SLComposeSheetConfigurationItem here.
45 | guard let item = extensionContext?.inputItems.first as? NSExtensionItem else {
46 | cancelRequest()
47 | return []
48 | }
49 | handlePost(item)
50 | return []
51 | }
52 |
53 | func handlePost(_ item: NSExtensionItem, extraData: [String:Any]? = nil) {
54 | guard (item.attachments?.first) != nil else {
55 | cancelRequest()
56 | return
57 | }
58 | self.items = [[String: String]]()
59 | self.itemCount = item.attachments?.count ?? 0
60 | if let data = extraData {
61 | storeExtraData(data)
62 | } else {
63 | removeExtraData()
64 | }
65 | let attachments:[NSItemProvider]! = item.attachments
66 | for provider in attachments {
67 | if provider.isText && provider.hasItemConformingToTypeIdentifier(kUTTypeText as String){
68 | storeText(withProvider: provider)
69 | } else if provider.isURL {
70 | storeUrl(withProvider: provider)
71 | } else {
72 | if provider.hasItemConformingToTypeIdentifier("public.image") {
73 | self.storeImage(withProvider: provider)
74 | } else if provider.hasItemConformingToTypeIdentifier("public.movie") {
75 | self.storeVideo(withProvider: provider)
76 | } else {
77 | storeFile(withProvider: provider)
78 | }
79 | }
80 | }
81 | }
82 |
83 | func storeExtraData(_ data: [String:Any]) {
84 | guard let hostAppId = self.hostAppId else {
85 | print("Error: \(NO_INFO_PLIST_INDENTIFIER_ERROR)")
86 | return
87 | }
88 | guard let userDefaults = UserDefaults(suiteName: "group.\(hostAppId)") else {
89 | print("Error: \(NO_APP_GROUP_ERROR)")
90 | return
91 | }
92 | userDefaults.set(data, forKey: USER_DEFAULTS_EXTRA_DATA_KEY)
93 | userDefaults.synchronize()
94 | }
95 |
96 | func removeExtraData() {
97 | guard let hostAppId = self.hostAppId else {
98 | print("Error: \(NO_INFO_PLIST_INDENTIFIER_ERROR)")
99 | return
100 | }
101 | guard let userDefaults = UserDefaults(suiteName: "group.\(hostAppId)") else {
102 | print("Error: \(NO_APP_GROUP_ERROR)")
103 | return
104 | }
105 | userDefaults.removeObject(forKey: USER_DEFAULTS_EXTRA_DATA_KEY)
106 | userDefaults.synchronize()
107 | }
108 |
109 | func storeText(withProvider provider: NSItemProvider) {
110 | provider.loadItem(forTypeIdentifier: kUTTypeText as String, options: nil) { (data, error) in
111 | self.itemCount = self.itemCount - 1
112 | guard (error == nil) else {
113 | self.exit(withError: error.debugDescription)
114 | return
115 | }
116 | if let text = data as? String {
117 | self.items!.append([DATA_KEY: text, MIME_TYPE_KEY: "text/plain"])
118 | } else if let text2 = data as? NSAttributedString {
119 | self.items!.append([DATA_KEY: text2.string, MIME_TYPE_KEY: "text/plain"])
120 | } else {
121 | self.exit(withError: error.debugDescription)
122 | return
123 | }
124 | self.openAppIfDone()
125 | }
126 | }
127 | func storeImage(withProvider provider:NSItemProvider) {
128 | provider.loadItem(forTypeIdentifier: kUTTypeImage as String, options: nil) { (data, error) in
129 | self.itemCount = self.itemCount - 1
130 | guard (error == nil) else {
131 | self.exit(withError: error.debugDescription)
132 | return
133 | }
134 | if let url = data as? URL {
135 | if !url.isFileURL {
136 | self.items!.append([DATA_KEY: url.absoluteString, MIME_TYPE_KEY: url.extractMimeType()])
137 | self.openAppIfDone()
138 | } else {
139 | self.saveAndOpen(url:url)
140 | }
141 | return
142 | }
143 | guard let image = data as? UIImage else {
144 | self.exit(withError: COULD_NOT_FIND_URL_ERROR)
145 | return
146 | }
147 | guard let hostAppId = self.hostAppId else {
148 | self.exit(withError: NO_INFO_PLIST_INDENTIFIER_ERROR)
149 | return
150 | }
151 | guard let groupFileManagerContainer = FileManager.default
152 | .containerURL(forSecurityApplicationGroupIdentifier: "group.\(hostAppId)") else {
153 | self.openAppIfDone()
154 | return
155 | }
156 | let imageData = image.pngData()
157 | let fileExtension = "png"
158 | let fileName = UUID().uuidString
159 | let filePath = groupFileManagerContainer
160 | .appendingPathComponent("\(fileName).\(fileExtension)")
161 | do {
162 | try imageData?.write(to: filePath)
163 | }
164 | catch (let error) {
165 | print("Could not save image to \(filePath): \(error)")
166 | self.openAppIfDone()
167 | return
168 | }
169 | self.items!.append([DATA_KEY: filePath.absoluteString, MIME_TYPE_KEY: "image/png"])
170 | self.openAppIfDone()
171 | }
172 | }
173 | func storeVideo(withProvider provider:NSItemProvider) {
174 | provider.loadItem(forTypeIdentifier: kUTTypeMovie as String, options: nil) { (data, error) in
175 | self.itemCount = self.itemCount - 1
176 | guard (error == nil) else {
177 | self.exit(withError: error.debugDescription)
178 | return
179 | }
180 | if let url = data as? URL {
181 | if url.isFileURL {
182 | self.saveAndOpen(url:url)
183 | } else {
184 | self.items!.append([DATA_KEY: url.absoluteString, MIME_TYPE_KEY: url.extractMimeType()])
185 | self.openAppIfDone()
186 | }
187 | }
188 | }
189 | }
190 | func storeUrl(withProvider provider: NSItemProvider) {
191 | provider.loadItem(forTypeIdentifier: kUTTypeURL as String, options: nil) { (data, error) in
192 | self.itemCount = self.itemCount - 1
193 | guard (error == nil) else {
194 | self.exit(withError: error.debugDescription)
195 | return
196 | }
197 | guard let url = data as? URL else {
198 | self.exit(withError: COULD_NOT_FIND_URL_ERROR)
199 | return
200 | }
201 | if url.isFileURL {
202 | self.saveAndOpen(url:url)
203 | } else {
204 | self.items!.append([DATA_KEY: url.absoluteString, MIME_TYPE_KEY: url.extractMimeType()])
205 | self.openAppIfDone()
206 | }
207 | }
208 | }
209 | func saveAndOpen(url:URL) {
210 | guard let hostAppId = self.hostAppId else {
211 | self.exit(withError: NO_INFO_PLIST_INDENTIFIER_ERROR)
212 | return
213 | }
214 | guard let groupFileManagerContainer = FileManager.default
215 | .containerURL(forSecurityApplicationGroupIdentifier: "group.\(hostAppId)")
216 | else {
217 | self.exit(withError: NO_APP_GROUP_ERROR)
218 | return
219 | }
220 | if let tmp = NSData(contentsOf: url) {
221 | let fileName = url.pathComponents.last ?? UUID().uuidString
222 | let filePath = groupFileManagerContainer
223 | .appendingPathComponent("\(fileName)")
224 | do {
225 | try tmp.write(to: filePath)
226 | self.items!.append([DATA_KEY: filePath.absoluteString, MIME_TYPE_KEY: url.extractMimeType()])
227 | self.openAppIfDone()
228 | }
229 | catch (let error) {
230 | print("Could not save image to \(filePath): \(error)")
231 | self.openAppIfDone()
232 | return
233 | }
234 | } else {
235 | self.items!.append([DATA_KEY: url.absoluteString, MIME_TYPE_KEY: url.extractMimeType()])
236 | self.openAppIfDone()
237 | return
238 | }
239 | }
240 |
241 | func storeFile(withProvider provider: NSItemProvider) {
242 | provider.loadItem(forTypeIdentifier: kUTTypeData as String, options: nil) { (data, error) in
243 | self.itemCount = self.itemCount - 1
244 | guard (error == nil) else {
245 | self.exit(withError: error.debugDescription)
246 | return
247 | }
248 | guard let url = data as? URL else {
249 | self.exit(withError: COULD_NOT_FIND_IMG_ERROR)
250 | return
251 | }
252 | guard let hostAppId = self.hostAppId else {
253 | self.exit(withError: NO_INFO_PLIST_INDENTIFIER_ERROR)
254 | return
255 | }
256 | guard let groupFileManagerContainer = FileManager.default
257 | .containerURL(forSecurityApplicationGroupIdentifier: "group.\(hostAppId)")
258 | else {
259 | self.exit(withError: NO_APP_GROUP_ERROR)
260 | return
261 | }
262 |
263 | let mimeType = url.extractMimeType()
264 | let fileExtension = url.pathExtension
265 | let fileName = UUID().uuidString
266 | let filePath = groupFileManagerContainer
267 | .appendingPathComponent("\(fileName).\(fileExtension)")
268 |
269 | guard self.moveFileToDisk(from: url, to: filePath) else {
270 | self.exit(withError: COULD_NOT_SAVE_FILE_ERROR)
271 | return
272 | }
273 | self.items!.append([DATA_KEY: filePath.absoluteString, MIME_TYPE_KEY: mimeType])
274 | self.openAppIfDone()
275 | }
276 | }
277 |
278 | func moveFileToDisk(from srcUrl: URL, to destUrl: URL) -> Bool {
279 | do {
280 | if FileManager.default.fileExists(atPath: destUrl.path) {
281 | try FileManager.default.removeItem(at: destUrl)
282 | }
283 | try FileManager.default.copyItem(at: srcUrl, to: destUrl)
284 | } catch (let error) {
285 | print("Could not save file from \(srcUrl) to \(destUrl): \(error)")
286 | return false
287 | }
288 |
289 | return true
290 | }
291 |
292 | func exit(withError error: String) {
293 | print("Error: \(error)")
294 | cancelRequest()
295 | }
296 | func openAppIfDone() {
297 | if itemCount <= 0 {
298 | guard let hostAppId = self.hostAppId else {
299 | self.exit(withError: NO_INFO_PLIST_INDENTIFIER_ERROR)
300 | return
301 | }
302 | guard let userDefaults = UserDefaults(suiteName: "group.\(hostAppId)") else {
303 | self.exit(withError: NO_APP_GROUP_ERROR)
304 | return
305 | }
306 | userDefaults.set(items,
307 | forKey: USER_DEFAULTS_KEY)
308 | userDefaults.synchronize()
309 | self.openHostApp()
310 | }
311 | }
312 | internal func openHostApp() {
313 | guard let urlScheme = self.hostAppUrlScheme else {
314 | exit(withError: NO_INFO_PLIST_URL_SCHEME_ERROR)
315 | return
316 | }
317 | let jsonString = items!.toJSONString().data(using: .utf8)!.base64EncodedString()
318 | let escapedString = "share?sharedData=\(jsonString)"
319 | let urlString = urlScheme + escapedString
320 | let url = URL(string: urlString)
321 | let selectorOpenURL = sel_registerName("openURL:")
322 | print("url =\(url!)")
323 | var responder: UIResponder? = self
324 | while responder != nil {
325 | if responder?.responds(to: selectorOpenURL) == true {
326 | responder?.perform(selectorOpenURL, with: url)
327 | }
328 | responder = responder!.next
329 | }
330 |
331 | completeRequest()
332 | }
333 |
334 | func completeRequest() {
335 | super.didSelectCancel()
336 | }
337 |
338 | func cancelRequest() {
339 | super.didSelectCancel()
340 | }
341 |
342 | }
343 |
--------------------------------------------------------------------------------
/example/ios/Podfile.lock:
--------------------------------------------------------------------------------
1 | PODS:
2 | - boost-for-react-native (1.63.0)
3 | - CocoaAsyncSocket (7.6.4)
4 | - CocoaLibEvent (1.0.0)
5 | - DoubleConversion (1.1.6)
6 | - FBLazyVector (0.63.2)
7 | - FBReactNativeSpec (0.63.2):
8 | - Folly (= 2020.01.13.00)
9 | - RCTRequired (= 0.63.2)
10 | - RCTTypeSafety (= 0.63.2)
11 | - React-Core (= 0.63.2)
12 | - React-jsi (= 0.63.2)
13 | - ReactCommon/turbomodule/core (= 0.63.2)
14 | - Flipper (0.41.5):
15 | - Flipper-Folly (~> 2.2)
16 | - Flipper-RSocket (~> 1.1)
17 | - Flipper-DoubleConversion (1.1.7)
18 | - Flipper-Folly (2.2.0):
19 | - boost-for-react-native
20 | - CocoaLibEvent (~> 1.0)
21 | - Flipper-DoubleConversion
22 | - Flipper-Glog
23 | - OpenSSL-Universal (= 1.0.2.19)
24 | - Flipper-Glog (0.3.6)
25 | - Flipper-PeerTalk (0.0.4)
26 | - Flipper-RSocket (1.1.0):
27 | - Flipper-Folly (~> 2.2)
28 | - FlipperKit (0.41.5):
29 | - FlipperKit/Core (= 0.41.5)
30 | - FlipperKit/Core (0.41.5):
31 | - Flipper (~> 0.41.5)
32 | - FlipperKit/CppBridge
33 | - FlipperKit/FBCxxFollyDynamicConvert
34 | - FlipperKit/FBDefines
35 | - FlipperKit/FKPortForwarding
36 | - FlipperKit/CppBridge (0.41.5):
37 | - Flipper (~> 0.41.5)
38 | - FlipperKit/FBCxxFollyDynamicConvert (0.41.5):
39 | - Flipper-Folly (~> 2.2)
40 | - FlipperKit/FBDefines (0.41.5)
41 | - FlipperKit/FKPortForwarding (0.41.5):
42 | - CocoaAsyncSocket (~> 7.6)
43 | - Flipper-PeerTalk (~> 0.0.4)
44 | - FlipperKit/FlipperKitHighlightOverlay (0.41.5)
45 | - FlipperKit/FlipperKitLayoutPlugin (0.41.5):
46 | - FlipperKit/Core
47 | - FlipperKit/FlipperKitHighlightOverlay
48 | - FlipperKit/FlipperKitLayoutTextSearchable
49 | - YogaKit (~> 1.18)
50 | - FlipperKit/FlipperKitLayoutTextSearchable (0.41.5)
51 | - FlipperKit/FlipperKitNetworkPlugin (0.41.5):
52 | - FlipperKit/Core
53 | - FlipperKit/FlipperKitReactPlugin (0.41.5):
54 | - FlipperKit/Core
55 | - FlipperKit/FlipperKitUserDefaultsPlugin (0.41.5):
56 | - FlipperKit/Core
57 | - FlipperKit/SKIOSNetworkPlugin (0.41.5):
58 | - FlipperKit/Core
59 | - FlipperKit/FlipperKitNetworkPlugin
60 | - Folly (2020.01.13.00):
61 | - boost-for-react-native
62 | - DoubleConversion
63 | - Folly/Default (= 2020.01.13.00)
64 | - glog
65 | - Folly/Default (2020.01.13.00):
66 | - boost-for-react-native
67 | - DoubleConversion
68 | - glog
69 | - glog (0.3.5)
70 | - OpenSSL-Universal (1.0.2.19):
71 | - OpenSSL-Universal/Static (= 1.0.2.19)
72 | - OpenSSL-Universal/Static (1.0.2.19)
73 | - RCTRequired (0.63.2)
74 | - RCTTypeSafety (0.63.2):
75 | - FBLazyVector (= 0.63.2)
76 | - Folly (= 2020.01.13.00)
77 | - RCTRequired (= 0.63.2)
78 | - React-Core (= 0.63.2)
79 | - React (0.63.2):
80 | - React-Core (= 0.63.2)
81 | - React-Core/DevSupport (= 0.63.2)
82 | - React-Core/RCTWebSocket (= 0.63.2)
83 | - React-RCTActionSheet (= 0.63.2)
84 | - React-RCTAnimation (= 0.63.2)
85 | - React-RCTBlob (= 0.63.2)
86 | - React-RCTImage (= 0.63.2)
87 | - React-RCTLinking (= 0.63.2)
88 | - React-RCTNetwork (= 0.63.2)
89 | - React-RCTSettings (= 0.63.2)
90 | - React-RCTText (= 0.63.2)
91 | - React-RCTVibration (= 0.63.2)
92 | - React-callinvoker (0.63.2)
93 | - React-Core (0.63.2):
94 | - Folly (= 2020.01.13.00)
95 | - glog
96 | - React-Core/Default (= 0.63.2)
97 | - React-cxxreact (= 0.63.2)
98 | - React-jsi (= 0.63.2)
99 | - React-jsiexecutor (= 0.63.2)
100 | - Yoga
101 | - React-Core/CoreModulesHeaders (0.63.2):
102 | - Folly (= 2020.01.13.00)
103 | - glog
104 | - React-Core/Default
105 | - React-cxxreact (= 0.63.2)
106 | - React-jsi (= 0.63.2)
107 | - React-jsiexecutor (= 0.63.2)
108 | - Yoga
109 | - React-Core/Default (0.63.2):
110 | - Folly (= 2020.01.13.00)
111 | - glog
112 | - React-cxxreact (= 0.63.2)
113 | - React-jsi (= 0.63.2)
114 | - React-jsiexecutor (= 0.63.2)
115 | - Yoga
116 | - React-Core/DevSupport (0.63.2):
117 | - Folly (= 2020.01.13.00)
118 | - glog
119 | - React-Core/Default (= 0.63.2)
120 | - React-Core/RCTWebSocket (= 0.63.2)
121 | - React-cxxreact (= 0.63.2)
122 | - React-jsi (= 0.63.2)
123 | - React-jsiexecutor (= 0.63.2)
124 | - React-jsinspector (= 0.63.2)
125 | - Yoga
126 | - React-Core/RCTActionSheetHeaders (0.63.2):
127 | - Folly (= 2020.01.13.00)
128 | - glog
129 | - React-Core/Default
130 | - React-cxxreact (= 0.63.2)
131 | - React-jsi (= 0.63.2)
132 | - React-jsiexecutor (= 0.63.2)
133 | - Yoga
134 | - React-Core/RCTAnimationHeaders (0.63.2):
135 | - Folly (= 2020.01.13.00)
136 | - glog
137 | - React-Core/Default
138 | - React-cxxreact (= 0.63.2)
139 | - React-jsi (= 0.63.2)
140 | - React-jsiexecutor (= 0.63.2)
141 | - Yoga
142 | - React-Core/RCTBlobHeaders (0.63.2):
143 | - Folly (= 2020.01.13.00)
144 | - glog
145 | - React-Core/Default
146 | - React-cxxreact (= 0.63.2)
147 | - React-jsi (= 0.63.2)
148 | - React-jsiexecutor (= 0.63.2)
149 | - Yoga
150 | - React-Core/RCTImageHeaders (0.63.2):
151 | - Folly (= 2020.01.13.00)
152 | - glog
153 | - React-Core/Default
154 | - React-cxxreact (= 0.63.2)
155 | - React-jsi (= 0.63.2)
156 | - React-jsiexecutor (= 0.63.2)
157 | - Yoga
158 | - React-Core/RCTLinkingHeaders (0.63.2):
159 | - Folly (= 2020.01.13.00)
160 | - glog
161 | - React-Core/Default
162 | - React-cxxreact (= 0.63.2)
163 | - React-jsi (= 0.63.2)
164 | - React-jsiexecutor (= 0.63.2)
165 | - Yoga
166 | - React-Core/RCTNetworkHeaders (0.63.2):
167 | - Folly (= 2020.01.13.00)
168 | - glog
169 | - React-Core/Default
170 | - React-cxxreact (= 0.63.2)
171 | - React-jsi (= 0.63.2)
172 | - React-jsiexecutor (= 0.63.2)
173 | - Yoga
174 | - React-Core/RCTSettingsHeaders (0.63.2):
175 | - Folly (= 2020.01.13.00)
176 | - glog
177 | - React-Core/Default
178 | - React-cxxreact (= 0.63.2)
179 | - React-jsi (= 0.63.2)
180 | - React-jsiexecutor (= 0.63.2)
181 | - Yoga
182 | - React-Core/RCTTextHeaders (0.63.2):
183 | - Folly (= 2020.01.13.00)
184 | - glog
185 | - React-Core/Default
186 | - React-cxxreact (= 0.63.2)
187 | - React-jsi (= 0.63.2)
188 | - React-jsiexecutor (= 0.63.2)
189 | - Yoga
190 | - React-Core/RCTVibrationHeaders (0.63.2):
191 | - Folly (= 2020.01.13.00)
192 | - glog
193 | - React-Core/Default
194 | - React-cxxreact (= 0.63.2)
195 | - React-jsi (= 0.63.2)
196 | - React-jsiexecutor (= 0.63.2)
197 | - Yoga
198 | - React-Core/RCTWebSocket (0.63.2):
199 | - Folly (= 2020.01.13.00)
200 | - glog
201 | - React-Core/Default (= 0.63.2)
202 | - React-cxxreact (= 0.63.2)
203 | - React-jsi (= 0.63.2)
204 | - React-jsiexecutor (= 0.63.2)
205 | - Yoga
206 | - React-CoreModules (0.63.2):
207 | - FBReactNativeSpec (= 0.63.2)
208 | - Folly (= 2020.01.13.00)
209 | - RCTTypeSafety (= 0.63.2)
210 | - React-Core/CoreModulesHeaders (= 0.63.2)
211 | - React-jsi (= 0.63.2)
212 | - React-RCTImage (= 0.63.2)
213 | - ReactCommon/turbomodule/core (= 0.63.2)
214 | - React-cxxreact (0.63.2):
215 | - boost-for-react-native (= 1.63.0)
216 | - DoubleConversion
217 | - Folly (= 2020.01.13.00)
218 | - glog
219 | - React-callinvoker (= 0.63.2)
220 | - React-jsinspector (= 0.63.2)
221 | - React-jsi (0.63.2):
222 | - boost-for-react-native (= 1.63.0)
223 | - DoubleConversion
224 | - Folly (= 2020.01.13.00)
225 | - glog
226 | - React-jsi/Default (= 0.63.2)
227 | - React-jsi/Default (0.63.2):
228 | - boost-for-react-native (= 1.63.0)
229 | - DoubleConversion
230 | - Folly (= 2020.01.13.00)
231 | - glog
232 | - React-jsiexecutor (0.63.2):
233 | - DoubleConversion
234 | - Folly (= 2020.01.13.00)
235 | - glog
236 | - React-cxxreact (= 0.63.2)
237 | - React-jsi (= 0.63.2)
238 | - React-jsinspector (0.63.2)
239 | - React-RCTActionSheet (0.63.2):
240 | - React-Core/RCTActionSheetHeaders (= 0.63.2)
241 | - React-RCTAnimation (0.63.2):
242 | - FBReactNativeSpec (= 0.63.2)
243 | - Folly (= 2020.01.13.00)
244 | - RCTTypeSafety (= 0.63.2)
245 | - React-Core/RCTAnimationHeaders (= 0.63.2)
246 | - React-jsi (= 0.63.2)
247 | - ReactCommon/turbomodule/core (= 0.63.2)
248 | - React-RCTBlob (0.63.2):
249 | - FBReactNativeSpec (= 0.63.2)
250 | - Folly (= 2020.01.13.00)
251 | - React-Core/RCTBlobHeaders (= 0.63.2)
252 | - React-Core/RCTWebSocket (= 0.63.2)
253 | - React-jsi (= 0.63.2)
254 | - React-RCTNetwork (= 0.63.2)
255 | - ReactCommon/turbomodule/core (= 0.63.2)
256 | - React-RCTImage (0.63.2):
257 | - FBReactNativeSpec (= 0.63.2)
258 | - Folly (= 2020.01.13.00)
259 | - RCTTypeSafety (= 0.63.2)
260 | - React-Core/RCTImageHeaders (= 0.63.2)
261 | - React-jsi (= 0.63.2)
262 | - React-RCTNetwork (= 0.63.2)
263 | - ReactCommon/turbomodule/core (= 0.63.2)
264 | - React-RCTLinking (0.63.2):
265 | - FBReactNativeSpec (= 0.63.2)
266 | - React-Core/RCTLinkingHeaders (= 0.63.2)
267 | - React-jsi (= 0.63.2)
268 | - ReactCommon/turbomodule/core (= 0.63.2)
269 | - React-RCTNetwork (0.63.2):
270 | - FBReactNativeSpec (= 0.63.2)
271 | - Folly (= 2020.01.13.00)
272 | - RCTTypeSafety (= 0.63.2)
273 | - React-Core/RCTNetworkHeaders (= 0.63.2)
274 | - React-jsi (= 0.63.2)
275 | - ReactCommon/turbomodule/core (= 0.63.2)
276 | - React-RCTSettings (0.63.2):
277 | - FBReactNativeSpec (= 0.63.2)
278 | - Folly (= 2020.01.13.00)
279 | - RCTTypeSafety (= 0.63.2)
280 | - React-Core/RCTSettingsHeaders (= 0.63.2)
281 | - React-jsi (= 0.63.2)
282 | - ReactCommon/turbomodule/core (= 0.63.2)
283 | - React-RCTText (0.63.2):
284 | - React-Core/RCTTextHeaders (= 0.63.2)
285 | - React-RCTVibration (0.63.2):
286 | - FBReactNativeSpec (= 0.63.2)
287 | - Folly (= 2020.01.13.00)
288 | - React-Core/RCTVibrationHeaders (= 0.63.2)
289 | - React-jsi (= 0.63.2)
290 | - ReactCommon/turbomodule/core (= 0.63.2)
291 | - ReactCommon/turbomodule/core (0.63.2):
292 | - DoubleConversion
293 | - Folly (= 2020.01.13.00)
294 | - glog
295 | - React-callinvoker (= 0.63.2)
296 | - React-Core (= 0.63.2)
297 | - React-cxxreact (= 0.63.2)
298 | - React-jsi (= 0.63.2)
299 | - RNShareMenu (4.1.4):
300 | - React
301 | - Yoga (1.14.0)
302 | - YogaKit (1.18.1):
303 | - Yoga (~> 1.14)
304 |
305 | DEPENDENCIES:
306 | - DoubleConversion (from `../node_modules/react-native/third-party-podspecs/DoubleConversion.podspec`)
307 | - FBLazyVector (from `../node_modules/react-native/Libraries/FBLazyVector`)
308 | - FBReactNativeSpec (from `../node_modules/react-native/Libraries/FBReactNativeSpec`)
309 | - Flipper (~> 0.41.1)
310 | - Flipper-DoubleConversion (= 1.1.7)
311 | - Flipper-Folly (~> 2.2)
312 | - Flipper-Glog (= 0.3.6)
313 | - Flipper-PeerTalk (~> 0.0.4)
314 | - Flipper-RSocket (~> 1.1)
315 | - FlipperKit (~> 0.41.1)
316 | - FlipperKit/Core (~> 0.41.1)
317 | - FlipperKit/CppBridge (~> 0.41.1)
318 | - FlipperKit/FBCxxFollyDynamicConvert (~> 0.41.1)
319 | - FlipperKit/FBDefines (~> 0.41.1)
320 | - FlipperKit/FKPortForwarding (~> 0.41.1)
321 | - FlipperKit/FlipperKitHighlightOverlay (~> 0.41.1)
322 | - FlipperKit/FlipperKitLayoutPlugin (~> 0.41.1)
323 | - FlipperKit/FlipperKitLayoutTextSearchable (~> 0.41.1)
324 | - FlipperKit/FlipperKitNetworkPlugin (~> 0.41.1)
325 | - FlipperKit/FlipperKitReactPlugin (~> 0.41.1)
326 | - FlipperKit/FlipperKitUserDefaultsPlugin (~> 0.41.1)
327 | - FlipperKit/SKIOSNetworkPlugin (~> 0.41.1)
328 | - Folly (from `../node_modules/react-native/third-party-podspecs/Folly.podspec`)
329 | - glog (from `../node_modules/react-native/third-party-podspecs/glog.podspec`)
330 | - RCTRequired (from `../node_modules/react-native/Libraries/RCTRequired`)
331 | - RCTTypeSafety (from `../node_modules/react-native/Libraries/TypeSafety`)
332 | - React (from `../node_modules/react-native/`)
333 | - React-callinvoker (from `../node_modules/react-native/ReactCommon/callinvoker`)
334 | - React-Core (from `../node_modules/react-native/`)
335 | - React-Core/DevSupport (from `../node_modules/react-native/`)
336 | - React-Core/RCTWebSocket (from `../node_modules/react-native/`)
337 | - React-CoreModules (from `../node_modules/react-native/React/CoreModules`)
338 | - React-cxxreact (from `../node_modules/react-native/ReactCommon/cxxreact`)
339 | - React-jsi (from `../node_modules/react-native/ReactCommon/jsi`)
340 | - React-jsiexecutor (from `../node_modules/react-native/ReactCommon/jsiexecutor`)
341 | - React-jsinspector (from `../node_modules/react-native/ReactCommon/jsinspector`)
342 | - React-RCTActionSheet (from `../node_modules/react-native/Libraries/ActionSheetIOS`)
343 | - React-RCTAnimation (from `../node_modules/react-native/Libraries/NativeAnimation`)
344 | - React-RCTBlob (from `../node_modules/react-native/Libraries/Blob`)
345 | - React-RCTImage (from `../node_modules/react-native/Libraries/Image`)
346 | - React-RCTLinking (from `../node_modules/react-native/Libraries/LinkingIOS`)
347 | - React-RCTNetwork (from `../node_modules/react-native/Libraries/Network`)
348 | - React-RCTSettings (from `../node_modules/react-native/Libraries/Settings`)
349 | - React-RCTText (from `../node_modules/react-native/Libraries/Text`)
350 | - React-RCTVibration (from `../node_modules/react-native/Libraries/Vibration`)
351 | - ReactCommon/turbomodule/core (from `../node_modules/react-native/ReactCommon`)
352 | - RNShareMenu (from `../..`)
353 | - Yoga (from `../node_modules/react-native/ReactCommon/yoga`)
354 |
355 | SPEC REPOS:
356 | trunk:
357 | - boost-for-react-native
358 | - CocoaAsyncSocket
359 | - CocoaLibEvent
360 | - Flipper
361 | - Flipper-DoubleConversion
362 | - Flipper-Folly
363 | - Flipper-Glog
364 | - Flipper-PeerTalk
365 | - Flipper-RSocket
366 | - FlipperKit
367 | - OpenSSL-Universal
368 | - YogaKit
369 |
370 | EXTERNAL SOURCES:
371 | DoubleConversion:
372 | :podspec: "../node_modules/react-native/third-party-podspecs/DoubleConversion.podspec"
373 | FBLazyVector:
374 | :path: "../node_modules/react-native/Libraries/FBLazyVector"
375 | FBReactNativeSpec:
376 | :path: "../node_modules/react-native/Libraries/FBReactNativeSpec"
377 | Folly:
378 | :podspec: "../node_modules/react-native/third-party-podspecs/Folly.podspec"
379 | glog:
380 | :podspec: "../node_modules/react-native/third-party-podspecs/glog.podspec"
381 | RCTRequired:
382 | :path: "../node_modules/react-native/Libraries/RCTRequired"
383 | RCTTypeSafety:
384 | :path: "../node_modules/react-native/Libraries/TypeSafety"
385 | React:
386 | :path: "../node_modules/react-native/"
387 | React-callinvoker:
388 | :path: "../node_modules/react-native/ReactCommon/callinvoker"
389 | React-Core:
390 | :path: "../node_modules/react-native/"
391 | React-CoreModules:
392 | :path: "../node_modules/react-native/React/CoreModules"
393 | React-cxxreact:
394 | :path: "../node_modules/react-native/ReactCommon/cxxreact"
395 | React-jsi:
396 | :path: "../node_modules/react-native/ReactCommon/jsi"
397 | React-jsiexecutor:
398 | :path: "../node_modules/react-native/ReactCommon/jsiexecutor"
399 | React-jsinspector:
400 | :path: "../node_modules/react-native/ReactCommon/jsinspector"
401 | React-RCTActionSheet:
402 | :path: "../node_modules/react-native/Libraries/ActionSheetIOS"
403 | React-RCTAnimation:
404 | :path: "../node_modules/react-native/Libraries/NativeAnimation"
405 | React-RCTBlob:
406 | :path: "../node_modules/react-native/Libraries/Blob"
407 | React-RCTImage:
408 | :path: "../node_modules/react-native/Libraries/Image"
409 | React-RCTLinking:
410 | :path: "../node_modules/react-native/Libraries/LinkingIOS"
411 | React-RCTNetwork:
412 | :path: "../node_modules/react-native/Libraries/Network"
413 | React-RCTSettings:
414 | :path: "../node_modules/react-native/Libraries/Settings"
415 | React-RCTText:
416 | :path: "../node_modules/react-native/Libraries/Text"
417 | React-RCTVibration:
418 | :path: "../node_modules/react-native/Libraries/Vibration"
419 | ReactCommon:
420 | :path: "../node_modules/react-native/ReactCommon"
421 | RNShareMenu:
422 | :path: "../.."
423 | Yoga:
424 | :path: "../node_modules/react-native/ReactCommon/yoga"
425 |
426 | SPEC CHECKSUMS:
427 | boost-for-react-native: 39c7adb57c4e60d6c5479dd8623128eb5b3f0f2c
428 | CocoaAsyncSocket: 694058e7c0ed05a9e217d1b3c7ded962f4180845
429 | CocoaLibEvent: 2fab71b8bd46dd33ddb959f7928ec5909f838e3f
430 | DoubleConversion: cde416483dac037923206447da6e1454df403714
431 | FBLazyVector: 3ef4a7f62e7db01092f9d517d2ebc0d0677c4a37
432 | FBReactNativeSpec: dc7fa9088f0f2a998503a352b0554d69a4391c5a
433 | Flipper: 33585e2d9810fe5528346be33bcf71b37bb7ae13
434 | Flipper-DoubleConversion: 38631e41ef4f9b12861c67d17cb5518d06badc41
435 | Flipper-Folly: c12092ea368353b58e992843a990a3225d4533c3
436 | Flipper-Glog: 1dfd6abf1e922806c52ceb8701a3599a79a200a6
437 | Flipper-PeerTalk: 116d8f857dc6ef55c7a5a75ea3ceaafe878aadc9
438 | Flipper-RSocket: 64e7431a55835eb953b0bf984ef3b90ae9fdddd7
439 | FlipperKit: bc68102cd4952a258a23c9c1b316c7bec1fecf83
440 | Folly: b73c3869541e86821df3c387eb0af5f65addfab4
441 | glog: 40a13f7840415b9a77023fbcae0f1e6f43192af3
442 | OpenSSL-Universal: 8b48cc0d10c1b2923617dfe5c178aa9ed2689355
443 | RCTRequired: f13f25e7b12f925f1f6a6a8c69d929a03c0129fe
444 | RCTTypeSafety: 44982c5c8e43ff4141eb519a8ddc88059acd1f3a
445 | React: e1c65dd41cb9db13b99f24608e47dd595f28ca9a
446 | React-callinvoker: 552a6a6bc8b3bb794cf108ad59e5a9e2e3b4fc98
447 | React-Core: 9d341e725dc9cd2f49e4c49ad1fc4e8776aa2639
448 | React-CoreModules: 5335e168165da7f7083ce7147768d36d3e292318
449 | React-cxxreact: d3261ec5f7d11743fbf21e263a34ea51d1f13ebc
450 | React-jsi: 54245e1d5f4b690dec614a73a3795964eeef13a8
451 | React-jsiexecutor: 8ca588cc921e70590820ce72b8789b02c67cce38
452 | React-jsinspector: b14e62ebe7a66e9231e9581279909f2fc3db6606
453 | React-RCTActionSheet: 910163b6b09685a35c4ebbc52b66d1bfbbe39fc5
454 | React-RCTAnimation: 9a883bbe1e9d2e158d4fb53765ed64c8dc2200c6
455 | React-RCTBlob: 39cf0ece1927996c4466510e25d2105f67010e13
456 | React-RCTImage: de355d738727b09ad3692f2a979affbd54b5f378
457 | React-RCTLinking: 8122f221d395a63364b2c0078ce284214bd04575
458 | React-RCTNetwork: 8f96c7b49ea6a0f28f98258f347b6ad218bc0830
459 | React-RCTSettings: 8a49622aff9c1925f5455fa340b6fe4853d64ab6
460 | React-RCTText: 1b6773e776e4b33f90468c20fe3b16ca3e224bb8
461 | React-RCTVibration: 4d2e726957f4087449739b595f107c0d4b6c2d2d
462 | ReactCommon: a0a1edbebcac5e91338371b72ffc66aa822792ce
463 | RNShareMenu: 43c83aa52d50a689b1f16b02f7815ea0406b1cc0
464 | Yoga: 7740b94929bbacbddda59bf115b5317e9a161598
465 | YogaKit: f782866e155069a2cca2517aafea43200b01fd5a
466 |
467 | PODFILE CHECKSUM: f5882acce3ccb72d524e52d64e8194cbbb00bbb5
468 |
469 | COCOAPODS: 1.9.3
470 |
--------------------------------------------------------------------------------