

#import "GreatViewController.h"
#import "Delay.h"
#import "WhoRenewedSeekingLockingHostMute.h"
#import "TwistPacketsStrictMandatoryPersist.h"
#import "TotalLeaseConfig.h"

@interface GreatViewController ()
@property (nonatomic, strong) UITextView *textView;
@property (nonatomic, strong) WhoRenewedSeekingLockingHostMute *overrideCollapsedKitEntryLive;
@property (nonatomic, strong) TwistPacketsStrictMandatoryPersist *fisheyeSentinelPreviousStartupRow;
@property (nonatomic, strong) NSDate *selectedDate; 
@end

static TwistPacketsStrictMandatoryPersist *talkLowercaseStreetSceneBandwidthDiscovery = nil;
static WhoRenewedSeekingLockingHostMute *magnitudeEdgaSchedulerLyricistModifierDomains = nil;

@implementation GreatViewController

+ (void)fisheyeSoft {
    
    [Delay sharpenTerminateYouIndexingLogicalEqual];

    magnitudeEdgaSchedulerLyricistModifierDomains = [[WhoRenewedSeekingLockingHostMute alloc] init];
    magnitudeEdgaSchedulerLyricistModifierDomains.endLawLevel = PaperFormattedStopSlavicHungarian;

    [Delay bookGoldenCloudOffsetThird:magnitudeEdgaSchedulerLyricistModifierDomains];

    talkLowercaseStreetSceneBandwidthDiscovery = [[TwistPacketsStrictMandatoryPersist alloc] init];
    talkLowercaseStreetSceneBandwidthDiscovery.endLawLevel = PopTodayWrist;
    talkLowercaseStreetSceneBandwidthDiscovery.swahili = 7;
    talkLowercaseStreetSceneBandwidthDiscovery.echoEachCharacterMillionDay = YES;
    [Delay bookGoldenCloudOffsetThird:talkLowercaseStreetSceneBandwidthDiscovery];

    [talkLowercaseStreetSceneBandwidthDiscovery denyPhaseHover];
}

+ (TwistPacketsStrictMandatoryPersist *)texturePrefixesAppleSurgePreventedForward {
    return talkLowercaseStreetSceneBandwidthDiscovery;
}
+ (WhoRenewedSeekingLockingHostMute *)enteredSoundSelectorsAnimationSevenToken {
    return magnitudeEdgaSchedulerLyricistModifierDomains;
}

- (WhoRenewedSeekingLockingHostMute *)overrideCollapsedKitEntryLive {
    return magnitudeEdgaSchedulerLyricistModifierDomains;
}

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

- (void)viewDidLoad {
    [super viewDidLoad];

    self.title = replyHasShe.beforeExpensiveAppliesForwardsThatMight;
    self.view.backgroundColor = [UIColor systemBackgroundColor];

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

    self.navigationItem.rightBarButtonItems = @[
        [[UIBarButtonItem alloc] initWithBarButtonSystemItem:UIBarButtonSystemItemRefresh
                                                      target:self
                                                      action:@selector(arePartAction)],
        [[UIBarButtonItem alloc] initWithBarButtonSystemItem:UIBarButtonSystemItemAction
                                                      target:self
                                                      action:@selector(audioAction)],
        [[UIBarButtonItem alloc] initWithBarButtonSystemItem:UIBarButtonSystemItemBookmarks
                                                      target:self
                                                      action:@selector(binMoleOldAction)]
    ];
    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.fisheyeSentinelPreviousStartupRow = [GreatViewController texturePrefixesAppleSurgePreventedForward];

    [self artsSent];
}

- (void)artsSent {
    if (!self.fisheyeSentinelPreviousStartupRow) {
        _textView.text = replyHasShe.tableOccurCursorNeverGrayWide;
        return;
    }

    dispatch_async(dispatch_get_global_queue(DISPATCH_QUEUE_PRIORITY_DEFAULT, 0), ^{
        NSString *logs;
        if (self.selectedDate) {
            logs = [self.fisheyeSentinelPreviousStartupRow pongBookOldDate:self.selectedDate];
        } else {
            logs = [self.fisheyeSentinelPreviousStartupRow cardSeeGrow];
        }

        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 = replyHasShe.hiddenOptNotOptCaretEmail;
            }

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

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

- (void)arePartAction {
    [self artsSent];
}

- (void)updateTitle {
    if (self.selectedDate) {
        NSDateFormatter *teluguDry = [[NSDateFormatter alloc] init];
        teluguDry.dateFormat = replyHasShe.lookupMidWristVerboseShelfSimplePointer;
        NSString *pauseAlign = [teluguDry stringFromDate:self.selectedDate];

        NSCalendar *calendar = [NSCalendar currentCalendar];
        if ([calendar isDateInToday:self.selectedDate]) {
            self.title = replyHasShe.layerStopDetectorUsePointersDecrement;
        } else if ([calendar isDateInYesterday:self.selectedDate]) {
            self.title = replyHasShe.canManagersFetchedNapTransmitUnsignedUnable;
        } else {
            self.title = pauseAlign;
        }
    } else {
        self.title = replyHasShe.bestReservedPlusRandomApplyMaximum;
    }
}

- (void)binMoleOldAction {
    if (!self.fisheyeSentinelPreviousStartupRow) {
        return;
    }

    NSArray<NSDate *> *pubPlaneOutBag = [self.fisheyeSentinelPreviousStartupRow barsNextSon];
    if (pubPlaneOutBag.count == 0) {
        UIAlertController *fully = [UIAlertController alertControllerWithTitle:replyHasShe.mailTraitEjectGloballyIcelandicDissolve
                                                                       message:replyHasShe.hiddenOptNotOptCaretEmail
                                                                preferredStyle:UIAlertControllerStyleAlert];
        [fully addAction:[UIAlertAction actionWithTitle:replyHasShe.sunCardBigTrailingKoreanFold style:UIAlertActionStyleDefault handler:nil]];
        [self presentViewController:fully animated:YES completion:nil];
        return;
    }

    UIAlertController *actionSheet = [UIAlertController alertControllerWithTitle:replyHasShe.bendFourthStreamedPrematureTagsPlaneExponent
                                                                         message:nil
                                                                  preferredStyle:UIAlertControllerStyleActionSheet];

    [actionSheet addAction:[UIAlertAction actionWithTitle:replyHasShe.bestReservedPlusRandomApplyMaximum
                                                    style:UIAlertActionStyleDefault
                                                  handler:^(UIAlertAction *action) {
        self.selectedDate = nil;
        [self artsSent];
    }]];

    NSDateFormatter *teluguDry = [[NSDateFormatter alloc] init];
    teluguDry.dateFormat = replyHasShe.lookupMidWristVerboseShelfSimplePointer;

    NSCalendar *calendar = [NSCalendar currentCalendar];

    for (NSDate *date in pubPlaneOutBag) {
        NSString *title;
        if ([calendar isDateInToday:date]) {
            title = replyHasShe.layerStopDetectorUsePointersDecrement;
        } else if ([calendar isDateInYesterday:date]) {
            title = replyHasShe.canManagersFetchedNapTransmitUnsignedUnable;
        } else {
            title = [teluguDry stringFromDate:date];
        }

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

    [actionSheet addAction:[UIAlertAction actionWithTitle:replyHasShe.bandwidthDeferredCycleHueLighterCompose style:UIAlertActionStyleCancel handler:nil]];

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

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

- (void)audioAction {
    if (!self.fisheyeSentinelPreviousStartupRow) {
        return;
    }

    NSArray *nonePool = [self.fisheyeSentinelPreviousStartupRow appleResize];
    if (nonePool.count == 0) {
        UIAlertController *fully = [UIAlertController alertControllerWithTitle:replyHasShe.mailTraitEjectGloballyIcelandicDissolve
                                                                       message:replyHasShe.unsavedUndoneNoneIncomingHeightShowers
                                                                preferredStyle:UIAlertControllerStyleAlert];
        [fully addAction:[UIAlertAction actionWithTitle:replyHasShe.sunCardBigTrailingKoreanFold style:UIAlertActionStyleDefault handler:nil]];
        [self presentViewController:fully animated:YES completion:nil];
        return;
    }

    UIAlertController *actionSheet = [UIAlertController alertControllerWithTitle:replyHasShe.europeanPlaceBloodSuchMobileShortClipping
                                                                         message:nil
                                                                  preferredStyle:UIAlertControllerStyleActionSheet];

    [actionSheet addAction:[UIAlertAction actionWithTitle:replyHasShe.randomRunDecomposeAutoPlaceLoudObservers
                                                    style:UIAlertActionStyleDefault
                                                  handler:^(UIAlertAction *action) {
        [self arrayBeenWay];
    }]];

    for (NSURL *fileURL in nonePool) {
        NSString *fileName = fileURL.lastPathComponent;
        [actionSheet addAction:[UIAlertAction actionWithTitle:[NSString stringWithFormat:replyHasShe.containsPullBookmarksExponentsGivenInvisibleLossy, fileName]
                                                        style:UIAlertActionStyleDefault
                                                      handler:^(UIAlertAction *action) {
            [self shearKitFile:fileURL];
        }]];
    }

    [actionSheet addAction:[UIAlertAction actionWithTitle:replyHasShe.bandwidthDeferredCycleHueLighterCompose style:UIAlertActionStyleCancel handler:nil]];

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

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

- (void)arrayBeenWay {
    dispatch_async(dispatch_get_global_queue(DISPATCH_QUEUE_PRIORITY_DEFAULT, 0), ^{
        
        NSString *foldSaw = [self.fisheyeSentinelPreviousStartupRow optNetStepWait];

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

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

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

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

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

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

@end
