- Notifications
You must be signed in to change notification settings - Fork 642
Closed
Labels
Description
[READ] Step 1: Are you in the right place?
- Yes
[REQUIRED] Step 2: Describe your environment
- Android Studio version: Hedgehog 2023.1.1 Patch 1
- Firebase Component: In-App Messaging
- Component version: 32.2.3
[REQUIRED] Step 3: Describe the problem
DisplayErrorListener won't trigger while displaying error in-app messaging.
Steps to reproduce:
- Add FirebaseInAppMessagingDisplayErrorListener via FirebaseInAppMessaging.getInstance().addDisplayErrorListener().
- Create a new campaign with a jpeg whose format is unsupported and make it display in the app.
- DisplayErrorListener won't be triggered while displaying error in-app messaging.
What happened? How can we make the problem occur?
This could be a description, log/console output, etc.
We found while the function onLoadFailed
was accessed, the inAppMessage and displayCallbacks objects are always null.
Hence DisplayErrorListener will never be triggered.
Relevant Code:
@FirebaseAppScope public class GlideErrorListener implements RequestListener<Object> { private InAppMessage inAppMessage; private FirebaseInAppMessagingDisplayCallbacks displayCallbacks; @Inject GlideErrorListener() {} public void setInAppMessage( InAppMessage inAppMessage, FirebaseInAppMessagingDisplayCallbacks displayCallbacks) { this.inAppMessage = inAppMessage; this.displayCallbacks = displayCallbacks; } @Override public boolean onLoadFailed( @Nullable GlideException e, Object model, Target<Object> target, boolean isFirstResource) { Logging.logd("Image Downloading Error : " + e.getMessage() + ":" + e.getCause()); if (inAppMessage != null && displayCallbacks != null) { if (e.getLocalizedMessage().contains("Failed to decode")) { displayCallbacks.displayErrorEncountered( FirebaseInAppMessagingDisplayCallbacks.InAppMessagingErrorReason .IMAGE_UNSUPPORTED_FORMAT); } else { displayCallbacks.displayErrorEncountered( FirebaseInAppMessagingDisplayCallbacks.InAppMessagingErrorReason .UNSPECIFIED_RENDER_ERROR); } } return false; } @Override public boolean onResourceReady( Object resource, Object model, Target<Object> target, DataSource dataSource, boolean isFirstResource) { Logging.logd("Image Downloading Success : " + resource); return false; } }