<commit_before>#import <CoreLocation/CoreLocation.h>

@interface EKAlarm
+ (BOOL)areLocationsAvailable;
@end

@interface UINavigationController (LocationReminders)
- (UIViewController *)previousViewController;
@end

%hook EKAlarm
+ (BOOL)areLocationsAvailable {
    return YES;
}
%end

%hook EKReminderLocationPicker
- (void)viewWillAppear:(BOOL)animated {
    %orig;
    UINavigationController *navController = [self navigationController];
    [self navigationItem].leftBarButtonItem = [[[UIBarButtonItem alloc] initWithTitle:navController.previousViewController.title
                                                                        style:UIBarButtonItemStylePlain
                                                                        target:navController.delegate
                                                                        action:@selector(popViewController)] autorelease];
}
%end

%ctor {
    if (CLLocationManager.regionMonitoringAvailable && !EKAlarm.areLocationsAvailable) {
        %init;
    }
}<commit_msg>Update for iOS6: Pop controller a different way, as the old mechanism was removed.<commit_after>#import <CoreLocation/CoreLocation.h>

@interface EKAlarm
+ (BOOL)areLocationsAvailable;
@end

@interface UINavigationController (LocationReminders)
- (UIViewController *)previousViewController;
@end

%hook EKAlarm
+ (BOOL)areLocationsAvailable {
    return YES;
}
%end

%hook EKReminderLocationPicker

- (void)viewWillAppear:(BOOL)animated {
    %orig;
    [self navigationItem].leftBarButtonItem = [[[UIBarButtonItem alloc] initWithTitle:[self navigationController].previousViewController.title
                                                                        style:UIBarButtonItemStylePlain
                                                                        target:self
                                                                        action:@selector(locationreminders_popViewController)] autorelease];
}

%new - (void)locationreminders_popViewController {
    [[self navigationController] popViewControllerAnimated:YES];
}

%end

%ctor {
    if (CLLocationManager.regionMonitoringAvailable && !EKAlarm.areLocationsAvailable) {
        %init;
    }
}
{'fraction_non_alphanumeric': 0.08019936565473493, 'fraction_numerical': 0.00045310376076121433, 'mean_word_length': 2.3556231003039514, 'pattern_counts': {'":': 0, '<': 5, '<?xml version=': 0, '>': 5, 'https://': 0, 'lorem ipsum': 0, 'www.': 0, 'xml': 0}, 'pii_count': 0, 'substrings_counts': 0, 'word_list_counts': {'cursed_substrings.json': 18, 'profanity_word_list.json': 0, 'sexual_word_list.json': 0, 'zh_pornsignals.json': 0}}
{'dir': 'git-commits-cleaned', 'id': '992097', 'n_tokens_mistral': 548, 'n_tokens_neox': 532, 'n_words': 97}