mirror of
https://github.com/gilshahar7/AVLock.git
synced 2025-06-28 00:46:45 +00:00
Version 1.0.3
Added a12 compatability. Fixed a bug where AVLock's button was overlapping.
This commit is contained in:
4
Makefile
4
Makefile
@ -1,5 +1,5 @@
|
|||||||
ARCHS = armv7 arm64
|
ARCHS = armv7 arm64 arm64e
|
||||||
|
export TARGET = iphone:clang:11.2:7.0
|
||||||
include $(THEOS)/makefiles/common.mk
|
include $(THEOS)/makefiles/common.mk
|
||||||
|
|
||||||
TWEAK_NAME = AVLock
|
TWEAK_NAME = AVLock
|
||||||
|
44
Tweak.xm
44
Tweak.xm
@ -21,7 +21,8 @@
|
|||||||
|
|
||||||
@end
|
@end
|
||||||
|
|
||||||
|
//#import <AudioToolbox/AudioToolbox.h>
|
||||||
|
//#import <AudioToolbox/AudioServices.h>
|
||||||
|
|
||||||
extern "C" CFNotificationCenterRef CFNotificationCenterGetDistributedCenter(void);
|
extern "C" CFNotificationCenterRef CFNotificationCenterGetDistributedCenter(void);
|
||||||
|
|
||||||
@ -66,13 +67,13 @@ CFNotificationCenterAddObserver(CFNotificationCenterGetDarwinNotifyCenter(),
|
|||||||
(void*)myObserver,
|
(void*)myObserver,
|
||||||
toggle,
|
toggle,
|
||||||
CFSTR("avlock.toggle"),
|
CFSTR("avlock.toggle"),
|
||||||
NULL,
|
NULL,
|
||||||
CFNotificationSuspensionBehaviorDeliverImmediately);
|
CFNotificationSuspensionBehaviorDeliverImmediately);
|
||||||
CFNotificationCenterAddObserver(CFNotificationCenterGetDarwinNotifyCenter(),
|
CFNotificationCenterAddObserver(CFNotificationCenterGetDarwinNotifyCenter(),
|
||||||
(void*)myObserver,
|
(void*)myObserver,
|
||||||
firstUpdate,
|
firstUpdate,
|
||||||
CFSTR("avlock.firstUpdate"),
|
CFSTR("avlock.firstUpdate"),
|
||||||
NULL,
|
NULL,
|
||||||
CFNotificationSuspensionBehaviorDeliverImmediately);
|
CFNotificationSuspensionBehaviorDeliverImmediately);
|
||||||
|
|
||||||
return self;
|
return self;
|
||||||
@ -96,13 +97,24 @@ CFNotificationCenterAddObserver(CFNotificationCenterGetDarwinNotifyCenter(),
|
|||||||
}
|
}
|
||||||
|
|
||||||
%end
|
%end
|
||||||
|
double delayInSeconds = 0.13;
|
||||||
|
|
||||||
|
%hook AVPlaybackControlsVisibilityControllerItem
|
||||||
|
-(BOOL)wantsAnimatedTransitionToHidden:(BOOL)arg1 alpha:(double)arg2{
|
||||||
|
if(!arg1){
|
||||||
|
delayInSeconds = 0.0;
|
||||||
|
[[NSNotificationCenter defaultCenter] postNotificationName:UIDeviceOrientationDidChangeNotification object:nil];
|
||||||
|
//AudioServicesPlaySystemSound(1103);
|
||||||
|
delayInSeconds = 0.13;
|
||||||
|
}
|
||||||
|
return %orig;
|
||||||
|
}
|
||||||
|
%end
|
||||||
|
|
||||||
%hook AVTransportControlsView
|
%hook AVTransportControlsView
|
||||||
int test = 30;
|
int test = 30;
|
||||||
|
|
||||||
|
|
||||||
// iOS 12
|
// iOS 12
|
||||||
-(AVTransportControlsView *)initWithFrame:(CGRect)frame styleSheet:(id)arg2 captureView:(id)arg3{
|
-(AVTransportControlsView *)initWithFrame:(CGRect)frame styleSheet:(id)arg2 captureView:(id)arg3{
|
||||||
AVTransportControlsView *origself = %orig(frame,arg2,arg3);
|
AVTransportControlsView *origself = %orig(frame,arg2,arg3);
|
||||||
@ -110,13 +122,13 @@ int test = 30;
|
|||||||
(void*)myObserver,
|
(void*)myObserver,
|
||||||
lockButton,
|
lockButton,
|
||||||
CFSTR("avlock.lockButton"),
|
CFSTR("avlock.lockButton"),
|
||||||
NULL,
|
NULL,
|
||||||
CFNotificationSuspensionBehaviorDeliverImmediately);
|
CFNotificationSuspensionBehaviorDeliverImmediately);
|
||||||
CFNotificationCenterAddObserver(CFNotificationCenterGetDarwinNotifyCenter(),
|
CFNotificationCenterAddObserver(CFNotificationCenterGetDarwinNotifyCenter(),
|
||||||
(void*)myObserver,
|
(void*)myObserver,
|
||||||
unlockButton,
|
unlockButton,
|
||||||
CFSTR("avlock.unlockButton"),
|
CFSTR("avlock.unlockButton"),
|
||||||
NULL,
|
NULL,
|
||||||
CFNotificationSuspensionBehaviorDeliverImmediately);
|
CFNotificationSuspensionBehaviorDeliverImmediately);
|
||||||
button = [UIButton buttonWithType:UIButtonTypeCustom];
|
button = [UIButton buttonWithType:UIButtonTypeCustom];
|
||||||
[button addTarget:self action:@selector(orientationButtonPressed) forControlEvents:UIControlEventTouchUpInside];
|
[button addTarget:self action:@selector(orientationButtonPressed) forControlEvents:UIControlEventTouchUpInside];
|
||||||
@ -128,7 +140,7 @@ int test = 30;
|
|||||||
[self addSubview:button];
|
[self addSubview:button];
|
||||||
[[UIDevice currentDevice] beginGeneratingDeviceOrientationNotifications];
|
[[UIDevice currentDevice] beginGeneratingDeviceOrientationNotifications];
|
||||||
[[NSNotificationCenter defaultCenter] addObserver:self selector:@selector(deviceOrientationDidChange) name:UIDeviceOrientationDidChangeNotification object:nil];
|
[[NSNotificationCenter defaultCenter] addObserver:self selector:@selector(deviceOrientationDidChange) name:UIDeviceOrientationDidChangeNotification object:nil];
|
||||||
|
|
||||||
return origself;
|
return origself;
|
||||||
}
|
}
|
||||||
|
|
||||||
@ -139,13 +151,13 @@ int test = 30;
|
|||||||
(void*)myObserver,
|
(void*)myObserver,
|
||||||
lockButton,
|
lockButton,
|
||||||
CFSTR("avlock.lockButton"),
|
CFSTR("avlock.lockButton"),
|
||||||
NULL,
|
NULL,
|
||||||
CFNotificationSuspensionBehaviorDeliverImmediately);
|
CFNotificationSuspensionBehaviorDeliverImmediately);
|
||||||
CFNotificationCenterAddObserver(CFNotificationCenterGetDarwinNotifyCenter(),
|
CFNotificationCenterAddObserver(CFNotificationCenterGetDarwinNotifyCenter(),
|
||||||
(void*)myObserver,
|
(void*)myObserver,
|
||||||
unlockButton,
|
unlockButton,
|
||||||
CFSTR("avlock.unlockButton"),
|
CFSTR("avlock.unlockButton"),
|
||||||
NULL,
|
NULL,
|
||||||
CFNotificationSuspensionBehaviorDeliverImmediately);
|
CFNotificationSuspensionBehaviorDeliverImmediately);
|
||||||
button = [UIButton buttonWithType:UIButtonTypeCustom];
|
button = [UIButton buttonWithType:UIButtonTypeCustom];
|
||||||
[button addTarget:self action:@selector(orientationButtonPressed) forControlEvents:UIControlEventTouchUpInside];
|
[button addTarget:self action:@selector(orientationButtonPressed) forControlEvents:UIControlEventTouchUpInside];
|
||||||
@ -157,14 +169,14 @@ int test = 30;
|
|||||||
[self addSubview:button];
|
[self addSubview:button];
|
||||||
[[UIDevice currentDevice] beginGeneratingDeviceOrientationNotifications];
|
[[UIDevice currentDevice] beginGeneratingDeviceOrientationNotifications];
|
||||||
[[NSNotificationCenter defaultCenter] addObserver:self selector:@selector(deviceOrientationDidChange) name:UIDeviceOrientationDidChangeNotification object:nil];
|
[[NSNotificationCenter defaultCenter] addObserver:self selector:@selector(deviceOrientationDidChange) name:UIDeviceOrientationDidChangeNotification object:nil];
|
||||||
|
|
||||||
return origself;
|
return origself;
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|
||||||
-(void)dealloc{
|
-(void)dealloc{
|
||||||
%orig;
|
%orig;
|
||||||
CFNotificationCenterRemoveObserver ( CFNotificationCenterGetDarwinNotifyCenter(), (void*)myObserver, NULL, NULL);
|
CFNotificationCenterRemoveObserver ( CFNotificationCenterGetDarwinNotifyCenter(), (void*)myObserver, NULL, NULL);
|
||||||
test = 30;
|
test = 30;
|
||||||
}
|
}
|
||||||
|
|
||||||
@ -178,7 +190,7 @@ int test = 30;
|
|||||||
|
|
||||||
%new
|
%new
|
||||||
-(void)deviceOrientationDidChange{
|
-(void)deviceOrientationDidChange{
|
||||||
double delayInSeconds = 0.13;
|
|
||||||
dispatch_time_t popTime = dispatch_time(DISPATCH_TIME_NOW, delayInSeconds * NSEC_PER_SEC);
|
dispatch_time_t popTime = dispatch_time(DISPATCH_TIME_NOW, delayInSeconds * NSEC_PER_SEC);
|
||||||
dispatch_after(popTime, dispatch_get_main_queue(), ^(void){
|
dispatch_after(popTime, dispatch_get_main_queue(), ^(void){
|
||||||
|
|
||||||
@ -189,13 +201,13 @@ dispatch_after(popTime, dispatch_get_main_queue(), ^(void){
|
|||||||
CGPoint point = self.standardPlayPauseButton.frame.origin;
|
CGPoint point = self.standardPlayPauseButton.frame.origin;
|
||||||
point.x = (self.skipForwardButton.frame.origin.x - 40);
|
point.x = (self.skipForwardButton.frame.origin.x - 40);
|
||||||
[self.standardPlayPauseButton setFrame:CGRectMake(point.x, point.y, self.standardPlayPauseButton.frame.size.width, self.standardPlayPauseButton.frame.size.height)];
|
[self.standardPlayPauseButton setFrame:CGRectMake(point.x, point.y, self.standardPlayPauseButton.frame.size.width, self.standardPlayPauseButton.frame.size.height)];
|
||||||
|
|
||||||
point = self.skipBackButton.frame.origin;
|
point = self.skipBackButton.frame.origin;
|
||||||
point.x = (self.standardPlayPauseButton.frame.origin.x - 40);
|
point.x = (self.standardPlayPauseButton.frame.origin.x - 40);
|
||||||
[self.skipBackButton setFrame:CGRectMake(point.x, point.y, self.skipBackButton.frame.size.width, self.skipBackButton.frame.size.height)];
|
[self.skipBackButton setFrame:CGRectMake(point.x, point.y, self.skipBackButton.frame.size.width, self.skipBackButton.frame.size.height)];
|
||||||
|
|
||||||
[button setFrame:CGRectMake(self.standardPlayPauseButton.frame.origin.x-93.5, self.standardPlayPauseButton.frame.origin.y, 46, 46)];
|
[button setFrame:CGRectMake(self.standardPlayPauseButton.frame.origin.x-93.5, self.standardPlayPauseButton.frame.origin.y, 46, 46)];
|
||||||
|
|
||||||
}
|
}
|
||||||
else if(orientation == UIInterfaceOrientationPortrait){
|
else if(orientation == UIInterfaceOrientationPortrait){
|
||||||
button.frame = CGRectMake((self.skipBackButton.frame.origin.x - 62), self.skipBackButton.frame.origin.y, 46, 46);
|
button.frame = CGRectMake((self.skipBackButton.frame.origin.x - 62), self.skipBackButton.frame.origin.y, 46, 46);
|
||||||
|
BIN
com.gilshahar7.avlock_1.0.3_iphoneos-arm.deb
Normal file
BIN
com.gilshahar7.avlock_1.0.3_iphoneos-arm.deb
Normal file
Binary file not shown.
Reference in New Issue
Block a user