react-native-share 12.0.0 → 12.0.2

This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
package/app.plugin.js ADDED
@@ -0,0 +1,2 @@
1
+ // eslint-disable-next-line no-undef, import/no-commonjs
2
+ module.exports = require('./plugin/build');
package/package.json CHANGED
@@ -1,7 +1,7 @@
1
1
  {
2
2
  "name": "react-native-share",
3
3
  "description": "Social share, sending simple data to other apps.",
4
- "version": "12.0.0",
4
+ "version": "12.0.2",
5
5
  "repository": {
6
6
  "type": "git",
7
7
  "url": "git+https://github.com/react-native-community/react-native-share.git"
@@ -22,7 +22,9 @@
22
22
  "RNShare.podspec",
23
23
  "!**/__tests__",
24
24
  "!**/__fixtures__",
25
- "!**/__mocks__"
25
+ "!**/__mocks__",
26
+ "app.plugin.js",
27
+ "plugin"
26
28
  ],
27
29
  "devDependencies": {
28
30
  "@babel/core": "^7.23.3",
@@ -0,0 +1 @@
1
+ export {};
@@ -0,0 +1,79 @@
1
+ "use strict";
2
+ Object.defineProperty(exports, "__esModule", { value: true });
3
+ const config_plugins_1 = require("@expo/config-plugins");
4
+ // eslint-disable-next-line import/no-commonjs, @typescript-eslint/no-var-requires
5
+ const pkg = require('../../package.json');
6
+ /**
7
+ * @type {import('./types').ManifestQueries}
8
+ * what we are trying to add:
9
+ * <queries>
10
+ <package android:name="com.facebook.katana"/>
11
+ <package android:name="com.instagram.android"/>
12
+ <package android:name="com.twitter.android"/>
13
+ <package android:name="com.zhiliaoapp.musically"/>
14
+ <intent></intent>
15
+ <action android:name="android.intent.action.VIEW"/>
16
+ <category android:name="android.intent.category.BROWSABLE"/>
17
+ <data android:scheme="https"/>
18
+ </intent>
19
+ </queries>
20
+ */
21
+ /**
22
+ * @param {import('@expo/config-plugins').ExportedConfig} config
23
+ */
24
+ const withAndroidManifestService = (config, props) => {
25
+ return (0, config_plugins_1.withAndroidManifest)(config, (config) => {
26
+ config.modResults.manifest = {
27
+ ...config.modResults.manifest,
28
+ queries: {
29
+ package: props?.android?.map((social) => ({
30
+ $: {
31
+ 'android:name': social,
32
+ },
33
+ })),
34
+ intent: [
35
+ {
36
+ action: {
37
+ $: {
38
+ 'android:name': 'android.intent.action.VIEW',
39
+ },
40
+ },
41
+ category: {
42
+ $: {
43
+ 'android:name': 'android.intent.category.BROWSABLE',
44
+ },
45
+ },
46
+ data: {
47
+ $: {
48
+ 'android:scheme': 'https',
49
+ },
50
+ },
51
+ },
52
+ ],
53
+ },
54
+ };
55
+ return config;
56
+ });
57
+ };
58
+ const withInfoPlist = (config, props) => {
59
+ return {
60
+ ...config,
61
+ ios: {
62
+ ...config.ios,
63
+ infoPlist: {
64
+ ...config.ios?.infoPlist,
65
+ LSApplicationQueriesSchemes: {
66
+ ...config.ios?.infoPlist?.LSApplicationQueriesSchemes,
67
+ ...props?.ios,
68
+ },
69
+ },
70
+ },
71
+ };
72
+ };
73
+ function withSocialShare(config, props) {
74
+ config = withAndroidManifestService(config, props); // Android
75
+ config = withInfoPlist(config, props); // iOS
76
+ return config;
77
+ }
78
+ // eslint-disable-next-line import/no-commonjs
79
+ module.exports = (0, config_plugins_1.createRunOncePlugin)(withSocialShare, pkg.name, pkg.version);
@@ -0,0 +1,94 @@
1
+ import {
2
+ withAndroidManifest,
3
+ createRunOncePlugin,
4
+ ExportedConfigWithProps,
5
+ ExportedConfig,
6
+ } from '@expo/config-plugins';
7
+
8
+ // eslint-disable-next-line import/no-commonjs, @typescript-eslint/no-var-requires
9
+ const pkg = require('../../package.json');
10
+
11
+ /**
12
+ * @type {import('./types').ManifestQueries}
13
+ * what we are trying to add:
14
+ * <queries>
15
+ <package android:name="com.facebook.katana"/>
16
+ <package android:name="com.instagram.android"/>
17
+ <package android:name="com.twitter.android"/>
18
+ <package android:name="com.zhiliaoapp.musically"/>
19
+ <intent></intent>
20
+ <action android:name="android.intent.action.VIEW"/>
21
+ <category android:name="android.intent.category.BROWSABLE"/>
22
+ <data android:scheme="https"/>
23
+ </intent>
24
+ </queries>
25
+ */
26
+
27
+ /**
28
+ * @param {import('@expo/config-plugins').ExportedConfig} config
29
+ */
30
+ const withAndroidManifestService = (config: ExportedConfig, props: WithSocialShareProps) => {
31
+ return withAndroidManifest(config, (config: ExportedConfigWithProps) => {
32
+ config.modResults.manifest = {
33
+ ...config.modResults.manifest,
34
+ queries: {
35
+ package: props?.android?.map((social) => ({
36
+ $: {
37
+ 'android:name': social,
38
+ },
39
+ })),
40
+ intent: [
41
+ {
42
+ action: {
43
+ $: {
44
+ 'android:name': 'android.intent.action.VIEW',
45
+ },
46
+ },
47
+ category: {
48
+ $: {
49
+ 'android:name': 'android.intent.category.BROWSABLE',
50
+ },
51
+ },
52
+ data: {
53
+ $: {
54
+ 'android:scheme': 'https',
55
+ },
56
+ },
57
+ },
58
+ ],
59
+ },
60
+ };
61
+
62
+ return config;
63
+ });
64
+ };
65
+
66
+ const withInfoPlist = (config: ExportedConfig, props: WithSocialShareProps) => {
67
+ return {
68
+ ...config,
69
+ ios: {
70
+ ...config.ios,
71
+ infoPlist: {
72
+ ...config.ios?.infoPlist,
73
+ LSApplicationQueriesSchemes: {
74
+ ...config.ios?.infoPlist?.LSApplicationQueriesSchemes,
75
+ ...props?.ios,
76
+ },
77
+ },
78
+ },
79
+ };
80
+ };
81
+
82
+ type WithSocialShareProps = {
83
+ ios: string[];
84
+ android: string[];
85
+ };
86
+
87
+ function withSocialShare(config: ExportedConfig, props: WithSocialShareProps) {
88
+ config = withAndroidManifestService(config, props); // Android
89
+ config = withInfoPlist(config, props); // iOS
90
+ return config;
91
+ }
92
+
93
+ // eslint-disable-next-line import/no-commonjs
94
+ module.exports = createRunOncePlugin(withSocialShare, pkg.name, pkg.version);
@@ -0,0 +1,10 @@
1
+ {
2
+ "extends": "../tsconfig.json",
3
+ "compilerOptions": {
4
+ "outDir": "build",
5
+ "rootDir": "src",
6
+ "declaration": true,
7
+ "module": "commonjs",
8
+ },
9
+ "include": ["./src"]
10
+ }