mirror of
https://github.com/firebase/firebase-ios-sdk
synced 2026-11-11 22:55:59 +05:45
* Move display SDK source and resources into FIAM SDK * Change files prefixed with FID to be prefixed FIRIAM * Restructure example apps in firebase-ios-sdk directory * Fix directory structure for FIAM * Move proto files into base directory * Fix up proto files * Move unit test files to Firebase/InAppMessaging/Tests * Move FIRIAMSDKModeManagerTests and require app host in podspec * Move sample apps to tests folder * Add empty repo for FIAMDisplay that generates a warning * Fix up functional tests app * Fix up default UI test app * Re-generate protos * Add warning to remove display pod * Remove display podspec from .travis.yml * Remove trailing whitespace * Fix import in test app * Add changes to point to the default test app * Wrap iOS version conditionals * Add line in podspec about deprecation * Delete whitespace in podspec * Delete pods section in project file * Update changelog with consolidation info * Fix indentation in podspecs * Fix some import issues * Fix indent on FirebaseInAppMessaging.podspec * Delete FirebaseInAppMessagingDisplay, update podfile for external test app * Update podfiles, bump iOS min version to 9, remove iOS 9 checks in FIRIAMActionUrlFollowerTests * Add line in CHANGELOG referencing deletion of display sdk pod * Remove unused podfile * Update min version on Podfiles to iOS 9 * Add back FirebaseInAppMessagingDisplay.h * Add iOS support message to CHANGELOG.md * Wrap necessary deprecated iOS 9 call
76 lines
3.1 KiB
Objective-C
76 lines
3.1 KiB
Objective-C
/*
|
|
* Copyright 2017 Google
|
|
*
|
|
* Licensed under the Apache License, Version 2.0 (the "License");
|
|
* you may not use this file except in compliance with the License.
|
|
* You may obtain a copy of the License at
|
|
*
|
|
* http://www.apache.org/licenses/LICENSE-2.0
|
|
*
|
|
* Unless required by applicable law or agreed to in writing, software
|
|
* distributed under the License is distributed on an "AS IS" BASIS,
|
|
* WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
|
|
* See the License for the specific language governing permissions and
|
|
* limitations under the License.
|
|
*/
|
|
|
|
#import <Foundation/Foundation.h>
|
|
|
|
NS_ASSUME_NONNULL_BEGIN
|
|
@interface FIRIAMImpressionRecord : NSObject
|
|
@property(nonatomic, readonly, copy) NSString *messageID;
|
|
@property(nonatomic, readonly) long impressionTimeInSeconds;
|
|
|
|
- (NSString *)description;
|
|
|
|
- (instancetype)init NS_UNAVAILABLE;
|
|
- (instancetype)initWithMessageID:(NSString *)messageID
|
|
impressionTimeInSeconds:(long)impressionTime NS_DESIGNATED_INITIALIZER;
|
|
@end
|
|
|
|
// this protocol defines the interface for classes that can be used to track info regarding
|
|
// display & fetch of iam messages. The info tracked here can be used to decide if it's due for
|
|
// next display and/or fetch of iam messages.
|
|
@protocol FIRIAMBookKeeper
|
|
@property(nonatomic, readonly) double lastDisplayTime;
|
|
@property(nonatomic, readonly) double lastFetchTime;
|
|
@property(nonatomic, readonly) NSTimeInterval nextFetchWaitTime;
|
|
|
|
// only call this when it's considered to be a valid impression (for example, meeting the minimum
|
|
// display time requirement).
|
|
- (void)recordNewImpressionForMessage:(NSString *)messageID
|
|
withStartTimestampInSeconds:(double)timestamp;
|
|
|
|
- (void)recordNewFetchWithFetchCount:(NSInteger)fetchedMsgCount
|
|
withTimestampInSeconds:(double)fetchTimestamp
|
|
nextFetchWaitTime:(nullable NSNumber *)nextFetchWaitTime;
|
|
|
|
// When we fetch the eligible message list from the sdk server, it can contain messages that are
|
|
// already impressed for those that are defined to be displayed repeatedly (messages with custom
|
|
// display frequency). We need then clean up the impression records for these messages so that
|
|
// they can be displayed again on client side.
|
|
- (void)clearImpressionsWithMessageList:(NSArray<NSString *> *)messageList;
|
|
// fetch the impression list
|
|
- (NSArray<FIRIAMImpressionRecord *> *)getImpressions;
|
|
|
|
// For certain clients, they only need to get the list of the message ids in existing impression
|
|
// records. This is a helper method for that.
|
|
- (NSArray<NSString *> *)getMessageIDsFromImpressions;
|
|
@end
|
|
|
|
// implementation of FIRIAMBookKeeper protocol by storing data within iOS UserDefaults.
|
|
// TODO: switch to something else if there is risks for the data being unintentionally deleted by
|
|
// the app
|
|
@interface FIRIAMBookKeeperViaUserDefaults : NSObject <FIRIAMBookKeeper>
|
|
|
|
- (instancetype)init NS_UNAVAILABLE;
|
|
- (instancetype)initWithUserDefaults:(NSUserDefaults *)userDefaults NS_DESIGNATED_INITIALIZER;
|
|
|
|
// for testing, don't use them for production purpose
|
|
- (void)cleanupImpressions;
|
|
- (void)cleanupFetchRecords;
|
|
|
|
@end
|
|
|
|
NS_ASSUME_NONNULL_END
|