Files
RyukGram/src/Features/General/FeedDateFormat.x
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

116 lines
4.5 KiB
Plaintext

// Date format hooks — replace IG's relative timestamps with a custom format.
// Each NSDate formatter selector is independently toggleable via prefs
// (date_fmt_<name>) so users can apply the format surface-by-surface.
#import "../../InstagramHeaders.h"
#import "../../Utils.h"
#import "SCIDateFormatEntries.h"
#import <substrate.h>
static NSDictionary *sciDateFormats(BOOL sec) {
return sec ? @{
@"short": @"MMM d",
@"medium": @"MMM d, yyyy",
@"full": @"MMM d, yyyy 'at' h:mm:ss a",
@"time_12": @"MMM d 'at' h:mm:ss a",
@"time_24": @"MMM d 'at' HH:mm:ss",
@"dd_mmm": @"dd-MMM-yyyy 'at' h:mm:ss a",
@"day_slash": @"dd/MM/yyyy h:mm:ss a",
@"month_slash": @"MM/dd/yyyy h:mm:ss a",
@"euro": @"dd.MM.yyyy HH:mm:ss",
@"iso": @"yyyy-MM-dd",
@"iso_time": @"yyyy-MM-dd HH:mm:ss",
} : @{
@"short": @"MMM d",
@"medium": @"MMM d, yyyy",
@"full": @"MMM d, yyyy 'at' h:mm a",
@"time_12": @"MMM d 'at' h:mm a",
@"time_24": @"MMM d 'at' HH:mm",
@"dd_mmm": @"dd-MMM-yyyy 'at' h:mm a",
@"day_slash": @"dd/MM/yyyy h:mm a",
@"month_slash": @"MM/dd/yyyy h:mm a",
@"euro": @"dd.MM.yyyy HH:mm",
@"iso": @"yyyy-MM-dd",
@"iso_time": @"yyyy-MM-dd HH:mm",
};
}
static NSString *sciFormat(NSDate *date) {
NSString *fmt = [SCIUtils getStringPref:@"feed_date_format"];
if (!fmt.length || [fmt isEqualToString:@"default"]) return nil;
BOOL sec = [[NSUserDefaults standardUserDefaults] boolForKey:@"feed_date_show_seconds"];
NSString *pattern = sciDateFormats(sec)[fmt];
if (!pattern) return nil;
static NSDateFormatter *df = nil;
static dispatch_once_t once;
dispatch_once(&once, ^{ df = [NSDateFormatter new]; });
df.dateFormat = pattern;
return [df stringFromDate:date];
}
// Per-arity hook generators. When the entry's pref is on, return the custom
// format; otherwise forward to orig with the original arguments.
#define SCI_HOOK0(NAME, SEL_, LABEL, PREF) \
static NSString *(*orig_##NAME)(NSDate *, SEL); \
static NSString *hook_##NAME(NSDate *self, SEL _cmd) { \
if ([SCIUtils getBoolPref:@PREF]) { \
NSString *r = sciFormat(self); \
if (r) return r; \
} \
return orig_##NAME(self, _cmd); \
}
#define SCI_HOOK1(NAME, SEL_, LABEL, PREF) \
static NSString *(*orig_##NAME)(NSDate *, SEL, NSInteger); \
static NSString *hook_##NAME(NSDate *self, SEL _cmd, NSInteger a1) { \
if ([SCIUtils getBoolPref:@PREF]) { \
NSString *r = sciFormat(self); \
if (r) return r; \
} \
return orig_##NAME(self, _cmd, a1); \
}
#define SCI_HOOK2(NAME, SEL_, LABEL, PREF) \
static NSString *(*orig_##NAME)(NSDate *, SEL, NSInteger, NSInteger); \
static NSString *hook_##NAME(NSDate *self, SEL _cmd, NSInteger a1, NSInteger a2) { \
if ([SCIUtils getBoolPref:@PREF]) { \
NSString *r = sciFormat(self); \
if (r) return r; \
} \
return orig_##NAME(self, _cmd, a1, a2); \
}
#define SCI_HOOK3(NAME, SEL_, LABEL, PREF) \
static NSString *(*orig_##NAME)(NSDate *, SEL, NSInteger, NSInteger, NSInteger); \
static NSString *hook_##NAME(NSDate *self, SEL _cmd, NSInteger a1, NSInteger a2, NSInteger a3) { \
if ([SCIUtils getBoolPref:@PREF]) { \
NSString *r = sciFormat(self); \
if (r) return r; \
} \
return orig_##NAME(self, _cmd, a1, a2, a3); \
}
#define SCI_HOOK4(NAME, SEL_, LABEL, PREF) \
static NSString *(*orig_##NAME)(NSDate *, SEL, NSInteger, NSInteger, NSInteger, NSInteger); \
static NSString *hook_##NAME(NSDate *self, SEL _cmd, NSInteger a1, NSInteger a2, NSInteger a3, NSInteger a4) { \
if ([SCIUtils getBoolPref:@PREF]) { \
NSString *r = sciFormat(self); \
if (r) return r; \
} \
return orig_##NAME(self, _cmd, a1, a2, a3, a4); \
}
#define SCI_EMIT_HOOK(NAME, SEL_, LABEL, ARITY, PREF) SCI_HOOK##ARITY(NAME, SEL_, LABEL, PREF)
SCI_DATE_FORMAT_ENTRIES(SCI_EMIT_HOOK)
#define SCI_INSTALL_HOOK(NAME, SEL_, LABEL, ARITY, PREF) do { \
SEL s = sel_registerName(SEL_); \
if ([[NSDate class] instancesRespondToSelector:s]) \
MSHookMessageEx([NSDate class], s, (IMP)hook_##NAME, (IMP *)&orig_##NAME); \
} while (0);
%ctor {
SCI_DATE_FORMAT_ENTRIES(SCI_INSTALL_HOOK)
}