Skip to content

Commit

Permalink
Add an option to hide the progress hud as requested by a Redditor
Browse files Browse the repository at this point in the history
  • Loading branch information
pwn20wndstuff committed May 24, 2019
1 parent e957ee8 commit 5725cd5
Show file tree
Hide file tree
Showing 7 changed files with 83 additions and 27 deletions.
87 changes: 61 additions & 26 deletions Undecimus/Main.storyboard

Large diffs are not rendered by default.

6 changes: 6 additions & 0 deletions Undecimus/source/JailbreakViewController.h
Original file line number Diff line number Diff line change
Expand Up @@ -75,6 +75,9 @@ static inline UIProgressHUD *addProgressHUD() {
}

static inline void removeProgressHUD(UIProgressHUD *hud) {
if (hud == nil) {
return;
}
dispatch_semaphore_t semaphore = dispatch_semaphore_create(0);
dispatch_async(dispatch_get_main_queue(), ^{
[hud hide];
Expand All @@ -85,6 +88,9 @@ static inline void removeProgressHUD(UIProgressHUD *hud) {
}

static inline void updateProgressHUD(UIProgressHUD *hud, NSString *msg) {
if (hud == nil) {
return;
}
dispatch_semaphore_t semaphore = dispatch_semaphore_create(0);
dispatch_async(dispatch_get_main_queue(), ^{
[hud setText:msg];
Expand Down
1 change: 1 addition & 0 deletions Undecimus/source/SettingsTableViewController.h
Original file line number Diff line number Diff line change
Expand Up @@ -40,6 +40,7 @@
@property (weak, nonatomic) IBOutlet UISwitch *EnableGetTaskAllowSwitch;
@property (weak, nonatomic) IBOutlet UISwitch *SetCSDebuggedSwitch;
@property (weak, nonatomic) IBOutlet UISwitch *AutoRespringSwitch;
@property (weak, nonatomic) IBOutlet UISwitch *HideProgressHUDSwitch;

+ (NSDictionary *)provisioningProfileAtPath:(NSString *)path;

Expand Down
9 changes: 9 additions & 0 deletions Undecimus/source/SettingsTableViewController.m
Original file line number Diff line number Diff line change
Expand Up @@ -105,6 +105,7 @@ - (void)reloadData {
[self.EnableGetTaskAllowSwitch setOn:(BOOL)prefs->enable_get_task_allow];
[self.SetCSDebuggedSwitch setOn:(BOOL)prefs->set_cs_debugged];
[self.AutoRespringSwitch setOn:(BOOL)prefs->auto_respring];
[self.HideProgressHUDSwitch setOn:(BOOL)prefs->hide_progress_hud];
[self.RestartSpringBoardButton setEnabled:respringSupported()];
[self.restartButton setEnabled:restartSupported()];
release_prefs(&prefs);
Expand Down Expand Up @@ -412,6 +413,14 @@ - (IBAction)setAutoRespring:(id)sender {
[self reloadData];
}

- (IBAction)setHideProgressHUD:(id)sender {
prefs_t *prefs = copy_prefs();
prefs->hide_progress_hud = (bool)self.HideProgressHUDSwitch.isOn;
set_prefs(prefs);
release_prefs(&prefs);
[self reloadData];
}

- (IBAction)tappedOnResetAppPreferences:(id)sender {
void (^const block)(void) = ^(void) {
reset_prefs();
Expand Down
2 changes: 1 addition & 1 deletion Undecimus/source/jailbreak.m
Original file line number Diff line number Diff line change
Expand Up @@ -113,7 +113,7 @@ void jailbreak()
NSMutableString *status = [NSMutableString new];
bool const betaFirmware = isBetaFirmware();
time_t const start_time = time(NULL);
UIProgressHUD *hud = addProgressHUD();
UIProgressHUD *hud = prefs->hide_progress_hud ? nil : addProgressHUD();
JailbreakViewController *sharedController = [JailbreakViewController sharedController];
NSMutableArray *resources = [NSMutableArray new];
NSFileManager *const fileManager = [NSFileManager defaultManager];
Expand Down
2 changes: 2 additions & 0 deletions Undecimus/source/prefs.h
Original file line number Diff line number Diff line change
Expand Up @@ -34,6 +34,7 @@
#define K_ENABLE_GET_TASK_ALLOW "DoEnableGetTaskAllow"
#define K_SET_CS_DEBUGGED "SetCSDebugged"
#define K_AUTO_RESPRING "AutoRespring"
#define K_HIDE_PROGRESS_HUD "HideProgressHUD"

typedef struct {
bool load_tweaks;
Expand All @@ -57,6 +58,7 @@ typedef struct {
bool set_cs_debugged;
bool hide_log_window;
bool auto_respring;
bool hide_progress_hud;
int exploit;
} prefs_t;

Expand Down
3 changes: 3 additions & 0 deletions Undecimus/source/prefs.m
Original file line number Diff line number Diff line change
Expand Up @@ -64,6 +64,7 @@ bool load_prefs(prefs_t *prefs) {
prefs->exploit = (int)[[userDefaults objectForKey:@K_EXPLOIT inDomain:prefsFile] intValue];
prefs->hide_log_window = (bool)[[userDefaults objectForKey:@K_HIDE_LOG_WINDOW inDomain:prefsFile] boolValue];
prefs->auto_respring = (bool)[[userDefaults objectForKey:@K_AUTO_RESPRING inDomain:prefsFile] boolValue];
prefs->hide_progress_hud = (bool)[[userDefaults objectForKey:@K_HIDE_PROGRESS_HUD inDomain:prefsFile] boolValue];
return true;
}

Expand Down Expand Up @@ -93,6 +94,7 @@ bool set_prefs(prefs_t *prefs) {
[userDefaults setObject:[NSNumber numberWithInt:(int)prefs->exploit] forKey:@K_EXPLOIT inDomain:prefsFile];
[userDefaults setObject:[NSNumber numberWithBool:(BOOL)prefs->hide_log_window] forKey:@K_HIDE_LOG_WINDOW inDomain:prefsFile];
[userDefaults setObject:[NSNumber numberWithBool:(BOOL)prefs->auto_respring] forKey:@K_AUTO_RESPRING inDomain:prefsFile];
[userDefaults setObject:[NSNumber numberWithBool:(BOOL)prefs->hide_progress_hud] forKey:@K_HIDE_PROGRESS_HUD inDomain:prefsFile];
[userDefaults synchronize];
return true;
}
Expand All @@ -119,6 +121,7 @@ void register_default_prefs() {
defaults[@K_SET_CS_DEBUGGED] = @NO;
defaults[@K_HIDE_LOG_WINDOW] = @NO;
defaults[@K_AUTO_RESPRING] = @NO;
defaults[@K_HIDE_PROGRESS_HUD] = @NO;
defaults[@K_EXPLOIT] = [NSNumber numberWithInteger:recommendedJailbreakSupport()];
[userDefaults registerDefaults:defaults];
}
Expand Down

0 comments on commit 5725cd5

Please sign in to comment.