@@ -516,6 +516,127 @@ module.exports = {
516
516
instabugUtils . captureJsErrors ( ) ;
517
517
} ,
518
518
519
+ /**
520
+ * Add file to attached files with each report being sent.
521
+ * A new copy of the file at fileURL will be attached with each bug report being sent. The file is only copied
522
+ * at the time of sending the report, so you could safely call this API whenever the file is available on disk, and the copy
523
+ * attached to your bug reports will always contain that latest changes at the time of sending the report.
524
+ *
525
+ * Each call to this method adds the file to the files attached, until a maximum of 3 then it overrides the first file.
526
+ * The file has to be available locally at the provided path when the report is being sent.
527
+ * @param {string } stringURL Path to a file that's going to be attached to each report.
528
+ */
529
+
530
+ // addFileAttachment: function(stringURL) {
531
+ // if (Platform.OS == 'ios') {
532
+ // Instabug.addFileAttachment(stringURL);
533
+ // }
534
+ // },
535
+
536
+ /**
537
+ * Clear list of files to be attached with each report.
538
+ * This method doesn't delete any files from the file system. It will just removes them for the list of files
539
+ * to be attached with each report.
540
+ */
541
+
542
+ // clearFileAttachments: function() {
543
+ // if (Platform.OS == 'ios') {
544
+ // Instabug.clearFileAttachments();
545
+ // }
546
+ // },
547
+
548
+ /**
549
+ * Shows/Hides email field.
550
+ * Defaults to show email field.
551
+ * @param {boolean } shouldShowEmailField true to show the email field, false to hide it.
552
+ */
553
+ setShowEmailField : function ( shouldShowEmailField ) {
554
+ if ( Platform . OS == 'ios' ) {
555
+ Instabug . setShowEmailField ( ) ;
556
+ }
557
+ } ,
558
+
559
+ /**
560
+ * Sets the default value of the user's email and hides the email field from the reporting UI
561
+ * and set the user's name to be included with all reports.
562
+ * It also reset the chats on device to that email and removes user attributes, user data and completed surveys.
563
+ * @param {string } email Email address to be set as the user's email.
564
+ * @param {string } name Name of the user to be set.
565
+ */
566
+ identifyUserWithEmail : function ( email , name ) {
567
+ if ( Platform . OS == 'ios' ) {
568
+ Instabug . identifyUserWithEmail ( email , name ) ;
569
+ }
570
+ } ,
571
+
572
+ /**
573
+ * Sets the default value of the user's email to nil and show email field and remove user name from all reports
574
+ * It also reset the chats on device and removes user attributes, user data and completed surveys.
575
+ */
576
+ logOut : function ( ) {
577
+ if ( Platform . OS == 'ios' ) {
578
+ Instabug . logOut ( ) ;
579
+ }
580
+ } ,
581
+
582
+ /**
583
+ * Sets whether to show a "Thank You" dialog after a bug report is sent or not.
584
+ * Defaults to YES.
585
+ * @param {boolean } isPostSendingDialogEnabled A boolean to indicate whether the dialog is enabled or not.
586
+ */
587
+ setPostSendingDialogEnabled : function ( isPostSendingDialogEnabled ) {
588
+ if ( Platform . OS == 'ios' ) {
589
+ Instabug . setPostSendingDialogEnabled ( isPostSendingDialogEnabled ) ;
590
+ }
591
+ } ,
592
+
593
+ /**
594
+ * Sets an array of report categories to be shown for users to select from before reporting a bug or sending
595
+ * feedback.
596
+ * Use this method to give users a list of choices of categories their bug report or feedback might be related
597
+ * to. Selected category will be shown as a tag on your dashboard.
598
+ * @param {array } titles titles to be shown in the list.
599
+ * @param {array } name names of icons to be shown along with titles. Use the same names you would use
600
+ */
601
+ setReportCategories : function ( titles , names ) {
602
+ if ( Platform . OS == 'ios' ) {
603
+ Instabug . setReportCategories ( titles , names ) ;
604
+ }
605
+ } ,
606
+
607
+ /**
608
+ * Enables/disables inspect view hierarchy when reporting a bug/feedback.
609
+ * @param {boolean } viewHierarchyEnabled A boolean to set whether view hierarchy are enabled or disabled.
610
+ */
611
+ setViewHierarchyEnabled : function ( viewHierarchyEnabled ) {
612
+ if ( Platform . OS == 'ios' ) {
613
+ Instabug . setViewHierarchyEnabled ( viewHierarchyEnabled ) ;
614
+ }
615
+ } ,
616
+
617
+ /**
618
+ * Logs a user event that happens through the lifecycle of the application.
619
+ * Logged user events are going to be sent with each report, as well as at the end of a session.
620
+ * @param {string } name Event name.
621
+ */
622
+ logUserEventWithName : function ( name ) {
623
+ if ( Platform . OS == 'ios' ) {
624
+ Instabug . logUserEventWithName ( name ) ;
625
+ }
626
+ } ,
627
+
628
+ /**
629
+ * Logs a user event that happens through the lifecycle of the application.
630
+ * Logged user events are going to be sent with each report, as well as at the end of a session.
631
+ * @param {string } name Event name.
632
+ * @param {Object } params An optional dictionary or parameters to be associated with the event.
633
+ */
634
+ logUserEventWithNameAndParams : function ( name , params ) {
635
+ if ( Platform . OS == 'ios' ) {
636
+ Instabug . logUserEventWithNameAndParams ( name , params ) ;
637
+ }
638
+ } ,
639
+
519
640
/**
520
641
* Appends a log message to Instabug internal log
521
642
* <p>
@@ -529,10 +650,12 @@ module.exports = {
529
650
*
530
651
* @param message the message
531
652
*/
532
- logV ( message ) {
653
+ logVerbose : function ( message ) {
533
654
if ( ! message ) return ;
534
655
if ( Platform . OS === 'android' ) {
535
656
Instabug . log ( "v" , message ) ;
657
+ } else {
658
+ Instabug . logVerbose ( message ) ;
536
659
}
537
660
} ,
538
661
@@ -549,10 +672,12 @@ module.exports = {
549
672
*
550
673
* @param message the message
551
674
*/
552
- logI ( message ) {
675
+ logInfo : function ( message ) {
553
676
if ( ! message ) return ;
554
677
if ( Platform . OS === 'android' ) {
555
678
Instabug . log ( "i" , message ) ;
679
+ } else {
680
+ Instabug . logInfo ( message ) ;
556
681
}
557
682
} ,
558
683
@@ -569,10 +694,12 @@ module.exports = {
569
694
*
570
695
* @param message the message
571
696
*/
572
- logD ( message ) {
697
+ logDebug : function ( message ) {
573
698
if ( ! message ) return ;
574
699
if ( Platform . OS === 'android' ) {
575
700
Instabug . log ( "d" , message ) ;
701
+ } else {
702
+ Instabug . logDebug ( message ) ;
576
703
}
577
704
} ,
578
705
@@ -589,10 +716,12 @@ module.exports = {
589
716
*
590
717
* @param message the message
591
718
*/
592
- logE ( message ) {
719
+ logError : function ( message ) {
593
720
if ( ! message ) return ;
594
721
if ( Platform . OS === 'android' ) {
595
722
Instabug . log ( "e" , message ) ;
723
+ } else {
724
+ Instabug . logError ( message ) ;
596
725
}
597
726
} ,
598
727
@@ -609,10 +738,12 @@ module.exports = {
609
738
*
610
739
* @param message the message
611
740
*/
612
- logW ( message ) {
741
+ logWarn : function ( message ) {
613
742
if ( ! message ) return ;
614
743
if ( Platform . OS === 'android' ) {
615
744
Instabug . log ( "w" , message ) ;
745
+ } else {
746
+ Instabug . logWarn ( message ) ;
616
747
}
617
748
} ,
618
749
@@ -640,7 +771,7 @@ module.exports = {
640
771
* Clears Instabug internal log
641
772
*
642
773
*/
643
- clearLogs ( ) {
774
+ clearLogs : function ( ) {
644
775
if ( Platform . OS === 'android' ) {
645
776
Instabug . clearLogs ( ) ;
646
777
}
@@ -652,7 +783,7 @@ module.exports = {
652
783
* @param key the attribute
653
784
* @param value the value
654
785
*/
655
- setUserAttribute ( key , value ) {
786
+ setUserAttribute : function ( key , value ) {
656
787
if ( ! key || ! value || typeof key !== "string" || typeof value !== "string" )
657
788
throw new TypeError ( "Invalid param, Expected String" ) ;
658
789
if ( Platform . OS === 'android' ) {
@@ -661,16 +792,20 @@ module.exports = {
661
792
} ,
662
793
663
794
/**
664
- * Gets specific user attribute.
665
- *
666
- * @param key the attribute key as string
667
- * @return the desired user attribute
795
+ * return callback
796
+ * @callback userAttributeCallback
797
+ * @param {string } value for key in user attributes.
668
798
*/
669
- getUserAttribute ( key ) {
670
- if ( ! key || typeof key !== "string" )
671
- throw new TypeError ( "Invalid param, Expected String" ) ;
672
- if ( Platform . OS === 'android' ) {
673
- return Instabug . getUserAttribute ( key ) ;
799
+
800
+ /**
801
+ * Returns the user attribute associated with a given key.
802
+ aKey
803
+ * @param {string } key The attribute key as string
804
+ * @param {userAttributeCallback } userAttributeCallback callback with argument as the desired user attribute value
805
+ */
806
+ getUserAttribute : function ( key , userAttributeCallback ) {
807
+ if ( Platform . OS === 'ios' ) {
808
+ return Instabug . getUserAttribute ( key , userAttributeCallback ) ;
674
809
}
675
810
} ,
676
811
@@ -680,7 +815,7 @@ module.exports = {
680
815
* @param key the attribute key as string
681
816
* @see #setUserAttribute(String, String)
682
817
*/
683
- removeUserAttribute ( key ) {
818
+ removeUserAttribute : function ( key ) {
684
819
if ( ! key || typeof key !== "string" )
685
820
throw new TypeError ( "Invalid param, Expected String" ) ;
686
821
if ( Platform . OS === 'android' ) {
@@ -689,20 +824,26 @@ module.exports = {
689
824
} ,
690
825
691
826
/**
692
- * Gets all saved user attributes.
693
- *
694
- * @return all user attributes as HashMap<String, String>
827
+ * return callback
828
+ * @callback userAttributesCallback
829
+ * @param { Object } userAttributes Dictionary of the user attributes.
695
830
*/
696
- getAllUserAttributes ( ) {
697
- if ( Platform . OS === 'android' ) {
698
- return Instabug . getAllUserAttributes ( ) ;
831
+
832
+ /**
833
+ * @summary Returns all user attributes.
834
+ * @param {userAttributesCallback } userAttributesCallback callback with argument A new dictionary containing all the currently set user attributes,
835
+ * or an empty dictionary if no user attributes have been set.
836
+ */
837
+ getAllUserAttributes : function ( userAttributesCallback ) {
838
+ if ( Platform . OS === 'ios' ) {
839
+ return Instabug . getAllUserAttributes ( userAttributesCallback ) ;
699
840
}
700
841
} ,
701
842
702
843
/**
703
844
* Clears all user attributes if exists.
704
845
*/
705
- clearAllUserAttributes ( ) {
846
+ clearAllUserAttributes : function ( ) {
706
847
if ( Platform . OS === 'android' ) {
707
848
Instabug . clearAllUserAttributes ( ) ;
708
849
}
@@ -717,7 +858,7 @@ module.exports = {
717
858
none : Instabug . invocationEventNone ,
718
859
shake : Instabug . invocationEventShake ,
719
860
screenshot : Instabug . invocationEventScreenshot ,
720
- twoFingersSwipe : Instabug . invocationEventTwoFingersSwipe ,
861
+ twoFingersSwipe : Instabug . invocationEventTwoFingersSwipeLeft ,
721
862
floatingButton : Instabug . invocationEventFloatingButton
722
863
} ,
723
864
0 commit comments