Skip to content

Commit

Permalink
MBL-1417: Crash from PushNotifications.fetchBitmap (#2048)
Browse files Browse the repository at this point in the history
- return default bitmap in catch branch

Co-authored-by: mtgriego <[email protected]>
(cherry picked from commit c85d86e)
  • Loading branch information
Arkariang committed Jun 3, 2024
1 parent 2b18913 commit 9f4bc5a
Showing 1 changed file with 7 additions and 1 deletion.
Original file line number Diff line number Diff line change
Expand Up @@ -8,6 +8,7 @@
import android.content.Context;
import android.content.Intent;
import android.graphics.Bitmap;
import android.graphics.BitmapFactory;
import android.os.Build;
import android.util.Pair;

Expand All @@ -22,6 +23,7 @@
import com.bumptech.glide.load.MultiTransformation;
import com.bumptech.glide.request.FutureTarget;
import com.bumptech.glide.request.RequestOptions;
import com.google.firebase.crashlytics.FirebaseCrashlytics;
import com.kickstarter.R;
import com.kickstarter.libs.qualifiers.ApplicationContext;
import com.kickstarter.libs.utils.extensions.AnyExtKt;
Expand Down Expand Up @@ -420,19 +422,23 @@ private void displayNotificationFromUpdateActivity(final @NonNull PushNotificati
final FutureTarget<Bitmap> circleCrop = Glide.with(this.context)
.asBitmap()
.load(url)
.error(R.drawable.logo)
.apply(RequestOptions.circleCropTransform())
.submit();
return circleCrop.get();
} else {
final FutureTarget<Bitmap> SquareRoundCorners = Glide.with(this.context)
.asBitmap()
.load(url)
.error(R.drawable.logo)
.transform(new MultiTransformation<>(new CenterCrop(), new RoundedCorners(10)))
.submit();
return SquareRoundCorners.get();
}
} catch (ExecutionException | InterruptedException e) {
throw new RuntimeException(e);
final Throwable error = new Throwable(url, e);
FirebaseCrashlytics.getInstance().recordException(error);
return BitmapFactory.decodeResource(this.context.getResources(), R.drawable.logo);
}
}

Expand Down

0 comments on commit 9f4bc5a

Please sign in to comment.