FIRIAMDisplayExecutor.h 2.9 KB

1234567891011121314151617181920212223242526272829303132333435363738394041424344454647484950515253545556575859606162636465
  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 "FIRIAMActionURLFollower.h"
  18. #import "FIRIAMActivityLogger.h"
  19. #import "FIRIAMBookKeeper.h"
  20. #import "FIRIAMClearcutLogger.h"
  21. #import "FIRIAMMessageClientCache.h"
  22. #import "FIRIAMTimeFetcher.h"
  23. #import "FIRInAppMessaging.h"
  24. #import "FIRInAppMessagingRendering.h"
  25. NS_ASSUME_NONNULL_BEGIN
  26. @interface FIRIAMDisplaySetting : NSObject
  27. @property(nonatomic) NSTimeInterval displayMinIntervalInMinutes;
  28. @end
  29. // The class for checking if there are appropriate messages to be displayed and if so, render it.
  30. // There are other flows that would determine the timing for the checking and then use this class
  31. // instance for the actual check/display.
  32. //
  33. // In addition to fetch eligible message from message cache, this class also ensures certain
  34. // conditions are satisfied for the rendering
  35. // 1 No current in-app message is being displayed
  36. // 2 For non-contextual messages, the display interval in display setting is met.
  37. @interface FIRIAMDisplayExecutor : NSObject
  38. - (instancetype)initWithInAppMessaging:(FIRInAppMessaging *)inAppMessaging
  39. setting:(FIRIAMDisplaySetting *)setting
  40. messageCache:(FIRIAMMessageClientCache *)cache
  41. timeFetcher:(id<FIRIAMTimeFetcher>)timeFetcher
  42. bookKeeper:(id<FIRIAMBookKeeper>)displayBookKeeper
  43. actionURLFollower:(FIRIAMActionURLFollower *)actionURLFollower
  44. activityLogger:(FIRIAMActivityLogger *)activityLogger
  45. analyticsEventLogger:(id<FIRIAMAnalyticsEventLogger>)analyticsEventLogger;
  46. // Check and display next in-app message eligible for app launch trigger
  47. - (void)checkAndDisplayNextAppLaunchMessage;
  48. // Check and display next in-app message eligible for app open trigger
  49. - (void)checkAndDisplayNextAppForegroundMessage;
  50. // Check and display next in-app message eligible for analytics event trigger with given event name.
  51. - (void)checkAndDisplayNextContextualMessageForAnalyticsEvent:(NSString *)eventName;
  52. // a boolean flag that can be used to suppress/resume displaying messages.
  53. @property(nonatomic) BOOL suppressMessageDisplay;
  54. // This is the display component used by display executor for actual message rendering.
  55. @property(nonatomic) id<FIRInAppMessagingDisplay> messageDisplayComponent;
  56. @end
  57. NS_ASSUME_NONNULL_END