mirror of
https://github.com/firebase/firebase-ios-sdk
synced 2026-11-09 22:36:01 +05:45
Firebase In-app messaging callbacks (#2354)
* FIRInAppMessagingDisplayMessage and FIRInAppMessagingDisplayDelegate refactor + downstream changes * More downstream changes from FIRInAppMessagingDisplayDelegate, calling through to app-side delegate from default display executor * Add delegate property on FIRInAppMessaging * Display SDK changes to pass through in app message with callbacks * Headless SDK unit test refactoring * Display test app downstream changes * Pull in headless SDK in display app, no need to have this come in as a framework anymore * Run scripts/style.sh * Remove WIP test * Refactor FIRIAMDIsplayExecutor to take an InAppMessaging object for testing * Depend on FirebaseAnalyticsInterop in UI test app * File imports for FIRInAppMessaging files * Remove FirebaseInAppMessaging imports
This commit is contained in:
1 parent
26f021a838
commit
c8899e294d
20 files changed
+547
-187
No files matched your search
+51
-18
@@ -15,20 +15,20 @@
|
||||
*/
|
||||
|
||||
import UIKit
|
||||
import FirebaseInAppMessaging
|
||||
|
||||
class ModalMessageViewController: CommonMessageTestVC {
|
||||
let displayImpl = InAppMessagingDefaultDisplayImpl()
|
||||
|
||||
@IBOutlet var verifyLabel: UILabel!
|
||||
|
||||
override func messageClicked() {
|
||||
super.messageClicked()
|
||||
override func messageClicked(_ inAppMessage: InAppMessagingDisplayMessage) {
|
||||
super.messageClicked(inAppMessage)
|
||||
verifyLabel.text = "message clicked!"
|
||||
}
|
||||
|
||||
override func messageDismissed(dismissType dimissType: FIRInAppMessagingDismissType) {
|
||||
super.messageClicked()
|
||||
override func messageDismissed(_ inAppMessage: InAppMessagingDisplayMessage,
|
||||
dismissType: FIRInAppMessagingDismissType) {
|
||||
super.messageClicked(inAppMessage)
|
||||
verifyLabel.text = "message dismissed!"
|
||||
}
|
||||
|
||||
@@ -38,13 +38,16 @@ class ModalMessageViewController: CommonMessageTestVC {
|
||||
let fiamImageData = InAppMessagingImageData(imageURL: "url not important", imageData: imageRawData!)
|
||||
|
||||
let modalMessage = InAppMessagingModalDisplay(messageID: "messageId",
|
||||
campaignName: "testCampaign",
|
||||
renderAsTestMessage: false,
|
||||
triggerType: .onAnalyticsEvent,
|
||||
titleText: normalMessageTitle,
|
||||
bodyText: normalMessageBody,
|
||||
textColor: UIColor.black,
|
||||
backgroundColor: UIColor.blue,
|
||||
imageData: fiamImageData,
|
||||
actionButton: defaultActionButton)
|
||||
actionButton: defaultActionButton,
|
||||
actionURL: URL(string: "http://firebase.com"))
|
||||
|
||||
displayImpl.displayMessage(modalMessage, displayDelegate: self)
|
||||
}
|
||||
@@ -52,13 +55,16 @@ class ModalMessageViewController: CommonMessageTestVC {
|
||||
@IBAction func showWithoutImage(_ sender: Any) {
|
||||
verifyLabel.text = "Verification Label"
|
||||
let modalMessage = InAppMessagingModalDisplay(messageID: "messageId",
|
||||
campaignName: "testCampaign",
|
||||
renderAsTestMessage: false,
|
||||
triggerType: .onAnalyticsEvent,
|
||||
titleText: normalMessageTitle,
|
||||
bodyText: normalMessageBody,
|
||||
textColor: UIColor.black,
|
||||
backgroundColor: UIColor.blue,
|
||||
imageData: nil,
|
||||
actionButton: defaultActionButton)
|
||||
actionButton: defaultActionButton,
|
||||
actionURL: URL(string: "http://firebase.com"))
|
||||
|
||||
displayImpl.displayMessage(modalMessage, displayDelegate: self)
|
||||
}
|
||||
@@ -69,13 +75,16 @@ class ModalMessageViewController: CommonMessageTestVC {
|
||||
let fiamImageData = InAppMessagingImageData(imageURL: "url not important", imageData: imageRawData!)
|
||||
|
||||
let modalMessage = InAppMessagingModalDisplay(messageID: "messageId",
|
||||
campaignName: "testCampaign",
|
||||
renderAsTestMessage: false,
|
||||
triggerType: .onAnalyticsEvent,
|
||||
titleText: normalMessageTitle,
|
||||
bodyText: normalMessageBody,
|
||||
textColor: UIColor.black,
|
||||
backgroundColor: UIColor.blue,
|
||||
imageData: fiamImageData,
|
||||
actionButton: nil)
|
||||
actionButton: nil,
|
||||
actionURL: nil)
|
||||
|
||||
displayImpl.displayMessage(modalMessage, displayDelegate: self)
|
||||
}
|
||||
@@ -83,13 +92,16 @@ class ModalMessageViewController: CommonMessageTestVC {
|
||||
@IBAction func showWithoutImageAndButton(_ sender: Any) {
|
||||
verifyLabel.text = "Verification Label"
|
||||
let modalMessage = InAppMessagingModalDisplay(messageID: "messageId",
|
||||
campaignName: "testCampaign",
|
||||
renderAsTestMessage: false,
|
||||
triggerType: .onAnalyticsEvent,
|
||||
titleText: normalMessageTitle,
|
||||
bodyText: normalMessageBody,
|
||||
textColor: UIColor.black,
|
||||
backgroundColor: UIColor.blue,
|
||||
imageData: nil,
|
||||
actionButton: nil)
|
||||
actionButton: nil,
|
||||
actionURL: nil)
|
||||
|
||||
displayImpl.displayMessage(modalMessage, displayDelegate: self)
|
||||
}
|
||||
@@ -97,13 +109,16 @@ class ModalMessageViewController: CommonMessageTestVC {
|
||||
@IBAction func showWithLargeBody(_ sender: Any) {
|
||||
verifyLabel.text = "Verification Label"
|
||||
let modalMessage = InAppMessagingModalDisplay(messageID: "messageId",
|
||||
campaignName: "testCampaign",
|
||||
renderAsTestMessage: false,
|
||||
triggerType: .onAnalyticsEvent,
|
||||
titleText: normalMessageTitle,
|
||||
bodyText: longBodyText,
|
||||
textColor: UIColor.black,
|
||||
backgroundColor: UIColor.blue,
|
||||
imageData: nil,
|
||||
actionButton: defaultActionButton)
|
||||
actionButton: defaultActionButton,
|
||||
actionURL: URL(string: "http://firebase.com"))
|
||||
|
||||
displayImpl.displayMessage(modalMessage, displayDelegate: self)
|
||||
}
|
||||
@@ -114,13 +129,16 @@ class ModalMessageViewController: CommonMessageTestVC {
|
||||
let fiamImageData = InAppMessagingImageData(imageURL: "url not important", imageData: imageRawData!)
|
||||
|
||||
let modalMessage = InAppMessagingModalDisplay(messageID: "messageId",
|
||||
campaignName: "testCampaign",
|
||||
renderAsTestMessage: false,
|
||||
titleText: longBodyText,
|
||||
triggerType: .onAnalyticsEvent,
|
||||
titleText: longTitleText,
|
||||
bodyText: longBodyText,
|
||||
textColor: UIColor.black,
|
||||
backgroundColor: UIColor.blue,
|
||||
imageData: fiamImageData,
|
||||
actionButton: defaultActionButton)
|
||||
actionButton: defaultActionButton,
|
||||
actionURL: URL(string: "http://firebase.com"))
|
||||
|
||||
displayImpl.displayMessage(modalMessage, displayDelegate: self)
|
||||
}
|
||||
@@ -128,13 +146,16 @@ class ModalMessageViewController: CommonMessageTestVC {
|
||||
@IBAction func showWithLargeTitle(_ sender: Any) {
|
||||
verifyLabel.text = "Verification Label"
|
||||
let modalMessage = InAppMessagingModalDisplay(messageID: "messageId",
|
||||
campaignName: "testCampaign",
|
||||
renderAsTestMessage: false,
|
||||
triggerType: .onAnalyticsEvent,
|
||||
titleText: longBodyText,
|
||||
bodyText: normalMessageBody,
|
||||
textColor: UIColor.black,
|
||||
backgroundColor: UIColor.blue,
|
||||
imageData: nil,
|
||||
actionButton: defaultActionButton)
|
||||
actionButton: defaultActionButton,
|
||||
actionURL: URL(string: "http://firebase.com"))
|
||||
|
||||
displayImpl.displayMessage(modalMessage, displayDelegate: self)
|
||||
}
|
||||
@@ -142,13 +163,16 @@ class ModalMessageViewController: CommonMessageTestVC {
|
||||
@IBAction func showWithLargeTitleAndBodyWithoutImage(_ sender: Any) {
|
||||
verifyLabel.text = "Verification Label"
|
||||
let modalMessage = InAppMessagingModalDisplay(messageID: "messageId",
|
||||
campaignName: "testCampaign",
|
||||
renderAsTestMessage: false,
|
||||
titleText: longBodyText,
|
||||
triggerType: .onAnalyticsEvent,
|
||||
titleText: longTitleText,
|
||||
bodyText: longBodyText,
|
||||
textColor: UIColor.black,
|
||||
backgroundColor: UIColor.blue,
|
||||
imageData: nil,
|
||||
actionButton: defaultActionButton)
|
||||
actionButton: defaultActionButton,
|
||||
actionURL: URL(string: "http://firebase.com"))
|
||||
|
||||
displayImpl.displayMessage(modalMessage, displayDelegate: self)
|
||||
}
|
||||
@@ -156,13 +180,16 @@ class ModalMessageViewController: CommonMessageTestVC {
|
||||
@IBAction func showWithLargeTitleWithoutBodyWithoutImageWithoutButton(_ sender: Any) {
|
||||
verifyLabel.text = "Verification Label"
|
||||
let modalMessage = InAppMessagingModalDisplay(messageID: "messageId",
|
||||
campaignName: "testCampaign",
|
||||
renderAsTestMessage: false,
|
||||
triggerType: .onAnalyticsEvent,
|
||||
titleText: longBodyText,
|
||||
bodyText: "",
|
||||
textColor: UIColor.black,
|
||||
backgroundColor: UIColor.blue,
|
||||
imageData: nil,
|
||||
actionButton: nil)
|
||||
actionButton: nil,
|
||||
actionURL: nil)
|
||||
|
||||
displayImpl.displayMessage(modalMessage, displayDelegate: self)
|
||||
}
|
||||
@@ -173,13 +200,16 @@ class ModalMessageViewController: CommonMessageTestVC {
|
||||
let fiamImageData = InAppMessagingImageData(imageURL: "url not important", imageData: imageRawData!)
|
||||
|
||||
let modalMessage = InAppMessagingModalDisplay(messageID: "messageId",
|
||||
campaignName: "testCampaign",
|
||||
renderAsTestMessage: false,
|
||||
triggerType: .onAnalyticsEvent,
|
||||
titleText: normalMessageTitle,
|
||||
bodyText: normalMessageBody,
|
||||
textColor: UIColor.black,
|
||||
backgroundColor: UIColor.blue,
|
||||
imageData: fiamImageData,
|
||||
actionButton: defaultActionButton)
|
||||
actionButton: defaultActionButton,
|
||||
actionURL: URL(string: "http://firebase.com"))
|
||||
|
||||
displayImpl.displayMessage(modalMessage, displayDelegate: self)
|
||||
}
|
||||
@@ -190,13 +220,16 @@ class ModalMessageViewController: CommonMessageTestVC {
|
||||
let fiamImageData = InAppMessagingImageData(imageURL: "url not important", imageData: imageRawData!)
|
||||
|
||||
let modalMessage = InAppMessagingModalDisplay(messageID: "messageId",
|
||||
campaignName: "testCampaign",
|
||||
renderAsTestMessage: false,
|
||||
triggerType: .onAnalyticsEvent,
|
||||
titleText: normalMessageTitle,
|
||||
bodyText: normalMessageBody,
|
||||
textColor: UIColor.black,
|
||||
backgroundColor: UIColor.blue,
|
||||
imageData: fiamImageData,
|
||||
actionButton: defaultActionButton)
|
||||
actionButton: defaultActionButton,
|
||||
actionURL: URL(string: "http://firebase.com"))
|
||||
|
||||
displayImpl.displayMessage(modalMessage, displayDelegate: self)
|
||||
}
|
||||
|
||||
Reference in new issue
Block a user