From d4ba00620637ee7983ed088b0064fa1e1700b082 Mon Sep 17 00:00:00 2001 From: Chris Tibbs Date: Mon, 11 Feb 2019 11:15:32 -0800 Subject: [PATCH 01/57] Add card scene to storyboard, use IBDesignable rounded corners view --- ...IRInAppMessageDisplayStoryboard.storyboard | 184 ++++++++++++++++-- .../Util/RoundedCornersView.h | 21 ++ .../Util/RoundedCornersView.m | 17 ++ 3 files changed, 207 insertions(+), 15 deletions(-) create mode 100644 Firebase/InAppMessagingDisplay/Util/RoundedCornersView.h create mode 100644 Firebase/InAppMessagingDisplay/Util/RoundedCornersView.m diff --git a/Firebase/InAppMessagingDisplay/Resources/FIRInAppMessageDisplayStoryboard.storyboard b/Firebase/InAppMessagingDisplay/Resources/FIRInAppMessageDisplayStoryboard.storyboard index 05da4e1b7b9..9030b472f23 100644 --- a/Firebase/InAppMessagingDisplay/Resources/FIRInAppMessageDisplayStoryboard.storyboard +++ b/Firebase/InAppMessagingDisplay/Resources/FIRInAppMessageDisplayStoryboard.storyboard @@ -1,11 +1,11 @@ - - + + - + @@ -18,7 +18,7 @@ - + @@ -59,11 +59,11 @@ - + - + @@ -73,14 +73,14 @@ + + + + + + + + + + + + + + + + + + + + + + + + diff --git a/Firebase/InAppMessagingDisplay/Util/RoundedCornersView.h b/Firebase/InAppMessagingDisplay/Util/RoundedCornersView.h new file mode 100644 index 00000000000..0b045090bfc --- /dev/null +++ b/Firebase/InAppMessagingDisplay/Util/RoundedCornersView.h @@ -0,0 +1,21 @@ +/* + * Copyright 2018 Google + * + * Licensed under the Apache License, Version 2.0 (the "License"); + * you may not use this file except in compliance with the License. + * You may obtain a copy of the License at + * + * http://www.apache.org/licenses/LICENSE-2.0 + * + * Unless required by applicable law or agreed to in writing, software + * distributed under the License is distributed on an "AS IS" BASIS, + * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. + * See the License for the specific language governing permissions and + * limitations under the License. + */ + +#import +IB_DESIGNABLE +@interface RoundedCornersView : UIView +@property(nonatomic) IBInspectable CGFloat cornerRadius; +@end diff --git a/Firebase/InAppMessagingDisplay/Util/RoundedCornersView.m b/Firebase/InAppMessagingDisplay/Util/RoundedCornersView.m new file mode 100644 index 00000000000..1566baa708a --- /dev/null +++ b/Firebase/InAppMessagingDisplay/Util/RoundedCornersView.m @@ -0,0 +1,17 @@ +// +// RoundedCornersView.m +// FirebaseInAppMessagingDisplay +// +// Created by Chris Tibbs on 2/9/19. +// + +#import "RoundedCornersView.h" + +@implementation RoundedCornersView + +- (void)setCornerRadius:(CGFloat)cornerRadius { + self.layer.cornerRadius = cornerRadius; + self.layer.masksToBounds = cornerRadius > 0; +} + +@end From 8ba72d8bbbe2a6e7201fd58a5d215789344b3c35 Mon Sep 17 00:00:00 2001 From: Chris Tibbs Date: Tue, 19 Feb 2019 11:35:28 -0800 Subject: [PATCH 02/57] Use IBdesignable rounded corners view for modal message --- .../Modal/FIDModalViewController.m | 1 - ...IRInAppMessageDisplayStoryboard.storyboard | 37 +++++++++++-------- 2 files changed, 21 insertions(+), 17 deletions(-) diff --git a/Firebase/InAppMessagingDisplay/Modal/FIDModalViewController.m b/Firebase/InAppMessagingDisplay/Modal/FIDModalViewController.m index 40862db032f..f751e5f8c11 100644 --- a/Firebase/InAppMessagingDisplay/Modal/FIDModalViewController.m +++ b/Firebase/InAppMessagingDisplay/Modal/FIDModalViewController.m @@ -124,7 +124,6 @@ - (void)viewDidLoad { } self.messageCardView.backgroundColor = self.modalDisplayMessage.displayBackgroundColor; - self.messageCardView.layer.cornerRadius = 4; self.titleLabel.textColor = self.modalDisplayMessage.textColor; self.bodyTextView.textColor = self.modalDisplayMessage.textColor; diff --git a/Firebase/InAppMessagingDisplay/Resources/FIRInAppMessageDisplayStoryboard.storyboard b/Firebase/InAppMessagingDisplay/Resources/FIRInAppMessageDisplayStoryboard.storyboard index 9030b472f23..8f36571cebe 100644 --- a/Firebase/InAppMessagingDisplay/Resources/FIRInAppMessageDisplayStoryboard.storyboard +++ b/Firebase/InAppMessagingDisplay/Resources/FIRInAppMessageDisplayStoryboard.storyboard @@ -132,7 +132,7 @@ - + - + @@ -526,6 +526,13 @@ + + + + + + + From f0d31495b3ad443e84ae7fc790d23553f7e63e15 Mon Sep 17 00:00:00 2001 From: Chris Tibbs Date: Wed, 6 Mar 2019 12:20:55 -0800 Subject: [PATCH 06/57] Naive landscape image loading (needs error handling) --- .../Data/FIRIAMMessageContentData.h | 1 + .../FIRIAMMessageContentDataWithImageURL.m | 131 ++++++++++++------ .../Flows/FIRIAMDisplayExecutor.m | 58 ++++---- 3 files changed, 120 insertions(+), 70 deletions(-) diff --git a/Firebase/InAppMessaging/Data/FIRIAMMessageContentData.h b/Firebase/InAppMessaging/Data/FIRIAMMessageContentData.h index 13759eac51e..b3267047f61 100644 --- a/Firebase/InAppMessaging/Data/FIRIAMMessageContentData.h +++ b/Firebase/InAppMessaging/Data/FIRIAMMessageContentData.h @@ -37,6 +37,7 @@ NS_ASSUME_NONNULL_BEGIN // is no image assoicated with the message. // If error is nil and imageData is not nil, then the image data is loaded successfully - (void)loadImageDataWithBlock:(void (^)(NSData *_Nullable imageData, + NSData *_Nullable landscapeImageData, NSError *_Nullable error))block; // convert to a description string of the content diff --git a/Firebase/InAppMessaging/Data/FIRIAMMessageContentDataWithImageURL.m b/Firebase/InAppMessaging/Data/FIRIAMMessageContentDataWithImageURL.m index 82a09f87b9f..944cdd12387 100644 --- a/Firebase/InAppMessaging/Data/FIRIAMMessageContentDataWithImageURL.m +++ b/Firebase/InAppMessaging/Data/FIRIAMMessageContentDataWithImageURL.m @@ -28,8 +28,11 @@ @interface FIRIAMMessageContentDataWithImageURL () @property(nonatomic, readwrite, nonnull, copy) NSString *titleText; @property(nonatomic, readwrite, nonnull, copy) NSString *bodyText; @property(nonatomic, copy, nullable) NSString *actionButtonText; +@property(nonatomic, copy, nullable) NSString *secondaryActionButtonText; @property(nonatomic, copy, nullable) NSURL *actionURL; +@property(nonatomic, copy, nullable) NSURL *secondaryActionURL; @property(nonatomic, nullable, copy) NSURL *imageURL; +@property(nonatomic, nullable, copy) NSURL *landscapeImageURL; @property(readonly) NSURLSession *URLSession; @end @@ -37,15 +40,21 @@ @implementation FIRIAMMessageContentDataWithImageURL - (instancetype)initWithMessageTitle:(NSString *)title messageBody:(NSString *)body actionButtonText:(nullable NSString *)actionButtonText + secondaryActionButtonText:(nullable NSString *)secondaryActionButtonText actionURL:(nullable NSURL *)actionURL + secondaryActionURL:(nullable NSURL *)secondaryActionURL imageURL:(nullable NSURL *)imageURL + landscapeImageURL:(nullable NSURL *)landscapeImageURL usingURLSession:(nullable NSURLSession *)URLSession { if (self = [super init]) { _titleText = title; _bodyText = body; _imageURL = imageURL; + _landscapeImageURL = landscapeImageURL; _actionButtonText = actionButtonText; + _secondaryActionButtonText = secondaryActionButtonText; _actionURL = actionURL; + _secondaryActionURL = secondaryActionURL; if (imageURL) { _URLSession = URLSession ? URLSession : [NSURLSession sharedSession]; @@ -74,65 +83,99 @@ - (nullable NSString *)getActionButtonText { return _actionButtonText; } -- (void)loadImageDataWithBlock:(void (^)(NSData *_Nullable imageData, +- (void)loadImageDataWithBlock:(void (^)(NSData *_Nullable standardImageData, + NSData *_Nullable landscapeImageData, NSError *_Nullable error))block { if (!block) { // no need for any further action if block is nil return; } - if (!_imageURL) { + if (!_imageURL && !_landscapeImageURL) { // no image data since image url is nil - block(nil, nil); + block(nil, nil, nil); + } else if (!_landscapeImageURL) { + // Only fetch standard image. + [self fetchImageFromURL:_imageURL + withBlock:^(NSData *_Nullable imageData, NSError *_Nullable error) { + block(imageData, nil, error); + }]; + } else if (!_imageURL) { + // Only fetch portrait image. + [self fetchImageFromURL:_landscapeImageURL + withBlock:^(NSData *_Nullable imageData, NSError *_Nullable error) { + block(nil, imageData, error); + }]; } else { - NSURLRequest *imageDataRequest = [NSURLRequest requestWithURL:_imageURL]; - NSURLSessionDataTask *task = [_URLSession - dataTaskWithRequest:imageDataRequest - completionHandler:^(NSData *data, NSURLResponse *response, NSError *error) { - if (error) { - FIRLogWarning(kFIRLoggerInAppMessaging, @"I-IAM000003", - @"Error in fetching image: %@", error); - block(nil, error); - } else { - if ([response isKindOfClass:[NSHTTPURLResponse class]]) { - NSHTTPURLResponse *httpResponse = (NSHTTPURLResponse *)response; - if (httpResponse.statusCode == SuccessHTTPStatusCode) { - if (httpResponse.MIMEType == nil || ![httpResponse.MIMEType hasPrefix:@"image"]) { - NSString *errorDesc = - [NSString stringWithFormat:@"None image MIME type %@" - " detected for url %@", - httpResponse.MIMEType, self.imageURL]; - FIRLogWarning(kFIRLoggerInAppMessaging, @"I-IAM000004", @"%@", errorDesc); - - NSError *error = - [NSError errorWithDomain:kFirebaseInAppMessagingErrorDomain - code:FIRIAMSDKRuntimeErrorNonImageMimetypeFromImageURL - userInfo:@{NSLocalizedDescriptionKey : errorDesc}]; - block(nil, error); - } else { - block(data, nil); - } - } else { + // Fetch both images separately, call completion when they're both fetched. + NSData *portrait; + NSData *landscape; + + [self fetchImageFromURL:_imageURL + withBlock:^(NSData *_Nullable imageData, NSError *_Nullable error) { + if (landscape) { + block(imageData, landscape, nil); + } + }]; + + [self fetchImageFromURL:_landscapeImageURL + withBlock:^(NSData *_Nullable imageData, NSError *_Nullable error) { + if (portrait) { + block(portrait, imageData, nil); + } + }]; + } +} + +- (void)fetchImageFromURL:(NSURL *)imageURL + withBlock:(void (^)(NSData *_Nullable imageData, NSError *_Nullable error))block { + NSURLRequest *imageDataRequest = [NSURLRequest requestWithURL:imageURL]; + NSURLSessionDataTask *task = [_URLSession + dataTaskWithRequest:imageDataRequest + completionHandler:^(NSData *data, NSURLResponse *response, NSError *error) { + if (error) { + FIRLogWarning(kFIRLoggerInAppMessaging, @"I-IAM000003", @"Error in fetching image: %@", + error); + block(nil, error); + } else { + if ([response isKindOfClass:[NSHTTPURLResponse class]]) { + NSHTTPURLResponse *httpResponse = (NSHTTPURLResponse *)response; + if (httpResponse.statusCode == SuccessHTTPStatusCode) { + if (httpResponse.MIMEType == nil || ![httpResponse.MIMEType hasPrefix:@"image"]) { NSString *errorDesc = - [NSString stringWithFormat:@"Failed HTTP request to crawl image %@: " - "HTTP status code as %ld", - self->_imageURL, (long)httpResponse.statusCode]; - FIRLogWarning(kFIRLoggerInAppMessaging, @"I-IAM000001", @"%@", errorDesc); + [NSString stringWithFormat:@"None image MIME type %@" + " detected for url %@", + httpResponse.MIMEType, self.imageURL]; + FIRLogWarning(kFIRLoggerInAppMessaging, @"I-IAM000004", @"%@", errorDesc); + NSError *error = - [NSError errorWithDomain:NSURLErrorDomain - code:httpResponse.statusCode + [NSError errorWithDomain:kFirebaseInAppMessagingErrorDomain + code:FIRIAMSDKRuntimeErrorNonImageMimetypeFromImageURL userInfo:@{NSLocalizedDescriptionKey : errorDesc}]; block(nil, error); + } else { + block(data, nil); } } else { - FIRLogWarning(kFIRLoggerInAppMessaging, @"I-IAM000002", - @"Internal error: got a non http response from fetching image for " - @"image url as %@", - self->_imageURL); + NSString *errorDesc = + [NSString stringWithFormat:@"Failed HTTP request to crawl image %@: " + "HTTP status code as %ld", + self->_imageURL, (long)httpResponse.statusCode]; + FIRLogWarning(kFIRLoggerInAppMessaging, @"I-IAM000001", @"%@", errorDesc); + NSError *error = [NSError errorWithDomain:NSURLErrorDomain + code:httpResponse.statusCode + userInfo:@{NSLocalizedDescriptionKey : errorDesc}]; + block(nil, error); } + } else { + FIRLogWarning(kFIRLoggerInAppMessaging, @"I-IAM000002", + @"Internal error: got a non http response from fetching image for " + @"image url as %@", + self->_imageURL); } - }]; - [task resume]; - } + } + }]; + [task resume]; } + @end diff --git a/Firebase/InAppMessaging/Flows/FIRIAMDisplayExecutor.m b/Firebase/InAppMessaging/Flows/FIRIAMDisplayExecutor.m index 2b4c0ce617e..41c4eb3e203 100644 --- a/Firebase/InAppMessaging/Flows/FIRIAMDisplayExecutor.m +++ b/Firebase/InAppMessaging/Flows/FIRIAMDisplayExecutor.m @@ -375,10 +375,10 @@ - (void)checkAndDisplayNextContextualMessageForAnalyticsEvent:(NSString *)eventN triggerType:(FIRInAppMessagingDisplayTriggerType)triggerType { // For easier reference in this method. FIRIAMMessageRenderData *renderData = definition.renderData; - + NSString *title = renderData.contentData.titleText; NSString *body = renderData.contentData.bodyText; - + FIRInAppMessagingActionButton *primaryActionButton = nil; if (definition.renderData.contentData.actionButtonText) { primaryActionButton = [[FIRInAppMessagingActionButton alloc] @@ -386,7 +386,7 @@ - (void)checkAndDisplayNextContextualMessageForAnalyticsEvent:(NSString *)eventN buttonTextColor:renderData.renderingEffectSettings.btnTextColor backgroundColor:renderData.renderingEffectSettings.btnBGColor]; } - + FIRInAppMessagingActionButton *secondaryActionButton = nil; if (definition.renderData.contentData.actionButtonText) { secondaryActionButton = [[FIRInAppMessagingActionButton alloc] @@ -394,22 +394,22 @@ - (void)checkAndDisplayNextContextualMessageForAnalyticsEvent:(NSString *)eventN buttonTextColor:renderData.renderingEffectSettings.btnTextColor backgroundColor:renderData.renderingEffectSettings.btnBGColor]; } - - FIRInAppMessagingCardDisplay *cardMessage = - [[FIRInAppMessagingCardDisplay alloc] initWithMessageID:renderData.messageID - campaignName:renderData.name - renderAsTestMessage:definition.isTestMessage - triggerType:triggerType - titleText:title - bodyText:body - portraitImageData:portraitImageData - landscapeImageData:landscapeImageData - backgroundColor:renderData.renderingEffectSettings.displayBGColor - primaryActionButton:primaryActionButton - primaryActionURL:definition.renderData.contentData.actionURL - secondaryActionButton:secondaryActionButton - secondaryActionURL:definition.renderData.contentData.secondaryActionURL]; - + + FIRInAppMessagingCardDisplay *cardMessage = [[FIRInAppMessagingCardDisplay alloc] + initWithMessageID:renderData.messageID + campaignName:renderData.name + renderAsTestMessage:definition.isTestMessage + triggerType:triggerType + titleText:title + bodyText:body + portraitImageData:portraitImageData + landscapeImageData:landscapeImageData + backgroundColor:renderData.renderingEffectSettings.displayBGColor + primaryActionButton:primaryActionButton + primaryActionURL:definition.renderData.contentData.actionURL + secondaryActionButton:secondaryActionButton + secondaryActionURL:definition.renderData.contentData.secondaryActionURL]; + return cardMessage; } @@ -517,12 +517,11 @@ - (void)displayForMessage:(FIRIAMMessageDefinition *)message triggerType:(FIRInAppMessagingDisplayTriggerType)triggerType { _currentMsgBeingDisplayed = message; [message.renderData.contentData - loadImageDataWithBlock:^(NSData *_Nullable imageNSData, NSError *error) { + loadImageDataWithBlock:^(NSData *_Nullable standardImageRawData, + NSData *_Nullable landscapeImageRawData, NSError *_Nullable error) { FIRInAppMessagingImageData *imageData = nil; FIRInAppMessagingImageData *landscapeImageData = nil; - // TODO(eggyeggbean): load image data for landscape image. - if (error) { FIRLogDebug(kFIRLoggerInAppMessaging, @"I-IAM400019", @"Error in loading image data for the message."); @@ -535,10 +534,17 @@ - (void)displayForMessage:(FIRIAMMessageDefinition *)message // short-circuit to display error handling [self displayErrorForMessage:erroredMessage error:error]; return; - } else if (imageNSData != nil) { - imageData = [[FIRInAppMessagingImageData alloc] - initWithImageURL:message.renderData.contentData.imageURL.absoluteString - imageData:imageNSData]; + } else { + if (standardImageRawData) { + imageData = [[FIRInAppMessagingImageData alloc] + initWithImageURL:message.renderData.contentData.imageURL.absoluteString + imageData:standardImageRawData]; + } + if (landscapeImageRawData) { + landscapeImageData = [[FIRInAppMessagingImageData alloc] + initWithImageURL:message.renderData.contentData.imageURL.absoluteString + imageData:landscapeImageRawData]; + } } self.impressionRecorded = NO; From 16c8ce853078983e894905f6b12b27ce5bbbc1bb Mon Sep 17 00:00:00 2001 From: Chris Tibbs Date: Wed, 6 Mar 2019 12:26:29 -0800 Subject: [PATCH 07/57] Quick bug fix --- Firebase/InAppMessaging/Flows/FIRIAMDisplayExecutor.m | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/Firebase/InAppMessaging/Flows/FIRIAMDisplayExecutor.m b/Firebase/InAppMessaging/Flows/FIRIAMDisplayExecutor.m index 41c4eb3e203..e9b2ca1ccd1 100644 --- a/Firebase/InAppMessaging/Flows/FIRIAMDisplayExecutor.m +++ b/Firebase/InAppMessaging/Flows/FIRIAMDisplayExecutor.m @@ -542,7 +542,7 @@ - (void)displayForMessage:(FIRIAMMessageDefinition *)message } if (landscapeImageRawData) { landscapeImageData = [[FIRInAppMessagingImageData alloc] - initWithImageURL:message.renderData.contentData.imageURL.absoluteString + initWithImageURL:message.renderData.contentData.landscapeImageURL.absoluteString imageData:landscapeImageRawData]; } } From 866abe8df339a4e6544b357b754753edf1151257 Mon Sep 17 00:00:00 2001 From: Chris Tibbs Date: Wed, 6 Mar 2019 16:32:38 -0800 Subject: [PATCH 08/57] Wire up Display to show cards --- .../FIRIAMDefaultDisplayImpl.m | 43 +++++++++++++++ ...IRInAppMessageDisplayStoryboard.storyboard | 4 +- .../Base.lproj/Main.storyboard | 55 ++++++++++++++++++- .../CardMessageViewController.swift | 36 ++++++++++++ .../project.pbxproj | 4 ++ 5 files changed, 138 insertions(+), 4 deletions(-) create mode 100644 InAppMessagingDisplay/Example/FiamDisplaySwiftExample/CardMessageViewController.swift diff --git a/Firebase/InAppMessagingDisplay/FIRIAMDefaultDisplayImpl.m b/Firebase/InAppMessagingDisplay/FIRIAMDefaultDisplayImpl.m index b3d4507c22a..88fd7369dd3 100644 --- a/Firebase/InAppMessagingDisplay/FIRIAMDefaultDisplayImpl.m +++ b/Firebase/InAppMessagingDisplay/FIRIAMDefaultDisplayImpl.m @@ -19,6 +19,7 @@ #import #import "FIDBannerViewController.h" +#import "FIDCardViewController.h" #import "FIDImageOnlyViewController.h" #import "FIDModalViewController.h" #import "FIDRenderingWindowHelper.h" @@ -69,6 +70,42 @@ + (NSBundle *)getViewResourceBundle { return resourceBundle; } ++ (void)displayCardViewWithMessageDefinition:(FIRInAppMessagingCardDisplay *)cardMessage + displayDelegate:(id)displayDelegate { + NSBundle *resourceBundle = [self getViewResourceBundle]; + + if (resourceBundle == nil) { + NSError *error = [NSError errorWithDomain:kFirebaseInAppMessagingDisplayErrorDomain + code:FIAMDisplayRenderErrorTypeUnspecifiedError + userInfo:@{@"message" : @"resource bundle is missing"}]; + [displayDelegate displayErrorForMessage:cardMessage error:error]; + return; + } + + dispatch_async(dispatch_get_main_queue(), ^{ + FIDTimerWithNSDate *timeFetcher = [[FIDTimerWithNSDate alloc] init]; + FIDCardViewController *cardVC = + [FIDCardViewController instantiateViewControllerWithResourceBundle:resourceBundle + displayMessage:cardMessage + displayDelegate:displayDelegate + timeFetcher:timeFetcher]; + + if (cardVC == nil) { + FIRLogWarning(kFIRLoggerInAppMessagingDisplay, @"I-FID100011", + @"View controller can not be created."); + NSError *error = [NSError errorWithDomain:kFirebaseInAppMessagingDisplayErrorDomain + code:FIAMDisplayRenderErrorTypeUnspecifiedError + userInfo:@{}]; + [displayDelegate displayErrorForMessage:cardMessage error:error]; + return; + } + + UIWindow *displayUIWindow = [FIDRenderingWindowHelper UIWindowForModalView]; + displayUIWindow.rootViewController = cardVC; + [displayUIWindow setHidden:NO]; + }); +} + + (void)displayModalViewWithMessageDefinition:(FIRInAppMessagingModalDisplay *)modalMessage displayDelegate: (id)displayDelegate { @@ -200,6 +237,12 @@ - (void)displayMessage:(FIRInAppMessagingDisplayMessage *)messageForDisplay [self.class displayImageOnlyViewWithMessageDefinition:(FIRInAppMessagingImageOnlyDisplay *) messageForDisplay displayDelegate:displayDelegate]; + } else if ([messageForDisplay isKindOfClass:[FIRInAppMessagingCardDisplay class]]) { + FIRLogDebug(kFIRLoggerInAppMessagingDisplay, @"I-FID100009", @"Display a card message"); + [self.class displayCardViewWithMessageDefinition:(FIRInAppMessagingCardDisplay *) + messageForDisplay + displayDelegate:displayDelegate]; + } else { FIRLogWarning(kFIRLoggerInAppMessagingDisplay, @"I-FID100003", @"Unknown message type %@ " diff --git a/Firebase/InAppMessagingDisplay/Resources/FIRInAppMessageDisplayStoryboard.storyboard b/Firebase/InAppMessagingDisplay/Resources/FIRInAppMessageDisplayStoryboard.storyboard index 814d71094e2..d7f8afe2679 100644 --- a/Firebase/InAppMessagingDisplay/Resources/FIRInAppMessageDisplayStoryboard.storyboard +++ b/Firebase/InAppMessagingDisplay/Resources/FIRInAppMessageDisplayStoryboard.storyboard @@ -418,7 +418,7 @@ - @@ -450,7 +450,7 @@ - + diff --git a/InAppMessagingDisplay/Example/FiamDisplaySwiftExample/Base.lproj/Main.storyboard b/InAppMessagingDisplay/Example/FiamDisplaySwiftExample/Base.lproj/Main.storyboard index 96f8aebeed7..4348f292afe 100644 --- a/InAppMessagingDisplay/Example/FiamDisplaySwiftExample/Base.lproj/Main.storyboard +++ b/InAppMessagingDisplay/Example/FiamDisplaySwiftExample/Base.lproj/Main.storyboard @@ -1,11 +1,11 @@ - + - + @@ -325,11 +325,62 @@ + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + diff --git a/InAppMessagingDisplay/Example/FiamDisplaySwiftExample/CardMessageViewController.swift b/InAppMessagingDisplay/Example/FiamDisplaySwiftExample/CardMessageViewController.swift new file mode 100644 index 00000000000..68423b6f563 --- /dev/null +++ b/InAppMessagingDisplay/Example/FiamDisplaySwiftExample/CardMessageViewController.swift @@ -0,0 +1,36 @@ +// +// CardMessageViewController.swift +// FiamDisplaySwiftExample +// +// Created by Chris Tibbs on 3/6/19. +// Copyright © 2019 Google. All rights reserved. +// + +import UIKit + +class CardMessageViewController: CommonMessageTestVC { + let displayImpl = InAppMessagingDefaultDisplayImpl() + + @IBOutlet var verifyLabel: UILabel! + + @IBAction func showRegular(_ sender: Any) { + let portraitImageRawData = produceImageOfSize(size: CGSize(width: 200, height: 200)) + let portraitImageData = InAppMessagingImageData(imageURL: "url not important", imageData: portraitImageRawData!) + + let cardMessage = InAppMessagingCardDisplay(messageID: "testID", + campaignName: "testCampaign", + renderAsTestMessage: false, + triggerType: .onAnalyticsEvent, + titleText: normalMessageTitle, + bodyText: normalMessageBody, + portraitImageData: portraitImageData, + landscapeImageData: nil, + backgroundColor: UIColor.white, + primaryActionButton: defaultActionButton, + primaryActionURL: URL(string: "http://google.com")!, + secondaryActionButton: nil, + secondaryActionURL: nil) + + displayImpl.displayMessage(cardMessage, displayDelegate: self) + } +} diff --git a/InAppMessagingDisplay/Example/InAppMessagingDisplay-Sample.xcodeproj/project.pbxproj b/InAppMessagingDisplay/Example/InAppMessagingDisplay-Sample.xcodeproj/project.pbxproj index 8698f0fa84e..4eee5093c5f 100644 --- a/InAppMessagingDisplay/Example/InAppMessagingDisplay-Sample.xcodeproj/project.pbxproj +++ b/InAppMessagingDisplay/Example/InAppMessagingDisplay-Sample.xcodeproj/project.pbxproj @@ -7,6 +7,7 @@ objects = { /* Begin PBXBuildFile section */ + 2544AF6B2230656D00C5B420 /* CardMessageViewController.swift in Sources */ = {isa = PBXBuildFile; fileRef = 2544AF6A2230656D00C5B420 /* CardMessageViewController.swift */; }; 4265DE16D92C99B9A6E56539 /* Pods_FiamDisplaySwiftExample.framework in Frameworks */ = {isa = PBXBuildFile; fileRef = 5C72088F73776B875CB106D8 /* Pods_FiamDisplaySwiftExample.framework */; }; AD7200B52124D19200AFD5F3 /* AppDelegate.swift in Sources */ = {isa = PBXBuildFile; fileRef = AD7200B42124D19200AFD5F3 /* AppDelegate.swift */; }; AD7200BA2124D19200AFD5F3 /* Main.storyboard in Resources */ = {isa = PBXBuildFile; fileRef = AD7200B82124D19200AFD5F3 /* Main.storyboard */; }; @@ -34,6 +35,7 @@ /* Begin PBXFileReference section */ 0F66149C0079E8409F390CBE /* Pods-InAppMessagingDisplay-Sample.release.xcconfig */ = {isa = PBXFileReference; includeInIndex = 1; lastKnownFileType = text.xcconfig; name = "Pods-InAppMessagingDisplay-Sample.release.xcconfig"; path = "Pods/Target Support Files/Pods-InAppMessagingDisplay-Sample/Pods-InAppMessagingDisplay-Sample.release.xcconfig"; sourceTree = ""; }; + 2544AF6A2230656D00C5B420 /* CardMessageViewController.swift */ = {isa = PBXFileReference; lastKnownFileType = sourcecode.swift; path = CardMessageViewController.swift; sourceTree = ""; }; 46449F37C45EA76C97C32634 /* Pods-FiamDisplaySwiftExample.release.xcconfig */ = {isa = PBXFileReference; includeInIndex = 1; lastKnownFileType = text.xcconfig; name = "Pods-FiamDisplaySwiftExample.release.xcconfig"; path = "Pods/Target Support Files/Pods-FiamDisplaySwiftExample/Pods-FiamDisplaySwiftExample.release.xcconfig"; sourceTree = ""; }; 5C72088F73776B875CB106D8 /* Pods_FiamDisplaySwiftExample.framework */ = {isa = PBXFileReference; explicitFileType = wrapper.framework; includeInIndex = 0; path = Pods_FiamDisplaySwiftExample.framework; sourceTree = BUILT_PRODUCTS_DIR; }; 8FF302EB136148B923534F2E /* Pods-FiamDisplaySwiftExample.debug.xcconfig */ = {isa = PBXFileReference; includeInIndex = 1; lastKnownFileType = text.xcconfig; name = "Pods-FiamDisplaySwiftExample.debug.xcconfig"; path = "Pods/Target Support Files/Pods-FiamDisplaySwiftExample/Pods-FiamDisplaySwiftExample.debug.xcconfig"; sourceTree = ""; }; @@ -108,6 +110,7 @@ AD7200BB2124D19400AFD5F3 /* Assets.xcassets */, AD7200BD2124D19400AFD5F3 /* LaunchScreen.storyboard */, AD7200C02124D19400AFD5F3 /* Info.plist */, + 2544AF6A2230656D00C5B420 /* CardMessageViewController.swift */, ); path = FiamDisplaySwiftExample; sourceTree = ""; @@ -307,6 +310,7 @@ isa = PBXSourcesBuildPhase; buildActionMask = 2147483647; files = ( + 2544AF6B2230656D00C5B420 /* CardMessageViewController.swift in Sources */, AD7200C82124E24300AFD5F3 /* ImageOnlyMessageViewController.swift in Sources */, AD7200CA2124E24300AFD5F3 /* ModalMessageViewController.swift in Sources */, AD7200CC2124E2A800AFD5F3 /* CommonMessageTestVC.swift in Sources */, From 49d2b210a61abecfb1bf68e98daf632caf9b9687 Mon Sep 17 00:00:00 2001 From: Chris Tibbs Date: Thu, 7 Mar 2019 13:33:31 -0800 Subject: [PATCH 09/57] Wire up Display to show cards --- .../Card/FIDCardViewController.h | 32 ++++++++ .../Card/FIDCardViewController.m | 74 +++++++++++++++++++ 2 files changed, 106 insertions(+) create mode 100644 Firebase/InAppMessagingDisplay/Card/FIDCardViewController.h create mode 100644 Firebase/InAppMessagingDisplay/Card/FIDCardViewController.m diff --git a/Firebase/InAppMessagingDisplay/Card/FIDCardViewController.h b/Firebase/InAppMessagingDisplay/Card/FIDCardViewController.h new file mode 100644 index 00000000000..e152a824779 --- /dev/null +++ b/Firebase/InAppMessagingDisplay/Card/FIDCardViewController.h @@ -0,0 +1,32 @@ +/* + * Copyright 2019 Google + * + * Licensed under the Apache License, Version 2.0 (the "License"); + * you may not use this file except in compliance with the License. + * You may obtain a copy of the License at + * + * http://www.apache.org/licenses/LICENSE-2.0 + * + * Unless required by applicable law or agreed to in writing, software + * distributed under the License is distributed on an "AS IS" BASIS, + * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. + * See the License for the specific language governing permissions and + * limitations under the License. + */ + +#import "FIDBaseRenderingViewController.h" + +@class FIRInAppMessagingCardDisplay; +@protocol FIRInAppMessagingDisplayDelegate; + +NS_ASSUME_NONNULL_BEGIN +@interface FIDCardViewController : FIDBaseRenderingViewController + ++ (FIDCardViewController *) + instantiateViewControllerWithResourceBundle:(NSBundle *)resourceBundle + displayMessage:(FIRInAppMessagingCardDisplay *)cardMessage + displayDelegate:(id)displayDelegate + timeFetcher:(id)timeFetcher; + +@end +NS_ASSUME_NONNULL_END diff --git a/Firebase/InAppMessagingDisplay/Card/FIDCardViewController.m b/Firebase/InAppMessagingDisplay/Card/FIDCardViewController.m new file mode 100644 index 00000000000..ff5a079ff04 --- /dev/null +++ b/Firebase/InAppMessagingDisplay/Card/FIDCardViewController.m @@ -0,0 +1,74 @@ +// +// FIDCardViewController.m +// FirebaseInAppMessagingDisplay +// +// Created by Chris Tibbs on 2/19/19. +// + +#import "FIDCardViewController.h" +#import "FIRCore+InAppMessagingDisplay.h" + +@interface FIDCardViewController () + +@property(nonatomic, readwrite) FIRInAppMessagingCardDisplay *cardDisplayMessage; + +@property (weak, nonatomic) IBOutlet UIImageView *imageView; +@property (weak, nonatomic) IBOutlet UILabel *titleLabel; +@property (weak, nonatomic) IBOutlet UILabel *bodyLabel; +@property (weak, nonatomic) IBOutlet UIButton *primaryActionButton; +@property (weak, nonatomic) IBOutlet UIButton *secondaryActionButton; + +@end + +@implementation FIDCardViewController + ++ (FIDCardViewController *) + instantiateViewControllerWithResourceBundle:(NSBundle *)resourceBundle + displayMessage:(FIRInAppMessagingCardDisplay *)cardMessage + displayDelegate:(id)displayDelegate + timeFetcher:(id)timeFetcher { + UIStoryboard *storyboard = [UIStoryboard storyboardWithName:@"FIRInAppMessageDisplayStoryboard" + bundle:resourceBundle]; + + if (!storyboard) { + FIRLogError(kFIRLoggerInAppMessagingDisplay, @"I-FID300001", + @"Storyboard '" + "FIRInAppMessageDisplayStoryboard' not found in bundle %@", + resourceBundle); + return nil; + } + FIDCardViewController *cardVC = (FIDCardViewController *)[storyboard + instantiateViewControllerWithIdentifier:@"card-view-vc"]; + cardVC.displayDelegate = displayDelegate; + cardVC.cardDisplayMessage = cardMessage; + cardVC.timeFetcher = timeFetcher; + + return cardVC; +} + +- (FIRInAppMessagingDisplayMessage *)inAppMessage { + return self.cardDisplayMessage; +} + +- (void)viewDidLoad { + [super viewDidLoad]; + + // make the background half transparent + [self.view setBackgroundColor:[UIColor.grayColor colorWithAlphaComponent:0.5]]; + + self.titleLabel.text = self.cardDisplayMessage.title; + self.bodyLabel.text = self.cardDisplayMessage.body; + + self.imageView.image = [UIImage imageWithData:self.cardDisplayMessage.portraitImageData.imageRawData]; + + [self.primaryActionButton setTitle:self.cardDisplayMessage.primaryActionButton.buttonText + forState:UIControlStateNormal]; + + if (self.cardDisplayMessage.secondaryActionButton) { + self.secondaryActionButton.hidden = NO; + [self.secondaryActionButton setTitle:self.cardDisplayMessage.secondaryActionButton.buttonText + forState:UIControlStateNormal]; + } +} + +@end From 73189cfddb6978e00048a5aa996b813c3ba87e1b Mon Sep 17 00:00:00 2001 From: Chris Tibbs Date: Thu, 7 Mar 2019 13:56:39 -0800 Subject: [PATCH 10/57] Fix tablet width --- Card/FIDCardViewController.h | 32 -------- Card/FIDCardViewController.m | 70 ------------------ ...IRInAppMessageDisplayStoryboard.storyboard | 42 +++++------ default.profraw | Bin 0 -> 2056 bytes 4 files changed, 21 insertions(+), 123 deletions(-) delete mode 100644 Card/FIDCardViewController.h delete mode 100644 Card/FIDCardViewController.m create mode 100644 default.profraw diff --git a/Card/FIDCardViewController.h b/Card/FIDCardViewController.h deleted file mode 100644 index e152a824779..00000000000 --- a/Card/FIDCardViewController.h +++ /dev/null @@ -1,32 +0,0 @@ -/* - * Copyright 2019 Google - * - * Licensed under the Apache License, Version 2.0 (the "License"); - * you may not use this file except in compliance with the License. - * You may obtain a copy of the License at - * - * http://www.apache.org/licenses/LICENSE-2.0 - * - * Unless required by applicable law or agreed to in writing, software - * distributed under the License is distributed on an "AS IS" BASIS, - * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. - * See the License for the specific language governing permissions and - * limitations under the License. - */ - -#import "FIDBaseRenderingViewController.h" - -@class FIRInAppMessagingCardDisplay; -@protocol FIRInAppMessagingDisplayDelegate; - -NS_ASSUME_NONNULL_BEGIN -@interface FIDCardViewController : FIDBaseRenderingViewController - -+ (FIDCardViewController *) - instantiateViewControllerWithResourceBundle:(NSBundle *)resourceBundle - displayMessage:(FIRInAppMessagingCardDisplay *)cardMessage - displayDelegate:(id)displayDelegate - timeFetcher:(id)timeFetcher; - -@end -NS_ASSUME_NONNULL_END diff --git a/Card/FIDCardViewController.m b/Card/FIDCardViewController.m deleted file mode 100644 index d2022a7b2a6..00000000000 --- a/Card/FIDCardViewController.m +++ /dev/null @@ -1,70 +0,0 @@ -// -// FIDCardViewController.m -// FirebaseInAppMessagingDisplay -// -// Created by Chris Tibbs on 2/19/19. -// - -#import "FIDCardViewController.h" -#import "FIRCore+InAppMessagingDisplay.h" - -@interface FIDCardViewController () - -@property(nonatomic, readwrite) FIRInAppMessagingCardDisplay *cardDisplayMessage; - -@property (weak, nonatomic) IBOutlet UIImageView *imageView; -@property (weak, nonatomic) IBOutlet UILabel *titleLabel; -@property (weak, nonatomic) IBOutlet UILabel *bodyLabel; -@property (weak, nonatomic) IBOutlet UIButton *primaryActionButton; -@property (weak, nonatomic) IBOutlet UIButton *secondaryActionButton; - -@end - -@implementation FIDCardViewController - -+ (FIDCardViewController *) - instantiateViewControllerWithResourceBundle:(NSBundle *)resourceBundle - displayMessage:(FIRInAppMessagingCardDisplay *)cardMessage - displayDelegate:(id)displayDelegate - timeFetcher:(id)timeFetcher { - UIStoryboard *storyboard = [UIStoryboard storyboardWithName:@"FIRInAppMessageDisplaySDtoryboard" - bundle:resourceBundle]; - - if (!storyboard) { - FIRLogError(kFIRLoggerInAppMessagingDisplay, @"I-FID300001", - @"Storyboard '" - "FIRInAppMessageDisplayStoryboard' not found in bundle %@", - resourceBundle); - return nil; - } - FIDCardViewController *cardVC = (FIDCardViewController *)[storyboard - instantiateViewControllerWithIdentifier:@"card-view-vc"]; - cardVC.displayDelegate = displayDelegate; - cardVC.cardDisplayMessage = cardMessage; - cardVC.timeFetcher = timeFetcher; - - return cardVC; -} - -- (FIRInAppMessagingDisplayMessage *)inAppMessage { - return self.cardDisplayMessage; -} - -- (void)viewDidLoad { - [super viewDidLoad]; - - self.titleLabel.text = self.cardDisplayMessage.title; - self.bodyLabel.text = self.cardDisplayMessage.body; - - self.imageView.image = [UIImage imageWithData:self.cardDisplayMessage.portraitImageData.imageRawData]; - - [self.primaryActionButton setTitle:self.cardDisplayMessage.primaryActionButton.buttonText - forState:UIControlStateNormal]; - - if (self.cardDisplayMessage.secondaryActionButton) { - [self.secondaryActionButton setTitle:self.cardDisplayMessage.secondaryActionButton.buttonText - forState:UIControlStateNormal]; - } -} - -@end diff --git a/Firebase/InAppMessagingDisplay/Resources/FIRInAppMessageDisplayStoryboard.storyboard b/Firebase/InAppMessagingDisplay/Resources/FIRInAppMessageDisplayStoryboard.storyboard index d7f8afe2679..5126b885225 100644 --- a/Firebase/InAppMessagingDisplay/Resources/FIRInAppMessageDisplayStoryboard.storyboard +++ b/Firebase/InAppMessagingDisplay/Resources/FIRInAppMessageDisplayStoryboard.storyboard @@ -1,6 +1,6 @@ - + @@ -18,7 +18,7 @@ - + @@ -59,11 +59,11 @@ - + - + @@ -73,14 +73,14 @@ - + @@ -306,7 +306,7 @@ @@ -430,7 +430,7 @@ - + diff --git a/default.profraw b/default.profraw new file mode 100644 index 0000000000000000000000000000000000000000..21cf05d5a993beaff95849858591d68e67804dd8 GIT binary patch literal 2056 zcmZoHO3N=Q$obF000E*%Jl2)hbS5qF(?cH`F>*(d$( zNW#T7==IGd;@eF&yr1FHT24)r(f zXB+Qt_fm z)4TR*MzM36EXjbXH$YPl3(t)lR;Z4h+{wW#X(pyqpNDM&B= zf7k`)-w9Cl3azN>VgBXWZuh|D*!$^M-~M~qFh5*#22_0mntE7x&Z>QG$1;;+F3kKL zQ1uVmu$zCuPU=p5ll9&}70roDJh&JRK-Dj3M^z6qUr^xgMc+>a&U*u*A2mI5YJ31y z&(MLYUKr{C8Q;SP4X&C8NRTLM#yl{cV+K<{1FAj%hkBSlVBwEW z!{iCk==xxMm_8UEMl(SfFnM%7OdOqt=|`tw>d?i93LoA5Fg}ci`2(E~6DO61nS)Nl z%z=r+_=IS5^)Nm>#jUA*r~Q}>d0eN;uM!ZIE?cap z(cQIz`L)K9=`%AXS!}vH@kjNtr7J@sN}pHP{Mm5#oYB)&@=RviZtqoI8Ww%NsgK>V zRXk(8%;^uSPKa+ATzKNwY7@vOJgcBVwC}=$<>=0)~yRzPDD$_S(Pd zSY%jn^gXj(en Date: Mon, 11 Mar 2019 11:33:27 -0700 Subject: [PATCH 11/57] Pick right image for orientation --- .../Card/FIDCardViewController.m | 16 +++++-- ...IRInAppMessageDisplayStoryboard.storyboard | 44 +++++++++---------- 2 files changed, 35 insertions(+), 25 deletions(-) diff --git a/Firebase/InAppMessagingDisplay/Card/FIDCardViewController.m b/Firebase/InAppMessagingDisplay/Card/FIDCardViewController.m index ff5a079ff04..d39e5eaa242 100644 --- a/Firebase/InAppMessagingDisplay/Card/FIDCardViewController.m +++ b/Firebase/InAppMessagingDisplay/Card/FIDCardViewController.m @@ -58,9 +58,7 @@ - (void)viewDidLoad { self.titleLabel.text = self.cardDisplayMessage.title; self.bodyLabel.text = self.cardDisplayMessage.body; - - self.imageView.image = [UIImage imageWithData:self.cardDisplayMessage.portraitImageData.imageRawData]; - + [self.primaryActionButton setTitle:self.cardDisplayMessage.primaryActionButton.buttonText forState:UIControlStateNormal]; @@ -71,4 +69,16 @@ - (void)viewDidLoad { } } +- (void)viewDidLayoutSubviews { + [super viewDidLayoutSubviews]; + + if (self.traitCollection.horizontalSizeClass == UIUserInterfaceSizeClassRegular || + self.traitCollection.verticalSizeClass == UIUserInterfaceSizeClassCompact) { + NSData *imageData = self.cardDisplayMessage.landscapeImageData ? self.cardDisplayMessage.landscapeImageData.imageRawData : self.cardDisplayMessage.portraitImageData.imageRawData; + self.imageView.image = [UIImage imageWithData:imageData]; + } else { + self.imageView.image = [UIImage imageWithData:self.cardDisplayMessage.portraitImageData.imageRawData]; + } +} + @end diff --git a/Firebase/InAppMessagingDisplay/Resources/FIRInAppMessageDisplayStoryboard.storyboard b/Firebase/InAppMessagingDisplay/Resources/FIRInAppMessageDisplayStoryboard.storyboard index 5126b885225..85b6d080ce5 100644 --- a/Firebase/InAppMessagingDisplay/Resources/FIRInAppMessageDisplayStoryboard.storyboard +++ b/Firebase/InAppMessagingDisplay/Resources/FIRInAppMessageDisplayStoryboard.storyboard @@ -237,12 +237,6 @@ - - - - - - @@ -251,6 +245,12 @@ + + + + + + @@ -261,12 +261,12 @@ - - - + + + @@ -274,23 +274,23 @@ + + - - - - - + + + @@ -390,7 +390,7 @@ - + @@ -402,24 +402,24 @@ - - + @@ -555,6 +555,7 @@ + diff --git a/FirebaseInAppMessaging.podspec b/FirebaseInAppMessaging.podspec index b10e0ca66fc..e5073920517 100644 --- a/FirebaseInAppMessaging.podspec +++ b/FirebaseInAppMessaging.podspec @@ -1,6 +1,6 @@ Pod::Spec.new do |s| s.name = 'FirebaseInAppMessaging' - s.version = '0.14.0' + s.version = '0.13.0' s.summary = 'Firebase In-App Messaging for iOS' s.description = <<-DESC diff --git a/FirebaseInAppMessagingDisplay.podspec b/FirebaseInAppMessagingDisplay.podspec index f426a08e549..f93eddb0f7a 100644 --- a/FirebaseInAppMessagingDisplay.podspec +++ b/FirebaseInAppMessagingDisplay.podspec @@ -1,6 +1,6 @@ Pod::Spec.new do |s| s.name = 'FirebaseInAppMessagingDisplay' - s.version = '0.14.0' + s.version = '0.13.1' s.summary = 'Firebase In-App Messaging UI for iOS' s.description = <<-DESC @@ -41,5 +41,5 @@ Firebase In-App Messaging SDK. } s.dependency 'FirebaseCore' - s.dependency 'FirebaseInAppMessaging', '>=0.14.0' + s.dependency 'FirebaseInAppMessaging', '>=0.13.0' end From 04c8ad17c020a089c62ca207b7b65bc82ea926a0 Mon Sep 17 00:00:00 2001 From: Chris Tibbs Date: Wed, 17 Apr 2019 14:51:25 -0400 Subject: [PATCH 24/57] Don't animate scroll to top on scroll view --- Firebase/InAppMessagingDisplay/Card/FIDCardViewController.m | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/Firebase/InAppMessagingDisplay/Card/FIDCardViewController.m b/Firebase/InAppMessagingDisplay/Card/FIDCardViewController.m index 2690e3fe044..bfface15b6c 100644 --- a/Firebase/InAppMessagingDisplay/Card/FIDCardViewController.m +++ b/Firebase/InAppMessagingDisplay/Card/FIDCardViewController.m @@ -121,7 +121,7 @@ - (void)viewDidLayoutSubviews { self.bodyTextView.scrollEnabled = textHeight > self.bodyTextView.frame.size.height; if (self.bodyTextView.scrollEnabled) { - [self.bodyTextView setContentOffset:CGPointZero animated:YES]; + [self.bodyTextView setContentOffset:CGPointZero animated:NO]; } } From 81584b394dd4879405bb39f6b891b3b7a8f3a8f8 Mon Sep 17 00:00:00 2001 From: Chris Tibbs Date: Wed, 17 Apr 2019 18:38:00 -0400 Subject: [PATCH 25/57] Fix text scrolling bug --- .../Card/FIDCardViewController.m | 13 ++--- ...IRInAppMessageDisplayStoryboard.storyboard | 56 +++++++++++-------- 2 files changed, 38 insertions(+), 31 deletions(-) diff --git a/Firebase/InAppMessagingDisplay/Card/FIDCardViewController.m b/Firebase/InAppMessagingDisplay/Card/FIDCardViewController.m index bfface15b6c..fad4a08c757 100644 --- a/Firebase/InAppMessagingDisplay/Card/FIDCardViewController.m +++ b/Firebase/InAppMessagingDisplay/Card/FIDCardViewController.m @@ -18,6 +18,7 @@ @interface FIDCardViewController () @property (weak, nonatomic) IBOutlet UIButton *primaryActionButton; @property (weak, nonatomic) IBOutlet UIButton *secondaryActionButton; @property (weak, nonatomic) IBOutlet UITextView *bodyTextView; +@property (weak, nonatomic) IBOutlet UIScrollView *textAreaScrollView; @end @@ -114,15 +115,9 @@ - (void)viewDidLayoutSubviews { } else { self.imageView.image = [UIImage imageWithData:self.cardDisplayMessage.portraitImageData.imageRawData]; } - - CGFloat textViewWidth = self.bodyTextView.frame.size.width; - CGFloat textHeight = [self determineTextAreaViewFitHeightForView:self.bodyTextView withWidth:textViewWidth]; - self.bodyTextView.contentSize = CGSizeMake(textViewWidth, textHeight); - self.bodyTextView.scrollEnabled = textHeight > self.bodyTextView.frame.size.height; - - if (self.bodyTextView.scrollEnabled) { - [self.bodyTextView setContentOffset:CGPointZero animated:NO]; - } + + self.textAreaScrollView.contentSize = self.bodyTextView.frame.size; + [self.textAreaScrollView setContentOffset:CGPointZero]; } - (CGFloat)determineTextAreaViewFitHeightForView:(UIView *)textView diff --git a/Firebase/InAppMessagingDisplay/Resources/FIRInAppMessageDisplayStoryboard.storyboard b/Firebase/InAppMessagingDisplay/Resources/FIRInAppMessageDisplayStoryboard.storyboard index 1f75d7aab1d..bf982934b7b 100644 --- a/Firebase/InAppMessagingDisplay/Resources/FIRInAppMessageDisplayStoryboard.storyboard +++ b/Firebase/InAppMessagingDisplay/Resources/FIRInAppMessageDisplayStoryboard.storyboard @@ -433,12 +433,25 @@ - + - - - - + + + + + + + + + + + + + + + + + + + + + + + diff --git a/InAppMessagingDisplay/Example/FiamDisplaySwiftExample/CardMessageViewController.swift b/InAppMessagingDisplay/Example/FiamDisplaySwiftExample/CardMessageViewController.swift index 344d7442101..440233c66c3 100644 --- a/InAppMessagingDisplay/Example/FiamDisplaySwiftExample/CardMessageViewController.swift +++ b/InAppMessagingDisplay/Example/FiamDisplaySwiftExample/CardMessageViewController.swift @@ -26,6 +26,7 @@ class CardMessageViewController: CommonMessageTestVC { triggerType: .onAnalyticsEvent, titleText: normalMessageTitle, bodyText: normalMessageBody, + textColor: UIColor.black, portraitImageData: portraitImageData, landscapeImageData: landscapeImageData, backgroundColor: UIColor.white, @@ -47,6 +48,7 @@ class CardMessageViewController: CommonMessageTestVC { triggerType: .onAnalyticsEvent, titleText: normalMessageTitle, bodyText: normalMessageBody, + textColor: UIColor.black, portraitImageData: portraitImageData, landscapeImageData: nil, backgroundColor: UIColor.white, @@ -71,6 +73,7 @@ class CardMessageViewController: CommonMessageTestVC { triggerType: .onAnalyticsEvent, titleText: normalMessageTitle, bodyText: normalMessageBody, + textColor: UIColor.black, portraitImageData: portraitImageData, landscapeImageData: landscapeImageData, backgroundColor: UIColor.white, @@ -82,7 +85,7 @@ class CardMessageViewController: CommonMessageTestVC { displayImpl.displayMessage(cardMessage, displayDelegate: self) } - @IBAction func showRegularTwoButtonWithOnlyPortrait(_ sender: Any) { + @IBAction func showLongTitleRegularBody(_ sender: Any) { let portraitImageRawData = produceImageOfSize(size: CGSize(width: 300, height: 200)) let portraitImageData = InAppMessagingImageData(imageURL: "url not important", imageData: portraitImageRawData!) @@ -90,8 +93,53 @@ class CardMessageViewController: CommonMessageTestVC { campaignName: "testCampaign", renderAsTestMessage: false, triggerType: .onAnalyticsEvent, - titleText: normalMessageTitle, + titleText: longTitleText, bodyText: normalMessageBody, + textColor: UIColor.black, + portraitImageData: portraitImageData, + landscapeImageData: nil, + backgroundColor: UIColor.white, + primaryActionButton: defaultActionButton, + primaryActionURL: URL(string: "http://google.com")!, + secondaryActionButton: defaultSecondaryActionButton, + secondaryActionURL: nil) + + displayImpl.displayMessage(cardMessage, displayDelegate: self) + } + + @IBAction func showRegularTitleLongBody(_ sender: Any) { + let portraitImageRawData = produceImageOfSize(size: CGSize(width: 300, height: 200)) + let portraitImageData = InAppMessagingImageData(imageURL: "url not important", imageData: portraitImageRawData!) + + let cardMessage = InAppMessagingCardDisplay(messageID: "testID", + campaignName: "testCampaign", + renderAsTestMessage: false, + triggerType: .onAnalyticsEvent, + titleText: normalMessageTitle, + bodyText: longBodyText, + textColor: UIColor.black, + portraitImageData: portraitImageData, + landscapeImageData: nil, + backgroundColor: UIColor.white, + primaryActionButton: defaultActionButton, + primaryActionURL: URL(string: "http://google.com")!, + secondaryActionButton: defaultSecondaryActionButton, + secondaryActionURL: nil) + + displayImpl.displayMessage(cardMessage, displayDelegate: self) + } + + @IBAction func showLongTitleNoBody(_ sender: Any) { + let portraitImageRawData = produceImageOfSize(size: CGSize(width: 300, height: 200)) + let portraitImageData = InAppMessagingImageData(imageURL: "url not important", imageData: portraitImageRawData!) + + let cardMessage = InAppMessagingCardDisplay(messageID: "testID", + campaignName: "testCampaign", + renderAsTestMessage: false, + triggerType: .onAnalyticsEvent, + titleText: longTitleText, + bodyText: nil, + textColor: UIColor.black, portraitImageData: portraitImageData, landscapeImageData: nil, backgroundColor: UIColor.white, @@ -102,4 +150,92 @@ class CardMessageViewController: CommonMessageTestVC { displayImpl.displayMessage(cardMessage, displayDelegate: self) } + + @IBAction func showLongPrimaryButton(_ sender: Any) { + let portraitImageRawData = produceImageOfSize(size: CGSize(width: 300, height: 200)) + let portraitImageData = InAppMessagingImageData(imageURL: "url not important", imageData: portraitImageRawData!) + + let cardMessage = InAppMessagingCardDisplay(messageID: "testID", + campaignName: "testCampaign", + renderAsTestMessage: false, + triggerType: .onAnalyticsEvent, + titleText: longTitleText, + bodyText: normalMessageBody, + textColor: UIColor.black, + portraitImageData: portraitImageData, + landscapeImageData: nil, + backgroundColor: UIColor.white, + primaryActionButton: longTextButton, + primaryActionURL: URL(string: "http://google.com")!, + secondaryActionButton: defaultSecondaryActionButton, + secondaryActionURL: nil) + + displayImpl.displayMessage(cardMessage, displayDelegate: self) + } + + @IBAction func showLongSecondaryButton(_ sender: Any) { + let portraitImageRawData = produceImageOfSize(size: CGSize(width: 300, height: 200)) + let portraitImageData = InAppMessagingImageData(imageURL: "url not important", imageData: portraitImageRawData!) + + let cardMessage = InAppMessagingCardDisplay(messageID: "testID", + campaignName: "testCampaign", + renderAsTestMessage: false, + triggerType: .onAnalyticsEvent, + titleText: longTitleText, + bodyText: normalMessageBody, + textColor: UIColor.black, + portraitImageData: portraitImageData, + landscapeImageData: nil, + backgroundColor: UIColor.white, + primaryActionButton: defaultActionButton, + primaryActionURL: URL(string: "http://google.com")!, + secondaryActionButton: longTextButton, + secondaryActionURL: nil) + + displayImpl.displayMessage(cardMessage, displayDelegate: self) + } + + @IBAction func showSmallImage(_ sender: Any) { + let portraitImageRawData = produceImageOfSize(size: CGSize(width: 30, height: 20)) + let portraitImageData = InAppMessagingImageData(imageURL: "url not important", imageData: portraitImageRawData!) + + let cardMessage = InAppMessagingCardDisplay(messageID: "testID", + campaignName: "testCampaign", + renderAsTestMessage: false, + triggerType: .onAnalyticsEvent, + titleText: normalMessageTitle, + bodyText: normalMessageBody, + textColor: UIColor.black, + portraitImageData: portraitImageData, + landscapeImageData: nil, + backgroundColor: UIColor.white, + primaryActionButton: defaultActionButton, + primaryActionURL: URL(string: "http://google.com")!, + secondaryActionButton: nil, + secondaryActionURL: nil) + + displayImpl.displayMessage(cardMessage, displayDelegate: self) + } + + @IBAction func showHugeImage(_ sender: Any) { + let portraitImageRawData = produceImageOfSize(size: CGSize(width: 3000, height: 2000)) + let portraitImageData = InAppMessagingImageData(imageURL: "url not important", imageData: portraitImageRawData!) + + let cardMessage = InAppMessagingCardDisplay(messageID: "testID", + campaignName: "testCampaign", + renderAsTestMessage: false, + triggerType: .onAnalyticsEvent, + titleText: normalMessageTitle, + bodyText: normalMessageBody, + textColor: UIColor.black, + portraitImageData: portraitImageData, + landscapeImageData: nil, + backgroundColor: UIColor.white, + primaryActionButton: defaultActionButton, + primaryActionURL: URL(string: "http://google.com")!, + secondaryActionButton: nil, + secondaryActionURL: nil) + + displayImpl.displayMessage(cardMessage, displayDelegate: self) + } } diff --git a/InAppMessagingDisplay/Example/FiamDisplaySwiftExample/CommonMessageTestVC.swift b/InAppMessagingDisplay/Example/FiamDisplaySwiftExample/CommonMessageTestVC.swift index 37ccc22dfbd..d7281af0a92 100644 --- a/InAppMessagingDisplay/Example/FiamDisplaySwiftExample/CommonMessageTestVC.swift +++ b/InAppMessagingDisplay/Example/FiamDisplaySwiftExample/CommonMessageTestVC.swift @@ -16,13 +16,14 @@ import Foundation -class CommonMessageTestVC: UIViewController, InAppMessagingDisplayDelegate { +class CommonMessageTestVC: UIViewController, InAppMessagingDisplayDelegate { var messageClosedWithClick = false var messageClosedDismiss = false // start of InAppMessagingDisplayDelegate functions - func messageClicked(_ inAppMessage: InAppMessagingDisplayMessage) { + func messageClicked(_ inAppMessage: InAppMessagingDisplayMessage, + with action: FIRInAppMessagingAction) { print("message clicked to follow action url") messageClosedWithClick = true } @@ -58,6 +59,10 @@ class CommonMessageTestVC: UIViewController, InAppMessagingDisplayDelegate { let defaultSecondaryActionButton = InAppMessagingActionButton(buttonText: "Take another action", buttonTextColor: UIColor.black, backgroundColor: UIColor.yellow) + + let longTextButton = InAppMessagingActionButton(buttonText: "Hakuna matata, it's a wonderful phrase", + buttonTextColor: UIColor.black, + backgroundColor: UIColor.white) func produceImageOfSize(size: CGSize) -> Data? { let color = UIColor.cyan diff --git a/InAppMessagingDisplay/Example/FiamDisplaySwiftExample/ImageOnlyMessageViewController.swift b/InAppMessagingDisplay/Example/FiamDisplaySwiftExample/ImageOnlyMessageViewController.swift index 1d6a8cfc42e..5c01147f4a9 100644 --- a/InAppMessagingDisplay/Example/FiamDisplaySwiftExample/ImageOnlyMessageViewController.swift +++ b/InAppMessagingDisplay/Example/FiamDisplaySwiftExample/ImageOnlyMessageViewController.swift @@ -20,14 +20,15 @@ class ImageOnlyMessageViewController: CommonMessageTestVC { @IBOutlet var verifyLabel: UILabel! - override func messageClicked(_ inAppMessage: InAppMessagingDisplayMessage) { - super.messageClicked(inAppMessage) + override func messageClicked(_ inAppMessage: InAppMessagingDisplayMessage, + with action: FIRInAppMessagingAction) { + super.messageClicked(inAppMessage, with: action) verifyLabel.text = "message clicked!" } override func messageDismissed(_ inAppMessage: InAppMessagingDisplayMessage, dismissType: FIRInAppMessagingDismissType) { - super.messageClicked(inAppMessage) + super.messageDismissed(inAppMessage, dismissType: dismissType) verifyLabel.text = "message dismissed!" } diff --git a/InAppMessagingDisplay/Example/FiamDisplaySwiftExample/ModalMessageViewController.swift b/InAppMessagingDisplay/Example/FiamDisplaySwiftExample/ModalMessageViewController.swift index 6ba528acc76..a3942e5a987 100644 --- a/InAppMessagingDisplay/Example/FiamDisplaySwiftExample/ModalMessageViewController.swift +++ b/InAppMessagingDisplay/Example/FiamDisplaySwiftExample/ModalMessageViewController.swift @@ -21,14 +21,15 @@ class ModalMessageViewController: CommonMessageTestVC { @IBOutlet var verifyLabel: UILabel! - override func messageClicked(_ inAppMessage: InAppMessagingDisplayMessage) { - super.messageClicked(inAppMessage) + override func messageClicked(_ inAppMessage: InAppMessagingDisplayMessage, + with action: FIRInAppMessagingAction) { + super.messageClicked(inAppMessage, with: action) verifyLabel.text = "message clicked!" } override func messageDismissed(_ inAppMessage: InAppMessagingDisplayMessage, dismissType: FIRInAppMessagingDismissType) { - super.messageClicked(inAppMessage) + super.messageDismissed(inAppMessage, dismissType: dismissType) verifyLabel.text = "message dismissed!" } diff --git a/InAppMessagingDisplay/Example/InAppMessagingDisplay-Sample.xcodeproj/project.pbxproj b/InAppMessagingDisplay/Example/InAppMessagingDisplay-Sample.xcodeproj/project.pbxproj index 5010f666204..f458ccf5af6 100644 --- a/InAppMessagingDisplay/Example/InAppMessagingDisplay-Sample.xcodeproj/project.pbxproj +++ b/InAppMessagingDisplay/Example/InAppMessagingDisplay-Sample.xcodeproj/project.pbxproj @@ -3,12 +3,12 @@ archiveVersion = 1; classes = { }; - objectVersion = 51; + objectVersion = 50; objects = { /* Begin PBXBuildFile section */ 2544AF6B2230656D00C5B420 /* CardMessageViewController.swift in Sources */ = {isa = PBXBuildFile; fileRef = 2544AF6A2230656D00C5B420 /* CardMessageViewController.swift */; }; - 4265DE16D92C99B9A6E56539 /* Pods_FiamDisplaySwiftExample.framework in Frameworks */ = {isa = PBXBuildFile; fileRef = 5C72088F73776B875CB106D8 /* Pods_FiamDisplaySwiftExample.framework */; }; + 65EEF8062812F4285CE916C6 /* Pods_FiamDisplaySwiftExample.framework in Frameworks */ = {isa = PBXBuildFile; fileRef = CC4D5F99DA1A0238D59C7185 /* Pods_FiamDisplaySwiftExample.framework */; }; AD7200B52124D19200AFD5F3 /* AppDelegate.swift in Sources */ = {isa = PBXBuildFile; fileRef = AD7200B42124D19200AFD5F3 /* AppDelegate.swift */; }; AD7200BA2124D19200AFD5F3 /* Main.storyboard in Resources */ = {isa = PBXBuildFile; fileRef = AD7200B82124D19200AFD5F3 /* Main.storyboard */; }; AD7200BC2124D19400AFD5F3 /* Assets.xcassets in Resources */ = {isa = PBXBuildFile; fileRef = AD7200BB2124D19400AFD5F3 /* Assets.xcassets */; }; @@ -34,11 +34,8 @@ /* End PBXContainerItemProxy section */ /* Begin PBXFileReference section */ - 0F66149C0079E8409F390CBE /* Pods-InAppMessagingDisplay-Sample.release.xcconfig */ = {isa = PBXFileReference; includeInIndex = 1; lastKnownFileType = text.xcconfig; name = "Pods-InAppMessagingDisplay-Sample.release.xcconfig"; path = "Pods/Target Support Files/Pods-InAppMessagingDisplay-Sample/Pods-InAppMessagingDisplay-Sample.release.xcconfig"; sourceTree = ""; }; 2544AF6A2230656D00C5B420 /* CardMessageViewController.swift */ = {isa = PBXFileReference; lastKnownFileType = sourcecode.swift; path = CardMessageViewController.swift; sourceTree = ""; }; - 46449F37C45EA76C97C32634 /* Pods-FiamDisplaySwiftExample.release.xcconfig */ = {isa = PBXFileReference; includeInIndex = 1; lastKnownFileType = text.xcconfig; name = "Pods-FiamDisplaySwiftExample.release.xcconfig"; path = "Pods/Target Support Files/Pods-FiamDisplaySwiftExample/Pods-FiamDisplaySwiftExample.release.xcconfig"; sourceTree = ""; }; - 5C72088F73776B875CB106D8 /* Pods_FiamDisplaySwiftExample.framework */ = {isa = PBXFileReference; explicitFileType = wrapper.framework; includeInIndex = 0; path = Pods_FiamDisplaySwiftExample.framework; sourceTree = BUILT_PRODUCTS_DIR; }; - 8FF302EB136148B923534F2E /* Pods-FiamDisplaySwiftExample.debug.xcconfig */ = {isa = PBXFileReference; includeInIndex = 1; lastKnownFileType = text.xcconfig; name = "Pods-FiamDisplaySwiftExample.debug.xcconfig"; path = "Pods/Target Support Files/Pods-FiamDisplaySwiftExample/Pods-FiamDisplaySwiftExample.debug.xcconfig"; sourceTree = ""; }; + AC6B055EA6ABACFAF95EAEA6 /* Pods-FiamDisplaySwiftExample.release.xcconfig */ = {isa = PBXFileReference; includeInIndex = 1; lastKnownFileType = text.xcconfig; name = "Pods-FiamDisplaySwiftExample.release.xcconfig"; path = "Pods/Target Support Files/Pods-FiamDisplaySwiftExample/Pods-FiamDisplaySwiftExample.release.xcconfig"; sourceTree = ""; }; AD7200B22124D19200AFD5F3 /* FiamDisplaySwiftExample.app */ = {isa = PBXFileReference; explicitFileType = wrapper.application; includeInIndex = 0; path = FiamDisplaySwiftExample.app; sourceTree = BUILT_PRODUCTS_DIR; }; AD7200B42124D19200AFD5F3 /* AppDelegate.swift */ = {isa = PBXFileReference; lastKnownFileType = sourcecode.swift; path = AppDelegate.swift; sourceTree = ""; }; AD7200B92124D19200AFD5F3 /* Base */ = {isa = PBXFileReference; lastKnownFileType = file.storyboard; name = Base; path = Base.lproj/Main.storyboard; sourceTree = ""; }; @@ -55,6 +52,8 @@ AD7200DB2126136D00AFD5F3 /* InAppMessagingDisplayUITestsBase.swift */ = {isa = PBXFileReference; lastKnownFileType = sourcecode.swift; path = InAppMessagingDisplayUITestsBase.swift; sourceTree = ""; }; AD7200DD2126147100AFD5F3 /* InAppMessagingDisplayBannerViewUITests.swift */ = {isa = PBXFileReference; lastKnownFileType = sourcecode.swift; path = InAppMessagingDisplayBannerViewUITests.swift; sourceTree = ""; }; AD7200DF2126150600AFD5F3 /* InAppMessagingDisplayImageOnlyViewUITests.swift */ = {isa = PBXFileReference; lastKnownFileType = sourcecode.swift; path = InAppMessagingDisplayImageOnlyViewUITests.swift; sourceTree = ""; }; + B8776021E73E0BF1940A1D04 /* Pods-FiamDisplaySwiftExample.debug.xcconfig */ = {isa = PBXFileReference; includeInIndex = 1; lastKnownFileType = text.xcconfig; name = "Pods-FiamDisplaySwiftExample.debug.xcconfig"; path = "Pods/Target Support Files/Pods-FiamDisplaySwiftExample/Pods-FiamDisplaySwiftExample.debug.xcconfig"; sourceTree = ""; }; + CC4D5F99DA1A0238D59C7185 /* Pods_FiamDisplaySwiftExample.framework */ = {isa = PBXFileReference; explicitFileType = wrapper.framework; includeInIndex = 0; path = Pods_FiamDisplaySwiftExample.framework; sourceTree = BUILT_PRODUCTS_DIR; }; /* End PBXFileReference section */ /* Begin PBXFrameworksBuildPhase section */ @@ -62,6 +61,7 @@ isa = PBXFrameworksBuildPhase; buildActionMask = 2147483647; files = ( + 65EEF8062812F4285CE916C6 /* Pods_FiamDisplaySwiftExample.framework in Frameworks */, ); runOnlyForDeploymentPostprocessing = 0; }; @@ -82,12 +82,12 @@ AD7200C62124E24300AFD5F3 /* BannerMessageViewController.swift */, AD7200C52124E24200AFD5F3 /* ImageOnlyMessageViewController.swift */, AD7200C72124E24300AFD5F3 /* ModalMessageViewController.swift */, + 2544AF6A2230656D00C5B420 /* CardMessageViewController.swift */, AD7200B42124D19200AFD5F3 /* AppDelegate.swift */, AD7200B82124D19200AFD5F3 /* Main.storyboard */, AD7200BB2124D19400AFD5F3 /* Assets.xcassets */, AD7200BD2124D19400AFD5F3 /* LaunchScreen.storyboard */, AD7200C02124D19400AFD5F3 /* Info.plist */, - 2544AF6A2230656D00C5B420 /* CardMessageViewController.swift */, ); path = FiamDisplaySwiftExample; sourceTree = ""; @@ -110,6 +110,8 @@ AD7200B32124D19200AFD5F3 /* FiamDisplaySwiftExample */, AD7200D22125F92100AFD5F3 /* InAppMessagingDisplay-UITests */, ADA7B5B921223CED00B1C614 /* Products */, + FCA66209D7188F744DAD2262 /* Pods */, + E245F88BD78CC8A8280F329F /* Frameworks */, ); sourceTree = ""; }; @@ -122,6 +124,23 @@ name = Products; sourceTree = ""; }; + E245F88BD78CC8A8280F329F /* Frameworks */ = { + isa = PBXGroup; + children = ( + CC4D5F99DA1A0238D59C7185 /* Pods_FiamDisplaySwiftExample.framework */, + ); + name = Frameworks; + sourceTree = ""; + }; + FCA66209D7188F744DAD2262 /* Pods */ = { + isa = PBXGroup; + children = ( + B8776021E73E0BF1940A1D04 /* Pods-FiamDisplaySwiftExample.debug.xcconfig */, + AC6B055EA6ABACFAF95EAEA6 /* Pods-FiamDisplaySwiftExample.release.xcconfig */, + ); + name = Pods; + sourceTree = ""; + }; /* End PBXGroup section */ /* Begin PBXNativeTarget section */ @@ -129,9 +148,12 @@ isa = PBXNativeTarget; buildConfigurationList = AD7200C32124D19400AFD5F3 /* Build configuration list for PBXNativeTarget "FiamDisplaySwiftExample" */; buildPhases = ( + 6749464D694A4DE6A1B9B34A /* [CP] Check Pods Manifest.lock */, AD7200AE2124D19200AFD5F3 /* Sources */, AD7200AF2124D19200AFD5F3 /* Frameworks */, AD7200B02124D19200AFD5F3 /* Resources */, + 13715CF1BB8FE93FA5796D7C /* [CP] Embed Pods Frameworks */, + 03AE05BD4DCE9E3FAD6572E8 /* [CP] Copy Pods Resources */, ); buildRules = ( ); @@ -218,6 +240,75 @@ }; /* End PBXResourcesBuildPhase section */ +/* Begin PBXShellScriptBuildPhase section */ + 03AE05BD4DCE9E3FAD6572E8 /* [CP] Copy Pods Resources */ = { + isa = PBXShellScriptBuildPhase; + buildActionMask = 2147483647; + files = ( + ); + inputFileListPaths = ( + ); + inputPaths = ( + "${SRCROOT}/Pods/Target Support Files/Pods-FiamDisplaySwiftExample/Pods-FiamDisplaySwiftExample-resources.sh", + "${PODS_CONFIGURATION_BUILD_DIR}/FirebaseInAppMessagingDisplay/InAppMessagingDisplayResources.bundle", + ); + name = "[CP] Copy Pods Resources"; + outputFileListPaths = ( + ); + outputPaths = ( + "${TARGET_BUILD_DIR}/${UNLOCALIZED_RESOURCES_FOLDER_PATH}/InAppMessagingDisplayResources.bundle", + ); + runOnlyForDeploymentPostprocessing = 0; + shellPath = /bin/sh; + shellScript = "\"${SRCROOT}/Pods/Target Support Files/Pods-FiamDisplaySwiftExample/Pods-FiamDisplaySwiftExample-resources.sh\"\n"; + showEnvVarsInLog = 0; + }; + 13715CF1BB8FE93FA5796D7C /* [CP] Embed Pods Frameworks */ = { + isa = PBXShellScriptBuildPhase; + buildActionMask = 2147483647; + files = ( + ); + inputFileListPaths = ( + ); + inputPaths = ( + "${SRCROOT}/Pods/Target Support Files/Pods-FiamDisplaySwiftExample/Pods-FiamDisplaySwiftExample-frameworks.sh", + "${BUILT_PRODUCTS_DIR}/GoogleUtilities/GoogleUtilities.framework", + ); + name = "[CP] Embed Pods Frameworks"; + outputFileListPaths = ( + ); + outputPaths = ( + "${TARGET_BUILD_DIR}/${FRAMEWORKS_FOLDER_PATH}/GoogleUtilities.framework", + ); + runOnlyForDeploymentPostprocessing = 0; + shellPath = /bin/sh; + shellScript = "\"${SRCROOT}/Pods/Target Support Files/Pods-FiamDisplaySwiftExample/Pods-FiamDisplaySwiftExample-frameworks.sh\"\n"; + showEnvVarsInLog = 0; + }; + 6749464D694A4DE6A1B9B34A /* [CP] Check Pods Manifest.lock */ = { + isa = PBXShellScriptBuildPhase; + buildActionMask = 2147483647; + files = ( + ); + inputFileListPaths = ( + ); + inputPaths = ( + "${PODS_PODFILE_DIR_PATH}/Podfile.lock", + "${PODS_ROOT}/Manifest.lock", + ); + name = "[CP] Check Pods Manifest.lock"; + outputFileListPaths = ( + ); + outputPaths = ( + "$(DERIVED_FILE_DIR)/Pods-FiamDisplaySwiftExample-checkManifestLockResult.txt", + ); + runOnlyForDeploymentPostprocessing = 0; + shellPath = /bin/sh; + shellScript = "diff \"${PODS_PODFILE_DIR_PATH}/Podfile.lock\" \"${PODS_ROOT}/Manifest.lock\" > /dev/null\nif [ $? != 0 ] ; then\n # print error to STDERR\n echo \"error: The sandbox is not in sync with the Podfile.lock. Run 'pod install' or update your CocoaPods installation.\" >&2\n exit 1\nfi\n# This output is used by Xcode 'outputs' to avoid re-running this script phase.\necho \"SUCCESS\" > \"${SCRIPT_OUTPUT_FILE_0}\"\n"; + showEnvVarsInLog = 0; + }; +/* End PBXShellScriptBuildPhase section */ + /* Begin PBXSourcesBuildPhase section */ AD7200AE2124D19200AFD5F3 /* Sources */ = { isa = PBXSourcesBuildPhase; @@ -275,6 +366,7 @@ /* Begin XCBuildConfiguration section */ AD7200C12124D19400AFD5F3 /* Debug */ = { isa = XCBuildConfiguration; + baseConfigurationReference = B8776021E73E0BF1940A1D04 /* Pods-FiamDisplaySwiftExample.debug.xcconfig */; buildSettings = { ASSETCATALOG_COMPILER_APPICON_NAME = AppIcon; CODE_SIGN_STYLE = Automatic; @@ -295,6 +387,7 @@ }; AD7200C22124D19400AFD5F3 /* Release */ = { isa = XCBuildConfiguration; + baseConfigurationReference = AC6B055EA6ABACFAF95EAEA6 /* Pods-FiamDisplaySwiftExample.release.xcconfig */; buildSettings = { ASSETCATALOG_COMPILER_APPICON_NAME = AppIcon; CODE_SIGN_STYLE = Automatic; From 43ca3b29b9ae5338053833db3f0e1ba1ee723b2d Mon Sep 17 00:00:00 2001 From: Chris Tibbs Date: Mon, 6 May 2019 16:41:56 -0400 Subject: [PATCH 34/57] Add required vertical compression resistance for primary and secondary action button --- ...FIRInAppMessageDisplayStoryboard.storyboard | 18 +++++++++++++----- 1 file changed, 13 insertions(+), 5 deletions(-) diff --git a/Firebase/InAppMessagingDisplay/Resources/FIRInAppMessageDisplayStoryboard.storyboard b/Firebase/InAppMessagingDisplay/Resources/FIRInAppMessageDisplayStoryboard.storyboard index bf982934b7b..78b5be53c8a 100644 --- a/Firebase/InAppMessagingDisplay/Resources/FIRInAppMessageDisplayStoryboard.storyboard +++ b/Firebase/InAppMessagingDisplay/Resources/FIRInAppMessageDisplayStoryboard.storyboard @@ -1,11 +1,11 @@ - + - + @@ -389,11 +389,14 @@ - + + + + @@ -429,6 +432,7 @@ + From 6d8ee205c4fb45d857145dd6d60c4c570da7c128 Mon Sep 17 00:00:00 2001 From: Chris Tibbs Date: Mon, 6 May 2019 17:23:59 -0400 Subject: [PATCH 35/57] Add UI tests for card view controller --- ...IRInAppMessageDisplayStoryboard.storyboard | 6 + .../CardMessageViewController.swift | 12 ++ .../project.pbxproj | 4 + ...InAppMessagingDisplayCardViewUITests.swift | 167 ++++++++++++++++++ 4 files changed, 189 insertions(+) create mode 100644 InAppMessagingDisplay/Example/InAppMessagingDisplay-UITests/InAppMessagingDisplayCardViewUITests.swift diff --git a/Firebase/InAppMessagingDisplay/Resources/FIRInAppMessageDisplayStoryboard.storyboard b/Firebase/InAppMessagingDisplay/Resources/FIRInAppMessageDisplayStoryboard.storyboard index 78b5be53c8a..255b09cf2f9 100644 --- a/Firebase/InAppMessagingDisplay/Resources/FIRInAppMessageDisplayStoryboard.storyboard +++ b/Firebase/InAppMessagingDisplay/Resources/FIRInAppMessageDisplayStoryboard.storyboard @@ -460,6 +460,9 @@