firebase / firebase/firebase-android-sdk

FirebaseInAppMessagingDisplay implementation improvements

Open
#4,717 2 comments 1 reaction 0 assignees View on GitHub
api: inappmessaging type: feature request
Dominant language
Java
Stars
2.6k
Forks
710
Avg merge
2d 9h
Merged PRs (30d)
31

Description

## What feature would you like to see?

`com.google.firebase.inappmessaging.display.FirebaseInAppMessagingDisplay`'s implementation is weird. It would be nice to fix it. Here are the things that I think should be changed:
1) The class name is the same as the name of the interface that it implements (`com.google.firebase.inappmessaging.FirebaseInAppMessagingDisplay`). This makes things confusing. Importing an incorrect thing is easy. If you want to use both the interface and the class (e.g. when implementing your own implementation of message display that forwards to the default one in some cases) then it becomes even more cumbersome.
2) Even though `FirebaseInAppMessagingDisplay` (the class) implements `FirebaseInAppMessagingDisplay` (the interface), its `displayMessage()` method doesn't do anything because it's inherited from `FirebaseInAppMessagingDisplayImpl` where this method is empty. `displayMessage()` should be implemented correctly in `FirebaseInAppMessagingDisplay` (the class).
3) `FirebaseInAppMessagingDisplayImpl` mentioned in the previous point is a weird class that probably shouldn't exist. It does nothing except printing some logs on Activity lifecycle events. In particular, it doesn't provide the implementation of `FirebaseInAppMessagingDisplay` (the interface) that it implements.

I'm trying to implement my own `FirebaseInAppMessagingDisplay` that forwards to the default implementation after checking some conditions. Calling `displayMessage()` on the default implementation class doesn't work. I have to use the `testMessage()` method which is a hacky use of that code. If the default implementation of `FirebaseInAppMessagingDisplay` can't correctly implement the interface then doesn't it mean that the interface itself isn't that great either?

Contributor guide

Open the contributing guide

Assessment

This issue has not been assessed yet.

Get new issues in your inbox

A short digest of beginner-friendly GitHub issues.