Files
RyukGram/src/Features/Reels/PasswordedReels.xm
T
faroukbmiled 86eaa95019 [release] RyukGram v1.2.0
### 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)
2026-04-16 03:03:30 +01:00

190 lines
8.0 KiB
Plaintext

#import "../../InstagramHeaders.h"
#import "../../Utils.h"
#import <objc/runtime.h>
#import <objc/message.h>
// Password-locked reels use IGMediaOverlayProfileWithPasswordView as a blur overlay.
// The password is stored in the _asnwer ivar (IG typo). We read it at runtime,
// then provide buttons to auto-fill + submit or reveal + copy the password.
#define SCI_PW_BTN_TAG 1342
static NSString * _Nullable sciGetPassword(id overlayView) {
Class cls = [overlayView class];
while (cls && cls != [UIView class]) {
unsigned int count = 0;
Ivar *ivars = class_copyIvarList(cls, &count);
for (unsigned int i = 0; i < count; i++) {
const char *name = ivar_getName(ivars[i]);
if (name && strcmp(name, "_asnwer") == 0) {
id value = object_getIvar(overlayView, ivars[i]);
free(ivars);
if ([value isKindOfClass:[NSString class]] && [(NSString *)value length] > 0)
return (NSString *)value;
return nil;
}
}
if (ivars) free(ivars);
cls = class_getSuperclass(cls);
}
// Fallback: scan for any password-related string ivar
cls = [overlayView class];
while (cls && cls != [UIView class]) {
unsigned int count = 0;
Ivar *ivars = class_copyIvarList(cls, &count);
for (unsigned int i = 0; i < count; i++) {
const char *type = ivar_getTypeEncoding(ivars[i]);
if (!type || type[0] != '@') continue;
@try {
id value = object_getIvar(overlayView, ivars[i]);
if (![value isKindOfClass:[NSString class]] || [(NSString *)value length] == 0) continue;
const char *name = ivar_getName(ivars[i]);
if (!name) continue;
NSString *lower = [[NSString stringWithUTF8String:name] lowercaseString];
if ([lower containsString:@"answer"] || [lower containsString:@"asnwer"] ||
[lower containsString:@"password"] || [lower containsString:@"secret"]) {
free(ivars);
return (NSString *)value;
}
} @catch(id e) {}
}
if (ivars) free(ivars);
cls = class_getSuperclass(cls);
}
return nil;
}
static UITextField * _Nullable sciFindTextField(UIView *root) {
NSMutableArray *stack = [NSMutableArray arrayWithObject:root];
while (stack.count > 0) {
UIView *v = stack.lastObject;
[stack removeLastObject];
if ([v isKindOfClass:[UITextField class]]) return (UITextField *)v;
for (UIView *sub in v.subviews) [stack addObject:sub];
}
return nil;
}
static UIView * _Nullable sciFindSubmitButton(UIView *root) {
NSMutableArray *stack = [NSMutableArray arrayWithObject:root];
while (stack.count > 0) {
UIView *v = stack.lastObject;
[stack removeLastObject];
if ([NSStringFromClass([v class]) containsString:@"IGDSMediaTextButton"]) return v;
for (UIView *sub in v.subviews) [stack addObject:sub];
}
return nil;
}
%hook IGMediaOverlayProfileWithPasswordView
- (void)didMoveToSuperview {
%orig;
if (!self.superview) return;
if (![SCIUtils getBoolPref:@"unlock_password_reels"]) return;
[self sciAddButtons];
}
- (void)layoutSubviews {
%orig;
if (![SCIUtils getBoolPref:@"unlock_password_reels"]) return;
[self sciAddButtons];
}
%new - (void)sciAddButtons {
if ([self viewWithTag:SCI_PW_BTN_TAG]) return;
UIImageSymbolConfiguration *config = [UIImageSymbolConfiguration configurationWithPointSize:18 weight:UIImageSymbolWeightBold];
UIButton *unlockBtn = [UIButton buttonWithType:UIButtonTypeCustom];
unlockBtn.tag = SCI_PW_BTN_TAG;
[unlockBtn setImage:[UIImage systemImageNamed:@"lock.open.fill" withConfiguration:config] forState:UIControlStateNormal];
unlockBtn.tintColor = [UIColor colorWithRed:1.0 green:0.85 blue:0.0 alpha:1.0];
unlockBtn.backgroundColor = [UIColor colorWithWhite:0.0 alpha:0.5];
unlockBtn.layer.cornerRadius = 20;
unlockBtn.translatesAutoresizingMaskIntoConstraints = NO;
[unlockBtn addTarget:self action:@selector(sciUnlockTapped) forControlEvents:UIControlEventTouchUpInside];
[self addSubview:unlockBtn];
UIButton *eyeBtn = [UIButton buttonWithType:UIButtonTypeCustom];
eyeBtn.tag = SCI_PW_BTN_TAG + 1;
[eyeBtn setImage:[UIImage systemImageNamed:@"eye.fill" withConfiguration:config] forState:UIControlStateNormal];
eyeBtn.tintColor = [UIColor whiteColor];
eyeBtn.backgroundColor = [UIColor colorWithWhite:0.0 alpha:0.5];
eyeBtn.layer.cornerRadius = 20;
eyeBtn.translatesAutoresizingMaskIntoConstraints = NO;
[eyeBtn addTarget:self action:@selector(sciShowPasswordTapped) forControlEvents:UIControlEventTouchUpInside];
[self addSubview:eyeBtn];
[NSLayoutConstraint activateConstraints:@[
[unlockBtn.topAnchor constraintEqualToAnchor:self.safeAreaLayoutGuide.topAnchor constant:200],
[unlockBtn.trailingAnchor constraintEqualToAnchor:self.trailingAnchor constant:-16],
[unlockBtn.widthAnchor constraintEqualToConstant:40],
[unlockBtn.heightAnchor constraintEqualToConstant:40],
[eyeBtn.topAnchor constraintEqualToAnchor:unlockBtn.bottomAnchor constant:12],
[eyeBtn.trailingAnchor constraintEqualToAnchor:self.trailingAnchor constant:-16],
[eyeBtn.widthAnchor constraintEqualToConstant:40],
[eyeBtn.heightAnchor constraintEqualToConstant:40],
]];
}
%new - (void)sciUnlockTapped {
UIImpactFeedbackGenerator *haptic = [[UIImpactFeedbackGenerator alloc] initWithStyle:UIImpactFeedbackStyleMedium];
[haptic impactOccurred];
NSString *password = sciGetPassword(self);
if (!password) {
[SCIUtils showErrorHUDWithDescription:SCILocalized(@"No password found")];
return;
}
UITextField *textField = sciFindTextField(self);
if (!textField) {
[SCIUtils showErrorHUDWithDescription:SCILocalized(@"No text field found")];
return;
}
textField.text = password;
[textField sendActionsForControlEvents:UIControlEventEditingChanged];
[[NSNotificationCenter defaultCenter] postNotificationName:UITextFieldTextDidChangeNotification object:textField];
if (textField.delegate) {
if ([textField.delegate respondsToSelector:@selector(textField:shouldChangeCharactersInRange:replacementString:)])
[textField.delegate textField:textField shouldChangeCharactersInRange:NSMakeRange(0, 0) replacementString:password];
if ([textField.delegate respondsToSelector:@selector(textFieldDidChangeSelection:)])
[textField.delegate textFieldDidChangeSelection:textField];
}
dispatch_after(dispatch_time(DISPATCH_TIME_NOW, (int64_t)(0.4 * NSEC_PER_SEC)), dispatch_get_main_queue(), ^{
UIView *submitBtn = sciFindSubmitButton(self);
if (submitBtn && [submitBtn isKindOfClass:[UIControl class]]) {
[(UIControl *)submitBtn setHidden:NO];
[(UIControl *)submitBtn sendActionsForControlEvents:UIControlEventTouchUpInside];
}
});
}
%new - (void)sciShowPasswordTapped {
UIImpactFeedbackGenerator *haptic = [[UIImpactFeedbackGenerator alloc] initWithStyle:UIImpactFeedbackStyleLight];
[haptic impactOccurred];
NSString *password = sciGetPassword(self);
if (!password) {
[SCIUtils showErrorHUDWithDescription:SCILocalized(@"No password found")];
return;
}
[[UIPasteboard generalPasteboard] setString:password];
UIAlertController *alert = [UIAlertController alertControllerWithTitle:SCILocalized(@"Password")
message:password
preferredStyle:UIAlertControllerStyleAlert];
[alert addAction:[UIAlertAction actionWithTitle:SCILocalized(@"Copied!") style:UIAlertActionStyleCancel handler:nil]];
UIViewController *topVC = topMostController();
if (topVC) [topVC presentViewController:alert animated:YES completion:nil];
}
%end