鏡像自
https://github.com/gilshahar7/AVLock.git
已同步 2025-12-14 12:47:18 +00:00
Add files via upload
此提交包含在:
1
AVLock.plist
一般檔案
1
AVLock.plist
一般檔案
@ -0,0 +1 @@
|
||||
{ Filter = { Bundles = ( "com.apple.AVKit", "com.apple.springboard" ); }; }
|
||||
17
Makefile
一般檔案
17
Makefile
一般檔案
@ -0,0 +1,17 @@
|
||||
ARCHS = armv7 arm64
|
||||
|
||||
include $(THEOS)/makefiles/common.mk
|
||||
|
||||
TWEAK_NAME = AVLock
|
||||
AVLock_FILES = Tweak.xm
|
||||
AVLock_FRAMEWORKS = UIKit
|
||||
|
||||
include $(THEOS_MAKE_PATH)/tweak.mk
|
||||
|
||||
|
||||
BUNDLE_NAME = AVLockBundle
|
||||
AVLockBundle_INSTALL_PATH = /Library/MobileSubstrate/DynamicLibraries
|
||||
include $(THEOS)/makefiles/bundle.mk
|
||||
|
||||
after-install::
|
||||
install.exec "killall -9 SpringBoard"
|
||||
二進制
Resources/Test@2x.png
一般檔案
二進制
Resources/Test@2x.png
一般檔案
未顯示二進位檔案。
|
之後 寬度: | 高度: | 大小: 7.7 KiB |
54
Tweak.xm
一般檔案
54
Tweak.xm
一般檔案
@ -0,0 +1,54 @@
|
||||
#define kBundlePath @"/Library/MobileSubstrate/DynamicLibraries/AVLockBundle.bundle"
|
||||
|
||||
|
||||
@interface SBOrientationLockManager
|
||||
+(SBOrientationLockManager *)sharedInstance;
|
||||
-(bool)isUserLocked;
|
||||
-(void)lock;
|
||||
-(void)unlock;
|
||||
@end
|
||||
|
||||
@interface AVTransportControlsView
|
||||
-(void)addSubview:(id)arg1;
|
||||
@property CGRect frame;
|
||||
@end
|
||||
|
||||
static bool firstrun = true;
|
||||
|
||||
%hook AVTransportControlsView
|
||||
-(void)layoutSubviews{
|
||||
%orig;
|
||||
if(firstrun){
|
||||
UIButton *button = [UIButton buttonWithType:UIButtonTypeCustom];
|
||||
[button addTarget:self action:@selector(orientationButtonPressed)
|
||||
forControlEvents:UIControlEventTouchUpInside];
|
||||
|
||||
NSBundle *bundle = [[NSBundle alloc] initWithPath:kBundlePath];
|
||||
NSString *imagePath = [bundle pathForResource:@"Test" ofType:@"png"];
|
||||
UIImage *img = [UIImage imageWithContentsOfFile:imagePath];
|
||||
|
||||
[button setImage:img forState:UIControlStateNormal];
|
||||
[button setImage:img forState:UIControlStateHighlighted];
|
||||
[button setImage:img forState:UIControlStateSelected];
|
||||
button.contentMode = UIViewContentModeScaleToFill;
|
||||
button.frame = CGRectMake(0, 0, img.size.width, img.size.height);
|
||||
[self addSubview:button];
|
||||
firstrun = false;
|
||||
}
|
||||
}
|
||||
|
||||
-(void)dealloc{
|
||||
%orig;
|
||||
firstrun = true;
|
||||
}
|
||||
|
||||
%new
|
||||
-(void)orientationButtonPressed{
|
||||
if([[%c(SBOrientationLockManager) sharedInstance] isUserLocked]){
|
||||
[[%c(SBOrientationLockManager) sharedInstance] unlock];
|
||||
}else{
|
||||
[[%c(SBOrientationLockManager) sharedInstance] lock];
|
||||
}
|
||||
}
|
||||
|
||||
%end
|
||||
新增問題並參考
封鎖使用者