Skip to content

Commit d7e224b

Browse files
committed
style: add mark comments for sections
1 parent e209535 commit d7e224b

3 files changed

Lines changed: 47 additions & 36 deletions

File tree

src/Tweak.x

Lines changed: 9 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -18,7 +18,7 @@ NSString *SCIVersionString = @"v1.2.0-dev";
1818
// Variables that work across features
1919
BOOL dmVisualMsgsViewedButtonEnabled = false;
2020

21-
// Tweak first-time setup
21+
// MARK: Tweak first-time setup
2222
%hook IGInstagramAppDelegate
2323
- (_Bool)application:(UIApplication *)application willFinishLaunchingWithOptions:(id)arg2 {
2424
// Default SCInsta config
@@ -93,6 +93,8 @@ BOOL dmVisualMsgsViewedButtonEnabled = false;
9393
}
9494
%end
9595

96+
// MARK: Liquid glass
97+
9698
%hook IGDSLauncherConfig
9799
- (_Bool)isLiquidGlassInAppNotificationEnabled {
98100
return [SCIUtils liquidGlassEnabledBool:%orig];
@@ -111,6 +113,8 @@ BOOL dmVisualMsgsViewedButtonEnabled = false;
111113
}
112114
%end
113115

116+
// MARK: Bug reports
117+
114118
// Disable sending modded insta bug reports
115119
%hook IGWindow
116120
- (void)showDebugMenu {
@@ -130,6 +134,8 @@ shouldPersistLastBugReportId:(id)arg6
130134
}
131135
%end
132136

137+
// MARK: Screenshots
138+
133139
// Disable anti-screenshot feature on visual messages
134140
%hook IGStoryViewerContainerView
135141
- (void)setShouldBlockScreenshot:(BOOL)arg1 viewModel:(id)arg2 { VOID_HANDLESCREENSHOT(%orig); }
@@ -190,7 +196,7 @@ shouldPersistLastBugReportId:(id)arg6
190196

191197
/////////////////////////////////////////////////////////////////////////////
192198

193-
// Hide items
199+
// MARK: Hide items
194200

195201
// Direct suggested chats (in search bar)
196202
BOOL showSearchSectionLabelForTag(NSInteger tag) {
@@ -600,7 +606,7 @@ BOOL showSearchSectionLabelForTag(NSInteger tag) {
600606

601607
/////////////////////////////////////////////////////////////////////////////
602608

603-
// Confirm buttons
609+
// MARK: Confirm buttons
604610

605611
%hook IGFeedItemUFICell
606612
- (void)UFIButtonBarDidTapOnLike:(id)arg1 {

src/Utils.h

Lines changed: 9 additions & 8 deletions
Original file line numberDiff line numberDiff line change
@@ -21,15 +21,22 @@
2121

2222
@interface SCIUtils : NSObject
2323

24+
// Preferences
2425
+ (BOOL)getBoolPref:(NSString *)key;
2526
+ (double)getDoublePref:(NSString *)key;
2627
+ (NSString *)getStringPref:(NSString *)key;
2728

29+
// Misc
30+
+ (NSString *)IGVersionString;
31+
+ (BOOL)isNotch;
32+
33+
+ (BOOL)existingLongPressGestureRecognizerForView:(UIView *)view;
34+
2835
+ (_Bool)liquidGlassEnabledBool:(_Bool)fallback;
2936

3037
+ (void)cleanCache;
3138

32-
// Displaying View Controllers
39+
// Display View Controllers
3340
+ (void)showQuickLookVC:(NSArray<id> *)items;
3441
+ (void)showShareVC:(id)item;
3542
+ (void)showSettingsVC:(UIWindow *)window;
@@ -51,17 +58,11 @@
5158
+ (NSURL *)getVideoUrl:(IGVideo *)video;
5259
+ (NSURL *)getVideoUrlForMedia:(IGMedia *)media;
5360

54-
// View Controllers
61+
// View Controller Helpers
5562
+ (UIViewController *)viewControllerForView:(UIView *)view;
5663
+ (UIViewController *)viewControllerForAncestralView:(UIView *)view;
5764
+ (UIViewController *)nearestViewControllerForView:(UIView *)view;
5865

59-
// Functions
60-
+ (NSString *)IGVersionString;
61-
+ (BOOL)isNotch;
62-
63-
+ (BOOL)existingLongPressGestureRecognizerForView:(UIView *)view;
64-
6566
// Alerts
6667
+ (BOOL)showConfirmation:(void(^)(void))okHandler title:(NSString *)title;
6768
+ (BOOL)showConfirmation:(void(^)(void))okHandler cancelHandler:(void(^)(void))cancelHandler title:(NSString *)title;

src/Utils.m

Lines changed: 29 additions & 25 deletions
Original file line numberDiff line numberDiff line change
@@ -18,6 +18,27 @@ + (NSString *)getStringPref:(NSString *)key {
1818
return [[NSUserDefaults standardUserDefaults] stringForKey:key];
1919
}
2020

21+
// MARK: Misc
22+
23+
+ (NSString *)IGVersionString {
24+
return [[[NSBundle mainBundle] infoDictionary] objectForKey:@"CFBundleShortVersionString"];
25+
};
26+
+ (BOOL)isNotch {
27+
return [[[UIApplication sharedApplication] keyWindow] safeAreaInsets].bottom > 0;
28+
};
29+
30+
+ (BOOL)existingLongPressGestureRecognizerForView:(UIView *)view {
31+
NSArray *allRecognizers = view.gestureRecognizers;
32+
33+
for (UIGestureRecognizer *recognizer in allRecognizers) {
34+
if ([[recognizer class] isSubclassOfClass:[UILongPressGestureRecognizer class]]) {
35+
return YES;
36+
}
37+
}
38+
39+
return NO;
40+
}
41+
2142
+ (_Bool)liquidGlassEnabledBool:(_Bool)fallback {
2243
BOOL setting = [SCIUtils getBoolPref:@"liquid_glass_surfaces"];
2344
return setting ? true : fallback;
@@ -72,7 +93,7 @@ + (void)cleanCache {
7293

7394
}
7495

75-
// Displaying View Controllers
96+
// MARK: Display View Controllers
7697
+ (void)showQuickLookVC:(NSArray<id> *)items {
7798
QLPreviewController *previewController = [[QLPreviewController alloc] init];
7899
QuickLookDelegate *quickLookDelegate = [[QuickLookDelegate alloc] initWithPreviewItemURLs:items];
@@ -97,12 +118,12 @@ + (void)showSettingsVC:(UIWindow *)window {
97118
[rootController presentViewController:navigationController animated:YES completion:nil];
98119
}
99120

100-
// Colours
121+
// MARK: Colours
101122
+ (UIColor *)SCIColor_Primary {
102123
return [UIColor colorWithRed:0/255.0 green:152/255.0 blue:254/255.0 alpha:1];
103124
};
104125

105-
// Errors
126+
// MARK: Errors
106127
+ (NSError *)errorWithDescription:(NSString *)errorDesc {
107128
return [self errorWithDescription:errorDesc code:1];
108129
}
@@ -125,7 +146,7 @@ + (JGProgressHUD *)showErrorHUDWithDescription:(NSString *)errorDesc dismissAfte
125146
return hud;
126147
}
127148

128-
// Media
149+
// MARK: Media
129150
+ (NSURL *)getPhotoUrl:(IGPhoto *)photo {
130151
if (!photo) return nil;
131152

@@ -167,7 +188,7 @@ + (NSURL *)getVideoUrlForMedia:(IGMedia *)media {
167188
return [SCIUtils getVideoUrl:video];
168189
}
169190

170-
// View Controllers
191+
// MARK: View Controller Helpers
171192
+ (UIViewController *)viewControllerForView:(UIView *)view {
172193
NSString *viewDelegate = @"viewDelegate";
173194
if ([view respondsToSelector:NSSelectorFromString(viewDelegate)]) {
@@ -191,26 +212,9 @@ + (UIViewController *)nearestViewControllerForView:(UIView *)view {
191212
}
192213

193214
// Functions
194-
+ (NSString *)IGVersionString {
195-
return [[[NSBundle mainBundle] infoDictionary] objectForKey:@"CFBundleShortVersionString"];
196-
};
197-
+ (BOOL)isNotch {
198-
return [[[UIApplication sharedApplication] keyWindow] safeAreaInsets].bottom > 0;
199-
};
200-
201-
+ (BOOL)existingLongPressGestureRecognizerForView:(UIView *)view {
202-
NSArray *allRecognizers = view.gestureRecognizers;
203215

204-
for (UIGestureRecognizer *recognizer in allRecognizers) {
205-
if ([[recognizer class] isSubclassOfClass:[UILongPressGestureRecognizer class]]) {
206-
return YES;
207-
}
208-
}
209-
210-
return NO;
211-
}
212216

213-
// Alerts
217+
// MARK: Alerts
214218
+ (BOOL)showConfirmation:(void(^)(void))okHandler title:(NSString *)title {
215219
UIAlertController* alert = [UIAlertController alertControllerWithTitle:title message:@"Are you sure?" preferredStyle:UIAlertControllerStyleAlert];
216220
[alert addAction:[UIAlertAction actionWithTitle:@"Yes" style:UIAlertActionStyleDefault handler:^(UIAlertAction * _Nonnull action) {
@@ -253,7 +257,7 @@ + (void)showRestartConfirmation {
253257
[topMostController() presentViewController:alert animated:YES completion:nil];
254258
};
255259

256-
// Toasts
260+
// MARK: Toasts
257261
+ (void)showToastForDuration:(double)duration title:(NSString *)title {
258262
[SCIUtils showToastForDuration:duration title:title subtitle:nil];
259263
}
@@ -282,7 +286,7 @@ + (void)showToastForDuration:(double)duration title:(NSString *)title subtitle:(
282286
[toastPresenter showAlertWithViewModel:model isAnimated:true animationDuration:duration presentationPriority:0 tapActionBlock:nil presentedHandler:nil dismissedHandler:nil];
283287
}
284288

285-
// Math
289+
// MARK: Math
286290
+ (NSUInteger)decimalPlacesInDouble:(double)value {
287291
NSNumberFormatter *formatter = [[NSNumberFormatter alloc] init];
288292
[formatter setNumberStyle:NSNumberFormatterDecimalStyle];

0 commit comments

Comments
 (0)