diff --git a/README.md b/README.md index 94155f8..b95fe40 100644 --- a/README.md +++ b/README.md @@ -87,6 +87,7 @@ A feature-rich iOS tweak for Instagram, forked from [SCInsta](https://github.com - Auto mark seen on send (marks messages as read when you send any message) **\*** - Auto mark seen on typing (marks messages as read the moment you start typing, even when typing status is hidden) **\*** - Mark seen on story like **\*** +- Advance to next story when marking as seen — tapping the eye button auto-skips to the next story **\*** - Send audio as file — send audio files as voice messages from the DM plus menu **\*** - Download voice messages — adds a Download option to the long-press menu on voice messages, saves as M4A via share sheet **\*** - Disable typing status diff --git a/src/Features/StoriesAndMessages/DisableStorySeen.x b/src/Features/StoriesAndMessages/DisableStorySeen.x index ca8ebf5..3ccf025 100644 --- a/src/Features/StoriesAndMessages/DisableStorySeen.x +++ b/src/Features/StoriesAndMessages/DisableStorySeen.x @@ -5,6 +5,7 @@ #import BOOL sciSeenBypassActive = NO; +BOOL sciAdvanceBypassActive = NO; NSMutableSet *sciAllowedSeenPKs = nil; void sciAllowSeenForPK(id media) { @@ -61,11 +62,11 @@ static BOOL sciShouldBlockSeenVisual() { - (void)sendSeenRequestForCurrentItem { if (sciShouldBlockSeenVisual()) return; %orig; } - (void)markCurrentItemAsSeen { if (sciShouldBlockSeenVisual()) return; %orig; } - (void)storyPlayerMediaViewDidPlayToEnd:(id)arg1 { - if ([SCIUtils getBoolPref:@"stop_story_auto_advance"]) return; + if (!sciAdvanceBypassActive && [SCIUtils getBoolPref:@"stop_story_auto_advance"]) return; %orig; } - (void)advanceToNextReelForAutoScroll { - if ([SCIUtils getBoolPref:@"stop_story_auto_advance"]) return; + if (!sciAdvanceBypassActive && [SCIUtils getBoolPref:@"stop_story_auto_advance"]) return; %orig; } %end diff --git a/src/Features/StoriesAndMessages/OverlayButtons.xm b/src/Features/StoriesAndMessages/OverlayButtons.xm index 739272e..49d97c3 100644 --- a/src/Features/StoriesAndMessages/OverlayButtons.xm +++ b/src/Features/StoriesAndMessages/OverlayButtons.xm @@ -2,6 +2,7 @@ #import "StoryHelpers.h" extern "C" BOOL sciSeenBypassActive; +extern "C" BOOL sciAdvanceBypassActive; extern "C" NSMutableSet *sciAllowedSeenPKs; extern "C" void sciAllowSeenForPK(id); @@ -232,6 +233,34 @@ static void sciDownloadDMVisualMessage(UIViewController *dmVC) { } sciSeenBypassActive = NO; [SCIUtils showToastForDuration:2.0 title:@"Marked as seen" subtitle:@"Will sync when leaving stories"]; + + // Advance to next story item if enabled — bypass the stop-auto-advance hook + if ([SCIUtils getBoolPref:@"advance_on_mark_seen"] && sectionCtrl) { + __block id secCtrl = sectionCtrl; + __weak __typeof(self) weakSelf = self; + dispatch_after(dispatch_time(DISPATCH_TIME_NOW, (int64_t)(0.1 * NSEC_PER_SEC)), dispatch_get_main_queue(), ^{ + sciAdvanceBypassActive = YES; + + SEL advSel = NSSelectorFromString(@"advanceToNextItemWithNavigationAction:"); + if ([secCtrl respondsToSelector:advSel]) { + ((void(*)(id, SEL, NSInteger))objc_msgSend)(secCtrl, advSel, 1); + } + + // After advancing, kick playback on the new section controller + dispatch_after(dispatch_time(DISPATCH_TIME_NOW, (int64_t)(0.2 * NSEC_PER_SEC)), dispatch_get_main_queue(), ^{ + __strong __typeof(weakSelf) strongSelf = weakSelf; + UIViewController *vc2 = strongSelf ? sciFindVC(strongSelf, @"IGStoryViewerViewController") : nil; + id sc2 = vc2 ? sciFindSectionController(vc2) : nil; + if (sc2) { + SEL resumeSel = NSSelectorFromString(@"tryResumePlaybackWithReason:"); + if ([sc2 respondsToSelector:resumeSel]) { + ((void(*)(id, SEL, NSInteger))objc_msgSend)(sc2, resumeSel, 0); + } + } + sciAdvanceBypassActive = NO; + }); + }); + } return; } diff --git a/src/Settings/TweakSettings.m b/src/Settings/TweakSettings.m index 9ecef14..f5f1b57 100644 --- a/src/Settings/TweakSettings.m +++ b/src/Settings/TweakSettings.m @@ -93,8 +93,7 @@ @{ @"header": @"Hiding", @"rows": @[ - [SCISetting switchCellWithTitle:@"Hide reels header" subtitle:@"Hides the top navigation bar when watching reels" defaultsKey:@"hide_reels_header"], - [SCISetting switchCellWithTitle:@"Hide reels blend button" subtitle:@"Hides the button in DMs to open a reels blend" defaultsKey:@"hide_reels_blend"] + [SCISetting switchCellWithTitle:@"Hide reels header" subtitle:@"Hides the top navigation bar when watching reels" defaultsKey:@"hide_reels_header"] ] }, @{ @@ -137,11 +136,36 @@ ] }] ], - [SCISetting navigationCellWithTitle:@"Stories and messages" + [SCISetting navigationCellWithTitle:@"Stories" subtitle:@"" - icon:[SCISymbol symbolWithName:@"rectangle.portrait.on.rectangle.portrait.angled"] + icon:[SCISymbol symbolWithName:@"circle.dashed"] navSections:@[@{ - @"header": @"Messages", + @"header": @"Seen receipts", + @"rows": @[ + [SCISetting switchCellWithTitle:@"Disable story seen receipt" subtitle:@"Hides the notification for others when you view their story" defaultsKey:@"no_seen_receipt"], + [SCISetting switchCellWithTitle:@"Keep stories visually unseen" subtitle:@"Prevents stories from visually marking as seen in the tray (keeps colorful ring)" defaultsKey:@"no_seen_visual"], + [SCISetting switchCellWithTitle:@"Mark seen on story like" subtitle:@"Marks a story as seen the moment you tap the heart, even with seen blocking on" defaultsKey:@"seen_on_story_like"], + ] + }, + @{ + @"header": @"Playback", + @"rows": @[ + [SCISetting switchCellWithTitle:@"Stop story auto-advance" subtitle:@"Stories won't auto-skip to the next one when the timer ends. Tap to advance manually" defaultsKey:@"stop_story_auto_advance"], + [SCISetting switchCellWithTitle:@"Advance when marking as seen" subtitle:@"Tapping the eye button to mark a story as seen advances to the next story automatically" defaultsKey:@"advance_on_mark_seen"], + ] + }, + @{ + @"header": @"Other", + @"rows": @[ + [SCISetting switchCellWithTitle:@"Disable instants creation" subtitle:@"Hides the functionality to create/send instants" defaultsKey:@"disable_instants_creation" requiresRestart:YES] + ] + }] + ], + [SCISetting navigationCellWithTitle:@"Messages" + subtitle:@"" + icon:[SCISymbol symbolWithName:@"bubble.left.and.bubble.right"] + navSections:@[@{ + @"header": @"Threads", @"rows": @[ [SCISetting navigationCellWithTitle:@"Keep deleted messages" subtitle:@"Preserve messages that others unsend" @@ -171,21 +195,22 @@ }] ], [SCISetting switchCellWithTitle:@"Disable typing status" subtitle:@"Prevents the typing indicator from being shown to others when you're typing in DMs" defaultsKey:@"disable_typing_status"], + [SCISetting switchCellWithTitle:@"Hide reels blend button" subtitle:@"Hides the button in DMs to open a reels blend" defaultsKey:@"hide_reels_blend"], + ] + }, + @{ + @"header": @"Voice messages", + @"rows": @[ [SCISetting switchCellWithTitle:@"Send audio as file" subtitle:@"Adds an 'Audio File' option to the plus menu in DMs to send audio files as voice messages" defaultsKey:@"send_audio_as_file"], [SCISetting switchCellWithTitle:@"Download voice messages" subtitle:@"Adds a 'Download' option to the long-press menu on voice messages to save them as M4A audio" defaultsKey:@"download_audio_message"], ] }, @{ - @"header": @"Visual messages & stories", + @"header": @"Visual messages", @"rows": @[ [SCISetting switchCellWithTitle:@"Unlimited replay of visual messages" subtitle:@"Replays direct visual messages normal/once stories unlimited times (toggle with image check icon)" defaultsKey:@"unlimited_replay"], [SCISetting switchCellWithTitle:@"Disable view-once limitations" subtitle:@"Makes view-once messages behave like normal visual messages (loopable/pauseable)" defaultsKey:@"disable_view_once_limitations"], [SCISetting switchCellWithTitle:@"Disable screenshot detection" subtitle:@"Removes the screenshot-prevention features for visual messages in DMs" defaultsKey:@"remove_screenshot_alert"], - [SCISetting switchCellWithTitle:@"Disable story seen receipt" subtitle:@"Hides the notification for others when you view their story" defaultsKey:@"no_seen_receipt"], - [SCISetting switchCellWithTitle:@"Keep stories visually unseen" subtitle:@"Prevents stories from visually marking as seen in the tray (keeps colorful ring)" defaultsKey:@"no_seen_visual"], - [SCISetting switchCellWithTitle:@"Mark seen on story like" subtitle:@"Marks a story as seen the moment you tap the heart, even with seen blocking on" defaultsKey:@"seen_on_story_like"], - [SCISetting switchCellWithTitle:@"Stop story auto-advance" subtitle:@"Stories won't auto-skip to the next one when the timer ends. Tap to advance manually" defaultsKey:@"stop_story_auto_advance"], - [SCISetting switchCellWithTitle:@"Disable instants creation" subtitle:@"Hides the functionality to create/send instants" defaultsKey:@"disable_instants_creation" requiresRestart:YES] ] }] ], diff --git a/src/Tweak.x b/src/Tweak.x index 909478c..88a6102 100644 --- a/src/Tweak.x +++ b/src/Tweak.x @@ -55,6 +55,7 @@ BOOL dmVisualMsgsViewedButtonEnabled = false; @"seen_auto_on_interact": @(NO), @"seen_auto_on_typing": @(NO), @"seen_on_story_like": @(NO), + @"advance_on_mark_seen": @(NO), @"indicate_unsent_messages": @(NO), @"unsent_message_toast": @(NO), @"warn_refresh_clears_preserved": @(NO)