mirror of
https://github.com/faroukbmiled/RyukGram.git
synced 2026-10-01 05:30:05 +02:00
- Fixed Disable video autoplay in feed
This commit is contained in:
1 parent
3490531941
commit
a93929bbb2
3 files changed
+31
-9
No files matched your search
@@ -1,10 +1,32 @@
|
|||||||
#import "../../Utils.h"
|
#import "../../Utils.h"
|
||||||
|
#import <objc/runtime.h>
|
||||||
|
#import <substrate.h>
|
||||||
|
|
||||||
// Demangled name: IGFeedPlayback.IGFeedPlaybackStrategy
|
// IGFeedPlayback.IGFeedPlaybackStrategy gained new init parameters in IG 423+.
|
||||||
%hook _TtC14IGFeedPlayback22IGFeedPlaybackStrategy
|
// Both the 2-arg and 3-arg variants are hooked to force shouldDisableAutoplay=YES.
|
||||||
- (id)initWithShouldDisableAutoplay:(_Bool)autoplay {
|
// Hooked via MSHookMessageEx in %ctor since the class has a Swift-mangled name.
|
||||||
if ([SCIUtils getBoolPref:@"disable_feed_autoplay"]) return %orig(true);
|
|
||||||
|
|
||||||
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 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 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:@"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),
|
@"detailed_color_picker": @(YES),
|
||||||
@"remove_screenshot_alert": @(YES),
|
@"remove_screenshot_alert": @(YES),
|
||||||
@"call_confirm": @(YES),
|
@"call_confirm": @(YES),
|
||||||
@"keep_deleted_message": @(YES),
|
@"keep_deleted_message": @(NO),
|
||||||
@"dw_feed_posts": @(YES),
|
@"dw_feed_posts": @(YES),
|
||||||
@"dw_reels": @(YES),
|
@"dw_reels": @(YES),
|
||||||
@"dw_story": @(YES),
|
@"dw_story": @(YES),
|
||||||
@@ -50,7 +50,7 @@ BOOL dmVisualMsgsViewedButtonEnabled = false;
|
|||||||
@"download_audio_message": @(NO),
|
@"download_audio_message": @(NO),
|
||||||
@"unlock_password_reels": @(YES),
|
@"unlock_password_reels": @(YES),
|
||||||
@"seen_mode": @"button",
|
@"seen_mode": @"button",
|
||||||
@"seen_auto_on_interact": @(YES),
|
@"seen_auto_on_interact": @(NO),
|
||||||
@"indicate_unsent_messages": @(NO),
|
@"indicate_unsent_messages": @(NO),
|
||||||
@"unsent_message_toast": @(NO)
|
@"unsent_message_toast": @(NO)
|
||||||
};
|
};
|
||||||
|
|||||||
Reference in new issue
Block a user