firebase / firebase-ios-sdk

Firebase SDK for Apple App Development
https://firebase.google.com
Apache License 2.0
5.52k stars 1.44k forks source link

In-App Messaging's test message does not include `appData` in response (and also not in `InAppMessagingDisplayMessage` ) #9126

Open fumito-ito opened 2 years ago

fumito-ito commented 2 years ago

[REQUIRED] Step 1: Describe your environment

[REQUIRED] Step 2: Describe the problem

In-App Messaging' message has appData property. But it looks always nil for test message.

Steps to reproduce:

  1. Make an App to receive In-App Messaging
  2. Create and send Test message from Firebase Console
  3. Set a break point at displayMessage(:displayDelegate:) in 1.'s App and run the App in Debug mode
  4. See messageForDisplay.appData in debug console. It shows nil.

Relevant Code:

There are two causes of this problem.

1. FIRIAMFetchResponseParser always ignores appData for test message

https://github.com/firebase/firebase-ios-sdk/blob/d28849cb12de765d013b7222123bd3b8ae8c4f0a/FirebaseInAppMessaging/Sources/Data/FIRIAMFetchResponseParser.m#L357-L367

In this code, FIRIAMFetchResponseParser looks ignore appData for test message.

2. In-App Messaging's response does not contain appData property for test message.

https://github.com/firebase/firebase-ios-sdk/blob/480178b0871217c5f4fd3dd3c3a309c78c1d5c4c/FirebaseInAppMessaging/Sources/Flows/FIRIAMMsgFetcherUsingRestful.m#L171-L173

I found that appData also does not be included in responseDict for test message. It looks happened every time for test message.

google-oss-bot commented 2 years ago

I found a few problems with this issue:

fumito-ito commented 2 years ago

@zwu52 Any updates on this ? In my use case, I detect custom message type by appData. But now, I cannot do it in test case because of this bug.

zwu52 commented 2 years ago

Hi @fumito-ito , apologies for missing the thread. Thanks for reporting & coming up with the fix. LGTM. I have pinged the owner for a final quick review & approval.

eldhosembabu commented 2 years ago

The SDK fix is merged, but it needs a fix from backend side as well to push this data to the client device.

eldhosembabu commented 2 years ago

filed an internal bug to track the backend issue : b/216496087