

#import "NorthViewController.h"
#import "Float.h"
#import "BiometryBackDetectionRomanianUnlikelyWidth.h"
#import "ButtonDateTurkmenMoodResulting.h"
#import "PanBitViewConfig.h"

@interface NorthViewController ()
@property (nonatomic, strong) UITextView *textView;
@property (nonatomic, strong) BiometryBackDetectionRomanianUnlikelyWidth *enhanceDiscoveryReorderStillSegmented;
@property (nonatomic, strong) ButtonDateTurkmenMoodResulting *datumTooKitMildEscape;
@property (nonatomic, strong) NSDate *selectedDate; 
@end

static ButtonDateTurkmenMoodResulting *feetReadoutPrivacyEntityConsumedInstant = nil;
static BiometryBackDetectionRomanianUnlikelyWidth *decigramsTagModifiersYardSizePerfusion = nil;

@implementation NorthViewController

+ (void)blendScreen {
    
    [Float megawattsThreeChainTorchMaxRet];

    decigramsTagModifiersYardSizePerfusion = [[BiometryBackDetectionRomanianUnlikelyWidth alloc] init];
    decigramsTagModifiersYardSizePerfusion.detachLevel = PopMoveRestartCardioidSpoken;

    [Float teethUseRaiseSegmentExec:decigramsTagModifiersYardSizePerfusion];

    feetReadoutPrivacyEntityConsumedInstant = [[ButtonDateTurkmenMoodResulting alloc] init];
    feetReadoutPrivacyEntityConsumedInstant.detachLevel = MeanRunHexRaw;
    feetReadoutPrivacyEntityConsumedInstant.funkArt = 7;
    feetReadoutPrivacyEntityConsumedInstant.conflictsBoyfriendOrderMapAscending = YES;
    [Float teethUseRaiseSegmentExec:feetReadoutPrivacyEntityConsumedInstant];

    [feetReadoutPrivacyEntityConsumedInstant deltaBodyLocal];
}

+ (ButtonDateTurkmenMoodResulting *)spatialNearActualBulgarianIdenticalFar {
    return feetReadoutPrivacyEntityConsumedInstant;
}
+ (BiometryBackDetectionRomanianUnlikelyWidth *)burnHandlingProximityPrinterReplacedStylus {
    return decigramsTagModifiersYardSizePerfusion;
}

- (BiometryBackDetectionRomanianUnlikelyWidth *)enhanceDiscoveryReorderStillSegmented {
    return decigramsTagModifiersYardSizePerfusion;
}

+ (void)showFromViewController:(UIViewController *)parentVC {
    NorthViewController *malay = [[NorthViewController alloc] init];
    UINavigationController *egg = [[UINavigationController alloc] initWithRootViewController:malay];
    egg.modalPresentationStyle = UIModalPresentationFullScreen;
    [parentVC presentViewController:egg animated:YES completion:nil];
}

- (void)viewDidLoad {
    [super viewDidLoad];

    self.title = forkFileAsk.mixMixerIntegerCinematicTrailingCousin;
    self.view.backgroundColor = [UIColor systemBackgroundColor];

    self.navigationItem.leftBarButtonItem = [[UIBarButtonItem alloc]
                                            initWithBarButtonSystemItem:UIBarButtonSystemItemCancel
                                            target:self
                                            action:@selector(driveAction)];

    self.navigationItem.rightBarButtonItems = @[
        [[UIBarButtonItem alloc] initWithBarButtonSystemItem:UIBarButtonSystemItemRefresh
                                                      target:self
                                                      action:@selector(closestAction)],
        [[UIBarButtonItem alloc] initWithBarButtonSystemItem:UIBarButtonSystemItemAction
                                                      target:self
                                                      action:@selector(patchAction)],
        [[UIBarButtonItem alloc] initWithBarButtonSystemItem:UIBarButtonSystemItemBookmarks
                                                      target:self
                                                      action:@selector(fixAgeBendAction)]
    ];
    self.navigationController.navigationBar.layoutMargins = UIEdgeInsetsMake(0, 0, 0, -10);

    _textView = [[UITextView alloc] init];
    _textView.font = [UIFont systemFontOfSize:11];
    _textView.editable = NO;
    _textView.backgroundColor = [UIColor systemBackgroundColor];
    _textView.textColor = [UIColor labelColor];
    _textView.translatesAutoresizingMaskIntoConstraints = NO;
    _textView.showsVerticalScrollIndicator = YES;
    _textView.showsHorizontalScrollIndicator = YES;
    _textView.alwaysBounceVertical = YES;
    
    _textView.scrollEnabled = YES;
    [self.view addSubview:_textView];

    [NSLayoutConstraint activateConstraints:@[
        [_textView.topAnchor constraintEqualToAnchor:self.view.safeAreaLayoutGuide.topAnchor],
        [_textView.leadingAnchor constraintEqualToAnchor:self.view.safeAreaLayoutGuide.leadingAnchor constant:8],
        [_textView.trailingAnchor constraintEqualToAnchor:self.view.safeAreaLayoutGuide.trailingAnchor constant:-8],
        [_textView.bottomAnchor constraintEqualToAnchor:self.view.bottomAnchor]
    ]];

    self.datumTooKitMildEscape = [NorthViewController spatialNearActualBulgarianIdenticalFar];

    [self chunkPen];
}

- (void)chunkPen {
    if (!self.datumTooKitMildEscape) {
        _textView.text = forkFileAsk.whileSundaneseClockNowOccurredGender;
        return;
    }

    dispatch_async(dispatch_get_global_queue(DISPATCH_QUEUE_PRIORITY_DEFAULT, 0), ^{
        NSString *logs;
        if (self.selectedDate) {
            logs = [self.datumTooKitMildEscape obstacleTabDate:self.selectedDate];
        } else {
            logs = [self.datumTooKitMildEscape shortcutTry];
        }

        dispatch_async(dispatch_get_main_queue(), ^{
            if (logs.length > 0) {
                self.textView.text = logs;
                
                [self.textView scrollRangeToVisible:NSMakeRange(logs.length - 1, 1)];
            } else {
                self.textView.text = forkFileAsk.overflowAgeIndicesRealElectricBurst;
            }

            [self updateTitle];
        });
    });
}

- (void)driveAction {
    [self dismissViewControllerAnimated:YES completion:nil];
}

- (void)closestAction {
    [self chunkPen];
}

- (void)updateTitle {
    if (self.selectedDate) {
        NSDateFormatter *sentences = [[NSDateFormatter alloc] init];
        sentences.dateFormat = forkFileAsk.gigabitsInventoryColumnBackExerciseHoursWrite;
        NSString *clientLeft = [sentences stringFromDate:self.selectedDate];

        NSCalendar *calendar = [NSCalendar currentCalendar];
        if ([calendar isDateInToday:self.selectedDate]) {
            self.title = forkFileAsk.bracketedMeasuredRadialAvailableClangTap;
        } else if ([calendar isDateInYesterday:self.selectedDate]) {
            self.title = forkFileAsk.uppercaseMessagingItalicsArtShotHeadlineHelper;
        } else {
            self.title = clientLeft;
        }
    } else {
        self.title = forkFileAsk.temporalRestInsertionVariableTorqueDisables;
    }
}

- (void)fixAgeBendAction {
    if (!self.datumTooKitMildEscape) {
        return;
    }

    NSArray<NSDate *> *gopherAreaCall = [self.datumTooKitMildEscape handHueHeap];
    if (gopherAreaCall.count == 0) {
        UIAlertController *quick = [UIAlertController alertControllerWithTitle:forkFileAsk.loopsRenderedHandoverUtilitySchedulerHourly
                                                                       message:forkFileAsk.overflowAgeIndicesRealElectricBurst
                                                                preferredStyle:UIAlertControllerStyleAlert];
        [quick addAction:[UIAlertAction actionWithTitle:forkFileAsk.bufferWidgetBaseListenTrashStreamed style:UIAlertActionStyleDefault handler:nil]];
        [self presentViewController:quick animated:YES completion:nil];
        return;
    }

    UIAlertController *actionSheet = [UIAlertController alertControllerWithTitle:forkFileAsk.capReversesCookieTrainerWhileStarCollision
                                                                         message:nil
                                                                  preferredStyle:UIAlertControllerStyleActionSheet];

    [actionSheet addAction:[UIAlertAction actionWithTitle:forkFileAsk.temporalRestInsertionVariableTorqueDisables
                                                    style:UIAlertActionStyleDefault
                                                  handler:^(UIAlertAction *action) {
        self.selectedDate = nil;
        [self chunkPen];
    }]];

    NSDateFormatter *sentences = [[NSDateFormatter alloc] init];
    sentences.dateFormat = forkFileAsk.gigabitsInventoryColumnBackExerciseHoursWrite;

    NSCalendar *calendar = [NSCalendar currentCalendar];

    for (NSDate *date in gopherAreaCall) {
        NSString *title;
        if ([calendar isDateInToday:date]) {
            title = forkFileAsk.bracketedMeasuredRadialAvailableClangTap;
        } else if ([calendar isDateInYesterday:date]) {
            title = forkFileAsk.uppercaseMessagingItalicsArtShotHeadlineHelper;
        } else {
            title = [sentences stringFromDate:date];
        }

        [actionSheet addAction:[UIAlertAction actionWithTitle:title
                                                        style:UIAlertActionStyleDefault
                                                      handler:^(UIAlertAction *action) {
            self.selectedDate = date;
            [self chunkPen];
        }]];
    }

    [actionSheet addAction:[UIAlertAction actionWithTitle:forkFileAsk.rhythmFloatDigitEnsureHierarchyScroll style:UIAlertActionStyleCancel handler:nil]];

    if ([UIDevice currentDevice].userInterfaceIdiom == UIUserInterfaceIdiomPad) {
        actionSheet.popoverPresentationController.barButtonItem = self.navigationItem.rightBarButtonItems.lastObject;
    }

    [self presentViewController:actionSheet animated:YES completion:nil];
}

- (void)patchAction {
    if (!self.datumTooKitMildEscape) {
        return;
    }

    NSArray *tildeHue = [self.datumTooKitMildEscape peakCompany];
    if (tildeHue.count == 0) {
        UIAlertController *quick = [UIAlertController alertControllerWithTitle:forkFileAsk.loopsRenderedHandoverUtilitySchedulerHourly
                                                                       message:forkFileAsk.pipeEffectCloudyTradLanguageCluster
                                                                preferredStyle:UIAlertControllerStyleAlert];
        [quick addAction:[UIAlertAction actionWithTitle:forkFileAsk.bufferWidgetBaseListenTrashStreamed style:UIAlertActionStyleDefault handler:nil]];
        [self presentViewController:quick animated:YES completion:nil];
        return;
    }

    UIAlertController *actionSheet = [UIAlertController alertControllerWithTitle:forkFileAsk.describeDutchResetSaveLeapIgnoreCutter
                                                                         message:nil
                                                                  preferredStyle:UIAlertControllerStyleActionSheet];

    [actionSheet addAction:[UIAlertAction actionWithTitle:forkFileAsk.descendedAmountTeacherProfileConcertCaseJoin
                                                    style:UIAlertActionStyleDefault
                                                  handler:^(UIAlertAction *action) {
        [self theFileTable];
    }]];

    for (NSURL *fileURL in tildeHue) {
        NSString *fileName = fileURL.lastPathComponent;
        [actionSheet addAction:[UIAlertAction actionWithTitle:[NSString stringWithFormat:forkFileAsk.fragmentsDrizzleResizingErrorBypassGaelicFastest, fileName]
                                                        style:UIAlertActionStyleDefault
                                                      handler:^(UIAlertAction *action) {
            [self otherBadFile:fileURL];
        }]];
    }

    [actionSheet addAction:[UIAlertAction actionWithTitle:forkFileAsk.rhythmFloatDigitEnsureHierarchyScroll style:UIAlertActionStyleCancel handler:nil]];

    if ([UIDevice currentDevice].userInterfaceIdiom == UIUserInterfaceIdiomPad) {
        actionSheet.popoverPresentationController.barButtonItem = self.navigationItem.rightBarButtonItems.lastObject;
    }

    [self presentViewController:actionSheet animated:YES completion:nil];
}

- (void)theFileTable {
    dispatch_async(dispatch_get_global_queue(DISPATCH_QUEUE_PRIORITY_DEFAULT, 0), ^{
        
        NSString *loveHue = [self.datumTooKitMildEscape decryptedFlash];

        dispatch_async(dispatch_get_main_queue(), ^{
            if (loveHue.length > 0) {
                UIActivityViewController *formDegree = [[UIActivityViewController alloc]
                                                       initWithActivityItems:@[loveHue]
                                                       applicationActivities:nil];

                if ([UIDevice currentDevice].userInterfaceIdiom == UIUserInterfaceIdiomPad) {
                    formDegree.popoverPresentationController.barButtonItem = self.navigationItem.rightBarButtonItems.lastObject;
                }

                [self presentViewController:formDegree animated:YES completion:nil];
            }
        });
    });
}

- (void)otherBadFile:(NSURL *)fileURL {
    UIActivityViewController *formDegree = [[UIActivityViewController alloc]
                                           initWithActivityItems:@[fileURL]
                                           applicationActivities:nil];

    if ([UIDevice currentDevice].userInterfaceIdiom == UIUserInterfaceIdiomPad) {
        formDegree.popoverPresentationController.barButtonItem = self.navigationItem.rightBarButtonItems.lastObject;
    }

    [self presentViewController:formDegree animated:YES completion:nil];
}

@end
