From 728b07647ad66c11a3250be6c5c1584cd9e12ccb Mon Sep 17 00:00:00 2001 From: Salma ElTarzi Date: Tue, 13 Feb 2018 20:45:02 +0200 Subject: [PATCH] =?UTF-8?q?=E2=9C=A8=20setAutoScreenRecordingMaxDuration?= =?UTF-8?q?=20and=20setAutoScreenRecordingEnabled=20APIs?= MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit --- .../RNInstabugReactnativeModule.java | 31 +++++++++++++++++++ index.js | 20 ++++++++++++ ios/RNInstabug/InstabugReactBridge.m | 8 +++++ 3 files changed, 59 insertions(+) diff --git a/android/src/main/java/com/instabug/reactlibrary/RNInstabugReactnativeModule.java b/android/src/main/java/com/instabug/reactlibrary/RNInstabugReactnativeModule.java index db83219..80e274b 100644 --- a/android/src/main/java/com/instabug/reactlibrary/RNInstabugReactnativeModule.java +++ b/android/src/main/java/com/instabug/reactlibrary/RNInstabugReactnativeModule.java @@ -233,6 +233,37 @@ public class RNInstabugReactnativeModule extends ReactContextBaseJavaModule { } } + /** + * Enable/Disable screen recording + * + * @param autoScreenRecordingEnabled boolean for enable/disable + * screen recording on crash feature + */ + @ReactMethod + public void setAutoScreenRecordingEnabled(boolean autoScreenRecordingEnabled) { + try { + Instabug.setAutoScreenRecordingEnabled(autoScreenRecordingEnabled); + } catch (Exception e) { + e.printStackTrace(); + } + } + + /** + * Sets auto screen recording maximum duration + * + * @param autoScreenRecordingMaxDuration maximum duration of the screen recording video + * in milliseconds + * The maximum duration is 30000 milliseconds + */ + @ReactMethod + public void setAutoScreenRecordingMaxDuration(int autoScreenRecordingMaxDuration) { + try { + Instabug.setAutoScreenRecordingMaxDuration(autoScreenRecordingMaxDuration); + } catch (Exception e) { + e.printStackTrace(); + } + } + /** * Change Locale of Instabug UI elements(defaults to English) * diff --git a/index.js b/index.js index 1de6028..8c75a9e 100644 --- a/index.js +++ b/index.js @@ -60,6 +60,26 @@ module.exports = { Instabug.setUserData(userData); }, + /** + * Enable/Disable screen recording + * @param {boolean} autoScreenRecordingEnabled boolean for enable/disable + * screen recording on crash feature + */ + setAutoScreenRecordingEnabled: function(autoScreenRecordingEnabled) { + Instabug.setAutoScreenRecordingEnabled(autoScreenRecordingEnabled); + }, + + /** + * Sets auto screen recording maximum duration + * + * @param autoScreenRecordingMaxDuration maximum duration of the screen recording video + * in milliseconds + * The maximum duration is 30000 milliseconds + */ + setAutoScreenRecordingMaxDuration: function(autoScreenRecordingMaxDuration) { + Instabug.setAutoScreenRecordingMaxDuration(autoScreenRecordingMaxDuration) + }, + /** * Adds custom logs that will be sent with each report. * @param {string} log Message to be logged. diff --git a/ios/RNInstabug/InstabugReactBridge.m b/ios/RNInstabug/InstabugReactBridge.m index 8335837..08c41e5 100644 --- a/ios/RNInstabug/InstabugReactBridge.m +++ b/ios/RNInstabug/InstabugReactBridge.m @@ -78,6 +78,14 @@ RCT_EXPORT_METHOD(setUserStepsEnabled:(BOOL)isUserStepsEnabled) { [Instabug setUserStepsEnabled:isUserStepsEnabled]; } +RCT_EXPORT_METHOD(setAutoScreenRecordingEnabled:(BOOL)enabled) { + [Instabug setAutoScreenRecordingEnabled:enabled]; +} + +RCT_EXPORT_METHOD(setAutoScreenRecordingMaxDuration:(CGFloat)duration) { + [Instabug setAutoScreenRecordingDuration:duration]; +} + RCT_EXPORT_METHOD(setPreSendingHandler:(RCTResponseSenderBlock)callBack) { if (callBack != nil) { [Instabug setPreSendingHandler:^{