Skip to content

Commit a147223

Browse files
authored
🤝 Merge pull request #1 from Instabug/feature/1.9_release
✨ setAutoScreenRecordingEnabled and setAutoScreenRecordingMaxDuration…
2 parents 883bbef + 9e503c6 commit a147223

36 files changed

+202
-91
lines changed

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-
compile 'com.instabug.library:instabug:4.10.0'
24+
compile 'com.instabug.library:instabug:4.10.2'
2525
compile 'com.android.support:multidex:1.0.0'
2626
}

src/android/IBGPlugin.java

Lines changed: 43 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -163,7 +163,13 @@ public boolean execute(final String action, JSONArray args, final CallbackContex
163163
} else if ("setViewHierarchyEnabled".equals(action)) {
164164
setViewHierarchyEnabled(callbackContext, args.optBoolean(0));
165165

166-
} else {
166+
} else if ("setAutoScreenRecordingEnabled".equals(action)) {
167+
setAutoScreenRecordingEnabled(callbackContext, args.optBoolean(0));
168+
169+
} else if ("setAutoScreenRecordingMaxDuration".equals(action)) {
170+
setAutoScreenRecordingMaxDuration(callbackContext, args.optInt(0));
171+
172+
} else {
167173
// Method not found.
168174
return false;
169175
}
@@ -557,6 +563,42 @@ private void setViewHierarchyEnabled(final CallbackContext callbackContext, bool
557563
}
558564
}
559565

566+
/**
567+
* Sets whether the SDK is recording the screen or not.
568+
*
569+
* @param isEnabled A boolean to set auto screen recording to being enabled or disabled.
570+
*
571+
* @param callbackContext
572+
* Used when calling back into JavaScript
573+
*/
574+
private void setAutoScreenRecordingEnabled(final CallbackContext callbackContext, boolean isEnabled) {
575+
try {
576+
Instabug.setAutoScreenRecordingEnabled(isEnabled);
577+
callbackContext.success();
578+
} catch (IllegalStateException e) {
579+
callbackContext.error(errorMsg);
580+
}
581+
}
582+
583+
/**
584+
* Sets maximum auto screen recording video duration.
585+
*
586+
* @param duration maximum duration of the screen recording video seconds
587+
* The maximum duration is 30 seconds
588+
*
589+
* @param callbackContext
590+
* Used when calling back into JavaScript
591+
*/
592+
private void setAutoScreenRecordingMaxDuration(final CallbackContext callbackContext, int duration) {
593+
try {
594+
int durationInMilli = duration * 1000;
595+
Instabug.setAutoScreenRecordingMaxDuration(durationInMilli);
596+
callbackContext.success();
597+
} catch (IllegalStateException e) {
598+
callbackContext.error(errorMsg);
599+
}
600+
}
601+
560602
/**
561603
* Sets user attribute to overwrite it's value or create a new one if it doesn't exist.
562604
*

src/ios/IBGPlugin.m

Lines changed: 46 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -483,6 +483,52 @@ - (void) setViewHierarchyEnabled:(CDVInvokedUrlCommand*)command
483483
[self.commandDelegate sendPluginResult:result callbackId:[command callbackId]];
484484
}
485485

486+
/**
487+
* Sets whether the SDK is recording the screen or not.
488+
*
489+
* @param {CDVInvokedUrlCommand*} command
490+
* The command sent from JavaScript
491+
*/
492+
- (void) setAutoScreenRecordingEnabled:(CDVInvokedUrlCommand*)command
493+
{
494+
CDVPluginResult* result;
495+
496+
BOOL isEnabled = [command argumentAtIndex:0];
497+
498+
if (isEnabled) {
499+
[Instabug setAutoScreenRecordingEnabled:isEnabled];
500+
result = [CDVPluginResult resultWithStatus:CDVCommandStatus_OK];
501+
} else {
502+
result = [CDVPluginResult resultWithStatus:CDVCommandStatus_ERROR
503+
messageAsString:@"A boolean value must be provided."];
504+
}
505+
506+
[self.commandDelegate sendPluginResult:result callbackId:[command callbackId]];
507+
}
508+
509+
/**
510+
* Sets maximum auto screen recording video duration.
511+
*
512+
* @param {CDVInvokedUrlCommand*} command
513+
* The command sent from JavaScript
514+
*/
515+
- (void) setAutoScreenRecordingMaxDuration:(CDVInvokedUrlCommand*)command
516+
{
517+
CDVPluginResult* result;
518+
519+
CGFloat duration = [[command argumentAtIndex:0] floatValue];
520+
521+
if (duration) {
522+
[Instabug setAutoScreenRecordingDuration:duration];
523+
result = [CDVPluginResult resultWithStatus:CDVCommandStatus_OK];
524+
} else {
525+
result = [CDVPluginResult resultWithStatus:CDVCommandStatus_ERROR
526+
messageAsString:@"A duration must be provided."];
527+
}
528+
529+
[self.commandDelegate sendPluginResult:result callbackId:[command callbackId]];
530+
}
531+
486532
/**
487533
* Convenience method for setting the threshold value
488534
* of the shake gesture for iPhone/iPod touch and iPad.

src/ios/Instabug.framework/Headers/Instabug.h

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -5,7 +5,7 @@
55
66
Copyright: (c) 2013-2018 by Instabug, Inc., all rights reserved.
77
8-
Version: 7.9.1
8+
Version: 7.9.2
99
*/
1010

1111
#import <Foundation/Foundation.h>

src/ios/Instabug.framework/Info.plist

0 Bytes
Binary file not shown.

src/ios/Instabug.framework/Instabug

-48.5 KB
Binary file not shown.

src/ios/Instabug.framework/_CodeSignature/CodeResources

Lines changed: 4 additions & 4 deletions
Original file line numberDiff line numberDiff line change
@@ -6,11 +6,11 @@
66
<dict>
77
<key>Headers/Instabug.h</key>
88
<data>
9-
QBpq+Ij2Wm2lDnacn3+fsy3X0pE=
9+
4kxZEeE00REbmUfGg94C3NULVvw=
1010
</data>
1111
<key>Info.plist</key>
1212
<data>
13-
wS/j0NU/yNgCQFnGCA2MArLdDfA=
13+
VKe9NgIDfUhBqsBVFqPK7wnZNKg=
1414
</data>
1515
<key>Modules/module.modulemap</key>
1616
<data>
@@ -23,11 +23,11 @@
2323
<dict>
2424
<key>hash</key>
2525
<data>
26-
QBpq+Ij2Wm2lDnacn3+fsy3X0pE=
26+
4kxZEeE00REbmUfGg94C3NULVvw=
2727
</data>
2828
<key>hash2</key>
2929
<data>
30-
LBpl5bfRVAvQGontLB4zAKs7MNCxFVAFEQgw1lpFNSI=
30+
jm2cECRm9S/pqpKmkItxvSLqsykctBM5sYtNF2GHj0o=
3131
</data>
3232
</dict>
3333
<key>Modules/module.modulemap</key>

src/ios/InstabugCore.framework/Headers/IBGTypes.h

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -5,7 +5,7 @@
55
66
Copyright: (c) 2013-2018 by Instabug, Inc., all rights reserved.
77
8-
Version: 7.9.1
8+
Version: 7.9.2
99
*/
1010

1111
#import <UIKit/UIKit.h>

src/ios/InstabugCore.framework/Headers/InstabugCore.h

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -5,7 +5,7 @@
55
66
Copyright: (c) 2013-2018 by Instabug, Inc., all rights reserved.
77
8-
Version: 7.9.1
8+
Version: 7.9.2
99
*/
1010

1111
#import <Foundation/Foundation.h>
Binary file not shown.
Binary file not shown.
Binary file not shown.
Binary file not shown.
-5 Bytes
Binary file not shown.
Binary file not shown.
Binary file not shown.
Binary file not shown.
Binary file not shown.
Binary file not shown.
3 Bytes
Binary file not shown.
Binary file not shown.
Binary file not shown.
Binary file not shown.
Binary file not shown.
Binary file not shown.
Binary file not shown.
Binary file not shown.
0 Bytes
Binary file not shown.
213 KB
Binary file not shown.
Binary file not shown.
Binary file not shown.
Binary file not shown.
Binary file not shown.

0 commit comments

Comments
 (0)