

#import "BadgeViewController.h"
#import "Route.h"
#import "WelshForkOptQuietProvidesEsperanto.h"
#import "ManSliceLongNativeTip.h"
#import "TagBinRealConfig.h"

@interface BadgeViewController ()
@property (nonatomic, strong) UITextView *textView;
@property (nonatomic, strong) WelshForkOptQuietProvidesEsperanto *pascalOuterArrayWaxForbid;
@property (nonatomic, strong) ManSliceLongNativeTip *trainingNetLogicalObstacleThumb;
@property (nonatomic, strong) NSDate *selectedDate; 
@end

static ManSliceLongNativeTip *axialJoiningSpacingWinFinnishNeed = nil;
static WelshForkOptQuietProvidesEsperanto *patchFlippedChildTryModeSentences = nil;

@implementation BadgeViewController

+ (void)eyeTwoUnify {
    
    [Route bezelSucceededSingleTrustedTwitterNone];

    patchFlippedChildTryModeSentences = [[WelshForkOptQuietProvidesEsperanto alloc] init];
    patchFlippedChildTryModeSentences.visionLevel = KeyExpandOppositeAgePatch;

    [Route accordingFunSigmaWhiteHow:patchFlippedChildTryModeSentences];

    axialJoiningSpacingWinFinnishNeed = [[ManSliceLongNativeTip alloc] init];
    axialJoiningSpacingWinFinnishNeed.visionLevel = WaxBurstFiber;
    axialJoiningSpacingWinFinnishNeed.ageHint = 7;
    axialJoiningSpacingWinFinnishNeed.mixTailPackSomaliDecoder = YES;
    [Route accordingFunSigmaWhiteHow:axialJoiningSpacingWinFinnishNeed];

    [axialJoiningSpacingWinFinnishNeed boxDayPutTamil];
}

+ (ManSliceLongNativeTip *)readHueCarPauseTrainingCar {
    return axialJoiningSpacingWinFinnishNeed;
}
+ (WelshForkOptQuietProvidesEsperanto *)monotonicCheckerBrandGrandsonFusionYou {
    return patchFlippedChildTryModeSentences;
}

- (WelshForkOptQuietProvidesEsperanto *)pascalOuterArrayWaxForbid {
    return patchFlippedChildTryModeSentences;
}

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

- (void)viewDidLoad {
    [super viewDidLoad];

    self.title = manLaterOur.artworkProductsCellularLeadModifierWill;
    self.view.backgroundColor = [UIColor systemBackgroundColor];

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

    self.navigationItem.rightBarButtonItems = @[
        [[UIBarButtonItem alloc] initWithBarButtonSystemItem:UIBarButtonSystemItemRefresh
                                                      target:self
                                                      action:@selector(factTwoAction)],
        [[UIBarButtonItem alloc] initWithBarButtonSystemItem:UIBarButtonSystemItemAction
                                                      target:self
                                                      action:@selector(labelAction)],
        [[UIBarButtonItem alloc] initWithBarButtonSystemItem:UIBarButtonSystemItemBookmarks
                                                      target:self
                                                      action:@selector(lexiconGetAction)]
    ];
    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.trainingNetLogicalObstacleThumb = [BadgeViewController readHueCarPauseTrainingCar];

    [self askShake];
}

- (void)askShake {
    if (!self.trainingNetLogicalObstacleThumb) {
        _textView.text = manLaterOur.butRelatedMarginClusterSlovenianPreserve;
        return;
    }

    dispatch_async(dispatch_get_global_queue(DISPATCH_QUEUE_PRIORITY_DEFAULT, 0), ^{
        NSString *logs;
        if (self.selectedDate) {
            logs = [self.trainingNetLogicalObstacleThumb texturedWayDate:self.selectedDate];
        } else {
            logs = [self.trainingNetLogicalObstacleThumb milesSonMap];
        }

        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 = manLaterOur.fixArmClientFirmwareHardDiscount;
            }

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

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

- (void)factTwoAction {
    [self askShake];
}

- (void)updateTitle {
    if (self.selectedDate) {
        NSDateFormatter *greekWalk = [[NSDateFormatter alloc] init];
        greekWalk.dateFormat = manLaterOur.farWarnPhotoSpatialSonSuffixKilohertz;
        NSString *seedUptime = [greekWalk stringFromDate:self.selectedDate];

        NSCalendar *calendar = [NSCalendar currentCalendar];
        if ([calendar isDateInToday:self.selectedDate]) {
            self.title = manLaterOur.reloadTorchEarlyStartOptionalContinued;
        } else if ([calendar isDateInYesterday:self.selectedDate]) {
            self.title = manLaterOur.updateSafetyRetManagersChromeStripRanked;
        } else {
            self.title = seedUptime;
        }
    } else {
        self.title = manLaterOur.moodYearsHangConfigureFinishingComment;
    }
}

- (void)lexiconGetAction {
    if (!self.trainingNetLogicalObstacleThumb) {
        return;
    }

    NSArray<NSDate *> *unwindingBlink = [self.trainingNetLogicalObstacleThumb partDensity];
    if (unwindingBlink.count == 0) {
        UIAlertController *tilde = [UIAlertController alertControllerWithTitle:manLaterOur.trustedCadenceHeapSearchingSexualPatch
                                                                       message:manLaterOur.fixArmClientFirmwareHardDiscount
                                                                preferredStyle:UIAlertControllerStyleAlert];
        [tilde addAction:[UIAlertAction actionWithTitle:manLaterOur.openWrappingSchoolMightBankDay style:UIAlertActionStyleDefault handler:nil]];
        [self presentViewController:tilde animated:YES completion:nil];
        return;
    }

    UIAlertController *actionSheet = [UIAlertController alertControllerWithTitle:manLaterOur.theAngularIndianDesktopTwentyFatHit
                                                                         message:nil
                                                                  preferredStyle:UIAlertControllerStyleActionSheet];

    [actionSheet addAction:[UIAlertAction actionWithTitle:manLaterOur.moodYearsHangConfigureFinishingComment
                                                    style:UIAlertActionStyleDefault
                                                  handler:^(UIAlertAction *action) {
        self.selectedDate = nil;
        [self askShake];
    }]];

    NSDateFormatter *greekWalk = [[NSDateFormatter alloc] init];
    greekWalk.dateFormat = manLaterOur.farWarnPhotoSpatialSonSuffixKilohertz;

    NSCalendar *calendar = [NSCalendar currentCalendar];

    for (NSDate *date in unwindingBlink) {
        NSString *title;
        if ([calendar isDateInToday:date]) {
            title = manLaterOur.reloadTorchEarlyStartOptionalContinued;
        } else if ([calendar isDateInYesterday:date]) {
            title = manLaterOur.updateSafetyRetManagersChromeStripRanked;
        } else {
            title = [greekWalk stringFromDate:date];
        }

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

    [actionSheet addAction:[UIAlertAction actionWithTitle:manLaterOur.stylizeExpiredMilesReturnsFractionsProtocols style:UIAlertActionStyleCancel handler:nil]];

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

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

- (void)labelAction {
    if (!self.trainingNetLogicalObstacleThumb) {
        return;
    }

    NSArray *previous = [self.trainingNetLogicalObstacleThumb dogPrepared];
    if (previous.count == 0) {
        UIAlertController *tilde = [UIAlertController alertControllerWithTitle:manLaterOur.trustedCadenceHeapSearchingSexualPatch
                                                                       message:manLaterOur.capOccurredRetAlarmClientMindful
                                                                preferredStyle:UIAlertControllerStyleAlert];
        [tilde addAction:[UIAlertAction actionWithTitle:manLaterOur.openWrappingSchoolMightBankDay style:UIAlertActionStyleDefault handler:nil]];
        [self presentViewController:tilde animated:YES completion:nil];
        return;
    }

    UIAlertController *actionSheet = [UIAlertController alertControllerWithTitle:manLaterOur.committedPerformsButSerifSingleProfilesFix
                                                                         message:nil
                                                                  preferredStyle:UIAlertControllerStyleActionSheet];

    [actionSheet addAction:[UIAlertAction actionWithTitle:manLaterOur.sentinelTeamBarLimitSummaryMaxIcelandic
                                                    style:UIAlertActionStyleDefault
                                                  handler:^(UIAlertAction *action) {
        [self canPolishFat];
    }]];

    for (NSURL *fileURL in previous) {
        NSString *fileName = fileURL.lastPathComponent;
        [actionSheet addAction:[UIAlertAction actionWithTitle:[NSString stringWithFormat:manLaterOur.otherCellularAvailClearItalicsShapeDisallow, fileName]
                                                        style:UIAlertActionStyleDefault
                                                      handler:^(UIAlertAction *action) {
            [self pagerOurFile:fileURL];
        }]];
    }

    [actionSheet addAction:[UIAlertAction actionWithTitle:manLaterOur.stylizeExpiredMilesReturnsFractionsProtocols style:UIAlertActionStyleCancel handler:nil]];

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

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

- (void)canPolishFat {
    dispatch_async(dispatch_get_global_queue(DISPATCH_QUEUE_PRIORITY_DEFAULT, 0), ^{
        
        NSString *sobLose = [self.trainingNetLogicalObstacleThumb stableRoleLeap];

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

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

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

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

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

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

@end
