FIRInAppMessaging.h 3.7 KB

12345678910111213141516171819202122232425262728293031323334353637383940414243444546474849505152535455565758596061626364656667686970717273747576777879808182838485868788899091
  1. /*
  2. * Copyright 2017 Google
  3. *
  4. * Licensed under the Apache License, Version 2.0 (the "License");
  5. * you may not use this file except in compliance with the License.
  6. * You may obtain a copy of the License at
  7. *
  8. * http://www.apache.org/licenses/LICENSE-2.0
  9. *
  10. * Unless required by applicable law or agreed to in writing, software
  11. * distributed under the License is distributed on an "AS IS" BASIS,
  12. * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
  13. * See the License for the specific language governing permissions and
  14. * limitations under the License.
  15. */
  16. #import <Foundation/Foundation.h>
  17. @class FIRApp;
  18. #import "FIRInAppMessagingRendering.h"
  19. NS_ASSUME_NONNULL_BEGIN
  20. /**
  21. * The root object for in-app messaging iOS SDK.
  22. *
  23. * Note: Firebase InApp Messaging depends on using a Firebase Instance ID & token pair to be able
  24. * to retrieve FIAM messages defined for the current app instance. By default, Firebase in-app
  25. * messaging SDK would obtain the ID & token pair on app/SDK startup. As a result of using
  26. * ID & token pair, some device client data (linked to the instance ID) would be collected and sent
  27. * over to Firebase backend periodically.
  28. *
  29. * The app can tune the default data collection behavior via certain controls. They are listed in
  30. * descending order below. If a higher-priority setting exists, lower level settings are ignored.
  31. *
  32. * 1. Dynamically turn on/off data collection behavior by setting the
  33. * `automaticDataCollectionEnabled` property on the `FIRInAppMessaging` instance to true/false
  34. * Swift or YES/NO (objective-c).
  35. * 2. Set `FirebaseInAppMessagingAutomaticDataCollectionEnabled` to false in the app's plist file.
  36. * 3. Global Firebase data collection setting.
  37. **/
  38. NS_SWIFT_NAME(InAppMessaging)
  39. @interface FIRInAppMessaging : NSObject
  40. /** @fn inAppMessaging
  41. @brief Gets the singleton FIRInAppMessaging object constructed from default Firebase App
  42. settings.
  43. */
  44. + (FIRInAppMessaging *)inAppMessaging NS_SWIFT_NAME(inAppMessaging());
  45. /**
  46. * Unavailable. Use +inAppMessaging instead.
  47. */
  48. - (instancetype)init __attribute__((unavailable("Use +inAppMessaging instead.")));
  49. /**
  50. * A boolean flag that can be used to suppress messaging display at runtime. It's
  51. * initialized to false at app startup. Once set to true, fiam SDK would stop rendering any
  52. * new messages until it's set back to false.
  53. */
  54. @property(nonatomic) BOOL messageDisplaySuppressed;
  55. /**
  56. * A boolean flag that can be set at runtime to allow/disallow fiam SDK automatically
  57. * collect user data on app startup. Settings made via this property is persisted across app
  58. * restarts and has higher priority over FirebaseInAppMessagingAutomaticDataCollectionEnabled
  59. * flag (if present) in plist file.
  60. */
  61. @property(nonatomic) BOOL automaticDataCollectionEnabled;
  62. /**
  63. * This is the display component that will be used by FirebaseInAppMessaging to render messages.
  64. * If it's nil (the default case when FirebaseIAppMessaging SDK starts), FirebaseInAppMessaging
  65. * would only perform other non-rendering flows (fetching messages for example). SDK
  66. * FirebaseInAppMessagingDisplay would set itself as the display component if it's included by
  67. * the app. Any other custom implementation of FIRInAppMessagingDisplay would need to set this
  68. * property so that it can be used for rendering fiam message UIs.
  69. */
  70. @property(nonatomic) id<FIRInAppMessagingDisplay> messageDisplayComponent;
  71. /**
  72. * Directly requests an in-app message with the given trigger to be shown.
  73. */
  74. - (void)triggerEvent:(NSString *)eventName;
  75. /**
  76. * This delegate should be set on the app side to receive message lifecycle events in app runtime.
  77. */
  78. @property(nonatomic, weak) id<FIRInAppMessagingDisplayDelegate> delegate;
  79. @end
  80. NS_ASSUME_NONNULL_END