FIRIAMMessageDefinition.h 2.1 KB

123456789101112131415161718192021222324252627282930313233343536373839404142434445464748495051525354555657585960
  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. #import "FIRIAMMessageRenderData.h"
  18. @class FIRIAMDisplayTriggerDefinition;
  19. NS_ASSUME_NONNULL_BEGIN
  20. @interface FIRIAMMessageDefinition : NSObject
  21. @property(nonatomic, nonnull, readonly) FIRIAMMessageRenderData *renderData;
  22. // metadata data that does not affect the rendering content/effect directly
  23. @property(nonatomic, readonly) NSTimeInterval startTime;
  24. @property(nonatomic, readonly) NSTimeInterval endTime;
  25. // a fiam message can have multiple triggers and any of them on its own can cause
  26. // the message to be rendered
  27. @property(nonatomic, readonly) NSArray<FIRIAMDisplayTriggerDefinition *> *renderTriggers;
  28. /// A flag for client-side testing messages
  29. @property(nonatomic, readonly) BOOL isTestMessage;
  30. - (instancetype)init NS_UNAVAILABLE;
  31. /**
  32. * Create a regular message definition.
  33. */
  34. - (instancetype)initWithRenderData:(FIRIAMMessageRenderData *)renderData
  35. startTime:(NSTimeInterval)startTime
  36. endTime:(NSTimeInterval)endTime
  37. triggerDefinition:(NSArray<FIRIAMDisplayTriggerDefinition *> *)renderTriggers;
  38. /**
  39. * Create a test message definition.
  40. */
  41. - (instancetype)initTestMessageWithRenderData:(FIRIAMMessageRenderData *)renderData;
  42. - (BOOL)messageHasExpired;
  43. - (BOOL)messageHasStarted;
  44. // should this message be rendered when the app gets foregrounded?
  45. - (BOOL)messageRenderedOnAppForegroundEvent;
  46. // should this message be rendered when a given analytics event is fired?
  47. - (BOOL)messageRenderedOnAnalyticsEvent:(NSString *)eventName;
  48. @end
  49. NS_ASSUME_NONNULL_END