Skip to content

Commit 0869ed3

Browse files
committed
Change provider to com.foxdebug.acodex.provider
1 parent c68cf22 commit 0869ed3

3 files changed

Lines changed: 18 additions & 5 deletions

File tree

package.json

Lines changed: 3 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -24,7 +24,9 @@
2424
"plugins": {
2525
"cordova-clipboard": {},
2626
"cordova-plugin-device": {},
27-
"cordova-plugin-file": {},
27+
"cordova-plugin-file": {
28+
"ANDROIDX_WEBKIT_VERSION": "1.4.0"
29+
},
2830
"cordova-plugin-sftp": {},
2931
"cordova-plugin-server": {},
3032
"cordova-plugin-ftp": {},

src/plugins/system/plugin.xml

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -18,7 +18,7 @@
1818
</config-file>
1919

2020
<config-file target="AndroidManifest.xml" parent="./application">
21-
<provider android:name="androidx.core.content.FileProvider" android:authorities="com.foxdebug.provider" android:exported="false" android:grantUriPermissions="true">
21+
<provider android:name="androidx.core.content.FileProvider" android:authorities="com.foxdebug.acodex.provider" android:exported="false" android:grantUriPermissions="true">
2222
<meta-data android:name="android.support.FILE_PROVIDER_PATHS" android:resource="@xml/file_provider"/>
2323
</provider>
2424
</config-file>

src/plugins/system/utils/changeProvider.js

Lines changed: 14 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -14,12 +14,23 @@ module.exports = {
1414

1515
try {
1616
const fileData = fs.readFileSync(configXML, "utf8");
17+
const widgetMatch = /<widget\s+id=['"]([^'"]+)['"]/.exec(fileData);
18+
if (!widgetMatch) {
19+
throw new Error("Could not find <widget id> in config.xml");
20+
}
1721
const manifest = fs.readFileSync(androidManifest, "utf8");
18-
const ID = reset ? "com.foxdebug" : /widget id="([0-9a-zA-Z\.\-_]*)"/.exec(fileData)[1];
22+
const ID = widgetMatch[1]; // always use the real id
23+
//const ID = reset ? "com.foxdebug" : /widget id="([0-9a-zA-Z\.\-_]*)"/.exec(fileData)[1];
24+
// const newFileData = manifest.replace(
25+
// /(android:authorities=")([0-9a-zA-Z\.\-_]*)(")/,
26+
// `$1${reset ? "com.foxdebug" : ID}.provider$3`
27+
// );
1928
const newFileData = manifest.replace(
20-
/(android:authorities=")([0-9a-zA-Z\.\-_]*)(")/,
21-
`$1${reset ? "com.foxdebug" : ID}.provider$3`
29+
// Match the FileProvider provider’s authorities attribute only
30+
/(<provider[^>]*android:name="androidx\.core\.content\.FileProvider"[^>]*android:authorities=")[^"]+(")/,
31+
`$1${ID}.provider$2`
2232
);
33+
2334
fs.writeFileSync(androidManifest, newFileData);
2435

2536
const msg = "==== Changed provider to " + ID + ".provider ====";

0 commit comments

Comments
 (0)