| 1 | 
           efrain | 
           1 | 
           // Copyright 2020 Google LLC
  | 
        
        
            | 
            | 
           2 | 
           //
  | 
        
        
            | 
            | 
           3 | 
           // Licensed under the Apache License, Version 2.0 (the "License");
  | 
        
        
            | 
            | 
           4 | 
           // you may not use this file except in compliance with the License.
  | 
        
        
            | 
            | 
           5 | 
           // You may obtain a copy of the License at
  | 
        
        
            | 
            | 
           6 | 
           //
  | 
        
        
            | 
            | 
           7 | 
           //      http://www.apache.org/licenses/LICENSE-2.0
  | 
        
        
            | 
            | 
           8 | 
           //
  | 
        
        
            | 
            | 
           9 | 
           // Unless required by applicable law or agreed to in writing, software
  | 
        
        
            | 
            | 
           10 | 
           // distributed under the License is distributed on an "AS IS" BASIS,
  | 
        
        
            | 
            | 
           11 | 
           // WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
  | 
        
        
            | 
            | 
           12 | 
           // See the License for the specific language governing permissions and
  | 
        
        
            | 
            | 
           13 | 
           // limitations under the License.
  | 
        
        
            | 
            | 
           14 | 
              | 
        
        
            | 
            | 
           15 | 
           #import "FirebasePerformance/Sources/FPRClient.h"
  | 
        
        
            | 
            | 
           16 | 
           #import "FirebasePerformance/Sources/Protogen/nanopb/perf_metric.nanopb.h"
  | 
        
        
            | 
            | 
           17 | 
              | 
        
        
            | 
            | 
           18 | 
           @class FPRGDTLogger;
  | 
        
        
            | 
            | 
           19 | 
           @class FPRConfigurations;
  | 
        
        
            | 
            | 
           20 | 
           @class FIRInstallations;
  | 
        
        
            | 
            | 
           21 | 
              | 
        
        
            | 
            | 
           22 | 
           /**
  | 
        
        
            | 
            | 
           23 | 
            * Extension that is added on top of the class FPRClient to make the private properties visible
  | 
        
        
            | 
            | 
           24 | 
            * between the implementation file and the unit tests.
  | 
        
        
            | 
            | 
           25 | 
            */
  | 
        
        
            | 
            | 
           26 | 
           @interface FPRClient ()
  | 
        
        
            | 
            | 
           27 | 
              | 
        
        
            | 
            | 
           28 | 
           @property(nonatomic, getter=isConfigured, readwrite) BOOL configured;
  | 
        
        
            | 
            | 
           29 | 
              | 
        
        
            | 
            | 
           30 | 
           /** GDT Logger to transmit Fireperf events to Google Data Transport. */
  | 
        
        
            | 
            | 
           31 | 
           @property(nonatomic) FPRGDTLogger *gdtLogger;
  | 
        
        
            | 
            | 
           32 | 
              | 
        
        
            | 
            | 
           33 | 
           /** The queue group all FPRClient work will run on. Used for testing only. */
  | 
        
        
            | 
            | 
           34 | 
           @property(nonatomic, readonly) dispatch_group_t eventsQueueGroup;
  | 
        
        
            | 
            | 
           35 | 
              | 
        
        
            | 
            | 
           36 | 
           /** Serial queue used for processing events. */
  | 
        
        
            | 
            | 
           37 | 
           @property(nonatomic, readonly) dispatch_queue_t eventsQueue;
  | 
        
        
            | 
            | 
           38 | 
              | 
        
        
            | 
            | 
           39 | 
           /** Firebase Remote Configuration object for FPRClient. */
  | 
        
        
            | 
            | 
           40 | 
           @property(nonatomic) FPRConfigurations *configuration;
  | 
        
        
            | 
            | 
           41 | 
              | 
        
        
            | 
            | 
           42 | 
           /** Firebase Installations object for FPRClient. */
  | 
        
        
            | 
            | 
           43 | 
           @property(nonatomic) FIRInstallations *installations;
  | 
        
        
            | 
            | 
           44 | 
              | 
        
        
            | 
            | 
           45 | 
           /** The Firebase Project ID of the project. */
  | 
        
        
            | 
            | 
           46 | 
           @property(nonatomic, readonly) NSString *projectID;
  | 
        
        
            | 
            | 
           47 | 
              | 
        
        
            | 
            | 
           48 | 
           /** The bundle ID of the project*/
  | 
        
        
            | 
            | 
           49 | 
           @property(nonatomic, readonly) NSString *bundleID;
  | 
        
        
            | 
            | 
           50 | 
           /**
  | 
        
        
            | 
            | 
           51 | 
            * Determines the log directory path in the caches directory.
  | 
        
        
            | 
            | 
           52 | 
            *
  | 
        
        
            | 
            | 
           53 | 
            * @return The directory in which Clearcut logs are stored.
  | 
        
        
            | 
            | 
           54 | 
            */
  | 
        
        
            | 
            | 
           55 | 
           + (NSString *)logDirectoryPath;
  | 
        
        
            | 
            | 
           56 | 
              | 
        
        
            | 
            | 
           57 | 
           /**
  | 
        
        
            | 
            | 
           58 | 
            * Cleans up the log directory path in the cache directory created for Clearcut logs storage.
  | 
        
        
            | 
            | 
           59 | 
            *
  | 
        
        
            | 
            | 
           60 | 
            * @remark This method (cleanup logic) should stay for a while until all of our apps have migrated
  | 
        
        
            | 
            | 
           61 | 
            * to a version which includes this logic.
  | 
        
        
            | 
            | 
           62 | 
            */
  | 
        
        
            | 
            | 
           63 | 
           + (void)cleanupClearcutCacheDirectory;
  | 
        
        
            | 
            | 
           64 | 
              | 
        
        
            | 
            | 
           65 | 
           /** Performs post processing and logs a firebase_perf_v1_PerfMetric object to Google Data Transport.
  | 
        
        
            | 
            | 
           66 | 
            *  @param event Reference to a firebase_perf_v1_PerfMetric proto object.
  | 
        
        
            | 
            | 
           67 | 
            */
  | 
        
        
            | 
            | 
           68 | 
           - (void)processAndLogEvent:(firebase_perf_v1_PerfMetric)event;
  | 
        
        
            | 
            | 
           69 | 
              | 
        
        
            | 
            | 
           70 | 
           @end
  |