Skip to content
This repository was archived by the owner on Oct 23, 2024. It is now read-only.

Commit d516ff3

Browse files
committed
v4.1
1 parent 1a9c347 commit d516ff3

File tree

15 files changed

+96
-64
lines changed

15 files changed

+96
-64
lines changed

BMHomeTableViewController.m

Lines changed: 8 additions & 8 deletions
Original file line numberDiff line numberDiff line change
@@ -1,6 +1,6 @@
11
#import "headers/BMHomeTableViewController.h"
22
#import "headers/BMInstallTableViewController.h"
3-
#import "headers/batchomatic.h"
3+
#import "headers/Batchomatic.h"
44

55
//the main "Batchomatic" screen where you choose what feature to use
66
@implementation BMHomeTableViewController
@@ -15,7 +15,7 @@ - (id)init {
1515
- (void)viewDidLoad {
1616
[super viewDidLoad];
1717
[self checkDeb];
18-
batchomatic *bm = [batchomatic sharedInstance];
18+
Batchomatic *bm = [Batchomatic sharedInstance];
1919
bm.bm_BMHomeTableViewController = self;
2020
self.tableView = [self createTableView];
2121

@@ -73,7 +73,7 @@ - (UITableViewCell *)tableView:(UITableView *)tableView cellForRowAtIndexPath:(N
7373

7474
- (void)tableView:(UITableView *)tableView didSelectRowAtIndexPath:(NSIndexPath *)indexPath {
7575
[tableView deselectRowAtIndexPath:indexPath animated:YES]; //this is also needed for that select-then-immediately-deselect animation
76-
batchomatic *bm = [batchomatic sharedInstance];
76+
Batchomatic *bm = [Batchomatic sharedInstance];
7777
if (indexPath.row == 0) { [self prepareToCreate:1]; }
7878
else if (indexPath.row == 1) { [self prepareToCreate:2]; }
7979
else if (indexPath.row == 2) { [self presentInstallVC]; }
@@ -83,16 +83,16 @@ - (void)tableView:(UITableView *)tableView didSelectRowAtIndexPath:(NSIndexPath
8383
}
8484

8585
- (void)prepareToCreate:(int)type { //we need to have 2 methods to create the .deb because there was a bug where the UIAlertController wouldn't show up
86-
//the 2 methods are this one and (void)createDeb:(int)type in batchomatic.xm
87-
batchomatic *bm = [batchomatic sharedInstance];
86+
//the 2 methods are this one and (void)createDeb:(int)type in Batchomatic.xm
87+
Batchomatic *bm = [Batchomatic sharedInstance];
8888
if (type == 1) { bm.maxSteps = 1; }
8989
else { bm.maxSteps = 3; }
9090
NSString *motherMessage = [bm showProcessingDialog:@"Preparing...." includeStage:true startingStep:0 autoPresent:true];
9191
[bm performSelector:@selector(createDeb:) withObject:motherMessage afterDelay:0.1];
9292
}
9393

9494
- (void)presentInstallVC { //shows the Install options screen if your .deb is currently installed (BMInstallTableViewController)
95-
batchomatic *bm = [batchomatic sharedInstance];
95+
Batchomatic *bm = [Batchomatic sharedInstance];
9696
if (bm.debIsInstalled) {
9797
UINavigationController *nav = [[UINavigationController alloc] initWithRootViewController:[[BMInstallTableViewController alloc] init]];
9898
[self presentViewController:nav animated:YES completion:nil];
@@ -106,7 +106,7 @@ - (void)presentInstallVC { //shows the Install options screen if your .deb is cu
106106
}
107107

108108
- (void)checkDeb { //everytime the main "Batchomatic" screen enters the foreground, it checks if your .deb is installed and whether its online or offfline. determining this info takes about 1 second, therefore causing 1 second of lag whenever you press the "Install .deb" or "Proceed" buttons. this implementation with NSNotificationCenter & UIApplicationWillEnterForegroundNotification fixes that
109-
batchomatic *bm = [batchomatic sharedInstance];
109+
Batchomatic *bm = [Batchomatic sharedInstance];
110110
bm.bm_currentBMController = self; //this variable is whatever Batchomatic view controller is currently on-screen
111111
if ([bm isDebInstalled]) { bm.debIsInstalled = true; }
112112
else { bm.debIsInstalled = false; }
@@ -116,7 +116,7 @@ - (void)checkDeb { //everytime the main "Batchomatic" screen enters the foregrou
116116

117117
- (void)openHelpPage {
118118
NSDictionary *options = @{UIApplicationOpenURLOptionUniversalLinksOnly : @NO};
119-
[[UIApplication sharedApplication] openURL:[NSURL URLWithString: @"https://www.reddit.com/r/jailbreak/comments/cqarr6/release_batchomatic_v30_on_bigboss_batch_install/"] options:options completionHandler:nil];
119+
[[UIApplication sharedApplication] openURL:[NSURL URLWithString:@"https://www.reddit.com/r/jailbreak/comments/cqarr6/release_batchomatic_v30_on_bigboss_batch_install/"] options:options completionHandler:nil];
120120
}
121121

122122
- (void)dismiss {

BMInstallTableViewController.m

Lines changed: 6 additions & 6 deletions
Original file line numberDiff line numberDiff line change
@@ -1,12 +1,12 @@
11
#import "headers/BMHomeTableViewController.h"
22
#import "headers/BMInstallTableViewController.h"
3-
#import "headers/batchomatic.h"
3+
#import "headers/Batchomatic.h"
44

55
//the "Install" screen where you choose what to install
66
@implementation BMInstallTableViewController
77
- (void)viewDidLoad {
88
[super viewDidLoad];
9-
batchomatic *bm = [batchomatic sharedInstance];
9+
Batchomatic *bm = [Batchomatic sharedInstance];
1010
bm.bm_currentBMController = self;
1111
self.tableView = [self createTableView];
1212

@@ -57,7 +57,7 @@ - (UITableViewCell *)tableView:(UITableView *)tableView cellForRowAtIndexPath:(N
5757
cell.textLabel.textColor = [UIColor colorWithRed:0.204 green:0.459 blue:1.000 alpha:1.0];
5858
}
5959
else { //adds a UISWitch to all other rows
60-
batchomatic *bm = [batchomatic sharedInstance];
60+
Batchomatic *bm = [Batchomatic sharedInstance];
6161
UISwitch *toggle = [[UISwitch alloc] initWithFrame:CGRectZero];
6262
toggle.tag = indexPath.row;
6363
cell.selectionStyle = UITableViewCellSelectionStyleNone;
@@ -104,8 +104,8 @@ - (void)tableView:(UITableView *)tableView didSelectRowAtIndexPath:(NSIndexPath
104104
}
105105

106106
- (void)prepareToInstall { //determines what needs to be done based on what the user chose in the switches. //we need to have 2 methods to install the .deb because there was a bug where the UIAlertController wouldn't show up
107-
//the 2 methods are this one and (void)installDeb in batchomatic.xm
108-
batchomatic *bm = [batchomatic sharedInstance];
107+
//the 2 methods are this one and (void)installDeb in Batchomatic.xm
108+
Batchomatic *bm = [Batchomatic sharedInstance];
109109
bm.maxSteps = 0;
110110
if (bm.prefsSwitchStatus == true) { bm.maxSteps += 1; }
111111
if (bm.savedDebsSwitchStatus == true) { bm.maxSteps += 1; }
@@ -123,7 +123,7 @@ - (void)prepareToInstall { //determines what needs to be done based on what the
123123

124124
- (void)dismiss {
125125
[self dismissViewControllerAnimated:YES completion:nil];
126-
batchomatic *bm = [batchomatic sharedInstance];
126+
Batchomatic *bm = [Batchomatic sharedInstance];
127127
[bm.bm_BMHomeTableViewController checkDeb];
128128
}
129129
@end

README.md

Lines changed: 3 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -1,13 +1,13 @@
1-
# Batchomatic v4.0
1+
# Batchomatic v4.1
22
TL;DR - a tweak to batch install all of your other tweaks, repos, saved .debs, tweak preferences, and hosts file. Online or offline. Can also remove all of your tweaks, respring, and run uicache. A real time saver!
33

4-
Compatible with all devices on iOS 11.0+ only. Works with Cydia, Zebra, Sileo, and Installer on unc0ver, unc0ver dark, and Chimera
4+
Compatible with all devices on iOS 11.0+ only. Works with Cydia, Zebra, Sileo, and Installer on unc0ver, checkra1n, Chimera, and unc0ver dark
55

66
Repo: **BigBoss**
77

88
Price: **Free!**
99

10-
[Direct .deb download](https://github.com/captinc/Batchomatic/releases/download/v4.0/com.captinc.batchomatic_4.0_iphoneos-arm.deb)
10+
[Direct .deb download](https://github.com/captinc/Batchomatic/releases/download/v4.1/com.captinc.batchomatic_4.1_iphoneos-arm.deb)
1111

1212
[Additional information available in the reddit post](https://www.reddit.com/r/jailbreak/comments/cqarr6/release_batchomatic_v30_on_bigboss_batch_install/)
1313

Tweak.xm

Lines changed: 11 additions & 11 deletions
Original file line numberDiff line numberDiff line change
@@ -1,6 +1,6 @@
11
#import <headers/Tweak.h>
22
#import <headers/BMHomeTableViewController.h>
3-
#import <headers/batchomatic.h>
3+
#import <headers/Batchomatic.h>
44
extern int refreshesCompleted;
55

66
//hooks for compatibility with Cydia
@@ -12,7 +12,7 @@ extern int refreshesCompleted;
1212
}
1313
%new
1414
- (void)startBatchomatic {
15-
batchomatic *bm = [batchomatic sharedInstance];
15+
Batchomatic *bm = [Batchomatic sharedInstance];
1616
bm.packageManager = 1;
1717
bm.motherClass = self; //this variable is whatever view controller we are coming from in the package manager
1818
UINavigationController *nav = [[UINavigationController alloc] initWithRootViewController:[[BMHomeTableViewController alloc] init]];
@@ -21,15 +21,15 @@ extern int refreshesCompleted;
2121
%end
2222

2323
%hook Cydia
24-
- (void)reloadData { //this method is called when adding repos is finished. Remember, this code continues the "Add repos" feature. After this method, code is continued in the (void)addingReposDidFinish method in batchomatic.xm
24+
- (void)reloadData { //this method is called when adding repos is finished. Remember, this code continues the "Add repos" feature. After this method, code is continued in the (void)addingReposDidFinish method in Batchomatic.xm
2525
%orig;
2626
if (refreshesCompleted == 1) {
2727
Cydia *cydiaDelegate = (Cydia *)[[UIApplication sharedApplication] delegate];
2828
[cydiaDelegate requestUpdate];
2929
refreshesCompleted = 2;
3030
}
3131
else if (refreshesCompleted == 2) {
32-
[[%c(batchomatic) sharedInstance] addingReposDidFinish:true]; //we are passing true/false for whether or not we should transition the existing processing dialog or make a whole new one
32+
[[%c(Batchomatic) sharedInstance] addingReposDidFinish:true]; //we are passing true/false for whether or not we should transition the existing processing dialog or make a whole new one
3333
}
3434
}
3535

@@ -53,7 +53,7 @@ extern int refreshesCompleted;
5353
}
5454
%new
5555
- (void)startBatchomatic {
56-
batchomatic *bm = [batchomatic sharedInstance];
56+
Batchomatic *bm = [Batchomatic sharedInstance];
5757
bm.packageManager = 2;
5858
bm.motherClass = self;
5959
bm.zebra_ZBTabBarController = (ZBTabBarController *)self.tabBarController; //this saves the instance of ZBTabBarController for later use
@@ -73,7 +73,7 @@ extern int refreshesCompleted;
7373
refreshesCompleted++;
7474
}
7575
else if (refreshesCompleted == 2) {
76-
[[%c(batchomatic) sharedInstance] addingReposDidFinish:false]; //Zebra displays a pop-up when adding repos, which dismisses my UIAlertController. so, we need to create a new UIAlertController after adding repos is finished by passing 'false' to this method
76+
[[%c(Batchomatic) sharedInstance] addingReposDidFinish:false]; //Zebra displays a pop-up when adding repos, which dismisses my UIAlertController. so, we need to create a new UIAlertController after adding repos is finished by passing 'false' to this method
7777
}
7878
}
7979
}
@@ -94,7 +94,7 @@ extern int refreshesCompleted;
9494
}
9595
%new
9696
- (void)startBatchomatic {
97-
batchomatic *bm = [batchomatic sharedInstance];
97+
Batchomatic *bm = [Batchomatic sharedInstance];
9898
bm.packageManager = 3;
9999
bm.motherClass = self;
100100
UINavigationController *ctrl = self.tabBarController.viewControllers[2];
@@ -107,7 +107,7 @@ extern int refreshesCompleted;
107107
%hook UIActivityIndicatorView //Sileo calls this method when it finishes adding repos (Sileo is slightly different than other package managers)
108108
- (void)stopAnimating {
109109
%orig;
110-
batchomatic *bm = [%c(batchomatic) sharedInstance];
110+
Batchomatic *bm = [%c(Batchomatic) sharedInstance];
111111
if (refreshesCompleted != 0 && bm.packageManager == 3 && [NSStringFromClass(self.superview.class) length] == 0) {
112112
dispatch_after(dispatch_time(DISPATCH_TIME_NOW, (int64_t)(1.0*NSEC_PER_SEC)), dispatch_get_main_queue(), ^{ //dispatch_after is necessary because Sileo takes a few seconds to update what tweaks are in the queue
113113
[bm addingReposDidFinish:true];
@@ -126,7 +126,7 @@ extern int refreshesCompleted;
126126
}
127127
%new
128128
- (void)startBatchomatic {
129-
batchomatic *bm = [batchomatic sharedInstance];
129+
Batchomatic *bm = [Batchomatic sharedInstance];
130130
bm.packageManager = 4;
131131
bm.motherClass = self;
132132
bm.installer_SearchViewController = self;
@@ -141,15 +141,15 @@ extern int refreshesCompleted;
141141
- (void)viewWillDisappear:(bool)animated { //Installer calls this method when it finishes adding repos
142142
%orig;
143143
if (refreshesCompleted != 0) {
144-
[[%c(batchomatic) sharedInstance] addingReposDidFinish:false];
144+
[[%c(Batchomatic) sharedInstance] addingReposDidFinish:false];
145145
}
146146
}
147147
%end
148148

149149
%hook ATRPackages
150150
- (id)init {
151151
%orig;
152-
batchomatic *bm = [%c(batchomatic) sharedInstance];
152+
Batchomatic *bm = [%c(Batchomatic) sharedInstance];
153153
bm.installer_ATRPackages = self;
154154
return self;
155155
}

batchomatic.xm

Lines changed: 33 additions & 10 deletions
Original file line numberDiff line numberDiff line change
@@ -1,14 +1,14 @@
1-
//Batchomatic v4.0 - Created by /u/CaptInc37
1+
//Batchomatic v4.1 - Created by /u/CaptInc37
22
#pragma clang diagnostic ignored "-Warc-performSelector-leaks"
3-
#import <headers/batchomatic.h>
3+
#import <headers/Batchomatic.h>
44
#import <headers/NSTask.h>
55
extern int refreshesCompleted; //this variable is used for telling my tweak what we should do next during add repos. It also ensures that my extra code in the hooks only executes if we are currently using Batchomatic
66
//Note: when I set that variable as an @property, I ran into some weird bug where it wasn't keeping track of its value. Setting it as a normal C global variable fixed that
77
int refreshesCompleted = 0;
88

9-
@implementation batchomatic
9+
@implementation Batchomatic
1010
+ (id)sharedInstance { //returns the instance of the Batchomatic class (so you can access the Batchomatic code from anywhere)
11-
static batchomatic *singleton;
11+
static Batchomatic *singleton;
1212
static dispatch_once_t onceToken;
1313
dispatch_once(&onceToken, ^{
1414
singleton = [[self alloc] init];
@@ -82,7 +82,7 @@ int refreshesCompleted = 0;
8282
[self.spinner stopAnimating];
8383
UIAlertAction *contactAction = [UIAlertAction actionWithTitle:@"Contact developer" style:UIAlertActionStyleDefault handler:^(UIAlertAction *action) {
8484
NSDictionary *options = @{UIApplicationOpenURLOptionUniversalLinksOnly : @NO};
85-
[[UIApplication sharedApplication] openURL:[NSURL URLWithString: @"https://www.reddit.com/message/compose/?to=captinc37&subject=Batchomatic%20creation%20fatal%20error"] options:options completionHandler:nil];
85+
[[UIApplication sharedApplication] openURL:[NSURL URLWithString:@"https://www.reddit.com/message/compose/?to=captinc37&subject=Batchomatic%20creation%20fatal%20error"] options:options completionHandler:nil];
8686
}];
8787
UIAlertAction *dismissAction = [UIAlertAction actionWithTitle:@"Dismiss" style:UIAlertActionStyleCancel handler:^(UIAlertAction *action) {}];
8888
[self.processingDialog addAction:contactAction];
@@ -433,7 +433,13 @@ int refreshesCompleted = 0;
433433
combinedStackView.translatesAutoresizingMaskIntoConstraints = NO;
434434
[combinedStackView.topAnchor constraintEqualToAnchor:optionsAlert.view.topAnchor constant:64].active = YES;
435435
[optionsAlert.view layoutIfNeeded];
436-
CGFloat height = optionsAlert.view.bounds.size.height + optionsAlert.actions.count*52 + combinedStackView.bounds.size.height;
436+
CGFloat height;
437+
if (@available(iOS 13, *)) {
438+
height = optionsAlert.view.bounds.size.height + optionsAlert.actions.count;
439+
}
440+
else {
441+
height = optionsAlert.view.bounds.size.height + optionsAlert.actions.count*52 + combinedStackView.bounds.size.height;
442+
}
437443
[optionsAlert.view.heightAnchor constraintEqualToConstant:height].active = YES;
438444

439445
[self.bm_currentBMController presentViewController:optionsAlert animated:YES completion:nil];
@@ -559,7 +565,12 @@ int refreshesCompleted = 0;
559565
self.processingDialog = [UIAlertController alertControllerWithTitle:@"Batchomatic" message:totalMessage preferredStyle:UIAlertControllerStyleAlert];
560566

561567
UIViewController *progressStatus = [[UIViewController alloc] init]; //these next few lines create a UIActivityIndicator inside of a UIAlertController (the spinning wheel)
562-
self.spinner = [[UIActivityIndicatorView alloc] initWithActivityIndicatorStyle:UIActivityIndicatorViewStyleGray];
568+
if (@available(iOS 13, *)) {
569+
self.spinner = [[UIActivityIndicatorView alloc] initWithActivityIndicatorStyle:UIActivityIndicatorViewStyleMedium];
570+
}
571+
else {
572+
self.spinner = [[UIActivityIndicatorView alloc] initWithActivityIndicatorStyle:UIActivityIndicatorViewStyleGray];
573+
}
563574
self.spinner.hidesWhenStopped = YES;
564575
[self.spinner startAnimating];
565576
[progressStatus.view addSubview:self.spinner];
@@ -574,7 +585,7 @@ int refreshesCompleted = 0;
574585
}
575586

576587
- (void)transitionProgressMessage:(NSString *)theMessage { //only transitions the text of the processing dialog
577-
[UIView transitionWithView: self.processingDialog.view duration: 0.3 options: UIViewAnimationOptionTransitionCrossDissolve animations: ^(void) { self.processingDialog.message = theMessage; } completion: nil];
588+
[UIView transitionWithView:self.processingDialog.view duration:0.3 options:UIViewAnimationOptionTransitionCrossDissolve animations:^(void) { self.processingDialog.message = theMessage; } completion:nil];
578589
}
579590

580591
- (NSString *)updateProgressMessage:(NSString *)wordMessage { //increments what stage we are on and transitions the text
@@ -626,7 +637,13 @@ int refreshesCompleted = 0;
626637
[combinedStackView.centerXAnchor constraintEqualToAnchor:self.processingDialog.view.centerXAnchor].active = YES;
627638
[combinedStackView.topAnchor constraintEqualToAnchor:self.processingDialog.view.topAnchor constant:64].active = YES;
628639
[self.processingDialog.view layoutIfNeeded];
629-
CGFloat height = self.processingDialog.view.bounds.size.height + self.processingDialog.actions.count*52 + combinedStackView.bounds.size.height;
640+
CGFloat height;
641+
if (@available(iOS 13, *)) {
642+
height = self.processingDialog.view.bounds.size.height + self.processingDialog.actions.count + combinedStackView.bounds.size.height;
643+
}
644+
else {
645+
height = self.processingDialog.view.bounds.size.height + self.processingDialog.actions.count*52 + combinedStackView.bounds.size.height;
646+
}
630647
[self.processingDialog.view.heightAnchor constraintEqualToConstant:height].active = YES;
631648

632649
[self transitionProgressMessage:theMessage];
@@ -643,7 +660,13 @@ int refreshesCompleted = 0;
643660
[combinedStackView.centerXAnchor constraintEqualToAnchor:alert.view.centerXAnchor].active = YES;
644661
[combinedStackView.topAnchor constraintEqualToAnchor:alert.view.topAnchor constant:64].active = YES;
645662
[alert.view layoutIfNeeded];
646-
CGFloat height = alert.view.bounds.size.height + alert.actions.count*52 + combinedStackView.bounds.size.height;
663+
CGFloat height;
664+
if (@available(iOS 13, *)) {
665+
height = alert.view.bounds.size.height + alert.actions.count + combinedStackView.bounds.size.height;
666+
}
667+
else {
668+
height = alert.view.bounds.size.height + alert.actions.count*52 + combinedStackView.bounds.size.height;
669+
}
647670
[alert.view.heightAnchor constraintEqualToConstant:height].active = YES;
648671

649672
if (shouldPresentImmediately) {

0 commit comments

Comments
 (0)