





#import "GrowAssetPickerMusicalExport.h"
@import Network;

static NSString *tryAnyOfferCat = nil;
static nw_path_monitor_t oddEyeUsedFork = NULL;

@implementation GrowAssetPickerMusicalExport

+ (BOOL)negativeReadSixAskDisk {
    return tryAnyOfferCat != nil;
}

+ (NSString *)lowPredicateType {
    return tryAnyOfferCat ?: @"none";
}

+ (void)distanceStripStampBarSayDisplay:(void (^)(BOOL negativeReadSixAskDisk))completion {
    
    if (oddEyeUsedFork != NULL) {
        nw_path_monitor_cancel(oddEyeUsedFork);
        oddEyeUsedFork = NULL;
    }
    
    
    oddEyeUsedFork = nw_path_monitor_create();
    nw_path_monitor_set_queue(oddEyeUsedFork, dispatch_get_main_queue());
    
    __block nw_path_monitor_t deletionTail = oddEyeUsedFork;
    nw_path_monitor_set_update_handler(oddEyeUsedFork, ^(nw_path_t path) {
        nw_path_status_t status = nw_path_get_status(path);
        if (status == nw_path_status_satisfied) {
            if (nw_path_uses_interface_type(path, nw_interface_type_wifi)) {
                tryAnyOfferCat = @"wifi";
            } else if (nw_path_uses_interface_type(path, nw_interface_type_cellular)) {
                tryAnyOfferCat = @"cellular";
            } else {
                
                tryAnyOfferCat = @"other";
            }
            
            
            if (deletionTail) {
                nw_path_monitor_cancel(deletionTail);
                deletionTail = NULL;
                oddEyeUsedFork = NULL;
            }
            
        } else {
            tryAnyOfferCat = nil;
        }
        
        
        if (completion) {
            completion([self negativeReadSixAskDisk]);
        }
        
    });
    
    
    nw_path_monitor_start(oddEyeUsedFork);
}

@end
