| 1 | 
           efrain | 
           1 | 
           /*
  | 
        
        
            | 
            | 
           2 | 
            * Copyright 2019 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 "FirebaseRemoteConfig/Sources/Public/FirebaseRemoteConfig/FIRRemoteConfig.h"
  | 
        
        
            | 
            | 
           20 | 
           #import "Interop/Analytics/Public/FIRAnalyticsInterop.h"
  | 
        
        
            | 
            | 
           21 | 
              | 
        
        
            | 
            | 
           22 | 
           @class FIROptions;
  | 
        
        
            | 
            | 
           23 | 
           @class RCNConfigContent;
  | 
        
        
            | 
            | 
           24 | 
           @class RCNConfigSettings;
  | 
        
        
            | 
            | 
           25 | 
           @class RCNConfigExperiment;
  | 
        
        
            | 
            | 
           26 | 
           @class RCNConfigDBManager;
  | 
        
        
            | 
            | 
           27 | 
              | 
        
        
            | 
            | 
           28 | 
           NS_ASSUME_NONNULL_BEGIN
  | 
        
        
            | 
            | 
           29 | 
              | 
        
        
            | 
            | 
           30 | 
           /// Completion handler invoked by NSSessionFetcher.
  | 
        
        
            | 
            | 
           31 | 
           typedef void (^RCNConfigFetcherCompletion)(NSData *data, NSURLResponse *response, NSError *error);
  | 
        
        
            | 
            | 
           32 | 
              | 
        
        
            | 
            | 
           33 | 
           @interface RCNConfigFetch : NSObject
  | 
        
        
            | 
            | 
           34 | 
              | 
        
        
            | 
            | 
           35 | 
           - (instancetype)init NS_UNAVAILABLE;
  | 
        
        
            | 
            | 
           36 | 
              | 
        
        
            | 
            | 
           37 | 
           /// Designated initializer
  | 
        
        
            | 
            | 
           38 | 
           - (instancetype)initWithContent:(RCNConfigContent *)content
  | 
        
        
            | 
            | 
           39 | 
                                 DBManager:(RCNConfigDBManager *)DBManager
  | 
        
        
            | 
            | 
           40 | 
                                  settings:(RCNConfigSettings *)settings
  | 
        
        
            | 
            | 
           41 | 
                                 analytics:(nullable id<FIRAnalyticsInterop>)analytics
  | 
        
        
            | 
            | 
           42 | 
                                experiment:(nullable RCNConfigExperiment *)experiment
  | 
        
        
            | 
            | 
           43 | 
                                     queue:(dispatch_queue_t)queue
  | 
        
        
            | 
            | 
           44 | 
                                 namespace:(NSString *)firebaseNamespace
  | 
        
        
            | 
            | 
           45 | 
                                   options:(FIROptions *)firebaseOptions NS_DESIGNATED_INITIALIZER;
  | 
        
        
            | 
            | 
           46 | 
              | 
        
        
            | 
            | 
           47 | 
           /// Fetches config data keyed by namespace. Completion block will be called on the main queue.
  | 
        
        
            | 
            | 
           48 | 
           /// @param expirationDuration  Expiration duration, in seconds.
  | 
        
        
            | 
            | 
           49 | 
           /// @param completionHandler   Callback handler.
  | 
        
        
            | 
            | 
           50 | 
           - (void)fetchConfigWithExpirationDuration:(NSTimeInterval)expirationDuration
  | 
        
        
            | 
            | 
           51 | 
                                   completionHandler:(FIRRemoteConfigFetchCompletion)completionHandler;
  | 
        
        
            | 
            | 
           52 | 
              | 
        
        
            | 
            | 
           53 | 
           /// Add the ability to update NSURLSession's timeout after a session has already been created.
  | 
        
        
            | 
            | 
           54 | 
           - (void)recreateNetworkSession;
  | 
        
        
            | 
            | 
           55 | 
              | 
        
        
            | 
            | 
           56 | 
           /// Provide fetchSession for tests to override.
  | 
        
        
            | 
            | 
           57 | 
           @property(nonatomic, readwrite, strong, nonnull) NSURLSession *fetchSession;
  | 
        
        
            | 
            | 
           58 | 
              | 
        
        
            | 
            | 
           59 | 
           NS_ASSUME_NONNULL_END
  | 
        
        
            | 
            | 
           60 | 
              | 
        
        
            | 
            | 
           61 | 
           @end
  |