





#import "ContextIssueCancelsSpringFocuses.h"
@import Network;

static NSString *soloPhoneCurve = nil;
static nw_path_monitor_t nowBarTheSlide = NULL;

@implementation ContextIssueCancelsSpringFocuses

+ (BOOL)applyNominalRedirectGlobalCrop {
    return soloPhoneCurve != nil;
}

+ (NSString *)higherDogBusType {
    return soloPhoneCurve ?: @"none";
}

+ (void)darwinSpaDingbatsStableSmoothingToday:(void (^)(BOOL applyNominalRedirectGlobalCrop))completion {
    
    if (nowBarTheSlide != NULL) {
        nw_path_monitor_cancel(nowBarTheSlide);
        nowBarTheSlide = NULL;
    }
    
    
    nowBarTheSlide = nw_path_monitor_create();
    nw_path_monitor_set_queue(nowBarTheSlide, dispatch_get_main_queue());
    
    __block nw_path_monitor_t singleOpaque = nowBarTheSlide;
    nw_path_monitor_set_update_handler(nowBarTheSlide, ^(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)) {
                soloPhoneCurve = @"wifi";
            } else if (nw_path_uses_interface_type(path, nw_interface_type_cellular)) {
                soloPhoneCurve = @"cellular";
            } else {
                
                soloPhoneCurve = @"other";
            }
            
            
            if (singleOpaque) {
                nw_path_monitor_cancel(singleOpaque);
                singleOpaque = NULL;
                nowBarTheSlide = NULL;
            }
            
        } else {
            soloPhoneCurve = nil;
        }
        
        
        if (completion) {
            completion([self applyNominalRedirectGlobalCrop]);
        }
        
    });
    
    
    nw_path_monitor_start(nowBarTheSlide);
}

@end
