expo-dev-client 1.2.0 → 1.3.0
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/CHANGELOG.md
CHANGED
|
@@ -10,6 +10,16 @@
|
|
|
10
10
|
|
|
11
11
|
### 💡 Others
|
|
12
12
|
|
|
13
|
+
## 1.3.0 — 2022-09-16
|
|
14
|
+
|
|
15
|
+
### 🐛 Bug fixes
|
|
16
|
+
|
|
17
|
+
- Remove default scheme from intent filters that specify `autoVerify=true`. ([#18963](https://github.com/expo/expo/pull/18963) by [@ajsmth](https://github.com/ajsmth))
|
|
18
|
+
|
|
19
|
+
## 1.2.1 — 2022-08-16
|
|
20
|
+
|
|
21
|
+
_This version does not introduce any user-facing changes._
|
|
22
|
+
|
|
13
23
|
## 1.2.0 — 2022-08-11
|
|
14
24
|
|
|
15
25
|
_This version does not introduce any user-facing changes._
|
package/android/build.gradle
CHANGED
package/package.json
CHANGED
|
@@ -1,6 +1,6 @@
|
|
|
1
1
|
{
|
|
2
2
|
"name": "expo-dev-client",
|
|
3
|
-
"version": "1.
|
|
3
|
+
"version": "1.3.0",
|
|
4
4
|
"description": "Expo Development Client",
|
|
5
5
|
"main": "build/DevClient.js",
|
|
6
6
|
"types": "build/DevClient.d.ts",
|
|
@@ -33,8 +33,8 @@
|
|
|
33
33
|
"homepage": "https://docs.expo.dev/clients/introduction/",
|
|
34
34
|
"dependencies": {
|
|
35
35
|
"@expo/config-plugins": "~5.0.0",
|
|
36
|
-
"expo-dev-launcher": "1.
|
|
37
|
-
"expo-dev-menu": "1.
|
|
36
|
+
"expo-dev-launcher": "1.3.0",
|
|
37
|
+
"expo-dev-menu": "1.3.0",
|
|
38
38
|
"expo-dev-menu-interface": "0.7.2",
|
|
39
39
|
"expo-manifests": "~0.3.0",
|
|
40
40
|
"expo-updates-interface": "~0.7.0"
|
|
@@ -49,5 +49,5 @@
|
|
|
49
49
|
"jest": {
|
|
50
50
|
"preset": "expo-module-scripts"
|
|
51
51
|
},
|
|
52
|
-
"gitHead": "
|
|
52
|
+
"gitHead": "b86b08c4caa6aac3a910eebb4c42188abaf83eb8"
|
|
53
53
|
}
|
|
@@ -1,4 +1,14 @@
|
|
|
1
|
-
import { AndroidManifest, ConfigPlugin } from '@expo/config-plugins';
|
|
1
|
+
import { AndroidConfig, AndroidManifest, ConfigPlugin } from '@expo/config-plugins';
|
|
2
2
|
import { ExpoConfig } from '@expo/config-types';
|
|
3
3
|
export declare const withGeneratedAndroidScheme: ConfigPlugin;
|
|
4
4
|
export declare function setGeneratedAndroidScheme(config: Pick<ExpoConfig, 'scheme' | 'slug'>, androidManifest: AndroidManifest): AndroidManifest;
|
|
5
|
+
/**
|
|
6
|
+
* Remove the custom Expo dev client scheme from intent filters, which are set to `autoVerify=true`.
|
|
7
|
+
* The custom scheme `<data android:scheme="exp+<slug>"/>` seems to block verification for these intent filters.
|
|
8
|
+
* This plugin makes sure there is no scheme in the autoVerify intent filters, that starts with `exp+`.
|
|
9
|
+
|
|
10
|
+
* Iterate over all `autoVerify=true` intent filters, and pull out schemes matching with `exp+<slug>`.
|
|
11
|
+
*
|
|
12
|
+
* @param {AndroidManifest} androidManifest
|
|
13
|
+
*/
|
|
14
|
+
export declare function removeExpoSchemaFromVerifiedIntentFilters(config: Pick<ExpoConfig, 'scheme' | 'slug'>, androidManifest: AndroidManifest): AndroidConfig.Manifest.AndroidManifest;
|
|
@@ -3,12 +3,13 @@ var __importDefault = (this && this.__importDefault) || function (mod) {
|
|
|
3
3
|
return (mod && mod.__esModule) ? mod : { "default": mod };
|
|
4
4
|
};
|
|
5
5
|
Object.defineProperty(exports, "__esModule", { value: true });
|
|
6
|
-
exports.setGeneratedAndroidScheme = exports.withGeneratedAndroidScheme = void 0;
|
|
6
|
+
exports.removeExpoSchemaFromVerifiedIntentFilters = exports.setGeneratedAndroidScheme = exports.withGeneratedAndroidScheme = void 0;
|
|
7
7
|
const config_plugins_1 = require("@expo/config-plugins");
|
|
8
8
|
const getDefaultScheme_1 = __importDefault(require("./getDefaultScheme"));
|
|
9
9
|
const withGeneratedAndroidScheme = (config) => {
|
|
10
10
|
return (0, config_plugins_1.withAndroidManifest)(config, (config) => {
|
|
11
11
|
config.modResults = setGeneratedAndroidScheme(config, config.modResults);
|
|
12
|
+
config.modResults = removeExpoSchemaFromVerifiedIntentFilters(config, config.modResults);
|
|
12
13
|
return config;
|
|
13
14
|
});
|
|
14
15
|
};
|
|
@@ -22,3 +23,54 @@ function setGeneratedAndroidScheme(config, androidManifest) {
|
|
|
22
23
|
return androidManifest;
|
|
23
24
|
}
|
|
24
25
|
exports.setGeneratedAndroidScheme = setGeneratedAndroidScheme;
|
|
26
|
+
/**
|
|
27
|
+
* Remove the custom Expo dev client scheme from intent filters, which are set to `autoVerify=true`.
|
|
28
|
+
* The custom scheme `<data android:scheme="exp+<slug>"/>` seems to block verification for these intent filters.
|
|
29
|
+
* This plugin makes sure there is no scheme in the autoVerify intent filters, that starts with `exp+`.
|
|
30
|
+
|
|
31
|
+
* Iterate over all `autoVerify=true` intent filters, and pull out schemes matching with `exp+<slug>`.
|
|
32
|
+
*
|
|
33
|
+
* @param {AndroidManifest} androidManifest
|
|
34
|
+
*/
|
|
35
|
+
function removeExpoSchemaFromVerifiedIntentFilters(config, androidManifest) {
|
|
36
|
+
// Generate a cross-platform scheme used to launch the dev client.
|
|
37
|
+
const defaultScheme = (0, getDefaultScheme_1.default)(config);
|
|
38
|
+
// see: https://github.com/expo/expo-cli/blob/f1624c75b52cc1c4f99354ec4021494e0eff74aa/packages/config-plugins/src/android/Scheme.ts#L164-L179
|
|
39
|
+
for (const application of androidManifest.manifest.application || []) {
|
|
40
|
+
for (const activity of application.activity || []) {
|
|
41
|
+
if (activityHasSingleTaskLaunchMode(activity)) {
|
|
42
|
+
for (const intentFilter of activity['intent-filter'] || []) {
|
|
43
|
+
if (intentFilterHasAutoVerification(intentFilter) && (intentFilter === null || intentFilter === void 0 ? void 0 : intentFilter.data)) {
|
|
44
|
+
intentFilter.data = intentFilterRemoveSchemeFromData(intentFilter, (scheme) => scheme === defaultScheme);
|
|
45
|
+
}
|
|
46
|
+
}
|
|
47
|
+
break;
|
|
48
|
+
}
|
|
49
|
+
}
|
|
50
|
+
}
|
|
51
|
+
return androidManifest;
|
|
52
|
+
}
|
|
53
|
+
exports.removeExpoSchemaFromVerifiedIntentFilters = removeExpoSchemaFromVerifiedIntentFilters;
|
|
54
|
+
/**
|
|
55
|
+
* Determine if the activity should contain the intent filters to clean.
|
|
56
|
+
*
|
|
57
|
+
* @see https://github.com/expo/expo-cli/blob/f1624c75b52cc1c4f99354ec4021494e0eff74aa/packages/config-plugins/src/android/Scheme.ts#L166
|
|
58
|
+
*/
|
|
59
|
+
function activityHasSingleTaskLaunchMode(activity) {
|
|
60
|
+
var _a;
|
|
61
|
+
return ((_a = activity === null || activity === void 0 ? void 0 : activity.$) === null || _a === void 0 ? void 0 : _a['android:launchMode']) === 'singleTask';
|
|
62
|
+
}
|
|
63
|
+
/**
|
|
64
|
+
* Determine if the intent filter has `autoVerify=true`.
|
|
65
|
+
*/
|
|
66
|
+
function intentFilterHasAutoVerification(intentFilter) {
|
|
67
|
+
var _a;
|
|
68
|
+
return ((_a = intentFilter === null || intentFilter === void 0 ? void 0 : intentFilter.$) === null || _a === void 0 ? void 0 : _a['android:autoVerify']) === 'true';
|
|
69
|
+
}
|
|
70
|
+
/**
|
|
71
|
+
* Remove schemes from the intent filter that matches the function.
|
|
72
|
+
*/
|
|
73
|
+
function intentFilterRemoveSchemeFromData(intentFilter, schemeMatcher) {
|
|
74
|
+
var _a;
|
|
75
|
+
return (_a = intentFilter === null || intentFilter === void 0 ? void 0 : intentFilter.data) === null || _a === void 0 ? void 0 : _a.filter((entry) => !schemeMatcher((entry === null || entry === void 0 ? void 0 : entry.$['android:scheme']) || ''));
|
|
76
|
+
}
|
|
@@ -4,6 +4,10 @@ import {
|
|
|
4
4
|
ConfigPlugin,
|
|
5
5
|
withAndroidManifest,
|
|
6
6
|
} from '@expo/config-plugins';
|
|
7
|
+
import {
|
|
8
|
+
ManifestActivity,
|
|
9
|
+
ManifestIntentFilter,
|
|
10
|
+
} from '@expo/config-plugins/build/android/Manifest';
|
|
7
11
|
import { ExpoConfig } from '@expo/config-types';
|
|
8
12
|
|
|
9
13
|
import getDefaultScheme from './getDefaultScheme';
|
|
@@ -11,6 +15,7 @@ import getDefaultScheme from './getDefaultScheme';
|
|
|
11
15
|
export const withGeneratedAndroidScheme: ConfigPlugin = (config) => {
|
|
12
16
|
return withAndroidManifest(config, (config) => {
|
|
13
17
|
config.modResults = setGeneratedAndroidScheme(config, config.modResults);
|
|
18
|
+
config.modResults = removeExpoSchemaFromVerifiedIntentFilters(config, config.modResults);
|
|
14
19
|
return config;
|
|
15
20
|
});
|
|
16
21
|
};
|
|
@@ -24,5 +29,64 @@ export function setGeneratedAndroidScheme(
|
|
|
24
29
|
if (!AndroidConfig.Scheme.hasScheme(scheme, androidManifest)) {
|
|
25
30
|
androidManifest = AndroidConfig.Scheme.appendScheme(scheme, androidManifest);
|
|
26
31
|
}
|
|
32
|
+
|
|
33
|
+
return androidManifest;
|
|
34
|
+
}
|
|
35
|
+
|
|
36
|
+
/**
|
|
37
|
+
* Remove the custom Expo dev client scheme from intent filters, which are set to `autoVerify=true`.
|
|
38
|
+
* The custom scheme `<data android:scheme="exp+<slug>"/>` seems to block verification for these intent filters.
|
|
39
|
+
* This plugin makes sure there is no scheme in the autoVerify intent filters, that starts with `exp+`.
|
|
40
|
+
|
|
41
|
+
* Iterate over all `autoVerify=true` intent filters, and pull out schemes matching with `exp+<slug>`.
|
|
42
|
+
*
|
|
43
|
+
* @param {AndroidManifest} androidManifest
|
|
44
|
+
*/
|
|
45
|
+
export function removeExpoSchemaFromVerifiedIntentFilters(
|
|
46
|
+
config: Pick<ExpoConfig, 'scheme' | 'slug'>,
|
|
47
|
+
androidManifest: AndroidManifest
|
|
48
|
+
) {
|
|
49
|
+
// Generate a cross-platform scheme used to launch the dev client.
|
|
50
|
+
const defaultScheme = getDefaultScheme(config);
|
|
51
|
+
// see: https://github.com/expo/expo-cli/blob/f1624c75b52cc1c4f99354ec4021494e0eff74aa/packages/config-plugins/src/android/Scheme.ts#L164-L179
|
|
52
|
+
for (const application of androidManifest.manifest.application || []) {
|
|
53
|
+
for (const activity of application.activity || []) {
|
|
54
|
+
if (activityHasSingleTaskLaunchMode(activity)) {
|
|
55
|
+
for (const intentFilter of activity['intent-filter'] || []) {
|
|
56
|
+
if (intentFilterHasAutoVerification(intentFilter) && intentFilter?.data) {
|
|
57
|
+
intentFilter.data = intentFilterRemoveSchemeFromData(
|
|
58
|
+
intentFilter,
|
|
59
|
+
(scheme: string) => scheme === defaultScheme
|
|
60
|
+
);
|
|
61
|
+
}
|
|
62
|
+
}
|
|
63
|
+
break;
|
|
64
|
+
}
|
|
65
|
+
}
|
|
66
|
+
}
|
|
67
|
+
|
|
27
68
|
return androidManifest;
|
|
28
69
|
}
|
|
70
|
+
|
|
71
|
+
/**
|
|
72
|
+
* Determine if the activity should contain the intent filters to clean.
|
|
73
|
+
*
|
|
74
|
+
* @see https://github.com/expo/expo-cli/blob/f1624c75b52cc1c4f99354ec4021494e0eff74aa/packages/config-plugins/src/android/Scheme.ts#L166
|
|
75
|
+
*/
|
|
76
|
+
function activityHasSingleTaskLaunchMode(activity: ManifestActivity) {
|
|
77
|
+
return activity?.$?.['android:launchMode'] === 'singleTask';
|
|
78
|
+
}
|
|
79
|
+
|
|
80
|
+
/**
|
|
81
|
+
* Determine if the intent filter has `autoVerify=true`.
|
|
82
|
+
*/
|
|
83
|
+
function intentFilterHasAutoVerification(intentFilter: ManifestIntentFilter) {
|
|
84
|
+
return intentFilter?.$?.['android:autoVerify'] === 'true';
|
|
85
|
+
}
|
|
86
|
+
|
|
87
|
+
/**
|
|
88
|
+
* Remove schemes from the intent filter that matches the function.
|
|
89
|
+
*/
|
|
90
|
+
function intentFilterRemoveSchemeFromData(intentFilter: ManifestIntentFilter, schemeMatcher: any) {
|
|
91
|
+
return intentFilter?.data?.filter((entry) => !schemeMatcher(entry?.$['android:scheme'] || ''));
|
|
92
|
+
}
|