Преглед на файлове

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
christibbs преди 5 години
родител
ревизия
b41a127336
променени са 41 файла, в които са добавени 156 реда и са изтрити 113 реда
  1. 2 1
      .github/workflows/inappmessaging.yml
  2. 7 0
      FIRInAppMessageDisplayStoryboardTV.storyboard
  3. 41 6
      FirebaseInAppMessaging.podspec
  4. 3 0
      FirebaseInAppMessaging/CHANGELOG.md
  5. 2 2
      FirebaseInAppMessaging/Sources/Analytics/FIRIAMAnalyticsEventLoggerImpl.m
  6. 2 2
      FirebaseInAppMessaging/Sources/Analytics/FIRIAMClearcutHttpRequestSender.m
  7. 8 2
      FirebaseInAppMessaging/Sources/Analytics/FIRIAMClearcutLogStorage.m
  8. 2 2
      FirebaseInAppMessaging/Sources/Analytics/FIRIAMClearcutLogger.m
  9. 2 2
      FirebaseInAppMessaging/Sources/Analytics/FIRIAMClearcutUploader.m
  10. 2 2
      FirebaseInAppMessaging/Sources/Data/FIRIAMFetchResponseParser.m
  11. 2 2
      FirebaseInAppMessaging/Sources/Data/FIRIAMMessageContentDataWithImageURL.m
  12. 2 2
      FirebaseInAppMessaging/Sources/Data/FIRIAMMessageDefinition.m
  13. 2 2
      FirebaseInAppMessaging/Sources/Data/FIRIAMRenderingEffectSetting.m
  14. 2 2
      FirebaseInAppMessaging/Sources/DisplayTrigger/FIRIAMDisplayTriggerDefinition.m
  15. 2 2
      FirebaseInAppMessaging/Sources/FIRCore+InAppMessaging.m
  16. 2 2
      FirebaseInAppMessaging/Sources/FIRInAppMessaging.m
  17. 8 4
      FirebaseInAppMessaging/Sources/Flows/FIRIAMActivityLogger.m
  18. 2 2
      FirebaseInAppMessaging/Sources/Flows/FIRIAMBookKeeper.m
  19. 2 2
      FirebaseInAppMessaging/Sources/Flows/FIRIAMClientInfoFetcher.m
  20. 2 2
      FirebaseInAppMessaging/Sources/Flows/FIRIAMDisplayCheckOnAnalyticEventsFlow.m
  21. 2 2
      FirebaseInAppMessaging/Sources/Flows/FIRIAMDisplayCheckOnAppForegroundFlow.m
  22. 2 2
      FirebaseInAppMessaging/Sources/Flows/FIRIAMDisplayCheckOnFetchDoneNotificationFlow.m
  23. 2 2
      FirebaseInAppMessaging/Sources/Flows/FIRIAMDisplayCheckTriggerFlow.m
  24. 19 8
      FirebaseInAppMessaging/Sources/Flows/FIRIAMDisplayExecutor.m
  25. 2 2
      FirebaseInAppMessaging/Sources/Flows/FIRIAMFetchFlow.m
  26. 2 2
      FirebaseInAppMessaging/Sources/Flows/FIRIAMFetchOnAppForegroundFlow.m
  27. 2 2
      FirebaseInAppMessaging/Sources/Flows/FIRIAMMessageClientCache.m
  28. 2 2
      FirebaseInAppMessaging/Sources/Flows/FIRIAMMsgFetcherUsingRestful.m
  29. 2 2
      FirebaseInAppMessaging/Sources/Flows/FIRIAMServerMsgFetchStorage.m
  30. 2 2
      FirebaseInAppMessaging/Sources/Public/FirebaseInAppMessaging/FIRInAppMessaging.h
  31. 2 2
      FirebaseInAppMessaging/Sources/Public/FirebaseInAppMessaging/FIRInAppMessagingRendering.h
  32. 2 2
      FirebaseInAppMessaging/Sources/RenderingObjects/FIRInAppMessagingRenderingDataClasses.m
  33. 2 26
      FirebaseInAppMessaging/Sources/Runtime/FIRIAMActionURLFollower.m
  34. 2 2
      FirebaseInAppMessaging/Sources/Runtime/FIRIAMRuntimeManager.m
  35. 2 2
      FirebaseInAppMessaging/Sources/Runtime/FIRIAMSDKModeManager.m
  36. 2 2
      FirebaseInAppMessaging/Sources/Runtime/FIRIAMSDKSettings.m
  37. 2 2
      FirebaseInAppMessaging/Sources/Runtime/FIRInAppMessaging+Bootstrap.m
  38. 2 2
      FirebaseInAppMessaging/Sources/Util/FIRIAMElapsedTimeTracker.m
  39. 2 2
      FirebaseInAppMessaging/Sources/Util/FIRIAMTimeFetcher.m
  40. 2 2
      FirebaseInAppMessaging/Sources/Util/NSString+FIRInterlaceStrings.m
  41. 2 2
      FirebaseInAppMessaging/Sources/Util/UIColor+FIRIAMHexString.m

+ 2 - 1
.github/workflows/inappmessaging.yml

@@ -66,13 +66,14 @@ jobs:
           '--use-static-frameworks',
           '--use-libraries'
         ]
+        platform: [ios, tvos]
     needs: pod_lib_lint
     steps:
     - uses: actions/checkout@v2
     - name: Setup Bundler
       run: scripts/setup_bundler.sh
     - name: PodLibLint InAppMessaging Cron
-      run: scripts/third_party/travis/retry.sh scripts/pod_lib_lint.rb FirebaseInAppMessaging.podspec --platforms=ios ${{ matrix.flags }}
+      run: scripts/third_party/travis/retry.sh scripts/pod_lib_lint.rb FirebaseInAppMessaging.podspec --platforms=${{ matrix.platform }} ${{ matrix.flags }}
 
   quickstart:
     # Don't run on private repo unless it is a PR.

+ 7 - 0
FIRInAppMessageDisplayStoryboardTV.storyboard

@@ -0,0 +1,7 @@
+<?xml version="1.0" encoding="UTF-8" standalone="no"?>
+<document type="com.apple.InterfaceBuilder.AppleTV.Storyboard" version="3.0" toolsVersion="13142" targetRuntime="AppleTV" propertyAccessControl="none" useAutolayout="YES" useTraitCollections="YES" useSafeAreas="YES" colorMatched="YES">
+    <dependencies>
+        <plugIn identifier="com.apple.InterfaceBuilder.IBCocoaTouchPlugin" version="12042"/>
+    </dependencies>
+    <scenes/>
+</document>

+ 41 - 6
FirebaseInAppMessaging.podspec

@@ -18,23 +18,59 @@ See more product details at https://firebase.google.com/products/in-app-messagin
   }
   s.social_media_url = 'https://twitter.com/Firebase'
   s.ios.deployment_target = '10.0'
+  s.tvos.deployment_target = '13.0'
 
   s.cocoapods_version = '>= 1.4.0'
   s.prefix_header_file = false
 
   base_dir = "FirebaseInAppMessaging/"
-  s.source_files = [
-    base_dir + "Sources/**/*.[cmh]",
+  s.ios.source_files = [
+    base_dir + "Sources/*.[cmh]",
+	base_dir + "Sources/Analytics/**/*.[cmh]",
+	base_dir + "Sources/Data/**/*.[cmh]",
+	base_dir + "Sources/DefaultUI/**/*.[cmh]",
+	base_dir + "Sources/DisplayTrigger/**/*.[cmh]",
+	base_dir + "Sources/Flows/**/*.[cmh]",
+	base_dir + "Sources/Private/**/*.[cmh]",
+	base_dir + "Sources/Public/**/*.[cmh]",
+	base_dir + "Sources/RenderingObjects/**/*.[cmh]",
+	base_dir + "Sources/Runtime/**/*.[cmh]",
+	base_dir + "Sources/Util/**/*.[cmh]",
     'Interop/Analytics/Public/*.h',
     'FirebaseABTesting/Sources/Private/*.h',
     'FirebaseCore/Sources/Private/*.h',
     'FirebaseInstallations/Source/Library/Private/*.h',
   ]
+
+  s.tvos.source_files = [
+    base_dir + "Sources/*.[cmh]",
+	base_dir + "Sources/Analytics/**/*.[cmh]",
+	base_dir + "Sources/Data/**/*.[cmh]",
+	base_dir + "Sources/DisplayTrigger/**/*.[cmh]",
+	base_dir + "Sources/Flows/**/*.[cmh]",
+	base_dir + "Sources/Private/**/*.[cmh]",
+	base_dir + "Sources/Public/**/*.[cmh]",
+	base_dir + "Sources/RenderingObjects/**/*.[cmh]",
+	base_dir + "Sources/Runtime/**/*.[cmh]",
+	base_dir + "Sources/Util/**/*.[cmh]",
+    'Interop/Analytics/Public/*.h',
+    'FirebaseABTesting/Sources/Private/*.h',
+    'FirebaseCore/Sources/Private/*.h',
+    'FirebaseInstallations/Source/Library/Private/*.h',
+  ]
+
   s.public_header_files = base_dir + 'Sources/Public/FirebaseInAppMessaging/*.h'
 
-  s.resource_bundles = {
+  s.ios.resource_bundles = {
     'InAppMessagingDisplayResources' => [
-       base_dir + 'Resources/*.storyboard',
+       base_dir + 'Resources/FIRInAppMessageDisplayStoryboard.storyboard',
+       base_dir + 'Resources/*.png'
+     ]
+  }
+
+  s.tvos.resource_bundles = {
+    'InAppMessagingDisplayResources' => [
+       base_dir + 'Resources/FIRInAppMessageDisplayStoryboardTV.storyboard',
        base_dir + 'Resources/*.png'
      ]
   }
@@ -58,5 +94,4 @@ See more product details at https://firebase.google.com/products/in-app-messagin
       unit_tests.requires_app_host = true
       unit_tests.dependency 'OCMock'
    end
-
-end
+end

+ 3 - 0
FirebaseInAppMessaging/CHANGELOG.md

@@ -1,3 +1,6 @@
+# 2021-01 -- v7.4.0
+- [added] Added support for custom in-app messages in tvOS (#7160).
+
 # 2020-12 -- v7.3.0
 - [fixed] Fixed default display bug in apps that don't use `UISceneDelegate` (#6803).
 

+ 2 - 2
FirebaseInAppMessaging/Sources/Analytics/FIRIAMAnalyticsEventLoggerImpl.m

@@ -15,7 +15,7 @@
  */
 
 #import <TargetConditionals.h>
-#if TARGET_OS_IOS
+#if TARGET_OS_IOS || TARGET_OS_TV
 
 #import "FirebaseInAppMessaging/Sources/Analytics/FIRIAMAnalyticsEventLoggerImpl.h"
 
@@ -172,4 +172,4 @@ static NSString *const kFIAMUserDefaualtsKeyForRemoveUserPropertyTimeInSeconds =
 }
 @end
 
-#endif  // TARGET_OS_IOS
+#endif  // TARGET_OS_IOS || TARGET_OS_TV

+ 2 - 2
FirebaseInAppMessaging/Sources/Analytics/FIRIAMClearcutHttpRequestSender.m

@@ -15,7 +15,7 @@
  */
 
 #import <TargetConditionals.h>
-#if TARGET_OS_IOS
+#if TARGET_OS_IOS || TARGET_OS_TV
 
 #import "FirebaseCore/Sources/Private/FirebaseCoreInternal.h"
 
@@ -204,4 +204,4 @@
 }
 @end
 
-#endif  // TARGET_OS_IOS
+#endif  // TARGET_OS_IOS || TARGET_OS_TV

+ 8 - 2
FirebaseInAppMessaging/Sources/Analytics/FIRIAMClearcutLogStorage.m

@@ -15,7 +15,7 @@
  */
 
 #import <TargetConditionals.h>
-#if TARGET_OS_IOS
+#if TARGET_OS_IOS || TARGET_OS_TV
 
 #import <UIKit/UIKit.h>
 
@@ -166,7 +166,10 @@ static NSString *const kEventExtensionJson = @"extension_js";
   NSString *filePath = cacheFilePath == nil ? [self.class determineCacheFilePath] : cacheFilePath;
 
   NSTimeInterval start = [self.timeFetcher currentTimestampInSeconds];
+#pragma clang diagnostic push
+#pragma clang diagnostic ignored "-Wdeprecated-declarations"
   id fetchedClearcutRetryRecords = [NSKeyedUnarchiver unarchiveObjectWithFile:filePath];
+#pragma clang diagnostic pop
   if (fetchedClearcutRetryRecords) {
     @synchronized(self) {
       self.records = (NSMutableArray<FIRIAMClearcutLogRecord *> *)fetchedClearcutRetryRecords;
@@ -180,7 +183,10 @@ static NSString *const kEventExtensionJson = @"extension_js";
 - (BOOL)saveIntoCacheWithPath:(NSString *)cacheFilePath {
   NSString *filePath = cacheFilePath == nil ? [self.class determineCacheFilePath] : cacheFilePath;
   @synchronized(self) {
+#pragma clang diagnostic push
+#pragma clang diagnostic ignored "-Wdeprecated-declarations"
     BOOL saveResult = [NSKeyedArchiver archiveRootObject:self.records toFile:filePath];
+#pragma clang diagnostic pop
     FIRLogDebug(kFIRLoggerInAppMessaging, @"I-IAM230003",
                 @"Saving %d clearcut log records into file is %@", (int)self.records.count,
                 saveResult ? @"successful" : @"failure");
@@ -190,4 +196,4 @@ static NSString *const kEventExtensionJson = @"extension_js";
 }
 @end
 
-#endif  // TARGET_OS_IOS
+#endif  // TARGET_OS_IOS || TARGET_OS_TV

+ 2 - 2
FirebaseInAppMessaging/Sources/Analytics/FIRIAMClearcutLogger.m

@@ -15,7 +15,7 @@
  */
 
 #import <TargetConditionals.h>
-#if TARGET_OS_IOS
+#if TARGET_OS_IOS || TARGET_OS_TV
 
 #import "FirebaseCore/Sources/Private/FirebaseCoreInternal.h"
 
@@ -214,4 +214,4 @@
 }
 @end
 
-#endif  // TARGET_OS_IOS
+#endif  // TARGET_OS_IOS || TARGET_OS_TV

+ 2 - 2
FirebaseInAppMessaging/Sources/Analytics/FIRIAMClearcutUploader.m

@@ -15,7 +15,7 @@
  */
 
 #import <TargetConditionals.h>
-#if TARGET_OS_IOS
+#if TARGET_OS_IOS || TARGET_OS_TV
 
 #import <UIKit/UIKit.h>
 #import "FirebaseCore/Sources/Private/FirebaseCoreInternal.h"
@@ -245,4 +245,4 @@ static NSString *FIRIAM_UserDefaultsKeyForNextValidClearcutUploadTimeInMills =
 
 @end
 
-#endif  // TARGET_OS_IOS
+#endif  // TARGET_OS_IOS || TARGET_OS_TV

+ 2 - 2
FirebaseInAppMessaging/Sources/Data/FIRIAMFetchResponseParser.m

@@ -15,7 +15,7 @@
  */
 
 #import <TargetConditionals.h>
-#if TARGET_OS_IOS
+#if TARGET_OS_IOS || TARGET_OS_TV
 
 #import "FirebaseCore/Sources/Private/FirebaseCoreInternal.h"
 
@@ -376,4 +376,4 @@
 }
 @end
 
-#endif  // TARGET_OS_IOS
+#endif  // TARGET_OS_IOS || TARGET_OS_TV

+ 2 - 2
FirebaseInAppMessaging/Sources/Data/FIRIAMMessageContentDataWithImageURL.m

@@ -15,7 +15,7 @@
  */
 
 #import <TargetConditionals.h>
-#if TARGET_OS_IOS
+#if TARGET_OS_IOS || TARGET_OS_TV
 
 #import "FirebaseCore/Sources/Private/FirebaseCoreInternal.h"
 
@@ -206,4 +206,4 @@ static NSInteger const SuccessHTTPStatusCode = 200;
 
 @end
 
-#endif  // TARGET_OS_IOS
+#endif  // TARGET_OS_IOS || TARGET_OS_TV

+ 2 - 2
FirebaseInAppMessaging/Sources/Data/FIRIAMMessageDefinition.m

@@ -15,7 +15,7 @@
  */
 
 #import <TargetConditionals.h>
-#if TARGET_OS_IOS
+#if TARGET_OS_IOS || TARGET_OS_TV
 
 #import "FirebaseInAppMessaging/Sources/Private/Data/FIRIAMMessageDefinition.h"
 
@@ -108,4 +108,4 @@
 }
 @end
 
-#endif  // TARGET_OS_IOS
+#endif  // TARGET_OS_IOS || TARGET_OS_TV

+ 2 - 2
FirebaseInAppMessaging/Sources/Data/FIRIAMRenderingEffectSetting.m

@@ -15,7 +15,7 @@
  */
 
 #import <TargetConditionals.h>
-#if TARGET_OS_IOS
+#if TARGET_OS_IOS || TARGET_OS_TV
 
 #import "FirebaseInAppMessaging/Sources/Private/Data/FIRIAMRenderingEffectSetting.h"
 
@@ -34,4 +34,4 @@
 }
 @end
 
-#endif  // TARGET_OS_IOS
+#endif  // TARGET_OS_IOS || TARGET_OS_TV

+ 2 - 2
FirebaseInAppMessaging/Sources/DisplayTrigger/FIRIAMDisplayTriggerDefinition.m

@@ -15,7 +15,7 @@
  */
 
 #import <TargetConditionals.h>
-#if TARGET_OS_IOS
+#if TARGET_OS_IOS || TARGET_OS_TV
 
 #import "FirebaseInAppMessaging/Sources/Private/DisplayTrigger/FIRIAMDisplayTriggerDefinition.h"
 
@@ -43,4 +43,4 @@
 }
 @end
 
-#endif  // TARGET_OS_IOS
+#endif  // TARGET_OS_IOS || TARGET_OS_TV

+ 2 - 2
FirebaseInAppMessaging/Sources/FIRCore+InAppMessaging.m

@@ -15,7 +15,7 @@
  */
 
 #import <TargetConditionals.h>
-#if TARGET_OS_IOS
+#if TARGET_OS_IOS || TARGET_OS_TV
 
 #import <Foundation/Foundation.h>
 #import "FirebaseInAppMessaging/Sources/FIRCore+InAppMessaging.h"
@@ -23,4 +23,4 @@
 NSString *const kFirebaseInAppMessagingErrorDomain = @"com.firebase.inappmessaging";
 FIRLoggerService kFIRLoggerInAppMessaging = @"[Firebase/InAppMessaging]";
 
-#endif  // TARGET_OS_IOS
+#endif  // TARGET_OS_IOS || TARGET_OS_TV

+ 2 - 2
FirebaseInAppMessaging/Sources/FIRInAppMessaging.m

@@ -15,7 +15,7 @@
  */
 
 #import <TargetConditionals.h>
-#if TARGET_OS_IOS
+#if TARGET_OS_IOS || TARGET_OS_TV
 
 #import "FirebaseInAppMessaging/Sources/Public/FirebaseInAppMessaging/FIRInAppMessaging.h"
 
@@ -145,4 +145,4 @@ static BOOL _autoBootstrapOnFIRAppInit = YES;
 
 @end
 
-#endif  // TARGET_OS_IOS
+#endif  // TARGET_OS_IOS || TARGET_OS_TV

+ 8 - 4
FirebaseInAppMessaging/Sources/Flows/FIRIAMActivityLogger.m

@@ -15,7 +15,7 @@
  */
 
 #import <TargetConditionals.h>
-#if TARGET_OS_IOS
+#if TARGET_OS_IOS || TARGET_OS_TV
 
 #import <UIKit/UIKit.h>
 
@@ -150,9 +150,10 @@ static NSString *const kDetailArchiveKey = @"detail";
 
 - (void)loadFromCachePath:(NSString *)cacheFilePath {
   NSString *filePath = cacheFilePath == nil ? [self.class determineCacheFilePath] : cacheFilePath;
-
+#pragma clang diagnostic push
+#pragma clang diagnostic ignored "-Wdeprecated-declarations"
   id fetchedActivityRecords = [NSKeyedUnarchiver unarchiveObjectWithFile:filePath];
-
+#pragma clang diagnostic pop
   if (fetchedActivityRecords) {
     @synchronized(self) {
       self.activityRecords = (NSMutableArray<FIRIAMActivityRecord *> *)fetchedActivityRecords;
@@ -164,7 +165,10 @@ static NSString *const kDetailArchiveKey = @"detail";
 - (BOOL)saveIntoCacheWithPath:(NSString *)cacheFilePath {
   NSString *filePath = cacheFilePath == nil ? [self.class determineCacheFilePath] : cacheFilePath;
   @synchronized(self) {
+#pragma clang diagnostic push
+#pragma clang diagnostic ignored "-Wdeprecated-declarations"
     BOOL result = [NSKeyedArchiver archiveRootObject:self.activityRecords toFile:filePath];
+#pragma clang diagnostic pop
     if (result) {
       self.isDirty = NO;
     }
@@ -224,4 +228,4 @@ static NSString *const kDetailArchiveKey = @"detail";
 }
 @end
 
-#endif  // TARGET_OS_IOS
+#endif  // TARGET_OS_IOS || TARGET_OS_TV

+ 2 - 2
FirebaseInAppMessaging/Sources/Flows/FIRIAMBookKeeper.m

@@ -15,7 +15,7 @@
  */
 
 #import <TargetConditionals.h>
-#if TARGET_OS_IOS
+#if TARGET_OS_IOS || TARGET_OS_TV
 
 #import "FirebaseCore/Sources/Private/FirebaseCoreInternal.h"
 
@@ -262,4 +262,4 @@ static NSTimeInterval kMaxFetchWaitTimeInSeconds = 3 * 24 * 60 * 60;
 }
 @end
 
-#endif  // TARGET_OS_IOS
+#endif  // TARGET_OS_IOS || TARGET_OS_TV

+ 2 - 2
FirebaseInAppMessaging/Sources/Flows/FIRIAMClientInfoFetcher.m

@@ -15,7 +15,7 @@
  */
 
 #import <TargetConditionals.h>
-#if TARGET_OS_IOS
+#if TARGET_OS_IOS || TARGET_OS_TV
 
 #import "FirebaseCore/Sources/Private/FirebaseCoreInternal.h"
 #import "FirebaseInstallations/Source/Library/Private/FirebaseInstallationsInternal.h"
@@ -133,4 +133,4 @@
 }
 @end
 
-#endif  // TARGET_OS_IOS
+#endif  // TARGET_OS_IOS || TARGET_OS_TV

+ 2 - 2
FirebaseInAppMessaging/Sources/Flows/FIRIAMDisplayCheckOnAnalyticEventsFlow.m

@@ -15,7 +15,7 @@
  */
 
 #import <TargetConditionals.h>
-#if TARGET_OS_IOS
+#if TARGET_OS_IOS || TARGET_OS_TV
 
 #import "FirebaseCore/Sources/Private/FirebaseCoreInternal.h"
 #import "Interop/Analytics/Public/FIRAnalyticsInterop.h"
@@ -68,4 +68,4 @@
 
 @end
 
-#endif  // TARGET_OS_IOS
+#endif  // TARGET_OS_IOS || TARGET_OS_TV

+ 2 - 2
FirebaseInAppMessaging/Sources/Flows/FIRIAMDisplayCheckOnAppForegroundFlow.m

@@ -15,7 +15,7 @@
  */
 
 #import <TargetConditionals.h>
-#if TARGET_OS_IOS
+#if TARGET_OS_IOS || TARGET_OS_TV
 
 #import "FirebaseCore/Sources/Private/FirebaseCoreInternal.h"
 
@@ -67,4 +67,4 @@
 }
 @end
 
-#endif  // TARGET_OS_IOS
+#endif  // TARGET_OS_IOS || TARGET_OS_TV

+ 2 - 2
FirebaseInAppMessaging/Sources/Flows/FIRIAMDisplayCheckOnFetchDoneNotificationFlow.m

@@ -15,7 +15,7 @@
  */
 
 #import <TargetConditionals.h>
-#if TARGET_OS_IOS
+#if TARGET_OS_IOS || TARGET_OS_TV
 
 #import "FirebaseCore/Sources/Private/FirebaseCoreInternal.h"
 
@@ -64,4 +64,4 @@ extern NSString *const kFIRIAMFetchIsDoneNotification;
 }
 @end
 
-#endif  // TARGET_OS_IOS
+#endif  // TARGET_OS_IOS || TARGET_OS_TV

+ 2 - 2
FirebaseInAppMessaging/Sources/Flows/FIRIAMDisplayCheckTriggerFlow.m

@@ -15,7 +15,7 @@
  */
 
 #import <TargetConditionals.h>
-#if TARGET_OS_IOS
+#if TARGET_OS_IOS || TARGET_OS_TV
 
 #import "FirebaseInAppMessaging/Sources/Private/Flows/FIRIAMDisplayCheckTriggerFlow.h"
 
@@ -34,4 +34,4 @@
 }
 @end
 
-#endif  // TARGET_OS_IOS
+#endif  // TARGET_OS_IOS || TARGET_OS_TV

+ 19 - 8
FirebaseInAppMessaging/Sources/Flows/FIRIAMDisplayExecutor.m

@@ -15,7 +15,7 @@
  */
 
 #import <TargetConditionals.h>
-#if TARGET_OS_IOS
+#if TARGET_OS_IOS || TARGET_OS_TV
 
 #import <UIKit/UIKit.h>
 #import "FirebaseCore/Sources/Private/FirebaseCoreInternal.h"
@@ -55,6 +55,17 @@
   FIRIAMMessageDefinition *_currentMsgBeingDisplayed;
 }
 
++ (NSString *)logStringForNilMessageDisplayComponent {
+#if TARGET_OS_IOS
+  return @"Message display component is not present yet. No display should happen.";
+#else  // TARGET_OS_TV
+  return @"There is no default UI for tvOS. You must implement a messageDisplayComponent and set "
+         @"it on the InAppMessaging singleton. See "
+         @"https://firebase.google.com/docs/in-app-messaging/"
+         @"customize-messages#create_your_own_message_display_library.";
+#endif
+}
+
 #pragma mark - FIRInAppMessagingDisplayDelegate methods
 - (void)messageClicked:(FIRInAppMessagingDisplayMessage *)inAppMessage
             withAction:(FIRInAppMessagingAction *)action {
@@ -386,8 +397,8 @@
     }
 
     if (!self.messageDisplayComponent) {
-      FIRLogDebug(kFIRLoggerInAppMessaging, @"I-IAM400026",
-                  @"Message display component is not present yet. No display should happen.");
+      FIRLogDebug(kFIRLoggerInAppMessaging, @"I-IAM400026", @"%@",
+                  [[self class] logStringForNilMessageDisplayComponent]);
       return;
     }
 
@@ -655,8 +666,8 @@
   // threads.
   @synchronized(self) {
     if (!self.messageDisplayComponent) {
-      FIRLogDebug(kFIRLoggerInAppMessaging, @"I-IAM400028",
-                  @"Message display component is not present yet. No display should happen.");
+      FIRLogDebug(kFIRLoggerInAppMessaging, @"I-IAM400028", @"%@",
+                  [[self class] logStringForNilMessageDisplayComponent]);
       return;
     }
 
@@ -699,8 +710,8 @@
   // triggered message concurrently
   @synchronized(self) {
     if (!self.messageDisplayComponent) {
-      FIRLogDebug(kFIRLoggerInAppMessaging, @"I-IAM400027",
-                  @"Message display component is not present yet. No display should happen.");
+      FIRLogDebug(kFIRLoggerInAppMessaging, @"I-IAM400027", @"%@",
+                  [[self class] logStringForNilMessageDisplayComponent]);
       return;
     }
 
@@ -738,4 +749,4 @@
 }
 @end
 
-#endif  // TARGET_OS_IOS
+#endif  // TARGET_OS_IOS || TARGET_OS_TV

+ 2 - 2
FirebaseInAppMessaging/Sources/Flows/FIRIAMFetchFlow.m

@@ -15,7 +15,7 @@
  */
 
 #import <TargetConditionals.h>
-#if TARGET_OS_IOS
+#if TARGET_OS_IOS || TARGET_OS_TV
 
 #import "FirebaseCore/Sources/Private/FirebaseCoreInternal.h"
 
@@ -267,4 +267,4 @@ NSString *const kFIRIAMFetchIsDoneNotification = @"FIRIAMFetchIsDoneNotification
 }
 @end
 
-#endif  // TARGET_OS_IOS
+#endif  // TARGET_OS_IOS || TARGET_OS_TV

+ 2 - 2
FirebaseInAppMessaging/Sources/Flows/FIRIAMFetchOnAppForegroundFlow.m

@@ -15,7 +15,7 @@
  */
 
 #import <TargetConditionals.h>
-#if TARGET_OS_IOS
+#if TARGET_OS_IOS || TARGET_OS_TV
 
 #import "FirebaseCore/Sources/Private/FirebaseCoreInternal.h"
 
@@ -61,4 +61,4 @@
 }
 @end
 
-#endif  // TARGET_OS_IOS
+#endif  // TARGET_OS_IOS || TARGET_OS_TV

+ 2 - 2
FirebaseInAppMessaging/Sources/Flows/FIRIAMMessageClientCache.m

@@ -15,7 +15,7 @@
  */
 
 #import <TargetConditionals.h>
-#if TARGET_OS_IOS
+#if TARGET_OS_IOS || TARGET_OS_TV
 
 #import "FirebaseCore/Sources/Private/FirebaseCoreInternal.h"
 
@@ -236,4 +236,4 @@
 }
 @end
 
-#endif  // TARGET_OS_IOS
+#endif  // TARGET_OS_IOS || TARGET_OS_TV

+ 2 - 2
FirebaseInAppMessaging/Sources/Flows/FIRIAMMsgFetcherUsingRestful.m

@@ -15,7 +15,7 @@
  */
 
 #import <TargetConditionals.h>
-#if TARGET_OS_IOS
+#if TARGET_OS_IOS || TARGET_OS_TV
 
 #import "FirebaseCore/Sources/Private/FirebaseCoreInternal.h"
 
@@ -277,4 +277,4 @@ static NSInteger const SuccessHTTPStatusCode = 200;
 }
 @end
 
-#endif  // TARGET_OS_IOS
+#endif  // TARGET_OS_IOS || TARGET_OS_TV

+ 2 - 2
FirebaseInAppMessaging/Sources/Flows/FIRIAMServerMsgFetchStorage.m

@@ -15,7 +15,7 @@
  */
 
 #import <TargetConditionals.h>
-#if TARGET_OS_IOS
+#if TARGET_OS_IOS || TARGET_OS_TV
 
 #import "FirebaseCore/Sources/Private/FirebaseCoreInternal.h"
 
@@ -66,4 +66,4 @@
 }
 @end
 
-#endif  // TARGET_OS_IOS
+#endif  // TARGET_OS_IOS || TARGET_OS_TV

+ 2 - 2
FirebaseInAppMessaging/Sources/Public/FirebaseInAppMessaging/FIRInAppMessaging.h

@@ -15,7 +15,7 @@
  */
 
 #import <TargetConditionals.h>
-#if TARGET_OS_IOS
+#if TARGET_OS_IOS || TARGET_OS_TV
 
 #import <Foundation/Foundation.h>
 
@@ -93,4 +93,4 @@ NS_SWIFT_NAME(InAppMessaging)
 @end
 NS_ASSUME_NONNULL_END
 
-#endif  // TARGET_OS_IOS
+#endif  // TARGET_OS_IOS || TARGET_OS_TV

+ 2 - 2
FirebaseInAppMessaging/Sources/Public/FirebaseInAppMessaging/FIRInAppMessagingRendering.h

@@ -15,7 +15,7 @@
  */
 
 #import <TargetConditionals.h>
-#if TARGET_OS_IOS
+#if TARGET_OS_IOS || TARGET_OS_TV
 
 #import <UIKit/UIKit.h>
 
@@ -425,4 +425,4 @@ NS_SWIFT_NAME(InAppMessagingDisplay)
 @end
 NS_ASSUME_NONNULL_END
 
-#endif  // TARGET_OS_IOS
+#endif  // TARGET_OS_IOS || TARGET_OS_TV

+ 2 - 2
FirebaseInAppMessaging/Sources/RenderingObjects/FIRInAppMessagingRenderingDataClasses.m

@@ -15,7 +15,7 @@
  */
 
 #import <TargetConditionals.h>
-#if TARGET_OS_IOS
+#if TARGET_OS_IOS || TARGET_OS_TV
 
 #import <Foundation/Foundation.h>
 
@@ -375,4 +375,4 @@
 
 @end
 
-#endif  // TARGET_OS_IOS
+#endif  // TARGET_OS_IOS || TARGET_OS_TV

+ 2 - 26
FirebaseInAppMessaging/Sources/Runtime/FIRIAMActionURLFollower.m

@@ -15,7 +15,7 @@
  */
 
 #import <TargetConditionals.h>
-#if TARGET_OS_IOS
+#if TARGET_OS_IOS || TARGET_OS_TV
 
 #import <Foundation/Foundation.h>
 #import <UIKit/UIKit.h>
@@ -156,26 +156,7 @@
   if (self.isNewAppDelegateOpenURLDefined) {
     FIRLogDebug(kFIRLoggerInAppMessaging, @"I-IAM210008",
                 @"iOS 9+ version of App Delegate's application:openURL:options: method detected");
-#pragma clang diagnostic push
-#pragma clang diagnostic ignored "-Wunguarded-availability"
     return [self.appDelegate application:self.mainApplication openURL:url options:@{}];
-#pragma clang pop
-  }
-
-  // if we come here, we can try to trigger the older version of openURL method on the app's
-  // delegate
-  if (self.isOldAppDelegateOpenURLDefined) {
-    FIRLogDebug(kFIRLoggerInAppMessaging, @"I-IAM240009",
-                @"iOS 9 below version of App Delegate's openURL method detected");
-    NSString *appBundleIdentifier = [[NSBundle mainBundle] bundleIdentifier];
-#pragma clang diagnostic push
-#pragma clang diagnostic ignored "-Wdeprecated-declarations"
-    BOOL handled = [self.appDelegate application:self.mainApplication
-                                         openURL:url
-                               sourceApplication:appBundleIdentifier
-                                      annotation:@{}];
-#pragma clang pop
-    return handled;
   }
 
   FIRLogDebug(kFIRLoggerInAppMessaging, @"I-IAM240010",
@@ -229,11 +210,6 @@
           FIRLogDebug(kFIRLoggerInAppMessaging, @"I-IAM240006", @"openURL result is %d", success);
           completion(success);
         }];
-  } else {
-    // fallback to the older version of openURL
-    BOOL success = [self.mainApplication openURL:url];
-    FIRLogDebug(kFIRLoggerInAppMessaging, @"I-IAM240007", @"openURL result is %d", success);
-    completion(success);
   }
 }
 
@@ -249,4 +225,4 @@
 }
 @end
 
-#endif  // TARGET_OS_IOS
+#endif  // TARGET_OS_IOS || TARGET_OS_TV

+ 2 - 2
FirebaseInAppMessaging/Sources/Runtime/FIRIAMRuntimeManager.m

@@ -15,7 +15,7 @@
  */
 
 #import <TargetConditionals.h>
-#if TARGET_OS_IOS
+#if TARGET_OS_IOS || TARGET_OS_TV
 
 #import "FirebaseCore/Sources/Private/FirebaseCoreInternal.h"
 
@@ -444,4 +444,4 @@ static NSString *const kFirebaseInAppMessagingAutoDataCollectionKey =
 }
 @end
 
-#endif  // TARGET_OS_IOS
+#endif  // TARGET_OS_IOS || TARGET_OS_TV

+ 2 - 2
FirebaseInAppMessaging/Sources/Runtime/FIRIAMSDKModeManager.m

@@ -15,7 +15,7 @@
  */
 
 #import <TargetConditionals.h>
-#if TARGET_OS_IOS
+#if TARGET_OS_IOS || TARGET_OS_TV
 
 #import "FirebaseCore/Sources/Private/FirebaseCoreInternal.h"
 
@@ -115,4 +115,4 @@ NSInteger const kFIRIAMMaxFetchInNewlyInstalledMode = 5;
 }
 @end
 
-#endif  // TARGET_OS_IOS
+#endif  // TARGET_OS_IOS || TARGET_OS_TV

+ 2 - 2
FirebaseInAppMessaging/Sources/Runtime/FIRIAMSDKSettings.m

@@ -15,7 +15,7 @@
  */
 
 #import <TargetConditionals.h>
-#if TARGET_OS_IOS
+#if TARGET_OS_IOS || TARGET_OS_TV
 
 #import "FirebaseInAppMessaging/Sources/Private/Runtime/FIRIAMSDKSettings.h"
 
@@ -37,4 +37,4 @@
 }
 @end
 
-#endif  // TARGET_OS_IOS
+#endif  // TARGET_OS_IOS || TARGET_OS_TV

+ 2 - 2
FirebaseInAppMessaging/Sources/Runtime/FIRInAppMessaging+Bootstrap.m

@@ -15,7 +15,7 @@
  */
 
 #import <TargetConditionals.h>
-#if TARGET_OS_IOS
+#if TARGET_OS_IOS || TARGET_OS_TV
 
 #import "FirebaseInAppMessaging/Sources/Private/Runtime/FIRInAppMessaging+Bootstrap.h"
 
@@ -136,4 +136,4 @@ static NSString *_fiamServerHostName = @"firebaseinappmessaging.googleapis.com";
 
 @end
 
-#endif  // TARGET_OS_IOS
+#endif  // TARGET_OS_IOS || TARGET_OS_TV

+ 2 - 2
FirebaseInAppMessaging/Sources/Util/FIRIAMElapsedTimeTracker.m

@@ -15,7 +15,7 @@
  */
 
 #import <TargetConditionals.h>
-#if TARGET_OS_IOS
+#if TARGET_OS_IOS || TARGET_OS_TV
 
 #import "FirebaseInAppMessaging/Sources/Util/FIRIAMElapsedTimeTracker.h"
 @interface FIRIAMElapsedTimeTracker ()
@@ -58,4 +58,4 @@
 }
 @end
 
-#endif  // TARGET_OS_IOS
+#endif  // TARGET_OS_IOS || TARGET_OS_TV

+ 2 - 2
FirebaseInAppMessaging/Sources/Util/FIRIAMTimeFetcher.m

@@ -15,7 +15,7 @@
  */
 
 #import <TargetConditionals.h>
-#if TARGET_OS_IOS
+#if TARGET_OS_IOS || TARGET_OS_TV
 
 #import "FirebaseInAppMessaging/Sources/Private/Util/FIRIAMTimeFetcher.h"
 
@@ -25,4 +25,4 @@
 }
 @end
 
-#endif  // TARGET_OS_IOS
+#endif  // TARGET_OS_IOS || TARGET_OS_TV

+ 2 - 2
FirebaseInAppMessaging/Sources/Util/NSString+FIRInterlaceStrings.m

@@ -15,7 +15,7 @@
  */
 
 #import <TargetConditionals.h>
-#if TARGET_OS_IOS
+#if TARGET_OS_IOS || TARGET_OS_TV
 
 #import "FirebaseInAppMessaging/Sources/Private/Util/NSString+FIRInterlaceStrings.h"
 
@@ -44,4 +44,4 @@
 
 @end
 
-#endif  // TARGET_OS_IOS
+#endif  // TARGET_OS_IOS || TARGET_OS_TV

+ 2 - 2
FirebaseInAppMessaging/Sources/Util/UIColor+FIRIAMHexString.m

@@ -15,7 +15,7 @@
  */
 
 #import <TargetConditionals.h>
-#if TARGET_OS_IOS
+#if TARGET_OS_IOS || TARGET_OS_TV
 
 #import "FirebaseInAppMessaging/Sources/Util/UIColor+FIRIAMHexString.h"
 
@@ -41,4 +41,4 @@
 }
 @end
 
-#endif  // TARGET_OS_IOS
+#endif  // TARGET_OS_IOS || TARGET_OS_TV