Skip to content

Commit 0e6f713

Browse files
committed
💎 Bump version to 8.0.4
2 parents 481779a + 7976c82 commit 0e6f713

File tree

3 files changed

+60
-3
lines changed

3 files changed

+60
-3
lines changed

‎package.json

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -1,6 +1,6 @@
11
{
22
"name": "instabug-cordova",
3-
"version": "8.0.3",
3+
"version": "8.0.4",
44
"description": "The purpose of this plugin is to simplify the process of integrating the Instabug SDK in a hybrid application, as well as to provide an interface to interfacing with the SDK through JavaScript.",
55
"main": "index.js",
66
"repository": {

‎plugin.xml

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -3,7 +3,7 @@
33
<plugin xmlns="http://apache.org/cordova/ns/plugins/1.0"
44
xmlns:android="http://schemas.android.com/apk/res/android"
55
id="instabug-cordova"
6-
version="1.10.0">
6+
version="8.0.4">
77

88
<name>instabug-cordova</name>
99

@@ -82,7 +82,7 @@
8282
<source-file src="src/android/IBGPluginActivity.java" target-dir="src/com/instabug/cordova/plugin"/>
8383
<source-file src="src/android/IBGPlugin.java" target-dir="src/com/instabug/cordova/plugin"/>
8484
<source-file src="src/android/MyApplication.java" target-dir="src/com/instabug/cordova/plugin"/>
85-
85+
<hook type="before_plugin_install" src="scripts/android/before_plugin_install.js"/>
8686
</platform>
8787

8888
<!-- ios -->
Lines changed: 57 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,57 @@
1+
var fs = require('fs');
2+
var path = require('path');
3+
4+
const ibgBuildGradleExists = () => {
5+
var target = path.join('plugins', 'instabug-cordova', 'build.gradle');
6+
return fs.existsSync(target);
7+
};
8+
9+
const readIbgBuildGradle = () => {
10+
var target = path.join('plugins', 'instabug-cordova', 'build.gradle');
11+
return fs.readFileSync(target, 'utf-8');
12+
};
13+
14+
const writeIbgBuildGradle = (contents) => {
15+
var target = path.join('plugins', 'instabug-cordova', 'build.gradle');
16+
fs.writeFileSync(target, contents);
17+
};
18+
19+
const getAndroidVersion = () => {
20+
const target = path.join('config.xml');
21+
let file = fs.readFileSync(target, 'utf-8');
22+
const androidEngine = file.match(/engine name="android" spec="\^[1-9]+.[0-9]+.[0-9]+"/g);
23+
if (androidEngine) {
24+
const version = androidEngine[0].match(/[1-9]+.[0-9]+.[0-9]+/g);
25+
if (version) {
26+
return version[0];
27+
} else {
28+
console.log('Instabug: ', 'Error retrieving cordova-android version.');
29+
30+
}
31+
} else {
32+
console.log(
33+
'Instabug: ',
34+
'Cordova-android not installed. Skipping android preparation steps.'
35+
);
36+
}
37+
};
38+
39+
const isAndroid7 = version => {
40+
if (version) {
41+
const major = parseInt(version.split('.')[0]);
42+
return major >= 7;
43+
}
44+
};
45+
46+
module.exports = function(ctx) {
47+
if (ibgBuildGradleExists) {
48+
let buildGradle = readIbgBuildGradle();
49+
if (isAndroid7(getAndroidVersion())) {
50+
buildGradle = buildGradle.replace(
51+
"manifest.srcFile 'AndroidManifest.xml'",
52+
"manifest.srcFile 'src/main/AndroidManifest.xml'"
53+
);
54+
writeIbgBuildGradle(buildGradle);
55+
}
56+
}
57+
};

0 commit comments

Comments
 (0)