mirror of
https://github.com/faroukbmiled/RyukGram.git
synced 2026-04-22 12:16:15 +02:00
- Fixed Disable video autoplay in feed
This commit is contained in:
@@ -1,10 +1,32 @@
|
||||
#import "../../Utils.h"
|
||||
#import <objc/runtime.h>
|
||||
#import <substrate.h>
|
||||
|
||||
// Demangled name: IGFeedPlayback.IGFeedPlaybackStrategy
|
||||
%hook _TtC14IGFeedPlayback22IGFeedPlaybackStrategy
|
||||
- (id)initWithShouldDisableAutoplay:(_Bool)autoplay {
|
||||
if ([SCIUtils getBoolPref:@"disable_feed_autoplay"]) return %orig(true);
|
||||
// IGFeedPlayback.IGFeedPlaybackStrategy gained new init parameters in IG 423+.
|
||||
// Both the 2-arg and 3-arg variants are hooked to force shouldDisableAutoplay=YES.
|
||||
// Hooked via MSHookMessageEx in %ctor since the class has a Swift-mangled name.
|
||||
|
||||
return %orig(autoplay);
|
||||
static id (*orig_initStrategy2)(id, SEL, BOOL, BOOL);
|
||||
static id new_initStrategy2(id self, SEL _cmd, BOOL shouldDisable, BOOL shouldClearStale) {
|
||||
if ([SCIUtils getBoolPref:@"disable_feed_autoplay"]) shouldDisable = YES;
|
||||
return orig_initStrategy2(self, _cmd, shouldDisable, shouldClearStale);
|
||||
}
|
||||
|
||||
static id (*orig_initStrategy3)(id, SEL, BOOL, BOOL, BOOL);
|
||||
static id new_initStrategy3(id self, SEL _cmd, BOOL shouldDisable, BOOL shouldClearStale, BOOL bypassForVoiceover) {
|
||||
if ([SCIUtils getBoolPref:@"disable_feed_autoplay"]) shouldDisable = YES;
|
||||
return orig_initStrategy3(self, _cmd, shouldDisable, shouldClearStale, bypassForVoiceover);
|
||||
}
|
||||
|
||||
%ctor {
|
||||
Class cls = objc_getClass("IGFeedPlayback.IGFeedPlaybackStrategy");
|
||||
if (!cls) return;
|
||||
|
||||
SEL sel2 = @selector(initWithShouldDisableAutoplay:shouldClearStaleReservation:);
|
||||
if ([cls instancesRespondToSelector:sel2])
|
||||
MSHookMessageEx(cls, sel2, (IMP)new_initStrategy2, (IMP *)&orig_initStrategy2);
|
||||
|
||||
SEL sel3 = @selector(initWithShouldDisableAutoplay:shouldClearStaleReservation:shouldBypassDisabledAutoplayForVoiceover:);
|
||||
if ([cls instancesRespondToSelector:sel3])
|
||||
MSHookMessageEx(cls, sel3, (IMP)new_initStrategy3, (IMP *)&orig_initStrategy3);
|
||||
}
|
||||
%end
|
||||
@@ -71,7 +71,7 @@
|
||||
[SCISetting switchCellWithTitle:@"No suggested for you" subtitle:@"Hides suggested accounts for you to follow" defaultsKey:@"no_suggested_account"],
|
||||
[SCISetting switchCellWithTitle:@"No suggested reels" subtitle:@"Hides suggested reels to watch" defaultsKey:@"no_suggested_reels"],
|
||||
[SCISetting switchCellWithTitle:@"No suggested threads posts" subtitle:@"Hides suggested threads posts" defaultsKey:@"no_suggested_threads"],
|
||||
[SCISetting switchCellWithTitle:@"Disable video autoplay" subtitle:@"Prevents videos on your feed from playing automatically" defaultsKey:@"disable_feed_autoplay"]
|
||||
[SCISetting switchCellWithTitle:@"Disable video autoplay" subtitle:@"Prevents videos on your feed from playing automatically" defaultsKey:@"disable_feed_autoplay" requiresRestart:YES]
|
||||
]
|
||||
}]
|
||||
],
|
||||
|
||||
+2
-2
@@ -28,7 +28,7 @@ BOOL dmVisualMsgsViewedButtonEnabled = false;
|
||||
@"detailed_color_picker": @(YES),
|
||||
@"remove_screenshot_alert": @(YES),
|
||||
@"call_confirm": @(YES),
|
||||
@"keep_deleted_message": @(YES),
|
||||
@"keep_deleted_message": @(NO),
|
||||
@"dw_feed_posts": @(YES),
|
||||
@"dw_reels": @(YES),
|
||||
@"dw_story": @(YES),
|
||||
@@ -50,7 +50,7 @@ BOOL dmVisualMsgsViewedButtonEnabled = false;
|
||||
@"download_audio_message": @(NO),
|
||||
@"unlock_password_reels": @(YES),
|
||||
@"seen_mode": @"button",
|
||||
@"seen_auto_on_interact": @(YES),
|
||||
@"seen_auto_on_interact": @(NO),
|
||||
@"indicate_unsent_messages": @(NO),
|
||||
@"unsent_message_toast": @(NO)
|
||||
};
|
||||
|
||||
Reference in New Issue
Block a user