This repository was archived by the owner on Jul 9, 2024. It is now read-only.
-
Notifications
You must be signed in to change notification settings - Fork 1
Expand file tree
/
Copy pathTweak.x
More file actions
58 lines (43 loc) · 1.77 KB
/
Tweak.x
File metadata and controls
58 lines (43 loc) · 1.77 KB
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
52
53
54
55
56
57
58
/**
* Copyright (c) 2024 Nightwind. All rights reserved.
*/
#import <UIKit/UIKit.h>
#import "SpringBoard.h"
#import "SnowBoard.h"
/* Fix Badges */
%hook SBIconBadgeView
%property (nonatomic, strong) UIImageView *_sb16fix_badgeBackgroundView;
- (void)didMoveToSuperview {
%orig;
// Get image which contains background and text
UIImageView *const backgroundView = [self safeValueForKey:@"_backgroundView"];
if (!backgroundView) return;
// SnowBoard badge image
UIImage *const image = [[[[%c(SnowBoardThemeLoader) sharedInstance] springboardTheme] badgeBackground] imageWithScale:[[UIScreen mainScreen] scale]];
if (!image) return;
// Only add image once
if ([backgroundView.subviews containsObject:self._sb16fix_badgeBackgroundView]) return;
// Make image view
self._sb16fix_badgeBackgroundView = [[UIImageView alloc] initWithImage:image];
self._sb16fix_badgeBackgroundView.translatesAutoresizingMaskIntoConstraints = NO;
// self._sb16fix_badgeBackgroundView.frame = CGRectMake(0, 0, 40, 40);
[backgroundView insertSubview:self._sb16fix_badgeBackgroundView atIndex:0];
// Activate constraints
[NSLayoutConstraint activateConstraints:@[
[self._sb16fix_badgeBackgroundView.widthAnchor constraintEqualToAnchor:backgroundView.widthAnchor],
[self._sb16fix_badgeBackgroundView.heightAnchor constraintEqualToAnchor:backgroundView.heightAnchor],
[self._sb16fix_badgeBackgroundView.centerXAnchor constraintEqualToAnchor:backgroundView.centerXAnchor],
[self._sb16fix_badgeBackgroundView.centerYAnchor constraintEqualToAnchor:backgroundView.centerYAnchor]
]];
}
+ (UIColor *)badgeBackgroundColor {
return [UIColor clearColor];
}
%end
/* Crash Fix */
%hook SBIconController
%new
- (SBLibraryViewController *)libraryViewController {
return [self overlayLibraryViewController];
}
%end