Skip to content

Commit bbbe77e

Browse files
authored
Deprecate initializers for FIAM view model objects (#3187)
* Deprecate initializers for FIAM view model objects, they're only used by the SDK and will eventually be hidden in a private header * Run styles.sh
1 parent 143caf9 commit bbbe77e

File tree

8 files changed

+131
-9
lines changed

8 files changed

+131
-9
lines changed

Firebase/InAppMessaging/Flows/FIRIAMDisplayExecutor.m

+24
Original file line numberDiff line numberDiff line change
@@ -390,18 +390,24 @@ - (void)checkAndDisplayNextContextualMessageForAnalyticsEvent:(NSString *)eventN
390390

391391
FIRInAppMessagingActionButton *primaryActionButton = nil;
392392
if (definition.renderData.contentData.actionButtonText) {
393+
#pragma clang diagnostic push
394+
#pragma clang diagnostic ignored "-Wdeprecated-declarations"
393395
primaryActionButton = [[FIRInAppMessagingActionButton alloc]
394396
initWithButtonText:renderData.contentData.actionButtonText
395397
buttonTextColor:renderData.renderingEffectSettings.btnTextColor
396398
backgroundColor:renderData.renderingEffectSettings.btnBGColor];
399+
#pragma clang diagnostic pop
397400
}
398401

399402
FIRInAppMessagingActionButton *secondaryActionButton = nil;
400403
if (definition.renderData.contentData.secondaryActionButtonText) {
404+
#pragma clang diagnostic push
405+
#pragma clang diagnostic ignored "-Wdeprecated-declarations"
401406
secondaryActionButton = [[FIRInAppMessagingActionButton alloc]
402407
initWithButtonText:renderData.contentData.secondaryActionButtonText
403408
buttonTextColor:renderData.renderingEffectSettings.secondaryActionBtnTextColor
404409
backgroundColor:renderData.renderingEffectSettings.btnBGColor];
410+
#pragma clang diagnostic pop
405411
}
406412

407413
FIRInAppMessagingCardDisplay *cardMessage = [[FIRInAppMessagingCardDisplay alloc]
@@ -431,6 +437,8 @@ - (void)checkAndDisplayNextContextualMessageForAnalyticsEvent:(NSString *)eventN
431437
NSString *title = definition.renderData.contentData.titleText;
432438
NSString *body = definition.renderData.contentData.bodyText;
433439

440+
#pragma clang diagnostic push
441+
#pragma clang diagnostic ignored "-Wdeprecated-declarations"
434442
FIRInAppMessagingBannerDisplay *bannerMessage = [[FIRInAppMessagingBannerDisplay alloc]
435443
initWithMessageID:definition.renderData.messageID
436444
campaignName:definition.renderData.name
@@ -442,6 +450,7 @@ - (void)checkAndDisplayNextContextualMessageForAnalyticsEvent:(NSString *)eventN
442450
backgroundColor:definition.renderData.renderingEffectSettings.displayBGColor
443451
imageData:imageData
444452
actionURL:definition.renderData.contentData.actionURL];
453+
#pragma clang diagnostic pop
445454

446455
return bannerMessage;
447456
}
@@ -450,13 +459,16 @@ - (void)checkAndDisplayNextContextualMessageForAnalyticsEvent:(NSString *)eventN
450459
imageOnlyDisplayMessageWithMessageDefinition:(FIRIAMMessageDefinition *)definition
451460
imageData:(FIRInAppMessagingImageData *)imageData
452461
triggerType:(FIRInAppMessagingDisplayTriggerType)triggerType {
462+
#pragma clang diagnostic push
463+
#pragma clang diagnostic ignored "-Wdeprecated-declarations"
453464
FIRInAppMessagingImageOnlyDisplay *imageOnlyMessage = [[FIRInAppMessagingImageOnlyDisplay alloc]
454465
initWithMessageID:definition.renderData.messageID
455466
campaignName:definition.renderData.name
456467
renderAsTestMessage:definition.isTestMessage
457468
triggerType:triggerType
458469
imageData:imageData
459470
actionURL:definition.renderData.contentData.actionURL];
471+
#pragma clang diagnostic pop
460472

461473
return imageOnlyMessage;
462474
}
@@ -474,12 +486,17 @@ - (void)checkAndDisplayNextContextualMessageForAnalyticsEvent:(NSString *)eventN
474486
FIRInAppMessagingActionButton *actionButton = nil;
475487

476488
if (definition.renderData.contentData.actionButtonText) {
489+
#pragma clang diagnostic push
490+
#pragma clang diagnostic ignored "-Wdeprecated-declarations"
477491
actionButton = [[FIRInAppMessagingActionButton alloc]
478492
initWithButtonText:renderData.contentData.actionButtonText
479493
buttonTextColor:renderData.renderingEffectSettings.btnTextColor
480494
backgroundColor:renderData.renderingEffectSettings.btnBGColor];
495+
#pragma clang diagnostic pop
481496
}
482497

498+
#pragma clang diagnostic push
499+
#pragma clang diagnostic ignored "-Wdeprecated-declarations"
483500
FIRInAppMessagingModalDisplay *modalViewMessage = [[FIRInAppMessagingModalDisplay alloc]
484501
initWithMessageID:definition.renderData.messageID
485502
campaignName:definition.renderData.name
@@ -492,6 +509,7 @@ - (void)checkAndDisplayNextContextualMessageForAnalyticsEvent:(NSString *)eventN
492509
imageData:imageData
493510
actionButton:actionButton
494511
actionURL:definition.renderData.contentData.actionURL];
512+
#pragma clang diagnostic pop
495513

496514
return modalViewMessage;
497515
}
@@ -547,14 +565,20 @@ - (void)displayForMessage:(FIRIAMMessageDefinition *)message
547565
return;
548566
} else {
549567
if (standardImageRawData) {
568+
#pragma clang diagnostic push
569+
#pragma clang diagnostic ignored "-Wdeprecated-declarations"
550570
imageData = [[FIRInAppMessagingImageData alloc]
551571
initWithImageURL:message.renderData.contentData.imageURL.absoluteString
552572
imageData:standardImageRawData];
573+
#pragma clang diagnostic pop
553574
}
554575
if (landscapeImageRawData) {
576+
#pragma clang diagnostic push
577+
#pragma clang diagnostic ignored "-Wdeprecated-declarations"
555578
landscapeImageData = [[FIRInAppMessagingImageData alloc]
556579
initWithImageURL:message.renderData.contentData.landscapeImageURL.absoluteString
557580
imageData:landscapeImageRawData];
581+
#pragma clang diagnostic pop
558582
}
559583
}
560584

Firebase/InAppMessaging/Public/FIRInAppMessagingRendering.h

+9-9
Original file line numberDiff line numberDiff line change
@@ -53,7 +53,7 @@ NS_SWIFT_NAME(InAppMessagingActionButton)
5353
- (instancetype)init NS_UNAVAILABLE;
5454
- (instancetype)initWithButtonText:(NSString *)btnText
5555
buttonTextColor:(UIColor *)textColor
56-
backgroundColor:(UIColor *)bkgColor NS_DESIGNATED_INITIALIZER;
56+
backgroundColor:(UIColor *)bkgColor __deprecated;
5757
@end
5858

5959
/** Contain display data for an image for a fiam message.
@@ -68,8 +68,7 @@ NS_SWIFT_NAME(InAppMessagingImageData)
6868
@property(nonatomic, readonly, nullable) NSData *imageRawData;
6969

7070
- (instancetype)init NS_UNAVAILABLE;
71-
- (instancetype)initWithImageURL:(NSString *)imageURL
72-
imageData:(NSData *)imageData NS_DESIGNATED_INITIALIZER;
71+
- (instancetype)initWithImageURL:(NSString *)imageURL imageData:(NSData *)imageData __deprecated;
7372
@end
7473

7574
/** Defines the metadata for the campaign to which a FIAM message belongs.
@@ -83,7 +82,7 @@ NS_SWIFT_NAME(InAppMessagingImageData)
8382
- (instancetype)init NS_UNAVAILABLE;
8483
- (instancetype)initWithMessageID:(NSString *)messageID
8584
campaignName:(NSString *)campaignName
86-
renderAsTestMessage:(BOOL)renderAsTestMessage;
85+
renderAsTestMessage:(BOOL)renderAsTestMessage __deprecated;
8786

8887
@end
8988

@@ -102,7 +101,8 @@ NS_SWIFT_NAME(InAppMessagingAction)
102101
@property(nonatomic, nonnull, copy, readonly) NSURL *actionURL;
103102

104103
- (instancetype)init NS_UNAVAILABLE;
105-
- (instancetype)initWithActionText:(nullable NSString *)actionText actionURL:(NSURL *)actionURL;
104+
- (instancetype)initWithActionText:(nullable NSString *)actionText
105+
actionURL:(NSURL *)actionURL __deprecated;
106106

107107
@end
108108

@@ -121,7 +121,7 @@ NS_SWIFT_NAME(InAppMessagingDisplayMessage)
121121
campaignName:(NSString *)campaignName
122122
renderAsTestMessage:(BOOL)renderAsTestMessage
123123
messageType:(FIRInAppMessagingDisplayMessageType)messageType
124-
triggerType:(FIRInAppMessagingDisplayTriggerType)triggerType;
124+
triggerType:(FIRInAppMessagingDisplayTriggerType)triggerType __deprecated;
125125
@end
126126

127127
NS_SWIFT_NAME(InAppMessagingCardDisplay)
@@ -232,7 +232,7 @@ NS_SWIFT_NAME(InAppMessagingModalDisplay)
232232
backgroundColor:(UIColor *)backgroundColor
233233
imageData:(nullable FIRInAppMessagingImageData *)imageData
234234
actionButton:(nullable FIRInAppMessagingActionButton *)actionButton
235-
actionURL:(nullable NSURL *)actionURL NS_DESIGNATED_INITIALIZER;
235+
actionURL:(nullable NSURL *)actionURL __deprecated;
236236
@end
237237

238238
/** Class for defining a banner message for display.
@@ -271,7 +271,7 @@ NS_SWIFT_NAME(InAppMessagingBannerDisplay)
271271
textColor:(UIColor *)textColor
272272
backgroundColor:(UIColor *)backgroundColor
273273
imageData:(nullable FIRInAppMessagingImageData *)imageData
274-
actionURL:(nullable NSURL *)actionURL NS_DESIGNATED_INITIALIZER;
274+
actionURL:(nullable NSURL *)actionURL __deprecated;
275275
@end
276276

277277
/** Class for defining a image-only message for display.
@@ -295,7 +295,7 @@ NS_SWIFT_NAME(InAppMessagingImageOnlyDisplay)
295295
renderAsTestMessage:(BOOL)renderAsTestMessage
296296
triggerType:(FIRInAppMessagingDisplayTriggerType)triggerType
297297
imageData:(nullable FIRInAppMessagingImageData *)imageData
298-
actionURL:(nullable NSURL *)actionURL NS_DESIGNATED_INITIALIZER;
298+
actionURL:(nullable NSURL *)actionURL __deprecated;
299299
@end
300300

301301
typedef NS_ENUM(NSInteger, FIRInAppMessagingDismissType) {

Firebase/InAppMessaging/RenderingObjects/FIRInAppMessagingRenderingDataClasses.m

+3
Original file line numberDiff line numberDiff line change
@@ -64,11 +64,14 @@ - (instancetype)initWithMessageID:(NSString *)messageID
6464
backgroundColor:(UIColor *)backgroundColor
6565
primaryActionButton:(FIRInAppMessagingActionButton *)primaryActionButton
6666
primaryActionURL:(NSURL *)primaryActionURL {
67+
#pragma clang diagnostic push
68+
#pragma clang diagnostic ignored "-Wdeprecated-declarations"
6769
if (self = [super initWithMessageID:messageID
6870
campaignName:campaignName
6971
renderAsTestMessage:renderAsTestMessage
7072
messageType:FIRInAppMessagingDisplayMessageTypeCard
7173
triggerType:triggerType]) {
74+
#pragma clang diagnostic pop
7275
_title = title;
7376
_textColor = textColor;
7477
_portraitImageData = portraitImageData;

Firebase/InAppMessaging/RenderingObjects/FIRInAppMessagingRenderingPrivate.h

+80
Original file line numberDiff line numberDiff line change
@@ -36,4 +36,84 @@ NS_ASSUME_NONNULL_BEGIN
3636

3737
@end
3838

39+
@interface FIRInAppMessagingActionButton (Private)
40+
41+
- (instancetype)initWithButtonText:(NSString *)btnText
42+
buttonTextColor:(UIColor *)textColor
43+
backgroundColor:(UIColor *)bkgColor;
44+
45+
@end
46+
47+
@interface FIRInAppMessagingImageData (Private)
48+
49+
- (instancetype)initWithImageURL:(NSString *)imageURL imageData:(NSData *)imageData;
50+
51+
@end
52+
53+
@interface FIRInAppMessagingCampaignInfo (Private)
54+
55+
- (instancetype)initWithMessageID:(NSString *)messageID
56+
campaignName:(NSString *)campaignName
57+
renderAsTestMessage:(BOOL)renderAsTestMessage;
58+
59+
@end
60+
61+
@interface FIRInAppMessagingAction (Private)
62+
63+
- (instancetype)initWithActionText:(nullable NSString *)actionText actionURL:(NSURL *)actionURL;
64+
65+
@end
66+
67+
@interface FIRInAppMessagingDisplayMessage (Private)
68+
69+
- (instancetype)initWithMessageID:(NSString *)messageID
70+
campaignName:(NSString *)campaignName
71+
renderAsTestMessage:(BOOL)renderAsTestMessage
72+
messageType:(FIRInAppMessagingDisplayMessageType)messageType
73+
triggerType:(FIRInAppMessagingDisplayTriggerType)triggerType;
74+
75+
@end
76+
77+
@interface FIRInAppMessagingModalDisplay (Private)
78+
79+
- (instancetype)initWithMessageID:(NSString *)messageID
80+
campaignName:(NSString *)campaignName
81+
renderAsTestMessage:(BOOL)renderAsTestMessage
82+
triggerType:(FIRInAppMessagingDisplayTriggerType)triggerType
83+
titleText:(NSString *)title
84+
bodyText:(NSString *)bodyText
85+
textColor:(UIColor *)textColor
86+
backgroundColor:(UIColor *)backgroundColor
87+
imageData:(nullable FIRInAppMessagingImageData *)imageData
88+
actionButton:(nullable FIRInAppMessagingActionButton *)actionButton
89+
actionURL:(nullable NSURL *)actionURL;
90+
91+
@end
92+
93+
@interface FIRInAppMessagingBannerDisplay (Private)
94+
95+
- (instancetype)initWithMessageID:(NSString *)messageID
96+
campaignName:(NSString *)campaignName
97+
renderAsTestMessage:(BOOL)renderAsTestMessage
98+
triggerType:(FIRInAppMessagingDisplayTriggerType)triggerType
99+
titleText:(NSString *)title
100+
bodyText:(NSString *)bodyText
101+
textColor:(UIColor *)textColor
102+
backgroundColor:(UIColor *)backgroundColor
103+
imageData:(nullable FIRInAppMessagingImageData *)imageData
104+
actionURL:(nullable NSURL *)actionURL;
105+
106+
@end
107+
108+
@interface FIRInAppMessagingImageOnlyDisplay (Private)
109+
110+
- (instancetype)initWithMessageID:(NSString *)messageID
111+
campaignName:(NSString *)campaignName
112+
renderAsTestMessage:(BOOL)renderAsTestMessage
113+
triggerType:(FIRInAppMessagingDisplayTriggerType)triggerType
114+
imageData:(nullable FIRInAppMessagingImageData *)imageData
115+
actionURL:(nullable NSURL *)actionURL;
116+
117+
@end
118+
39119
NS_ASSUME_NONNULL_END

Firebase/InAppMessagingDisplay/Banner/FIDBannerViewController.m

+3
Original file line numberDiff line numberDiff line change
@@ -194,9 +194,12 @@ - (void)closeViewFromManualDismiss {
194194
- (void)messageTapped:(UITapGestureRecognizer *)recognizer {
195195
[self.autoDismissTimer invalidate];
196196
[self dismissViewWithAnimation:^(void) {
197+
#pragma clang diagnostic push
198+
#pragma clang diagnostic ignored "-Wdeprecated-declarations"
197199
FIRInAppMessagingAction *action =
198200
[[FIRInAppMessagingAction alloc] initWithActionText:nil
199201
actionURL:self.bannerDisplayMessage.actionURL];
202+
#pragma clang diagnostic pop
200203
[self followAction:action];
201204
}];
202205
}

Firebase/InAppMessagingDisplay/Card/FIDCardViewController.m

+6
Original file line numberDiff line numberDiff line change
@@ -60,9 +60,12 @@ @implementation FIDCardViewController
6060

6161
- (IBAction)primaryActionButtonTapped:(id)sender {
6262
if (self.cardDisplayMessage.primaryActionURL) {
63+
#pragma clang diagnostic push
64+
#pragma clang diagnostic ignored "-Wdeprecated-declarations"
6365
FIRInAppMessagingAction *primaryAction = [[FIRInAppMessagingAction alloc]
6466
initWithActionText:self.cardDisplayMessage.primaryActionButton.buttonText
6567
actionURL:self.cardDisplayMessage.primaryActionURL];
68+
#pragma clang diagnostic pop
6669
[self followAction:primaryAction];
6770
} else {
6871
[self dismissView:FIRInAppMessagingDismissTypeUserTapClose];
@@ -71,9 +74,12 @@ - (IBAction)primaryActionButtonTapped:(id)sender {
7174

7275
- (IBAction)secondaryActionButtonTapped:(id)sender {
7376
if (self.cardDisplayMessage.secondaryActionURL) {
77+
#pragma clang diagnostic push
78+
#pragma clang diagnostic ignored "-Wdeprecated-declarations"
7479
FIRInAppMessagingAction *secondaryAction = [[FIRInAppMessagingAction alloc]
7580
initWithActionText:self.cardDisplayMessage.secondaryActionButton.buttonText
7681
actionURL:self.cardDisplayMessage.secondaryActionURL];
82+
#pragma clang diagnostic pop
7783
[self followAction:secondaryAction];
7884
} else {
7985
[self dismissView:FIRInAppMessagingDismissTypeUserTapClose];

Firebase/InAppMessagingDisplay/ImageOnly/FIDImageOnlyViewController.m

+3
Original file line numberDiff line numberDiff line change
@@ -73,9 +73,12 @@ - (void)setupRecognizers {
7373
}
7474

7575
- (void)messageTapped:(UITapGestureRecognizer *)recognizer {
76+
#pragma clang diagnostic push
77+
#pragma clang diagnostic ignored "-Wdeprecated-declarations"
7678
FIRInAppMessagingAction *action =
7779
[[FIRInAppMessagingAction alloc] initWithActionText:nil
7880
actionURL:self.imageOnlyMessage.actionURL];
81+
#pragma clang diagnostic pop
7982
[self followAction:action];
8083
}
8184

Firebase/InAppMessagingDisplay/Modal/FIDModalViewController.m

+3
Original file line numberDiff line numberDiff line change
@@ -102,9 +102,12 @@ - (IBAction)closeButtonClicked:(id)sender {
102102
}
103103

104104
- (IBAction)actionButtonTapped:(id)sender {
105+
#pragma clang diagnostic push
106+
#pragma clang diagnostic ignored "-Wdeprecated-declarations"
105107
FIRInAppMessagingAction *action = [[FIRInAppMessagingAction alloc]
106108
initWithActionText:self.modalDisplayMessage.actionButton.buttonText
107109
actionURL:self.modalDisplayMessage.actionURL];
110+
#pragma clang diagnostic pop
108111
[self followAction:action];
109112
}
110113

0 commit comments

Comments
 (0)