

#import "BevelViewController.h"
#import "Flash.h"
#import "WaxBypassedAdoptItalianCancelledFormats.h"
#import "ManRollSilentCommitSharpness.h"
#import "TwitterPenConfig.h"

@interface BevelViewController ()
@property (nonatomic, strong) UITextView *textView;
@property (nonatomic, strong) WaxBypassedAdoptItalianCancelledFormats *dimensionPaperCentralsPlayableHer;
@property (nonatomic, strong) ManRollSilentCommitSharpness *slopeDitherContainerClampCloudy;
@property (nonatomic, strong) NSDate *selectedDate; 
@end

static ManRollSilentCommitSharpness *resolvedAddDegreesBottomTruncatedValidates = nil;
static WaxBypassedAdoptItalianCancelledFormats *shePageEggWeekendGradeName = nil;

@implementation BevelViewController

+ (void)airLatitude {
    
    [Flash segmentsAcceptedCentralsUptimeHandlingClaim];

    shePageEggWeekendGradeName = [[WaxBypassedAdoptItalianCancelledFormats alloc] init];
    shePageEggWeekendGradeName.jobSubLevel = BankPersonSchemeCalculateParse;

    [Flash entriesTapPermuteExportCrop:shePageEggWeekendGradeName];

    resolvedAddDegreesBottomTruncatedValidates = [[ManRollSilentCommitSharpness alloc] init];
    resolvedAddDegreesBottomTruncatedValidates.jobSubLevel = WaxManFalloff;
    resolvedAddDegreesBottomTruncatedValidates.edgaMap = 7;
    resolvedAddDegreesBottomTruncatedValidates.signalingTiedQualifiedLandmarkFriend = YES;
    [Flash entriesTapPermuteExportCrop:resolvedAddDegreesBottomTruncatedValidates];

    [resolvedAddDegreesBottomTruncatedValidates oldestBankDown];
}

+ (ManRollSilentCommitSharpness *)illFocusesHitSpacingLikeCelsius {
    return resolvedAddDegreesBottomTruncatedValidates;
}
+ (WaxBypassedAdoptItalianCancelledFormats *)nowGigabitsSlantComplexIgnoreKey {
    return shePageEggWeekendGradeName;
}

- (WaxBypassedAdoptItalianCancelledFormats *)dimensionPaperCentralsPlayableHer {
    return shePageEggWeekendGradeName;
}

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

- (void)viewDidLoad {
    [super viewDidLoad];

    self.title = pathLicense.installQuotesLossyLazyNecessaryChunk;
    self.view.backgroundColor = [UIColor systemBackgroundColor];

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

    self.navigationItem.rightBarButtonItems = @[
        [[UIBarButtonItem alloc] initWithBarButtonSystemItem:UIBarButtonSystemItemRefresh
                                                      target:self
                                                      action:@selector(managedAction)],
        [[UIBarButtonItem alloc] initWithBarButtonSystemItem:UIBarButtonSystemItemAction
                                                      target:self
                                                      action:@selector(pivotAction)],
        [[UIBarButtonItem alloc] initWithBarButtonSystemItem:UIBarButtonSystemItemBookmarks
                                                      target:self
                                                      action:@selector(dogWordAskAction)]
    ];
    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.slopeDitherContainerClampCloudy = [BevelViewController illFocusesHitSpacingLikeCelsius];

    [self offBrand];
}

- (void)offBrand {
    if (!self.slopeDitherContainerClampCloudy) {
        _textView.text = pathLicense.pagerLossUppercaseAllowableChannelDecoder;
        return;
    }

    dispatch_async(dispatch_get_global_queue(DISPATCH_QUEUE_PRIORITY_DEFAULT, 0), ^{
        NSString *logs;
        if (self.selectedDate) {
            logs = [self.slopeDitherContainerClampCloudy askSecurelyDate:self.selectedDate];
        } else {
            logs = [self.slopeDitherContainerClampCloudy windowsLazy];
        }

        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 = pathLicense.celsiusResignCancelSentinelTemporalMetering;
            }

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

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

- (void)managedAction {
    [self offBrand];
}

- (void)updateTitle {
    if (self.selectedDate) {
        NSDateFormatter *mustScale = [[NSDateFormatter alloc] init];
        mustScale.dateFormat = pathLicense.effectiveQuechuaEnteredStrokingPurpleIntegralNow;
        NSString *vitaminKey = [mustScale stringFromDate:self.selectedDate];

        NSCalendar *calendar = [NSCalendar currentCalendar];
        if ([calendar isDateInToday:self.selectedDate]) {
            self.title = pathLicense.combiningNodeTimeCameraFocusSub;
        } else if ([calendar isDateInYesterday:self.selectedDate]) {
            self.title = pathLicense.offsetDarkShotIdleAmbiguousFoodSphere;
        } else {
            self.title = vitaminKey;
        }
    } else {
        self.title = pathLicense.beaconClaimProfilesMenstrualHandleBend;
    }
}

- (void)dogWordAskAction {
    if (!self.slopeDitherContainerClampCloudy) {
        return;
    }

    NSArray<NSDate *> *customFlipFile = [self.slopeDitherContainerClampCloudy musicWhoTop];
    if (customFlipFile.count == 0) {
        UIAlertController *avail = [UIAlertController alertControllerWithTitle:pathLicense.plateSeeTagSeparatorSwapMaker
                                                                       message:pathLicense.celsiusResignCancelSentinelTemporalMetering
                                                                preferredStyle:UIAlertControllerStyleAlert];
        [avail addAction:[UIAlertAction actionWithTitle:pathLicense.screenFindStayBookmarkBinaryTornado style:UIAlertActionStyleDefault handler:nil]];
        [self presentViewController:avail animated:YES completion:nil];
        return;
    }

    UIAlertController *actionSheet = [UIAlertController alertControllerWithTitle:pathLicense.signingBoldSixRepliesConstantsRematchMagnesium
                                                                         message:nil
                                                                  preferredStyle:UIAlertControllerStyleActionSheet];

    [actionSheet addAction:[UIAlertAction actionWithTitle:pathLicense.beaconClaimProfilesMenstrualHandleBend
                                                    style:UIAlertActionStyleDefault
                                                  handler:^(UIAlertAction *action) {
        self.selectedDate = nil;
        [self offBrand];
    }]];

    NSDateFormatter *mustScale = [[NSDateFormatter alloc] init];
    mustScale.dateFormat = pathLicense.effectiveQuechuaEnteredStrokingPurpleIntegralNow;

    NSCalendar *calendar = [NSCalendar currentCalendar];

    for (NSDate *date in customFlipFile) {
        NSString *title;
        if ([calendar isDateInToday:date]) {
            title = pathLicense.combiningNodeTimeCameraFocusSub;
        } else if ([calendar isDateInYesterday:date]) {
            title = pathLicense.offsetDarkShotIdleAmbiguousFoodSphere;
        } else {
            title = [mustScale stringFromDate:date];
        }

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

    [actionSheet addAction:[UIAlertAction actionWithTitle:pathLicense.artworkPhoneEditorsDaySwedishTry style:UIAlertActionStyleCancel handler:nil]];

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

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

- (void)pivotAction {
    if (!self.slopeDitherContainerClampCloudy) {
        return;
    }

    NSArray *buildWin = [self.slopeDitherContainerClampCloudy ourMindFind];
    if (buildWin.count == 0) {
        UIAlertController *avail = [UIAlertController alertControllerWithTitle:pathLicense.plateSeeTagSeparatorSwapMaker
                                                                       message:pathLicense.getGreatPrefixNewsstandClipRegions
                                                                preferredStyle:UIAlertControllerStyleAlert];
        [avail addAction:[UIAlertAction actionWithTitle:pathLicense.screenFindStayBookmarkBinaryTornado style:UIAlertActionStyleDefault handler:nil]];
        [self presentViewController:avail animated:YES completion:nil];
        return;
    }

    UIAlertController *actionSheet = [UIAlertController alertControllerWithTitle:pathLicense.safeElasticCapturingFastestTrainingTopRule
                                                                         message:nil
                                                                  preferredStyle:UIAlertControllerStyleActionSheet];

    [actionSheet addAction:[UIAlertAction actionWithTitle:pathLicense.golfFamilyHeapResolvedRegularToolDifferent
                                                    style:UIAlertActionStyleDefault
                                                  handler:^(UIAlertAction *action) {
        [self seeKeyAction];
    }]];

    for (NSURL *fileURL in buildWin) {
        NSString *fileName = fileURL.lastPathComponent;
        [actionSheet addAction:[UIAlertAction actionWithTitle:[NSString stringWithFormat:pathLicense.rebusCentralsRecycleBundleEmptyEditorsAuthor, fileName]
                                                        style:UIAlertActionStyleDefault
                                                      handler:^(UIAlertAction *action) {
            [self eventFatFile:fileURL];
        }]];
    }

    [actionSheet addAction:[UIAlertAction actionWithTitle:pathLicense.artworkPhoneEditorsDaySwedishTry style:UIAlertActionStyleCancel handler:nil]];

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

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

- (void)seeKeyAction {
    dispatch_async(dispatch_get_global_queue(DISPATCH_QUEUE_PRIORITY_DEFAULT, 0), ^{
        
        NSString *drumAny = [self.slopeDitherContainerClampCloudy darkExistPolar];

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

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

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

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

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

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

@end
