Skip to content

Commit e3c7cb7

Browse files
authored
Release 9.0.5 (#91)
1 parent 101e297 commit e3c7cb7

File tree

156 files changed

+1928
-440
lines changed

Some content is hidden

Large Commits have some content hidden by default. Use the searchbox below for content that may be hidden.

156 files changed

+1928
-440
lines changed

CHANGELOG.md

Lines changed: 4 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -1,3 +1,7 @@
1+
## v9.0.0 (2020-03-10)
2+
3+
* Bump native SDKs to v9
4+
15
## v8.6.5 (2019-09-06)
26

37
* Fixes various android issues

README.md

Lines changed: 53 additions & 21 deletions
Original file line numberDiff line numberDiff line change
@@ -1,5 +1,4 @@
1-
Instabug Cordova Plugin
2-
=================================
1+
# Instabug Cordova Plugin
32

43
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 interact with the SDK through JavaScript.
54

@@ -8,28 +7,69 @@ Instabug is a bug reporting and in-app feedback tool that provides your testers
87
For more info, visit [Instabug.com](https://instabug.com).
98

109
### Installation
10+
1111
Currently, this plugin can only be installed via the Command-Line Interface.
12+
1213
```
1314
cordova plugin add instabug-cordova
1415
```
16+
1517
##### Ionic
18+
1619
If you're using this plugin with Ionic, you can install using this command.
20+
1721
```
1822
ionic cordova plugin add instabug-cordova
1923
```
2024

2125
## Usage
22-
1. You can initialize the SDK by using this method in your JS class
26+
27+
To initialize Instabug in your app, you need to do the following:
28+
29+
### Android
30+
31+
1. Change the name of the application class in your AndroidManifest.xml file to `android:name="com.instabug.cordova.plugin.MyApplication"`.
32+
33+
Starting from _Cordova Android v7.0.0_ `AndroidManifest.xml` location has been changed and its new path now is `app/src/main/AndroidManifest.xml` ([read more](http://cordova.apache.org/announcements/2017/12/04/cordova-android-7.0.0.html)).
34+
35+
If you're using _Cordova Android v7+, please make sure you update its location inside Cordova's `build.gradle` file at `platforms/android/CordovaLib/build.gradle`:
36+
37+
```
38+
sourceSets {
39+
main {
40+
manifest.srcFile 'src/main/AndroidManifest.xml'
41+
}
42+
}
43+
```
44+
45+
2. You need to add your app token in the **MyApplication** class, by replacing `YOUR_ANDROID_TOKEN`. (You can find this class under this path `YourProjectName/platforms/android/app/src/main/java/com.instabug.cordova.plugin/MyApplication.java`)
46+
47+
3. You can change the invocation event by changing this line `InstabugInvocationEvent.SHAKE` in the **MyApplication** class to any of the following:
48+
49+
`InstabugInvocationEvent.FLOATING_BUTTON`, `InstabugInvocationEvent.SCREENSHOT_GESTURE`, `InstabugInvocationEvent.TWO_FINGER_SWIPE_LEFT`, or `InstabugInvocationEvent.NONE`.
50+
51+
4. Make sure the following snippet is added to your project level `build.gradle`, if not you can manually add it as follows:.
52+
53+
```dart
54+
allprojects {
55+
repositories {
56+
maven {
57+
url "https://sdks.instabug.com/nexus/repository/instabug-cp"
58+
}
59+
}
60+
}
61+
```
62+
63+
### iOS
64+
65+
You can initialize the SDK by using this method in your JS class
66+
2367
```
2468
cordova.plugins.instabug.activate(
2569
{
26-
token: 'MY_TOKEN'
70+
ios: 'MY_IOS_TOKEN'
2771
},
2872
'shake',
29-
{
30-
commentRequired: true,
31-
colorTheme: 'dark'
32-
},
3373
function () {
3474
console.log('Instabug initialized.');
3575
},
@@ -38,20 +78,12 @@ cordova.plugins.instabug.activate(
3878
}
3979
);
4080
```
41-
You can change the invocation event with any of the following: ```'button'```, ```'screenshot'```, ```'swipe'```, or ```'shake'```.
4281

43-
2. Make sure the following snippet is added to your project level `build.gradle`, if not you can manually add it as follows:.
44-
```dart
45-
allprojects {
46-
repositories {
47-
maven {
48-
url "https://sdks.instabug.com/nexus/repository/instabug-cp"
49-
}
50-
}
51-
}
52-
```
53-
##### TypeScript
54-
If you're using this plugin with TypeScript, you need to add this line at the beginning of your __app.component.ts__ class.
82+
You can change the invocation event with any of the following: `'button'`, `'screenshot'`, `'swipe'`, or `'shake'`.
83+
84+
##### Ionic
85+
86+
If you're using this plugin with Ionic, you need to add this line at the beginning of your **app.component.ts** class.
5587

5688
```
5789
declare let cordova: any;

build.gradle

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -21,6 +21,6 @@ android {
2121
}
2222

2323
dependencies {
24-
implementation 'com.instabug.library:instabug:8.6.3.0'
24+
implementation 'com.instabug.library:instabug:9.0.5.5'
2525
implementation 'com.android.support:multidex:1.0.0'
2626
}

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.6.5",
3+
"version": "9.0.0",
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: 3 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -87,10 +87,10 @@
8787

8888
<source-file src="src/android/IBGPluginActivity.java" target-dir="src/com/instabug/cordova/plugin"/>
8989
<source-file src="src/android/IBGPlugin.java" target-dir="src/com/instabug/cordova/plugin"/>
90-
<!-- <source-file src="src/android/MyApplication.java" target-dir="src/com/instabug/cordova/plugin"/> -->
90+
<source-file src="src/android/MyApplication.java" target-dir="src/com/instabug/cordova/plugin"/>
9191
<source-file src="src/android/util/Util.java" target-dir="src/com/instabug/cordova/plugin/util"/>
92-
<hook type="before_plugin_install" src="scripts/android/link_gradle.js"/>
93-
<hook type="before_plugin_uninstall" src="scripts/android/unlink_gradle.js"/>
92+
<hook type="before_plugin_install" src="scripts/android/before_plugin_install.js"/>
93+
<hook type="before_plugin_uninstall" src="scripts/android/before_plugin_uninstall.js"/>
9494
</platform>
9595

9696
<!-- ios -->

sampleApp/config.xml

Lines changed: 3 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -23,4 +23,7 @@
2323
<allow-intent href="itms:*" />
2424
<allow-intent href="itms-apps:*" />
2525
</platform>
26+
<platform name="android">
27+
<preference name="android-targetSdkVersion" value="29" />
28+
</platform>
2629
</widget>

sampleApp/platforms/android/app/src/main/AndroidManifest.xml

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -9,5 +9,5 @@
99
</intent-filter>
1010
</activity>
1111
</application>
12-
<uses-sdk android:targetSdkVersion="28" />
12+
<uses-sdk android:targetSdkVersion="29" />
1313
</manifest>

sampleApp/platforms/android/build.gradle

Lines changed: 3 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -45,10 +45,10 @@ allprojects {
4545

4646
//This replaces project.properties w.r.t. build settings
4747
project.ext {
48-
defaultBuildToolsVersion="28.0.3" //String
48+
defaultBuildToolsVersion="29.0.0" //String
4949
defaultMinSdkVersion=19 //Integer - Minimum requirement is Android 4.4
50-
defaultTargetSdkVersion=28 //Integer - We ALWAYS target the latest by default
51-
defaultCompileSdkVersion=28 //Integer - We ALWAYS compile with the latest by default
50+
defaultTargetSdkVersion=29 //Integer - We ALWAYS target the latest by default
51+
defaultCompileSdkVersion=29 //Integer - We ALWAYS compile with the latest by default
5252
}
5353
}
5454

sampleApp/platforms/android/project.properties

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -8,6 +8,6 @@
88
# This is the application project. This is only required for Android Studio Gradle projects
99

1010
# Project target.
11-
target=android-28
11+
target=android-29
1212
android.library.reference.1=CordovaLib
1313
android.library.reference.2=app

sampleApp/platforms/ios/HelloCordovaUITest/HelloCordovaUITest.m

Lines changed: 1 addition & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -21,8 +21,7 @@ - (void)setUp {
2121
- (void)testInstabugSendBugReport {
2222

2323
XCUIApplication *app = [[XCUIApplication alloc] init];
24-
XCUIElement *ibgfloatingbuttonaccessibilityidentifierElement = app/*@START_MENU_TOKEN@*/.otherElements[@"IBGFloatingButtonAccessibilityIdentifier"]/*[[".otherElements[@\"Floating Button\"]",".otherElements[@\"IBGFloatingButtonAccessibilityIdentifier\"]"],[[[-1,1],[-1,0]]],[0]]@END_MENU_TOKEN@*/;
25-
[ibgfloatingbuttonaccessibilityidentifierElement tap];
24+
[app/*@START_MENU_TOKEN@*/.buttons[@"IBGFloatingButtonAccessibilityIdentifier"]/*[[".windows[@\"Floating button window\"]",".buttons[@\"Floating Button\"]",".buttons[@\"IBGFloatingButtonAccessibilityIdentifier\"]"],[[[-1,2],[-1,1],[-1,0,1]],[[-1,2],[-1,1]]],[0]]@END_MENU_TOKEN@*/ tap];
2625
[app.tables.staticTexts[@"Report a bug"] tap];
2726

2827
XCUIElement *textField = app.scrollViews.otherElements.textFields[@"IBGBugInputViewEmailFieldAccessibilityIdentifier"];

sampleApp/www/js/index.js

Lines changed: 47 additions & 38 deletions
Original file line numberDiff line numberDiff line change
@@ -17,47 +17,56 @@
1717
* under the License.
1818
*/
1919
var app = {
20-
// Application Constructor
21-
initialize: function() {
22-
document.addEventListener('deviceready', this.onDeviceReady.bind(this), false);
23-
},
20+
// Application Constructor
21+
initialize: function() {
22+
document.addEventListener(
23+
"deviceready",
24+
this.onDeviceReady.bind(this),
25+
false
26+
);
27+
},
2428

25-
// deviceready Event Handler
26-
//
27-
// Bind any cordova events here. Common events are:
28-
// 'pause', 'resume', etc.
29-
onDeviceReady: function() {
30-
this.receivedEvent('deviceready');
31-
cordova.plugins.instabug.activate(
32-
{
33-
token: 'cb518c145decef204b0735cb7efa6016'
34-
},
35-
cordova.plugins.bugReporting.invocationEvents.button,
36-
{
37-
commentRequired: true,
38-
colorTheme: 'light',
39-
enableIntroDialog: false
40-
},
41-
function () {
42-
console.log('Instabug initialized.');
43-
},
44-
function (error) {
45-
console.log('Instabug could not be initialized - ' + error);
46-
}
47-
);
48-
},
29+
// deviceready Event Handler
30+
//
31+
// Bind any cordova events here. Common events are:
32+
// 'pause', 'resume', etc.
33+
onDeviceReady: function() {
34+
this.receivedEvent("deviceready");
35+
cordova.plugins.instabug.activate(
36+
{
37+
ios: "cb518c145decef204b0735cb7efa6016"
38+
},
39+
cordova.plugins.bugReporting.invocationEvents.button,
40+
{
41+
commentRequired: true,
42+
colorTheme: "light",
43+
enableIntroDialog: false
44+
},
45+
function() {
46+
console.log("Instabug initialized.");
47+
},
48+
function(error) {
49+
console.log("Instabug could not be initialized - " + error);
50+
}
51+
);
52+
cordova.plugins.bugReporting.setInvocationEvents(
53+
[cordova.plugins.bugReporting.invocationEvents.button],
54+
function() {},
55+
function(error) {}
56+
);
57+
},
4958

50-
// Update DOM on a Received Event
51-
receivedEvent: function(id) {
52-
var parentElement = document.getElementById(id);
53-
var listeningElement = parentElement.querySelector('.listening');
54-
var receivedElement = parentElement.querySelector('.received');
59+
// Update DOM on a Received Event
60+
receivedEvent: function(id) {
61+
var parentElement = document.getElementById(id);
62+
var listeningElement = parentElement.querySelector(".listening");
63+
var receivedElement = parentElement.querySelector(".received");
5564

56-
listeningElement.setAttribute('style', 'display:none;');
57-
receivedElement.setAttribute('style', 'display:block;');
65+
listeningElement.setAttribute("style", "display:none;");
66+
receivedElement.setAttribute("style", "display:block;");
5867

59-
console.log('Received Event: ' + id);
60-
}
68+
console.log("Received Event: " + id);
69+
}
6170
};
6271

63-
app.initialize();
72+
app.initialize();

scripts/android/before_plugin_install.js

Lines changed: 1 addition & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -1,6 +1,7 @@
11
var fs = require('fs');
22
var path = require('path');
33
const editManist = require('./edit_manifest');
4+
require('./link_gradle');
45

56
const ibgBuildGradleExists = () => {
67
var target = path.join('plugins', 'instabug-cordova', 'build.gradle');
Lines changed: 2 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -1,4 +1,6 @@
11
const editManifest = require('./edit_manifest');
2+
require('./unlink_gradle');
3+
24
module.exports = (ctx) => {
35
return editManifest(ctx, false);
46
}

src/android/IBGPlugin.java

Lines changed: 8 additions & 18 deletions
Original file line numberDiff line numberDiff line change
@@ -8,7 +8,6 @@
88
import android.util.Log;
99

1010
import com.instabug.bug.BugReporting;
11-
import com.instabug.bug.invocation.InvocationOption;
1211
import com.instabug.bug.invocation.Option;
1312
import com.instabug.chat.Chats;
1413
import com.instabug.chat.Replies;
@@ -232,21 +231,7 @@ public void startWithToken(final CallbackContext callbackContext, JSONArray args
232231
*
233232
* @param callbackContext Used when calling back into JavaScript
234233
*/
235-
public void activate(final CallbackContext callbackContext, JSONArray args) {
236-
try {
237-
activationIntent.putExtra("token", args.optJSONObject(0).getString("token"));
238-
} catch (JSONException e) {
239-
callbackContext.error("An application token must be provided.");
240-
return;
241-
}
242-
243-
try {
244-
activationIntent.putExtra("invocation", args.getString(1));
245-
} catch (JSONException e) {
246-
callbackContext.error("An invocation event must be provided.");
247-
return;
248-
}
249-
234+
private void activate(final CallbackContext callbackContext, JSONArray args) {
250235
this.options = args.optJSONObject(2);
251236
if (options != null) {
252237
// Attach extras
@@ -666,7 +651,7 @@ public void clearLog(final CallbackContext callbackContext) {
666651
public void setInvocationEvents(final CallbackContext callbackContext, JSONArray args) {
667652
JSONArray events = args.optJSONArray(0);
668653
String[] stringArrayOfEvents = toStringArray(events);
669-
ArrayList<InstabugInvocationEvent> invocationEvents = new ArrayList<InstabugInvocationEvent>();
654+
final ArrayList<InstabugInvocationEvent> invocationEvents = new ArrayList<InstabugInvocationEvent>();
670655
if(stringArrayOfEvents.length != 0) {
671656
try {
672657
for (String event : stringArrayOfEvents) {
@@ -696,7 +681,12 @@ public void setInvocationEvents(final CallbackContext callbackContext, JSONArray
696681
callbackContext.error("A valid event type must be provided.");
697682
}
698683
}
699-
BugReporting.setInvocationEvents(invocationEvents.toArray(new InstabugInvocationEvent[0]));
684+
new Handler(Looper.getMainLooper()).post(new Runnable() {
685+
@Override
686+
public void run() {
687+
BugReporting.setInvocationEvents(invocationEvents.toArray(new InstabugInvocationEvent[0]));
688+
}
689+
});
700690
} catch (IllegalStateException e) {
701691
callbackContext.error(errorMsg);
702692
}

src/android/IBGPluginActivity.java

Lines changed: 0 additions & 21 deletions
Original file line numberDiff line numberDiff line change
@@ -9,19 +9,11 @@
99
import com.instabug.library.Feature;
1010
import com.instabug.library.Instabug;
1111
import com.instabug.library.InstabugColorTheme;
12-
import com.instabug.library.bugreporting.model.Bug;
13-
import com.instabug.library.invocation.InstabugInvocationEvent;
1412
import com.instabug.library.invocation.util.InstabugFloatingButtonEdge;
1513
import com.instabug.library.ui.onboarding.WelcomeMessage;
1614

1715
import org.apache.cordova.CordovaActivity;
1816

19-
import static com.instabug.cordova.plugin.IBGPlugin.parseInvocationEvent;
20-
import static com.instabug.library.invocation.InstabugInvocationEvent.FLOATING_BUTTON;
21-
import static com.instabug.library.invocation.InstabugInvocationEvent.NONE;
22-
import static com.instabug.library.invocation.InstabugInvocationEvent.SCREENSHOT;
23-
import static com.instabug.library.invocation.InstabugInvocationEvent.SHAKE;
24-
import static com.instabug.library.invocation.InstabugInvocationEvent.TWO_FINGER_SWIPE_LEFT;
2517

2618
public class IBGPluginActivity extends CordovaActivity
2719
{
@@ -41,19 +33,6 @@ public void onCreate(Bundle savedInstanceState) {
4133
// Retrieve initialization options
4234
Bundle options = getIntent().getExtras();
4335

44-
InstabugInvocationEvent invocationEvent = SHAKE;
45-
String token = options.getString("token");
46-
invocationEvent = parseInvocationEvent(options.getString("invocation"));
47-
48-
49-
new Instabug.Builder(
50-
this.getApplication(),
51-
token).build();
52-
53-
if (invocationEvent != null)
54-
BugReporting.setInvocationEvents(invocationEvent);
55-
56-
5736
// Apply initialization options
5837
if(options != null) {
5938
setBuilderOptions(options);

0 commit comments

Comments
 (0)