44import com .facebook .react .bridge .ReadableMap ;
55import com .facebook .react .bridge .WritableArray ;
66import com .facebook .react .bridge .WritableMap ;
7+ import com .facebook .react .bridge .ReadableNativeArray ;
8+
79
810import java .util .ArrayList ;
911import java .util .Map ;
1012import java .util .Iterator ;
1113
12- import com .facebook .react .bridge .WritableNativeMap ;
1314import com .google .gson .Gson ;
1415
1516public class NotificationAttributes {
@@ -52,6 +53,8 @@ public class NotificationAttributes {
5253 public String bigStyleImageBase64 ;
5354 public String subText ;
5455 public Integer progress ;
56+ public Integer lifetime ;
57+ public Integer progressEnd ;
5558 public String color ;
5659 public Integer number ;
5760 public String category ;
@@ -62,6 +65,8 @@ public class NotificationAttributes {
6265 public String inboxStyleSummaryText ;
6366 public ArrayList <String > inboxStyleLines ;
6467
68+ public String group ;
69+
6570 public void loadFromMap (Map map ) {
6671 WritableMap writableMap = (WritableMap ) new WritableNativeMap ();
6772
@@ -84,6 +89,34 @@ public void loadFromMap(Map map) {
8489
8590 } else if (value .getClass ().equals (Boolean .class )) {
8691 writableMap .putBoolean (key , (Boolean ) value );
92+
93+
94+ } else if ("inboxStyle" .equals (key )) {
95+ inboxStyle = true ;
96+ WritableMap inboxStyleMap = new WritableNativeMap ();
97+
98+ Map inboxMap = (Map ) value ;
99+ if (inboxMap .containsKey ("bigContentTitle" )) {
100+ inboxStyleBigContentTitle = (String ) inboxMap .get ("bigContentTitle" );
101+ inboxStyleMap .putString ("bigContentTitle" , inboxStyleBigContentTitle );
102+ }
103+
104+ if (inboxMap .containsKey ("summaryText" )) {
105+ inboxStyleSummaryText = (String ) inboxMap .get ("summaryText" );
106+ inboxStyleMap .putString ("summaryText" , inboxStyleSummaryText );
107+ }
108+
109+ if (inboxMap .containsKey ("lines" )) {
110+ WritableArray inboxLines = new com .facebook .react .bridge .WritableNativeArray ();
111+ org .mozilla .javascript .NativeArray inboxStyleLines = (org .mozilla .javascript .NativeArray ) inboxMap .get ("lines" );
112+
113+ for (int i =0 ; i < inboxStyleLines .size (); i ++){
114+ inboxLines .pushString ((String ) inboxStyleLines .get (i ));
115+ }
116+ inboxStyleMap .putArray ("lines" , inboxLines );
117+ }
118+
119+ writableMap .putMap ("inboxStyle" , inboxStyleMap );
87120
88121 } else {
89122 Gson gson = new Gson ();
@@ -136,22 +169,28 @@ public void loadFromReadableMap(ReadableMap readableMap) {
136169 if (readableMap .hasKey ("bigStyleImageBase64" )) bigStyleImageBase64 = readableMap .getString ("bigStyleImageBase64" );
137170 if (readableMap .hasKey ("subText" )) subText = readableMap .getString ("subText" );
138171 if (readableMap .hasKey ("progress" )) progress = readableMap .getInt ("progress" );
172+ if (readableMap .hasKey ("progressEnd" )) progressEnd = readableMap .getInt ("progressEnd" );
173+ if (readableMap .hasKey ("lifetime" )) lifetime = readableMap .getInt ("lifetime" );
174+
139175 if (readableMap .hasKey ("color" )) color = readableMap .getString ("color" );
140176 if (readableMap .hasKey ("number" )) number = readableMap .getInt ("number" );
141177 if (readableMap .hasKey ("category" )) category = readableMap .getString ("category" );
142178 if (readableMap .hasKey ("localOnly" )) localOnly = readableMap .getBoolean ("localOnly" );
179+ if (readableMap .hasKey ("group" )) group = readableMap .getString ("group" );
143180
144181 if (readableMap .hasKey ("inboxStyle" )){
145182 inboxStyle = true ;
146- ReadableMap inboxStyle = readableMap .getMap ("inboxStyle" );
183+ ReadableMap inboxStyleMap = readableMap .getMap ("inboxStyle" );
147184
148- inboxStyleBigContentTitle = inboxStyle .getString ("bigContentTitle" );
149- inboxStyleSummaryText = inboxStyle .getString ("summaryText" );
185+ inboxStyleBigContentTitle = inboxStyleMap .getString ("bigContentTitle" );
186+ inboxStyleSummaryText = inboxStyleMap .getString ("summaryText" );
150187
151- ReadableArray inboxLines = inboxStyle .getArray ("lines" );
152- inboxStyleLines = new ArrayList <>();
153- for (int i =0 ; i < inboxLines .size (); i ++){
154- inboxStyleLines .add (inboxLines .getString (i ));
188+ ReadableArray inboxLines = inboxStyleMap .getArray ("lines" );
189+ if (inboxLines != null ) {
190+ inboxStyleLines = new ArrayList <>();
191+ for (int i =0 ; i < inboxLines .size (); i ++){
192+ inboxStyleLines .add (inboxLines .getString (i ));
193+ }
155194 }
156195 }else {
157196 inboxStyle = false ;
@@ -205,10 +244,14 @@ public ReadableMap asReadableMap() {
205244 if (number != null ) writableMap .putInt ("number" , number );
206245 if (category != null ) writableMap .putString ("category" , category );
207246 if (localOnly != null ) writableMap .putBoolean ("localOnly" , localOnly );
247+ if (group != null ) writableMap .putString ("group" , group );
248+
249+ if (progressEnd != null ) writableMap .putInt ("progressEnd" , progressEnd );
250+ if (lifetime != null ) writableMap .putInt ("lifetime" , lifetime );
208251
209252 if (inboxStyle ){
210253
211- WritableMap inboxStyle = new com . facebook . react . bridge . WritableNativeMap ();
254+ WritableMap inboxStyle = new WritableNativeMap ();
212255
213256 if (inboxStyleBigContentTitle != null ) inboxStyle .putString ("bigContentTitle" , inboxStyleBigContentTitle );
214257 if (inboxStyleSummaryText != null ) inboxStyle .putString ("summaryText" , inboxStyleSummaryText );
0 commit comments