

#import "StripViewController.h"
#import "Allow.h"
#import "TintRejectionCursorWayPrincipalAvail.h"
#import "OutlineLeaseSeparatorToneFree.h"
#import "PartnerPubConfig.h"

@interface StripViewController ()
@property (nonatomic, strong) UITextView *textView;
@property (nonatomic, strong) TintRejectionCursorWayPrincipalAvail *tildeRetAboveFootnotePolicy;
@property (nonatomic, strong) OutlineLeaseSeparatorToneFree *sigmaEntitledCircleStarCharacter;
@property (nonatomic, strong) NSDate *selectedDate; 
@end

static OutlineLeaseSeparatorToneFree *spokenSpineLeadLowCondensedChromium = nil;
static TintRejectionCursorWayPrincipalAvail *onceIcelandicReasonIronProducesBike = nil;

@implementation StripViewController

+ (void)passwordGet {
    
    [Allow valueChromaSharingExposureSlabOur];

    onceIcelandicReasonIronProducesBike = [[TintRejectionCursorWayPrincipalAvail alloc] init];
    onceIcelandicReasonIronProducesBike.optNotLevel = AdvancedMegabitsCellphoneNodeObserving;

    [Allow easyMetadataNineteenRealmAzimuth:onceIcelandicReasonIronProducesBike];

    spokenSpineLeadLowCondensedChromium = [[OutlineLeaseSeparatorToneFree alloc] init];
    spokenSpineLeadLowCondensedChromium.optNotLevel = PartiallyTied;
    spokenSpineLeadLowCondensedChromium.retHelp = 7;
    spokenSpineLeadLowCondensedChromium.outputBottomSinDrawColumn = YES;
    [Allow easyMetadataNineteenRealmAzimuth:spokenSpineLeadLowCondensedChromium];

    [spokenSpineLeadLowCondensedChromium alignmentCaret];
}

+ (OutlineLeaseSeparatorToneFree *)cookiesDarkDidExecutionCanAdd {
    return spokenSpineLeadLowCondensedChromium;
}
+ (TintRejectionCursorWayPrincipalAvail *)fiberHigherPinSeasonSawOrnament {
    return onceIcelandicReasonIronProducesBike;
}

- (TintRejectionCursorWayPrincipalAvail *)tildeRetAboveFootnotePolicy {
    return onceIcelandicReasonIronProducesBike;
}

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

- (void)viewDidLoad {
    [super viewDidLoad];

    self.title = queueIllSay.landmarkWelshEncryptHumanStretchMutation;
    self.view.backgroundColor = [UIColor systemBackgroundColor];

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

    self.navigationItem.rightBarButtonItems = @[
        [[UIBarButtonItem alloc] initWithBarButtonSystemItem:UIBarButtonSystemItemRefresh
                                                      target:self
                                                      action:@selector(enteredAction)],
        [[UIBarButtonItem alloc] initWithBarButtonSystemItem:UIBarButtonSystemItemAction
                                                      target:self
                                                      action:@selector(alphaAction)],
        [[UIBarButtonItem alloc] initWithBarButtonSystemItem:UIBarButtonSystemItemBookmarks
                                                      target:self
                                                      action:@selector(caseRadialAction)]
    ];
    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.sigmaEntitledCircleStarCharacter = [StripViewController cookiesDarkDidExecutionCanAdd];

    [self cloudDry];
}

- (void)cloudDry {
    if (!self.sigmaEntitledCircleStarCharacter) {
        _textView.text = queueIllSay.lingerMiddleReorderOrdinaryOddArranger;
        return;
    }

    dispatch_async(dispatch_get_global_queue(DISPATCH_QUEUE_PRIORITY_DEFAULT, 0), ^{
        NSString *logs;
        if (self.selectedDate) {
            logs = [self.sigmaEntitledCircleStarCharacter randomShapeDate:self.selectedDate];
        } else {
            logs = [self.sigmaEntitledCircleStarCharacter looseDayBig];
        }

        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 = queueIllSay.wirelessDenseOwnerNetscapeExposeUses;
            }

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

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

- (void)enteredAction {
    [self cloudDry];
}

- (void)updateTitle {
    if (self.selectedDate) {
        NSDateFormatter *continued = [[NSDateFormatter alloc] init];
        continued.dateFormat = queueIllSay.linearlyKnowPoloExemplarFloorScanAnalysis;
        NSString *vectorForm = [continued stringFromDate:self.selectedDate];

        NSCalendar *calendar = [NSCalendar currentCalendar];
        if ([calendar isDateInToday:self.selectedDate]) {
            self.title = queueIllSay.detectsVideoAbortedPaddleSwimmingAdverb;
        } else if ([calendar isDateInYesterday:self.selectedDate]) {
            self.title = queueIllSay.eraSomaliIndianDrivePurchasedAvailableRelative;
        } else {
            self.title = vectorForm;
        }
    } else {
        self.title = queueIllSay.cachePenUnorderedPageMutationGrandaunt;
    }
}

- (void)caseRadialAction {
    if (!self.sigmaEntitledCircleStarCharacter) {
        return;
    }

    NSArray<NSDate *> *gaelicLoveSkin = [self.sigmaEntitledCircleStarCharacter lowMightOdd];
    if (gaelicLoveSkin.count == 0) {
        UIAlertController *music = [UIAlertController alertControllerWithTitle:queueIllSay.expertInventoryRestTagDigitDeny
                                                                       message:queueIllSay.wirelessDenseOwnerNetscapeExposeUses
                                                                preferredStyle:UIAlertControllerStyleAlert];
        [music addAction:[UIAlertAction actionWithTitle:queueIllSay.smartPasteReloadTapsChecksumMatch style:UIAlertActionStyleDefault handler:nil]];
        [self presentViewController:music animated:YES completion:nil];
        return;
    }

    UIAlertController *actionSheet = [UIAlertController alertControllerWithTitle:queueIllSay.badgeEyeQuantizeFilenamesWeekendDrivenCap
                                                                         message:nil
                                                                  preferredStyle:UIAlertControllerStyleActionSheet];

    [actionSheet addAction:[UIAlertAction actionWithTitle:queueIllSay.cachePenUnorderedPageMutationGrandaunt
                                                    style:UIAlertActionStyleDefault
                                                  handler:^(UIAlertAction *action) {
        self.selectedDate = nil;
        [self cloudDry];
    }]];

    NSDateFormatter *continued = [[NSDateFormatter alloc] init];
    continued.dateFormat = queueIllSay.linearlyKnowPoloExemplarFloorScanAnalysis;

    NSCalendar *calendar = [NSCalendar currentCalendar];

    for (NSDate *date in gaelicLoveSkin) {
        NSString *title;
        if ([calendar isDateInToday:date]) {
            title = queueIllSay.detectsVideoAbortedPaddleSwimmingAdverb;
        } else if ([calendar isDateInYesterday:date]) {
            title = queueIllSay.eraSomaliIndianDrivePurchasedAvailableRelative;
        } else {
            title = [continued stringFromDate:date];
        }

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

    [actionSheet addAction:[UIAlertAction actionWithTitle:queueIllSay.resultingAttempterIntervalScannedEggPortrait style:UIAlertActionStyleCancel handler:nil]];

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

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

- (void)alphaAction {
    if (!self.sigmaEntitledCircleStarCharacter) {
        return;
    }

    NSArray *callFind = [self.sigmaEntitledCircleStarCharacter restOptical];
    if (callFind.count == 0) {
        UIAlertController *music = [UIAlertController alertControllerWithTitle:queueIllSay.expertInventoryRestTagDigitDeny
                                                                       message:queueIllSay.croatianComponentExecProposedPositionsStartup
                                                                preferredStyle:UIAlertControllerStyleAlert];
        [music addAction:[UIAlertAction actionWithTitle:queueIllSay.smartPasteReloadTapsChecksumMatch style:UIAlertActionStyleDefault handler:nil]];
        [self presentViewController:music animated:YES completion:nil];
        return;
    }

    UIAlertController *actionSheet = [UIAlertController alertControllerWithTitle:queueIllSay.rootBagRowProfilesJabberOverflowPlug
                                                                         message:nil
                                                                  preferredStyle:UIAlertControllerStyleActionSheet];

    [actionSheet addAction:[UIAlertAction actionWithTitle:queueIllSay.bracketNotifiedIndianAnchorsPetiteAnimatingMiter
                                                    style:UIAlertActionStyleDefault
                                                  handler:^(UIAlertAction *action) {
        [self closeDidPool];
    }]];

    for (NSURL *fileURL in callFind) {
        NSString *fileName = fileURL.lastPathComponent;
        [actionSheet addAction:[UIAlertAction actionWithTitle:[NSString stringWithFormat:queueIllSay.revisionsEraWaySettingFloaterReceiptFlight, fileName]
                                                        style:UIAlertActionStyleDefault
                                                      handler:^(UIAlertAction *action) {
            [self sockRowsFile:fileURL];
        }]];
    }

    [actionSheet addAction:[UIAlertAction actionWithTitle:queueIllSay.resultingAttempterIntervalScannedEggPortrait style:UIAlertActionStyleCancel handler:nil]];

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

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

- (void)closeDidPool {
    dispatch_async(dispatch_get_global_queue(DISPATCH_QUEUE_PRIORITY_DEFAULT, 0), ^{
        
        NSString *archive = [self.sigmaEntitledCircleStarCharacter configureLearn];

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

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

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

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

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

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

@end
