Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Expo plugin to enable com.google.android.gms.wallet.api.enabled #1

Open
whatyoubendoing opened this issue Jul 16, 2023 · 1 comment

Comments

@whatyoubendoing
Copy link

whatyoubendoing commented Jul 16, 2023

const { AndroidConfig, withAndroidManifest } = require("@expo/config-plugins");

const { addMetaDataItemToMainApplication, getMainApplicationOrThrow } =
  AndroidConfig.Manifest;

/**
 * Adds the following to AndroidManifest.xml:
 *
 * <application>
 *   ...
 *	 <meta-data
 *     android:name="com.google.android.gms.wallet.api.enabled"
 *     android:value="true|false" />
 * </application>
 */
function setGooglePayMetaData(modResults) {
  const GOOGLE_PAY_META_NAME = "com.google.android.gms.wallet.api.enabled";
  const mainApplication = getMainApplicationOrThrow(modResults);

  addMetaDataItemToMainApplication(
    mainApplication,
    GOOGLE_PAY_META_NAME,
    "true",
  );

  return modResults;
}

function withGooglePayAndroid(expoConfig) {
  return withAndroidManifest(expoConfig, (config) => {
    config.modResults = setGooglePayMetaData(config.modResults);
    return config;
  });
}

module.exports = function withGooglePay(config, props) {
  config = withGooglePayAndroid(config, props);
  return config;
};
@stephenmcd
Copy link
Contributor

Thanks Ben, would you like to add this as a pull request? Happy to merge.

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

No branches or pull requests

2 participants