mirror of https://git.lenooby09.tech/LeNooby09/social-app.git
1const {withAndroidManifest} = require('@expo/config-plugins')
2
3const withIntentFilters = config => {
4 // eslint-disable-next-line no-shadow
5 return withAndroidManifest(config, config => {
6 const intents = [
7 {
8 action: [
9 {
10 $: {
11 'android:name': 'android.intent.action.SEND',
12 },
13 },
14 ],
15 category: [
16 {
17 $: {
18 'android:name': 'android.intent.category.DEFAULT',
19 },
20 },
21 ],
22 data: [
23 {
24 $: {
25 'android:mimeType': 'image/*',
26 },
27 },
28 ],
29 },
30 {
31 action: [
32 {
33 $: {
34 'android:name': 'android.intent.action.SEND',
35 },
36 },
37 ],
38 category: [
39 {
40 $: {
41 'android:name': 'android.intent.category.DEFAULT',
42 },
43 },
44 ],
45 data: [
46 {
47 $: {
48 'android:mimeType': 'text/plain',
49 },
50 },
51 ],
52 },
53 {
54 action: [
55 {
56 $: {
57 'android:name': 'android.intent.action.SEND_MULTIPLE',
58 },
59 },
60 ],
61 category: [
62 {
63 $: {
64 'android:name': 'android.intent.category.DEFAULT',
65 },
66 },
67 ],
68 data: [
69 {
70 $: {
71 'android:mimeType': 'image/*',
72 },
73 },
74 ],
75 },
76 ]
77
78 const intentFilter =
79 config.modResults.manifest.application?.[0].activity?.[0]['intent-filter']
80
81 if (intentFilter) {
82 intentFilter.push(...intents)
83 }
84
85 return config
86 })
87}
88
89module.exports = {withIntentFilters}