mirror of
https://github.com/faroukbmiled/RyukGram.git
synced 2026-06-08 16:33:54 +02:00
86eaa95019
### Features - **Open Instagram links in app (Safari extension)** — bundled Safari web extension (sideload IPA only). Enable in Safari → Extensions; instagram.com links open in the app. - **Localization** — every user-facing string flows through a central translation layer. Globe button in Settings; missing keys fall back to English. Ships English only — see the "Translating RyukGram" section in the README to add more. - **Action buttons** — context-aware menus on feed, reels, and stories (expand, repost, download, copy caption, etc.) with per-context default tap action and carousel/multi-story bulk download - **Enhanced HD downloads** — up to 1080p via DASH + FFmpegKit with quality picker, preview playback, encoding-speed options, and 720p fallback - **Repost**, **media viewer**, **media zoom** (long-press), **download pill** (frosted glass, stacks concurrent downloads) - **Fake location** — overrides CoreLocation app-wide, map picker + saved presets, optional quick-toggle button on the Friends Map - **Messages-only mode** — strips every tab except DM inbox + profile - **Launch tab** — pick which tab the app opens to - Full last active date in DMs — show full date instead of "Active 2h ago" - Custom date format — 12 formats with per-surface toggles (feed, notes/comments/stories, DMs) - Send files in DMs (experimental) - View story mentions - Hide suggested stories - Story tray long-press actions — view HD profile picture from the tray menu - Advance on story reply — auto-skip to next story after sending a reply or reaction - Mark story as seen on reply or emoji reaction - Hide metrics (likes, comments, shares counts) - Hide messages tab - Hide voice/video call buttons in DM thread header (independent toggles) - Disable app haptics - Disable reels tab refresh - Disable disappearing messages mode in DMs - Follow indicator — shows whether the profile user follows you - Copy note text on long press - Zoom profile photo — long press opens full-screen viewer - Notes actions — copy text, download GIF/audio from notes long-press menu - Confirm unfollow - Feed refresh controls — disable background refresh, home button refresh, and home button scroll ### Improvements - Default tap action: added copy URL, repost, and view mentions options; dynamic menu generation per context - Settings pages reordered: General → Feed → Stories → Reels → Messages → Profile → Navigation → Saving → Confirmations - Fake location picker: native Apple Maps-style UI (search, long-press to drop pin, current location) - Liquid glass floating tab bar + dynamic sizing - Upload audio: FFmpegKit re-encode + trim for any audio/video input - Settings reorganized with per-context action button config; new Profile page - Highlight cover: full-screen viewer replaces direct download - Switched HD encoder to `h264_videotoolbox` (hardware) — no GPL FFmpegKit required - Legacy long-press download deprecated (off by default), replaced by action buttons ### Fixes - Hide suggested stories no longer removes followed users' stories on scroll - Settings search bar transparency with liquid glass off; auto-deactivates on push - HD download cancel: tapping pill aborts in-flight downloads + FFmpeg sessions cleanly - Download pill stuck state on background/foreground, progress reset per download - Disappearing messages mode confirmation not firing on swipe - Detailed color picker not working on story draw `†` - DM seen toggle menu not updating after tap - Reel refresh confirmation appearing on first app launch `†` - Reels action button displacing profile pictures on photo reels - Disappearing DM media download (expand, share, save to Photos with progress pill) - Carousel "Download all" not showing item count in feed - Encoding speed setting being ignored for HD downloads - Various upstream SCInsta merges (Meta AI hiding, suggested chats hiding, notes tray) — marked `†` > `†` Merged from upstream [SCInsta](https://github.com/SoCuul/SCInsta) by SoCuul ### Credits - Thanks to [@erupts0](https://github.com/erupts0) (John) for testing and feature suggestions - Thanks to [@euoradan](https://t.me/euoradan) (Radan) for experimental Instagram feature flag research - Safari extension forked/cleaned from [BillyCurtis/OpenInstagramSafariExtension](https://github.com/BillyCurtis/OpenInstagramSafariExtension) ### Known Issues - Preserved unsent messages can't be removed via "Delete for you"; pull-to-refresh clears them (warning available in settings) - "Delete for you" detection uses a ~2s window after the local action — a real unsend landing in that window may be missed (rare)
199 lines
6.8 KiB
Plaintext
199 lines
6.8 KiB
Plaintext
// Media zoom — long press on feed media to expand in full-screen viewer.
|
|
|
|
#import "../../InstagramHeaders.h"
|
|
#import "../../Utils.h"
|
|
#import "../../ActionButton/SCIMediaActions.h"
|
|
#import "../../ActionButton/SCIMediaViewer.h"
|
|
#import <objc/runtime.h>
|
|
#import <objc/message.h>
|
|
|
|
// IGFeedItemPageVideoCell declared in InstagramHeaders.h
|
|
|
|
static const void *kZoomGestureKey = &kZoomGestureKey;
|
|
|
|
static BOOL sciZoomEnabled(void) {
|
|
return [SCIUtils getBoolPref:@"feed_media_zoom"];
|
|
}
|
|
|
|
// Walk up to the feed's outer collection view (skip carousel inner CVs)
|
|
static UICollectionView *sciFeedCollectionView(UIView *view) {
|
|
UIView *v = view;
|
|
while (v) {
|
|
if ([v isKindOfClass:[UICollectionView class]]) {
|
|
NSString *cls = NSStringFromClass([v class]);
|
|
if (![cls containsString:@"Carousel"] && ![cls containsString:@"Page"])
|
|
return (UICollectionView *)v;
|
|
}
|
|
v = v.superview;
|
|
}
|
|
return nil;
|
|
}
|
|
|
|
static NSInteger sciFeedSectionForView(UIView *view, UICollectionView *cv) {
|
|
UIView *v = view;
|
|
while (v) {
|
|
if ([v isKindOfClass:[UICollectionViewCell class]]) {
|
|
NSIndexPath *ip = [cv indexPathForCell:(UICollectionViewCell *)v];
|
|
if (ip) return ip.section;
|
|
}
|
|
v = v.superview;
|
|
}
|
|
return -1;
|
|
}
|
|
|
|
// Extract IGMedia from sibling cells in the same section
|
|
static IGMedia *sciZoomFeedMedia(UIView *view) {
|
|
Class mediaClass = NSClassFromString(@"IGMedia");
|
|
if (!mediaClass) return nil;
|
|
|
|
UICollectionView *cv = sciFeedCollectionView(view);
|
|
if (!cv) return nil;
|
|
|
|
NSInteger section = sciFeedSectionForView(view, cv);
|
|
if (section < 0) return nil;
|
|
|
|
for (UICollectionViewCell *cell in cv.visibleCells) {
|
|
NSIndexPath *path = [cv indexPathForCell:cell];
|
|
if (!path || path.section != section) continue;
|
|
|
|
NSString *cls = NSStringFromClass([cell class]);
|
|
if (![cls containsString:@"Photo"] && ![cls containsString:@"Video"]
|
|
&& ![cls containsString:@"Media"] && ![cls containsString:@"Page"]) continue;
|
|
|
|
unsigned int count = 0;
|
|
Class c = object_getClass(cell);
|
|
while (c && c != [UICollectionViewCell class]) {
|
|
Ivar *ivars = class_copyIvarList(c, &count);
|
|
for (unsigned int i = 0; i < count; i++) {
|
|
const char *type = ivar_getTypeEncoding(ivars[i]);
|
|
if (!type || type[0] != '@') continue;
|
|
@try {
|
|
id val = object_getIvar(cell, ivars[i]);
|
|
if (val && [val isKindOfClass:mediaClass]) { free(ivars); return (IGMedia *)val; }
|
|
} @catch (__unused id e) {}
|
|
}
|
|
if (ivars) free(ivars);
|
|
c = class_getSuperclass(c);
|
|
}
|
|
|
|
if ([cell respondsToSelector:@selector(mediaCellFeedItem)]) {
|
|
id m = ((id(*)(id,SEL))objc_msgSend)(cell, @selector(mediaCellFeedItem));
|
|
if (m && [m isKindOfClass:mediaClass]) return (IGMedia *)m;
|
|
}
|
|
}
|
|
return nil;
|
|
}
|
|
|
|
// Carousel page index from the horizontal scroll view in the Page cell
|
|
static NSInteger sciZoomPageIndex(UIView *view) {
|
|
UICollectionView *cv = sciFeedCollectionView(view);
|
|
if (!cv) return 0;
|
|
|
|
NSInteger section = sciFeedSectionForView(view, cv);
|
|
if (section < 0) return 0;
|
|
|
|
for (UICollectionViewCell *cell in cv.visibleCells) {
|
|
NSIndexPath *path = [cv indexPathForCell:cell];
|
|
if (!path || path.section != section) continue;
|
|
if (![NSStringFromClass([cell class]) containsString:@"Page"]) continue;
|
|
|
|
NSMutableArray *queue = [NSMutableArray arrayWithObject:cell];
|
|
int scanned = 0;
|
|
while (queue.count && scanned < 100) {
|
|
UIView *cur = queue.firstObject; [queue removeObjectAtIndex:0]; scanned++;
|
|
if ([cur isKindOfClass:[UIScrollView class]] && cur != cv) {
|
|
UIScrollView *sv = (UIScrollView *)cur;
|
|
CGFloat pageW = sv.bounds.size.width;
|
|
if (pageW > 100 && sv.contentSize.width > pageW * 1.5)
|
|
return (NSInteger)round(sv.contentOffset.x / pageW);
|
|
}
|
|
for (UIView *s in cur.subviews) [queue addObject:s];
|
|
}
|
|
}
|
|
return 0;
|
|
}
|
|
|
|
static void sciZoomFired(UILongPressGestureRecognizer *g) {
|
|
if (g.state != UIGestureRecognizerStateBegan) return;
|
|
if (!sciZoomEnabled()) return;
|
|
|
|
UIView *view = g.view;
|
|
IGMedia *media = sciZoomFeedMedia(view);
|
|
if (!media) return;
|
|
|
|
NSString *caption = [SCIMediaActions captionForMedia:media];
|
|
|
|
if ([SCIMediaActions isCarouselMedia:media]) {
|
|
NSArray *children = [SCIMediaActions carouselChildrenForMedia:media];
|
|
NSMutableArray *items = [NSMutableArray array];
|
|
for (id child in children) {
|
|
NSURL *v = [SCIUtils getVideoUrlForMedia:(IGMedia *)child];
|
|
NSURL *p = [SCIUtils getPhotoUrlForMedia:(IGMedia *)child];
|
|
if (!v && !p) p = [SCIMediaActions bestURLForMedia:child];
|
|
if (v || p) [items addObject:[SCIMediaViewerItem itemWithVideoURL:v photoURL:p caption:caption]];
|
|
}
|
|
if (items.count) {
|
|
NSInteger idx = sciZoomPageIndex(view);
|
|
if (idx < 0 || idx >= (NSInteger)items.count) idx = 0;
|
|
[SCIMediaViewer showItems:items startIndex:idx];
|
|
return;
|
|
}
|
|
}
|
|
|
|
NSURL *videoUrl = [SCIUtils getVideoUrlForMedia:media];
|
|
NSURL *photoUrl = [SCIUtils getPhotoUrlForMedia:media];
|
|
if (!videoUrl && !photoUrl) photoUrl = [SCIMediaActions bestURLForMedia:media];
|
|
if (!videoUrl && !photoUrl) return;
|
|
|
|
[SCIMediaViewer showWithVideoURL:videoUrl photoURL:photoUrl caption:caption];
|
|
}
|
|
|
|
// MARK: - Gesture setup
|
|
|
|
@interface _SCIZoomTarget : NSObject @end
|
|
@implementation _SCIZoomTarget
|
|
- (void)fired:(UILongPressGestureRecognizer *)g { sciZoomFired(g); }
|
|
@end
|
|
|
|
static void sciAddZoomGesture(UIView *view) {
|
|
if (objc_getAssociatedObject(view, kZoomGestureKey)) return;
|
|
|
|
_SCIZoomTarget *target = [_SCIZoomTarget new];
|
|
objc_setAssociatedObject(view, kZoomGestureKey, target, OBJC_ASSOCIATION_RETAIN_NONATOMIC);
|
|
|
|
UILongPressGestureRecognizer *gesture = [[UILongPressGestureRecognizer alloc]
|
|
initWithTarget:target action:@selector(fired:)];
|
|
gesture.minimumPressDuration = 0.5;
|
|
[view addGestureRecognizer:gesture];
|
|
}
|
|
|
|
// MARK: - Hooks
|
|
|
|
%hook IGFeedPhotoView
|
|
- (void)didMoveToSuperview {
|
|
%orig;
|
|
if (self.superview) sciAddZoomGesture(self);
|
|
}
|
|
%end
|
|
|
|
%hook IGModernFeedVideoCell.IGModernFeedVideoCell
|
|
- (void)didMoveToSuperview {
|
|
%orig;
|
|
if (((UIView *)self).superview) sciAddZoomGesture((UIView *)self);
|
|
}
|
|
%end
|
|
|
|
%hook IGFeedItemPagePhotoCell
|
|
- (void)didMoveToSuperview {
|
|
%orig;
|
|
if (self.superview) sciAddZoomGesture((UIView *)self);
|
|
}
|
|
%end
|
|
|
|
%hook IGFeedItemPageVideoCell
|
|
- (void)didMoveToSuperview {
|
|
%orig;
|
|
if (self.superview) sciAddZoomGesture((UIView *)self);
|
|
}
|
|
%end
|