react-native-zalo-auth
Version:
Zalo SDK for React Native
47 lines (45 loc) • 1.66 kB
JavaScript
;
Object.defineProperty(exports, "__esModule", {
value: true
});
exports.default = void 0;
var _configPlugins = require("@expo/config-plugins");
const withZaloIOSPlist = (config, appId) => (0, _configPlugins.withInfoPlist)(config, infoConfig => {
let queriesSchemes = infoConfig.modResults.LSApplicationQueriesSchemes;
if (!queriesSchemes) {
infoConfig.modResults.LSApplicationQueriesSchemes = [];
queriesSchemes = infoConfig.modResults.LSApplicationQueriesSchemes;
}
if (!queriesSchemes.find(item => item === 'zalosdk')) {
queriesSchemes.push('zalosdk');
}
if (!queriesSchemes.find(item => item === 'zaloshareext')) {
queriesSchemes.push('zaloshareext');
}
let urlTypes = infoConfig.modResults.CFBundleURLTypes;
if (!urlTypes) {
infoConfig.modResults.CFBundleURLTypes = [];
urlTypes = infoConfig.modResults.CFBundleURLTypes;
}
if (!urlTypes.find(item => item.CFBundleURLName)) {
urlTypes.push({
CFBundleURLName: 'zalo',
CFBundleURLSchemes: [`zalo-${appId}`]
});
}
return infoConfig;
});
const withZaloAppDelegate = (config, appDelegateContent) => (0, _configPlugins.withAppDelegate)(config, appDelegateConfig => {
appDelegateConfig.modResults.contents = appDelegateContent;
return appDelegateConfig;
});
/**
* @typedef {import("expo/config-plugins").ConfigPlugin} ConfigPlugin
* @param {ConfigPlugin} config
*/
const withIOS = (config, {
appId,
appDelegateContent
}) => (0, _configPlugins.withPlugins)(config, [[withZaloIOSPlist, appId], [withZaloAppDelegate, appDelegateContent]]);
var _default = exports.default = withIOS;
//# sourceMappingURL=withIOS.js.map