| 12345678910111213141516171819202122232425262728293031323334353637383940414243444546 |
- const fs = require("fs");
- const path = require("path");
- const https = require("https");
- module.exports = function (context) {
- if (
- context.opts.plugin &&
- context.opts.plugin.id === "cordova-plugin-qrscanner"
- ) {
- const projectRoot = context.opts.projectRoot;
- const cordovaCommon = context.requireCordovaModule("cordova-common");
- const { ConfigParser } = cordovaCommon;
- const appConfig = new ConfigParser(
- path.resolve(projectRoot, "config.xml")
- );
- let projectName = appConfig.name();
- const file = path.resolve(
- projectRoot,
- "platforms",
- "android",
- "app",
- "src",
- "main",
- "java",
- "com",
- "bitpay",
- "cordova",
- "qrscanner",
- "QRScanner.java"
- );
- if (fs.existsSync(file)) {
- fs.writeFileSync(
- file,
- fs
- .readFileSync(file)
- .toString()
- .replaceAll(
- "android.support.v4.app.ActivityCompat",
- "androidx.core.app.ActivityCompat"
- )
- );
- }
- }
- };
|