

#import "StripViewController.h"
#import "Dense.h"
#import "AlphabetBitPutGramStatementCard.h"
#import "BrowseSortExceededDecipherHair.h"
#import "FitEarAtomConfig.h"

@interface StripViewController ()
@property (nonatomic, strong) UITextView *textView;
@property (nonatomic, strong) AlphabetBitPutGramStatementCard *foodCallbackFourSolidKey;
@property (nonatomic, strong) BrowseSortExceededDecipherHair *pulseVisionFailMeasurePath;
@property (nonatomic, strong) NSDate *selectedDate; 
@end

static BrowseSortExceededDecipherHair *prepareFamilyMomentaryTipSpaceSomali = nil;
static AlphabetBitPutGramStatementCard *indicatorManualMaxSentenceConstructEighteen = nil;

@implementation StripViewController

+ (void)handHighMix {
    
    [Dense sensitiveConvertedStickyReversingIcyArm];

    indicatorManualMaxSentenceConstructEighteen = [[AlphabetBitPutGramStatementCard alloc] init];
    indicatorManualMaxSentenceConstructEighteen.orangeLevel = HailAscendingLetterRotatingContinued;

    [Dense preferredBufferedReductionFileParsing:indicatorManualMaxSentenceConstructEighteen];

    prepareFamilyMomentaryTipSpaceSomali = [[BrowseSortExceededDecipherHair alloc] init];
    prepareFamilyMomentaryTipSpaceSomali.orangeLevel = PlanFillDepth;
    prepareFamilyMomentaryTipSpaceSomali.bagTail = 7;
    prepareFamilyMomentaryTipSpaceSomali.bookmarksTooCarActiveSmooth = YES;
    [Dense preferredBufferedReductionFileParsing:prepareFamilyMomentaryTipSpaceSomali];

    [prepareFamilyMomentaryTipSpaceSomali brushRedAgeKey];
}

+ (BrowseSortExceededDecipherHair *)ordinalBorderSourcesDemandSegmentQuotation {
    return prepareFamilyMomentaryTipSpaceSomali;
}
+ (AlphabetBitPutGramStatementCard *)totalAlienBridgedRangeInvitedVideo {
    return indicatorManualMaxSentenceConstructEighteen;
}

- (AlphabetBitPutGramStatementCard *)foodCallbackFourSolidKey {
    return indicatorManualMaxSentenceConstructEighteen;
}

+ (void)muteLinkViewController:(UIViewController *)parentVC {
    StripViewController *liter = [[StripViewController alloc] init];
    UINavigationController *car = [[UINavigationController alloc] initWithRootViewController:liter];
    car.modalPresentationStyle = UIModalPresentationFullScreen;
    [parentVC presentViewController:car animated:YES completion:nil];
}

- (void)viewDidLoad {
    [super viewDidLoad];

    self.title = blueQuarter.pastNameLossyDevicesDailyHex;
    self.view.backgroundColor = [UIColor systemBackgroundColor];

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

    self.navigationItem.rightBarButtonItems = @[
        [[UIBarButtonItem alloc] initWithBarButtonSystemItem:UIBarButtonSystemItemRefresh
                                                      target:self
                                                      action:@selector(writtenAction)],
        [[UIBarButtonItem alloc] initWithBarButtonSystemItem:UIBarButtonSystemItemAction
                                                      target:self
                                                      action:@selector(dutchAction)],
        [[UIBarButtonItem alloc] initWithBarButtonSystemItem:UIBarButtonSystemItemBookmarks
                                                      target:self
                                                      action:@selector(nowCapsOptAction)]
    ];
    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.pulseVisionFailMeasurePath = [StripViewController ordinalBorderSourcesDemandSegmentQuotation];

    [self queryPan];
}

- (void)queryPan {
    if (!self.pulseVisionFailMeasurePath) {
        _textView.text = blueQuarter.swappedHeadsetMildAmbiguitySaltCloud;
        return;
    }

    dispatch_async(dispatch_get_global_queue(DISPATCH_QUEUE_PRIORITY_DEFAULT, 0), ^{
        NSString *logs;
        if (self.selectedDate) {
            logs = [self.pulseVisionFailMeasurePath mustDiskSexDate:self.selectedDate];
        } else {
            logs = [self.pulseVisionFailMeasurePath tapsOnePair];
        }

        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 = blueQuarter.offsetsArabicLowercaseDegreePolicyEvaluated;
            }

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

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

- (void)writtenAction {
    [self queryPan];
}

- (void)updateTitle {
    if (self.selectedDate) {
        NSDateFormatter *disparity = [[NSDateFormatter alloc] init];
        disparity.dateFormat = blueQuarter.seedBeforeAwakeSockManagerSongWon;
        NSString *itsOurWire = [disparity stringFromDate:self.selectedDate];

        NSCalendar *calendar = [NSCalendar currentCalendar];
        if ([calendar isDateInToday:self.selectedDate]) {
            self.title = blueQuarter.alertSleetOpenSchemeDogMeter;
        } else if ([calendar isDateInYesterday:self.selectedDate]) {
            self.title = blueQuarter.reflectCollapseIndicatedVarianceEditCancelledAlphabet;
        } else {
            self.title = itsOurWire;
        }
    } else {
        self.title = blueQuarter.biometryEncodeSplitBoundingCrossSwap;
    }
}

- (void)nowCapsOptAction {
    if (!self.pulseVisionFailMeasurePath) {
        return;
    }

    NSArray<NSDate *> *affectedWidget = [self.pulseVisionFailMeasurePath lawObstacle];
    if (affectedWidget.count == 0) {
        UIAlertController *exist = [UIAlertController alertControllerWithTitle:blueQuarter.pagerHumanDensityRightSwitchAccurate
                                                                       message:blueQuarter.offsetsArabicLowercaseDegreePolicyEvaluated
                                                                preferredStyle:UIAlertControllerStyleAlert];
        [exist addAction:[UIAlertAction actionWithTitle:blueQuarter.occurLocatorDistantSharpenExpiredPipe style:UIAlertActionStyleDefault handler:nil]];
        [self presentViewController:exist animated:YES completion:nil];
        return;
    }

    UIAlertController *actionSheet = [UIAlertController alertControllerWithTitle:blueQuarter.pubForHangLocationsLevelFriendsBank
                                                                         message:nil
                                                                  preferredStyle:UIAlertControllerStyleActionSheet];

    [actionSheet addAction:[UIAlertAction actionWithTitle:blueQuarter.biometryEncodeSplitBoundingCrossSwap
                                                    style:UIAlertActionStyleDefault
                                                  handler:^(UIAlertAction *action) {
        self.selectedDate = nil;
        [self queryPan];
    }]];

    NSDateFormatter *disparity = [[NSDateFormatter alloc] init];
    disparity.dateFormat = blueQuarter.seedBeforeAwakeSockManagerSongWon;

    NSCalendar *calendar = [NSCalendar currentCalendar];

    for (NSDate *date in affectedWidget) {
        NSString *title;
        if ([calendar isDateInToday:date]) {
            title = blueQuarter.alertSleetOpenSchemeDogMeter;
        } else if ([calendar isDateInYesterday:date]) {
            title = blueQuarter.reflectCollapseIndicatedVarianceEditCancelledAlphabet;
        } else {
            title = [disparity stringFromDate:date];
        }

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

    [actionSheet addAction:[UIAlertAction actionWithTitle:blueQuarter.cellphoneDecoderTerminateTextSuchTags style:UIAlertActionStyleCancel handler:nil]];

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

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

- (void)dutchAction {
    if (!self.pulseVisionFailMeasurePath) {
        return;
    }

    NSArray *humanPut = [self.pulseVisionFailMeasurePath targetedTab];
    if (humanPut.count == 0) {
        UIAlertController *exist = [UIAlertController alertControllerWithTitle:blueQuarter.pagerHumanDensityRightSwitchAccurate
                                                                       message:blueQuarter.speechNoticeTapsExclusionConflictShe
                                                                preferredStyle:UIAlertControllerStyleAlert];
        [exist addAction:[UIAlertAction actionWithTitle:blueQuarter.occurLocatorDistantSharpenExpiredPipe style:UIAlertActionStyleDefault handler:nil]];
        [self presentViewController:exist animated:YES completion:nil];
        return;
    }

    UIAlertController *actionSheet = [UIAlertController alertControllerWithTitle:blueQuarter.buttonIndentEphemeralGregorianWorkflowMinRestored
                                                                         message:nil
                                                                  preferredStyle:UIAlertControllerStyleActionSheet];

    [actionSheet addAction:[UIAlertAction actionWithTitle:blueQuarter.heavyEventBagVolatileVarianceManClick
                                                    style:UIAlertActionStyleDefault
                                                  handler:^(UIAlertAction *action) {
        [self installsMill];
    }]];

    for (NSURL *fileURL in humanPut) {
        NSString *fileName = fileURL.lastPathComponent;
        [actionSheet addAction:[UIAlertAction actionWithTitle:[NSString stringWithFormat:blueQuarter.powerJustCircularRenderPressureTrackThickness, fileName]
                                                        style:UIAlertActionStyleDefault
                                                      handler:^(UIAlertAction *action) {
            [self borderedFile:fileURL];
        }]];
    }

    [actionSheet addAction:[UIAlertAction actionWithTitle:blueQuarter.cellphoneDecoderTerminateTextSuchTags style:UIAlertActionStyleCancel handler:nil]];

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

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

- (void)installsMill {
    dispatch_async(dispatch_get_global_queue(DISPATCH_QUEUE_PRIORITY_DEFAULT, 0), ^{
        
        NSString *optIron = [self.pulseVisionFailMeasurePath alongBuiltType];

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

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

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

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

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

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

@end
