@@ -77,19 +77,27 @@ public static NetworkRequest mapToNetworkRequest(ReadableMap object) {
7777 }
7878
7979 public static NotificationEvent mapToNotificationEvent (ReadableMap object ) {
80+ String id = object .hasKey ("id" ) && !object .isNull ("id" ) ? object .getString ("id" ) : "" ;
81+ String title = object .hasKey ("title" ) && !object .isNull ("title" ) ? object .getString ("title" ) : "" ;
82+ String description = object .hasKey ("description" ) && !object .isNull ("description" ) ? object .getString ("description" ) : "" ;
83+
8084 NotificationEvent notificationEvent = new NotificationEvent ();
81- notificationEvent .setId (object . getInt ( "id" ));
82- notificationEvent .setTitle (object . getString ( " title" ) );
83- notificationEvent .setDescription (object . getString ( " description" ) );
85+ notificationEvent .setId (Converter . stringToInt ( id ));
86+ notificationEvent .setTitle (title );
87+ notificationEvent .setDescription (description );
8488
8589 return notificationEvent ;
8690 }
8791
8892 public static WritableMap notificationEventToMap (NotificationEvent notificationEvent ) {
93+ int id = notificationEvent .getId ();
94+ String title = notificationEvent .getTitle () == null ? "" : notificationEvent .getTitle ();
95+ String description = notificationEvent .getDescription () == null ? "" : notificationEvent .getDescription ();
96+
8997 WritableMap map = new WritableNativeMap ();
90- map .putInt ("id" , notificationEvent . getId ( ));
91- map .putString ("title" , notificationEvent . getTitle () );
92- map .putString ("description" , notificationEvent . getDescription () );
98+ map .putString ("id" , String . valueOf ( id ));
99+ map .putString ("title" , title );
100+ map .putString ("description" , description );
93101
94102 return map ;
95103 }
0 commit comments