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 1010import com .facebook .react .bridge .ReadableMap ;
1111import com .facebook .react .bridge .WritableArray ;
1212import com .facebook .react .bridge .WritableNativeArray ;
13+ import com .facebook .react .bridge .WritableMap ;
14+ import com .facebook .react .bridge .WritableNativeMap ;
1315import com .facebook .react .bridge .Callback ;
1416
1517import com .instabug .library .Instabug ;
@@ -676,8 +678,17 @@ public void removeUserAttribute(String key) {
676678 * @return all user attributes as HashMap<String, String>
677679 */
678680 @ 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 );
681692 }
682693
683694 /**
Original file line number Diff line number Diff line change @@ -631,11 +631,7 @@ module.exports = {
631631 * or an empty dictionary if no user attributes have been set.
632632 */
633633 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 ) ;
639635 } ,
640636
641637 /**
You can’t perform that action at this time.
0 commit comments