| 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 <Foundation/Foundation.h>
  | 
        
        
            | 
            | 
           16 | 
              | 
        
        
            | 
            | 
           17 | 
           NS_ASSUME_NONNULL_BEGIN
  | 
        
        
            | 
            | 
           18 | 
              | 
        
        
            | 
            | 
           19 | 
           /** Allows the filtering of URLs based on a allowlist specified in the Info.plist. */
  | 
        
        
            | 
            | 
           20 | 
           @interface FPRURLFilter : NSObject
  | 
        
        
            | 
            | 
           21 | 
              | 
        
        
            | 
            | 
           22 | 
           /** Returns a singleton URL filterer.
  | 
        
        
            | 
            | 
           23 | 
            *
  | 
        
        
            | 
            | 
           24 | 
            *  @return The singleton instance. */
  | 
        
        
            | 
            | 
           25 | 
           + (instancetype)sharedInstance;
  | 
        
        
            | 
            | 
           26 | 
              | 
        
        
            | 
            | 
           27 | 
           /** Default initializer is disabled.
  | 
        
        
            | 
            | 
           28 | 
            */
  | 
        
        
            | 
            | 
           29 | 
           - (instancetype)init NS_UNAVAILABLE;
  | 
        
        
            | 
            | 
           30 | 
              | 
        
        
            | 
            | 
           31 | 
           /** Checks the allowlist and denylist, and returns a YES or NO depending on their state.
  | 
        
        
            | 
            | 
           32 | 
            *
  | 
        
        
            | 
            | 
           33 | 
            *  @note The current implementation is very naive. The denylist is only set by the SDK, and these
  | 
        
        
            | 
            | 
           34 | 
            *      URLs will not be allowed, even if we explicitly allow them.
  | 
        
        
            | 
            | 
           35 | 
            *
  | 
        
        
            | 
            | 
           36 | 
            *  @param URL The URL string to check.
  | 
        
        
            | 
            | 
           37 | 
            *  @return YES if the URL should be instrumented, NO otherwise.
  | 
        
        
            | 
            | 
           38 | 
            */
  | 
        
        
            | 
            | 
           39 | 
           - (BOOL)shouldInstrumentURL:(NSString *)URL;
  | 
        
        
            | 
            | 
           40 | 
              | 
        
        
            | 
            | 
           41 | 
           @end
  | 
        
        
            | 
            | 
           42 | 
              | 
        
        
            | 
            | 
           43 | 
           NS_ASSUME_NONNULL_END
  |