commit 8d9472a3a69cddd3e5fa084ba140959d9b40febb Author: Jamie Berghmans Date: Sat Dec 28 23:59:06 2019 +0100 Initial commit diff --git a/.gitignore b/.gitignore new file mode 100644 index 0000000..f5f6458 --- /dev/null +++ b/.gitignore @@ -0,0 +1,3 @@ +.DS_Store +.theos +packages \ No newline at end of file diff --git a/AutoReplay.plist b/AutoReplay.plist new file mode 100644 index 0000000..d7db307 --- /dev/null +++ b/AutoReplay.plist @@ -0,0 +1 @@ +{ Filter = { Bundles = ( "com.apple.mobileslideshow" ); }; } diff --git a/Makefile b/Makefile new file mode 100644 index 0000000..3da2a09 --- /dev/null +++ b/Makefile @@ -0,0 +1,11 @@ +export ARCHS = armv7 arm64 arm64e + +include ~/theos/makefiles/common.mk + +TWEAK_NAME = AutoReplay +AutoReplay_FILES = Tweak.xm + +include $(THEOS_MAKE_PATH)/tweak.mk + +after-install:: + install.exec "killall -9 SpringBoard" diff --git a/Tweak.xm b/Tweak.xm new file mode 100644 index 0000000..5c421fa --- /dev/null +++ b/Tweak.xm @@ -0,0 +1,77 @@ +typedef struct { + long long value; + int timescale; + unsigned int flags; + long long epoch; + } TIME; + +@interface PUBrowsingVideoPlayer +-(void)videoSessionDidPlayToEnd:(id)arg1; //IOS12 +-(void)avPlayer:(id)arg1 itemDidPlayToEnd:(id)arg2; //IOS13 +-(void)seekToTime:(TIME)arg1 toleranceBefore:(TIME)arg2 toleranceAfter:(TIME)arg3 completionHandler:(id)arg4; +-(void)seekToTime:(TIME)arg1 completionHandler:(id)arg2; +-(TIME)currentTime; +-(void)_updateVideoSessionDesiredPlayState; +-(void)rewindExistingPlayer; +@property(nonatomic) long long desiredPlayState; +@end + + + + + +%group IOS12 +%hook PUBrowsingVideoPlayer + +- (void)avPlayer:(id)arg1 itemDidPlayToEnd:(id)arg2 { + // %orig (arg1, arg2); + NSLog(@"AutoReplay - Ended 12"); + + TIME t = [self currentTime]; + t.value = (long long) 0; + t.timescale = 100; + t.flags = (unsigned int) 1; + + [self seekToTime:t toleranceBefore:t toleranceAfter:t completionHandler:NULL]; +} + +%end +%end //end group IOS12 + + + + + +%group IOS13 +%hook PUBrowsingVideoPlayer + +static bool isFirstTryAfterEnding = false; + +- (void)videoSessionDidPlayToEnd:(id)arg1 { + isFirstTryAfterEnding = true; + [self rewindExistingPlayer]; +} + +- (void)_updateVideoSessionDesiredPlayState { + if (self.desiredPlayState == 0 && isFirstTryAfterEnding) { + isFirstTryAfterEnding = false; + MSHookIvar(self, "_desiredPlayState") = 1; + } + + %orig; +} +%end +%end //end group IOS13 + + + + + +%ctor { + float version = [[[UIDevice currentDevice] systemVersion] floatValue]; + if (version <= 12) { + %init(IOS12); + } else { + %init(IOS13); + } +} \ No newline at end of file diff --git a/control b/control new file mode 100644 index 0000000..c065581 --- /dev/null +++ b/control @@ -0,0 +1,9 @@ +Package: com.devvix.autoreplay +Name: AutoReplay +Depends: mobilesubstrate +Version: 1.0.2 +Architecture: iphoneos-arm +Description: An awesome MobileSubstrate tweak! +Maintainer: Devvix +Author: Devvix +Section: Tweaks