Skip to content

Commit b41a127

Browse files
authored
Support in-app messaging on tvOS apps (#7160)
* Unlock tvOS for in-app messaging. Podspec needs refactoring * Remove trailing whitespace * Remove trailing whitespace * Fix whitespace * Add tvOS tests to GHA * Add TARGET_OS_TV to endifs. Get rid of another pre iOS10 URL open check * Fix yml for GHA * Don't build default UI sample app on tvOS * Better logging for nil message display component in tvOS * Silence archiving deprecation warnings * Lower tvOS support target
1 parent c1a03b1 commit b41a127

Some content is hidden

Large Commits have some content hidden by default. Use the searchbox below for content that may be hidden.

41 files changed

+156
-113
lines changed

.github/workflows/inappmessaging.yml

Lines changed: 2 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -66,13 +66,14 @@ jobs:
6666
'--use-static-frameworks',
6767
'--use-libraries'
6868
]
69+
platform: [ios, tvos]
6970
needs: pod_lib_lint
7071
steps:
7172
- uses: actions/checkout@v2
7273
- name: Setup Bundler
7374
run: scripts/setup_bundler.sh
7475
- name: PodLibLint InAppMessaging Cron
75-
run: scripts/third_party/travis/retry.sh scripts/pod_lib_lint.rb FirebaseInAppMessaging.podspec --platforms=ios ${{ matrix.flags }}
76+
run: scripts/third_party/travis/retry.sh scripts/pod_lib_lint.rb FirebaseInAppMessaging.podspec --platforms=${{ matrix.platform }} ${{ matrix.flags }}
7677

7778
quickstart:
7879
# Don't run on private repo unless it is a PR.
Lines changed: 7 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,7 @@
1+
<?xml version="1.0" encoding="UTF-8" standalone="no"?>
2+
<document type="com.apple.InterfaceBuilder.AppleTV.Storyboard" version="3.0" toolsVersion="13142" targetRuntime="AppleTV" propertyAccessControl="none" useAutolayout="YES" useTraitCollections="YES" useSafeAreas="YES" colorMatched="YES">
3+
<dependencies>
4+
<plugIn identifier="com.apple.InterfaceBuilder.IBCocoaTouchPlugin" version="12042"/>
5+
</dependencies>
6+
<scenes/>
7+
</document>

FirebaseInAppMessaging.podspec

Lines changed: 41 additions & 6 deletions
Original file line numberDiff line numberDiff line change
@@ -18,23 +18,59 @@ See more product details at https://firebase.google.com/products/in-app-messagin
1818
}
1919
s.social_media_url = 'https://twitter.com/Firebase'
2020
s.ios.deployment_target = '10.0'
21+
s.tvos.deployment_target = '13.0'
2122

2223
s.cocoapods_version = '>= 1.4.0'
2324
s.prefix_header_file = false
2425

2526
base_dir = "FirebaseInAppMessaging/"
26-
s.source_files = [
27-
base_dir + "Sources/**/*.[cmh]",
27+
s.ios.source_files = [
28+
base_dir + "Sources/*.[cmh]",
29+
base_dir + "Sources/Analytics/**/*.[cmh]",
30+
base_dir + "Sources/Data/**/*.[cmh]",
31+
base_dir + "Sources/DefaultUI/**/*.[cmh]",
32+
base_dir + "Sources/DisplayTrigger/**/*.[cmh]",
33+
base_dir + "Sources/Flows/**/*.[cmh]",
34+
base_dir + "Sources/Private/**/*.[cmh]",
35+
base_dir + "Sources/Public/**/*.[cmh]",
36+
base_dir + "Sources/RenderingObjects/**/*.[cmh]",
37+
base_dir + "Sources/Runtime/**/*.[cmh]",
38+
base_dir + "Sources/Util/**/*.[cmh]",
2839
'Interop/Analytics/Public/*.h',
2940
'FirebaseABTesting/Sources/Private/*.h',
3041
'FirebaseCore/Sources/Private/*.h',
3142
'FirebaseInstallations/Source/Library/Private/*.h',
3243
]
44+
45+
s.tvos.source_files = [
46+
base_dir + "Sources/*.[cmh]",
47+
base_dir + "Sources/Analytics/**/*.[cmh]",
48+
base_dir + "Sources/Data/**/*.[cmh]",
49+
base_dir + "Sources/DisplayTrigger/**/*.[cmh]",
50+
base_dir + "Sources/Flows/**/*.[cmh]",
51+
base_dir + "Sources/Private/**/*.[cmh]",
52+
base_dir + "Sources/Public/**/*.[cmh]",
53+
base_dir + "Sources/RenderingObjects/**/*.[cmh]",
54+
base_dir + "Sources/Runtime/**/*.[cmh]",
55+
base_dir + "Sources/Util/**/*.[cmh]",
56+
'Interop/Analytics/Public/*.h',
57+
'FirebaseABTesting/Sources/Private/*.h',
58+
'FirebaseCore/Sources/Private/*.h',
59+
'FirebaseInstallations/Source/Library/Private/*.h',
60+
]
61+
3362
s.public_header_files = base_dir + 'Sources/Public/FirebaseInAppMessaging/*.h'
3463

35-
s.resource_bundles = {
64+
s.ios.resource_bundles = {
3665
'InAppMessagingDisplayResources' => [
37-
base_dir + 'Resources/*.storyboard',
66+
base_dir + 'Resources/FIRInAppMessageDisplayStoryboard.storyboard',
67+
base_dir + 'Resources/*.png'
68+
]
69+
}
70+
71+
s.tvos.resource_bundles = {
72+
'InAppMessagingDisplayResources' => [
73+
base_dir + 'Resources/FIRInAppMessageDisplayStoryboardTV.storyboard',
3874
base_dir + 'Resources/*.png'
3975
]
4076
}
@@ -58,5 +94,4 @@ See more product details at https://firebase.google.com/products/in-app-messagin
5894
unit_tests.requires_app_host = true
5995
unit_tests.dependency 'OCMock'
6096
end
61-
62-
end
97+
end

FirebaseInAppMessaging/CHANGELOG.md

Lines changed: 3 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -1,3 +1,6 @@
1+
# 2021-01 -- v7.4.0
2+
- [added] Added support for custom in-app messages in tvOS (#7160).
3+
14
# 2020-12 -- v7.3.0
25
- [fixed] Fixed default display bug in apps that don't use `UISceneDelegate` (#6803).
36

FirebaseInAppMessaging/Sources/Analytics/FIRIAMAnalyticsEventLoggerImpl.m

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -15,7 +15,7 @@
1515
*/
1616

1717
#import <TargetConditionals.h>
18-
#if TARGET_OS_IOS
18+
#if TARGET_OS_IOS || TARGET_OS_TV
1919

2020
#import "FirebaseInAppMessaging/Sources/Analytics/FIRIAMAnalyticsEventLoggerImpl.h"
2121

@@ -172,4 +172,4 @@ - (void)logAnalyticsEventForType:(FIRIAMAnalyticsLogEventType)eventType
172172
}
173173
@end
174174

175-
#endif // TARGET_OS_IOS
175+
#endif // TARGET_OS_IOS || TARGET_OS_TV

FirebaseInAppMessaging/Sources/Analytics/FIRIAMClearcutHttpRequestSender.m

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -15,7 +15,7 @@
1515
*/
1616

1717
#import <TargetConditionals.h>
18-
#if TARGET_OS_IOS
18+
#if TARGET_OS_IOS || TARGET_OS_TV
1919

2020
#import "FirebaseCore/Sources/Private/FirebaseCoreInternal.h"
2121

@@ -204,4 +204,4 @@ - (void)sendClearcutHttpRequestForLogs:(NSArray<FIRIAMClearcutLogRecord *> *)log
204204
}
205205
@end
206206

207-
#endif // TARGET_OS_IOS
207+
#endif // TARGET_OS_IOS || TARGET_OS_TV

FirebaseInAppMessaging/Sources/Analytics/FIRIAMClearcutLogStorage.m

Lines changed: 8 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -15,7 +15,7 @@
1515
*/
1616

1717
#import <TargetConditionals.h>
18-
#if TARGET_OS_IOS
18+
#if TARGET_OS_IOS || TARGET_OS_TV
1919

2020
#import <UIKit/UIKit.h>
2121

@@ -166,7 +166,10 @@ - (void)loadFromCachePath:(NSString *)cacheFilePath {
166166
NSString *filePath = cacheFilePath == nil ? [self.class determineCacheFilePath] : cacheFilePath;
167167

168168
NSTimeInterval start = [self.timeFetcher currentTimestampInSeconds];
169+
#pragma clang diagnostic push
170+
#pragma clang diagnostic ignored "-Wdeprecated-declarations"
169171
id fetchedClearcutRetryRecords = [NSKeyedUnarchiver unarchiveObjectWithFile:filePath];
172+
#pragma clang diagnostic pop
170173
if (fetchedClearcutRetryRecords) {
171174
@synchronized(self) {
172175
self.records = (NSMutableArray<FIRIAMClearcutLogRecord *> *)fetchedClearcutRetryRecords;
@@ -180,7 +183,10 @@ - (void)loadFromCachePath:(NSString *)cacheFilePath {
180183
- (BOOL)saveIntoCacheWithPath:(NSString *)cacheFilePath {
181184
NSString *filePath = cacheFilePath == nil ? [self.class determineCacheFilePath] : cacheFilePath;
182185
@synchronized(self) {
186+
#pragma clang diagnostic push
187+
#pragma clang diagnostic ignored "-Wdeprecated-declarations"
183188
BOOL saveResult = [NSKeyedArchiver archiveRootObject:self.records toFile:filePath];
189+
#pragma clang diagnostic pop
184190
FIRLogDebug(kFIRLoggerInAppMessaging, @"I-IAM230003",
185191
@"Saving %d clearcut log records into file is %@", (int)self.records.count,
186192
saveResult ? @"successful" : @"failure");
@@ -190,4 +196,4 @@ - (BOOL)saveIntoCacheWithPath:(NSString *)cacheFilePath {
190196
}
191197
@end
192198

193-
#endif // TARGET_OS_IOS
199+
#endif // TARGET_OS_IOS || TARGET_OS_TV

FirebaseInAppMessaging/Sources/Analytics/FIRIAMClearcutLogger.m

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -15,7 +15,7 @@
1515
*/
1616

1717
#import <TargetConditionals.h>
18-
#if TARGET_OS_IOS
18+
#if TARGET_OS_IOS || TARGET_OS_TV
1919

2020
#import "FirebaseCore/Sources/Private/FirebaseCoreInternal.h"
2121

@@ -214,4 +214,4 @@ - (void)logAnalyticsEventForType:(FIRIAMAnalyticsLogEventType)eventType
214214
}
215215
@end
216216

217-
#endif // TARGET_OS_IOS
217+
#endif // TARGET_OS_IOS || TARGET_OS_TV

FirebaseInAppMessaging/Sources/Analytics/FIRIAMClearcutUploader.m

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -15,7 +15,7 @@
1515
*/
1616

1717
#import <TargetConditionals.h>
18-
#if TARGET_OS_IOS
18+
#if TARGET_OS_IOS || TARGET_OS_TV
1919

2020
#import <UIKit/UIKit.h>
2121
#import "FirebaseCore/Sources/Private/FirebaseCoreInternal.h"
@@ -245,4 +245,4 @@ - (void)scheduleNextSend {
245245

246246
@end
247247

248-
#endif // TARGET_OS_IOS
248+
#endif // TARGET_OS_IOS || TARGET_OS_TV

FirebaseInAppMessaging/Sources/Data/FIRIAMFetchResponseParser.m

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -15,7 +15,7 @@
1515
*/
1616

1717
#import <TargetConditionals.h>
18-
#if TARGET_OS_IOS
18+
#if TARGET_OS_IOS || TARGET_OS_TV
1919

2020
#import "FirebaseCore/Sources/Private/FirebaseCoreInternal.h"
2121

@@ -376,4 +376,4 @@ - (FIRIAMMessageDefinition *)convertToMessageDefinitionWithMessageDict:(NSDictio
376376
}
377377
@end
378378

379-
#endif // TARGET_OS_IOS
379+
#endif // TARGET_OS_IOS || TARGET_OS_TV

FirebaseInAppMessaging/Sources/Data/FIRIAMMessageContentDataWithImageURL.m

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -15,7 +15,7 @@
1515
*/
1616

1717
#import <TargetConditionals.h>
18-
#if TARGET_OS_IOS
18+
#if TARGET_OS_IOS || TARGET_OS_TV
1919

2020
#import "FirebaseCore/Sources/Private/FirebaseCoreInternal.h"
2121

@@ -206,4 +206,4 @@ - (void)fetchImageFromURL:(NSURL *)imageURL
206206

207207
@end
208208

209-
#endif // TARGET_OS_IOS
209+
#endif // TARGET_OS_IOS || TARGET_OS_TV

FirebaseInAppMessaging/Sources/Data/FIRIAMMessageDefinition.m

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -15,7 +15,7 @@
1515
*/
1616

1717
#import <TargetConditionals.h>
18-
#if TARGET_OS_IOS
18+
#if TARGET_OS_IOS || TARGET_OS_TV
1919

2020
#import "FirebaseInAppMessaging/Sources/Private/Data/FIRIAMMessageDefinition.h"
2121

@@ -108,4 +108,4 @@ - (BOOL)messageHasStarted {
108108
}
109109
@end
110110

111-
#endif // TARGET_OS_IOS
111+
#endif // TARGET_OS_IOS || TARGET_OS_TV

FirebaseInAppMessaging/Sources/Data/FIRIAMRenderingEffectSetting.m

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -15,7 +15,7 @@
1515
*/
1616

1717
#import <TargetConditionals.h>
18-
#if TARGET_OS_IOS
18+
#if TARGET_OS_IOS || TARGET_OS_TV
1919

2020
#import "FirebaseInAppMessaging/Sources/Private/Data/FIRIAMRenderingEffectSetting.h"
2121

@@ -34,4 +34,4 @@ + (instancetype)getDefaultRenderingEffectSetting {
3434
}
3535
@end
3636

37-
#endif // TARGET_OS_IOS
37+
#endif // TARGET_OS_IOS || TARGET_OS_TV

FirebaseInAppMessaging/Sources/DisplayTrigger/FIRIAMDisplayTriggerDefinition.m

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -15,7 +15,7 @@
1515
*/
1616

1717
#import <TargetConditionals.h>
18-
#if TARGET_OS_IOS
18+
#if TARGET_OS_IOS || TARGET_OS_TV
1919

2020
#import "FirebaseInAppMessaging/Sources/Private/DisplayTrigger/FIRIAMDisplayTriggerDefinition.h"
2121

@@ -43,4 +43,4 @@ - (instancetype)initWithFirebaseAnalyticEvent:(NSString *)title {
4343
}
4444
@end
4545

46-
#endif // TARGET_OS_IOS
46+
#endif // TARGET_OS_IOS || TARGET_OS_TV

FirebaseInAppMessaging/Sources/FIRCore+InAppMessaging.m

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -15,12 +15,12 @@
1515
*/
1616

1717
#import <TargetConditionals.h>
18-
#if TARGET_OS_IOS
18+
#if TARGET_OS_IOS || TARGET_OS_TV
1919

2020
#import <Foundation/Foundation.h>
2121
#import "FirebaseInAppMessaging/Sources/FIRCore+InAppMessaging.h"
2222

2323
NSString *const kFirebaseInAppMessagingErrorDomain = @"com.firebase.inappmessaging";
2424
FIRLoggerService kFIRLoggerInAppMessaging = @"[Firebase/InAppMessaging]";
2525

26-
#endif // TARGET_OS_IOS
26+
#endif // TARGET_OS_IOS || TARGET_OS_TV

FirebaseInAppMessaging/Sources/FIRInAppMessaging.m

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -15,7 +15,7 @@
1515
*/
1616

1717
#import <TargetConditionals.h>
18-
#if TARGET_OS_IOS
18+
#if TARGET_OS_IOS || TARGET_OS_TV
1919

2020
#import "FirebaseInAppMessaging/Sources/Public/FirebaseInAppMessaging/FIRInAppMessaging.h"
2121

@@ -145,4 +145,4 @@ - (void)triggerEvent:(NSString *)eventName {
145145

146146
@end
147147

148-
#endif // TARGET_OS_IOS
148+
#endif // TARGET_OS_IOS || TARGET_OS_TV

FirebaseInAppMessaging/Sources/Flows/FIRIAMActivityLogger.m

Lines changed: 8 additions & 4 deletions
Original file line numberDiff line numberDiff line change
@@ -15,7 +15,7 @@
1515
*/
1616

1717
#import <TargetConditionals.h>
18-
#if TARGET_OS_IOS
18+
#if TARGET_OS_IOS || TARGET_OS_TV
1919

2020
#import <UIKit/UIKit.h>
2121

@@ -150,9 +150,10 @@ + (NSString *)determineCacheFilePath {
150150

151151
- (void)loadFromCachePath:(NSString *)cacheFilePath {
152152
NSString *filePath = cacheFilePath == nil ? [self.class determineCacheFilePath] : cacheFilePath;
153-
153+
#pragma clang diagnostic push
154+
#pragma clang diagnostic ignored "-Wdeprecated-declarations"
154155
id fetchedActivityRecords = [NSKeyedUnarchiver unarchiveObjectWithFile:filePath];
155-
156+
#pragma clang diagnostic pop
156157
if (fetchedActivityRecords) {
157158
@synchronized(self) {
158159
self.activityRecords = (NSMutableArray<FIRIAMActivityRecord *> *)fetchedActivityRecords;
@@ -164,7 +165,10 @@ - (void)loadFromCachePath:(NSString *)cacheFilePath {
164165
- (BOOL)saveIntoCacheWithPath:(NSString *)cacheFilePath {
165166
NSString *filePath = cacheFilePath == nil ? [self.class determineCacheFilePath] : cacheFilePath;
166167
@synchronized(self) {
168+
#pragma clang diagnostic push
169+
#pragma clang diagnostic ignored "-Wdeprecated-declarations"
167170
BOOL result = [NSKeyedArchiver archiveRootObject:self.activityRecords toFile:filePath];
171+
#pragma clang diagnostic pop
168172
if (result) {
169173
self.isDirty = NO;
170174
}
@@ -224,4 +228,4 @@ - (void)addLogRecord:(FIRIAMActivityRecord *)newRecord {
224228
}
225229
@end
226230

227-
#endif // TARGET_OS_IOS
231+
#endif // TARGET_OS_IOS || TARGET_OS_TV

FirebaseInAppMessaging/Sources/Flows/FIRIAMBookKeeper.m

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -15,7 +15,7 @@
1515
*/
1616

1717
#import <TargetConditionals.h>
18-
#if TARGET_OS_IOS
18+
#if TARGET_OS_IOS || TARGET_OS_TV
1919

2020
#import "FirebaseCore/Sources/Private/FirebaseCoreInternal.h"
2121

@@ -262,4 +262,4 @@ - (void)cleanupFetchRecords {
262262
}
263263
@end
264264

265-
#endif // TARGET_OS_IOS
265+
#endif // TARGET_OS_IOS || TARGET_OS_TV

FirebaseInAppMessaging/Sources/Flows/FIRIAMClientInfoFetcher.m

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -15,7 +15,7 @@
1515
*/
1616

1717
#import <TargetConditionals.h>
18-
#if TARGET_OS_IOS
18+
#if TARGET_OS_IOS || TARGET_OS_TV
1919

2020
#import "FirebaseCore/Sources/Private/FirebaseCoreInternal.h"
2121
#import "FirebaseInstallations/Source/Library/Private/FirebaseInstallationsInternal.h"
@@ -133,4 +133,4 @@ - (NSString *)getIAMSDKVersion {
133133
}
134134
@end
135135

136-
#endif // TARGET_OS_IOS
136+
#endif // TARGET_OS_IOS || TARGET_OS_TV

FirebaseInAppMessaging/Sources/Flows/FIRIAMDisplayCheckOnAnalyticEventsFlow.m

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -15,7 +15,7 @@
1515
*/
1616

1717
#import <TargetConditionals.h>
18-
#if TARGET_OS_IOS
18+
#if TARGET_OS_IOS || TARGET_OS_TV
1919

2020
#import "FirebaseCore/Sources/Private/FirebaseCoreInternal.h"
2121
#import "Interop/Analytics/Public/FIRAnalyticsInterop.h"
@@ -68,4 +68,4 @@ - (void)stop {
6868

6969
@end
7070

71-
#endif // TARGET_OS_IOS
71+
#endif // TARGET_OS_IOS || TARGET_OS_TV

0 commit comments

Comments
 (0)