Skip to content

Commit

Permalink
Merge c9b6844 into 41b0073
Browse files Browse the repository at this point in the history
  • Loading branch information
christibbs authored Jul 16, 2021
2 parents 41b0073 + c9b6844 commit 2d909b5
Show file tree
Hide file tree
Showing 18 changed files with 686 additions and 560 deletions.
4 changes: 4 additions & 0 deletions FirebaseInAppMessaging/CHANGELOG.md
Original file line number Diff line number Diff line change
@@ -1,3 +1,7 @@
# 2021-7 -- v.8.3.0
- [added] Added support for unit testing with in-app message data objects (#8351).
- [added] Added support for prototyping custom in-app message views in SwiftUI (#8351).

# 2021-6 -- v.8.2.0
- [fixed] Fixed missing constraints warnings in default UI storyboard (#8205).

Expand Down
34 changes: 16 additions & 18 deletions FirebaseInAppMessaging/Sources/Flows/FIRIAMDisplayExecutor.m
Original file line number Diff line number Diff line change
Expand Up @@ -471,24 +471,22 @@ - (void)checkAndDisplayNextContextualMessageForAnalyticsEvent:(NSString *)eventN
}

FIRInAppMessagingCardDisplay *cardMessage = [[FIRInAppMessagingCardDisplay alloc]
initWithMessageID:renderData.messageID
campaignName:renderData.name
experimentPayload:definition.experimentPayload
renderAsTestMessage:definition.isTestMessage
triggerType:triggerType
titleText:title
textColor:renderData.renderingEffectSettings.textColor
portraitImageData:portraitImageData
backgroundColor:renderData.renderingEffectSettings.displayBGColor
primaryActionButton:primaryActionButton
primaryActionURL:definition.renderData.contentData.actionURL
appData:definition.appData];

cardMessage.body = body;
cardMessage.landscapeImageData = landscapeImageData;
cardMessage.secondaryActionButton = secondaryActionButton;
cardMessage.secondaryActionURL = definition.renderData.contentData.secondaryActionURL;

initWithMessageID:renderData.messageID
campaignName:renderData.name
experimentPayload:definition.experimentPayload
renderAsTestMessage:definition.isTestMessage
triggerType:triggerType
titleText:title
bodyText:body
textColor:renderData.renderingEffectSettings.textColor
portraitImageData:portraitImageData
landscapeImageData:landscapeImageData
backgroundColor:renderData.renderingEffectSettings.displayBGColor
primaryActionButton:primaryActionButton
secondaryActionButton:secondaryActionButton
primaryActionURL:definition.renderData.contentData.actionURL
secondaryActionURL:definition.renderData.contentData.secondaryActionURL
appData:definition.appData];
return cardMessage;
}

Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -64,6 +64,12 @@ NS_SWIFT_NAME(InAppMessagingActionButton)
/// Unavailable.
- (instancetype)init NS_UNAVAILABLE;

/// Exposed for unit testing only, or for use in SwiftUI previews. Don't instantiate this in your
/// app directly.
- (instancetype)initWithButtonText:(NSString *)buttonText
buttonTextColor:(UIColor *)textColor
backgroundColor:(UIColor *)backgroundColor;

@end

/** Contain display data for an image for a fiam message.
Expand All @@ -84,6 +90,10 @@ NS_SWIFT_NAME(InAppMessagingImageData)
/// Unavailable.
- (instancetype)init NS_UNAVAILABLE;

/// Exposed for unit testing only, or for use in SwiftUI previews. Don't instantiate this in your
/// app directly.
- (instancetype)initWithImageURL:(NSString *)imageURL imageData:(NSData *)imageData;

@end

/** Defines the metadata for the campaign to which a FIAM message belongs.
Expand Down Expand Up @@ -128,7 +138,8 @@ NS_SWIFT_NAME(InAppMessagingAction)
/// Unavailable.
- (instancetype)init NS_UNAVAILABLE;

/// This class should only be initialized from a custom in-app message UI component implementation.
/// This class should only be initialized from a custom in-app message UI component implementation
/// or in unit testing.
- (instancetype)initWithActionText:(nullable NSString *)actionText
actionURL:(nullable NSURL *)actionURL;

Expand Down Expand Up @@ -229,6 +240,21 @@ NS_SWIFT_NAME(InAppMessagingCardDisplay)
/// Unavailable.
- (instancetype)init NS_UNAVAILABLE;

/// Exposed for unit testing only, or for use in SwiftUI previews. Don't instantiate this in your
/// app directly.
- (instancetype)initWithCampaignName:(NSString *)campaignName
titleText:(NSString *)title
bodyText:(nullable NSString *)bodyText
textColor:(UIColor *)textColor
portraitImageData:(FIRInAppMessagingImageData *)portraitImageData
landscapeImageData:(nullable FIRInAppMessagingImageData *)landscapeImageData
backgroundColor:(UIColor *)backgroundColor
primaryActionButton:(FIRInAppMessagingActionButton *)primaryActionButton
secondaryActionButton:(nullable FIRInAppMessagingActionButton *)secondaryActionButton
primaryActionURL:(nullable NSURL *)primaryActionURL
secondaryActionURL:(nullable NSURL *)secondaryActionURL
appData:(nullable NSDictionary *)appData;

@end

/** Class for defining a modal message for display.
Expand Down Expand Up @@ -274,6 +300,18 @@ NS_SWIFT_NAME(InAppMessagingModalDisplay)
/// Unavailable.
- (instancetype)init NS_UNAVAILABLE;

/// Exposed for unit testing only, or for use in SwiftUI previews. Don't instantiate this in your
/// app directly.
- (instancetype)initWithCampaignName:(NSString *)campaignName
titleText:(NSString *)title
bodyText:(nullable NSString *)bodyText
textColor:(UIColor *)textColor
backgroundColor:(UIColor *)backgroundColor
imageData:(nullable FIRInAppMessagingImageData *)imageData
actionButton:(nullable FIRInAppMessagingActionButton *)actionButton
actionURL:(nullable NSURL *)actionURL
appData:(nullable NSDictionary *)appData;

@end

/** Class for defining a banner message for display.
Expand Down Expand Up @@ -314,6 +352,17 @@ NS_SWIFT_NAME(InAppMessagingBannerDisplay)
/// Unavailable.
- (instancetype)init NS_UNAVAILABLE;

/// Exposed for unit testing only, or for use in SwiftUI previews. Don't instantiate this in your
/// app directly.
- (instancetype)initWithCampaignName:(NSString *)campaignName
titleText:(NSString *)title
bodyText:(nullable NSString *)bodyText
textColor:(UIColor *)textColor
backgroundColor:(UIColor *)backgroundColor
imageData:(nullable FIRInAppMessagingImageData *)imageData
actionURL:(nullable NSURL *)actionURL
appData:(nullable NSDictionary *)appData;

@end

/** Class for defining a image-only message for display.
Expand All @@ -334,6 +383,13 @@ NS_SWIFT_NAME(InAppMessagingImageOnlyDisplay)
/// Unavailable.
- (instancetype)init NS_UNAVAILABLE;

/// Exposed for unit testing only, or for use in SwiftUI previews. Don't instantiate this in your
/// app directly.
- (instancetype)initWithCampaignName:(NSString *)campaignName
imageData:(FIRInAppMessagingImageData *)imageData
actionURL:(nullable NSURL *)actionURL
appData:(nullable NSDictionary *)appData;

@end

/// The way that an in-app message was dismissed.
Expand Down
Loading

0 comments on commit 2d909b5

Please # to comment.