add iOS 13 support
This commit is contained in:
53
Tweak.xm
53
Tweak.xm
@ -1,3 +1,14 @@
|
|||||||
|
// respring function
|
||||||
|
@interface FBSystemService : NSObject
|
||||||
|
+(id)sharedInstance;
|
||||||
|
-(void)exitAndRelaunch:(bool)arg1;
|
||||||
|
@end
|
||||||
|
|
||||||
|
static void RespringDevice() {
|
||||||
|
[[%c(FBSystemService) sharedInstance] exitAndRelaunch:YES];
|
||||||
|
}
|
||||||
|
|
||||||
|
// headers
|
||||||
@interface SBUILegibilityLabel : UIView
|
@interface SBUILegibilityLabel : UIView
|
||||||
@property (nonatomic,copy) NSString *string;
|
@property (nonatomic,copy) NSString *string;
|
||||||
@property (assign,nonatomic) long long textAlignment;
|
@property (assign,nonatomic) long long textAlignment;
|
||||||
@ -25,54 +36,36 @@ static void notificationCallback(CFNotificationCenterRef center, void *observer,
|
|||||||
NSString *eCustomText = (NSString *)[[NSUserDefaults standardUserDefaults] objectForKey:@"customText" inDomain:nsDomainString];
|
NSString *eCustomText = (NSString *)[[NSUserDefaults standardUserDefaults] objectForKey:@"customText" inDomain:nsDomainString];
|
||||||
|
|
||||||
enabled = (eEnabled) ? [eEnabled boolValue]:NO;
|
enabled = (eEnabled) ? [eEnabled boolValue]:NO;
|
||||||
customText = eCustomText; //(eCustomText) ? [eCustomText value]:@"";
|
customText = eCustomText;
|
||||||
}
|
}
|
||||||
|
|
||||||
/*#ifndef kCFCoreFoundationVersionNumber_iOS_13_0
|
// check iOS version
|
||||||
|
#ifndef kCFCoreFoundationVersionNumber_iOS_13_0
|
||||||
#define kCFCoreFoundationVersionNumber_iOS_13_0 1665.15
|
#define kCFCoreFoundationVersionNumber_iOS_13_0 1665.15
|
||||||
#endif
|
#endif
|
||||||
|
|
||||||
#define kSLSystemVersioniOS13 kCFCoreFoundationVersionNumber >= kCFCoreFoundationVersionNumber_iOS_13_0*/
|
#define kSLSystemVersioniOS13 kCFCoreFoundationVersionNumber >= kCFCoreFoundationVersionNumber_iOS_13_0
|
||||||
|
|
||||||
/*%group ios13
|
|
||||||
|
|
||||||
%hook NCNotificationListSectionRevealHintView
|
|
||||||
|
|
||||||
-(void)setRevealHintTitle:(SBUILegibilityLabel *)arg1 {
|
|
||||||
if (enabled) {
|
|
||||||
arg1 = customText;
|
|
||||||
}
|
|
||||||
}
|
|
||||||
|
|
||||||
%end
|
|
||||||
|
|
||||||
%end*/
|
|
||||||
|
|
||||||
//%group ios12
|
|
||||||
|
|
||||||
|
// hook class
|
||||||
%hook NCNotificationListSectionRevealHintView
|
%hook NCNotificationListSectionRevealHintView
|
||||||
|
|
||||||
-(void)didMoveToWindow {
|
-(void)didMoveToWindow {
|
||||||
%orig;
|
%orig;
|
||||||
if (enabled) {
|
if (enabled) {
|
||||||
self.revealHintTitle.string = customText;
|
self.revealHintTitle.string = customText;
|
||||||
self.revealHintTitle.textAlignment = 1;
|
if (kSLSystemVersioniOS13) {
|
||||||
|
self.revealHintTitle.textAlignment = 1;
|
||||||
|
}
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
%end
|
%end
|
||||||
|
|
||||||
//%end
|
|
||||||
|
|
||||||
%ctor {
|
%ctor {
|
||||||
// check iOS version
|
// prefs changed listener
|
||||||
/*if (kSLSystemVersioniOS13) {
|
|
||||||
%init(ios13);
|
|
||||||
}
|
|
||||||
else {
|
|
||||||
%init(ios12);
|
|
||||||
}*/
|
|
||||||
|
|
||||||
notificationCallback(NULL, NULL, NULL, NULL, NULL);
|
notificationCallback(NULL, NULL, NULL, NULL, NULL);
|
||||||
CFNotificationCenterAddObserver(CFNotificationCenterGetDarwinNotifyCenter(), NULL, notificationCallback, (CFStringRef)nsNotificationString, NULL, CFNotificationSuspensionBehaviorCoalesce);
|
CFNotificationCenterAddObserver(CFNotificationCenterGetDarwinNotifyCenter(), NULL, notificationCallback, (CFStringRef)nsNotificationString, NULL, CFNotificationSuspensionBehaviorCoalesce);
|
||||||
|
|
||||||
|
// respring notification listener
|
||||||
|
CFNotificationCenterAddObserver(CFNotificationCenterGetDarwinNotifyCenter(), NULL, (CFNotificationCallback)RespringDevice, CFSTR("com.yaypixxo.cnon/respring"), NULL, CFNotificationSuspensionBehaviorDeliverImmediately);
|
||||||
}
|
}
|
@ -13,6 +13,7 @@
|
|||||||
|
|
||||||
- (void)apply {
|
- (void)apply {
|
||||||
[self.view endEditing:YES];
|
[self.view endEditing:YES];
|
||||||
|
CFNotificationCenterPostNotification(CFNotificationCenterGetDarwinNotifyCenter(), CFSTR("com.yaypixxo.cnon/respring"), NULL, NULL, YES);
|
||||||
}
|
}
|
||||||
|
|
||||||
- (void)openTwitter {
|
- (void)openTwitter {
|
||||||
|
@ -44,7 +44,7 @@
|
|||||||
<key>action</key>
|
<key>action</key>
|
||||||
<string>apply</string>
|
<string>apply</string>
|
||||||
<key>label</key>
|
<key>label</key>
|
||||||
<string>Apply</string>
|
<string>Respring</string>
|
||||||
</dict>
|
</dict>
|
||||||
<dict>
|
<dict>
|
||||||
<key>cell</key>
|
<key>cell</key>
|
||||||
|
Reference in New Issue
Block a user