File tree Expand file tree Collapse file tree 2 files changed +14
-7
lines changed
android/src/main/java/com/instabug/reactlibrary Expand file tree Collapse file tree 2 files changed +14
-7
lines changed Original file line number Diff line number Diff line change 10
10
import com .facebook .react .bridge .ReadableMap ;
11
11
import com .facebook .react .bridge .WritableArray ;
12
12
import com .facebook .react .bridge .WritableNativeArray ;
13
+ import com .facebook .react .bridge .WritableMap ;
14
+ import com .facebook .react .bridge .WritableNativeMap ;
13
15
import com .facebook .react .bridge .Callback ;
14
16
15
17
import com .instabug .library .Instabug ;
@@ -676,8 +678,17 @@ public void removeUserAttribute(String key) {
676
678
* @return all user attributes as HashMap<String, String>
677
679
*/
678
680
@ ReactMethod
679
- public HashMap <String , String > getAllUserAttributes () {
680
- return mInstabug .getAllUserAttributes ();
681
+ public void getAllUserAttributes (Callback userAttributesCallback ) {
682
+ WritableMap writableMap = new WritableNativeMap ();
683
+ try {
684
+ HashMap <String , String > map = mInstabug .getAllUserAttributes ();
685
+ for (HashMap .Entry <String , String > entry : map .entrySet ()) {
686
+ writableMap .putString (entry .getKey (), entry .getValue ());
687
+ }
688
+ } catch (Exception e ) {
689
+ e .printStackTrace ();
690
+ }
691
+ userAttributesCallback .invoke (writableMap );
681
692
}
682
693
683
694
/**
Original file line number Diff line number Diff line change @@ -631,11 +631,7 @@ module.exports = {
631
631
* or an empty dictionary if no user attributes have been set.
632
632
*/
633
633
getAllUserAttributes : function ( userAttributesCallback ) {
634
- if ( Platform . OS === 'ios' ) {
635
- return Instabug . getAllUserAttributes ( userAttributesCallback ) ;
636
- } else if ( Platform . OS === 'android' ) {
637
- return Instabug . getAllUserAttributes ( ) ;
638
- }
634
+ Instabug . getAllUserAttributes ( userAttributesCallback ) ;
639
635
} ,
640
636
641
637
/**
You can’t perform that action at this time.
0 commit comments