Skip to content

Commit f0fc7f7

Browse files
committed
fix: too many bugs
Signed-off-by: 82Flex <82flex@gmail.com>
1 parent 207bba3 commit f0fc7f7

12 files changed

Lines changed: 90 additions & 33 deletions

File tree

Tweak/DayNightSwitch.m

Lines changed: 3 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -431,8 +431,10 @@ - (void)tapGestureOccurred:(UITapGestureRecognizer *)sender {
431431
if (self.dragging) {
432432
return;
433433
}
434-
434+
435+
self.dragging = YES;
435436
self.on = !self.on;
437+
self.dragging = NO;
436438
}
437439

438440
- (void)setOn:(BOOL)on {
Lines changed: 33 additions & 11 deletions
Original file line numberDiff line numberDiff line change
@@ -1,5 +1,7 @@
11
#import "FGARootListController.h"
22

3+
#import <Preferences/PSSpecifier.h>
4+
35
#import <roothide.h>
46
#import <spawn.h>
57

@@ -9,41 +11,61 @@ - (NSArray *)specifiers {
911
if (!_specifiers) {
1012
_specifiers = [self loadSpecifiersFromPlistName:@"Root" target:self];
1113
}
12-
14+
1315
return _specifiers;
1416
}
1517

1618
- (void)respring {
1719
pid_t pid;
18-
const char* args[] = {"killall", "-9", "SpringBoard", "backboardd", NULL};
19-
posix_spawn(&pid, jbroot("/usr/bin/killall"), NULL, NULL, (char* const*)args, NULL);
20+
const char *args[] = {"killall", "-9", "SpringBoard", "backboardd", NULL};
21+
posix_spawn(&pid, jbroot("/usr/bin/killall"), NULL, NULL, (char *const *)args, NULL);
2022
}
2123

2224
- (void)twitter {
2325
UIApplication *app = [UIApplication sharedApplication];
2426
if ([app canOpenURL:[NSURL URLWithString:@"twitter://fga"]]) {
25-
[app openURL:[NSURL URLWithString:@"twitter://user?screen_name=fga"] options: @{} completionHandler: nil];
27+
[app openURL:[NSURL URLWithString:@"twitter://user?screen_name=fga"] options:@{} completionHandler:nil];
2628
} else if ([app canOpenURL:[NSURL URLWithString:@"tweetbot://fga/user_profile/fga"]]) {
27-
[app openURL:[NSURL URLWithString:@"tweetbot://fga/user_profile/fga"] options: @{} completionHandler: nil];
29+
[app openURL:[NSURL URLWithString:@"tweetbot://fga/user_profile/fga"] options:@{} completionHandler:nil];
2830
} else if ([app canOpenURL:[NSURL URLWithString:@"https://twitter.com/fga"]]) {
29-
[app openURL:[NSURL URLWithString:@"https://twitter.com/fga"] options: @{} completionHandler: nil];
31+
[app openURL:[NSURL URLWithString:@"https://twitter.com/fga"] options:@{} completionHandler:nil];
3032
}
3133
}
3234

3335
- (void)github {
34-
[self openURL: [NSURL URLWithString:@"https://github.com/finngaida"]];
36+
[self openURL:[NSURL URLWithString:@"https://github.com/finngaida"]];
3537
}
3638

3739
- (void)mail {
38-
[self openURL: [NSURL URLWithString:@"mailto:f@fga.pw?subject=DayNightSwitch%20Feature%20Request"]];
40+
[self openURL:[NSURL URLWithString:@"mailto:f@fga.pw?subject=DayNightSwitch%20Feature%20Request"]];
3941
}
4042

4143
- (void)paypal {
42-
[self openURL: [NSURL URLWithString:@"https://paypal.me/fga"]];
44+
[self openURL:[NSURL URLWithString:@"https://paypal.me/fga"]];
45+
}
46+
47+
- (void)support {
48+
[self openURL:[NSURL URLWithString:@"https://havoc.app/search/82Flex"]];
4349
}
4450

45-
-(void)openURL:(NSURL *)url {
46-
[[UIApplication sharedApplication] openURL: url options: @{} completionHandler: nil];
51+
- (void)openURL:(NSURL *)url {
52+
[[UIApplication sharedApplication] openURL:url options:@{} completionHandler:nil];
53+
}
54+
55+
- (UITableViewCell *)tableView:(UITableView *)tableView cellForRowAtIndexPath:(NSIndexPath *)indexPath {
56+
if (indexPath.section == 0) {
57+
PSSpecifier *specifier = [self specifierAtIndexPath:indexPath];
58+
NSString *key = [specifier propertyForKey:@"cell"];
59+
if ([key isEqualToString:@"PSButtonCell"]) {
60+
UITableViewCell *cell = [super tableView:tableView cellForRowAtIndexPath:indexPath];
61+
NSNumber *isDestructiveValue = [specifier propertyForKey:@"isDestructive"];
62+
BOOL isDestructive = [isDestructiveValue boolValue];
63+
cell.textLabel.textColor = isDestructive ? [UIColor systemRedColor] : [UIColor systemBlueColor];
64+
cell.textLabel.highlightedTextColor = isDestructive ? [UIColor systemRedColor] : [UIColor systemBlueColor];
65+
return cell;
66+
}
67+
}
68+
return [super tableView:tableView cellForRowAtIndexPath:indexPath];
4769
}
4870

4971
@end

Tweak/daynightswitch/Makefile

Lines changed: 0 additions & 4 deletions
Original file line numberDiff line numberDiff line change
@@ -12,7 +12,3 @@ DayNightSwitch_FRAMEWORKS += UIKit
1212
DayNightSwitch_PRIVATE_FRAMEWORKS += Preferences
1313

1414
include $(THEOS_MAKE_PATH)/bundle.mk
15-
16-
internal-stage::
17-
$(ECHO_NOTHING)mkdir -p $(THEOS_STAGING_DIR)/Library/PreferenceLoader/Preferences$(ECHO_END)
18-
$(ECHO_NOTHING)cp entry.plist $(THEOS_STAGING_DIR)/Library/PreferenceLoader/Preferences/DayNightSwitch.plist$(ECHO_END)

Tweak/daynightswitch/Resources/Root.plist

Lines changed: 24 additions & 17 deletions
Original file line numberDiff line numberDiff line change
@@ -8,49 +8,56 @@
88
<key>cell</key>
99
<string>PSGroupCell</string>
1010
<key>label</key>
11-
<string>Global</string>
12-
<key>footerText</key>
13-
<string>Switching this on will change ALL switches to show the DayNightSwitch instead of just the Do Not Disturb one.</string>
11+
<string></string>
1412
</dict>
1513
<dict>
1614
<key>cell</key>
1715
<string>PSSwitchCell</string>
1816
<key>default</key>
19-
<true/>
17+
<false/>
2018
<key>defaults</key>
2119
<string>de.finngaida.daynightswitch</string>
2220
<key>key</key>
23-
<string>enabled</string>
21+
<string>global</string>
2422
<key>label</key>
2523
<string>Enabled</string>
2624
</dict>
2725
<dict>
26+
<key>action</key>
27+
<string>respring</string>
2828
<key>cell</key>
29-
<string>PSSwitchCell</string>
30-
<key>default</key>
31-
<false/>
32-
<key>defaults</key>
33-
<string>de.finngaida.daynightswitch</string>
34-
<key>key</key>
35-
<string>global</string>
29+
<string>PSButtonCell</string>
3630
<key>label</key>
37-
<string>Enabled Globally</string>
31+
<string>Respring to Apply Changes</string>
32+
<key>isDestructive</key>
33+
<true/>
34+
</dict>
35+
36+
<dict>
37+
<key>cell</key>
38+
<string>PSGroupCell</string>
39+
<key>label</key>
40+
<string></string>
41+
<key>footerText</key>
42+
<string>Please support our paid works, thank you!</string>
3843
</dict>
3944
<dict>
40-
<key>action</key>
41-
<string>respring</string>
4245
<key>cell</key>
4346
<string>PSButtonCell</string>
4447
<key>label</key>
45-
<string>Respring</string>
48+
<string>Fixed with ♥ by OwnGoal Studio</string>
49+
<key>action</key>
50+
<string>support</string>
4651
</dict>
52+
4753
<dict>
4854
<key>cell</key>
4955
<string>PSGroupCell</string>
5056
<key>label</key>
5157
<string>About</string>
5258
<key>footerText</key>
53-
<string>Copyright ⓒ 2016 Finn Gaida</string>
59+
<string>Copyright ⓒ 2016 Finn Gaida
60+
Copyright ⓒ 2025 OwnGoal Studio</string>
5461
</dict>
5562
<dict>
5663
<key>action</key>
Lines changed: 2 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,2 @@
1+
/* No comment provided by engineer. */
2+
"CFBundleDisplayName" = "DayNightSwitch";
Lines changed: 13 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,13 @@
1+
"Enabled" = "Enabled";
2+
"Respring to Apply Changes" = "Respring to Apply Changes";
3+
"Fixed with ♥ by OwnGoal Studio" = "Fixed with ♥ by OwnGoal Studio";
4+
"Please support our paid works, thank you!" = "Please support our paid works, thank you!";
5+
"DayNightSwitch" = "DayNightSwitch";
6+
"About" = "About";
7+
"Follow me on Twitter (@fga)" = "Follow me on Twitter (@fga)";
8+
"Follow me on GitHub" = "Follow me on GitHub";
9+
"Send a feature request" = "Send a feature request";
10+
"Send a donation" = "Send a donation";
11+
"Copyright ⓒ 2016 Finn Gaida
12+
Copyright ⓒ 2025 OwnGoal Studio" = "Copyright ⓒ 2016 Finn Gaida
13+
Copyright ⓒ 2025 OwnGoal Studio";
-14 KB
Loading
-13.4 KB
Loading
-12.7 KB
Loading
Lines changed: 2 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,2 @@
1+
/* No comment provided by engineer. */
2+
"CFBundleDisplayName" = "日月开关";

0 commit comments

Comments
 (0)