Files
firebase-ios-sdk/FirebaseRemoteConfig/Sources/Private/RCNConfigFetch.h
T

76 lines
3.1 KiB
Objective-C
Raw Normal View History

2019-08-21 14:26:41 -07:00
/*
* Copyright 2019 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>
2020-07-23 10:01:02 -07:00
#import "FirebaseRemoteConfig/Sources/Public/FirebaseRemoteConfig/FIRRemoteConfig.h"
#import "Interop/Analytics/Public/FIRAnalyticsInterop.h"
2019-08-21 14:26:41 -07:00
@class FIROptions;
@class RCNConfigContent;
@class RCNConfigSettings;
@class RCNConfigExperiment;
@class RCNConfigDBManager;
NS_ASSUME_NONNULL_BEGIN
/// Completion handler invoked by NSSessionFetcher.
typedef void (^RCNConfigFetcherCompletion)(NSData *data, NSURLResponse *response, NSError *error);
2023-03-13 16:02:56 -07:00
/// Completion handler invoked after a fetch that contains the updated keys
typedef void (^RCNConfigFetchCompletion)(FIRRemoteConfigFetchStatus status,
FIRRemoteConfigUpdate *update,
NSError *error);
2019-08-21 14:26:41 -07:00
@interface RCNConfigFetch : NSObject
- (instancetype)init NS_UNAVAILABLE;
/// Designated initializer
- (instancetype)initWithContent:(RCNConfigContent *)content
DBManager:(RCNConfigDBManager *)DBManager
settings:(RCNConfigSettings *)settings
analytics:(nullable id<FIRAnalyticsInterop>)analytics
experiment:(nullable RCNConfigExperiment *)experiment
queue:(dispatch_queue_t)queue
namespace:(NSString *)firebaseNamespace
options:(FIROptions *)firebaseOptions NS_DESIGNATED_INITIALIZER;
2019-12-04 07:44:31 -08:00
/// Fetches config data keyed by namespace. Completion block will be called on the main queue.
2019-08-21 14:26:41 -07:00
/// @param expirationDuration Expiration duration, in seconds.
/// @param completionHandler Callback handler.
2019-12-04 07:44:31 -08:00
- (void)fetchConfigWithExpirationDuration:(NSTimeInterval)expirationDuration
completionHandler:(FIRRemoteConfigFetchCompletion)completionHandler;
2019-08-21 14:26:41 -07:00
2023-03-13 16:02:56 -07:00
/// Fetches config data immediately, keyed by namespace. Completion block will be called on the main
/// queue.
/// @param fetchAttemptNumber The number of the fetch attempt.
/// @param completionHandler Callback handler.
- (void)realtimeFetchConfigWithNoExpirationDuration:(NSInteger)fetchAttemptNumber
completionHandler:(RCNConfigFetchCompletion)completionHandler;
/// Add the ability to update NSURLSession's timeout after a session has already been created.
- (void)recreateNetworkSession;
/// Provide fetchSession for tests to override.
@property(nonatomic, readwrite, strong, nonnull) NSURLSession *fetchSession;
2019-08-21 14:26:41 -07:00
2023-03-13 16:02:56 -07:00
/// Provide config template version number for Realtime config client.
@property(nonatomic, copy, nonnull) NSString *templateVersionNumber;
2019-08-21 14:26:41 -07:00
NS_ASSUME_NONNULL_END
@end