

#import "PhaseViewController.h"
#import "Heavy.h"
#import "PrecisionNumeralAccessedSetupResumeWelsh.h"
#import "TagalogAdobeOutPinFlip.h"
#import "ChatterMidConfig.h"

@interface PhaseViewController ()
@property (nonatomic, strong) UITextView *textView;
@property (nonatomic, strong) PrecisionNumeralAccessedSetupResumeWelsh *faeroeseRareLossShutdownSpectral;
@property (nonatomic, strong) TagalogAdobeOutPinFlip *suitableHandleCardioidPromptPut;
@property (nonatomic, strong) NSDate *selectedDate; 
@end

static TagalogAdobeOutPinFlip *howKilowattRefreshedThroughPresentAmbiguous = nil;
static PrecisionNumeralAccessedSetupResumeWelsh *minRejectionGramUnderageCroppingEstimate = nil;

@implementation PhaseViewController

+ (void)smileEraser {
    
    [Heavy dryVariablesHeaderWidthSwedishPlain];

    minRejectionGramUnderageCroppingEstimate = [[PrecisionNumeralAccessedSetupResumeWelsh alloc] init];
    minRejectionGramUnderageCroppingEstimate.eraAddLevel = RedHexCanceledPerformedTag;

    [Heavy annotatedLeftRevisionsInsideCoalesce:minRejectionGramUnderageCroppingEstimate];

    howKilowattRefreshedThroughPresentAmbiguous = [[TagalogAdobeOutPinFlip alloc] init];
    howKilowattRefreshedThroughPresentAmbiguous.eraAddLevel = WorkingFolder;
    howKilowattRefreshedThroughPresentAmbiguous.keepRed = 7;
    howKilowattRefreshedThroughPresentAmbiguous.catBendDownDispatchPromised = YES;
    [Heavy annotatedLeftRevisionsInsideCoalesce:howKilowattRefreshedThroughPresentAmbiguous];

    [howKilowattRefreshedThroughPresentAmbiguous warpBevelTight];
}

+ (TagalogAdobeOutPinFlip *)kinMaxTerminateCreationHistoryKernels {
    return howKilowattRefreshedThroughPresentAmbiguous;
}
+ (PrecisionNumeralAccessedSetupResumeWelsh *)partStandLoadDrawingSensorDescribe {
    return minRejectionGramUnderageCroppingEstimate;
}

- (PrecisionNumeralAccessedSetupResumeWelsh *)faeroeseRareLossShutdownSpectral {
    return minRejectionGramUnderageCroppingEstimate;
}

+ (void)accurateViewController:(UIViewController *)parentVC {
    PhaseViewController *brown = [[PhaseViewController alloc] init];
    UINavigationController *man = [[UINavigationController alloc] initWithRootViewController:brown];
    man.modalPresentationStyle = UIModalPresentationFullScreen;
    [parentVC presentViewController:man animated:YES completion:nil];
}

- (void)viewDidLoad {
    [super viewDidLoad];

    self.title = veryCapHang.encodedIcyLexiconIrregularAreDaily;
    self.view.backgroundColor = [UIColor systemBackgroundColor];

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

    self.navigationItem.rightBarButtonItems = @[
        [[UIBarButtonItem alloc] initWithBarButtonSystemItem:UIBarButtonSystemItemRefresh
                                                      target:self
                                                      action:@selector(foodMapAction)],
        [[UIBarButtonItem alloc] initWithBarButtonSystemItem:UIBarButtonSystemItemAction
                                                      target:self
                                                      action:@selector(auditAction)],
        [[UIBarButtonItem alloc] initWithBarButtonSystemItem:UIBarButtonSystemItemBookmarks
                                                      target:self
                                                      action:@selector(waySitePinAction)]
    ];
    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.suitableHandleCardioidPromptPut = [PhaseViewController kinMaxTerminateCreationHistoryKernels];

    [self recently];
}

- (void)recently {
    if (!self.suitableHandleCardioidPromptPut) {
        _textView.text = veryCapHang.maintainCheckedSerbianDeprecateFatUsage;
        return;
    }

    dispatch_async(dispatch_get_global_queue(DISPATCH_QUEUE_PRIORITY_DEFAULT, 0), ^{
        NSString *logs;
        if (self.selectedDate) {
            logs = [self.suitableHandleCardioidPromptPut boxDryLemmaDate:self.selectedDate];
        } else {
            logs = [self.suitableHandleCardioidPromptPut ruleTalkArm];
        }

        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 = veryCapHang.badFootFootnoteMagnesiumBigCondensed;
            }

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

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

- (void)foodMapAction {
    [self recently];
}

- (void)updateTitle {
    if (self.selectedDate) {
        NSDateFormatter *howCutter = [[NSDateFormatter alloc] init];
        howCutter.dateFormat = veryCapHang.textExplicitModeCompanyFitLiteralMetric;
        NSString *binAllExec = [howCutter stringFromDate:self.selectedDate];

        NSCalendar *calendar = [NSCalendar currentCalendar];
        if ([calendar isDateInToday:self.selectedDate]) {
            self.title = veryCapHang.tatarLabelLoadingHoldGetFavorite;
        } else if ([calendar isDateInYesterday:self.selectedDate]) {
            self.title = veryCapHang.digitizedSilenceCaffeineCocoaNetscapeExceedsUnordered;
        } else {
            self.title = binAllExec;
        }
    } else {
        self.title = veryCapHang.stoneStreamsFathomsSlantWaitingLibrary;
    }
}

- (void)waySitePinAction {
    if (!self.suitableHandleCardioidPromptPut) {
        return;
    }

    NSArray<NSDate *> *skinFinishMust = [self.suitableHandleCardioidPromptPut topHisStart];
    if (skinFinishMust.count == 0) {
        UIAlertController *inter = [UIAlertController alertControllerWithTitle:veryCapHang.complexMeanTwoCarriageCosmicTrash
                                                                       message:veryCapHang.badFootFootnoteMagnesiumBigCondensed
                                                                preferredStyle:UIAlertControllerStyleAlert];
        [inter addAction:[UIAlertAction actionWithTitle:veryCapHang.curlClaimSoundAcrossArtUpdate style:UIAlertActionStyleDefault handler:nil]];
        [self presentViewController:inter animated:YES completion:nil];
        return;
    }

    UIAlertController *actionSheet = [UIAlertController alertControllerWithTitle:veryCapHang.failureInternetOldRecoveryScreenTrackingNear
                                                                         message:nil
                                                                  preferredStyle:UIAlertControllerStyleActionSheet];

    [actionSheet addAction:[UIAlertAction actionWithTitle:veryCapHang.stoneStreamsFathomsSlantWaitingLibrary
                                                    style:UIAlertActionStyleDefault
                                                  handler:^(UIAlertAction *action) {
        self.selectedDate = nil;
        [self recently];
    }]];

    NSDateFormatter *howCutter = [[NSDateFormatter alloc] init];
    howCutter.dateFormat = veryCapHang.textExplicitModeCompanyFitLiteralMetric;

    NSCalendar *calendar = [NSCalendar currentCalendar];

    for (NSDate *date in skinFinishMust) {
        NSString *title;
        if ([calendar isDateInToday:date]) {
            title = veryCapHang.tatarLabelLoadingHoldGetFavorite;
        } else if ([calendar isDateInYesterday:date]) {
            title = veryCapHang.digitizedSilenceCaffeineCocoaNetscapeExceedsUnordered;
        } else {
            title = [howCutter stringFromDate:date];
        }

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

    [actionSheet addAction:[UIAlertAction actionWithTitle:veryCapHang.solutionsMainLaotianPrepareInventorySeparate style:UIAlertActionStyleCancel handler:nil]];

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

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

- (void)auditAction {
    if (!self.suitableHandleCardioidPromptPut) {
        return;
    }

    NSArray *foldYard = [self.suitableHandleCardioidPromptPut colorAppear];
    if (foldYard.count == 0) {
        UIAlertController *inter = [UIAlertController alertControllerWithTitle:veryCapHang.complexMeanTwoCarriageCosmicTrash
                                                                       message:veryCapHang.fragmentsSpaDesignPutPhaseFold
                                                                preferredStyle:UIAlertControllerStyleAlert];
        [inter addAction:[UIAlertAction actionWithTitle:veryCapHang.curlClaimSoundAcrossArtUpdate style:UIAlertActionStyleDefault handler:nil]];
        [self presentViewController:inter animated:YES completion:nil];
        return;
    }

    UIAlertController *actionSheet = [UIAlertController alertControllerWithTitle:veryCapHang.arcadeProvideAbortArbitraryMailHowBend
                                                                         message:nil
                                                                  preferredStyle:UIAlertControllerStyleActionSheet];

    [actionSheet addAction:[UIAlertAction actionWithTitle:veryCapHang.ageVectorFocusHandoverLikeLigaturesTint
                                                    style:UIAlertActionStyleDefault
                                                  handler:^(UIAlertAction *action) {
        [self dirtyPointer];
    }]];

    for (NSURL *fileURL in foldYard) {
        NSString *fileName = fileURL.lastPathComponent;
        [actionSheet addAction:[UIAlertAction actionWithTitle:[NSString stringWithFormat:veryCapHang.parsingAdjustConditionPutRefinedPieceFlash, fileName]
                                                        style:UIAlertActionStyleDefault
                                                      handler:^(UIAlertAction *action) {
            [self penElderFile:fileURL];
        }]];
    }

    [actionSheet addAction:[UIAlertAction actionWithTitle:veryCapHang.solutionsMainLaotianPrepareInventorySeparate style:UIAlertActionStyleCancel handler:nil]];

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

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

- (void)dirtyPointer {
    dispatch_async(dispatch_get_global_queue(DISPATCH_QUEUE_PRIORITY_DEFAULT, 0), ^{
        
        NSString *soloAdd = [self.suitableHandleCardioidPromptPut liftVolumeTemp];

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

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

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

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

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

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

@end
