2
2
NativeModules ,
3
3
NativeAppEventEmitter ,
4
4
DeviceEventEmitter ,
5
- Platform
5
+ Platform ,
6
+ processColor
6
7
} from 'react-native' ;
7
8
let { Instabug } = NativeModules ;
8
9
import InstabugUtils from './utils/InstabugUtils' ;
@@ -89,6 +90,15 @@ const InstabugModule = {
89
90
Instabug . setIBGLogPrintsToConsole ( printsToConsole ) ;
90
91
} ,
91
92
93
+ /**
94
+ * @deprecated use {@link CrashReporting.setCrashReportingEnabled}
95
+ * Report un-caught exceptions to Instabug dashboard
96
+ * We don't send exceptions from __DEV__, since it's way too noisy!
97
+ */
98
+ setCrashReportingEnabled : function ( enableCrashReporter ) {
99
+ Instabug . setCrashReportingEnabled ( enableCrashReporter ) ;
100
+ } ,
101
+
92
102
/**
93
103
* Sets a block of code to be executed when a prompt option is selected.
94
104
* @param {function } didSelectPromptOptionHandler - A block of code that
@@ -125,6 +135,19 @@ const InstabugModule = {
125
135
Instabug . setSessionProfilerEnabled ( sessionProfilerEnabled ) ;
126
136
} ,
127
137
138
+ /**
139
+ * @deprecated use {@link Replies.getUnreadRepliesCount}
140
+ * Returns the number of unread messages the user currently has.
141
+ * Use this method to get the number of unread messages the user
142
+ * has, then possibly notify them about it with your own UI.
143
+ * @param {messageCountCallback } messageCountCallback callback with argument
144
+ * Notifications count, or -1 in case the SDK has not been initialized.
145
+ */
146
+
147
+ getUnreadMessagesCount : function ( messageCountCallback ) {
148
+ Instabug . getUnreadMessagesCount ( messageCountCallback ) ;
149
+ } ,
150
+
128
151
/**
129
152
* Enables/disables the use of push notifications in the SDK.
130
153
* Defaults to YES.
@@ -197,7 +220,7 @@ const InstabugModule = {
197
220
* @param {color } primaryColor A color to set the UI elements of the SDK to.
198
221
*/
199
222
setPrimaryColor : function ( primaryColor ) {
200
- Instabug . setPrimaryColor ( primaryColor ) ;
223
+ Instabug . setPrimaryColor ( primaryColor ) ;
201
224
} ,
202
225
203
226
/**
@@ -471,6 +494,42 @@ const InstabugModule = {
471
494
Instabug . clearAllUserAttributes ( ) ;
472
495
} ,
473
496
497
+ /**
498
+ * @deprecated use {@link Replies.setInAppNotificationsEnabled}
499
+ * Enables/disables showing in-app notifications when the user receives a
500
+ * new message.
501
+ * @param {boolean } isChatNotificationEnabled A boolean to set whether
502
+ * notifications are enabled or disabled.
503
+ */
504
+
505
+ setChatNotificationEnabled : function ( isChatNotificationEnabled ) {
506
+ Instabug . setChatNotificationEnabled ( isChatNotificationEnabled ) ;
507
+ } ,
508
+
509
+ /**
510
+ * @deprecated use {@link Replies.setOnNewReplyReceivedCallback}
511
+ * Sets a block of code that gets executed when a new message is received.
512
+ * @param {function } onNewMessageHandler - A callback that gets
513
+ * executed when a new message is received.
514
+ */
515
+
516
+ setOnNewMessageHandler : function ( onNewMessageHandler ) {
517
+ if ( Platform . OS === 'ios' ) {
518
+ Instabug . addListener ( 'IBGonNewMessageHandler' ) ;
519
+ NativeAppEventEmitter . addListener (
520
+ 'IBGonNewMessageHandler' ,
521
+ onNewMessageHandler
522
+ ) ;
523
+ } else {
524
+ DeviceEventEmitter . addListener (
525
+ 'IBGonNewMessageHandler' ,
526
+ onNewMessageHandler
527
+ ) ;
528
+ }
529
+
530
+ Instabug . setOnNewMessageHandler ( onNewMessageHandler ) ;
531
+ } ,
532
+
474
533
/**
475
534
* @summary Enables/disables inspect view hierarchy when reporting a bug/feedback.
476
535
* @param {boolean } viewHierarchyEnabled A boolean to set whether view hierarchy are enabled
@@ -480,6 +539,21 @@ const InstabugModule = {
480
539
Instabug . setViewHierarchyEnabled ( viewHierarchyEnabled ) ;
481
540
} ,
482
541
542
+ /**
543
+ * @deprecated use {@link Surveys.setEnabled}
544
+ * @summary Sets whether surveys are enabled or not.
545
+ * If you disable surveys on the SDK but still have active surveys on your Instabug dashboard,
546
+ * those surveys are still going to be sent to the device, but are not going to be
547
+ * shown automatically.
548
+ * To manually display any available surveys, call `Instabug.showSurveyIfAvailable()`.
549
+ * Defaults to `true`.
550
+ * @param {boolean } surveysEnabled A boolean to set whether Instabug Surveys is enabled or disabled.
551
+ */
552
+
553
+ setSurveysEnabled : function ( surveysEnabled ) {
554
+ Instabug . setSurveysEnabled ( surveysEnabled ) ;
555
+ } ,
556
+
483
557
/**
484
558
* Enable/Disable debug logs from Instabug SDK
485
559
* Default state: disabled
@@ -512,6 +586,43 @@ const InstabugModule = {
512
586
}
513
587
} ,
514
588
589
+ /**
590
+ * @deprecated use {@link Replies.setInAppNotificationSound}
591
+ * Set whether new in app notification received will play a small sound notification
592
+ * or not (Default is {@code false})
593
+ *
594
+ * @param shouldPlaySound desired state of conversation sounds
595
+ * @since 4.1.0
596
+ */
597
+
598
+ setEnableInAppNotificationSound : function ( shouldPlaySound ) {
599
+ if ( Platform . OS === 'android' ) {
600
+ Instabug . setEnableInAppNotificationSound ( shouldPlaySound ) ;
601
+ }
602
+ } ,
603
+
604
+ /**
605
+ * @deprecated use {@link CrashReporting.reportJSException}
606
+ * Send handled JS error object
607
+ *
608
+ * @param errorObject Error object to be sent to Instabug's servers
609
+ */
610
+
611
+ reportJSException : function ( errorObject ) {
612
+ let jsStackTrace = InstabugUtils . parseErrorStack ( errorObject ) ;
613
+ var jsonObject = {
614
+ message : errorObject . name + ' - ' + errorObject . message ,
615
+ os : Platform . OS ,
616
+ platform : 'react_native' ,
617
+ exception : jsStackTrace
618
+ } ;
619
+ if ( Platform . OS === 'android' ) {
620
+ Instabug . sendHandledJSCrash ( JSON . stringify ( jsonObject ) ) ;
621
+ } else {
622
+ Instabug . sendHandledJSCrash ( jsonObject ) ;
623
+ }
624
+ } ,
625
+
515
626
/**
516
627
* @summary Checks whether app is development/Beta testing OR live
517
628
* Note: This API is iOS only
0 commit comments