1 |
efrain |
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 |
|
|
|
17 |
#import <Foundation/Foundation.h>
|
|
|
18 |
|
|
|
19 |
#import "FirebaseInAppMessaging/Sources/Private/Flows/FIRIAMActivityLogger.h"
|
|
|
20 |
#import "FirebaseInAppMessaging/Sources/Private/Flows/FIRIAMBookKeeper.h"
|
|
|
21 |
#import "FirebaseInAppMessaging/Sources/Private/Flows/FIRIAMDisplayExecutor.h"
|
|
|
22 |
#import "FirebaseInAppMessaging/Sources/Private/Flows/FIRIAMMessageClientCache.h"
|
|
|
23 |
#import "FirebaseInAppMessaging/Sources/Private/Runtime/FIRIAMSDKModeManager.h"
|
|
|
24 |
#import "FirebaseInAppMessaging/Sources/Private/Util/FIRIAMTimeFetcher.h"
|
|
|
25 |
|
|
|
26 |
@protocol FIRIAMAnalyticsEventLogger;
|
|
|
27 |
|
|
|
28 |
NS_ASSUME_NONNULL_BEGIN
|
|
|
29 |
@interface FIRIAMFetchSetting : NSObject
|
|
|
30 |
@property(nonatomic) NSTimeInterval fetchMinIntervalInMinutes;
|
|
|
31 |
@end
|
|
|
32 |
|
|
|
33 |
typedef void (^FIRIAMFetchMessageCompletionHandler)(
|
|
|
34 |
NSArray<FIRIAMMessageDefinition *> *_Nullable messages,
|
|
|
35 |
NSNumber *_Nullable nextFetchWaitTime,
|
|
|
36 |
NSInteger discardedMessageCount,
|
|
|
37 |
NSError *_Nullable error);
|
|
|
38 |
|
|
|
39 |
@protocol FIRIAMMessageFetcher
|
|
|
40 |
- (void)fetchMessagesWithImpressionList:(NSArray<FIRIAMImpressionRecord *> *)impressonList
|
|
|
41 |
withCompletion:(FIRIAMFetchMessageCompletionHandler)completion;
|
|
|
42 |
@end
|
|
|
43 |
|
|
|
44 |
// Parent class for supporting different fetching flows. Subclass is supposed to trigger
|
|
|
45 |
// checkAndFetch at appropriate moments based on its fetch strategy
|
|
|
46 |
NS_EXTENSION_UNAVAILABLE("Firebase In App Messaging is not supported for iOS extensions.")
|
|
|
47 |
@interface FIRIAMFetchFlow : NSObject
|
|
|
48 |
- (instancetype)initWithSetting:(FIRIAMFetchSetting *)setting
|
|
|
49 |
messageCache:(FIRIAMMessageClientCache *)cache
|
|
|
50 |
messageFetcher:(id<FIRIAMMessageFetcher>)messageFetcher
|
|
|
51 |
timeFetcher:(id<FIRIAMTimeFetcher>)timeFetcher
|
|
|
52 |
bookKeeper:(id<FIRIAMBookKeeper>)displayBookKeeper
|
|
|
53 |
activityLogger:(FIRIAMActivityLogger *)activityLogger
|
|
|
54 |
analyticsEventLogger:(id<FIRIAMAnalyticsEventLogger>)analyticsEventLogger
|
|
|
55 |
FIRIAMSDKModeManager:(FIRIAMSDKModeManager *)sdkModeManager
|
|
|
56 |
displayExecutor:(FIRIAMDisplayExecutor *)displayExecutor;
|
|
|
57 |
|
|
|
58 |
// Triggers a potential fetch of in-app messaging from the source. It would check and respect the
|
|
|
59 |
// the fetchMinIntervalInMinutes defined in setting
|
|
|
60 |
- (void)checkAndFetchForInitialAppLaunch:(BOOL)forInitialAppLaunch;
|
|
|
61 |
|
|
|
62 |
@end
|
|
|
63 |
NS_ASSUME_NONNULL_END
|