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

0 commit comments

Comments
 (0)