UNPKG

@42techpacks/expo-spotify-sdk

Version:
33 lines (32 loc) 1.37 kB
"use strict"; Object.defineProperty(exports, "__esModule", { value: true }); exports.withSpotifyAndroidAppBuildGradle = void 0; const config_plugins_1 = require("@expo/config-plugins"); const withSpotifyAndroidAppBuildGradle = (config, spotifyConfig) => { return (0, config_plugins_1.withAppBuildGradle)(config, (config) => { const defaultConfigPattern = /(defaultConfig\s*{[\s\S]*?)(})/s; const manifestPlaceholders = ` manifestPlaceholders = [ spotifyClientId: "${spotifyConfig.clientID}", spotifyRedirectUri: "${spotifyConfig.scheme}://${spotifyConfig.host}", redirectSchemeName: "${spotifyConfig.scheme}", redirectHostName: "${spotifyConfig.host}" ] `; if (defaultConfigPattern.test(config.modResults.contents)) { // If the defaultConfig block exists, add the manifestPlaceholders to it config.modResults.contents = config.modResults.contents.replace(defaultConfigPattern, `$1${manifestPlaceholders}$2`); } else { // If the defaultConfig block doesn't exist, add it to the android block config.modResults.contents += ` android { defaultConfig { ${manifestPlaceholders} } }`; } return config; }); }; exports.withSpotifyAndroidAppBuildGradle = withSpotifyAndroidAppBuildGradle;