├── LICENSE ├── Makefile ├── ShakeItOff.plist ├── Tweak.h ├── Tweak.xm ├── control ├── packages └── com.nahtedetihw.shakeitoff_1.2_iphoneos-arm.deb └── shakeitoffprefs ├── Makefile ├── Resources ├── Info.plist ├── Root.plist ├── banner.png ├── banner2.png ├── icon@2x.png └── icon@3x.png ├── SHAKEITOFFPreferences.h ├── SHAKEITOFFPreferences.m └── entry.plist /LICENSE: -------------------------------------------------------------------------------- 1 | copyright (c) 2020 kritanta 2 | 3 | dragon license version 1 4 | 5 | the following statement, within quotation marks, is a non-binding summation of the following license: 6 | 7 | " 8 | Clauses: 9 | 1. If you're forking/repacking the project, include this LICENSE file 10 | 2. If you use an individual file somewhere else, you need to keep the copyright header comment 11 | 3. Don't take a snippet/snippets of code from here and relicense it unless you've added it to a larger project. 12 | 4. If you repackage/fork this project, indicate so in the name and description of the project to a reasonable extent. 13 | 14 | Exemptions: 15 | 1. Anything you used this tool to create isn't bound by this license 16 | 2. Submodules of this project aren't bound by this license unless they also include it. 17 | 18 | This license isn't strictly enforced, and is very loose in general, so respecting it is appreciated. 19 | " 20 | 21 | redistribution and use in source and binary forms, with or without modification, are permitted provided that the following conditions are met: 22 | 23 | 1. redistributions of substantial portions of the source code of this project must retain the above copyright notice, this list of conditions and the following disclaimer. 24 | 25 | 2. redistributions of source code in any capacity must maintain the copyright notice within individual files. this does not apply to snippets of code. 26 | 27 | 3. individual snippets of code alone should not be relicensed unless they do not make up a substantial portion of the project. 28 | 29 | 4. redistributions of substantial portions of the source code of this project must differentiate themselves from this project within their name and within extended descriptions of the project. 30 | 31 | 4a. modified redistributions of substantial portions of the source code or compiled binary must indicate they have been modified 32 | 33 | 34 | the following are exempt from this license: 35 | 36 | 1. projects, binaries, or any packages generated through this program are not considered derivative works, and are not bound by this license. 37 | 38 | 2. submodules of this project are not bound by this license unless explicitly stated. 39 | -------------------------------------------------------------------------------- /Makefile: -------------------------------------------------------------------------------- 1 | TARGET := iphone:clang:latest:13.0 2 | INSTALL_TARGET_PROCESSES = SpringBoard 3 | ARCHS = arm64 arm64e 4 | 5 | DEBUG = 0 6 | FINALPACKAGE = 1 7 | 8 | PREFIX=$(THEOS)/toolchain/Xcode.xctoolchain/usr/bin/ 9 | 10 | include $(THEOS)/makefiles/common.mk 11 | 12 | TWEAK_NAME = ShakeItOff 13 | 14 | ShakeItOff_FILES = Tweak.xm 15 | ShakeItOff_CFLAGS = -fobjc-arc -Wno-deprecated-declarations 16 | ShakeItOff_FRAMEWORKS = UIKit 17 | ShakeItOff_EXTRA_FRAMEWORKS += Cephei 18 | ShakeItOff_PRIVATE_FRAMEWORKS = MediaRemote 19 | 20 | SUBPROJECTS += shakeitoffprefs 21 | 22 | include $(THEOS_MAKE_PATH)/tweak.mk 23 | 24 | after-install:: 25 | install.exec "killall -9 Preferences && killall -9 SpringBoard" 26 | include $(THEOS_MAKE_PATH)/aggregate.mk -------------------------------------------------------------------------------- /ShakeItOff.plist: -------------------------------------------------------------------------------- 1 | { Filter = { Bundles = ( "com.apple.springboard" ); }; } 2 | -------------------------------------------------------------------------------- /Tweak.h: -------------------------------------------------------------------------------- 1 | // Original tweak ShakeLight by KritantaDev 2 | // https://github.com/KritantaDev/ShakeLight 3 | 4 | #import 5 | #import 6 | #import 7 | #import 8 | #import 9 | #import 10 | #import 11 | #import 12 | #import 13 | #import "MediaRemote.h" 14 | #import 15 | //#import 16 | //#import 17 | //#import 18 | 19 | @interface UISUserInterfaceStyleMode : NSObject 20 | @property (nonatomic, assign) long long modeValue; 21 | @end 22 | 23 | @interface _CDBatterySaver 24 | -(id)batterySaver; 25 | -(BOOL)setPowerMode:(long long)arg1 error:(id *)arg2; 26 | @end 27 | 28 | @interface SBVolumeControl 29 | +(id)sharedInstance; 30 | -(void)setActiveCategoryVolume:(float)arg1 ; 31 | -(float)_effectiveVolume; 32 | -(void)toggleMute; 33 | -(void)_updateEffectiveVolume:(float)arg1; 34 | @end 35 | 36 | @interface SBHomeHardwareButton : NSObject 37 | -(void)doublePressDown:(id)arg1 ; 38 | -(void)longPress:(id)arg1 ; 39 | @end 40 | 41 | @interface SpringBoard : NSObject 42 | @property (nonatomic,readonly) SBHomeHardwareButton * homeHardwareButton; 43 | -(void)_runBottomEdgeSwipeTestFromHomeScreen:(BOOL)arg1; 44 | -(void)_simulateLockButtonPress; 45 | -(void)takeScreenshot; 46 | @end 47 | 48 | @interface SBReachabilityManager : NSObject 49 | +(id)sharedInstance; 50 | -(void)toggleReachability; 51 | -(BOOL)reachabilityModeActive; 52 | @end 53 | 54 | @interface SBApplication : NSObject 55 | @property (nonatomic, readonly) NSString *bundleIdentifier; 56 | @end 57 | 58 | @interface LSApplicationWorkspace : NSObject 59 | +(id)defaultWorkspace; 60 | -(void)openApplicationWithBundleIdentifier:(id)arg1 configuration:(id)arg2 completionHandler:(/*^block*/id)arg3 ; 61 | @end 62 | 63 | @interface SBMediaController : NSObject 64 | +(id)sharedInstance; 65 | @property (nonatomic) SBApplication *nowPlayingApplication; 66 | @property (nonatomic,readonly) NSString * displayName; 67 | @end 68 | 69 | @interface SBWiFiManager : NSObject 70 | +(id)sharedInstance; 71 | -(void)setWiFiEnabled:(BOOL)arg1 ; 72 | -(BOOL)wiFiEnabled; 73 | @end 74 | 75 | @interface RadiosPreferences : NSObject 76 | - (BOOL)airplaneMode; 77 | - (void)setAirplaneMode:(BOOL)arg1; 78 | - (void)synchronize; 79 | @end 80 | 81 | @interface SBControlCenterController : UIViewController 82 | +(id)sharedInstance; 83 | -(BOOL)isVisible; 84 | -(void)presentAnimated:(BOOL)arg1 completion:(/*^block*/id)arg2; 85 | -(void)dismissAnimated:(BOOL)arg1 completion:(/*^block*/id)arg2; 86 | @end 87 | 88 | @interface CSCoverSheetViewController : UIViewController 89 | -(BOOL)_isShowingChargingModal; 90 | -(void)_transitionChargingViewToVisible:(BOOL)arg1 showBattery:(BOOL)arg2 animated:(BOOL)arg3; 91 | @end 92 | 93 | @interface SBLockScreenManager : NSObject 94 | @property (nonatomic,readonly) CSCoverSheetViewController * coverSheetViewController; 95 | +(id)sharedInstance; 96 | -(BOOL)isScreenOn; 97 | @end 98 | 99 | @interface AVOutputDevice : NSObject 100 | -(BOOL)isLogicalDeviceLeader; 101 | -(id)currentBluetoothListeningMode; 102 | - (void)setCurrentBluetoothListeningMode:(NSString *)arg1; 103 | @end 104 | 105 | @interface MPAVRoute : NSObject 106 | - (id)logicalLeaderOutputDevice; 107 | @end 108 | 109 | @interface MPAVRoutingController : NSObject 110 | @property(readonly, nonatomic)MPAVRoute* pickedRoute; 111 | @end 112 | 113 | @interface BBAction : NSObject 114 | + (id)actionWithLaunchBundleID:(id)arg1 callblock:(id)arg2; 115 | @end 116 | 117 | @interface BBBulletin : NSObject 118 | @property(nonatomic, copy)NSString* sectionID; 119 | @property(nonatomic, copy)NSString* recordID; 120 | @property(nonatomic, copy)NSString* publisherBulletinID; 121 | @property(nonatomic, copy)NSString* title; 122 | @property(nonatomic, copy)NSString* message; 123 | @property(nonatomic, retain)NSDate* date; 124 | @property(assign, nonatomic)BOOL clearable; 125 | @property(nonatomic)BOOL showsMessagePreview; 126 | @property(nonatomic, copy)BBAction* defaultAction; 127 | @property(nonatomic, copy)NSString* bulletinID; 128 | @property(nonatomic, retain)NSDate* lastInterruptDate; 129 | @property(nonatomic, retain)NSDate* publicationDate; 130 | @end 131 | 132 | @interface BBServer : NSObject 133 | - (void)publishBulletin:(BBBulletin *)arg1 destinations:(NSUInteger)arg2 alwaysToLockScreen:(BOOL)arg3; 134 | - (void)publishBulletin:(id)arg1 destinations:(unsigned long long)arg2; 135 | -(void)_removeBulletins:(id)arg1 forSectionID:(id)arg2 shouldSync:(BOOL)arg3 ; 136 | -(id)_bulletinsForIDs:(id)arg1 ; 137 | -(id)allBulletinIDsForSectionID:(id)arg1 ; 138 | -(void)_removeActiveSectionID:(id)arg1 ; 139 | @end 140 | 141 | @interface SBAssistantController 142 | + (id)sharedInstance; 143 | -(void)siriPresentation:(id)arg1 requestsPunchout:(id)arg2 withHandler:(/*^block*/id)arg3; 144 | -(void)dismissAssistantViewIfNecessaryWithAnimation:(long long)arg1 factory:(id)arg2 dismissalOptions:(id)arg3 completion:(/*^block*/id)arg4 ; 145 | -(BOOL)isVisible; 146 | @end 147 | 148 | @interface SBOrientationLockManager : NSObject 149 | +(id)sharedInstance; 150 | -(BOOL)isUserLocked; 151 | -(void)unlock; 152 | -(void)lock; 153 | @end 154 | 155 | @interface BluetoothManager 156 | + (id)sharedInstance; 157 | - (BOOL)powered; 158 | - (BOOL)enabled; 159 | - (BOOL)setPowered:(BOOL)powered; 160 | - (void)setEnabled:(BOOL)enabled; 161 | @end 162 | 163 | @interface RPScreenRecorder 164 | @property (assign,getter=isRecording,nonatomic) BOOL recording; 165 | + (id)sharedRecorder; 166 | -(void)startRecordingWithHandler:(/*^block*/id)arg1 ; 167 | -(void)stopRecordingWithHandler:(/*^block*/id)arg1 ; 168 | @end 169 | 170 | @interface SBRingerControl 171 | - (BOOL)isRingerMuted; 172 | - (void)setRingerMuted:(BOOL)muted; 173 | -(void)activateRingerHUDFromMuteSwitch:(int)arg1; 174 | @end 175 | 176 | @interface SBMainWorkspace 177 | @property (nonatomic,readonly) SBRingerControl * ringerControl; 178 | - (id)sharedInstance; 179 | @end 180 | -------------------------------------------------------------------------------- /Tweak.xm: -------------------------------------------------------------------------------- 1 | #import "Tweak.h" 2 | 3 | BOOL enable; 4 | BOOL enableNoiseCancellationBanners; 5 | NSInteger listeningMode; 6 | NSInteger shakeSelection; 7 | HBPreferences *preferences; 8 | static BBServer *bbServer = nil; 9 | 10 | static dispatch_queue_t getBBServerQueue() { 11 | 12 | static dispatch_queue_t queue; 13 | static dispatch_once_t predicate; 14 | 15 | dispatch_once(&predicate, ^{ 16 | void* handle = dlopen(NULL, RTLD_GLOBAL); 17 | if (handle) { 18 | dispatch_queue_t __weak *pointer = (__weak dispatch_queue_t *) dlsym(handle, "__BBServerQueue"); 19 | if (pointer) queue = *pointer; 20 | dlclose(handle); 21 | } 22 | }); 23 | 24 | return queue; 25 | 26 | } 27 | 28 | static void fakeNotification(NSString *sectionID, NSDate *date, NSString *message, bool banner) { 29 | 30 | BBBulletin* bulletin = [[%c(BBBulletin) alloc] init]; 31 | 32 | bulletin.title = @"Bluetooth listening mode:"; 33 | bulletin.message = message; 34 | bulletin.sectionID = sectionID; 35 | bulletin.bulletinID = [[NSProcessInfo processInfo] globallyUniqueString]; 36 | bulletin.recordID = [[NSProcessInfo processInfo] globallyUniqueString]; 37 | bulletin.publisherBulletinID = [[NSProcessInfo processInfo] globallyUniqueString]; 38 | bulletin.date = date; 39 | bulletin.defaultAction = [%c(BBAction) actionWithLaunchBundleID:sectionID callblock:nil]; 40 | bulletin.clearable = YES; 41 | bulletin.showsMessagePreview = YES; 42 | bulletin.publicationDate = date; 43 | bulletin.lastInterruptDate = date; 44 | 45 | if (banner) { 46 | if ([bbServer respondsToSelector:@selector(publishBulletin:destinations:)]) { 47 | dispatch_sync(getBBServerQueue(), ^{ 48 | [bbServer publishBulletin:bulletin destinations:15]; 49 | }); 50 | } 51 | } 52 | } 53 | 54 | void noiseCancelTestBanner() { 55 | fakeNotification(@"com.apple.Music", [NSDate date], @"Active Noise Cancellation Mode", true); 56 | } 57 | 58 | void transparencyTestBanner() { 59 | fakeNotification(@"com.apple.Music", [NSDate date], @"Transparency Mode", true); 60 | } 61 | 62 | void normalTestBanner() { 63 | fakeNotification(@"com.apple.Music", [NSDate date], @"Normal Mode", true); 64 | } 65 | 66 | void toggleFlashlight() { 67 | AVCaptureDevice *flashLight = [AVCaptureDevice defaultDeviceWithMediaType:AVMediaTypeVideo]; 68 | if ([flashLight isTorchAvailable] && [flashLight isTorchModeSupported:AVCaptureTorchModeOn]) { 69 | BOOL success = [flashLight lockForConfiguration:nil]; 70 | if (success) { 71 | if ([flashLight isTorchActive]) { 72 | [flashLight setTorchMode:AVCaptureTorchModeOff]; 73 | } else { 74 | [flashLight setTorchMode:AVCaptureTorchModeOn]; 75 | } 76 | [flashLight unlockForConfiguration]; 77 | } 78 | } 79 | AudioServicesPlaySystemSound(1519); 80 | } 81 | 82 | void toggleRespring() { 83 | pid_t pid; 84 | const char* args[] = {"killall", "SpringBoard", NULL}; 85 | posix_spawn(&pid, "/usr/bin/killall", NULL, NULL, (char* const*)args, NULL); 86 | AudioServicesPlaySystemSound(1519); 87 | } 88 | 89 | void toggleSafeMode() { 90 | pid_t pid; 91 | const char *args[] = {"killall", "-SEGV", "SpringBoard", NULL}; 92 | posix_spawn(&pid, "/usr/bin/killall", NULL, NULL, (char * const *)args, NULL); 93 | AudioServicesPlaySystemSound(1519); 94 | } 95 | 96 | void toggleDarkMode() { 97 | BOOL darkEnabled = ([UITraitCollection currentTraitCollection].userInterfaceStyle == UIUserInterfaceStyleDark); 98 | 99 | UISUserInterfaceStyleMode *styleMode = [[%c(UISUserInterfaceStyleMode) alloc] init]; 100 | if (darkEnabled) { 101 | styleMode.modeValue = 1; 102 | } else if (!darkEnabled) { 103 | styleMode.modeValue = 2; 104 | } 105 | AudioServicesPlaySystemSound(1519); 106 | } 107 | 108 | void toggleLowPowerMode() { 109 | BOOL success = NO; 110 | if ([[%c(NSProcessInfo) processInfo] isLowPowerModeEnabled]) { 111 | [[%c(_CDBatterySaver) batterySaver] setPowerMode:0 error:nil]; 112 | success = YES; 113 | } else { 114 | [[%c(_CDBatterySaver) batterySaver] setPowerMode:1 error:nil]; 115 | success = YES; 116 | } 117 | AudioServicesPlaySystemSound(1519); 118 | } 119 | 120 | void toggleSound() { 121 | if ([[%c(SBVolumeControl) sharedInstance] _effectiveVolume] == 0) { 122 | [[%c(SBVolumeControl) sharedInstance] setActiveCategoryVolume:100]; 123 | [[%c(SBVolumeControl) sharedInstance] _updateEffectiveVolume:100]; 124 | } else { 125 | [[%c(SBVolumeControl) sharedInstance] setActiveCategoryVolume:0]; 126 | [[%c(SBVolumeControl) sharedInstance] _updateEffectiveVolume:0]; 127 | } 128 | //[[%c(SBVolumeControl) sharedInstance] toggleMute]; 129 | AudioServicesPlaySystemSound(1519); 130 | } 131 | 132 | void toggleLockScreen() { 133 | [(SpringBoard *)[UIApplication sharedApplication] _simulateLockButtonPress]; 134 | AudioServicesPlaySystemSound(1519); 135 | } 136 | 137 | void togglePreviousTrack() { 138 | MRMediaRemoteSendCommand(kMRPreviousTrack, nil); 139 | AudioServicesPlaySystemSound(1519); 140 | } 141 | 142 | void togglePlayPause() { 143 | MRMediaRemoteSendCommand(kMRTogglePlayPause, nil); 144 | AudioServicesPlaySystemSound(1519); 145 | } 146 | 147 | void toggleNextTrack() { 148 | MRMediaRemoteSendCommand(kMRNextTrack, nil); 149 | AudioServicesPlaySystemSound(1519); 150 | } 151 | 152 | void toggleReachability() { 153 | [[%c(SBReachabilityManager) sharedInstance] toggleReachability]; 154 | AudioServicesPlaySystemSound(1519); 155 | } 156 | 157 | void toggleNowPlayingApp() { 158 | SBApplication *app = [[%c(SBMediaController) sharedInstance] nowPlayingApplication]; 159 | [[%c(LSApplicationWorkspace) defaultWorkspace] openApplicationWithBundleIdentifier:app.bundleIdentifier configuration:nil completionHandler:nil]; 160 | AudioServicesPlaySystemSound(1519); 161 | } 162 | 163 | void toggleScreenshot() { 164 | [(SpringBoard *)[UIApplication sharedApplication] takeScreenshot]; 165 | AudioServicesPlaySystemSound(1519); 166 | } 167 | 168 | void toggleAirplaneMode() { 169 | RadiosPreferences *prefs = [[%c(RadiosPreferences) alloc] init]; 170 | if (prefs.airplaneMode == NO) { 171 | [prefs setAirplaneMode:YES]; 172 | } else { 173 | [prefs setAirplaneMode:NO]; 174 | } 175 | AudioServicesPlaySystemSound(1519); 176 | } 177 | 178 | void toggleControlCenter() { 179 | if ([[%c(SBControlCenterController) sharedInstance] isVisible] == NO) { 180 | [[%c(SBControlCenterController) sharedInstance] presentAnimated:YES completion:nil]; 181 | } else { 182 | [[%c(SBControlCenterController) sharedInstance] dismissAnimated:YES completion:nil]; 183 | } 184 | AudioServicesPlaySystemSound(1519); 185 | } 186 | 187 | void toggleWiFi() { 188 | if ([[%c(SBWiFiManager) sharedInstance] wiFiEnabled] == NO) { 189 | [[%c(SBWiFiManager) sharedInstance] setWiFiEnabled:YES]; 190 | } else { 191 | [[%c(SBWiFiManager) sharedInstance] setWiFiEnabled:NO]; 192 | } 193 | AudioServicesPlaySystemSound(1519); 194 | } 195 | 196 | void toggleBattery() { 197 | if ([((SBLockScreenManager *)[%c(SBLockScreenManager) sharedInstance]).coverSheetViewController _isShowingChargingModal] == NO) { 198 | [((SBLockScreenManager *)[%c(SBLockScreenManager) sharedInstance]).coverSheetViewController _transitionChargingViewToVisible:YES showBattery:YES animated:YES]; 199 | } else { 200 | [((SBLockScreenManager *)[%c(SBLockScreenManager) sharedInstance]).coverSheetViewController dismissViewControllerAnimated:YES completion:nil]; 201 | } 202 | AudioServicesPlaySystemSound(1519); 203 | } 204 | 205 | void toggleNoiseCancellation() { 206 | if (listeningMode == 0) { 207 | [[[[[[%c(SBMediaController) sharedInstance] valueForKey:@"_routingController"] pickedRoute] logicalLeaderOutputDevice] valueForKey:@"_avOutputDevice"] setCurrentBluetoothListeningMode:@"AVOutputDeviceBluetoothListeningModeAudioTransparency"]; 208 | listeningMode = 1; 209 | if (enableNoiseCancellationBanners) transparencyTestBanner(); 210 | } else if (listeningMode == 1) { 211 | [[[[[[%c(SBMediaController) sharedInstance] valueForKey:@"_routingController"] pickedRoute] logicalLeaderOutputDevice] valueForKey:@"_avOutputDevice"] setCurrentBluetoothListeningMode:@"AVOutputDeviceBluetoothListeningModeActiveNoiseCancellation"]; 212 | listeningMode = 2; 213 | if (enableNoiseCancellationBanners) noiseCancelTestBanner(); 214 | } else if (listeningMode == 2) { 215 | [[[[[[%c(SBMediaController) sharedInstance] valueForKey:@"_routingController"] pickedRoute] logicalLeaderOutputDevice] valueForKey:@"_avOutputDevice"] setCurrentBluetoothListeningMode:@"AVOutputDeviceBluetoothListeningModeNormal"]; 216 | listeningMode = 0; 217 | if (enableNoiseCancellationBanners) normalTestBanner(); 218 | } 219 | AudioServicesPlaySystemSound(1519); 220 | } 221 | 222 | void toggleOrientationLock() { 223 | if ([[%c(SBOrientationLockManager) sharedInstance] isUserLocked] == YES) { 224 | [[%c(SBOrientationLockManager) sharedInstance] unlock]; 225 | } else { 226 | [[%c(SBOrientationLockManager) sharedInstance] lock]; 227 | } 228 | AudioServicesPlaySystemSound(1519); 229 | } 230 | 231 | void toggleBluetooth() { 232 | if ([[%c(BluetoothManager) sharedInstance] enabled] == NO) { 233 | [[%c(BluetoothManager) sharedInstance] setEnabled:YES]; 234 | } else { 235 | [[%c(BluetoothManager) sharedInstance] setEnabled:NO]; 236 | } 237 | AudioServicesPlaySystemSound(1519); 238 | } 239 | 240 | void toggleRinger() { 241 | if ([((SBMainWorkspace *)[%c(SBMainWorkspace) sharedInstance]).ringerControl isRingerMuted] == NO) { 242 | [((SBMainWorkspace *)[%c(SBMainWorkspace) sharedInstance]).ringerControl setRingerMuted:YES]; 243 | [((SBMainWorkspace *)[%c(SBMainWorkspace) sharedInstance]).ringerControl activateRingerHUDFromMuteSwitch:0]; 244 | } else { 245 | [((SBMainWorkspace *)[%c(SBMainWorkspace) sharedInstance]).ringerControl setRingerMuted:NO]; 246 | [((SBMainWorkspace *)[%c(SBMainWorkspace) sharedInstance]).ringerControl activateRingerHUDFromMuteSwitch:1]; 247 | } 248 | AudioServicesPlaySystemSound(1519); 249 | } 250 | 251 | %group ShakeItOff 252 | 253 | %hook UIWindow 254 | - (void)motionEnded:(UIEventSubtype)motion withEvent:(UIEvent *)event { 255 | %orig; 256 | BOOL isScreenOn = MSHookIvar([%c(SBLockScreenManager) sharedInstance], "_isScreenOn"); 257 | if (event.type == UIEventSubtypeMotionShake && self == [[UIApplication sharedApplication] keyWindow] && isScreenOn == YES) { 258 | switch (shakeSelection) { 259 | case 0: 260 | toggleFlashlight(); 261 | break; 262 | 263 | case 1: 264 | toggleRespring(); 265 | break; 266 | 267 | case 2: 268 | toggleSafeMode(); 269 | break; 270 | 271 | case 3: 272 | toggleDarkMode(); 273 | break; 274 | 275 | case 4: 276 | toggleLowPowerMode(); 277 | break; 278 | 279 | case 5: 280 | toggleSound(); 281 | break; 282 | 283 | case 6: 284 | toggleLockScreen(); 285 | break; 286 | 287 | case 7: 288 | togglePreviousTrack(); 289 | break; 290 | 291 | case 8: 292 | togglePlayPause(); 293 | break; 294 | 295 | case 9: 296 | toggleNextTrack(); 297 | break; 298 | 299 | case 10: 300 | toggleReachability(); 301 | break; 302 | 303 | case 11: 304 | toggleNowPlayingApp(); 305 | break; 306 | 307 | case 12: 308 | toggleScreenshot(); 309 | break; 310 | 311 | case 13: 312 | toggleAirplaneMode(); 313 | break; 314 | 315 | case 14: 316 | toggleControlCenter(); 317 | break; 318 | 319 | case 15: 320 | toggleWiFi(); 321 | break; 322 | 323 | case 16: 324 | toggleBattery(); 325 | break; 326 | 327 | case 17: 328 | toggleNoiseCancellation(); 329 | break; 330 | 331 | case 18: 332 | toggleOrientationLock(); 333 | break; 334 | 335 | case 19: 336 | toggleBluetooth(); 337 | break; 338 | 339 | case 20: 340 | toggleRinger(); 341 | break; 342 | } 343 | } 344 | } 345 | 346 | %end 347 | 348 | %hook BBServer 349 | 350 | - (id)initWithQueue:(id)arg1 { 351 | 352 | bbServer = %orig; 353 | 354 | return bbServer; 355 | 356 | } 357 | 358 | - (id)initWithQueue:(id)arg1 dataProviderManager:(id)arg2 syncService:(id)arg3 dismissalSyncCache:(id)arg4 observerListener:(id)arg5 utilitiesListener:(id)arg6 conduitListener:(id)arg7 systemStateListener:(id)arg8 settingsListener:(id)arg9 { 359 | 360 | bbServer = %orig; 361 | 362 | return bbServer; 363 | 364 | } 365 | 366 | - (void)dealloc { 367 | 368 | if (bbServer == self) bbServer = nil; 369 | 370 | %orig; 371 | 372 | } 373 | 374 | %end 375 | 376 | %end 377 | 378 | %ctor { 379 | preferences = [[HBPreferences alloc] initWithIdentifier:@"com.nahtedetihw.shakeitoffprefs"]; 380 | [preferences registerBool:&enable default:NO forKey:@"enable"]; 381 | [preferences registerBool:&enableNoiseCancellationBanners default:NO forKey:@"enableNoiseCancellationBanners"]; 382 | [preferences registerInteger:&shakeSelection default:0 forKey:@"shakeSelection"]; 383 | 384 | if (enable) { 385 | %init(ShakeItOff); 386 | return; 387 | CFNotificationCenterAddObserver(CFNotificationCenterGetDarwinNotifyCenter(), NULL, (CFNotificationCallback)noiseCancelTestBanner, (CFStringRef)@"com.nahtedetihw.shakeitoff/NoiseCancel", NULL, (CFNotificationSuspensionBehavior)kNilOptions); 388 | CFNotificationCenterAddObserver(CFNotificationCenterGetDarwinNotifyCenter(), NULL, (CFNotificationCallback)transparencyTestBanner, (CFStringRef)@"com.nahtedetihw.shakeitoff/Transparency", NULL, (CFNotificationSuspensionBehavior)kNilOptions); 389 | CFNotificationCenterAddObserver(CFNotificationCenterGetDarwinNotifyCenter(), NULL, (CFNotificationCallback)normalTestBanner, (CFStringRef)@"com.nahtedetihw.shakeitoff/Normal", NULL, (CFNotificationSuspensionBehavior)kNilOptions); 390 | } 391 | return; 392 | } 393 | -------------------------------------------------------------------------------- /control: -------------------------------------------------------------------------------- 1 | Package: com.nahtedetihw.shakeitoff 2 | Name: ShakeItOff 3 | Version: 1.2 4 | Architecture: iphoneos-arm 5 | Description: Shake your device and toggle some stuff! 6 | Maintainer: Ethan Whited 7 | Author: Ethan Whited 8 | Section: Tweaks 9 | Depends: mobilesubstrate, ws.hbang.common 10 | -------------------------------------------------------------------------------- /packages/com.nahtedetihw.shakeitoff_1.2_iphoneos-arm.deb: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/nahtedetihw/ShakeItOff/60187f164b42f7c9f0dfba426bd115be81f21405/packages/com.nahtedetihw.shakeitoff_1.2_iphoneos-arm.deb -------------------------------------------------------------------------------- /shakeitoffprefs/Makefile: -------------------------------------------------------------------------------- 1 | ARCHS = arm64 arm64e 2 | 3 | include $(THEOS)/makefiles/common.mk 4 | 5 | BUNDLE_NAME = shakeitoffprefs 6 | shakeitoffprefs_FILES = SHAKEITOFFPreferences.m 7 | shakeitoffprefs_INSTALL_PATH = /Library/PreferenceBundles 8 | shakeitoffprefs_FRAMEWORKS = UIKit 9 | shakeitoffprefs_PRIVATE_FRAMEWORKS = Preferences 10 | shakeitoffprefs_EXTRA_FRAMEWORKS = Cephei CepheiPrefs 11 | 12 | include $(THEOS_MAKE_PATH)/bundle.mk 13 | 14 | internal-stage:: 15 | $(ECHO_NOTHING)mkdir -p $(THEOS_STAGING_DIR)/Library/PreferenceLoader/Preferences$(ECHO_END) 16 | $(ECHO_NOTHING)cp entry.plist $(THEOS_STAGING_DIR)/Library/PreferenceLoader/Preferences/shakeitoffprefs.plist$(ECHO_END) 17 | -------------------------------------------------------------------------------- /shakeitoffprefs/Resources/Info.plist: -------------------------------------------------------------------------------- 1 | 2 | 3 | 4 | 5 | CFBundleDevelopmentRegion 6 | English 7 | CFBundleExecutable 8 | shakeitoffprefs 9 | CFBundleIdentifier 10 | com.nahtedetihw.shakeitoffprefs 11 | CFBundleInfoDictionaryVersion 12 | 6.0 13 | CFBundlePackageType 14 | BNDL 15 | CFBundleShortVersionString 16 | 1.0.0 17 | CFBundleSignature 18 | ???? 19 | CFBundleVersion 20 | 1.0 21 | NSPrincipalClass 22 | SHAKEITOFFPreferencesListController 23 | 24 | 25 | -------------------------------------------------------------------------------- /shakeitoffprefs/Resources/Root.plist: -------------------------------------------------------------------------------- 1 | 2 | 3 | 4 | 5 | items 6 | 7 | 8 | cell 9 | PSSwitchCell 10 | default 11 | 12 | defaults 13 | com.nahtedetihw.shakeitoffprefs 14 | key 15 | enable 16 | label 17 | Enable 18 | 19 | 20 | cell 21 | PSGroupCell 22 | label 23 | 24 | 25 | 26 | cell 27 | PSLinkListCell 28 | default 29 | 0 30 | defaults 31 | com.nahtedetihw.shakeitoffprefs 32 | detail 33 | PSListItemsController 34 | key 35 | shakeSelection 36 | label 37 | Shake Selection 38 | validValues 39 | 40 | 0 41 | 1 42 | 2 43 | 3 44 | 4 45 | 5 46 | 6 47 | 7 48 | 8 49 | 9 50 | 10 51 | 11 52 | 12 53 | 13 54 | 14 55 | 15 56 | 16 57 | 17 58 | 18 59 | 19 60 | 20 61 | 62 | validTitles 63 | 64 | Flashlight 65 | Respring 66 | Safe Mode 67 | Dark Mode 68 | Low Power Mode 69 | Sound 70 | Lock Screen 71 | Previous Song 72 | Play/Pause Song 73 | Next Song 74 | Reachability 75 | Open Now Playing App 76 | Take Screenshot 77 | Airplane Mode 78 | Control Center 79 | WiFi 80 | Battery 81 | Noise Cancellation 82 | Orientation Lock 83 | Bluetooth 84 | Ringer 85 | 86 | PostNotification 87 | com.nahtedetihw.shakeitoffprefs/ReloadPrefs 88 | 89 | 90 | cell 91 | PSGroupCell 92 | label 93 | Respring not necessary :) 94 | 95 | 96 | cell 97 | PSSwitchCell 98 | default 99 | 100 | defaults 101 | com.nahtedetihw.shakeitoffprefs 102 | key 103 | enableNoiseCancellationBanners 104 | label 105 | Enable Banners for Noise Cancellation 106 | 107 | 108 | cell 109 | PSGroupCell 110 | label 111 | Contact 112 | 113 | 114 | cellClass 115 | HBTwitterCell 116 | label 117 | ETHN 118 | user 119 | EthanWhited 120 | 121 | 122 | cell 123 | PSGroupCell 124 | footerAlignment 125 | 1 126 | footerText 127 | ShakeItOff 1.2 128 | 129 | 130 | cell 131 | PSGroupCell 132 | footerAlignment 133 | 1 134 | footerText 135 | 2021 © nahtedetihw 136 | 137 | 138 | title 139 | 140 | 141 | 142 | -------------------------------------------------------------------------------- /shakeitoffprefs/Resources/banner.png: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/nahtedetihw/ShakeItOff/60187f164b42f7c9f0dfba426bd115be81f21405/shakeitoffprefs/Resources/banner.png -------------------------------------------------------------------------------- /shakeitoffprefs/Resources/banner2.png: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/nahtedetihw/ShakeItOff/60187f164b42f7c9f0dfba426bd115be81f21405/shakeitoffprefs/Resources/banner2.png -------------------------------------------------------------------------------- /shakeitoffprefs/Resources/icon@2x.png: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/nahtedetihw/ShakeItOff/60187f164b42f7c9f0dfba426bd115be81f21405/shakeitoffprefs/Resources/icon@2x.png -------------------------------------------------------------------------------- /shakeitoffprefs/Resources/icon@3x.png: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/nahtedetihw/ShakeItOff/60187f164b42f7c9f0dfba426bd115be81f21405/shakeitoffprefs/Resources/icon@3x.png -------------------------------------------------------------------------------- /shakeitoffprefs/SHAKEITOFFPreferences.h: -------------------------------------------------------------------------------- 1 | #import 2 | #import 3 | #import 4 | #import 5 | #import 6 | #import 7 | 8 | @interface SHAKEITOFFPreferencesListController : HBRootListController { 9 | 10 | UITableView * _table; 11 | 12 | } 13 | 14 | @property (nonatomic, retain) UIBarButtonItem *killButton; 15 | @property (nonatomic, retain) UIView *headerView; 16 | @property (nonatomic, retain) UIImageView *headerImageView; 17 | @property (nonatomic, retain) UILabel *titleLabel; 18 | @property (nonatomic, retain) UIImageView *iconView; 19 | @property (nonatomic, retain) NSArray *versionArray; 20 | - (void)handleYesGesture:(UIButton *)sender; 21 | - (void)handleNoGesture:(UIButton *)sender; 22 | @end 23 | 24 | @interface SHAKEITOFFAppearanceSettings: HBAppearanceSettings 25 | @end 26 | -------------------------------------------------------------------------------- /shakeitoffprefs/SHAKEITOFFPreferences.m: -------------------------------------------------------------------------------- 1 | #include "SHAKEITOFFPreferences.h" 2 | #import 3 | 4 | UIImageView *secondaryHeaderImage; 5 | UIBarButtonItem *respringButtonItem; 6 | UIViewController *popController; 7 | 8 | @interface UIColor (Private) 9 | + (id)tableCellGroupedBackgroundColor; 10 | @end 11 | 12 | @implementation SHAKEITOFFPreferencesListController 13 | @synthesize killButton; 14 | @synthesize versionArray; 15 | 16 | - (NSArray *)specifiers { 17 | if (!_specifiers) { 18 | _specifiers = [[self loadSpecifiersFromPlistName:@"Root" target:self] retain]; 19 | } 20 | 21 | return _specifiers; 22 | } 23 | 24 | 25 | - (instancetype)init { 26 | 27 | self = [super init]; 28 | 29 | if (self) { 30 | 31 | SHAKEITOFFAppearanceSettings *appearanceSettings = [[SHAKEITOFFAppearanceSettings alloc] init]; 32 | self.hb_appearanceSettings = appearanceSettings; 33 | 34 | UIButton *respringButton = [UIButton buttonWithType:UIButtonTypeCustom]; 35 | respringButton.frame = CGRectMake(0,0,30,30); 36 | respringButton.layer.cornerRadius = respringButton.frame.size.height / 2; 37 | respringButton.layer.masksToBounds = YES; 38 | respringButton.backgroundColor = [UIColor tableCellGroupedBackgroundColor]; 39 | [respringButton setImage:[UIImage systemImageNamed:@"checkmark.circle"] forState:UIControlStateNormal]; 40 | [respringButton addTarget:self action:@selector(apply:) forControlEvents:UIControlEventTouchUpInside]; 41 | respringButton.tintColor = [UIColor labelColor]; 42 | 43 | respringButtonItem = [[UIBarButtonItem alloc] initWithCustomView:respringButton]; 44 | 45 | self.navigationItem.rightBarButtonItem = respringButtonItem; 46 | self.navigationItem.titleView = [UIView new]; 47 | self.titleLabel = [[UILabel alloc] initWithFrame:CGRectMake(0, 0, 10, 10)]; 48 | self.titleLabel.font = [UIFont boldSystemFontOfSize:18]; 49 | self.titleLabel.translatesAutoresizingMaskIntoConstraints = NO; 50 | self.titleLabel.text = @""; 51 | self.titleLabel.textColor = [UIColor systemRedColor]; 52 | self.titleLabel.textAlignment = NSTextAlignmentCenter; 53 | [self.navigationItem.titleView addSubview:self.titleLabel]; 54 | 55 | self.iconView = [[UIImageView alloc] initWithFrame:CGRectMake(0, 0, 10, 10)]; 56 | self.iconView.contentMode = UIViewContentModeScaleAspectFit; 57 | self.iconView.image = [UIImage imageWithContentsOfFile:@"/Library/PreferenceBundles/shakeitoffprefs.bundle/icon.png"]; 58 | self.iconView.translatesAutoresizingMaskIntoConstraints = NO; 59 | self.iconView.alpha = 0.0; 60 | [self.navigationItem.titleView addSubview:self.iconView]; 61 | 62 | [NSLayoutConstraint activateConstraints:@[ 63 | [self.titleLabel.topAnchor constraintEqualToAnchor:self.navigationItem.titleView.topAnchor], 64 | [self.titleLabel.leadingAnchor constraintEqualToAnchor:self.navigationItem.titleView.leadingAnchor], 65 | [self.titleLabel.trailingAnchor constraintEqualToAnchor:self.navigationItem.titleView.trailingAnchor], 66 | [self.titleLabel.bottomAnchor constraintEqualToAnchor:self.navigationItem.titleView.bottomAnchor], 67 | [self.iconView.topAnchor constraintEqualToAnchor:self.navigationItem.titleView.topAnchor], 68 | [self.iconView.leadingAnchor constraintEqualToAnchor:self.navigationItem.titleView.leadingAnchor], 69 | [self.iconView.trailingAnchor constraintEqualToAnchor:self.navigationItem.titleView.trailingAnchor], 70 | [self.iconView.bottomAnchor constraintEqualToAnchor:self.navigationItem.titleView.bottomAnchor], 71 | ]]; 72 | 73 | } 74 | 75 | return self; 76 | 77 | } 78 | 79 | - (UIModalPresentationStyle)adaptivePresentationStyleForPresentationController:(UIPresentationController *)controller { 80 | 81 | return UIModalPresentationNone; 82 | } 83 | 84 | - (void)viewWillAppear:(BOOL)animated { 85 | 86 | [super viewWillAppear:animated]; 87 | 88 | CGRect frame = self.table.bounds; 89 | frame.origin.y = -frame.size.height; 90 | 91 | [self.navigationController.navigationController.navigationBar setShadowImage: [UIImage new]]; 92 | self.navigationController.navigationController.navigationBar.tintColor = [UIColor whiteColor]; 93 | self.navigationController.navigationController.navigationBar.translucent = NO; 94 | 95 | } 96 | 97 | - (UITableViewCell *)tableView:(UITableView *)tableView cellForRowAtIndexPath:(NSIndexPath *)indexPath { 98 | tableView.tableHeaderView = self.headerView; 99 | UITableViewCell *cell = [tableView cellForRowAtIndexPath:indexPath]; 100 | [cell setAccessoryType:UITableViewCellAccessoryDisclosureIndicator]; 101 | return [super tableView:tableView cellForRowAtIndexPath:indexPath]; 102 | } 103 | 104 | - (void)viewDidLoad { 105 | 106 | [super viewDidLoad]; 107 | 108 | _table.allowsMultipleSelection = YES; 109 | _table.allowsMultipleSelectionDuringEditing = YES; 110 | 111 | self.headerView = [[UIView alloc] initWithFrame:CGRectMake(0,0,200,200)]; 112 | self.headerImageView = [[UIImageView alloc] initWithFrame:CGRectMake(0,0,200,200)]; 113 | self.headerImageView.contentMode = UIViewContentModeScaleAspectFill; 114 | self.headerImageView.image = [UIImage imageWithContentsOfFile:@"/Library/PreferenceBundles/shakeitoffprefs.bundle/banner.png"]; 115 | self.headerImageView.translatesAutoresizingMaskIntoConstraints = NO; 116 | self.headerImageView.alpha = 1; 117 | 118 | [self.headerView addSubview:self.headerImageView]; 119 | [NSLayoutConstraint activateConstraints:@[ 120 | [self.headerImageView.topAnchor constraintEqualToAnchor:self.headerView.topAnchor], 121 | [self.headerImageView.leadingAnchor constraintEqualToAnchor:self.headerView.leadingAnchor], 122 | [self.headerImageView.trailingAnchor constraintEqualToAnchor:self.headerView.trailingAnchor], 123 | [self.headerImageView.bottomAnchor constraintEqualToAnchor:self.headerView.bottomAnchor], 124 | ]]; 125 | 126 | _table.tableHeaderView = self.headerView; 127 | 128 | secondaryHeaderImage = [[UIImageView alloc] initWithFrame:CGRectMake(0,0,200,200)]; 129 | secondaryHeaderImage.contentMode = UIViewContentModeScaleAspectFill; 130 | secondaryHeaderImage.image = [UIImage imageWithContentsOfFile:@"/Library/PreferenceBundles/shakeitoffprefs.bundle/banner2.png"]; 131 | secondaryHeaderImage.translatesAutoresizingMaskIntoConstraints = NO; 132 | secondaryHeaderImage.alpha = 0.0; 133 | [self.headerView addSubview:secondaryHeaderImage]; 134 | 135 | [NSLayoutConstraint activateConstraints:@[ 136 | [secondaryHeaderImage.topAnchor constraintEqualToAnchor:self.headerView.topAnchor], 137 | [secondaryHeaderImage.leadingAnchor constraintEqualToAnchor:self.headerView.leadingAnchor], 138 | [secondaryHeaderImage.trailingAnchor constraintEqualToAnchor:self.headerView.trailingAnchor], 139 | [secondaryHeaderImage.bottomAnchor constraintEqualToAnchor:self.headerView.bottomAnchor], 140 | ]]; 141 | 142 | [UIView animateWithDuration:0.2 delay:0 options: UIViewAnimationOptionAutoreverse | UIViewAnimationOptionRepeat animations:^{ 143 | secondaryHeaderImage.alpha = 1.0; 144 | self.headerImageView.alpha = 0; 145 | } completion:nil]; 146 | 147 | } 148 | 149 | - (void)scrollViewDidScroll:(UIScrollView *)scrollView { 150 | CGFloat offsetY = scrollView.contentOffset.y; 151 | 152 | if (offsetY > 200) { 153 | [UIView animateWithDuration:0.2 animations:^{ 154 | self.iconView.alpha = 1.0; 155 | self.titleLabel.alpha = 0.0; 156 | }]; 157 | } else { 158 | [UIView animateWithDuration:0.2 animations:^{ 159 | self.iconView.alpha = 0.0; 160 | self.titleLabel.alpha = 1.0; 161 | }]; 162 | } 163 | 164 | if (offsetY > 0) offsetY = 0; 165 | self.headerImageView.frame = CGRectMake(0, offsetY, self.headerView.frame.size.width, 200 - offsetY); 166 | } 167 | 168 | - (void)apply:(UIButton *)sender { 169 | 170 | popController = [[UIViewController alloc] init]; 171 | popController.modalPresentationStyle = UIModalPresentationPopover; 172 | popController.preferredContentSize = CGSizeMake(200,130); 173 | UILabel *respringLabel = [[UILabel alloc] init]; 174 | respringLabel.frame = CGRectMake(20, 20, 160, 60); 175 | respringLabel.numberOfLines = 2; 176 | respringLabel.textAlignment = NSTextAlignmentCenter; 177 | respringLabel.adjustsFontSizeToFitWidth = YES; 178 | respringLabel.font = [UIFont boldSystemFontOfSize:20]; 179 | respringLabel.textColor = [UIColor labelColor]; 180 | respringLabel.text = @"Are you sure you want to respring?"; 181 | [popController.view addSubview:respringLabel]; 182 | 183 | UIButton *yesButton = [UIButton buttonWithType:UIButtonTypeCustom]; 184 | [yesButton addTarget:self 185 | action:@selector(handleYesGesture:) 186 | forControlEvents:UIControlEventTouchUpInside]; 187 | [yesButton setTitle:@"Yes" forState:UIControlStateNormal]; 188 | [yesButton setTitleColor:[UIColor labelColor] forState:UIControlStateNormal]; 189 | yesButton.frame = CGRectMake(100, 100, 100, 30); 190 | [popController.view addSubview:yesButton]; 191 | 192 | UIButton *noButton = [UIButton buttonWithType:UIButtonTypeCustom]; 193 | [noButton addTarget:self 194 | action:@selector(handleNoGesture:) 195 | forControlEvents:UIControlEventTouchUpInside]; 196 | [noButton setTitle:@"No" forState:UIControlStateNormal]; 197 | [noButton setTitleColor:[UIColor labelColor] forState:UIControlStateNormal]; 198 | noButton.frame = CGRectMake(0, 100, 100, 30); 199 | [popController.view addSubview:noButton]; 200 | 201 | UIPopoverPresentationController *popover = popController.popoverPresentationController; 202 | popover.delegate = self; 203 | popover.permittedArrowDirections = UIPopoverArrowDirectionUp; 204 | popover.barButtonItem = respringButtonItem; 205 | 206 | [self presentViewController:popController animated:YES completion:nil]; 207 | 208 | AudioServicesPlaySystemSound(1519); 209 | 210 | } 211 | 212 | - (void)handleYesGesture:(UIButton *)sender { 213 | AudioServicesPlaySystemSound(1521); 214 | 215 | pid_t pid; 216 | const char* args[] = {"killall", "SpringBoard", NULL}; 217 | posix_spawn(&pid, "/usr/bin/killall", NULL, NULL, (char* const*)args, NULL); 218 | } 219 | 220 | - (void)handleNoGesture:(UIButton *)sender { 221 | [popController dismissViewControllerAnimated:YES completion:nil]; 222 | } 223 | @end 224 | 225 | @implementation SHAKEITOFFAppearanceSettings: HBAppearanceSettings 226 | 227 | - (UIColor *)tableViewCellSeparatorColor { 228 | 229 | return [UIColor clearColor]; 230 | 231 | } 232 | 233 | @end 234 | -------------------------------------------------------------------------------- /shakeitoffprefs/entry.plist: -------------------------------------------------------------------------------- 1 | 2 | 3 | 4 | 5 | entry 6 | 7 | bundle 8 | shakeitoffprefs 9 | cell 10 | PSLinkCell 11 | detail 12 | SHAKEITOFFPreferencesListController 13 | icon 14 | icon.png 15 | isController 16 | 17 | label 18 | ShakeItOff 19 | 20 | 21 | 22 | --------------------------------------------------------------------------------