Skip to content
This repository was archived by the owner on May 20, 2022. It is now read-only.

Commit 83c7b8f

Browse files
committed
refactor(expo): change accepted plugin parameters
BREAKING CHANGE: expo config plugin parameters have changed
1 parent dc5c4ae commit 83c7b8f

File tree

11 files changed

+21
-17
lines changed

11 files changed

+21
-17
lines changed

example/app.json

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -8,7 +8,7 @@
88
"sdkVersion": "42.0.0",
99
"version": "1.0.0",
1010
"platforms": ["ios", "android", "web"],
11-
"plugins": [["../app.plugin.js", { "signatureHash": "Xo8WBi6jzSxKDVR4drqm84yr9iU=" }]],
11+
"plugins": [["../app.plugin.js", { "android": { "packageSignatureHash": "Xo8WBi6jzSxKDVR4drqm84yr9iU=" } }]],
1212
"android": {
1313
"package": "com.example"
1414
},

example/ios/example.xcodeproj/project.pbxproj

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -316,7 +316,7 @@
316316
SWIFT_OBJC_BRIDGING_HEADER = "example-Bridging-Header.h";
317317
SWIFT_OPTIMIZATION_LEVEL = "-Onone";
318318
SWIFT_VERSION = 5.0;
319-
TARGETED_DEVICE_FAMILY = 1;
319+
TARGETED_DEVICE_FAMILY = "1";
320320
VERSIONING_SYSTEM = "apple-generic";
321321
};
322322
name = Debug;
@@ -345,7 +345,7 @@
345345
PRODUCT_NAME = example;
346346
SWIFT_OBJC_BRIDGING_HEADER = "example-Bridging-Header.h";
347347
SWIFT_VERSION = 5.0;
348-
TARGETED_DEVICE_FAMILY = 1;
348+
TARGETED_DEVICE_FAMILY = "1";
349349
VERSIONING_SYSTEM = "apple-generic";
350350
};
351351
name = Release;

example/ios/example/Info.plist

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -31,7 +31,7 @@
3131
<dict>
3232
<key>CFBundleURLSchemes</key>
3333
<array>
34-
<string>msauth.com.example</string>
34+
<string>msauth.$(PRODUCT_BUNDLE_IDENTIFIER)</string>
3535
</array>
3636
</dict>
3737
</array>
Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -1,4 +1,4 @@
11
import { ConfigPlugin } from '@expo/config-plugins';
22
export declare const withAndroidReactNativeMSAL: ConfigPlugin<{
3-
signatureHash: string;
3+
packageSignatureHash: string;
44
}>;

plugin/build/withAndroidReactNativeMSAL.js

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -60,7 +60,7 @@ function setGradleMaven(buildGradle) {
6060
}
6161
return buildGradle + `\n${gradleMaven}\n`;
6262
}
63-
const withAndroidReactNativeMSAL = (config, { signatureHash }) => {
64-
return config_plugins_1.withPlugins(config, [[withAndroidActivity, signatureHash], withAndroidMSALGradle]);
63+
const withAndroidReactNativeMSAL = (config, { packageSignatureHash }) => {
64+
return config_plugins_1.withPlugins(config, [[withAndroidActivity, packageSignatureHash], withAndroidMSALGradle]);
6565
};
6666
exports.withAndroidReactNativeMSAL = withAndroidReactNativeMSAL;

plugin/build/withIosReactNativeMSAL.js

Lines changed: 1 addition & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -3,9 +3,8 @@ Object.defineProperty(exports, "__esModule", { value: true });
33
exports.withIosReactNativeMSAL = void 0;
44
const config_plugins_1 = require("@expo/config-plugins");
55
const withIosUrlScheme = (config) => {
6-
var _a;
76
const QUERY_SCHEMES = ['msauthv2', 'msauthv3'];
8-
const URL_SCHEME = { CFBundleURLSchemes: [`msauth.${(_a = config.ios) === null || _a === void 0 ? void 0 : _a.bundleIdentifier}`] };
7+
const URL_SCHEME = { CFBundleURLSchemes: ['msauth.$(PRODUCT_BUNDLE_IDENTIFIER)'] };
98
return config_plugins_1.withInfoPlist(config, (mod) => {
109
var _a;
1110
mod.modResults.CFBundleURLTypes = [...(mod.modResults.CFBundleURLTypes || []), URL_SCHEME];
Lines changed: 3 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -1,5 +1,7 @@
11
import { ConfigPlugin } from '@expo/config-plugins';
22
declare const withReactNativeMSAL: ConfigPlugin<{
3-
signatureHash: string;
3+
android: {
4+
signatureHash: string;
5+
};
46
}>;
57
export default withReactNativeMSAL;

plugin/build/withReactNativeMSAL.js

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -3,7 +3,7 @@ Object.defineProperty(exports, "__esModule", { value: true });
33
const config_plugins_1 = require("@expo/config-plugins");
44
const withAndroidReactNativeMSAL_1 = require("./withAndroidReactNativeMSAL");
55
const withIosReactNativeMSAL_1 = require("./withIosReactNativeMSAL");
6-
const withReactNativeMSAL = (config, { signatureHash }) => {
7-
return config_plugins_1.withPlugins(config, [[withAndroidReactNativeMSAL_1.withAndroidReactNativeMSAL, { signatureHash }], withIosReactNativeMSAL_1.withIosReactNativeMSAL]);
6+
const withReactNativeMSAL = (config, { android }) => {
7+
return config_plugins_1.withPlugins(config, [[withAndroidReactNativeMSAL_1.withAndroidReactNativeMSAL, android], withIosReactNativeMSAL_1.withIosReactNativeMSAL]);
88
};
99
exports.default = withReactNativeMSAL;

plugin/src/withAndroidReactNativeMSAL.ts

Lines changed: 5 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -78,6 +78,9 @@ function setGradleMaven(buildGradle: string) {
7878
return buildGradle + `\n${gradleMaven}\n`;
7979
}
8080

81-
export const withAndroidReactNativeMSAL: ConfigPlugin<{ signatureHash: string }> = (config, { signatureHash }) => {
82-
return withPlugins(config, [[withAndroidActivity, signatureHash], withAndroidMSALGradle]);
81+
export const withAndroidReactNativeMSAL: ConfigPlugin<{ packageSignatureHash: string }> = (
82+
config,
83+
{ packageSignatureHash }
84+
) => {
85+
return withPlugins(config, [[withAndroidActivity, packageSignatureHash], withAndroidMSALGradle]);
8386
};

plugin/src/withIosReactNativeMSAL.ts

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -2,7 +2,7 @@ import { ConfigPlugin, withInfoPlist, withEntitlementsPlist, withPlugins, withAp
22

33
const withIosUrlScheme: ConfigPlugin = (config) => {
44
const QUERY_SCHEMES = ['msauthv2', 'msauthv3'];
5-
const URL_SCHEME = { CFBundleURLSchemes: [`msauth.${config.ios?.bundleIdentifier}`] };
5+
const URL_SCHEME = { CFBundleURLSchemes: ['msauth.$(PRODUCT_BUNDLE_IDENTIFIER)'] };
66

77
return withInfoPlist(config, (mod) => {
88
mod.modResults.CFBundleURLTypes = [...(mod.modResults.CFBundleURLTypes || []), URL_SCHEME];

0 commit comments

Comments
 (0)