Skip to content

Commit 85fbe29

Browse files
committed
Checks for picasso before calling load.
1 parent d00e2d3 commit 85fbe29

File tree

1 file changed

+11
-3
lines changed

1 file changed

+11
-3
lines changed

iterableapi/src/main/java/com/iterable/iterableapi/IterableNotification.java

Lines changed: 11 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -46,10 +46,18 @@ public Notification build() {
4646
@Override
4747
public void run() {
4848
final RemoteViews contentView = notification.contentView;
49-
//Picasso.with(mContext).load(imageUrl).into(contentView, iconId, requestCode, notification);
5049
if (android.os.Build.VERSION.SDK_INT >= android.os.Build.VERSION_CODES.JELLY_BEAN) {
5150
final RemoteViews bigContentView = notification.bigContentView;
52-
Picasso.with(mContext).load(imageUrl).into(bigContentView, bigIconId, requestCode, notification);
51+
52+
try {
53+
Class picassoClass = Class.forName(IterableConstants.PICASSO_CLASS);
54+
if (picassoClass != null) {
55+
Picasso.with(mContext).load(imageUrl).into(bigContentView, bigIconId, requestCode, notification);
56+
}
57+
} catch (ClassNotFoundException e) {
58+
IterableLogger.w(TAG, "ClassNotFoundException: Check that picasso is added " +
59+
"to the build dependencies", e);
60+
}
5361
}
5462
}
5563
});
@@ -99,7 +107,7 @@ public static IterableNotification createNotification(Context context, Bundle ex
99107
.setContentTitle(applicationName)
100108
.setPriority(Notification.PRIORITY_HIGH)
101109
.setContentText(notificationBody);
102-
110+
103111
if (pushImage != null) {
104112
notificationBuilder.imageUrl = pushImage;
105113
notificationBuilder.setContentText(notificationBody)

0 commit comments

Comments
 (0)