├── .gitignore
├── LICENSE
├── Makefile
├── Preferences
├── Makefile
├── PullToRespring.plist
├── PullToRespring.png
├── PullToRespring@2x.png
└── PullToRespring@3x.png
├── PullToRespring.plist
├── README.md
├── Screenshots
├── Example.png
└── Settings.png
├── Tweak.xm
├── com.sassoty.pulltorespring_1.2_iphoneos-arm.deb
└── control
/.gitignore:
--------------------------------------------------------------------------------
1 | _
2 | obj
3 | .theos
4 | theos
5 | .DS_Store
6 | packages
7 |
--------------------------------------------------------------------------------
/LICENSE:
--------------------------------------------------------------------------------
1 | MIT License
2 |
3 | Copyright (c) 2017 Noah Saso
4 |
5 | Permission is hereby granted, free of charge, to any person obtaining a copy
6 | of this software and associated documentation files (the "Software"), to deal
7 | in the Software without restriction, including without limitation the rights
8 | to use, copy, modify, merge, publish, distribute, sublicense, and/or sell
9 | copies of the Software, and to permit persons to whom the Software is
10 | furnished to do so, subject to the following conditions:
11 |
12 | The above copyright notice and this permission notice shall be included in all
13 | copies or substantial portions of the Software.
14 |
15 | THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR
16 | IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY,
17 | FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE
18 | AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER
19 | LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM,
20 | OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN THE
21 | SOFTWARE.
22 |
--------------------------------------------------------------------------------
/Makefile:
--------------------------------------------------------------------------------
1 | ARCHS = arm64 armv7
2 | include $(THEOS)/makefiles/common.mk
3 |
4 | TWEAK_NAME = PullToRespring
5 | PullToRespring_FILES = Tweak.xm
6 | PullToRespring_FRAMEWORKS = UIKit
7 |
8 | include $(THEOS_MAKE_PATH)/tweak.mk
9 |
10 | after-install::
11 | # install.exec "killall -9 Preferences"
12 | install.exec "killall -9 SpringBoard"
13 | SUBPROJECTS += Preferences
14 | include $(THEOS_MAKE_PATH)/aggregate.mk
15 |
--------------------------------------------------------------------------------
/Preferences/Makefile:
--------------------------------------------------------------------------------
1 | include $(THEOS)/makefiles/common.mk
2 |
3 | internal-stage::
4 | $(ECHO_NOTHING)mkdir -p $(THEOS_STAGING_DIR)/Library/PreferenceLoader/Preferences$(ECHO_END)
5 | $(ECHO_NOTHING)cp PullToRespring.plist $(THEOS_STAGING_DIR)/Library/PreferenceLoader/Preferences/PullToRespring.plist$(ECHO_END)
6 | $(ECHO_NOTHING)cp *.png $(THEOS_STAGING_DIR)/Library/PreferenceLoader/Preferences/$(ECHO_END)
7 |
--------------------------------------------------------------------------------
/Preferences/PullToRespring.plist:
--------------------------------------------------------------------------------
1 |
2 |
3 |
4 |
5 | entry
6 |
7 | cell
8 | PSSwitchCell
9 | default
10 |
11 | defaults
12 | com.sassoty.pulltorespring
13 | icon
14 | PullToRespring.png
15 | key
16 | Enabled
17 | label
18 | PullToRespring
19 | PostNotification
20 | com.sassoty.pulltorespring.prefschanged
21 |
22 |
23 |
24 |
--------------------------------------------------------------------------------
/Preferences/PullToRespring.png:
--------------------------------------------------------------------------------
https://raw.githubusercontent.com/NoahSaso/PullToRespring/0b9d92f69a8f5cf794f5d9838788d06e4bf1745b/Preferences/PullToRespring.png
--------------------------------------------------------------------------------
/Preferences/PullToRespring@2x.png:
--------------------------------------------------------------------------------
https://raw.githubusercontent.com/NoahSaso/PullToRespring/0b9d92f69a8f5cf794f5d9838788d06e4bf1745b/Preferences/PullToRespring@2x.png
--------------------------------------------------------------------------------
/Preferences/PullToRespring@3x.png:
--------------------------------------------------------------------------------
https://raw.githubusercontent.com/NoahSaso/PullToRespring/0b9d92f69a8f5cf794f5d9838788d06e4bf1745b/Preferences/PullToRespring@3x.png
--------------------------------------------------------------------------------
/PullToRespring.plist:
--------------------------------------------------------------------------------
1 | { Filter = { Bundles = ( "com.apple.Preferences", "com.apple.springboard" ); }; }
2 |
--------------------------------------------------------------------------------
/README.md:
--------------------------------------------------------------------------------
1 | PullToRespring
2 | ==============
3 |
4 | Pull down in Settings app to respring device
5 |
--------------------------------------------------------------------------------
/Screenshots/Example.png:
--------------------------------------------------------------------------------
https://raw.githubusercontent.com/NoahSaso/PullToRespring/0b9d92f69a8f5cf794f5d9838788d06e4bf1745b/Screenshots/Example.png
--------------------------------------------------------------------------------
/Screenshots/Settings.png:
--------------------------------------------------------------------------------
https://raw.githubusercontent.com/NoahSaso/PullToRespring/0b9d92f69a8f5cf794f5d9838788d06e4bf1745b/Screenshots/Settings.png
--------------------------------------------------------------------------------
/Tweak.xm:
--------------------------------------------------------------------------------
1 | #import
2 | #import
3 |
4 | @interface PSListController (PullToRespring)
5 | - (id)table;
6 | @end
7 |
8 | @interface PrefsListController : PSListController
9 | @end
10 | @interface PSUIPrefsListController : PSListController
11 | @end
12 |
13 | // iOS 10
14 | @interface SBRestartManager : NSObject
15 | - (void)restartWithTransitionRequest:(id)arg1;
16 | @end
17 |
18 | // iOS 10
19 | @interface SBRestartTransitionRequest : NSObject
20 | @property(nonatomic) int restartType;
21 | - (id)initWithRequester:(id)arg1 reason:(id)arg2;
22 | @property(nonatomic) _Bool wantsPersistentSnapshot;
23 | @property(nonatomic) double delay;
24 | @end
25 |
26 | @interface SpringBoard : UIApplication
27 | - (void)_relaunchSpringBoardNow;
28 | - (void)_tearDownNow;
29 | // iOS 10
30 | @property(readonly, nonatomic) SBRestartManager *restartManager;
31 | @end
32 |
33 | @interface FBSSystemService : NSObject
34 | + (id)sharedService;
35 | - (void)sendActions:(id)arg1 withResult:(id)arg2;
36 | @end
37 |
38 | @interface SBSRestartRenderServerAction : NSObject
39 | + (id)restartActionWithTargetRelaunchURL:(id)arg1;
40 | @end
41 |
42 | @interface PTRRespringHandler : NSObject
43 | @property (nonatomic, assign) PSListController *listController;
44 | @property (nonatomic, strong) UIRefreshControl *refreshControl;
45 | + (instancetype)sharedInstance;
46 | - (void)refreshControlValueChangedFORDAYS:(UIRefreshControl *)refreshControl;
47 | - (void)updateRefreshControlExistence:(BOOL)shouldExist;
48 | @end
49 |
50 | // Take PSListController argument so we can add the refresh control to the view
51 | static UIRefreshControl *createRefreshControlWithListController(PSListController *listController) {
52 | // Remove previous if existing
53 | [PTRRespringHandler.sharedInstance updateRefreshControlExistence:NO];
54 | // Instantiate new refresh control
55 | UIRefreshControl *refreshControl = [UIRefreshControl new];
56 | [refreshControl addTarget:[PTRRespringHandler sharedInstance] action:@selector(refreshControlValueChangedFORDAYS:) forControlEvents:UIControlEventValueChanged];
57 | // Setup property references
58 | PTRRespringHandler.sharedInstance.listController = listController;
59 | PTRRespringHandler.sharedInstance.refreshControl = refreshControl;
60 | // Return refreshControl
61 | return refreshControl;
62 | }
63 |
64 | static void loadPreferences() {
65 | // Sync preferences and retrieve
66 | CFPreferencesAppSynchronize(CFSTR("com.sassoty.pulltorespring"));
67 | id isEnabledVal = (id)CFPreferencesCopyAppValue(CFSTR("Enabled"), CFSTR("com.sassoty.pulltorespring"));
68 | // Have the controller update the existence of the refresh control
69 | [PTRRespringHandler.sharedInstance updateRefreshControlExistence:(isEnabledVal ? [isEnabledVal boolValue] : YES)];
70 | }
71 |
72 | %group NonSB
73 |
74 | // iOS 8 & 7
75 | %hook PrefsListController
76 | - (void)viewDidAppear:(BOOL)animated {
77 | %orig;
78 | [self.table addSubview: createRefreshControlWithListController(self)];
79 | loadPreferences();
80 | }
81 | %end // End of PrefsListController
82 |
83 | // iOS 9 +
84 | %hook PSUIPrefsListController
85 | - (void)viewDidAppear:(BOOL)animated {
86 | %orig;
87 | [self.table addSubview: createRefreshControlWithListController(self)];
88 | loadPreferences();
89 | }
90 | %end // End of PSUIPrefsListController
91 |
92 | %end // %group NonSB
93 |
94 | @implementation PTRRespringHandler
95 |
96 | + (instancetype)sharedInstance {
97 | static PTRRespringHandler *sharedInstance = nil;
98 | static dispatch_once_t onceToken;
99 | dispatch_once(&onceToken, ^{
100 | sharedInstance = [PTRRespringHandler new];
101 | });
102 | return sharedInstance;
103 | }
104 |
105 | - (void)refreshControlValueChangedFORDAYS:(UIRefreshControl *)refreshControl {
106 | [refreshControl endRefreshing];
107 | // iOS 8 - 9
108 | if(%c(SBSRestartRenderServerAction) && %c(FBSSystemService)) {
109 | // Respring
110 | FBSSystemService *service = [%c(FBSSystemService) sharedService];
111 | [service sendActions:[NSSet setWithObject:[%c(SBSRestartRenderServerAction) restartActionWithTargetRelaunchURL:nil]] withResult:nil];
112 | // iOS 7- or 10+
113 | } else {
114 | // Respring
115 | HBLogDebug(@"notif respring")
116 | notify_post("com.sassoty.pulltorespring.respring");
117 | }
118 | }
119 |
120 | - (void)updateRefreshControlExistence:(BOOL)shouldExist {
121 | if(shouldExist) {
122 | [self.listController.table addSubview: createRefreshControlWithListController(self.listController)];
123 | }else {
124 | if(self.refreshControl) {
125 | [self.refreshControl removeFromSuperview];
126 | }
127 | }
128 | }
129 |
130 | @end
131 |
132 | static void respringSB() {
133 | SpringBoard *springBoard = (SpringBoard *)[UIApplication sharedApplication];
134 | if([springBoard respondsToSelector:@selector(_relaunchSpringBoardNow)]) {
135 | HBLogDebug(@"relaunch");
136 | [springBoard _relaunchSpringBoardNow];
137 | }else if([springBoard respondsToSelector:@selector(_tearDownNow)]) {
138 | HBLogDebug(@"tear down");
139 | [springBoard _tearDownNow];
140 | // iOS 10
141 | }else if([springBoard respondsToSelector:@selector(restartManager:willRestartWithTransitionRequest:)]) {
142 | HBLogDebug(@"restart manager");
143 | SBRestartTransitionRequest *request = [[%c(SBRestartTransitionRequest) alloc] initWithRequester:@"PullToRespring" reason:@"Pulled"];
144 | request.delay = 0.5f;
145 | [springBoard.restartManager restartWithTransitionRequest:request];
146 | }else {
147 | // This block shouldn't happen TO MY KNOWLEDGE on iOS 7+
148 | HBLogDebug(@"IF THIS IS CALLED, SOMETHING IS REALLLLLLLLLY WRONG");
149 | }
150 | }
151 |
152 | %ctor {
153 | if([[NSBundle mainBundle].bundleIdentifier isEqualToString:@"com.apple.springboard"]) {
154 | CFNotificationCenterAddObserver(CFNotificationCenterGetDarwinNotifyCenter(), NULL,
155 | (CFNotificationCallback)respringSB,
156 | CFSTR("com.sassoty.pulltorespring.respring"), NULL, CFNotificationSuspensionBehaviorDeliverImmediately);
157 | }else {
158 | CFNotificationCenterAddObserver(CFNotificationCenterGetDarwinNotifyCenter(), NULL,
159 | (CFNotificationCallback)loadPreferences,
160 | CFSTR("com.sassoty.pulltorespring.prefschanged"), NULL, CFNotificationSuspensionBehaviorDeliverImmediately);
161 | %init(NonSB);
162 | }
163 | }
164 |
--------------------------------------------------------------------------------
/com.sassoty.pulltorespring_1.2_iphoneos-arm.deb:
--------------------------------------------------------------------------------
https://raw.githubusercontent.com/NoahSaso/PullToRespring/0b9d92f69a8f5cf794f5d9838788d06e4bf1745b/com.sassoty.pulltorespring_1.2_iphoneos-arm.deb
--------------------------------------------------------------------------------
/control:
--------------------------------------------------------------------------------
1 | Package: com.sassoty.pulltorespring
2 | Name: PullToRespring
3 | Depends: mobilesubstrate
4 | Version: 1.2
5 | Architecture: iphoneos-arm
6 | Description: Pull down in Settings to respring
7 | Maintainer: Noah Saso
8 | Author: Noah Saso
9 | Section: Tweaks
10 | Depiction: http://repo.noahsaso.com/deps.php?pkg=com.sassoty.pulltorespring
11 |
--------------------------------------------------------------------------------