@@ -155,7 +155,15 @@ public boolean execute(String action, JSONArray args, CallbackContext callbackCo
155155 if (action .equals ("setInteractivePushBtnPair" )){
156156 return setInteractivePushBtnPair ();
157157 }
158-
158+
159+ //Added in 1.8.7
160+ if (action .equals ("setLargeIconResID" )){
161+ return setLargeIconResID (args );
162+ }
163+ if (action .equals ("setSmallIconResID" )){
164+ return setSmallIconResID (args );
165+ }
166+
159167 /*GROWTH plugin*/
160168 if (action .equals ("getShareUrlForAppDownload" )){
161169 return originateShareWithCampaign (args ,callbackContext );
@@ -1088,6 +1096,88 @@ private boolean getIcon(JSONArray args,CallbackContext callbackContext){
10881096 }
10891097 return true ;
10901098 }
1099+
1100+ /**
1101+ * Function sets bigIcon to be used in notification bar
1102+ */
1103+ private boolean setLargeIconResID (JSONArray args ){
1104+ final Context context = cordova .getActivity ().getApplicationContext ();
1105+ String iconName ;
1106+ try {
1107+ iconName = args .getString (0 );
1108+ }catch (JSONException e ){
1109+ iconName =null ;
1110+ }
1111+ if (null ==iconName )
1112+ return false ;
1113+ Class noParams [] = {};
1114+ Class [] paramContext = new Class [1 ];
1115+ paramContext [0 ] = Context .class ;
1116+
1117+ Class [] name = new Class [1 ];
1118+ name [0 ] = String .class ;
1119+ Class push = null ;
1120+ try {
1121+ push = Class .forName ("com.streethawk.library.push.Push" );
1122+ Method pushMethod = push .getMethod ("getInstance" , paramContext );
1123+ Object obj = pushMethod .invoke (null ,context );
1124+ if (null != obj ) {
1125+ Method addPushModule = push .getDeclaredMethod ("setLargeIconResID" ,name );
1126+ addPushModule .invoke (obj ,iconName );
1127+ }
1128+ } catch (ClassNotFoundException e1 ) {
1129+ Log .w (TAG ,SUBTAG +"No Push module found. Add streethawk push plugin" );
1130+ } catch (IllegalAccessException e1 ) {
1131+ e1 .printStackTrace ();
1132+ } catch (NoSuchMethodException e1 ) {
1133+ e1 .printStackTrace ();
1134+ } catch (InvocationTargetException e1 ) {
1135+ e1 .printStackTrace ();
1136+ }
1137+ return true ;
1138+ }
1139+
1140+ /**
1141+ * Function returns icon resid of given icon name
1142+ */
1143+ private boolean setSmallIconResID (JSONArray args ){
1144+ Log .e ("Anurag" ,"inside setSmallIconResID" );
1145+ final Context context = cordova .getActivity ().getApplicationContext ();
1146+ String iconName ;
1147+ try {
1148+ iconName = args .getString (0 );
1149+ Log .e ("Anurag" ,"Small Iconname " +iconName );
1150+ }catch (JSONException e ){
1151+ iconName =null ;
1152+ }
1153+ if (null ==iconName )
1154+ return false ;
1155+ Class noParams [] = {};
1156+ Class [] paramContext = new Class [1 ];
1157+ paramContext [0 ] = Context .class ;
1158+ Class [] name = new Class [1 ];
1159+ name [0 ] = String .class ;
1160+ Class push = null ;
1161+ try {
1162+ push = Class .forName ("com.streethawk.library.push.Push" );
1163+ Method pushMethod = push .getMethod ("getInstance" , paramContext );
1164+ Object obj = pushMethod .invoke (null ,context );
1165+ if (null != obj ) {
1166+ Method addPushModule = push .getDeclaredMethod ("setSmallIconResID" ,name );
1167+ addPushModule .invoke (obj ,iconName );
1168+ }
1169+ } catch (ClassNotFoundException e1 ) {
1170+ Log .w (TAG ,SUBTAG +"No Push module found. Add streethawk push plugin" );
1171+ } catch (IllegalAccessException e1 ) {
1172+ e1 .printStackTrace ();
1173+ } catch (NoSuchMethodException e1 ) {
1174+ e1 .printStackTrace ();
1175+ } catch (InvocationTargetException e1 ) {
1176+ e1 .printStackTrace ();
1177+ }
1178+ return true ;
1179+ }
1180+
10911181
10921182 /*GROWTH API*/
10931183 private boolean originateShareWithCampaign (JSONArray args , CallbackContext callbackContext )throws JSONException {
0 commit comments