Skip to content

Commit ffc8ba0

Browse files
committed
feat: add tweak settings quick-access
1 parent e3cb32f commit ffc8ba0

3 files changed

Lines changed: 32 additions & 0 deletions

File tree

‎src/Features/General/SCSettingsMenuEntry.x‎

Lines changed: 27 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -28,4 +28,31 @@
2828

2929
[SCIUtils showSettingsVC:[self window]];
3030
}
31+
%end
32+
33+
// Quick access to tweak settings by holding on home tab button
34+
%hook IGTabBarButton
35+
- (void)didMoveToSuperview {
36+
%orig;
37+
38+
// Only work on home/feed tab
39+
if (![self.accessibilityIdentifier isEqualToString:@"mainfeed-tab"]) return;
40+
41+
if ([SCIUtils getBoolPref:@"settings_shortcut"]) {
42+
UILongPressGestureRecognizer *longPress = [[UILongPressGestureRecognizer alloc] initWithTarget:self action:@selector(handleLongPress:)];
43+
longPress.minimumPressDuration = 0.3;
44+
45+
// Take precidence over existing gesture recognizers
46+
for (UIGestureRecognizer *existing in self.gestureRecognizers) {
47+
[existing requireGestureRecognizerToFail:longPress];
48+
}
49+
50+
[self addGestureRecognizer:longPress];
51+
}
52+
}
53+
%new - (void)handleLongPress:(UILongPressGestureRecognizer *)sender {
54+
if (sender.state != UIGestureRecognizerStateBegan) return;
55+
56+
[SCIUtils showSettingsVC:[self window]];
57+
}
3158
%end

‎src/InstagramHeaders.h‎

Lines changed: 4 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -468,6 +468,10 @@
468468
- (void)markLastMessageAsSeen;
469469
@end
470470

471+
@interface IGTabBarButton : UIButton
472+
- (void)addHandleLongPress; // new
473+
@end
474+
471475

472476

473477
/////////////////////////////////////////////////////////////////////////////

‎src/Settings/TweakSettings.m‎

Lines changed: 1 addition & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -217,6 +217,7 @@ + (NSArray *)sections {
217217
@{
218218
@"header": @"SCInsta",
219219
@"rows": @[
220+
[SCISetting switchCellWithTitle:@"Enable tweak settings quick-access" subtitle:@"Allows you to hold on the home tab to open the SCInsta settings" defaultsKey:@"settings_shortcut" requiresRestart:YES],
220221
[SCISetting switchCellWithTitle:@"Show tweak settings on app launch" subtitle:@"Automatically opens the SCInsta settings when the app launches" defaultsKey:@"tweak_settings_app_launch"],
221222
[SCISetting buttonCellWithTitle:@"Reset onboarding completion state"
222223
subtitle:@""

0 commit comments

Comments
 (0)