Files
firebase-ios-sdk/FirebaseInAppMessaging/Sources/Private/Flows/FIRIAMActivityLogger.h
T
christibbs 48aa5ed5ee FIAM Consolidation (#4705)
* 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
2020-01-22 10:57:00 -05:00

90 lines
3.3 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>
/// Values for different fiam activity types.
typedef NS_ENUM(NSInteger, FIRIAMActivityType) {
FIRIAMActivityTypeFetchMessage = 0,
FIRIAMActivityTypeRenderMessage = 1,
FIRIAMActivityTypeDismissMessage = 2,
// Triggered checks
FIRIAMActivityTypeCheckForOnOpenMessage = 3,
FIRIAMActivityTypeCheckForAnalyticsEventMessage = 4,
FIRIAMActivityTypeCheckForFetch = 5,
};
NS_ASSUME_NONNULL_BEGIN
@interface FIRIAMActivityRecord : NSObject <NSCoding>
@property(nonatomic, nonnull, readonly) NSDate *timestamp;
@property(nonatomic, readonly) FIRIAMActivityType activityType;
@property(nonatomic, readonly) BOOL success;
@property(nonatomic, copy, nonnull, readonly) NSString *detail;
- (instancetype)init NS_UNAVAILABLE;
// Current timestamp would be fetched if parameter 'timestamp' is passed in as null
- (instancetype)initWithActivityType:(FIRIAMActivityType)type
isSuccessful:(BOOL)isSuccessful
withDetail:(NSString *)detail
timestamp:(nullable NSDate *)timestamp;
- (NSString *)displayStringForActivityType;
@end
/**
* This is the class for tracking fiam flow related activity logs. Its content can later on be
* retrieved for debugging/reporting purpose.
*/
@interface FIRIAMActivityLogger : NSObject
// If it's NO, activity logs of certain types won't get recorded by Logger. Consult
// isMandatoryType implementation to tell what are the types belong to verbose mode
// Turn it on for debugging cases
@property(nonatomic, readonly) BOOL verboseMode;
- (instancetype)init NS_UNAVAILABLE;
/**
* Parameter maxBeforeReduce and sizeAfterReduce defines the shrinking behavior when we reach
* the size cap of log storage: when we see the number of log records goes beyond
* maxBeforeReduce, we would trigger a reduction action which would bring the array length to be
* the size as defined by sizeAfterReduce
*
* @param verboseMode see the comments for the verboseMode property
* @param loadFromCache loads from cache to initialize the log list if it's true. Be aware that
* in this case, you should not call this method in main thread since reading the cache file
* can take time.
*/
- (instancetype)initWithMaxCountBeforeReduce:(NSInteger)maxBeforeReduce
withSizeAfterReduce:(NSInteger)sizeAfterReduce
verboseMode:(BOOL)verboseMode
loadFromCache:(BOOL)loadFromCache;
/**
* Inserting a new record into activity log.
*
* @param newRecord new record to be inserted
*/
- (void)addLogRecord:(FIRIAMActivityRecord *)newRecord;
/**
* Get a immutable copy of the existing activity log records.
*/
- (NSArray<FIRIAMActivityRecord *> *)readRecords;
@end
NS_ASSUME_NONNULL_END