2 Commits

Author SHA1 Message Date
faroukbmiled 54eafa749b sync: localization, readme, issue templates 2026-07-25 03:43:33 +01:00
faroukbmiled 5162a2563a RyukGram 2026-07-25 01:58:26 +01:00
286 changed files with 15046 additions and 40285 deletions
-10
View File
@@ -1,10 +0,0 @@
CompileFlags:
Add: [
"-isysroot",
"/Applications/Xcode.app/Contents/Developer/Platforms/iPhoneOS.platform/Developer/SDKs/iPhoneOS.sdk",
"-fmodules",
"-fcxx-modules",
"-fobjc-arc",
"-I/opt/theos/include",
"-I/opt/theos/vendor/include"
]
+2 -2
View File
@@ -1,2 +1,2 @@
ko_fi: SoCuul
github: SoCuul
buy_me_a_coffee: axryuk
github: faroukbmiled
-17
View File
@@ -1,17 +0,0 @@
name: Issue assignment
on:
issues:
types: [opened]
jobs:
auto-assign:
runs-on: ubuntu-latest
permissions:
issues: write
steps:
- name: 'Auto-assign issue'
uses: pozil/auto-assign-issue@v1
with:
assignees: faroukbmiled
allowNoAssignees: true
-19
View File
@@ -1,19 +0,0 @@
name: PR assignment
on:
pull_request_target:
types: [opened, reopened]
jobs:
auto-assign:
runs-on: ubuntu-latest
permissions:
contents: read
issues: write
pull-requests: write
steps:
- name: 'Auto-assign PR'
uses: pozil/auto-assign-issue@v1
with:
assignees: faroukbmiled
allowNoAssignees: true
+279
View File
@@ -0,0 +1,279 @@
name: Build sideloaded IPA from Release Assets
on:
workflow_dispatch:
inputs:
decrypted_instagram_url:
description: "Decrypted Instagram IPA — direct URL"
default: ""
required: true
type: string
target:
description: "Instagram version (410 needs a 410.x IPA above)"
default: "latest"
required: false
type: choice
options:
- "latest"
- "410"
build_sideload:
description: "Sideload IPA — with plugins"
default: true
required: false
type: boolean
build_noplugins:
description: "No-plugins IPA — any sideloader / free account"
default: false
required: false
type: boolean
dup_bundle_id:
description: "Bundle id (no-plugins only, blank = com.burbn.instagram)"
default: ""
required: false
type: string
dup_name:
description: "App name on Home Screen (blank = Instagram)"
default: ""
required: false
type: string
release_tag:
description: "Release tag (blank = latest)"
default: ""
required: false
type: string
upload_artifact:
description: "Upload the built IPA"
default: true
required: false
type: boolean
concurrency:
group: ${{ github.workflow }}-${{ github.ref }}
cancel-in-progress: true
env:
UPSTREAM_REPO: faroukbmiled/RyukGram
jobs:
build:
name: Build RyukGram from Release
runs-on: macos-latest
permissions:
contents: read
steps:
- name: Validate selection
env:
DUP_ID: ${{ inputs.dup_bundle_id }}
run: |
if [ "${{ inputs.build_sideload }}" != "true" ] && \
[ "${{ inputs.build_noplugins }}" != "true" ]; then
echo "::error::Select at least one of build_sideload / build_noplugins."
exit 1
fi
if [ -n "$DUP_ID" ] && [ "${{ inputs.build_noplugins }}" != "true" ]; then
echo "::error::A dup bundle id needs the no-plugins build. Enable build_noplugins."
exit 1
fi
- name: Checkout
uses: actions/checkout@v4
- name: Install Dependencies
run: brew install dpkg
- name: Install IPA tooling (cyan + ipapatch)
run: |
pip install --force-reinstall https://github.com/asdfzxcvbn/pyzule-rw/archive/main.zip
mkdir -p "$HOME/.local/bin"
curl -fLo "$HOME/.local/bin/ipapatch" https://github.com/asdfzxcvbn/ipapatch/releases/download/v2.1.3/ipapatch.macos-arm64
chmod +x "$HOME/.local/bin/ipapatch"
echo "$HOME/.local/bin" >> "$GITHUB_PATH"
- name: Resolve release tag
id: tag
env:
GH_TOKEN: ${{ github.token }}
INPUT_TAG: ${{ inputs.release_tag }}
INPUT_TARGET: ${{ inputs.target }}
run: |
set -euo pipefail
if [ -n "$INPUT_TAG" ]; then
TAG="$INPUT_TAG"
else
TAG="$(gh release view --repo "$UPSTREAM_REPO" --json tagName -q .tagName)"
fi
[ -n "$TAG" ] || { echo "::error::Could not resolve release tag."; exit 1; }
VERSION="${TAG#v}"
# 410 builds pull the RyukGram-410 deb and tag their output -410.
SUF=""; [ "$INPUT_TARGET" = "410" ] && SUF="-410"
echo "tag=${TAG}" >> "$GITHUB_OUTPUT"
echo "version=${VERSION}" >> "$GITHUB_OUTPUT"
echo "TAG=${TAG}" >> "$GITHUB_ENV"
echo "VERSION=${VERSION}" >> "$GITHUB_ENV"
echo "SUF=${SUF}" >> "$GITHUB_ENV"
echo "Using release tag: ${TAG} (version ${VERSION}${SUF})"
- name: Download release assets (rootless deb + injection dylibs)
env:
GH_TOKEN: ${{ github.token }}
TARGET: ${{ inputs.target }}
run: |
set -euo pipefail
mkdir -p packages release-assets
# 410 tweak lives in the RyukGram-410 deb; main in RyukGram_. The
# plugin dylibs are shared, so both targets pull the same ones.
if [ "$TARGET" = "410" ]; then DEBP="RyukGram-410_*_rootless.deb"; else DEBP="RyukGram_*_rootless.deb"; fi
gh release download "$TAG" --repo "$UPSTREAM_REPO" --dir release-assets --pattern "$DEBP"
DEB="$(ls -t release-assets/$DEBP 2>/dev/null | head -n1 || true)"
[ -n "$DEB" ] || { echo "::error::Rootless .deb ($DEBP) not found in release $TAG."; exit 1; }
echo "DEB=${DEB}" >> "$GITHUB_ENV"
if [ "${{ inputs.build_sideload }}" = "true" ]; then
gh release download "$TAG" --repo "$UPSTREAM_REPO" --dir release-assets \
--pattern "zxPluginsInject_v*.dylib"
ZX_DYLIB="$(ls -t release-assets/zxPluginsInject_v*.dylib 2>/dev/null | head -n1 || true)"
[ -n "$ZX_DYLIB" ] || { echo "::error::zxPluginsInject dylib not found in release $TAG (enable include_zxinject when releasing)."; exit 1; }
echo "ZX_DYLIB=${ZX_DYLIB}" >> "$GITHUB_ENV"
fi
if [ "${{ inputs.build_noplugins }}" = "true" ]; then
gh release download "$TAG" --repo "$UPSTREAM_REPO" --dir release-assets \
--pattern "NoPluginsPatch_v*.dylib"
NP_DYLIB="$(ls -t release-assets/NoPluginsPatch_v*.dylib 2>/dev/null | head -n1 || true)"
[ -n "$NP_DYLIB" ] || { echo "::error::NoPluginsPatch dylib not found in release $TAG (enable include_noplugins_patch when releasing)."; exit 1; }
echo "NP_DYLIB=${NP_DYLIB}" >> "$GITHUB_ENV"
fi
ls -la release-assets
- name: Extract dylib + bundle from rootless deb
run: |
set -euo pipefail
STAGE="$(mktemp -d)"
dpkg-deb -x "$DEB" "$STAGE"
DYLIB_SRC="$(find "$STAGE" -type f -name 'RyukGram.dylib' | head -1)"
BUNDLE_SRC="$(find "$STAGE" -type d -name 'RyukGram.bundle' | head -1)"
[ -n "$DYLIB_SRC" ] || { echo "::error::RyukGram.dylib not found in deb."; exit 1; }
[ -n "$BUNDLE_SRC" ] || { echo "::error::RyukGram.bundle not found in deb."; exit 1; }
cp "$DYLIB_SRC" packages/RyukGram.dylib
rm -rf packages/RyukGram.bundle
cp -R "$BUNDLE_SRC" packages/RyukGram.bundle
if [ "${{ inputs.build_sideload }}" = "true" ]; then
# Match the @rpath LC that ipapatch writes into target binaries.
cp "$ZX_DYLIB" packages/zxPluginsInject.dylib
install_name_tool -id "@rpath/zxPluginsInject.dylib" packages/zxPluginsInject.dylib 2>/dev/null || true
fi
if [ "${{ inputs.build_noplugins }}" = "true" ]; then
cp "$NP_DYLIB" packages/NoPluginsPatch.dylib
fi
rm -rf "$STAGE"
ls -la packages
ls -la packages/RyukGram.bundle | head -20
- name: Prepare Instagram IPA
env:
Instagram_URL: ${{ inputs.decrypted_instagram_url }}
run: |
set -euo pipefail
wget "$Instagram_URL" --no-verbose -O packages/com.burbn.instagram.ipa
ls -la packages
- name: Build sideloaded IPA (cyan + ipapatch with zxPluginsInject)
if: ${{ inputs.build_sideload }}
env:
DUP_NAME: ${{ inputs.dup_name }}
run: |
set -euo pipefail
rm -f packages/RyukGram-sideloaded.ipa
NAME_ARGS=()
[ -n "$DUP_NAME" ] && NAME_ARGS=(-n "$DUP_NAME")
cyan \
-i packages/com.burbn.instagram.ipa \
-o packages/RyukGram-sideloaded.ipa \
-f packages/RyukGram.dylib packages/RyukGram.bundle \
-c 9 -m 15.0 -du \
${NAME_ARGS[@]+"${NAME_ARGS[@]}"}
# Embed Safari "Open in Instagram" extension before ipapatch
# re-signs, so instagram.com links open the app.
APPEX_SRC="extensions/OpenInstagramSafariExtension.appex"
if [ -d "$APPEX_SRC" ]; then
echo "Embedding Safari extension"
INJECT_TMP="$(mktemp -d)"
unzip -q packages/RyukGram-sideloaded.ipa -d "$INJECT_TMP"
APP_DIR="$(find "$INJECT_TMP/Payload" -maxdepth 1 -type d -name '*.app' | head -1)"
if [ -n "$APP_DIR" ]; then
mkdir -p "$APP_DIR/PlugIns"
rm -rf "$APP_DIR/PlugIns/OpenInstagramSafariExtension.appex"
cp -R "$APPEX_SRC" "$APP_DIR/PlugIns/"
( cd "$INJECT_TMP" && zip -qr -9 ../repacked.ipa Payload )
mv "$INJECT_TMP/../repacked.ipa" packages/RyukGram-sideloaded.ipa
fi
rm -rf "$INJECT_TMP"
fi
echo "Running ipapatch (zxPluginsInject LC injection)"
ipapatch \
--input packages/RyukGram-sideloaded.ipa \
--inplace --noconfirm \
--dylib packages/zxPluginsInject.dylib
mv packages/RyukGram-sideloaded.ipa "packages/RyukGram_sideloaded_v${VERSION}${SUF}.ipa"
ls -la packages
- name: Build no-plugins IPA (cyan + NoPluginsPatch, appex stripped)
if: ${{ inputs.build_noplugins }}
env:
DUP_ID: ${{ inputs.dup_bundle_id }}
DUP_NAME: ${{ inputs.dup_name }}
run: |
set -euo pipefail
rm -f packages/RyukGram-noplugins.ipa
DUP_ARGS=()
[ -n "$DUP_ID" ] && DUP_ARGS+=(-b "$DUP_ID")
[ -n "$DUP_NAME" ] && DUP_ARGS+=(-n "$DUP_NAME")
cyan \
-i packages/com.burbn.instagram.ipa \
-o packages/RyukGram-noplugins.ipa \
-f packages/RyukGram.dylib packages/NoPluginsPatch.dylib packages/RyukGram.bundle \
-c 9 -m 15.0 -du \
${DUP_ARGS[@]+"${DUP_ARGS[@]}"}
# No-plugins: strip every app extension (no ipapatch, no Safari ext).
INJECT_TMP="$(mktemp -d)"
unzip -q packages/RyukGram-noplugins.ipa -d "$INJECT_TMP"
APP_DIR="$(find "$INJECT_TMP/Payload" -maxdepth 1 -type d -name '*.app' | head -1)"
if [ -n "$APP_DIR" ]; then
find "$APP_DIR" -type d -name '*.appex' -prune -exec rm -rf {} +
( cd "$INJECT_TMP" && zip -qr -9 ../repacked.ipa Payload )
mv "$INJECT_TMP/../repacked.ipa" packages/RyukGram-noplugins.ipa
fi
rm -rf "$INJECT_TMP"
OUT="RyukGram_noplugins_v${VERSION}${SUF}.ipa"
[ -n "$DUP_ID" ] && OUT="RyukGram_noplugins_dup_v${VERSION}${SUF}.ipa"
mv packages/RyukGram-noplugins.ipa "packages/${OUT}"
ls -la packages
- name: Upload sideload IPA artifact
if: ${{ inputs.upload_artifact && inputs.build_sideload }}
uses: actions/upload-artifact@v4
with:
name: RyukGram_sideloaded_v${{ steps.tag.outputs.version }}
path: packages/RyukGram_sideloaded_v*.ipa
if-no-files-found: error
- name: Upload no-plugins IPA artifact
if: ${{ inputs.upload_artifact && inputs.build_noplugins }}
uses: actions/upload-artifact@v4
with:
name: RyukGram_noplugins_v${{ steps.tag.outputs.version }}
path: packages/RyukGram_noplugins*.ipa
if-no-files-found: error
-152
View File
@@ -1,152 +0,0 @@
name: Build and Package RyukGram
on:
workflow_dispatch:
inputs:
decrypted_instagram_url:
description: "The direct URL to the decrypted Instagram IPA"
default: ""
required: true
type: string
upload_artifact:
description: "Upload Artifact"
default: true
required: false
type: boolean
build_tipa:
description: "Build tipa"
default: false
required: false
type: boolean
concurrency:
group: ${{ github.workflow }}-${{ github.ref }}
cancel-in-progress: true
jobs:
build:
name: Build RyukGram
runs-on: macos-latest
permissions:
contents: write
steps:
- name: Checkout Main
uses: actions/checkout@v4
with:
path: main
submodules: recursive
- name: Install Dependencies
run: brew install ldid dpkg make
- name: Set PATH environment variable
run: echo "$(brew --prefix make)/libexec/gnubin" >> $GITHUB_PATH
- name: Setup Theos
uses: actions/checkout@v4
with:
repository: theos/theos
ref: master
path: ${{ github.workspace }}/theos
submodules: recursive
- name: SDK Caching
id: SDK
uses: actions/cache@v4
env:
cache-name: iPhoneOS16.2.sdk
with:
path: ${{ github.workspace }}/theos/sdks/
key: ${{ env.cache-name }}
restore-keys: ${{ env.cache-name }}
- name: Download iOS SDK
if: steps.SDK.outputs.cache-hit != 'true'
run: |
git clone --quiet -n --depth=1 --filter=tree:0 https://github.com/xybp888/iOS-SDKs/
cd iOS-SDKs
git sparse-checkout set --no-cone iPhoneOS16.2.sdk
git checkout
mv *.sdk $THEOS/sdks
env:
THEOS: ${{ github.workspace }}/theos
- name: Prepare Instagram IPA
run: |
cd main
mkdir -p packages
wget "$Instagram_URL" --no-verbose -O packages/com.burbn.instagram.ipa
ls -la packages
env:
THEOS: ${{ github.workspace }}/theos
Instagram_URL: ${{ inputs.decrypted_instagram_url }}
- name: Get Version
id: version
run: |
VERSION=$(awk '/Version:/ {print $2}' main/control)
echo "VERSION=${VERSION}" >> "$GITHUB_ENV"
echo "version=${VERSION}" >> "$GITHUB_OUTPUT"
- name: Setup FFmpegKit
run: cd main && ./scripts/setup-ffmpegkit.sh
- name: Build sideloaded IPA (rootless deb → cyan inject)
run: |
pip install --force-reinstall https://github.com/asdfzxcvbn/pyzule-rw/archive/main.zip
cd main
curl -Lo ipapatch https://github.com/asdfzxcvbn/ipapatch/releases/download/v2.1.3/ipapatch.macos-arm64
chmod +x ipapatch
export PATH=.:$PATH
./build.sh sideload
ls -la packages
env:
THEOS: ${{ github.workspace }}/theos
- name: Rename IPA
run: |
cd main/packages
IPA=$(ls -t *.ipa | grep -iv instagram | head -n1)
[ -n "$IPA" ] && mv "$IPA" "RyukGram_sideloaded_v${VERSION}.ipa"
- name: Duplicate as .tipa
if: ${{ inputs.build_tipa }}
run: |
cd main/packages
cp "RyukGram_sideloaded_v${VERSION}.ipa" "RyukGram_trollstore_v${VERSION}.tipa"
- name: Pass package name to upload action
id: package_name
run: |
echo "package=$(ls -t main/packages/RyukGram_sideloaded_v*.ipa | head -n1 | xargs basename)" >> "$GITHUB_OUTPUT"
- name: Upload IPA Artifact
if: ${{ inputs.upload_artifact }}
uses: actions/upload-artifact@v4
with:
name: RyukGram_sideloaded_v${{ steps.version.outputs.version }}
path: ${{ github.workspace }}/main/packages/${{ steps.package_name.outputs.package }}
if-no-files-found: error
- name: Upload TIPA Artifact
if: ${{ inputs.upload_artifact && inputs.build_tipa }}
uses: actions/upload-artifact@v4
with:
name: RyukGram_trollstore_v${{ steps.version.outputs.version }}
path: ${{ github.workspace }}/main/packages/RyukGram_trollstore_v*.tipa
if-no-files-found: error
- name: Create Release
uses: softprops/action-gh-release@v2.0.6
with:
name: RyukGram_sideloaded_v${{ steps.version.outputs.version }}
files: |
${{ github.workspace }}/main/packages/RyukGram_sideloaded_v*.ipa
${{ github.workspace }}/main/packages/RyukGram_trollstore_v*.tipa
draft: true
- name: Output Release URL
run: |
echo "::notice::Release available at: https://github.com/${{ github.repository }}/releases"
-105
View File
@@ -1,105 +0,0 @@
name: Build RyukGram tweak (rootless + rootful)
on:
push:
branches:
- 'main'
- 'dev'
workflow_dispatch:
concurrency:
group: ${{ github.workflow }}-${{ github.ref }}
cancel-in-progress: true
jobs:
build:
name: Build RyukGram
runs-on: macos-latest
permissions:
contents: write
steps:
- name: Checkout Main
uses: actions/checkout@v4
with:
path: main
- name: Install Dependencies
run: brew install ldid dpkg make
- name: Set PATH environment variable
run: echo "$(brew --prefix make)/libexec/gnubin" >> $GITHUB_PATH
- name: Setup Theos
uses: actions/checkout@v4
with:
repository: theos/theos
ref: master
path: ${{ github.workspace }}/theos
submodules: recursive
- name: SDK Caching
id: SDK
uses: actions/cache@v4
env:
cache-name: iPhoneOS16.2.sdk
with:
path: ${{ github.workspace }}/theos/sdks/
key: ${{ env.cache-name }}
restore-keys: ${{ env.cache-name }}
- name: Download iOS SDK
if: steps.SDK.outputs.cache-hit != 'true'
run: |
git clone --quiet -n --depth=1 --filter=tree:0 https://github.com/xybp888/iOS-SDKs/
cd iOS-SDKs
git sparse-checkout set --no-cone iPhoneOS16.2.sdk
git checkout
mv *.sdk $THEOS/sdks
env:
THEOS: ${{ github.workspace }}/theos
- name: Get Version
id: version
run: |
VERSION=$(awk '/Version:/ {print $2}' main/control)
echo "VERSION=${VERSION}" >> "$GITHUB_ENV"
echo "version=${VERSION}" >> "$GITHUB_OUTPUT"
- name: Setup FFmpegKit
run: cd main && ./scripts/setup-ffmpegkit.sh
- name: Build rootless
run: |
cd main
./build.sh rootless
cd packages
DEB="$(ls -t *-rootless.deb | head -n1)"
[ -n "$DEB" ] && mv "$DEB" "com.faroukbmiled.ryukgram_${VERSION}+debug-rootless.deb"
ls -la
env:
THEOS: ${{ github.workspace }}/theos
- name: Build rootful
run: |
cd main
./build.sh rootful
cd packages
DEB="$(ls -t *-rootful.deb | head -n1)"
[ -n "$DEB" ] && mv "$DEB" "com.faroukbmiled.ryukgram_${VERSION}+debug-rootful.deb"
ls -la
env:
THEOS: ${{ github.workspace }}/theos
- name: Upload rootless artifact
uses: actions/upload-artifact@v4
with:
name: com.faroukbmiled.ryukgram_${{ env.VERSION }}+debug-rootless.deb
path: ${{ github.workspace }}/main/packages/com.faroukbmiled.ryukgram_${{ env.VERSION }}+debug-rootless.deb
if-no-files-found: error
- name: Upload rootful artifact
uses: actions/upload-artifact@v4
with:
name: com.faroukbmiled.ryukgram_${{ env.VERSION }}+debug-rootful.deb
path: ${{ github.workspace }}/main/packages/com.faroukbmiled.ryukgram_${{ env.VERSION }}+debug-rootful.deb
if-no-files-found: error
@@ -1,70 +0,0 @@
name: Delete old workflow runs
on:
workflow_dispatch:
inputs:
days:
description: 'Days-worth of runs to keep for each workflow'
required: true
default: '7'
minimum_runs:
description: 'Minimum runs to keep for each workflow'
required: true
default: '5'
delete_workflow_pattern:
description: 'Name or filename of the workflow (if not set, all workflows are targeted)'
required: false
default: 'Build and Package RyukGram'
delete_workflow_by_state_pattern:
description: 'Filter workflows by state: active, deleted, disabled_fork, disabled_inactivity, disabled_manually'
required: true
default: "ALL"
type: choice
options:
- "ALL"
- active
- deleted
- disabled_inactivity
- disabled_manually
delete_run_by_conclusion_pattern:
description: 'Remove runs based on conclusion: action_required, cancelled, failure, skipped, success'
required: true
default: "ALL"
type: choice
options:
- "ALL"
- "Unsuccessful: action_required,cancelled,failure,skipped"
- action_required
- cancelled
- failure
- skipped
- success
dry_run:
description: 'Logs simulated changes, no deletions are performed'
required: false
# schedule:
# - cron: '0 0 * * *'
jobs:
del_runs:
runs-on: ubuntu-latest
permissions:
actions: write
contents: read
steps:
- name: Delete workflow runs
uses: Mattraks/delete-workflow-runs@v2
with:
token: ${{ github.token }}
repository: ${{ github.repository }}
retain_days: ${{ github.event.inputs.days }}
keep_minimum_runs: ${{ github.event.inputs.minimum_runs }}
delete_workflow_pattern: ${{ github.event.inputs.delete_workflow_pattern }}
delete_workflow_by_state_pattern: ${{ github.event.inputs.delete_workflow_by_state_pattern }}
delete_run_by_conclusion_pattern: >-
${{
startsWith(github.event.inputs.delete_run_by_conclusion_pattern, 'Unsuccessful:')
&& 'action_required,cancelled,failure,skipped'
|| github.event.inputs.delete_run_by_conclusion_pattern
}}
dry_run: ${{ github.event.inputs.dry_run }}
-148
View File
@@ -1,148 +0,0 @@
name: Build and Release RyukGram
on:
push:
branches:
- 'main'
workflow_dispatch:
concurrency:
group: ${{ github.workflow }}-${{ github.ref }}
cancel-in-progress: true
jobs:
build:
name: Build RyukGram
runs-on: macos-latest
permissions:
contents: write
steps:
- name: Checkout
uses: actions/checkout@v4
with:
submodules: recursive
- name: Install Dependencies
run: brew install ldid dpkg make
- name: Set PATH
run: echo "$(brew --prefix make)/libexec/gnubin" >> $GITHUB_PATH
- name: Setup Theos
uses: actions/checkout@v4
with:
repository: theos/theos
ref: master
path: ${{ github.workspace }}/theos
submodules: recursive
- name: SDK Caching
id: SDK
uses: actions/cache@v4
env:
cache-name: iPhoneOS16.2.sdk
with:
path: ${{ github.workspace }}/theos/sdks/
key: ${{ env.cache-name }}
restore-keys: ${{ env.cache-name }}
- name: Download iOS SDK
if: steps.SDK.outputs.cache-hit != 'true'
run: |
git clone --quiet -n --depth=1 --filter=tree:0 https://github.com/xybp888/iOS-SDKs/
cd iOS-SDKs
git sparse-checkout set --no-cone iPhoneOS16.2.sdk
git checkout
mv *.sdk $THEOS/sdks
env:
THEOS: ${{ github.workspace }}/theos
- name: Get Version
id: version
run: |
VERSION=$(awk '/Version:/ {print $2}' control)
echo "VERSION=${VERSION}" >> "$GITHUB_ENV"
echo "version=${VERSION}" >> "$GITHUB_OUTPUT"
- name: Setup FFmpegKit
run: ./scripts/setup-ffmpegkit.sh
- name: Build rootless deb
run: |
export THEOS="${{ github.workspace }}/theos"
./build.sh rootless
cd packages
DEB="$(ls -t *-rootless.deb | head -n1)"
[ -n "$DEB" ] && mv "$DEB" "RyukGram_${VERSION}_rootless.deb"
ls -la
- name: Build rootful deb
run: |
export THEOS="${{ github.workspace }}/theos"
./build.sh rootful
cd packages
DEB="$(ls -t *-rootful.deb | head -n1)"
[ -n "$DEB" ] && mv "$DEB" "RyukGram_${VERSION}_rootful.deb"
ls -la
- name: Upload rootless artifact
uses: actions/upload-artifact@v4
with:
name: RyukGram_v${{ steps.version.outputs.version }}_rootless
path: packages/RyukGram_${{ env.VERSION }}_rootless.deb
if-no-files-found: error
- name: Upload rootful artifact
uses: actions/upload-artifact@v4
with:
name: RyukGram_v${{ steps.version.outputs.version }}_rootful
path: packages/RyukGram_${{ env.VERSION }}_rootful.deb
if-no-files-found: error
- name: Check if release
id: check_release
run: |
COMMIT_MSG=$(git log -1 --pretty=%B)
if [[ "$COMMIT_MSG" == *"[release]"* ]] || [[ "${{ github.event_name }}" == "workflow_dispatch" ]]; then
echo "should_release=true" >> "$GITHUB_OUTPUT"
else
echo "should_release=false" >> "$GITHUB_OUTPUT"
fi
- name: Generate release notes
if: steps.check_release.outputs.should_release == 'true'
run: |
PREV_TAG=$(git tag --sort=-creatordate | grep -v "v${VERSION}$" | head -n1 || true)
{
echo "## Changelog"
echo ""
git log -1 --pretty=%B | tail -n +2 | sed -e '/^<!--/,/-->$/d' -e '/^\[release\]/d'
echo ""
echo "## Downloads"
echo ""
echo "| File | Description |"
echo "|------|-------------|"
echo "| \`RyukGram_rootless.deb\` | Rootless .deb (Dopamine/palera1n). Also works for sideloading via Feather/cyan. |"
echo "| \`RyukGram_rootful.deb\` | Rootful .deb (unc0ver/checkra1n). |"
echo ""
if [ -n "$PREV_TAG" ]; then
echo "**Full changelog:** [\`${PREV_TAG}\`...\`v${VERSION}\`](https://github.com/${{ github.repository }}/compare/${PREV_TAG}...v${VERSION})"
else
echo "**[All commits](https://github.com/${{ github.repository }}/commits/main)**"
fi
} > /tmp/release_notes.md
- name: Create Release
if: steps.check_release.outputs.should_release == 'true'
run: |
SUBJECT=$(git log -1 --pretty=%s | sed 's/\[release\]//g' | xargs)
TITLE="${SUBJECT:-RyukGram v${VERSION}}"
gh release create "v${VERSION}" \
--repo "${{ github.repository }}" \
--title "$TITLE" \
--notes-file /tmp/release_notes.md \
"packages/RyukGram_${VERSION}_rootless.deb" \
"packages/RyukGram_${VERSION}_rootful.deb"
env:
GH_TOKEN: ${{ github.token }}
+1 -4
View File
@@ -33,13 +33,9 @@ livecontainer
src/**/wip.x
src/**/wip.xm
.claude
CLAUDE.md
upstream-scinsta
*.ipa
*.dylib
deploy.sh
PENDING_CHANGES.*
wrapper/
scripts/*.py
scripts/__pycache__/
@@ -53,5 +49,6 @@ exp_flags/
# Source packaging
zip-src.sh
RyukGram-src-*.zip
RYG*.md
*.zip
*_diff.txt
-3
View File
@@ -1,3 +0,0 @@
[submodule "modules/FLEXing"]
path = modules/FLEXing
url = https://github.com/SoCuul/FLEXing
-19
View File
@@ -1,19 +0,0 @@
{
"editor.tabSize": 4,
"editor.insertSpaces": true,
"editor.trimAutoWhitespace": true,
"editor.formatOnSave": false,
"files.associations": {
"*.x": "logos",
"*.xi": "logos",
"*.xm": "logos",
"*.xmi": "logos",
"*.m": "objective-c",
"*.h": "objective-c"
},
"search.exclude": {
"modules/": true,
"dumps/": true
}
}
-27
View File
@@ -1,27 +0,0 @@
{
"SCIUtils: Bool Pref": {
"prefix": "scibool",
"body": [
"if ([SCIUtils getBoolPref:@\"${1:key}\"]) $0"
]
},
"SCIUtils: String Pref": {
"prefix": "scistring",
"body": [
"if ([[SCIUtils getStringPref:@\"${1:key}\"] isEqualToString:@\"${2:string}\"]) $0"
]
},
"SCIUtils: Log": {
"prefix": "scilog",
"body": [
"SCILog($0);"
]
},
"SCIUtils: Log Id": {
"prefix": "scilogid",
"body": [
"SCILogId(@\"${1:prefix}\", $0);"
]
}
}
-59
View File
@@ -1,59 +0,0 @@
{
// See https://go.microsoft.com/fwlink/?LinkId=733558
// for the documentation about the tasks.json format
"version": "2.0.0",
"tasks": [
{
"label": "Compile tweak and deploy to LiveContainer",
"type": "shell",
"command": "./build-dev.sh",
"group": {
"kind": "build",
"isDefault": true
},
"presentation": {
"reveal": "always",
"panel": "dedicated",
"clear": true
},
"icon": {
"color": "terminal.ansiCyan",
"id": "run-all"
}
},
{
"label": "Build RyukGram and deploy with IPA",
"type": "shell",
"command": "./build-dev.sh true",
"group": {
"kind": "build",
},
"presentation": {
"reveal": "always",
"panel": "dedicated",
"clear": true
},
"icon": {
"id": "package"
}
},
{
"label": "Launch pymobiledevice3 device tunnel (for quick dev builds)",
"type": "shell",
"command": "sudo pymobiledevice3 remote tunneld",
"group": {
"kind": "build",
},
"presentation": {
"reveal": "silent",
"panel": "dedicated",
"clear": true
},
"icon": {
"color": "terminal.ansiYellow",
"id": "debug-connected"
}
}
]
}
+56 -674
View File
@@ -1,674 +1,56 @@
GNU GENERAL PUBLIC LICENSE
Version 3, 29 June 2007
Copyright (C) 2007 Free Software Foundation, Inc. <https://fsf.org/>
Everyone is permitted to copy and distribute verbatim copies
of this license document, but changing it is not allowed.
Preamble
The GNU General Public License is a free, copyleft license for
software and other kinds of works.
The licenses for most software and other practical works are designed
to take away your freedom to share and change the works. By contrast,
the GNU General Public License is intended to guarantee your freedom to
share and change all versions of a program--to make sure it remains free
software for all its users. We, the Free Software Foundation, use the
GNU General Public License for most of our software; it applies also to
any other work released this way by its authors. You can apply it to
your programs, too.
When we speak of free software, we are referring to freedom, not
price. Our General Public Licenses are designed to make sure that you
have the freedom to distribute copies of free software (and charge for
them if you wish), that you receive source code or can get it if you
want it, that you can change the software or use pieces of it in new
free programs, and that you know you can do these things.
To protect your rights, we need to prevent others from denying you
these rights or asking you to surrender the rights. Therefore, you have
certain responsibilities if you distribute copies of the software, or if
you modify it: responsibilities to respect the freedom of others.
For example, if you distribute copies of such a program, whether
gratis or for a fee, you must pass on to the recipients the same
freedoms that you received. You must make sure that they, too, receive
or can get the source code. And you must show them these terms so they
know their rights.
Developers that use the GNU GPL protect your rights with two steps:
(1) assert copyright on the software, and (2) offer you this License
giving you legal permission to copy, distribute and/or modify it.
For the developers' and authors' protection, the GPL clearly explains
that there is no warranty for this free software. For both users' and
authors' sake, the GPL requires that modified versions be marked as
changed, so that their problems will not be attributed erroneously to
authors of previous versions.
Some devices are designed to deny users access to install or run
modified versions of the software inside them, although the manufacturer
can do so. This is fundamentally incompatible with the aim of
protecting users' freedom to change the software. The systematic
pattern of such abuse occurs in the area of products for individuals to
use, which is precisely where it is most unacceptable. Therefore, we
have designed this version of the GPL to prohibit the practice for those
products. If such problems arise substantially in other domains, we
stand ready to extend this provision to those domains in future versions
of the GPL, as needed to protect the freedom of users.
Finally, every program is threatened constantly by software patents.
States should not allow patents to restrict development and use of
software on general-purpose computers, but in those that do, we wish to
avoid the special danger that patents applied to a free program could
make it effectively proprietary. To prevent this, the GPL assures that
patents cannot be used to render the program non-free.
The precise terms and conditions for copying, distribution and
modification follow.
TERMS AND CONDITIONS
0. Definitions.
"This License" refers to version 3 of the GNU General Public License.
"Copyright" also means copyright-like laws that apply to other kinds of
works, such as semiconductor masks.
"The Program" refers to any copyrightable work licensed under this
License. Each licensee is addressed as "you". "Licensees" and
"recipients" may be individuals or organizations.
To "modify" a work means to copy from or adapt all or part of the work
in a fashion requiring copyright permission, other than the making of an
exact copy. The resulting work is called a "modified version" of the
earlier work or a work "based on" the earlier work.
A "covered work" means either the unmodified Program or a work based
on the Program.
To "propagate" a work means to do anything with it that, without
permission, would make you directly or secondarily liable for
infringement under applicable copyright law, except executing it on a
computer or modifying a private copy. Propagation includes copying,
distribution (with or without modification), making available to the
public, and in some countries other activities as well.
To "convey" a work means any kind of propagation that enables other
parties to make or receive copies. Mere interaction with a user through
a computer network, with no transfer of a copy, is not conveying.
An interactive user interface displays "Appropriate Legal Notices"
to the extent that it includes a convenient and prominently visible
feature that (1) displays an appropriate copyright notice, and (2)
tells the user that there is no warranty for the work (except to the
extent that warranties are provided), that licensees may convey the
work under this License, and how to view a copy of this License. If
the interface presents a list of user commands or options, such as a
menu, a prominent item in the list meets this criterion.
1. Source Code.
The "source code" for a work means the preferred form of the work
for making modifications to it. "Object code" means any non-source
form of a work.
A "Standard Interface" means an interface that either is an official
standard defined by a recognized standards body, or, in the case of
interfaces specified for a particular programming language, one that
is widely used among developers working in that language.
The "System Libraries" of an executable work include anything, other
than the work as a whole, that (a) is included in the normal form of
packaging a Major Component, but which is not part of that Major
Component, and (b) serves only to enable use of the work with that
Major Component, or to implement a Standard Interface for which an
implementation is available to the public in source code form. A
"Major Component", in this context, means a major essential component
(kernel, window system, and so on) of the specific operating system
(if any) on which the executable work runs, or a compiler used to
produce the work, or an object code interpreter used to run it.
The "Corresponding Source" for a work in object code form means all
the source code needed to generate, install, and (for an executable
work) run the object code and to modify the work, including scripts to
control those activities. However, it does not include the work's
System Libraries, or general-purpose tools or generally available free
programs which are used unmodified in performing those activities but
which are not part of the work. For example, Corresponding Source
includes interface definition files associated with source files for
the work, and the source code for shared libraries and dynamically
linked subprograms that the work is specifically designed to require,
such as by intimate data communication or control flow between those
subprograms and other parts of the work.
The Corresponding Source need not include anything that users
can regenerate automatically from other parts of the Corresponding
Source.
The Corresponding Source for a work in source code form is that
same work.
2. Basic Permissions.
All rights granted under this License are granted for the term of
copyright on the Program, and are irrevocable provided the stated
conditions are met. This License explicitly affirms your unlimited
permission to run the unmodified Program. The output from running a
covered work is covered by this License only if the output, given its
content, constitutes a covered work. This License acknowledges your
rights of fair use or other equivalent, as provided by copyright law.
You may make, run and propagate covered works that you do not
convey, without conditions so long as your license otherwise remains
in force. You may convey covered works to others for the sole purpose
of having them make modifications exclusively for you, or provide you
with facilities for running those works, provided that you comply with
the terms of this License in conveying all material for which you do
not control copyright. Those thus making or running the covered works
for you must do so exclusively on your behalf, under your direction
and control, on terms that prohibit them from making any copies of
your copyrighted material outside their relationship with you.
Conveying under any other circumstances is permitted solely under
the conditions stated below. Sublicensing is not allowed; section 10
makes it unnecessary.
3. Protecting Users' Legal Rights From Anti-Circumvention Law.
No covered work shall be deemed part of an effective technological
measure under any applicable law fulfilling obligations under article
11 of the WIPO copyright treaty adopted on 20 December 1996, or
similar laws prohibiting or restricting circumvention of such
measures.
When you convey a covered work, you waive any legal power to forbid
circumvention of technological measures to the extent such circumvention
is effected by exercising rights under this License with respect to
the covered work, and you disclaim any intention to limit operation or
modification of the work as a means of enforcing, against the work's
users, your or third parties' legal rights to forbid circumvention of
technological measures.
4. Conveying Verbatim Copies.
You may convey verbatim copies of the Program's source code as you
receive it, in any medium, provided that you conspicuously and
appropriately publish on each copy an appropriate copyright notice;
keep intact all notices stating that this License and any
non-permissive terms added in accord with section 7 apply to the code;
keep intact all notices of the absence of any warranty; and give all
recipients a copy of this License along with the Program.
You may charge any price or no price for each copy that you convey,
and you may offer support or warranty protection for a fee.
5. Conveying Modified Source Versions.
You may convey a work based on the Program, or the modifications to
produce it from the Program, in the form of source code under the
terms of section 4, provided that you also meet all of these conditions:
a) The work must carry prominent notices stating that you modified
it, and giving a relevant date.
b) The work must carry prominent notices stating that it is
released under this License and any conditions added under section
7. This requirement modifies the requirement in section 4 to
"keep intact all notices".
c) You must license the entire work, as a whole, under this
License to anyone who comes into possession of a copy. This
License will therefore apply, along with any applicable section 7
additional terms, to the whole of the work, and all its parts,
regardless of how they are packaged. This License gives no
permission to license the work in any other way, but it does not
invalidate such permission if you have separately received it.
d) If the work has interactive user interfaces, each must display
Appropriate Legal Notices; however, if the Program has interactive
interfaces that do not display Appropriate Legal Notices, your
work need not make them do so.
A compilation of a covered work with other separate and independent
works, which are not by their nature extensions of the covered work,
and which are not combined with it such as to form a larger program,
in or on a volume of a storage or distribution medium, is called an
"aggregate" if the compilation and its resulting copyright are not
used to limit the access or legal rights of the compilation's users
beyond what the individual works permit. Inclusion of a covered work
in an aggregate does not cause this License to apply to the other
parts of the aggregate.
6. Conveying Non-Source Forms.
You may convey a covered work in object code form under the terms
of sections 4 and 5, provided that you also convey the
machine-readable Corresponding Source under the terms of this License,
in one of these ways:
a) Convey the object code in, or embodied in, a physical product
(including a physical distribution medium), accompanied by the
Corresponding Source fixed on a durable physical medium
customarily used for software interchange.
b) Convey the object code in, or embodied in, a physical product
(including a physical distribution medium), accompanied by a
written offer, valid for at least three years and valid for as
long as you offer spare parts or customer support for that product
model, to give anyone who possesses the object code either (1) a
copy of the Corresponding Source for all the software in the
product that is covered by this License, on a durable physical
medium customarily used for software interchange, for a price no
more than your reasonable cost of physically performing this
conveying of source, or (2) access to copy the
Corresponding Source from a network server at no charge.
c) Convey individual copies of the object code with a copy of the
written offer to provide the Corresponding Source. This
alternative is allowed only occasionally and noncommercially, and
only if you received the object code with such an offer, in accord
with subsection 6b.
d) Convey the object code by offering access from a designated
place (gratis or for a charge), and offer equivalent access to the
Corresponding Source in the same way through the same place at no
further charge. You need not require recipients to copy the
Corresponding Source along with the object code. If the place to
copy the object code is a network server, the Corresponding Source
may be on a different server (operated by you or a third party)
that supports equivalent copying facilities, provided you maintain
clear directions next to the object code saying where to find the
Corresponding Source. Regardless of what server hosts the
Corresponding Source, you remain obligated to ensure that it is
available for as long as needed to satisfy these requirements.
e) Convey the object code using peer-to-peer transmission, provided
you inform other peers where the object code and Corresponding
Source of the work are being offered to the general public at no
charge under subsection 6d.
A separable portion of the object code, whose source code is excluded
from the Corresponding Source as a System Library, need not be
included in conveying the object code work.
A "User Product" is either (1) a "consumer product", which means any
tangible personal property which is normally used for personal, family,
or household purposes, or (2) anything designed or sold for incorporation
into a dwelling. In determining whether a product is a consumer product,
doubtful cases shall be resolved in favor of coverage. For a particular
product received by a particular user, "normally used" refers to a
typical or common use of that class of product, regardless of the status
of the particular user or of the way in which the particular user
actually uses, or expects or is expected to use, the product. A product
is a consumer product regardless of whether the product has substantial
commercial, industrial or non-consumer uses, unless such uses represent
the only significant mode of use of the product.
"Installation Information" for a User Product means any methods,
procedures, authorization keys, or other information required to install
and execute modified versions of a covered work in that User Product from
a modified version of its Corresponding Source. The information must
suffice to ensure that the continued functioning of the modified object
code is in no case prevented or interfered with solely because
modification has been made.
If you convey an object code work under this section in, or with, or
specifically for use in, a User Product, and the conveying occurs as
part of a transaction in which the right of possession and use of the
User Product is transferred to the recipient in perpetuity or for a
fixed term (regardless of how the transaction is characterized), the
Corresponding Source conveyed under this section must be accompanied
by the Installation Information. But this requirement does not apply
if neither you nor any third party retains the ability to install
modified object code on the User Product (for example, the work has
been installed in ROM).
The requirement to provide Installation Information does not include a
requirement to continue to provide support service, warranty, or updates
for a work that has been modified or installed by the recipient, or for
the User Product in which it has been modified or installed. Access to a
network may be denied when the modification itself materially and
adversely affects the operation of the network or violates the rules and
protocols for communication across the network.
Corresponding Source conveyed, and Installation Information provided,
in accord with this section must be in a format that is publicly
documented (and with an implementation available to the public in
source code form), and must require no special password or key for
unpacking, reading or copying.
7. Additional Terms.
"Additional permissions" are terms that supplement the terms of this
License by making exceptions from one or more of its conditions.
Additional permissions that are applicable to the entire Program shall
be treated as though they were included in this License, to the extent
that they are valid under applicable law. If additional permissions
apply only to part of the Program, that part may be used separately
under those permissions, but the entire Program remains governed by
this License without regard to the additional permissions.
When you convey a copy of a covered work, you may at your option
remove any additional permissions from that copy, or from any part of
it. (Additional permissions may be written to require their own
removal in certain cases when you modify the work.) You may place
additional permissions on material, added by you to a covered work,
for which you have or can give appropriate copyright permission.
Notwithstanding any other provision of this License, for material you
add to a covered work, you may (if authorized by the copyright holders of
that material) supplement the terms of this License with terms:
a) Disclaiming warranty or limiting liability differently from the
terms of sections 15 and 16 of this License; or
b) Requiring preservation of specified reasonable legal notices or
author attributions in that material or in the Appropriate Legal
Notices displayed by works containing it; or
c) Prohibiting misrepresentation of the origin of that material, or
requiring that modified versions of such material be marked in
reasonable ways as different from the original version; or
d) Limiting the use for publicity purposes of names of licensors or
authors of the material; or
e) Declining to grant rights under trademark law for use of some
trade names, trademarks, or service marks; or
f) Requiring indemnification of licensors and authors of that
material by anyone who conveys the material (or modified versions of
it) with contractual assumptions of liability to the recipient, for
any liability that these contractual assumptions directly impose on
those licensors and authors.
All other non-permissive additional terms are considered "further
restrictions" within the meaning of section 10. If the Program as you
received it, or any part of it, contains a notice stating that it is
governed by this License along with a term that is a further
restriction, you may remove that term. If a license document contains
a further restriction but permits relicensing or conveying under this
License, you may add to a covered work material governed by the terms
of that license document, provided that the further restriction does
not survive such relicensing or conveying.
If you add terms to a covered work in accord with this section, you
must place, in the relevant source files, a statement of the
additional terms that apply to those files, or a notice indicating
where to find the applicable terms.
Additional terms, permissive or non-permissive, may be stated in the
form of a separately written license, or stated as exceptions;
the above requirements apply either way.
8. Termination.
You may not propagate or modify a covered work except as expressly
provided under this License. Any attempt otherwise to propagate or
modify it is void, and will automatically terminate your rights under
this License (including any patent licenses granted under the third
paragraph of section 11).
However, if you cease all violation of this License, then your
license from a particular copyright holder is reinstated (a)
provisionally, unless and until the copyright holder explicitly and
finally terminates your license, and (b) permanently, if the copyright
holder fails to notify you of the violation by some reasonable means
prior to 60 days after the cessation.
Moreover, your license from a particular copyright holder is
reinstated permanently if the copyright holder notifies you of the
violation by some reasonable means, this is the first time you have
received notice of violation of this License (for any work) from that
copyright holder, and you cure the violation prior to 30 days after
your receipt of the notice.
Termination of your rights under this section does not terminate the
licenses of parties who have received copies or rights from you under
this License. If your rights have been terminated and not permanently
reinstated, you do not qualify to receive new licenses for the same
material under section 10.
9. Acceptance Not Required for Having Copies.
You are not required to accept this License in order to receive or
run a copy of the Program. Ancillary propagation of a covered work
occurring solely as a consequence of using peer-to-peer transmission
to receive a copy likewise does not require acceptance. However,
nothing other than this License grants you permission to propagate or
modify any covered work. These actions infringe copyright if you do
not accept this License. Therefore, by modifying or propagating a
covered work, you indicate your acceptance of this License to do so.
10. Automatic Licensing of Downstream Recipients.
Each time you convey a covered work, the recipient automatically
receives a license from the original licensors, to run, modify and
propagate that work, subject to this License. You are not responsible
for enforcing compliance by third parties with this License.
An "entity transaction" is a transaction transferring control of an
organization, or substantially all assets of one, or subdividing an
organization, or merging organizations. If propagation of a covered
work results from an entity transaction, each party to that
transaction who receives a copy of the work also receives whatever
licenses to the work the party's predecessor in interest had or could
give under the previous paragraph, plus a right to possession of the
Corresponding Source of the work from the predecessor in interest, if
the predecessor has it or can get it with reasonable efforts.
You may not impose any further restrictions on the exercise of the
rights granted or affirmed under this License. For example, you may
not impose a license fee, royalty, or other charge for exercise of
rights granted under this License, and you may not initiate litigation
(including a cross-claim or counterclaim in a lawsuit) alleging that
any patent claim is infringed by making, using, selling, offering for
sale, or importing the Program or any portion of it.
11. Patents.
A "contributor" is a copyright holder who authorizes use under this
License of the Program or a work on which the Program is based. The
work thus licensed is called the contributor's "contributor version".
A contributor's "essential patent claims" are all patent claims
owned or controlled by the contributor, whether already acquired or
hereafter acquired, that would be infringed by some manner, permitted
by this License, of making, using, or selling its contributor version,
but do not include claims that would be infringed only as a
consequence of further modification of the contributor version. For
purposes of this definition, "control" includes the right to grant
patent sublicenses in a manner consistent with the requirements of
this License.
Each contributor grants you a non-exclusive, worldwide, royalty-free
patent license under the contributor's essential patent claims, to
make, use, sell, offer for sale, import and otherwise run, modify and
propagate the contents of its contributor version.
In the following three paragraphs, a "patent license" is any express
agreement or commitment, however denominated, not to enforce a patent
(such as an express permission to practice a patent or covenant not to
sue for patent infringement). To "grant" such a patent license to a
party means to make such an agreement or commitment not to enforce a
patent against the party.
If you convey a covered work, knowingly relying on a patent license,
and the Corresponding Source of the work is not available for anyone
to copy, free of charge and under the terms of this License, through a
publicly available network server or other readily accessible means,
then you must either (1) cause the Corresponding Source to be so
available, or (2) arrange to deprive yourself of the benefit of the
patent license for this particular work, or (3) arrange, in a manner
consistent with the requirements of this License, to extend the patent
license to downstream recipients. "Knowingly relying" means you have
actual knowledge that, but for the patent license, your conveying the
covered work in a country, or your recipient's use of the covered work
in a country, would infringe one or more identifiable patents in that
country that you have reason to believe are valid.
If, pursuant to or in connection with a single transaction or
arrangement, you convey, or propagate by procuring conveyance of, a
covered work, and grant a patent license to some of the parties
receiving the covered work authorizing them to use, propagate, modify
or convey a specific copy of the covered work, then the patent license
you grant is automatically extended to all recipients of the covered
work and works based on it.
A patent license is "discriminatory" if it does not include within
the scope of its coverage, prohibits the exercise of, or is
conditioned on the non-exercise of one or more of the rights that are
specifically granted under this License. You may not convey a covered
work if you are a party to an arrangement with a third party that is
in the business of distributing software, under which you make payment
to the third party based on the extent of your activity of conveying
the work, and under which the third party grants, to any of the
parties who would receive the covered work from you, a discriminatory
patent license (a) in connection with copies of the covered work
conveyed by you (or copies made from those copies), or (b) primarily
for and in connection with specific products or compilations that
contain the covered work, unless you entered into that arrangement,
or that patent license was granted, prior to 28 March 2007.
Nothing in this License shall be construed as excluding or limiting
any implied license or other defenses to infringement that may
otherwise be available to you under applicable patent law.
12. No Surrender of Others' Freedom.
If conditions are imposed on you (whether by court order, agreement or
otherwise) that contradict the conditions of this License, they do not
excuse you from the conditions of this License. If you cannot convey a
covered work so as to satisfy simultaneously your obligations under this
License and any other pertinent obligations, then as a consequence you may
not convey it at all. For example, if you agree to terms that obligate you
to collect a royalty for further conveying from those to whom you convey
the Program, the only way you could satisfy both those terms and this
License would be to refrain entirely from conveying the Program.
13. Use with the GNU Affero General Public License.
Notwithstanding any other provision of this License, you have
permission to link or combine any covered work with a work licensed
under version 3 of the GNU Affero General Public License into a single
combined work, and to convey the resulting work. The terms of this
License will continue to apply to the part which is the covered work,
but the special requirements of the GNU Affero General Public License,
section 13, concerning interaction through a network will apply to the
combination as such.
14. Revised Versions of this License.
The Free Software Foundation may publish revised and/or new versions of
the GNU General Public License from time to time. Such new versions will
be similar in spirit to the present version, but may differ in detail to
address new problems or concerns.
Each version is given a distinguishing version number. If the
Program specifies that a certain numbered version of the GNU General
Public License "or any later version" applies to it, you have the
option of following the terms and conditions either of that numbered
version or of any later version published by the Free Software
Foundation. If the Program does not specify a version number of the
GNU General Public License, you may choose any version ever published
by the Free Software Foundation.
If the Program specifies that a proxy can decide which future
versions of the GNU General Public License can be used, that proxy's
public statement of acceptance of a version permanently authorizes you
to choose that version for the Program.
Later license versions may give you additional or different
permissions. However, no additional obligations are imposed on any
author or copyright holder as a result of your choosing to follow a
later version.
15. Disclaimer of Warranty.
THERE IS NO WARRANTY FOR THE PROGRAM, TO THE EXTENT PERMITTED BY
APPLICABLE LAW. EXCEPT WHEN OTHERWISE STATED IN WRITING THE COPYRIGHT
HOLDERS AND/OR OTHER PARTIES PROVIDE THE PROGRAM "AS IS" WITHOUT WARRANTY
OF ANY KIND, EITHER EXPRESSED OR IMPLIED, INCLUDING, BUT NOT LIMITED TO,
THE IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR
PURPOSE. THE ENTIRE RISK AS TO THE QUALITY AND PERFORMANCE OF THE PROGRAM
IS WITH YOU. SHOULD THE PROGRAM PROVE DEFECTIVE, YOU ASSUME THE COST OF
ALL NECESSARY SERVICING, REPAIR OR CORRECTION.
16. Limitation of Liability.
IN NO EVENT UNLESS REQUIRED BY APPLICABLE LAW OR AGREED TO IN WRITING
WILL ANY COPYRIGHT HOLDER, OR ANY OTHER PARTY WHO MODIFIES AND/OR CONVEYS
THE PROGRAM AS PERMITTED ABOVE, BE LIABLE TO YOU FOR DAMAGES, INCLUDING ANY
GENERAL, SPECIAL, INCIDENTAL OR CONSEQUENTIAL DAMAGES ARISING OUT OF THE
USE OR INABILITY TO USE THE PROGRAM (INCLUDING BUT NOT LIMITED TO LOSS OF
DATA OR DATA BEING RENDERED INACCURATE OR LOSSES SUSTAINED BY YOU OR THIRD
PARTIES OR A FAILURE OF THE PROGRAM TO OPERATE WITH ANY OTHER PROGRAMS),
EVEN IF SUCH HOLDER OR OTHER PARTY HAS BEEN ADVISED OF THE POSSIBILITY OF
SUCH DAMAGES.
17. Interpretation of Sections 15 and 16.
If the disclaimer of warranty and limitation of liability provided
above cannot be given local legal effect according to their terms,
reviewing courts shall apply local law that most closely approximates
an absolute waiver of all civil liability in connection with the
Program, unless a warranty or assumption of liability accompanies a
copy of the Program in return for a fee.
END OF TERMS AND CONDITIONS
How to Apply These Terms to Your New Programs
If you develop a new program, and you want it to be of the greatest
possible use to the public, the best way to achieve this is to make it
free software which everyone can redistribute and change under these terms.
To do so, attach the following notices to the program. It is safest
to attach them to the start of each source file to most effectively
state the exclusion of warranty; and each file should have at least
the "copyright" line and a pointer to where the full notice is found.
<one line to give the program's name and a brief idea of what it does.>
Copyright (C) <year> <name of author>
This program is free software: you can redistribute it and/or modify
it under the terms of the GNU General Public License as published by
the Free Software Foundation, either version 3 of the License, or
(at your option) any later version.
This program is distributed in the hope that it will be useful,
but WITHOUT ANY WARRANTY; without even the implied warranty of
MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
GNU General Public License for more details.
You should have received a copy of the GNU General Public License
along with this program. If not, see <https://www.gnu.org/licenses/>.
Also add information on how to contact you by electronic and paper mail.
If the program does terminal interaction, make it output a short
notice like this when it starts in an interactive mode:
<program> Copyright (C) <year> <name of author>
This program comes with ABSOLUTELY NO WARRANTY; for details type `show w'.
This is free software, and you are welcome to redistribute it
under certain conditions; type `show c' for details.
The hypothetical commands `show w' and `show c' should show the appropriate
parts of the General Public License. Of course, your program's commands
might be different; for a GUI interface, you would use an "about box".
You should also get your employer (if you work as a programmer) or school,
if any, to sign a "copyright disclaimer" for the program, if necessary.
For more information on this, and how to apply and follow the GNU GPL, see
<https://www.gnu.org/licenses/>.
The GNU General Public License does not permit incorporating your program
into proprietary programs. If your program is a subroutine library, you
may consider it more useful to permit linking proprietary applications with
the library. If this is what you want to do, use the GNU Lesser General
Public License instead of this License. But first, please read
<https://www.gnu.org/licenses/why-not-lgpl.html>.
RyukGram — Proprietary Software License
Copyright (c) Ryuk. All rights reserved.
1. Definitions
"Software" means RyukGram, including the compiled tweak, its bundled
resources, and any accompanying materials distributed by the author.
"Author" means Ryuk, the copyright holder.
2. Grant
The Author grants you a personal, non-exclusive, non-transferable,
revocable license to download and install the compiled Software on
devices you own or control, solely for your own personal, non-commercial
use.
3. Restrictions
You may NOT, in whole or in part:
(a) copy, redistribute, sublicense, sell, rent, lease, or otherwise make
the Software available to any third party;
(b) modify, adapt, translate, or create derivative works of the Software;
(c) decompile, disassemble, reverse-engineer, or otherwise attempt to
derive the source code, except to the limited extent this restriction
is prohibited by applicable law;
(d) remove, alter, or obscure any copyright, attribution, or proprietary
notice contained in the Software;
(e) use the Software, or any portion of it, to build, train, or assist a
competing product.
4. Contributions
Translation files and other materials contributed to the project's public
repository are licensed to the Author under these same terms and may be
incorporated into current and future versions of the Software.
5. Ownership
The Software is licensed, not sold. The Author retains all right, title,
and interest in and to the Software, including all intellectual property
rights. No rights are granted except as expressly set out here.
6. No Warranty
THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR
IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY,
FITNESS FOR A PARTICULAR PURPOSE, AND NON-INFRINGEMENT.
7. Limitation of Liability
IN NO EVENT SHALL THE AUTHOR BE LIABLE FOR ANY CLAIM, DAMAGES, OR OTHER
LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT, OR OTHERWISE, ARISING
FROM, OUT OF, OR IN CONNECTION WITH THE SOFTWARE OR ITS USE.
8. Termination
This license terminates automatically if you breach any of its terms. On
termination you must stop using and delete all copies of the Software.
9. Trademarks
Instagram is a trademark of its respective owner. RyukGram is an
independent project and is not affiliated with, endorsed by, or sponsored
by Instagram or Meta. RyukGram was inspired by, but shares no source code
with, other Instagram tweaks.
-22
View File
@@ -1,22 +0,0 @@
TARGET := iphone:clang:16.2
INSTALL_TARGET_PROCESSES = Instagram
ARCHS = arm64
include $(THEOS)/makefiles/common.mk
TWEAK_NAME = RyukGram
$(TWEAK_NAME)_FILES = $(shell find src -type f \( -iname \*.x -o -iname \*.xm -o -iname \*.m \)) $(wildcard modules/JGProgressHUD/*.m) modules/fishhook/fishhook.c
$(TWEAK_NAME)_FRAMEWORKS = UIKit Foundation CoreGraphics Photos CoreServices SystemConfiguration SafariServices Security QuartzCore AVFoundation UniformTypeIdentifiers CoreLocation MapKit
$(TWEAK_NAME)_PRIVATE_FRAMEWORKS = Preferences
$(TWEAK_NAME)_CFLAGS = -fobjc-arc -Wno-unsupported-availability-guard -Wno-unused-value -Wno-deprecated-declarations -Wno-nullability-completeness -Wno-unused-function -Wno-incompatible-pointer-types -include src/SCIPrefix.h
$(TWEAK_NAME)_LOGOSFLAGS = --c warnings=none
CCFLAGS += -std=c++11
include $(THEOS_MAKE_PATH)/tweak.mk
# Build FLEXing for sideloading (not building in dev-mode)
ifdef SIDELOAD
$(TWEAK_NAME)_SUBPROJECTS += modules/flexing
endif
+110
View File
@@ -0,0 +1,110 @@
[release] RyukGram v1.3.3
Updated for Instagram 439.0.0.
### ✨ Highlights
- **Call recording** — record voice and video calls, with auto-record, smart video grids and a per-person browser to play them back
- **Activity notifications** — one log for who read your messages plus who came online, went offline or started typing, per person, with an accurate green dot
- **Grid feed** — turn your home feed into a tappable grid of thumbnails with stats and author overlays, per account
- **Stories archive** — saves every story you post before it expires, with its media and full viewer list, per account
- **Story viewers list** — a searchable, filterable, sortable and pinnable "who viewed my story", with each viewer's reaction shown
- **Instagram Plus** — turn on some Instagram's paid subscriber features inside the app
- **Custom button icons** — pick any Instagram icon or iOS symbol for the action and home-shortcut buttons
### 🆕 New features
#### Messages
- Activity notifications and Activity log — records who read your messages plus who came online, went offline or started typing, as a per-person timeline. Set each event to log silently, notify you, or both, and hold anyone to customise or mute them. A new accurate active-status option turns the green dot off the moment someone leaves. Filter by type and date, swipe or multi-select to delete, and lock the log behind your passcode
- A dot in the DMs inbox to turn your active status on or off without opening settings
- Keep deleted messages can now also keep the ones you unsend yourself, shown faded in chat and added to the deleted log
- Mark chats seen locally — with read-receipt blocking on, opened chats look read on your device while the sender still gets no receipt; the eye button turns orange until you really mark seen
- Hold the account name at the top of Direct to show or hide your hidden chats, with an optional passcode/Face ID lock
- Messages-only mode is now its own menu, can turn on automatically during a daily window, and adds a notifications shortcut plus an optional home-shortcut button in the inbox header
- Adding someone to a list (read-receipt blocking, hidden or locked chats, chat backgrounds, story viewer pins) now opens a picker of recent DMs with username search, instead of typing it in blind
- The DM Draw feature can now send an image as your doodle — from the gallery, Photos, your Instagram or iOS stickers, or a pasted image — with an editor to crop, resize and remove the background
- Custom chat backgrounds can now be videos or GIFs, framed with pan-zoom and trim, with the same opacity, blur and dim controls, and re-editable later
- Hide suggested accounts and channels in Direct messages search
#### Stories
- Stories archive saves every story you post before it expires, with its media and full viewer list, per account. Browse by date in a grid, see who viewed, liked or reacted, with filter, sort, pinned viewers, an unread badge, optional alerts and its own backup and storage entry
- The "who viewed my story" list is now searchable — filter (mutuals, following, follows you, verified, reacted, pinned), sort, and pin anyone to the top. Shows avatars, verified badges and each viewer's reaction, loads every viewer, and can switch back to Instagram's own list. Pick which one opens first
- Marked-seen indicator — stories you already marked as seen hide the eye button or fill it green for 48 hours, per account
- New "Save image (no music)" story download option for photo stories that have Instagram music on them
- Story tray long-press "Profile picture" now also works in Instagram's new subscriber story preview menu
#### Reels
- New reels playback menu — hold the ⋯ or audio button for speed, seek (skip back/forward by a custom amount) and auto-scroll controls
- Auto-scroll reels is back — Instagram default or RyukGram mode that keeps advancing after you swipe back
- Filter reels by engagement — set a minimum for likes, comments, views or reposts and reels below it never show, plus an option to hide reels whose author hides their counts. Only the Reels tab is filtered by default, so reels you open from a post, profile or share stay untouched
- Show when a reel was reposted — an optional date on the "reposted this reel" header
#### Feed & Explore
- New Grid feed — turn your home feed into a grid of post thumbnails showing likes, comments, views, shares and the author. Pinch to change columns, pull to refresh, tap a post to open it, or hold for a menu to like, follow, view profile, expand, share or copy the link. Choose which stats show, square or taller tiles, and how you switch back to Instagram's feed. Loads instantly, works per account and remembers where you left off
- Search and explore grids now show stat pills on posts and reels — views, likes, comments, shares, reposts and date — with a page to pick which appear, reorder them and toggle them
- New date format options — swap Instagram's relative timestamps on posts, notes, comments, stories and DMs for a fixed date, a preset like dd/MM/yyyy, or your own template, with a relative-time threshold
- New "Block surveys" toggle — hides Instagram's in-app surveys and feedback prompts, including the "Interested in this post?" cards
- Confirm feed refresh — an optional alert before a pull-to-refresh reloads the home feed
- Refresh stories only — pull-to-refresh reloads just the stories tray and leaves the feed where it is
#### Instants
- Instants download now works on videos too — expand, save, share and download-all all handle video instants
- Send a video from your gallery as an Instant — frame it square, trim any 7 seconds on a scrollable timeline, then hold to record
- Confirm before capturing an Instant — an optional alert on a photo tap or held video, plus a confirm before tapping to switch Instants
- Auto close the Instants viewer once you've seen them all
#### Downloads & Gallery
- Download manager got a rebuild — thumbnails for finished media, live size, speed and time left, a filter row, and swipe a row to cancel, retry or remove
- Downloads now stay listed after you close the app and can be downloaded again from the history — kept from 12 hours up to forever, and cleared or exported from Backup and Storage
- Download quality picker has an advanced view — download a video with no audio, or pick any of its audio tracks
- Gallery — import your own photos, videos and files from the ••• menu, saved under an Imported filter
- Gallery browsing got more controls — combine a sort with images, videos or favorites first, filter by date, pick 2 to 5 columns, and long-press a user section to select all their media
- The gallery now uses Instagram icons throughout, grid tiles show a date chip, and long-pressing an item shows its date, source and size
#### Profile
- Profile card details now also show comment, share and repost counts, with a page to pick which stats appear, reorder them and toggle them
- Followers and Following lists get a filter and sort button on Instagram's search bar — mutuals, following, follows you or verified, sorted by name or relationship
- Profile Analyzer's badge now shows gains and losses — a green +N when a list grew, a red N when it shrank
- Profile Analyzer is out of beta
#### Interface & notifications
- Action button and home-shortcut icons are now fully customisable — a searchable browser for any Instagram icon or iOS symbol, per button or shared, including Instagram's colourful pet stickers
- Tab bar icon order is now a live tab bar preview — drag to reorder, drag one up to hide, tap a hidden icon to add it back
- Story and disappearing-media overlay buttons can be repositioned by dragging them on a preview
- The notification pill can be placed anywhere on a phone preview, not just top or bottom
- Notifications mirrored to the iOS notification centre can now also show as system banners while you're using the app
- The home shortcut button shows a red dot for new deleted messages, read receipts or call recordings, with a count next to each in its menu
- Favorite GIFs long-press menu can now copy a GIF's link
#### Privacy & backup
- Device ID masking now also hides the vendor ID and machine ID, can block Apple device attestation, and can reset fresh while keeping masking on. A Device ID button on the login screen gives the same controls while signed out
- Follow requests tracker shows a badge for updates you haven't opened yet
- Backup's "Feature data" now opens a list where you tick exactly which stores to export, import or reset, instead of all-or-nothing
- Backups can be locked with a password when exporting (AES-256), asked for only when you restore them
#### General
- Change Instagram's own interface language from the tweak — a picker with a full language list, including Arabic even if your device isn't set to it; restart to apply
- New Instagram Plus menu in General — turns on Instagram's paid subscriber features inside the app, including story and message peek, fonts, the app icon picker and custom story lists, with a master on/off and reset
- Tweak settings shows an occasional donate prompt after long-term use, easily dismissed or hidden for good
### 🛠 Fixes
- Tapping someone in any RyukGram list now opens their profile inside RyukGram, so Back returns to the list instead of Instagram's home
- Your gallery carries over to this update, with a one-time prompt to restore items saved by an older version, and gallery backups now import and export every item
- The home shortcut button now shows on iPad
- Custom chat background now fills behind the message input on Instagram 437 instead of leaving a black strip
- Follow requests tracker no longer counts tapping "Following" on an already-followed account as a new request
- Follow requests tracker no longer wrongly shows received requests as withdrawn, and loads pending requests reliably
- Detailed color picker no longer crashes in the story drawing editor on Instagram 434
- OLED theme no longer turns the RyukGram settings screens fully black
- OLED theme no longer blacks out grey buttons like Follow/Following on profiles
- Downloading reels or videos with newer Instagram audio (xHE-AAC) no longer fails
- Feed scrolling is smoother, especially with the OLED theme enabled
- Favorite GIFs now send and appear reliably in Direct messages
- Deleted messages log now saves photos and videos at full quality instead of a low-res thumbnail
- Deleted messages log no longer crashes when you pull to refresh right after leaving a chat
- Reroute native Save now shows Instagram's Save and long-press Save on DM media even where Instagram hid them, including in vanish mode
- Settings that need a restart now take effect after one restart instead of sometimes needing two
- Auto-clear cache now runs reliably on the chosen interval and finishes even if you close Instagram mid-clear
- Saving or sharing media now always uses a clean name (like username_stories_date) instead of the internal temporary filename
- Reels action button stays visible on HDR reels, following Instagram's own tint like the like button does
- No more crash when switching to the Reels tab on some accounts
- Bulk saving Instants now labels each save with the account that posted it, even with several people's Instants on screen
+229 -330
View File
@@ -1,380 +1,279 @@
<div align="center">
# RyukGram
A feature-rich iOS tweak for Instagram, forked from [SCInsta](https://github.com/SoCuul/SCInsta) with additional features and fixes.\
`Version v1.3.0` | `Tested on Instagram 430.0.0`
<a href="https://buymeacoffee.com/axryuk" target="_blank" rel="noopener noreferrer"><img src="https://cdn.buymeacoffee.com/buttons/v2/default-violet.png" alt="Buy me a coffee" height="50"></a>
**The Instagram tweak for iOS power users.**
---
`v1.3.3` · Instagram 439.0.0 | Instagram 410.1.0
> [!WARNING]
> **Source pushes to this repository are paused for now, until further notice** — partly because a bit of the code has been finding its way into other paid projects, with no credit.
> Releases and localization are still kept up to date here — new builds land on the [Releases](https://github.com/faroukbmiled/RyukGram/releases/latest) page, and translation pull requests are still welcome.
<sub>The Instagram 410 build is for older devices and trails the main build on newer features.</sub>
<p>
<a href="https://github.com/faroukbmiled/RyukGram/releases/latest"><img src="https://img.shields.io/badge/Download-Latest%20release-7C3AED?style=for-the-badge&labelColor=1F2430" alt="Latest release" height="32"></a>
<a href="https://t.me/ryukgram"><img src="https://img.shields.io/badge/Telegram-Channel-2AABEE?style=for-the-badge&labelColor=1F2430" alt="Telegram" height="32"></a>
<a href="https://buymeacoffee.com/axryuk"><img src="https://img.shields.io/badge/Donate-Support%20the%20project-E5484D?style=for-the-badge&labelColor=1F2430" alt="Donate" height="32"></a>
</p>
<p>
<a href="https://github.com/faroukbmiled/RyukGram/issues">Issues</a>
·
<a href="#translating">Translate</a>
·
<a href="#features">Features</a>
</p>
</div>
---
> [!NOTE]
> To modify RyukGram's settings, check out [this section below](#opening-tweak-settings) for help
> RyukGram is [closed source](#credits) for now and will open up again later. Builds and translations stay current here.
## Install
### Add it in one tap
<div align="center">
<a href="https://store.ryuksign.com"><img src="https://img.shields.io/badge/Add%20RyukGram-store.ryuksign.com-7C3AED?style=for-the-badge&labelColor=1F2430" alt="Add RyukGram" height="36"></a>
</div>
Open it on your phone and everything is one tap away. Add it once and updates arrive on their own.
- **Sideload.** Adds the source to **Feather** or **RyukSign**, **SideStore**, or **AltStore**. Pick the **plugins** build normally, or **no plugins** if you sign with a free Apple account, since free accounts cannot sign the bundled extensions.
- **Jailbreak.** Adds the repo to **Sileo** or **Zebra**, then installs the build that matches your setup. To paste it by hand the repo is `https://source.ryuksign.com/apt/`.
### Build your own IPA
Instagram itself cannot be bundled here, so you bring the Instagram IPA and the build slots RyukGram into it.
**With GitHub Actions, no Mac needed.** Fork this repo, open the **Actions** tab, and run **Build sideloaded IPA from Release Assets**. Give it your Instagram IPA and it hands back a patched IPA ready to sign and install. Turn on the no-plugins option if you sign with a free account.
**Or by hand** with a tool like cyan, injecting into your own Instagram IPA:
- Regular build. Inject `zxPluginsInject.dylib` into the app and its plugins. The normal one, with the bundled extensions.
- No-plugins build. Inject `NoPluginsPatch.dylib` instead. For a plugin free sideload, or a free account where extensions cannot be signed.
### Download the .deb
Prefer the file? Both builds are on the [latest release](https://github.com/faroukbmiled/RyukGram/releases/latest).
<table>
<tr>
<th align="left">File</th>
<th align="left">Build</th>
</tr>
<tr>
<td><code>RyukGram_x.x.x_rootless.deb</code></td>
<td>Rootless</td>
</tr>
<tr>
<td><code>RyukGram_x.x.x_rootful.deb</code></td>
<td>Rootful</td>
</tr>
</table>
The rootless .deb also carries the dylib and bundle the sideload builds use.
### TrollStore
Download `RyukGram_trollfools.zip` from the [latest release](https://github.com/faroukbmiled/RyukGram/releases/latest) and inject it into Instagram with TrollFools.
---
# Installation
>[!IMPORTANT]
> Which type of device are you planning on installing this tweak on?
> - Jailbroken/TrollStore device -> [Download pre-built tweak](https://github.com/faroukbmiled/RyukGram/releases/latest)
> - Standard iOS device -> Sideload the .deb using Feather or similar
Once it is running, open the settings by holding the button at the top of your profile, or the home button in the tab bar. Screenshots are [below](#opening-settings).
# Features
> Features marked with **\*** are new or improved in RyukGram
## Features
### General
- Hide ads
- Hide Meta AI
- Hide metrics (likes, comments, shares counts)
- Hide the TestFlight beta update popup
- Disable app haptics
- Copy description
- Copy comment text from long-press menu **\***
- Download / copy / expand GIF and image comments **\***
- Custom GIF in comments — long-press the GIF button to paste any Giphy link **\***
- Download audio from the reels audio page **\***
- Profile copy button **\***
- Replace domain in shared links for embeds (Discord, Telegram, etc.) **\***
- Strip tracking params from shared links **\***
- Open links in external browser **\***
- Strip tracking from browser links **\***
- Do not save recent searches
- Open link from clipboard — long-press the search tab **\***
- Use detailed (native) color picker
- Enable liquid glass buttons
- Enable liquid glass surfaces **\***
- Liquid glass tab bar — Fixed (never shrink) / Hide on scroll
- Enable teen app icons
- IG Notes:
- Hide notes tray
- Hide friends map
- Enable note theming
- Custom note themes
- Focus/Distractions
- No suggested users
- No suggested chats
- Hide trending searches
- Hide explore posts grid
- Skip sensitive content covers **\***
- Live
- Anonymous live viewing **\***
- Toggle live comments **\***
- Privacy
- Hide RyukGram UI on screenshots, screen recordings, and mirroring **\***
- Hide ads, Meta AI, and like, comment and share counts
- Hide the TestFlight popup and turn off app haptics
- Copy captions, comment text, and profile info
- Download, copy, or expand image and GIF comments
- Send any Giphy link as a comment GIF, and pin the ones you favorite
- Download audio from the reels audio page
- Clean shared links for embeds and strip their tracking
- Open links in an external browser or straight from the clipboard
- Native color picker and teen app icons
- Liquid glass controls, with a force off switch and tab bar behavior
- Instagram Plus turns on Instagram's own paid features
- Notes tweaks: hide the tray, hide the friends map, custom themes
- Drop suggestions, trending, the explore grid, sensitive covers, and surveys
- Stat pills on search and explore, with a page to pick and reorder them
- Anonymous live viewing and toggleable live comments
- Redact RyukGram's own buttons in screenshots and recordings
### Feed
- Hide stories tray
- Hide suggested stories **\***
- View profile picture from story tray long-press menu **\***
- Hide entire feed
- No suggested posts
- No suggested for you (accounts)
- No suggested reels
- No suggested threads posts
- Disable video autoplay
- Media zoom — long press media to expand in full-screen viewer **\***
- Start media muted — expanded videos open with sound off **\***
- Custom date format — feed, notes/comments/stories, and DMs; optional relative threshold, compact "1h" style, and a Combine with date picker (`Jan 5, 2026 (2h)` or `2h Jan 5, 2026`) **\***
- Disable background refresh, home button refresh, and home button scroll **\***
- Disable reels tab button refresh **\***
- Hide repost button in feed **\***
- Grid feed turns your home feed into thumbnails, each with its stats and author
- Pick which stats show and their order, tile shape, columns by pinch, and the date format
- Hold a tile to preview it, or to like, follow, expand, share, or copy the link
- Switch back to Instagram's feed from the header heart or a floating button you place
- Hide the stories tray, suggested stories, and highlights
- View a profile picture from a story tray long press
- Hide the whole feed, or just suggested posts, accounts, reels, and threads
- Turn off video autoplay
- Long press any media to open it full screen, muted if you want
- Custom date format with your own template and relative times
- Turn off background and home button refresh
- Confirm before a pull to refresh, or refresh only the stories tray
- Hide the feed repost button
### Reels
- Modify tap controls
- Auto-scroll reels mode **\***
- Always show progress scrubber
- Disable auto-unmuting reels **\***
- Confirm reel refresh
- Unlock password-locked reels **\***
- Hide reels header
- Hide repost button in reels **\***
- Hide friends avatars on the reels Friends tab **\***
- Hide social context overlay on reels (reposted/commented bubbles) **\***
- Hide "Made with Edits" / "Open in Edits" promo pills on reels **\***
- Hide reels blend button
- Swipe a reel left to open the author's profile
- Disable scrolling reels
- Prevent doom scrolling (limit maximum viewable reels)
- Enhanced Pause/Play mode (when Pause/Play tap control is set): **\***
- Mute toggle auto-hidden
- Audio forced on in reels tab
- Play indicator hidden during playback
- Playback toggle synced with overlay during hold/zoom
- Optional tap-to-mute on photo reels
- Custom tap controls and an auto scroll mode
- Playback menu for speed, seek, and auto scroll
- Always visible scrubber, no auto unmute, and refresh confirmation
- Unlock password locked reels
- Hide the header, repost button, friend avatars, and promo pills
- Swipe left to open the author's profile
- Show the repost date
- Disable scrolling and cap how many reels you can watch in a row
- Filter the reels feed by minimum likes, comments, views, or reposts
- Enhanced pause and play mode
### Action buttons **\***
- Context-aware action menu on feed, reels, and stories **\***
- Configurable default tap action per context **\***
- Global icon picker — change the icon used across feed, stories, reels and DMs **\***
- Optional date header at the top of the action menu **\***
- Carousel and multi-story reel support with bulk download **\***
- Repost via IG's native creation flow **\***
- Full-screen media viewer with zoom and swipe **\***
- Story playback pauses when menus are open **\***
### Action buttons
- Context aware menus on feed, reels, stories, DMs, and profiles
- Configurable default tap, and a searchable browser of Instagram and system icons
- Carousel and multi story bulk download
- Save a photo post with its music as a video
- Save a photo story as just the image
- Repost through Instagram's own flow
- Full screen viewer with zoom and swipe
- Drag to arrange your overlay buttons on a live preview
### Profile **\***
- Zoom profile photo — long press to view full-screen **\***
- Save profile picture
- View highlight cover from profile long-press menu **\***
- Profile copy button **\***
- Follow indicator — shows whether the user follows you (off / on / colored) **\***
- Copy note on long press **\***
- Fake profile stats — verified badge and follower/following/post counts **\***
- Show full follower / post count on profile headers **\***
- Profile card details — view count, like count and upload date overlay on each post / reel card, with optional short-number format and on-demand fetch for missing counts **\***
- Filter & sort follower/following lists — reorder by mutuals, who follows you, verified or AZ, filter to just those, plus load-more and jump to top/bottom **\***
### Profile
- Zoom or save the profile picture
- View highlight covers from a long press
- Action button for info, the picture, and follower stats
- Follow indicator that shows who follows you back
- Copy notes, fake your stats, and reveal full counts
- Sort and search follower and following lists by mutuals, verified, and more
- Follow request tracker that logs every request, even ones cancelled before you answer
### Profile Analyzer (beta) **\***
- Follower and following scans with progress and cancel **\***
- Mutuals and non-followbacks lists **\***
- New and lost followers/following trackers across scans **\***
- Profile change history — username, name, bio, pfp **\***
- Searchable lists with inline and batch follow/unfollow **\***
- Visited profiles tracker — log every profile you open with date / verified / private filters **\***
- Pull-to-refresh on the visited list re-syncs identity and pictures from IG **\***
### Profile analyzer
- Follower and following scans, with mutuals and non followbacks
- New and lost trackers across scans
- Change history for name, username, bio, and picture
- Inline and batch follow, unfollow, and remove
- A log of every profile you open, with filters
- Per check toggles, with a badge for gains and losses since your last look
### Saving
- Enhanced HD downloads up to 1080p **\***
- Quality picker with preview playback **\***
- Audio-only and raw photo download options **\***
- Fallback to 720p without FFmpegKit **\***
- Live progress through both download and encode **\***
- Download manager — parallel downloads with a configurable limit, one combined progress pill, and a live queue with cancel / retry / redownload, long-press share / save, and bulk select; opens from the pill, a home shortcut, or settings **\***
- Auto-retry dropped downloads — parks offline downloads and resumes them when the connection returns **\***
- Save to RyukGram album — every download + share-sheet "Save to Photos" routes into a dedicated album with a customizable name **\***
- Enhanced media resolution — IG's CDN ships higher-quality images **\***
- Advanced encoding panel — codec (HW / libx264), preset, tune, H.264 profile + level, CRF / bitrate, pixel format, max resolution, frame rate, audio codec / bitrate / channels / sample rate, faststart, strip metadata **\***
- Download confirmation dialog **\***
- Output filenames formatted as `@username_context_timestamp` across every save surface (feed / reels / DMs / notes / comments / disappearing media) **\***
- Legacy long-press gesture (deprecated, customizable finger count + hold time) **\***
- HD downloads up to 1080p, with a quality picker and preview
- Audio only and raw photo options
- Download manager with live speed, filters, swipe actions, and bulk select
- Download history that survives a restart, with redownload and a keep window
- Auto retry for downloads that drop offline
- Save into a dedicated RyukGram album
- Advanced encoding panel for codec, bitrate, resolution, and more
- Clean filenames on every save
- Optional download confirmation
### Gallery **\***
- On-device gallery — every download can mirror into an in-app library **\***
- Stores images, videos, audio (m4a/aac/mp3/ogg/opus/...) and animated GIFs **\***
- Filter chips by type, source (feed / reels / stories / DMs / profile / notes / comments) and uploader; favorites; folders **\***
- Group by user — sections or virtual folders alongside your real folders **\***
- Folder cells show a thumbnail collage + item count and last-activity date **\***
- In-app preview carousel — image / video / audio scrubber / GIF playback **\***
- Audio + GIF picker — DM Upload Audio and (in future surfaces) Comment GIF can pull straight from the gallery **\***
- "Download to Gallery" submenu on every download surface when the gallery is enabled, with Photos / Gallery / Share options for audio **\***
### Gallery
- A private in app library that every download can mirror into
- Images, video, audio, and animated GIFs
- Filter by type, source, uploader, date, and favorites, with folders
- Sort by date, name, or size, with images, videos, or favorites first
- Group by user into sections or folders, from 2 to 5 columns
- Long press a user section to select all their media
- In app preview carousel
- Pull audio and GIFs straight from the gallery
- Import your own photos, videos and files into the gallery
- Grid tiles show a date chip, long press an item for its date, source and size
### Stories and messages
- Keep deleted messages **\***
- Deleted messages log — dedicated UI for every unsent message type, per-sender groups, search, filter, bulk Save / Share / Delete, edit history per message **\***
- Hide trailing action buttons on preserved messages
- Warn before pull-to-refresh clears preserved messages **\***
- Manually mark messages as seen (button or toggle mode) **\***
- Long-press the seen button for quick actions **\***
- Auto mark seen on send **\***
- Auto mark seen on typing **\***
- Mark seen on story like **\***
- Mark seen on story reply **\***
- Advance to next story when marking as seen **\***
- Advance on story like **\***
- Advance on story reply **\***
- Per-chat read-receipt exclusion list with Block all / Block selected mode **\***
- Send audio as file — DM plus menu, or long-press the camera button while replying **\***
- Download voice messages **\***
- Disable typing status
- Disable vanish mode swipe **\***
- Hide voice/video call buttons (independent toggles) **\***
- Hide send to group chat in the share sheet **\***
- Bypass DM character limit **\***
- Pin recipients on long-press in the share sheet — pinned chats render at the top **\***
- Custom chat backgrounds — per-chat images injected into IG's native theme picker, library upload with built-in cropper, per-image opacity / blur / dim, optional global default, per-account list of chats with backgrounds **\***
- Unlimited replay of direct stories **\***
- Full last active date **\***
- Send files in DMs (experimental) **\***
- Hold the DM tab button to open the on-device gallery **\***
- Notes actions — copy text, download GIF / audio (Photos or Gallery) **\***
- Copy note text on long press **\***
- Disable view-once limitations
- Disable screenshot detection
- Disable story seen receipt **\***
- Keep stories visually seen locally **\***
- Manual mark story as seen (button or toggle mode) **\***
- Long-press the story seen button for quick actions **\***
- Per-user story seen-receipt exclusion list with Block all / Block selected mode **\***
- Story audio mute/unmute toggle **\***
- View story mentions, with optional quick-access overlay button and count badge **\***
- Hide stories midcards (Trending / Music) **\***
- Stop story auto-advance **\***
- Reveal poll/slider vote counts and quiz answers on stories and reels before interacting **\***
- Force legacy Quiz and Reveal stickers back into the story composer tray **\***
- Bypass Reveal sticker — view stories blurred behind a Reveal sticker without DMing the author **\***
- Allow video in photo sticker — story photo sticker picker accepts videos too **\***
- Custom solid or gradient color for music and lyric stickers **\***
- Disappearing DM media overlay — action button, mark-as-viewed eye, and audio toggle **\***
- Download disappearing DM media **\***
- Upload audio as voice message with built-in trim editor **\***
- Disable instants creation
- Send Instants from your photo album — gallery button on the Instants camera with a built-in square cropper, posts through IG's native capture flow; pick from the in-app gallery or Photos library when the gallery is enabled
- Allow screenshots on Instants — bypasses the screenshot/screen-record block, scoped to the Instants viewer only
- Instants action button — Expand / Save (Photos / Gallery) / Share / Save all, fully configurable through the standard action-menu config
- Confirm Instants emoji reaction — optional confirmation before a quick-reaction sends
- Confirm Instants capture + Confirm switching Instant
- Save to Gallery from the expanded media viewer — share button surfaces a Save / Share menu when the gallery is enabled, with username / source attribution carried through
- Keep deleted messages, including your own unsends
- A full quality log of every unsent message, grouped by chat and searchable
- Activity notifications for reads, online, offline, and typing, set per person
- An activity log that keeps it all as a timeline, filterable and swipe to delete
- Accurate active status so the green dot turns off the moment someone leaves
- Manual and automatic mark as seen
- Mark chats seen on your device only, the eye button stays orange until you really send it
- Stories you already marked seen hide or tint the eye button for 48 hours
- Send audio as a file or a voice note, with a trim editor
- Send an image as your doodle in Draw, with a crop, resize, and background remover
- Download voice messages
- Turn off typing status, the vanish swipe, and view once limits
- Toggle your activity status from a dot in the DMs inbox
- Custom chat backgrounds from an image, video, or GIF, with a built in editor
- Filter, sort, search, and pin story viewers, and see who reacted with what
- Archive your own stories before they expire, viewer list included, per account
- View story mentions and reveal poll and quiz results
- Bypass Reveal stickers and pick custom sticker colors
- Download disappearing DM media in full quality
- Send Instants from your album, with crop and trim editors
- Auto close the Instants viewer once you have seen them all
- Toggle the Instants switch confirmation from a button in the viewer
- Record voice and video calls into an adaptive grid, browsed per person
### Interface **\***
- Tab bar shortcuts — Home shortcut button + Action button icon picker, grouped at the top of the page
- Notifications — universal in-app pill (Minimal / Colorful / Glow / Island), per-action routing (custom pill / IG-native / off), top or bottom position, master kill switch, swipe-to-dismiss, multi-pill stacking
- Modify tab bar icon order
- Modify swiping between tabs
- Hiding tabs
- Hide feed tab
- Hide explore tab
- Hide reels tab
- Hide create tab
- Hide messages tab
- Messages-only mode — inbox + profile only, launch straight into inbox **\***
- Hide tab bar sub-toggle — floating settings gear replaces it **\***
- Launch tab — pick which tab the app opens to **\***
- Home shortcut button — extra button on the home top bar with a configurable multi-action menu (Gallery / Settings / Security & Privacy / Hidden chats / Locked chats / Profile Analyzer / Deleted messages / Fake location / Clear cache / Changelog) **\***
### Interface
- A universal notification pill you can place anywhere on screen
- Mirror toasts to the iOS notification centre, in the background or while the app is open
- Reorder and hide tab bar icons on a live tab bar preview
- Messages only mode, with a daily schedule and inbox header shortcuts
- Force Instagram into any supported language
- Home shortcut button with new item badges
- Experimental flags
### Confirm actions
- Confirm like: Posts/Stories
- Confirm story emoji reaction **\***
- Confirm note like + emoji reaction **\***
- Confirm like: Reels
- Confirm follow
- Confirm unfollow **\***
- Confirm repost
- Confirm voice call **\***
- Confirm video call **\***
- Confirm voice messages
- Confirm follow requests
- Confirm vanish mode
- Confirm posting comment
- Confirm send to group chat **\***
- Confirm changing direct message theme
- Confirm sticker interaction (stories / highlights, per-surface: disabled / all / reaction stickers only) **\***
- Optional confirmations for likes, follows, reposts, calls, comments, and more
### Fake location **\***
- Override location app-wide for any IG feature reading coordinates
- MapKit picker with search + reverse-geocoded names
- Saved presets
- Quick toggle button on the Friends Map
### Fake location
- Override your location across the app, with a map picker and saved presets
### Theme **\***
- Theme picker — Off / Light / Dark / OLED, with optional Force theme to override the iOS appearance
- OLED chat theme — pure black DM thread and incoming bubbles
- Keyboard theme — dark or OLED, sticks through search keyboard activations
- Apply & restart, plus Reset theme to revert every theme option
### Theme
- Off, light, dark, or OLED, applied to Instagram only
- OLED chat theme and a matching keyboard theme
### Security & Privacy **\***
- Passcode + biometric lock — gates tweak settings, gallery, deleted-messages log, Profile Analyzer, DM inbox, individual chats, and Instagram itself
- Per-target idle timeout, re-lock on background, lock every time, independent session
- Hidden chats — long-press a DM to hide it; managed under S&P
- Per-account lists (excluded chats, hidden chats, locked chats, share-sheet pins) — switching IG accounts shows that account's own data
- App-switcher snapshot shroud — covers IG content when a locked surface is visible
- Hide message preview for locked chats in the inbox
### Security and privacy
- Mask the device identifiers Instagram reads, from settings or the login screen
- Passcode and biometric lock for settings, chats, logs, recordings, and the app itself
- Hidden chats and per account lists
- App switcher shroud and hidden previews for locked chats
### Tweak settings **\***
- Search bar with breadcrumbs across nested pages
- What's new indicator — a dot marks newly added settings and clears once viewed **\***
- Pause playback when opening settings **\***
- Quick-access via long-press on feed tab **\***
- Native Instagram icons throughout settings and in-app menus **\***
### Backup and restore
- Export your settings and feature data as JSON or an encrypted bundle
- Restore with replace or merge
- Scope any export, import, or reset to the accounts you pick
- See what RyukGram keeps on your device, by section and account, and clear it
### Advanced experimental features **\***
- Toggle hidden Instagram experiments: QuickSnap (Instants), Direct Notes reply types, Friend Map, Homecoming, Prism
- Batched changes with an Apply & restart button
- Auto-reset after 3 consecutive launch crashes
### Backup & Restore **\***
- Export RyukGram settings as JSON
- Import settings from JSON
- Preview before saving or applying
### Localization **\***
- Multi-language UI with fallback to English **\***
- Built-in language picker in Settings **\***
- Currently shipping: **English**, **Spanish**, **Russian**, **Korean**, **Arabic**, **Chinese (Traditional)**, **Chinese (Simplified)**, **Portuguese (Brazil)**, **Turkish**
### Localization
- English, Spanish, French, Russian, Korean, Japanese, Arabic, Vietnamese, Chinese, Portuguese, and Turkish
- In app language picker, with English as the fallback
### Optimization
- Clear Instagram cache on demand with optional auto-clear interval, with a toggle to preserve DMs, drafts, and Notes **\***
- Clear the Instagram cache on demand or on a timer
- Smoother feed scrolling
# Translating RyukGram
Want to see RyukGram in your language? Two ways:
## Translating
### Option A: In-app (fastest)
1. Open **Settings → Debug → Localization → Export strings** — pick a language (English for a fresh start, or an existing one to fix) and share its `.strings` file to yourself.
2. Translate the **right-hand side** of every `"key" = "value";` line. Never touch the left-hand side.
3. Go to **Debug → Localization → Update → + Add new language** — enter your language code (e.g. `fr`), pick the translated file, restart.
4. Your language now appears in the globe menu. Test it, tweak it, re-import as needed.
5. When ready, open a pull request with the file at `src/Localization/Resources/<code>.lproj/Localizable.strings`.
Want RyukGram in your language? Export the strings from **Settings, Debug, Localization**, translate the right side of each `"key" = "value";` line, and open a pull request with your file at `src/Localization/Resources/<code>.lproj/Localizable.strings`. Keep the format specifiers like `%@` and `%lu` exactly as they are. Missing lines fall back to English, so partial work is welcome. Anything you contribute is licensed to the project under the same terms as RyukGram.
### Option B: PR directly
1. Copy `src/Localization/Resources/en.lproj/Localizable.strings` into a new folder: `<code>.lproj/Localizable.strings`
2. Translate the right-hand side of every line.
3. Keep format specifiers (`%@`, `%lu`, `%d`, `%1$@`…) exactly as-is. Use positional specifiers if your language needs different word order.
4. Keep section banners and structure — makes the diff easy to review.
5. Open a PR at <https://github.com/faroukbmiled/RyukGram/pulls>. Title it e.g. `l10n: Add French translation`.
Partial translations are welcome — untranslated keys fall back to English at runtime.
If you find a string that still renders in English on a translated build, open an issue with a screenshot.
## Known Issues
- Preserved unsent messages cannot be removed using "Delete for you". Pull to refresh in the DMs tab clears the active account's preserved messages (with optional confirmation if "Warn before clearing on refresh" is enabled).
- "Delete for you" detection uses a ~2 second window after the local action. If a real other-party unsend happens to land in the same window, it may not be preserved. Rare in practice and limited to that specific overlap.
- With Liquid Glass buttons + Hide UI on capture both on, the DM eye leaves an empty glass bubble in captures — IG draws that backdrop, not the tweak, so it's outside our redaction.
# Opening Tweak Settings
## Opening settings
| | |
|:-------------------------------------------:|:-------------------------------------------:|
| <img src="https://i.imgur.com/uPMcugZ.png"> | <img src="https://i.imgur.com/RUlsg4k.jpeg"> |
| <img src="https://i.imgur.com/OnjLpZK.png"> | <img src="https://i.imgur.com/pHIuYTm.jpeg"> |
# Building from source
### Prerequisites
- XCode + Command-Line Developer Tools
- [Homebrew](https://brew.sh/#install)
- [CMake](https://formulae.brew.sh/formula/cmake#default) (`brew install cmake`)
- [Theos](https://theos.dev/docs/installation)
- [cyan](https://github.com/asdfzxcvbn/pyzule-rw?tab=readme-ov-file#install-instructions) **\*only required for sideloading**
- [ipapatch](https://github.com/asdfzxcvbn/ipapatch/releases/latest) **\*only required for sideloading**
## Credits
### Setup
1. Install iOS 16.2 frameworks for theos
1. [Click to download iOS SDKs](https://github.com/xybp888/iOS-SDKs/archive/refs/heads/master.zip)
2. Unzip, then copy the `iPhoneOS16.2.sdk` folder into `~/theos/sdks`
2. Clone repo: `git clone --recurse-submodules https://github.com/faroukbmiled/RyukGram`
3. **For sideloading**: Download a decrypted Instagram IPA from a trusted source, making sure to rename it to `com.burbn.instagram.ipa`.
Then create a folder called `packages` inside of the project folder, and move the Instagram IPA file into it.
RyukGram got its start from [SCInsta](https://github.com/SoCuul/SCInsta) by [@SoCuul](https://github.com/SoCuul), and I'm grateful for the foundation it gave the project. That code has since been fully rewritten and none of it remains, so RyukGram is its own separate codebase. It went closed source because earlier releases were being lifted and resold as paid tweaks, which is something I can't keep feeding, and I know some of you valued it staying open. Thanks to @SoCuul and the wider iOS tweak scene for paving the way.
### Run build script
```sh
$ chmod +x build.sh
$ ./build.sh <sideload/sidestore/rootless/rootful>
```
- [**@SoCuul**](https://github.com/SoCuul) for SCInsta, the spark for this project
- [**@BandarHL**](https://github.com/BandarHL) for BHInstagram
- [**@VAXMG**](https://t.me/ciesIPAs) for OLED theme inspiration
- [**@euoradan**](https://t.me/euoradan) for experiment flag research
- [**@n3d1117**](https://github.com/n3d1117) for the Following feed
- [**BillyCurtis**](https://github.com/BillyCurtis/OpenInstagramSafariExtension) for the Safari extension base
- [**@asdfzxcvbn**](https://github.com/asdfzxcvbn) for ipapatch and zxPluginsInject
- Furamako, [@ZomkaDEV](https://github.com/ZomkaDEV), [@ch1tmdgus](https://github.com/ch1tmdgus), [@bruuhim](https://github.com/bruuhim), [@jaydenjcpy](https://github.com/jaydenjcpy), [@brunorainha](https://github.com/brunorainha), [@yesnt10](https://github.com/yesnt10), [@tranbinh02](https://github.com/tranbinh02), [@yannouuuu](https://github.com/yannouuuu), and [@willybilly981](https://github.com/willybilly981) for translations
# Credits
- [SCInsta](https://github.com/SoCuul/SCInsta) by [@SoCuul](https://github.com/SoCuul) — original tweak this fork is based on
- [@BandarHL](https://github.com/BandarHL) — creator of the original BHInstagram project
- [Instaoled](https://t.me/ciesIPAs) by @VAXMG — OLED theme inspiration
- [@euoradan](https://t.me/euoradan) (Radan) — experimental Instagram feature flag research
- [@Mikasa-san](https://github.com/Mikasa-san) — code contributions
- [@n3d1117](https://github.com/n3d1117) (Edoardo) — Following feed mode (ported from [InstaSane](https://github.com/n3d1117/InstaSane))
- [@erupts0](https://github.com/erupts0) (John) — testing and feature suggestions
- [BillyCurtis/OpenInstagramSafariExtension](https://github.com/BillyCurtis/OpenInstagramSafariExtension) — base for the bundled Safari extension
- [@asdfzxcvbn](https://github.com/asdfzxcvbn) — [ipapatch](https://github.com/asdfzxcvbn/ipapatch) and [zxPluginsInject](https://github.com/asdfzxcvbn/zxPluginsInject)
- Furamako — Spanish translation
- [@ch1tmdgus](https://github.com/ch1tmdgus) (N4C) — Korean translation
- [ZomkaDEV](https://github.com/ZomkaDEV) — Russian translation
- [@bruuhim](https://github.com/bruuhim) — Arabic translation
- [@jaydenjcpy](https://github.com/jaydenjcpy) — Chinese (Traditional and Simplified) translation
- Bruno ([@brunorainha](https://github.com/brunorainha)) — Portuguese (Brazil) translation
- [@yesnt10](https://github.com/yesnt10) — Turkish translation
## Support
# Support
If RyukGram earns a spot on your phone, you can keep it going here.
RyukGram is free and open source. If you'd like to support development:
<div align="center">
- [☕ Donate to Ryuk (RyukGram)](https://buymeacoffee.com/axryuk)
- [☕ Donate to SoCuul (original SCInsta)](https://ko-fi.com/SoCuul) — RyukGram wouldn't exist without SoCuul's original SCInsta, so showing them some love is always welcome
<a href="https://buymeacoffee.com/axryuk"><img src="https://img.shields.io/badge/Donate-Support%20the%20project-E5484D?style=for-the-badge&labelColor=1F2430" alt="Donate" height="32"></a>
<a href="https://github.com/faroukbmiled/RyukGram"><img src="https://img.shields.io/badge/Star-the%20repo-6B7280?style=for-the-badge&labelColor=1F2430" alt="Star the repo" height="32"></a>
</div>
-14
View File
@@ -1,14 +0,0 @@
<?xml version="1.0" encoding="UTF-8"?>
<!DOCTYPE plist PUBLIC "-//Apple//DTD PLIST 1.0//EN" "http://www.apple.com/DTDs/PropertyList-1.0.dtd">
<plist version="1.0">
<dict>
<key>Filter</key>
<dict>
<key>Bundles</key>
<array>
<string>com.burbn.instagram</string>
</array>
</dict>
</dict>
</plist>
-28
View File
@@ -1,28 +0,0 @@
#!/usr/bin/env bash
set -e
echo 'Note: This script is meant to be used while developing the tweak.'
echo ' This does not build "libflex" or "FLEXing", they must be built manually and moved to ./packages'
echo
if [ "$1" == "true" ];
then
_scinsta_dev_before
# Build tweak and package into ipa
./build.sh sideload --dev
_scinsta_dev_after
else
_scinsta_devquick_before
# Built tweak and deploy to live container
make clean
make DEV=1
# Change framework locations to @rpath
install_name_tool -change "/Library/Frameworks/CydiaSubstrate.framework/CydiaSubstrate" "@rpath/CydiaSubstrate.framework/CydiaSubstrate" ".theos/obj/debug/RyukGram.dylib" 2>/dev/null || true
_scinsta_devquick_after
fi
-517
View File
@@ -1,517 +0,0 @@
#!/usr/bin/env bash
set -e
# Auto-detect THEOS if not set
if [ -z "$THEOS" ]; then
if [ -d "$HOME/theos" ]; then
export THEOS="$HOME/theos"
else
echo -e '\033[1m\033[0;31mTHEOS not set and ~/theos not found.\nSet THEOS or install Theos to ~/theos\033[0m'
exit 1
fi
fi
CMAKE_OSX_ARCHITECTURES="arm64e;arm64"
CMAKE_OSX_SYSROOT="iphoneos"
# Copy Localization resources (*.lproj) into a RyukGram.bundle.
# Arg 1: destination bundle directory (created if missing).
copy_localization_into_bundle() {
local DEST="$1"
local SRC="src/Localization/Resources"
[ -d "$SRC" ] || return 0
mkdir -p "$DEST"
for lproj in "$SRC"/*.lproj; do
[ -d "$lproj" ] || continue
cp -R "$lproj" "$DEST/"
done
}
# Copy generic static assets (PNGs, etc.) into a RyukGram.bundle. Used for
# bundled images the tweak loads via SCILocalizationBundle().
# Arg 1: destination bundle directory (created if missing).
copy_bundle_assets() {
local DEST="$1"
local SRC="src/BundleAssets"
[ -d "$SRC" ] || return 0
mkdir -p "$DEST"
find "$SRC" -maxdepth 1 -type f \( -iname '*.png' -o -iname '*.jpg' -o -iname '*.pdf' \) \
-exec cp {} "$DEST/" \;
}
# Collect all FFmpegKit frameworks for injection
ffmpegkit_frameworks() {
local fws=""
if [ -d "modules/ffmpegkit/ffmpegkit.framework" ]; then
for fw in modules/ffmpegkit/*.framework; do
fws="$fws $fw"
done
fi
echo "$fws"
}
# Inject RyukGram.bundle into a .deb:
# - Always: localization lproj resources.
# - Optional: FFmpegKit frameworks (renamed *_sci to avoid collisions).
# Path: Library/Application Support/RyukGram.bundle/ — jailbreak dlopens by full
# path, Feather copies .bundle without injecting load commands for sideload.
# Arg 1: path to .deb (cwd must be packages/)
inject_bundle_into_deb() {
local BASE_DEB="$1"
local TMPDIR=$(mktemp -d)
dpkg-deb -R "$BASE_DEB" "$TMPDIR"
local DYLIB_DIR=$(find "$TMPDIR" -name "RyukGram.dylib" -exec dirname {} \; | head -1)
[ -n "$DYLIB_DIR" ] || { rm -rf "$TMPDIR"; return; }
local PREFIX=""
[[ "$DYLIB_DIR" == *"/var/jb/"* ]] && PREFIX="var/jb/"
local BUNDLE_DIR="$TMPDIR/${PREFIX}Library/Application Support/RyukGram.bundle"
mkdir -p "$BUNDLE_DIR"
( cd .. && copy_localization_into_bundle "$BUNDLE_DIR" && copy_bundle_assets "$BUNDLE_DIR" )
if [ -d "../modules/ffmpegkit/ffmpegkit.framework" ]; then
for fw in ../modules/ffmpegkit/*.framework; do
cp -R "$fw" "$BUNDLE_DIR/"
done
local LIBS="libavutil libavcodec libavformat libavfilter libavdevice libswresample libswscale"
for lib in $LIBS; do
mv "$BUNDLE_DIR/${lib}.framework" "$BUNDLE_DIR/${lib}_sci.framework"
install_name_tool -id "@rpath/${lib}_sci.framework/${lib}" \
"$BUNDLE_DIR/${lib}_sci.framework/${lib}"
done
for target in "$BUNDLE_DIR/ffmpegkit.framework/ffmpegkit" \
"$BUNDLE_DIR"/libav*_sci.framework/libav* \
"$BUNDLE_DIR"/libsw*_sci.framework/libsw*; do
[ -f "$target" ] || continue
for lib in $LIBS; do
install_name_tool -change \
"@rpath/${lib}.framework/${lib}" \
"@rpath/${lib}_sci.framework/${lib}" \
"$target" 2>/dev/null || true
done
done
install_name_tool -add_rpath @loader_path/.. \
"$BUNDLE_DIR/ffmpegkit.framework/ffmpegkit" 2>/dev/null || true
fi
dpkg-deb -b "$TMPDIR" "$BASE_DEB"
rm -rf "$TMPDIR"
}
# Build zxPluginsInject.dylib -> packages/zxPluginsInject.dylib
build_zxpi_dylib() {
local MOD_DIR="modules/zxPluginsInject"
local DYLIB_OUT="$MOD_DIR/.theos/obj/zxPluginsInject.dylib"
if [ -z "${THEOS:-}" ]; then
if [ -d "$HOME/theos" ]; then
export THEOS="$HOME/theos"
else
echo -e '\033[1m\033[0;31mTHEOS not set and ~/theos not found\033[0m' >&2
exit 1
fi
fi
( cd "$MOD_DIR" && make FINALPACKAGE=1 >/dev/null )
[ -f "$DYLIB_OUT" ] || {
echo -e '\033[1m\033[0;31mzxPluginsInject.dylib build failed\033[0m' >&2
exit 1
}
mkdir -p packages
cp "$DYLIB_OUT" packages/zxPluginsInject.dylib
# Match the @rpath LC that ipapatch writes into target binaries.
install_name_tool -id "@rpath/zxPluginsInject.dylib" \
packages/zxPluginsInject.dylib 2>/dev/null || true
}
# LC-inject zxPluginsInject.dylib into main exec + every .appex in the IPA.
# Arg 1: path to the IPA
run_ipapatch() {
local IPA="$1"
if ! command -v ipapatch &> /dev/null; then
echo -e '\033[1m\033[0;31mipapatch not found. Install it from:\033[0m'
echo ' https://github.com/asdfzxcvbn/ipapatch/releases/latest'
exit 1
fi
echo -e '\033[1m\033[32mRunning ipapatch (zxPluginsInject LC injection)\033[0m'
ipapatch --input "$IPA" --inplace --noconfirm --dylib packages/zxPluginsInject.dylib
}
# Build just the dylib (for Feather/manual injection)
if [ "$1" == "dylib" ];
then
# --fast: incremental build (no clean)
if [ "$2" != "--fast" ]; then
make clean 2>/dev/null || true
rm -rf .theos
fi
echo -e '\033[1m\033[32mBuilding RyukGram dylib\033[0m'
make
mkdir -p packages
cp .theos/obj/debug/RyukGram.dylib packages/RyukGram.dylib
# Ship localization bundle next to the dylib so Feather/manual installs work.
copy_localization_into_bundle "packages/RyukGram.bundle"
copy_bundle_assets "packages/RyukGram.bundle"
echo -e "\033[1m\033[32mDone!\033[0m\n\nDylib at: $(pwd)/packages/RyukGram.dylib\nBundle at: $(pwd)/packages/RyukGram.bundle"
# Build sideloaded IPA
elif [ "$1" == "sideload" ];
then
# Check for FLEXing submodule
HAS_FLEX=1
if [ -z "$(ls -A modules/FLEXing 2>/dev/null)" ]; then
echo -e '\033[1m\033[0;33mFLEXing submodule not found — building without FLEX debugger.\033[0m'
echo -e '\033[0;33mTo include FLEX, run: git submodule update --init --recursive\033[0m'
echo
HAS_FLEX=0
fi
# Check if building with dev mode
if [ "$2" == "--dev" ];
then
if [ "$HAS_FLEX" == "0" ]; then
echo -e '\033[1m\033[0;31mDev mode requires FLEXing submodule.\033[0m'
exit 1
fi
# Cache pre-built FLEX libs
mkdir -p "packages/cache"
cp -f ".theos/obj/debug/FLEXing.dylib" "packages/cache/FLEXing.dylib" 2>/dev/null || true
cp -f ".theos/obj/debug/libflex.dylib" "packages/cache/libflex.dylib" 2>/dev/null || true
if [[ ! -f "packages/cache/FLEXing.dylib" || ! -f "packages/cache/libflex.dylib" ]]; then
echo -e '\033[1m\033[0;33mCould not find cached pre-built FLEX libs, building prerequisite binaries\033[0m'
echo
./build.sh sideload --buildonly
./build-dev.sh true
exit
fi
MAKEARGS='DEV=1'
FLEXPATH='packages/cache/FLEXing.dylib packages/cache/libflex.dylib'
COMPRESSION=0
else
# Clear cached FLEX libs
rm -rf "packages/cache"
if [ "$HAS_FLEX" == "1" ]; then
MAKEARGS='SIDELOAD=1'
FLEXPATH='.theos/obj/debug/FLEXing.dylib .theos/obj/debug/libflex.dylib'
else
MAKEARGS=''
FLEXPATH=''
fi
COMPRESSION=9
fi
# Clean build artifacts
make clean 2>/dev/null || true
rm -rf .theos
# Check for decrypted Instagram IPA
mkdir -p packages
ipaFile="$(find ./packages/ -maxdepth 1 -type f \( -iname '*com.burbn.instagram*.ipa' -o -iname 'Instagram*.ipa' -o -iname '[0-9]*.ipa' \) ! -iname 'RyukGram*.ipa' -exec basename {} \; 2>/dev/null | head -1)"
if [ -z "${ipaFile}" ]; then
# Auto-move any Instagram IPA from cwd into packages/
cwdIpa="$(find . -maxdepth 1 -type f \( -iname '*com.burbn.instagram*.ipa' -o -iname 'Instagram*.ipa' -o -iname '[0-9]*.ipa' \) 2>/dev/null | head -1)"
if [ -n "$cwdIpa" ]; then
echo -e "\033[1m\033[32mMoving $(basename "$cwdIpa") → packages/\033[0m"
mv "$cwdIpa" packages/
ipaFile="$(basename "$cwdIpa")"
fi
fi
if [ -z "${ipaFile}" ]; then
echo -e '\033[1m\033[0;31mDecrypted Instagram IPA not found.\nPlace a *com.burbn.instagram*.ipa in ./ or ./packages/.\033[0m'
exit 1
fi
# Check for cyan and ipapatch before building (skip check for --buildonly)
if [ "$2" != "--buildonly" ]; then
if ! command -v cyan &> /dev/null; then
echo -e '\033[1m\033[0;31mcyan not found. Install it with:\033[0m'
echo ' pip install --force-reinstall https://github.com/asdfzxcvbn/pyzule-rw/archive/main.zip'
echo
echo -e '\033[0;33mUse ./build.sh sideload --buildonly to just compile without creating the IPA.\033[0m'
echo -e '\033[0;33mOr use ./build.sh dylib to build the dylib for Feather injection.\033[0m'
exit 1
fi
if ! command -v ipapatch &> /dev/null; then
echo -e '\033[1m\033[0;31mipapatch not found. Install it from:\033[0m'
echo ' https://github.com/asdfzxcvbn/ipapatch/releases/latest'
exit 1
fi
fi
echo -e '\033[1m\033[32mBuilding RyukGram tweak for sideloading (as IPA)\033[0m'
make $MAKEARGS
# Build zxPluginsInject.dylib so ipapatch can inject it after cyan
echo -e '\033[1m\033[32mBuilding zxPluginsInject.dylib\033[0m'
build_zxpi_dylib
# Copy dylib to packages
mkdir -p packages
cp .theos/obj/debug/RyukGram.dylib packages/RyukGram.dylib
# Only build libs (for future use in dev build mode)
if [ "$2" == "--buildonly" ];
then
exit
fi
# Build RyukGram.bundle with renamed frameworks for cyan injection
BUNDLE_PATH="packages/RyukGram.bundle"
rm -rf "$BUNDLE_PATH"
mkdir -p "$BUNDLE_PATH"
copy_localization_into_bundle "$BUNDLE_PATH"
copy_bundle_assets "$BUNDLE_PATH"
if [ -d "modules/ffmpegkit/ffmpegkit.framework" ]; then
echo -e '\033[1m\033[32mBuilding RyukGram.bundle\033[0m'
for fw in modules/ffmpegkit/*.framework; do
cp -R "$fw" "$BUNDLE_PATH/"
done
LIBS="libavutil libavcodec libavformat libavfilter libavdevice libswresample libswscale"
for lib in $LIBS; do
mv "$BUNDLE_PATH/${lib}.framework" "$BUNDLE_PATH/${lib}_sci.framework"
install_name_tool -id "@rpath/${lib}_sci.framework/${lib}" \
"$BUNDLE_PATH/${lib}_sci.framework/${lib}"
done
for target in "$BUNDLE_PATH/ffmpegkit.framework/ffmpegkit" \
"$BUNDLE_PATH"/libav*_sci.framework/libav* \
"$BUNDLE_PATH"/libsw*_sci.framework/libsw*; do
[ -f "$target" ] || continue
for lib in $LIBS; do
install_name_tool -change \
"@rpath/${lib}.framework/${lib}" \
"@rpath/${lib}_sci.framework/${lib}" \
"$target" 2>/dev/null || true
done
done
install_name_tool -add_rpath @loader_path/.. \
"$BUNDLE_PATH/ffmpegkit.framework/ffmpegkit" 2>/dev/null || true
fi
TWEAKPATH=".theos/obj/debug/RyukGram.dylib"
if [ "$2" == "--devquick" ]; then TWEAKPATH=""; fi
BUNDLE_ARG=""
[ -d "$BUNDLE_PATH" ] && BUNDLE_ARG="$BUNDLE_PATH"
# Create IPA: cyan injects dylib + copies RyukGram.bundle to app root
echo -e '\033[1m\033[32mCreating the IPA file...\033[0m'
rm -f packages/RyukGram-sideloaded.ipa
cyan -i "packages/${ipaFile}" -o packages/RyukGram-sideloaded.ipa -f $TWEAKPATH $FLEXPATH $BUNDLE_ARG -c $COMPRESSION -m 15.0 -du
# Inject Safari "Open in Instagram" extension into Payload/*.app/PlugIns/
# before ipapatch re-signs, so instagram.com links open the app.
APPEX_SRC="extensions/OpenInstagramSafariExtension.appex"
if [ -d "$APPEX_SRC" ]; then
echo -e '\033[1m\033[32mEmbedding Safari extension\033[0m'
INJECT_TMP=$(mktemp -d)
unzip -q packages/RyukGram-sideloaded.ipa -d "$INJECT_TMP"
APP_DIR="$(find "$INJECT_TMP/Payload" -maxdepth 1 -type d -name '*.app' | head -1)"
if [ -n "$APP_DIR" ]; then
mkdir -p "$APP_DIR/PlugIns"
rm -rf "$APP_DIR/PlugIns/OpenInstagramSafariExtension.appex"
cp -R "$APPEX_SRC" "$APP_DIR/PlugIns/"
( cd "$INJECT_TMP" && zip -qr -${COMPRESSION} ../repacked.ipa Payload )
mv "$INJECT_TMP/../repacked.ipa" packages/RyukGram-sideloaded.ipa
fi
rm -rf "$INJECT_TMP"
fi
run_ipapatch packages/RyukGram-sideloaded.ipa
echo -e "\033[1m\033[32mDone, enjoy RyukGram!\033[0m\n\nYou can find the ipa file at: $(pwd)/packages"
# Build rootless .deb with FFmpegKit
elif [ "$1" == "rootless" ];
then
make clean 2>/dev/null || true
rm -rf .theos
echo -e '\033[1m\033[32mBuilding RyukGram tweak for rootless\033[0m'
export THEOS_PACKAGE_SCHEME=rootless
make package
echo -e '\033[1m\033[32mInjecting RyukGram.bundle (localization + FFmpegKit) into deb\033[0m'
cd packages
BASE_DEB="$(ls -t *.deb | head -n1)"
if [ -n "$BASE_DEB" ]; then
inject_bundle_into_deb "$BASE_DEB"
NEW_NAME="${BASE_DEB%.deb}-rootless.deb"
mv "$BASE_DEB" "$NEW_NAME"
fi
cd ..
[ -d "modules/ffmpegkit/ffmpegkit.framework" ] || echo -e '\033[0;33mFFmpegKit not found — deb built without FFmpegKit.\033[0m'
echo -e "\033[1m\033[32mDone, enjoy RyukGram!\033[0m\n\nYou can find the deb file at: $(pwd)/packages"
# Build rootful .deb with FFmpegKit
elif [ "$1" == "rootful" ];
then
make clean 2>/dev/null || true
rm -rf .theos
echo -e '\033[1m\033[32mBuilding RyukGram tweak for rootful\033[0m'
unset THEOS_PACKAGE_SCHEME
make package
echo -e '\033[1m\033[32mInjecting RyukGram.bundle (localization + FFmpegKit) into deb\033[0m'
cd packages
BASE_DEB="$(ls -t *.deb | head -n1)"
if [ -n "$BASE_DEB" ]; then
inject_bundle_into_deb "$BASE_DEB"
NEW_NAME="${BASE_DEB%.deb}-rootful.deb"
mv "$BASE_DEB" "$NEW_NAME"
fi
cd ..
[ -d "modules/ffmpegkit/ffmpegkit.framework" ] || echo -e '\033[0;33mFFmpegKit not found — deb built without FFmpegKit.\033[0m'
echo -e "\033[1m\033[32mDone, enjoy RyukGram!\033[0m\n\nYou can find the deb file at: $(pwd)/packages"
# TrollStore build — .tipa is a renamed .ipa. Skip sideload re-sign; TS signs on-device.
elif [ "$1" == "trollstore" ];
then
HAS_FLEX=1
if [ -z "$(ls -A modules/FLEXing 2>/dev/null)" ]; then
HAS_FLEX=0
fi
if [ "$HAS_FLEX" == "1" ]; then
MAKEARGS='SIDELOAD=1'
FLEXPATH='.theos/obj/debug/FLEXing.dylib .theos/obj/debug/libflex.dylib'
else
MAKEARGS=''
FLEXPATH=''
fi
COMPRESSION=9
make clean 2>/dev/null || true
rm -rf .theos
mkdir -p packages
ipaFile="$(find ./packages/ -maxdepth 1 -type f \( -iname '*com.burbn.instagram*.ipa' -o -iname 'Instagram*.ipa' -o -iname '[0-9]*.ipa' \) ! -iname 'RyukGram*.ipa' -exec basename {} \; 2>/dev/null | head -1)"
if [ -z "${ipaFile}" ]; then
cwdIpa="$(find . -maxdepth 1 -type f \( -iname '*com.burbn.instagram*.ipa' -o -iname 'Instagram*.ipa' -o -iname '[0-9]*.ipa' \) 2>/dev/null | head -1)"
if [ -n "$cwdIpa" ]; then
mv "$cwdIpa" packages/
ipaFile="$(basename "$cwdIpa")"
fi
fi
if [ -z "${ipaFile}" ]; then
echo -e '\033[1m\033[0;31mDecrypted Instagram IPA not found.\033[0m'
exit 1
fi
if ! command -v cyan &> /dev/null; then
echo -e '\033[1m\033[0;31mcyan not found. Install it with:\033[0m'
echo ' pip install --force-reinstall https://github.com/asdfzxcvbn/pyzule-rw/archive/main.zip'
exit 1
fi
if ! command -v ipapatch &> /dev/null; then
echo -e '\033[1m\033[0;31mipapatch not found. Install it from:\033[0m'
echo ' https://github.com/asdfzxcvbn/ipapatch/releases/latest'
exit 1
fi
echo -e '\033[1m\033[32mBuilding RyukGram tweak for TrollStore (.tipa)\033[0m'
make $MAKEARGS
cp .theos/obj/debug/RyukGram.dylib packages/RyukGram.dylib
echo -e '\033[1m\033[32mBuilding zxPluginsInject.dylib\033[0m'
build_zxpi_dylib
BUNDLE_PATH="packages/RyukGram.bundle"
rm -rf "$BUNDLE_PATH"
mkdir -p "$BUNDLE_PATH"
copy_localization_into_bundle "$BUNDLE_PATH"
copy_bundle_assets "$BUNDLE_PATH"
if [ -d "modules/ffmpegkit/ffmpegkit.framework" ]; then
for fw in modules/ffmpegkit/*.framework; do
cp -R "$fw" "$BUNDLE_PATH/"
done
LIBS="libavutil libavcodec libavformat libavfilter libavdevice libswresample libswscale"
for lib in $LIBS; do
mv "$BUNDLE_PATH/${lib}.framework" "$BUNDLE_PATH/${lib}_sci.framework"
install_name_tool -id "@rpath/${lib}_sci.framework/${lib}" \
"$BUNDLE_PATH/${lib}_sci.framework/${lib}"
done
for target in "$BUNDLE_PATH/ffmpegkit.framework/ffmpegkit" \
"$BUNDLE_PATH"/libav*_sci.framework/libav* \
"$BUNDLE_PATH"/libsw*_sci.framework/libsw*; do
[ -f "$target" ] || continue
for lib in $LIBS; do
install_name_tool -change \
"@rpath/${lib}.framework/${lib}" \
"@rpath/${lib}_sci.framework/${lib}" \
"$target" 2>/dev/null || true
done
done
install_name_tool -add_rpath @loader_path/.. \
"$BUNDLE_PATH/ffmpegkit.framework/ffmpegkit" 2>/dev/null || true
fi
TWEAKPATH=".theos/obj/debug/RyukGram.dylib"
BUNDLE_ARG=""
[ -d "$BUNDLE_PATH" ] && BUNDLE_ARG="$BUNDLE_PATH"
echo -e '\033[1m\033[32mCreating the TIPA file...\033[0m'
rm -f packages/RyukGram-trollstore.tipa packages/RyukGram-trollstore.ipa
cyan -i "packages/${ipaFile}" -o packages/RyukGram-trollstore.ipa -f $TWEAKPATH $FLEXPATH $BUNDLE_ARG -c $COMPRESSION -m 15.0 -du
# Embed Safari extension.
APPEX_SRC="extensions/OpenInstagramSafariExtension.appex"
if [ -d "$APPEX_SRC" ]; then
echo -e '\033[1m\033[32mEmbedding Safari extension\033[0m'
INJECT_TMP=$(mktemp -d)
unzip -q packages/RyukGram-trollstore.ipa -d "$INJECT_TMP"
APP_DIR="$(find "$INJECT_TMP/Payload" -maxdepth 1 -type d -name '*.app' | head -1)"
if [ -n "$APP_DIR" ]; then
mkdir -p "$APP_DIR/PlugIns"
rm -rf "$APP_DIR/PlugIns/OpenInstagramSafariExtension.appex"
cp -R "$APPEX_SRC" "$APP_DIR/PlugIns/"
( cd "$INJECT_TMP" && zip -qr -${COMPRESSION} ../repacked.ipa Payload )
mv "$INJECT_TMP/../repacked.ipa" packages/RyukGram-trollstore.ipa
fi
rm -rf "$INJECT_TMP"
fi
run_ipapatch packages/RyukGram-trollstore.ipa
mv packages/RyukGram-trollstore.ipa packages/RyukGram-trollstore.tipa
echo -e "\033[1m\033[32mDone!\033[0m\n\nTIPA at: $(pwd)/packages/RyukGram-trollstore.tipa"
else
echo '+----------------------+'
echo '|RyukGram Build Script |'
echo '+----------------------+'
echo
echo 'Usage: ./build.sh <dylib/sideload/trollstore/rootless/rootful>'
echo
echo ' dylib - Build the dylib only (for Feather/manual injection)'
echo ' sideload - Build a patched IPA (requires cyan + decrypted IPA)'
echo ' trollstore - Build a .tipa for TrollStore (requires cyan + decrypted IPA)'
echo ' rootless - Build a rootless .deb package (with FFmpegKit)'
echo ' rootful - Build a rootful .deb package (with FFmpegKit)'
exit 1
fi
-10
View File
@@ -1,10 +0,0 @@
Package: com.faroukbmiled.ryukgram
Name: RyukGram
Version: 1.2.2
Architecture: iphoneos-arm
Description: A feature-rich tweak for Instagram on iOS, based on SCInsta
Homepage: https://github.com/faroukbmiled/RyukGram
Maintainer: Ryuk
Author: Ryuk
Section: Tweaks
Depends: mobilesubstrate
@@ -1,10 +0,0 @@
{
"extension_name": {
"message": "Open in Instagram",
"description": "The display name for the extension."
},
"extension_description": {
"message": "Opens instagram.com links (profiles, posts, reels, stories, tags) in the Instagram app.",
"description": "Description of what the extension does."
}
}
@@ -1,41 +0,0 @@
// Redirect instagram.com web links into the native app.
// Shipped inside RyukGram as a Safari web extension.
(function () {
if (window.top !== window.self) return;
if (sessionStorage.getItem("__sciOpenedApp")) return;
function urlFromLocation() {
const path = window.location.pathname.split("/").filter(Boolean);
if (path.length === 0) return null;
if (path[0] === "p" || path[0] === "reel") {
const meta = document.querySelector("meta[property='al:ios:url']");
if (meta && meta.getAttribute("content")) return meta.getAttribute("content");
return path[1] ? `instagram://media?id=${path[1]}` : null;
}
if (path[0] === "stories" && path[1]) {
return `instagram://story?username=${path[1]}`;
}
if (path[0] === "explore" && path[1] === "tags" && path[2]) {
return `instagram://tag?name=${path[2]}`;
}
if (path.length === 1) {
return `instagram://user?username=${path[0]}`;
}
return null;
}
function openInApp() {
const target = urlFromLocation();
if (!target) return;
sessionStorage.setItem("__sciOpenedApp", "1");
window.location.href = target;
}
openInApp();
})();
Binary file not shown.

Before

Width:  |  Height:  |  Size: 15 KiB

Binary file not shown.

Before

Width:  |  Height:  |  Size: 42 KiB

Binary file not shown.

Before

Width:  |  Height:  |  Size: 3.4 KiB

Binary file not shown.

Before

Width:  |  Height:  |  Size: 128 KiB

Binary file not shown.

Before

Width:  |  Height:  |  Size: 5.0 KiB

Binary file not shown.

Before

Width:  |  Height:  |  Size: 9.5 KiB

Binary file not shown.

Before

Width:  |  Height:  |  Size: 1.6 KiB

Binary file not shown.

Before

Width:  |  Height:  |  Size: 1.3 KiB

Binary file not shown.

Before

Width:  |  Height:  |  Size: 2.4 KiB

Binary file not shown.

Before

Width:  |  Height:  |  Size: 2.9 KiB

Binary file not shown.

Before

Width:  |  Height:  |  Size: 3.7 KiB

Binary file not shown.

Before

Width:  |  Height:  |  Size: 5.9 KiB

@@ -1,39 +0,0 @@
{
"manifest_version": 3,
"default_locale": "en",
"name": "__MSG_extension_name__",
"description": "__MSG_extension_description__",
"version": "1.0",
"icons": {
"48": "images/icon-48.png",
"96": "images/icon-96.png",
"128": "images/icon-128.png",
"256": "images/icon-256.png",
"512": "images/icon-512.png"
},
"background": {
"service_worker": "background.js"
},
"content_scripts": [{
"js": [ "content.js" ],
"matches": [ "*://*.instagram.com/*" ]
}],
"action": {
"default_popup": "popup.html",
"default_icon": {
"16": "images/toolbar-icon-16.png",
"19": "images/toolbar-icon-19.png",
"32": "images/toolbar-icon-32.png",
"38": "images/toolbar-icon-38.png",
"48": "images/toolbar-icon-48.png",
"72": "images/toolbar-icon-72.png"
}
},
"permissions": [ ]
}
@@ -1,22 +0,0 @@
:root {
color-scheme: light dark;
}
body {
width: 220px;
padding: 14px 16px;
margin: 0;
font-family: -apple-system, system-ui, sans-serif;
text-align: left;
}
.title {
font-size: 15px;
font-weight: 600;
}
.subtitle {
margin-top: 4px;
font-size: 12px;
opacity: 0.7;
}
@@ -1,12 +0,0 @@
<!DOCTYPE html>
<html>
<head>
<meta charset="UTF-8">
<link rel="stylesheet" href="popup.css">
<script type="module" src="popup.js"></script>
</head>
<body>
<div class="title">Open in RyukGram</div>
<div class="subtitle">instagram.com links open in the app.</div>
</body>
</html>
Submodule modules/FLEXing deleted from 339eba9d99
@@ -1,78 +0,0 @@
//
// JGProgressHUD-Defines.h
// JGProgressHUD
//
// Created by Jonas Gessner on 28.04.15.
// Copyright (c) 2015 Jonas Gessner. All rights reserved.
//
#import <Foundation/Foundation.h>
/**
Positions of the HUD.
*/
typedef NS_ENUM(NSUInteger, JGProgressHUDPosition) {
/** Center position. */
JGProgressHUDPositionCenter = 0,
/** Top left position. */
JGProgressHUDPositionTopLeft,
/** Top center position. */
JGProgressHUDPositionTopCenter,
/** Top right position. */
JGProgressHUDPositionTopRight,
/** Center left position. */
JGProgressHUDPositionCenterLeft,
/** Center right position. */
JGProgressHUDPositionCenterRight,
/** Bottom left position. */
JGProgressHUDPositionBottomLeft,
/** Bottom center position. */
JGProgressHUDPositionBottomCenter,
/** Bottom right position. */
JGProgressHUDPositionBottomRight
};
/**
Appearance styles of the HUD.
*/
typedef NS_ENUM(NSUInteger, JGProgressHUDStyle) {
/** Extra light HUD with dark elements. */
JGProgressHUDStyleExtraLight = 0,
/** Light HUD with dark elemets. */
JGProgressHUDStyleLight,
/** Dark HUD with light elements. */
JGProgressHUDStyleDark,
};
#if TARGET_OS_IOS
/**
Interaction types.
*/
typedef NS_ENUM(NSUInteger, JGProgressHUDInteractionType) {
/** Block all touches. No interaction behin the HUD is possible. */
JGProgressHUDInteractionTypeBlockAllTouches = 0,
/** Block touches on the HUD view. */
JGProgressHUDInteractionTypeBlockTouchesOnHUDView,
/** Block no touches. */
JGProgressHUDInteractionTypeBlockNoTouches
};
#endif
/**
Parallax Modes.
*/
typedef NS_ENUM(NSUInteger, JGProgressHUDParallaxMode) {
/** Follows the device setting for parallax. If "Reduce Motion" is enabled, no parallax effect is added to the HUD, if "Reduce Motion" is disabled the HUD will have a parallax effect. This behaviour is only supported on iOS 8 and higher. */
JGProgressHUDParallaxModeDevice = 0,
/** Always adds a parallax effect to the HUD. Parallax is only supported on iOS 7 and higher. */
JGProgressHUDParallaxModeAlwaysOn,
/** Never adds a parallax effect to the HUD. */
JGProgressHUDParallaxModeAlwaysOff
};
#ifndef fequal
/**
Macro for safe floating point comparison (for internal use in JGProgressHUD).
*/
#define fequal(a,b) (fabs((a) - (b)) < FLT_EPSILON)
#endif
-310
View File
@@ -1,310 +0,0 @@
//
// JGProgressHUD.h
// JGProgressHUD
//
// Created by Jonas Gessner on 20.7.14.
// Copyright (c) 2014 Jonas Gessner. All rights reserved.
//
#pragma clang diagnostic push
#pragma clang diagnostic ignored "-Wquoted-include-in-framework-header"
#import "JGProgressHUD-Defines.h"
#import "JGProgressHUDShadow.h"
#import "JGProgressHUDAnimation.h"
#import "JGProgressHUDFadeAnimation.h"
#import "JGProgressHUDFadeZoomAnimation.h"
#import "JGProgressHUDIndicatorView.h"
#import "JGProgressHUDErrorIndicatorView.h"
#import "JGProgressHUDSuccessIndicatorView.h"
#import "JGProgressHUDRingIndicatorView.h"
#import "JGProgressHUDPieIndicatorView.h"
#import "JGProgressHUDIndeterminateIndicatorView.h"
#pragma clang diagnostic pop
@protocol JGProgressHUDDelegate;
/**
A HUD to indicate progress, success, error, warnings or other notifications to the user.
@discussion @c JGProgressHUD respects its @c layoutMargins when positioning the HUD view. Additionally, on iOS 11 if @c insetsLayoutMarginsFromSafeArea is set to @c YES (default) the @c layoutMargins additionally contain the @c safeAreaInsets.
@note Remember to call every method from the main thread! UIKit => main thread!
@attention You may not add JGProgressHUD to a view which has an alpha value < 1.0 or to a view which is a subview of a view with an alpha value < 1.0.
*/
@interface JGProgressHUD : UIView
/**
Designated initializer.
@param style The appearance style of the HUD.
*/
- (instancetype __nonnull)initWithStyle:(JGProgressHUDStyle)style;
/**
Convenience initializer.
@param style The appearance style of the HUD.
*/
+ (instancetype __nonnull)progressHUDWithStyle:(JGProgressHUDStyle)style;
/**
Convenience initializer. The HUD will dynamically change its style based on whether dark mode is enabled or not. When dark mode is on, the style will be JGProgressHUDStyleDark, when dark mode is off the style will be JGProgressHUDStyleExtraLight.
*/
- (instancetype __nonnull)initWithAutomaticStyle;
/**
Convenience initializer. The HUD will dynamically change its style based on whether dark mode is enabled or not. When dark mode is on, the style will be JGProgressHUDStyleDark, when dark mode is off the style will be JGProgressHUDStyleExtraLight.
*/
+ (instancetype __nonnull)progressHUDWithAutomaticStyle;
/**
The appearance style of the HUD.
@b Default: JGProgressHUDStyleExtraLight.
*/
@property (nonatomic, assign) JGProgressHUDStyle style;
/** The view in which the HUD is presented. */
@property (nonatomic, weak, readonly, nullable) UIView *targetView;
/**
The delegate of the HUD.
@sa JGProgressHUDDelegate.
*/
@property (nonatomic, weak, nullable) id <JGProgressHUDDelegate> delegate;
/** The actual HUD view visible on screen. You may add animations to this view. */
@property (nonatomic, strong, readonly, nonnull) UIView *HUDView;
/**
The content view inside the @c HUDView. If you want to add additional views to the HUD you should add them as subview to the @c contentView.
*/
@property (nonatomic, strong, readonly, nonnull) UIView *contentView;
/**
The label used to present text on the HUD. Set the @c text or @c attributedText property of this label to change the displayed text. You may not change the label's @c frame or @c bounds.
*/
@property (nonatomic, strong, readonly, nonnull) UILabel *textLabel;
/**
The label used to present detail text on the HUD. Set the @c text or @c attributedText property of this label to change the displayed text. You may not change the label's @c frame or @c bounds.
*/
@property (nonatomic, strong, readonly, nonnull) UILabel *detailTextLabel;
/**
The indicator view. You can assign a custom subclass of @c JGProgressHUDIndicatorView to this property or one of the default indicator views (if you do so, you should assign it before showing the HUD). This value is optional.
@b Default: JGProgressHUDIndeterminateIndicatorView.
*/
@property (nonatomic, strong, nullable) JGProgressHUDIndicatorView *indicatorView;
/**
The shadow cast by the @c HUDView. This value is optional. Setting this to @c nil means no shadow is cast by the HUD.
@b Default: nil.
*/
@property (nonatomic, strong, nullable) JGProgressHUDShadow *shadow;
/**
The position of the HUD inside the hosting view's frame, or inside the specified frame.
@b Default: JGProgressHUDPositionCenter
*/
@property (nonatomic, assign) JGProgressHUDPosition position;
/**
The animation used for showing and dismissing the HUD.
@b Default: JGProgressHUDFadeAnimation.
*/
@property (nonatomic, strong, nonnull) JGProgressHUDAnimation *animation;
#if TARGET_OS_IOS
/**
Interaction type of the HUD. Determines whether touches should be let through to the views behind the HUD.
@sa JGProgressHUDInteractionType.
@b Default: JGProgressHUDInteractionTypeBlockAllTouches.
*/
@property (nonatomic, assign) JGProgressHUDInteractionType interactionType;
#endif
/**
Parallax mode for the HUD. This setting determines whether the HUD should have a parallax (@c UIDeviceMotion) effect. This effect is controlled by device motion on iOS and remote touchpad panning gestures on tvOS.
@sa JGProgressHUDParallaxMode.
@b Default: JGProgressHUDParallaxModeDevice.
*/
@property (nonatomic, assign) JGProgressHUDParallaxMode parallaxMode;
#if TARGET_OS_TV
/**
When this property is set to @c YES the HUD will try to become focused, which prevents interactions with the @c targetView. If set to @c NO the HUD will not become focused and interactions with @c targetView remain possible. Default: @c YES.
*/
@property (nonatomic, assign) BOOL wantsFocus;
#endif
/**
If the HUD should always have the same width and height.
@b Default: NO.
*/
@property (nonatomic, assign) BOOL square;
/**
Internally @c JGProgressHUD uses an @c UIVisualEffectView with a @c UIBlurEffect. A second @c UIVisualEffectView can be added on top of that with a @c UIVibrancyEffect which amplifies and adjusts the color of content layered behind the view, allowing content placed inside the contentView to become more vivid. This flag sets whether the @c UIVibrancyEffect should be used. Using the vibrancy effect can sometimes, depending on the contents of the display, result in a weird look (especially on iOS < 9.3).
@b Default: NO.
*/
@property (nonatomic, assign) BOOL vibrancyEnabled;
/**
The radius used for rounding the four corners of the HUD view.
@b Default: 10.0.
*/
@property (nonatomic, assign) CGFloat cornerRadius;
/**
Insets the contents of the HUD.
@b Default: (20, 20, 20, 20).
*/
@property (nonatomic, assign) UIEdgeInsets contentInsets;
/**
@return Whether the HUD is visible on screen.
*/
@property (nonatomic, assign, readonly, getter = isVisible) BOOL visible;
/**
The progress to display using the @c progressIndicatorView. A change of this property is not animated. Use the @c setProgress:animated: method for an animated progress change.
@b Default: 0.0.
*/
@property (nonatomic, assign) float progress;
/**
Adjusts the current progress shown by the receiver, optionally animating the change.
The current progress is represented by a floating-point value between 0.0 and 1.0, inclusive, where 1.0 indicates the completion of the task. The default value is 0.0. Values less than 0.0 and greater than 1.0 are pinned to those limits.
@param progress The new progress value.
@param animated YES if the change should be animated, NO if the change should happen immediately.
*/
- (void)setProgress:(float)progress animated:(BOOL)animated;
/**
Specifies a minimum time that the HUD will be on-screen. Useful to prevent the HUD from flashing quickly on the screen when indeterminate tasks complete more quickly than expected.
@b Default: 0.0.
*/
@property (nonatomic, assign) NSTimeInterval minimumDisplayTime;
/**
Determines whether Voice Over announcements should be made upon displaying the HUD (if Voice Over is active).
@b Default: YES
*/
@property (nonatomic, assign) BOOL voiceOverEnabled;
#if TARGET_OS_IOS
/**
A block to be invoked when the HUD view is tapped.
@note The interaction type of the HUD must be @c JGProgressHUDInteractionTypeBlockTouchesOnHUDView or @c JGProgressHUDInteractionTypeBlockAllTouches, otherwise this block won't be fired.
*/
@property (nonatomic, copy, nullable) void (^tapOnHUDViewBlock)(JGProgressHUD *__nonnull HUD);
/**
A block to be invoked when the area outside of the HUD view is tapped.
@note The interaction type of the HUD must be @c JGProgressHUDInteractionTypeBlockAllTouches, otherwise this block won't be fired.
*/
@property (nonatomic, copy, nullable) void (^tapOutsideBlock)(JGProgressHUD *__nonnull HUD);
#endif
/**
Shows the HUD animated. You should preferably show the HUD in a UIViewController's view. The HUD will be repositioned in response to rotation and keyboard show/hide notifications.
@param view The view to show the HUD in. The frame of the @c view will be used to calculate the position of the HUD.
*/
- (void)showInView:(UIView *__nonnull)view;
/**
Shows the HUD. You should preferably show the HUD in a UIViewController's view. The HUD will be repositioned in response to rotation and keyboard show/hide notifications.
@param view The view to show the HUD in. The frame of the @c view will be used to calculate the position of the HUD.
@param animated If the HUD should show with an animation.
*/
- (void)showInView:(UIView *__nonnull)view animated:(BOOL)animated;
/**
Shows the HUD after a delay. You should preferably show the HUD in a UIViewController's view. The HUD will be repositioned in response to rotation and keyboard show/hide notifications.
You may call @c dismiss to stop the HUD from appearing before the delay has passed.
@param view The view to show the HUD in. The frame of the @c view will be used to calculate the position of the HUD.
@param animated If the HUD should show with an animation.
@param delay The delay until the HUD will be shown.
*/
- (void)showInView:(UIView *__nonnull)view animated:(BOOL)animated afterDelay:(NSTimeInterval)delay;
/** Dismisses the HUD animated. If the HUD is currently not visible this method does nothing. */
- (void)dismiss;
/**
Dismisses the HUD. If the HUD is currently not visible this method does nothing.
@param animated If the HUD should dismiss with an animation.
*/
- (void)dismissAnimated:(BOOL)animated;
/**
Dismisses the HUD animated after a delay. If the HUD is currently not visible this method does nothing.
@param delay The delay until the HUD will be dismissed.
*/
- (void)dismissAfterDelay:(NSTimeInterval)delay;
/**
Dismisses the HUD after a delay. If the HUD is currently not visible this method does nothing.
@param delay The delay until the HUD will be dismissed.
@param animated If the HUD should dismiss with an animation.
*/
- (void)dismissAfterDelay:(NSTimeInterval)delay animated:(BOOL)animated;
/**
Dismisses the HUD after a delay and runs a block upon completion. If the HUD is currently not visible this method does nothing.
@param delay The delay until the HUD will be dismissed.
@param animated If the HUD should dismiss with an animation.
@param dismissCompletion The block to execute after the HUD was dismissed.
*/
- (void)dismissAfterDelay:(NSTimeInterval)delay animated:(BOOL)animated completion:(void (^_Nullable)(void))dismissCompletion;
/**
Schedules the given block to be executed when this HUD disapears. If the HUD is currently not visible this method does nothing.
@param dismissCompletion The block to execute after the HUD was dismissed. Multiple calls to this method cause the different blocks to be executed in FIFO order.
*/
- (void)performAfterDismiss:(void (^_Nonnull)(void))dismissCompletion;
@end
@interface JGProgressHUD (HUDManagement)
/**
@param view The view to return all visible progress HUDs for.
@return All visible progress HUDs in the view.
*/
+ (NSArray<JGProgressHUD *> *__nonnull)allProgressHUDsInView:(UIView *__nonnull)view;
/**
@param view The view to return all visible progress HUDs for.
@return All visible progress HUDs in the view and its subviews.
*/
+ (NSArray<JGProgressHUD *> *__nonnull)allProgressHUDsInViewHierarchy:(UIView *__nonnull)view;
@end
@protocol JGProgressHUDDelegate <NSObject>
@optional
/**
Called before the HUD will appear.
@param view The view in which the HUD is presented.
*/
- (void)progressHUD:(JGProgressHUD *__nonnull)progressHUD willPresentInView:(UIView *__nonnull)view;
/**
Called after the HUD appeared.
@param view The view in which the HUD is presented.
*/
- (void)progressHUD:(JGProgressHUD *__nonnull)progressHUD didPresentInView:(UIView *__nonnull)view;
/**
Called before the HUD will disappear.
@param view The view in which the HUD is presented and will be dismissed from.
*/
- (void)progressHUD:(JGProgressHUD *__nonnull)progressHUD willDismissFromView:(UIView *__nonnull)view;
/**
Called after the HUD has disappeared.
@param view The view in which the HUD was presented and was be dismissed from.
*/
- (void)progressHUD:(JGProgressHUD *__nonnull)progressHUD didDismissFromView:(UIView *__nonnull)view;
@end
File diff suppressed because it is too large Load Diff
@@ -1,43 +0,0 @@
//
// JGProgressHUDAnimation.h
// JGProgressHUD
//
// Created by Jonas Gessner on 20.7.14.
// Copyright (c) 2014 Jonas Gessner. All rights reserved.
//
#import <Foundation/Foundation.h>
#import <UIKit/UIKit.h>
@class JGProgressHUD;
/**
You may subclass this class to create a custom progress indicator view.
*/
@interface JGProgressHUDAnimation : NSObject
/** Convenience initializer. */
+ (instancetype __nonnull)animation;
/** The HUD using this animation. */
@property (nonatomic, weak, readonly, nullable) JGProgressHUD *progressHUD;
/**
The @c progressHUD is hidden from screen with @c alpha = 1 and @c hidden = @c YES. Ideally, you should prepare the HUD for presentation, then set @c hidden to @c NO on the @c progressHUD and then perform the animation.
@post Call @c animationFinished.
*/
- (void)show NS_REQUIRES_SUPER;
/**
The @c progressHUD wis visible on screen with @c alpha = 1 and @c hidden = @c NO. You should only perform the animation in this method, the @c progressHUD itself will take care of hiding itself and removing itself from superview.
@post Call @c animationFinished.
*/
- (void)hide NS_REQUIRES_SUPER;
/**
@pre This method should only be called at the end of a @c show or @c hide animaiton.
@attention ALWAYS call this method after completing a @c show or @c hide animation.
*/
- (void)animationFinished NS_REQUIRES_SUPER;
@end
@@ -1,48 +0,0 @@
//
// JGProgressHUDAnimation.m
// JGProgressHUD
//
// Created by Jonas Gessner on 20.7.14.
// Copyright (c) 2014 Jonas Gessner. All rights reserved.
//
#import "JGProgressHUDAnimation.h"
#import "JGProgressHUD.h"
@interface JGProgressHUD (Private)
- (void)animationDidFinish:(BOOL)presenting;
@end
@interface JGProgressHUDAnimation () {
BOOL _presenting;
}
@property (nonatomic, weak) JGProgressHUD *progressHUD;
@end
@implementation JGProgressHUDAnimation
#pragma mark - Initializers
+ (instancetype)animation {
return [[self alloc] init];
}
#pragma mark - Public methods
- (void)show {
_presenting = YES;
}
- (void)hide {
_presenting = NO;
}
- (void)animationFinished {
[self.progressHUD animationDidFinish:_presenting];
}
@end
@@ -1,24 +0,0 @@
//
// JGProgressHUDErrorIndicatorView.h
// JGProgressHUD
//
// Created by Jonas Gessner on 19.08.14.
// Copyright (c) 2014 Jonas Gessner. All rights reserved.
//
#pragma clang diagnostic push
#pragma clang diagnostic ignored "-Wquoted-include-in-framework-header"
#import "JGProgressHUDImageIndicatorView.h"
#pragma clang diagnostic pop
/**
An image indicator showing a cross, representing a failed operation.
*/
@interface JGProgressHUDErrorIndicatorView : JGProgressHUDImageIndicatorView
/**
Default initializer for this class.
*/
- (instancetype __nonnull)init;
@end
@@ -1,57 +0,0 @@
//
// JGProgressHUDErrorIndicatorView.m
// JGProgressHUD
//
// Created by Jonas Gessner on 19.08.14.
// Copyright (c) 2014 Jonas Gessner. All rights reserved.
//
#import "JGProgressHUDErrorIndicatorView.h"
#import "JGProgressHUD.h"
static UIBezierPath *errorBezierPath() {
static UIBezierPath *path;
static dispatch_once_t onceToken;
dispatch_once(&onceToken, ^{
path = [UIBezierPath bezierPath];
[path moveToPoint:CGPointMake(3, 3)];
[path addLineToPoint:CGPointMake(30, 30)];
[path moveToPoint:CGPointMake(30, 3)];
[path addLineToPoint:CGPointMake(3, 30)];
[path setLineWidth:3];
[path setLineJoinStyle:kCGLineJoinRound];
[path setLineCapStyle:kCGLineCapRound];
});
return path;
}
@implementation JGProgressHUDErrorIndicatorView
- (instancetype)initWithContentView:(UIView *__unused)contentView {
UIBezierPath *path = errorBezierPath();
UIGraphicsBeginImageContextWithOptions(CGSizeMake(33, 33), NO, 0.0);
[[UIColor blackColor] setStroke];
[path stroke];
UIImage *img = [UIGraphicsGetImageFromCurrentImageContext() imageWithRenderingMode:UIImageRenderingModeAlwaysTemplate];
UIGraphicsEndImageContext();
self = [super initWithImage:img];
return self;
}
- (instancetype)init {
return [self initWithContentView:nil];
}
- (void)updateAccessibility {
self.accessibilityLabel = NSLocalizedString(@"Error",);
}
@end
@@ -1,33 +0,0 @@
//
// JGProgressHUDFadeAnimation.h
// JGProgressHUD
//
// Created by Jonas Gessner on 20.7.14.
// Copyright (c) 2014 Jonas Gessner. All rights reserved.
//
#pragma clang diagnostic push
#pragma clang diagnostic ignored "-Wquoted-include-in-framework-header"
#import "JGProgressHUDAnimation.h"
#pragma clang diagnostic pop
/**
A simple fade animation that fades the HUD from alpha @c 0.0 to alpha @c 1.0.
*/
@interface JGProgressHUDFadeAnimation : JGProgressHUDAnimation
/**
Duration of the animation.
@b Default: 0.4.
*/
@property (nonatomic, assign) NSTimeInterval duration;
/**
Animation options
@b Default: UIViewAnimationOptionCurveEaseInOut.
*/
@property (nonatomic, assign) UIViewAnimationOptions animationOptions;
@end
@@ -1,56 +0,0 @@
//
// JGProgressHUDFadeAnimation.m
// JGProgressHUD
//
// Created by Jonas Gessner on 20.7.14.
// Copyright (c) 2014 Jonas Gessner. All rights reserved.
//
#import "JGProgressHUDFadeAnimation.h"
#import "JGProgressHUD.h"
@implementation JGProgressHUDFadeAnimation
#pragma mark - Initializers
- (instancetype)init {
self = [super init];
if (self) {
self.duration = 0.4;
self.animationOptions = UIViewAnimationOptionCurveEaseInOut;
}
return self;
}
- (void)setAnimationOptions:(UIViewAnimationOptions)animationOptions {
_animationOptions = (animationOptions | UIViewAnimationOptionBeginFromCurrentState);
}
#pragma mark - Showing
- (void)show {
[super show];
self.progressHUD.alpha = 0.0;
self.progressHUD.hidden = NO;
[UIView animateWithDuration:self.duration delay:0.0 options:self.animationOptions animations:^{
self.progressHUD.alpha = 1.0;
} completion:^(BOOL __unused finished) {
[self animationFinished];
}];
}
#pragma mark - Hiding
- (void)hide {
[super hide];
[UIView animateWithDuration:self.duration delay:0.0 options:self.animationOptions animations:^{
self.progressHUD.alpha = 0.0;
} completion:^(BOOL __unused finished) {
[self animationFinished];
}];
}
@end
@@ -1,40 +0,0 @@
//
// JGProgressHUDFadeZoomAnimation.h
// JGProgressHUD
//
// Created by Jonas Gessner on 20.7.14.
// Copyright (c) 2014 Jonas Gessner. All rights reserved.
//
#pragma clang diagnostic push
#pragma clang diagnostic ignored "-Wquoted-include-in-framework-header"
#import "JGProgressHUDAnimation.h"
#pragma clang diagnostic pop
/**
An animation that fades in the HUD and expands the HUD from scale @c (0, 0) to a customizable scale, and finally to scale @c (1, 1), creating a bouncing effect.
*/
@interface JGProgressHUDFadeZoomAnimation : JGProgressHUDAnimation
/**
Duration of the animation from or to the shrinked state.
@b Default: 0.2.
*/
@property (nonatomic, assign) NSTimeInterval shrinkAnimationDuaration;
/**
Duration of the animation from or to the expanded state.
@b Default: 0.1.
*/
@property (nonatomic, assign) NSTimeInterval expandAnimationDuaration;
/**
The scale to apply to the HUD when expanding.
@b Default: (1.1, 1.1).
*/
@property (nonatomic, assign) CGSize expandScale;
@end
@@ -1,77 +0,0 @@
//
// JGProgressHUDFadeZoomAnimation.m
// JGProgressHUD
//
// Created by Jonas Gessner on 20.7.14.
// Copyright (c) 2014 Jonas Gessner. All rights reserved.
//
#import "JGProgressHUDFadeZoomAnimation.h"
#import "JGProgressHUD.h"
@implementation JGProgressHUDFadeZoomAnimation
#pragma mark - Initializers
- (instancetype)init {
self = [super init];
if (self) {
self.shrinkAnimationDuaration = 0.2;
self.expandAnimationDuaration = 0.1;
self.expandScale = CGSizeMake(1.1, 1.1);
}
return self;
}
#pragma mark - Showing
- (void)show {
[super show];
self.progressHUD.alpha = 0.0;
self.progressHUD.HUDView.transform = CGAffineTransformMakeScale(0.1, 0.1);
NSTimeInterval totalDuration = self.expandAnimationDuaration+self.shrinkAnimationDuaration;
self.progressHUD.hidden = NO;
[UIView animateWithDuration:totalDuration delay:0.0 options:(UIViewAnimationOptions)(UIViewAnimationOptionBeginFromCurrentState | UIViewAnimationOptionCurveEaseInOut) animations:^{
self.progressHUD.alpha = 1.0;
} completion:nil];
[UIView animateWithDuration:self.shrinkAnimationDuaration delay:0.0 options:(UIViewAnimationOptions)(UIViewAnimationOptionCurveEaseIn | UIViewAnimationOptionBeginFromCurrentState) animations:^{
self.progressHUD.HUDView.transform = CGAffineTransformMakeScale(self.expandScale.width, self.expandScale.height);
} completion:^(BOOL __unused _finished) {
[UIView animateWithDuration:self.expandAnimationDuaration delay:0.0 options:(UIViewAnimationOptions)(UIViewAnimationOptionCurveEaseOut | UIViewAnimationOptionBeginFromCurrentState) animations:^{
self.progressHUD.HUDView.transform = CGAffineTransformIdentity;
} completion:^(BOOL __unused __finished) {
[self animationFinished];
}];
}];
}
#pragma mark - Hiding
- (void)hide {
[super hide];
NSTimeInterval totalDuration = self.expandAnimationDuaration+self.shrinkAnimationDuaration;
[UIView animateWithDuration:totalDuration delay:0.0 options:(UIViewAnimationOptions)(UIViewAnimationOptionBeginFromCurrentState | UIViewAnimationOptionCurveEaseInOut) animations:^{
self.progressHUD.alpha = 0.0;
} completion:nil];
[UIView animateWithDuration:self.expandAnimationDuaration delay:0.0 options:(UIViewAnimationOptions)(UIViewAnimationOptionCurveEaseIn | UIViewAnimationOptionBeginFromCurrentState) animations:^{
self.progressHUD.HUDView.transform = CGAffineTransformMakeScale(self.expandScale.width, self.expandScale.height);
} completion:^(BOOL __unused _finished) {
[UIView animateWithDuration:self.shrinkAnimationDuaration delay:0.0 options:(UIViewAnimationOptions)(UIViewAnimationOptionCurveEaseOut | UIViewAnimationOptionBeginFromCurrentState) animations:^{
self.progressHUD.HUDView.transform = CGAffineTransformMakeScale(0.1, 0.1);
} completion:^(BOOL __unused __finished) {
self.progressHUD.HUDView.transform = CGAffineTransformIdentity;
[self animationFinished];
}];
}];
}
@end
@@ -1,28 +0,0 @@
//
// JGProgressHUDImageIndicatorView.h
// JGProgressHUD
//
// Created by Jonas Gessner on 05.08.15.
// Copyright (c) 2015 Jonas Gessner. All rights reserved.
//
#pragma clang diagnostic push
#pragma clang diagnostic ignored "-Wquoted-include-in-framework-header"
#import "JGProgressHUDIndicatorView.h"
#pragma clang diagnostic pop
/**
An indicator for displaying custom images. Supports animated images.
You may subclass this class to create a custom image indicator view.
*/
@interface JGProgressHUDImageIndicatorView : JGProgressHUDIndicatorView
/**
Initializes the indicator view with an UIImageView showing the @c image.
@param image The image to show in the indicator view.
*/
- (instancetype __nonnull)initWithImage:(UIImage *__nonnull)image;
@end
@@ -1,42 +0,0 @@
//
// JGProgressHUDImageIndicatorView.m
// JGProgressHUD
//
// Created by Jonas Gessner on 05.08.15.
// Copyright (c) 2015 Jonas Gessner. All rights reserved.
//
#import "JGProgressHUDImageIndicatorView.h"
@implementation JGProgressHUDImageIndicatorView {
BOOL _customizedTintColor;
}
- (instancetype)initWithImage:(UIImage *)image {
UIImageView *imageView = [[UIImageView alloc] initWithImage:image];
self = [super initWithContentView:imageView];
return self;
}
- (void)setUpForHUDStyle:(JGProgressHUDStyle)style vibrancyEnabled:(BOOL)vibrancyEnabled {
[super setUpForHUDStyle:style vibrancyEnabled:vibrancyEnabled];
if (!_customizedTintColor) {
if (style == JGProgressHUDStyleDark) {
self.tintColor = [UIColor whiteColor];
}
else {
self.tintColor = [UIColor blackColor];
}
_customizedTintColor = NO;
}
}
- (void)setTintColor:(UIColor *)tintColor {
[super setTintColor:tintColor];
_customizedTintColor = YES;
}
@end
@@ -1,25 +0,0 @@
//
// JGProgressHUDIndeterminateIndicatorView.h
// JGProgressHUD
//
// Created by Jonas Gessner on 19.07.14.
// Copyright (c) 2014 Jonas Gessner. All rights reserved.
//
#pragma clang diagnostic push
#pragma clang diagnostic ignored "-Wquoted-include-in-framework-header"
#import "JGProgressHUDIndicatorView.h"
#pragma clang diagnostic pop
/**
An indeterminate progress indicator showing a @c UIActivityIndicatorView.
*/
@interface JGProgressHUDIndeterminateIndicatorView : JGProgressHUDIndicatorView
/**
Set the color of the activity indicator view.
@param color The color to apply to the activity indicator view.
*/
- (void)setColor:(UIColor *__nonnull)color;
@end
@@ -1,63 +0,0 @@
//
// JGProgressHUDIndeterminateIndicatorView.m
// JGProgressHUD
//
// Created by Jonas Gessner on 19.07.14.
// Copyright (c) 2014 Jonas Gessner. All rights reserved.
//
#import "JGProgressHUDIndeterminateIndicatorView.h"
#ifndef __IPHONE_13_0
#define __IPHONE_13_0 130000
#endif
@implementation JGProgressHUDIndeterminateIndicatorView
- (instancetype)init {
UIActivityIndicatorView *activityIndicatorView;
#if __IPHONE_OS_VERSION_MAX_ALLOWED >= __IPHONE_13_0
if (@available(iOS 13, tvOS 13, *)) {
activityIndicatorView = [[UIActivityIndicatorView alloc] initWithActivityIndicatorStyle:UIActivityIndicatorViewStyleLarge];
}
else {
#pragma clang diagnostic push
#pragma clang diagnostic ignored "-Wdeprecated-declarations"
activityIndicatorView = [[UIActivityIndicatorView alloc] initWithActivityIndicatorStyle:UIActivityIndicatorViewStyleWhiteLarge];
#pragma clang diagnostic pop
}
#else
activityIndicatorView = [[UIActivityIndicatorView alloc] initWithActivityIndicatorStyle:UIActivityIndicatorViewStyleWhiteLarge];
#endif
[activityIndicatorView startAnimating];
self = [super initWithContentView:activityIndicatorView];
return self;
}
- (instancetype)initWithHUDStyle:(JGProgressHUDStyle)style {
return [self init];
}
- (void)setUpForHUDStyle:(JGProgressHUDStyle)style vibrancyEnabled:(BOOL)vibrancyEnabled {
[super setUpForHUDStyle:style vibrancyEnabled:vibrancyEnabled];
if (style != JGProgressHUDStyleDark) {
self.color = [UIColor blackColor];
}
else {
self.color = [UIColor whiteColor];
}
}
- (void)setColor:(UIColor *)color {
[(UIActivityIndicatorView *)self.contentView setColor:color];
}
- (void)updateAccessibility {
self.accessibilityLabel = NSLocalizedString(@"Indeterminate progress",);
}
@end
@@ -1,61 +0,0 @@
//
// JGProgressHUDIndicatorView.h
// JGProgressHUD
//
// Created by Jonas Gessner on 20.7.14.
// Copyright (c) 2014 Jonas Gessner. All rights reserved.
//
#import <Foundation/Foundation.h>
#import <UIKit/UIKit.h>
#pragma clang diagnostic push
#pragma clang diagnostic ignored "-Wquoted-include-in-framework-header"
#import "JGProgressHUD-Defines.h"
#pragma clang diagnostic pop
/** You may subclass this class to create a custom progress indicator view. */
@interface JGProgressHUDIndicatorView : UIView
/**
Designated initializer for this class.
@param contentView The content view to place on the container view (the container is the JGProgressHUDIndicatorView).
*/
- (instancetype __nonnull)initWithContentView:(UIView *__nullable)contentView;
/** Use this method to set up the indicator view to fit the HUD style and vibrancy setting. This method is called by @c JGProgressHUD when the indicator view is added to the HUD and when the HUD's @c vibrancyEnabled property changes. This method may be called multiple times with different values. The default implementation does nothing. */
- (void)setUpForHUDStyle:(JGProgressHUDStyle)style vibrancyEnabled:(BOOL)vibrancyEnabled;
/** Ranges from 0.0 to 1.0. */
@property (nonatomic, assign) float progress;
/**
Adjusts the current progress shown by the receiver, optionally animating the change.
The current progress is represented by a floating-point value between 0.0 and 1.0, inclusive, where 1.0 indicates the completion of the task. The default value is 0.0. Values less than 0.0 and greater than 1.0 are pinned to those limits.
@param progress The new progress value.
@param animated YES if the change should be animated, NO if the change should happen immediately.
*/
- (void)setProgress:(float)progress animated:(BOOL)animated;
/**
The content view which displays the progress.
*/
@property (nonatomic, strong, readonly, nullable) UIView *contentView;
/** Schedules an accessibility update on the next run loop. */
- (void)setNeedsAccessibilityUpdate;
/**
Runs @c updateAccessibility immediately if an accessibility update has been scheduled (through @c setNeedsAccessibilityUpdate) but has not executed yet.
*/
- (void)updateAccessibilityIfNeeded;
/**
Override to set custom accessibility properties. This method gets called once when initializing the view and after calling @c setNeedsAccessibilityUpdate.
*/
- (void)updateAccessibility;
@end
@@ -1,103 +0,0 @@
//
// JGProgressHUDIndicatorView.m
// JGProgressHUD
//
// Created by Jonas Gessner on 20.7.14.
// Copyright (c) 2014 Jonas Gessner. All rights reserved.
//
#import "JGProgressHUDIndicatorView.h"
#import "JGProgressHUD.h"
@interface JGProgressHUDIndicatorView () {
BOOL _accessibilityUpdateScheduled;
}
+ (void)runBlock:(void (^)(void))block;
@end
static void runOnNextRunLoop(void (^block)(void)) {
[[NSRunLoop currentRunLoop] performSelector:@selector(runBlock:) target:[JGProgressHUDIndicatorView class] argument:(id)block order:0 modes:@[NSRunLoopCommonModes]];
}
@implementation JGProgressHUDIndicatorView
#pragma mark - Initializers
- (instancetype)initWithFrame:(CGRect __unused)frame {
return [self init];
}
- (instancetype)init {
return [self initWithContentView:nil];
}
- (instancetype)initWithContentView:(UIView *)contentView {
self = [super initWithFrame:(contentView ? contentView.frame : CGRectMake(0.0, 0.0, 50.0, 50.0))];
if (self) {
self.opaque = NO;
self.backgroundColor = [UIColor clearColor];
self.isAccessibilityElement = YES;
[self setNeedsAccessibilityUpdate];
if (contentView) {
_contentView = contentView;
[self addSubview:self.contentView];
}
}
return self;
}
#pragma mark - Setup
- (void)setUpForHUDStyle:(JGProgressHUDStyle)style vibrancyEnabled:(BOOL)vibrancyEnabled {}
#pragma mark - Accessibility
+ (void)runBlock:(void (^)(void))block {
if (block != nil) {
block();
}
}
- (void)setNeedsAccessibilityUpdate {
if (!_accessibilityUpdateScheduled) {
_accessibilityUpdateScheduled = YES;
runOnNextRunLoop(^{
[self updateAccessibilityIfNeeded];
});
}
}
- (void)updateAccessibilityIfNeeded {
if (_accessibilityUpdateScheduled) {
[self updateAccessibility];
_accessibilityUpdateScheduled = NO;
}
}
- (void)updateAccessibility {
self.accessibilityLabel = [NSLocalizedString(@"Loading",) stringByAppendingFormat:@" %.f %%", self.progress];
}
#pragma mark - Getters & Setters
- (void)setProgress:(float)progress {
[self setProgress:progress animated:NO];
}
- (void)setProgress:(float)progress animated:(__unused BOOL)animated {
if (fequal(self.progress, progress)) {
return;
}
_progress = progress;
[self setNeedsAccessibilityUpdate];
}
@end
@@ -1,35 +0,0 @@
//
// JGProgressHUDPieIndicatorView.h
// JGProgressHUD
//
// Created by Jonas Gessner on 19.07.14.
// Copyright (c) 2014 Jonas Gessner. All rights reserved.
//
#pragma clang diagnostic push
#pragma clang diagnostic ignored "-Wquoted-include-in-framework-header"
#import "JGProgressHUDIndicatorView.h"
#pragma clang diagnostic pop
/**
A pie shaped determinate progress indicator.
*/
@interface JGProgressHUDPieIndicatorView : JGProgressHUDIndicatorView
/**
Tint color of the Pie.
@attention Custom values need to be set after assigning the indicator view to @c JGProgressHUD's @c indicatorView property.
@b Default: White for JGProgressHUDStyleDark, otherwise black.
*/
@property (nonatomic, strong, nonnull) UIColor *color;
/**
The background fill color inside the pie.
@attention Custom values need to be set after assigning the indicator view to @c JGProgressHUD's @c indicatorView property.
@b Default: Dark gray for JGProgressHUDStyleDark, otherwise light gray.
*/
@property (nonatomic, strong, nonnull) UIColor *fillColor;
@end
@@ -1,171 +0,0 @@
//
// JGProgressHUDPieIndicatorView.m
// JGProgressHUD
//
// Created by Jonas Gessner on 19.07.14.
// Copyright (c) 2014 Jonas Gessner. All rights reserved.
//
#import "JGProgressHUDPieIndicatorView.h"
@interface JGProgressHUDPieIndicatorLayer : CALayer
@property (nonatomic, assign) float progress;
@property (nonatomic, weak) UIColor *color;
@property (nonatomic, weak) UIColor *fillColor;
@end
@implementation JGProgressHUDPieIndicatorLayer
@dynamic progress, color, fillColor;
+ (BOOL)needsDisplayForKey:(NSString *)key {
return ([key isEqualToString:@"progress"] || [key isEqualToString:@"color"] || [key isEqualToString:@"fillColor"] || [super needsDisplayForKey:key]);
}
- (id <CAAction>)actionForKey:(NSString *)key {
if ([key isEqualToString:@"progress"]) {
CABasicAnimation *progressAnimation = [CABasicAnimation animation];
progressAnimation.fromValue = [self.presentationLayer valueForKey:key];
progressAnimation.timingFunction = [CAMediaTimingFunction functionWithName:kCAMediaTimingFunctionEaseInEaseOut];
return progressAnimation;
}
return [super actionForKey:key];
}
- (void)drawInContext:(CGContextRef)ctx {
UIGraphicsPushContext(ctx);
CGRect rect = self.bounds;
CGPoint center = CGPointMake(rect.origin.x + (CGFloat)floor(rect.size.width/2.0), rect.origin.y + (CGFloat)floor(rect.size.height/2.0));
CGFloat lineWidth = 2.0;
CGFloat radius = (CGFloat)floor(MIN(rect.size.width, rect.size.height)/2.0)-lineWidth;
UIBezierPath *borderPath = [UIBezierPath bezierPathWithArcCenter:center radius:radius startAngle:0.0 endAngle:2.0*(CGFloat)M_PI clockwise:NO];
[borderPath setLineWidth:lineWidth];
if (self.fillColor) {
[self.fillColor setFill];
[borderPath fill];
}
[self.color set];
[borderPath stroke];
if (self.progress > 0.0) {
UIBezierPath *processPath = [UIBezierPath bezierPath];
[processPath setLineWidth:radius];
CGFloat startAngle = -((CGFloat)M_PI/2.0);
CGFloat endAngle = startAngle + 2.0 * (CGFloat)M_PI * self.progress;
[processPath addArcWithCenter:center radius:radius/2.0 startAngle:startAngle endAngle:endAngle clockwise:YES];
[processPath stroke];
}
UIGraphicsPopContext();
}
@end
@implementation JGProgressHUDPieIndicatorView
#pragma mark - Initializers
- (instancetype)init {
self = [super initWithContentView:nil];
if (self) {
self.layer.contentsScale = [UIScreen mainScreen].scale;
[self.layer setNeedsDisplay];
self.color = [UIColor clearColor];
self.fillColor = [UIColor clearColor];
}
return self;
}
- (instancetype)initWithHUDStyle:(JGProgressHUDStyle)style {
return [self init];
}
- (instancetype)initWithContentView:(UIView *)contentView {
return [self init];
}
#pragma mark - Getters & Setters
- (void)setColor:(UIColor *)tintColor {
if ([tintColor isEqual:self.color]) {
return;
}
_color = tintColor;
[(JGProgressHUDPieIndicatorLayer *)self.layer setColor:self.color];
}
- (void)setFillColor:(UIColor *)fillColor {
if ([fillColor isEqual:self.fillColor]) {
return;
}
_fillColor = fillColor;
[(JGProgressHUDPieIndicatorLayer *)self.layer setFillColor:self.fillColor];
}
- (void)setProgress:(float)progress animated:(BOOL)animated {
if (fequal(self.progress, progress)) {
return;
}
[super setProgress:progress animated:animated];
[CATransaction begin];
[CATransaction setAnimationDuration:(animated ? 0.3 : 0.0)];
[(JGProgressHUDPieIndicatorLayer *)self.layer setProgress:progress];
[CATransaction commit];
}
#pragma mark - Overrides
- (void)setUpForHUDStyle:(JGProgressHUDStyle)style vibrancyEnabled:(BOOL)vibrancyEnabled {
[super setUpForHUDStyle:style vibrancyEnabled:vibrancyEnabled];
if (style == JGProgressHUDStyleDark) {
self.color = [UIColor colorWithWhite:1.0 alpha:1.0];
self.fillColor = [UIColor colorWithWhite:0.2 alpha:1.0];
}
else {
self.color = [UIColor blackColor];
if (style == JGProgressHUDStyleLight) {
self.fillColor = [UIColor colorWithWhite:0.85 alpha:1.0];
}
else {
self.fillColor = [UIColor colorWithWhite:0.9 alpha:1.0];
}
}
}
+ (Class)layerClass {
return [JGProgressHUDPieIndicatorLayer class];
}
@end
@@ -1,50 +0,0 @@
//
// JGProgressHUDRingIndicatorView.h
// JGProgressHUD
//
// Created by Jonas Gessner on 20.7.14.
// Copyright (c) 2014 Jonas Gessner. All rights reserved.
//
#pragma clang diagnostic push
#pragma clang diagnostic ignored "-Wquoted-include-in-framework-header"
#import "JGProgressHUDIndicatorView.h"
#pragma clang diagnostic pop
/**
A ring shaped determinate progress indicator.
*/
@interface JGProgressHUDRingIndicatorView : JGProgressHUDIndicatorView
/**
Background color of the ring.
@attention Custom values need to be set after assigning the indicator view to @c JGProgressHUD's @c indicatorView property.
@b Default: Black for JGProgressHUDStyleDark, light gray otherwise.
*/
@property (nonatomic, strong, nonnull) UIColor *ringBackgroundColor;
/**
Progress color of the progress ring.
@attention Custom values need to be set after assigning the indicator view to @c JGProgressHUD's @c indicatorView property.
@b Default: White for JGProgressHUDStyleDark, otherwise black.
*/
@property (nonatomic, strong, nonnull) UIColor *ringColor;
/**
Sets if the progress ring should have a rounded line cap.
@b Default: NO.
*/
@property (nonatomic, assign) BOOL roundProgressLine;
/**
Width of the ring.
@b Default: 3.0.
*/
@property (nonatomic, assign) CGFloat ringWidth;
@end
@@ -1,194 +0,0 @@
//
// JGProgressHUDRingIndicatorView.m
// JGProgressHUD
//
// Created by Jonas Gessner on 20.7.14.
// Copyright (c) 2014 Jonas Gessner. All rights reserved.
//
#import "JGProgressHUDRingIndicatorView.h"
@interface JGProgressHUDRingIndicatorLayer : CALayer
@property (nonatomic, assign) float progress;
@property (nonatomic, weak) UIColor *ringColor;
@property (nonatomic, weak) UIColor *ringBackgroundColor;
@property (nonatomic, assign) BOOL roundProgressLine;
@property (nonatomic, assign) CGFloat ringWidth;
@end
@implementation JGProgressHUDRingIndicatorLayer
@dynamic progress, ringBackgroundColor, ringColor, ringWidth, roundProgressLine;
+ (BOOL)needsDisplayForKey:(NSString *)key {
return ([key isEqualToString:@"progress"] || [key isEqualToString:@"ringColor"] || [key isEqualToString:@"ringBackgroundColor"] || [key isEqualToString:@"roundProgressLine"] || [key isEqualToString:@"ringWidth"] || [super needsDisplayForKey:key]);
}
- (id <CAAction>)actionForKey:(NSString *)key {
if ([key isEqualToString:@"progress"]) {
CABasicAnimation *progressAnimation = [CABasicAnimation animation];
progressAnimation.fromValue = [self.presentationLayer valueForKey:key];
progressAnimation.timingFunction = [CAMediaTimingFunction functionWithName:kCAMediaTimingFunctionEaseInEaseOut];
return progressAnimation;
}
return [super actionForKey:key];
}
- (void)drawInContext:(CGContextRef)ctx {
UIGraphicsPushContext(ctx);
CGRect rect = self.bounds;
CGPoint center = CGPointMake(rect.origin.x + (CGFloat)floor(rect.size.width/2.0), rect.origin.y + (CGFloat)floor(rect.size.height/2.0));
CGFloat lineWidth = self.ringWidth;
CGFloat radius = (CGFloat)floor(MIN(rect.size.width, rect.size.height)/2.0) - lineWidth;
//Background
[self.ringBackgroundColor setStroke];
UIBezierPath *borderPath = [UIBezierPath bezierPathWithArcCenter:center radius:radius startAngle:0.0 endAngle:2.0*(CGFloat)M_PI clockwise:NO];
[borderPath setLineWidth:lineWidth];
[borderPath stroke];
//Progress
[self.ringColor setStroke];
if (self.progress > 0.0) {
UIBezierPath *processPath = [UIBezierPath bezierPath];
[processPath setLineWidth:lineWidth];
[processPath setLineCapStyle:(self.roundProgressLine ? kCGLineCapRound : kCGLineCapSquare)];
CGFloat startAngle = -((CGFloat)M_PI / 2.0);
CGFloat endAngle = startAngle + 2.0 * (CGFloat)M_PI * self.progress;
[processPath addArcWithCenter:center radius:radius startAngle:startAngle endAngle:endAngle clockwise:YES];
[processPath stroke];
}
UIGraphicsPopContext();
}
@end
@implementation JGProgressHUDRingIndicatorView
#pragma mark - Initializers
- (instancetype)init {
self = [super initWithContentView:nil];;
if (self) {
self.layer.contentsScale = [UIScreen mainScreen].scale;
[self.layer setNeedsDisplay];
self.ringWidth = 3.0;
self.ringColor = [UIColor clearColor];
self.ringBackgroundColor = [UIColor clearColor];
}
return self;
}
- (instancetype)initWithHUDStyle:(JGProgressHUDStyle)style {
return [self init];
}
- (instancetype)initWithContentView:(UIView *)contentView {
return [self init];
}
#pragma mark - Getters & Setters
- (void)setRoundProgressLine:(BOOL)roundProgressLine {
if (roundProgressLine == self.roundProgressLine) {
return;
}
_roundProgressLine = roundProgressLine;
[(JGProgressHUDRingIndicatorLayer *)self.layer setRoundProgressLine:self.roundProgressLine];
}
- (void)setRingColor:(UIColor *)tintColor {
if ([tintColor isEqual:self.ringColor]) {
return;
}
_ringColor = tintColor;
[(JGProgressHUDRingIndicatorLayer *)self.layer setRingColor:self.ringColor];
}
- (void)setRingBackgroundColor:(UIColor *)backgroundTintColor {
if ([backgroundTintColor isEqual:self.ringBackgroundColor]) {
return;
}
_ringBackgroundColor = backgroundTintColor;
[(JGProgressHUDRingIndicatorLayer *)self.layer setRingBackgroundColor:self.ringBackgroundColor];
}
- (void)setRingWidth:(CGFloat)ringWidth {
if (fequal(ringWidth, self.ringWidth)) {
return;
}
_ringWidth = ringWidth;
[(JGProgressHUDRingIndicatorLayer *)self.layer setRingWidth:self.ringWidth];
}
- (void)setProgress:(float)progress animated:(BOOL)animated {
if (fequal(self.progress, progress)) {
return;
}
[super setProgress:progress animated:animated];
[CATransaction begin];
[CATransaction setAnimationDuration:(animated ? 0.3 : 0.0)];
[(JGProgressHUDRingIndicatorLayer *)self.layer setProgress:self.progress];
[CATransaction commit];
}
#pragma mark - Overrides
- (void)setUpForHUDStyle:(JGProgressHUDStyle)style vibrancyEnabled:(BOOL)vibrancyEnabled {
[super setUpForHUDStyle:style vibrancyEnabled:vibrancyEnabled];
if (style == JGProgressHUDStyleDark) {
self.ringColor = [UIColor colorWithWhite:1.0 alpha:1.0];
self.ringBackgroundColor = [UIColor colorWithWhite:0.0 alpha:1.0];
}
else {
self.ringColor = [UIColor blackColor];
if (style == JGProgressHUDStyleLight) {
self.ringBackgroundColor = [UIColor colorWithWhite:0.85 alpha:1.0];
}
else {
self.ringBackgroundColor = [UIColor colorWithWhite:0.9 alpha:1.0];
}
}
}
+ (Class)layerClass {
return [JGProgressHUDRingIndicatorLayer class];
}
@end
@@ -1,37 +0,0 @@
//
// JGProgressHUDShadow.h
// JGProgressHUD
//
// Created by Jonas Gessner on 25.09.17.
// Copyright © 2017 Jonas Gessner. All rights reserved.
//
#import <UIKit/UIKit.h>
/**
A wrapper representing properties of a shadow.
*/
@interface JGProgressHUDShadow : NSObject
- (instancetype __nonnull)initWithColor:(UIColor *__nonnull)color offset:(CGSize)offset radius:(CGFloat)radius opacity:(float)opacity;
/** Convenience initializer. */
+ (instancetype __nonnull)shadowWithColor:(UIColor *__nonnull)color offset:(CGSize)offset radius:(CGFloat)radius opacity:(float)opacity;
/**
The color of the shadow. Colors created from patterns are currently NOT supported.
*/
@property (nonatomic, strong, readonly, nonnull) UIColor *color;
/** The shadow offset. */
@property (nonatomic, assign, readonly) CGSize offset;
/** The blur radius used to create the shadow. */
@property (nonatomic, assign, readonly) CGFloat radius;
/**
The opacity of the shadow. Specifying a value outside the [0,1] range will give undefined results.
*/
@property (nonatomic, assign, readonly) float opacity;
@end
@@ -1,30 +0,0 @@
//
// JGProgressHUDShadow.m
// JGProgressHUD
//
// Created by Jonas Gessner on 25.09.17.
// Copyright © 2017 Jonas Gessner. All rights reserved.
//
#import "JGProgressHUDShadow.h"
@implementation JGProgressHUDShadow
+ (instancetype)shadowWithColor:(UIColor *)color offset:(CGSize)offset radius:(CGFloat)radius opacity:(float)opacity {
return [[self alloc] initWithColor:color offset:offset radius:radius opacity:opacity];
}
- (instancetype)initWithColor:(UIColor *)color offset:(CGSize)offset radius:(CGFloat)radius opacity:(float)opacity {
self = [super init];
if (self) {
_color = color;
_offset = offset;
_radius = radius;
_opacity = opacity;
}
return self;
}
@end
@@ -1,24 +0,0 @@
//
// JGProgressHUDSuccessIndicatorView.h
// JGProgressHUD
//
// Created by Jonas Gessner on 19.08.14.
// Copyright (c) 2014 Jonas Gessner. All rights reserved.
//
#pragma clang diagnostic push
#pragma clang diagnostic ignored "-Wquoted-include-in-framework-header"
#import "JGProgressHUDImageIndicatorView.h"
#pragma clang diagnostic pop
/**
An image indicator showing a checkmark, representing a failed operation.
*/
@interface JGProgressHUDSuccessIndicatorView : JGProgressHUDImageIndicatorView
/**
Default initializer for this class.
*/
- (instancetype __nonnull)init;
@end
@@ -1,56 +0,0 @@
//
// JGProgressHUDSuccessIndicatorView.m
// JGProgressHUD
//
// Created by Jonas Gessner on 19.08.14.
// Copyright (c) 2014 Jonas Gessner. All rights reserved.
//
#import "JGProgressHUDSuccessIndicatorView.h"
#import "JGProgressHUD.h"
static UIBezierPath *successBezierPath() {
static UIBezierPath *path;
static dispatch_once_t onceToken;
dispatch_once(&onceToken, ^{
path = [UIBezierPath bezierPath];
[path moveToPoint:CGPointMake(1.5, 18)];
[path addLineToPoint:CGPointMake(11, 28)];
[path addLineToPoint:CGPointMake(31.5, 5.5)];
[path setLineWidth:3];
[path setLineJoinStyle:kCGLineJoinRound];
[path setLineCapStyle:kCGLineCapRound];
});
return path;
}
@implementation JGProgressHUDSuccessIndicatorView
- (instancetype)initWithContentView:(UIView *__unused)contentView {
UIBezierPath *path = successBezierPath();
UIGraphicsBeginImageContextWithOptions(CGSizeMake(33, 33), NO, 0.0);
[[UIColor blackColor] setStroke];
[path stroke];
UIImage *img = [UIGraphicsGetImageFromCurrentImageContext() imageWithRenderingMode:UIImageRenderingModeAlwaysTemplate];
UIGraphicsEndImageContext();
self = [super initWithImage:img];
return self;
}
- (instancetype)init {
return [self initWithContentView:nil];
}
- (void)updateAccessibility {
self.accessibilityLabel = NSLocalizedString(@"Success",);
}
@end
-264
View File
@@ -1,264 +0,0 @@
// Copyright (c) 2013, Facebook, Inc.
// All rights reserved.
// Redistribution and use in source and binary forms, with or without
// modification, are permitted provided that the following conditions are met:
// * Redistributions of source code must retain the above copyright notice,
// this list of conditions and the following disclaimer.
// * Redistributions in binary form must reproduce the above copyright notice,
// this list of conditions and the following disclaimer in the documentation
// and/or other materials provided with the distribution.
// * Neither the name Facebook nor the names of its contributors may be used to
// endorse or promote products derived from this software without specific
// prior written permission.
// THIS SOFTWARE IS PROVIDED BY THE COPYRIGHT HOLDERS AND CONTRIBUTORS "AS IS"
// AND ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE
// IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE ARE
// DISCLAIMED. IN NO EVENT SHALL THE COPYRIGHT HOLDER OR CONTRIBUTORS BE LIABLE
// FOR ANY DIRECT, INDIRECT, INCIDENTAL, SPECIAL, EXEMPLARY, OR CONSEQUENTIAL
// DAMAGES (INCLUDING, BUT NOT LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS OR
// SERVICES; LOSS OF USE, DATA, OR PROFITS; OR BUSINESS INTERRUPTION) HOWEVER
// CAUSED AND ON ANY THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT LIABILITY,
// OR TORT (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY OUT OF THE USE
// OF THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE.
#include "fishhook.h"
#include <dlfcn.h>
#include <stdbool.h>
#include <stdlib.h>
#include <string.h>
#include <sys/mman.h>
#include <sys/types.h>
#include <mach/mach.h>
#include <mach/vm_map.h>
#include <mach/vm_region.h>
#include <mach-o/dyld.h>
#include <mach-o/loader.h>
#include <mach-o/nlist.h>
#ifdef __LP64__
typedef struct mach_header_64 mach_header_t;
typedef struct segment_command_64 segment_command_t;
typedef struct section_64 section_t;
typedef struct nlist_64 nlist_t;
#define LC_SEGMENT_ARCH_DEPENDENT LC_SEGMENT_64
#else
typedef struct mach_header mach_header_t;
typedef struct segment_command segment_command_t;
typedef struct section section_t;
typedef struct nlist nlist_t;
#define LC_SEGMENT_ARCH_DEPENDENT LC_SEGMENT
#endif
#ifndef SEG_DATA_CONST
#define SEG_DATA_CONST "__DATA_CONST"
#endif
struct rebindings_entry {
struct rebinding *rebindings;
size_t rebindings_nel;
struct rebindings_entry *next;
};
static struct rebindings_entry *_rebindings_head;
static int prepend_rebindings(struct rebindings_entry **rebindings_head,
struct rebinding rebindings[],
size_t nel) {
struct rebindings_entry *new_entry = (struct rebindings_entry *) malloc(sizeof(struct rebindings_entry));
if (!new_entry) {
return -1;
}
new_entry->rebindings = (struct rebinding *) malloc(sizeof(struct rebinding) * nel);
if (!new_entry->rebindings) {
free(new_entry);
return -1;
}
memcpy(new_entry->rebindings, rebindings, sizeof(struct rebinding) * nel);
new_entry->rebindings_nel = nel;
new_entry->next = *rebindings_head;
*rebindings_head = new_entry;
return 0;
}
#if 0
static int get_protection(void *addr, vm_prot_t *prot, vm_prot_t *max_prot) {
mach_port_t task = mach_task_self();
vm_size_t size = 0;
vm_address_t address = (vm_address_t)addr;
memory_object_name_t object;
#ifdef __LP64__
mach_msg_type_number_t count = VM_REGION_BASIC_INFO_COUNT_64;
vm_region_basic_info_data_64_t info;
kern_return_t info_ret = vm_region_64(
task, &address, &size, VM_REGION_BASIC_INFO_64, (vm_region_info_64_t)&info, &count, &object);
#else
mach_msg_type_number_t count = VM_REGION_BASIC_INFO_COUNT;
vm_region_basic_info_data_t info;
kern_return_t info_ret = vm_region(task, &address, &size, VM_REGION_BASIC_INFO, (vm_region_info_t)&info, &count, &object);
#endif
if (info_ret == KERN_SUCCESS) {
if (prot != NULL)
*prot = info.protection;
if (max_prot != NULL)
*max_prot = info.max_protection;
return 0;
}
return -1;
}
#endif
static void perform_rebinding_with_section(struct rebindings_entry *rebindings,
section_t *section,
intptr_t slide,
nlist_t *symtab,
char *strtab,
uint32_t *indirect_symtab) {
uint32_t *indirect_symbol_indices = indirect_symtab + section->reserved1;
void **indirect_symbol_bindings = (void **)((uintptr_t)slide + section->addr);
for (uint i = 0; i < section->size / sizeof(void *); i++) {
uint32_t symtab_index = indirect_symbol_indices[i];
if (symtab_index == INDIRECT_SYMBOL_ABS || symtab_index == INDIRECT_SYMBOL_LOCAL ||
symtab_index == (INDIRECT_SYMBOL_LOCAL | INDIRECT_SYMBOL_ABS)) {
continue;
}
uint32_t strtab_offset = symtab[symtab_index].n_un.n_strx;
char *symbol_name = strtab + strtab_offset;
bool symbol_name_longer_than_1 = symbol_name[0] && symbol_name[1];
struct rebindings_entry *cur = rebindings;
while (cur) {
for (uint j = 0; j < cur->rebindings_nel; j++) {
if (symbol_name_longer_than_1 && strcmp(&symbol_name[1], cur->rebindings[j].name) == 0) {
kern_return_t err;
if (cur->rebindings[j].replaced != NULL && indirect_symbol_bindings[i] != cur->rebindings[j].replacement)
*(cur->rebindings[j].replaced) = indirect_symbol_bindings[i];
/**
* 1. Moved the vm protection modifying codes to here to reduce the
* changing scope.
* 2. Adding VM_PROT_WRITE mode unconditionally because vm_region
* API on some iOS/Mac reports mismatch vm protection attributes.
* -- Lianfu Hao Jun 16th, 2021
**/
err = vm_protect (mach_task_self (), (uintptr_t)indirect_symbol_bindings, section->size, 0, VM_PROT_READ | VM_PROT_WRITE | VM_PROT_COPY);
if (err == KERN_SUCCESS) {
/**
* Once we failed to change the vm protection, we
* MUST NOT continue the following write actions!
* iOS 15 has corrected the const segments prot.
* -- Lionfore Hao Jun 11th, 2021
**/
indirect_symbol_bindings[i] = cur->rebindings[j].replacement;
}
goto symbol_loop;
}
}
cur = cur->next;
}
symbol_loop:;
}
}
static void rebind_symbols_for_image(struct rebindings_entry *rebindings,
const struct mach_header *header,
intptr_t slide) {
Dl_info info;
if (dladdr(header, &info) == 0) {
return;
}
segment_command_t *cur_seg_cmd;
segment_command_t *linkedit_segment = NULL;
struct symtab_command* symtab_cmd = NULL;
struct dysymtab_command* dysymtab_cmd = NULL;
uintptr_t cur = (uintptr_t)header + sizeof(mach_header_t);
for (uint i = 0; i < header->ncmds; i++, cur += cur_seg_cmd->cmdsize) {
cur_seg_cmd = (segment_command_t *)cur;
if (cur_seg_cmd->cmd == LC_SEGMENT_ARCH_DEPENDENT) {
if (strcmp(cur_seg_cmd->segname, SEG_LINKEDIT) == 0) {
linkedit_segment = cur_seg_cmd;
}
} else if (cur_seg_cmd->cmd == LC_SYMTAB) {
symtab_cmd = (struct symtab_command*)cur_seg_cmd;
} else if (cur_seg_cmd->cmd == LC_DYSYMTAB) {
dysymtab_cmd = (struct dysymtab_command*)cur_seg_cmd;
}
}
if (!symtab_cmd || !dysymtab_cmd || !linkedit_segment ||
!dysymtab_cmd->nindirectsyms) {
return;
}
// Find base symbol/string table addresses
uintptr_t linkedit_base = (uintptr_t)slide + linkedit_segment->vmaddr - linkedit_segment->fileoff;
nlist_t *symtab = (nlist_t *)(linkedit_base + symtab_cmd->symoff);
char *strtab = (char *)(linkedit_base + symtab_cmd->stroff);
// Get indirect symbol table (array of uint32_t indices into symbol table)
uint32_t *indirect_symtab = (uint32_t *)(linkedit_base + dysymtab_cmd->indirectsymoff);
cur = (uintptr_t)header + sizeof(mach_header_t);
for (uint i = 0; i < header->ncmds; i++, cur += cur_seg_cmd->cmdsize) {
cur_seg_cmd = (segment_command_t *)cur;
if (cur_seg_cmd->cmd == LC_SEGMENT_ARCH_DEPENDENT) {
if (strcmp(cur_seg_cmd->segname, SEG_DATA) != 0 &&
strcmp(cur_seg_cmd->segname, SEG_DATA_CONST) != 0) {
continue;
}
for (uint j = 0; j < cur_seg_cmd->nsects; j++) {
section_t *sect =
(section_t *)(cur + sizeof(segment_command_t)) + j;
if ((sect->flags & SECTION_TYPE) == S_LAZY_SYMBOL_POINTERS) {
perform_rebinding_with_section(rebindings, sect, slide, symtab, strtab, indirect_symtab);
}
if ((sect->flags & SECTION_TYPE) == S_NON_LAZY_SYMBOL_POINTERS) {
perform_rebinding_with_section(rebindings, sect, slide, symtab, strtab, indirect_symtab);
}
}
}
}
}
static void _rebind_symbols_for_image(const struct mach_header *header,
intptr_t slide) {
rebind_symbols_for_image(_rebindings_head, header, slide);
}
int rebind_symbols_image(void *header,
intptr_t slide,
struct rebinding rebindings[],
size_t rebindings_nel) {
struct rebindings_entry *rebindings_head = NULL;
int retval = prepend_rebindings(&rebindings_head, rebindings, rebindings_nel);
rebind_symbols_for_image(rebindings_head, (const struct mach_header *) header, slide);
if (rebindings_head) {
free(rebindings_head->rebindings);
}
free(rebindings_head);
return retval;
}
int rebind_symbols(struct rebinding rebindings[], size_t rebindings_nel) {
int retval = prepend_rebindings(&_rebindings_head, rebindings, rebindings_nel);
if (retval < 0) {
return retval;
}
// If this was the first call, register callback for image additions (which is also invoked for
// existing images, otherwise, just run on existing images
if (!_rebindings_head->next) {
_dyld_register_func_for_add_image(_rebind_symbols_for_image);
} else {
uint32_t c = _dyld_image_count();
for (uint32_t i = 0; i < c; i++) {
_rebind_symbols_for_image(_dyld_get_image_header(i), _dyld_get_image_vmaddr_slide(i));
}
}
return retval;
}
-76
View File
@@ -1,76 +0,0 @@
// Copyright (c) 2013, Facebook, Inc.
// All rights reserved.
// Redistribution and use in source and binary forms, with or without
// modification, are permitted provided that the following conditions are met:
// * Redistributions of source code must retain the above copyright notice,
// this list of conditions and the following disclaimer.
// * Redistributions in binary form must reproduce the above copyright notice,
// this list of conditions and the following disclaimer in the documentation
// and/or other materials provided with the distribution.
// * Neither the name Facebook nor the names of its contributors may be used to
// endorse or promote products derived from this software without specific
// prior written permission.
// THIS SOFTWARE IS PROVIDED BY THE COPYRIGHT HOLDERS AND CONTRIBUTORS "AS IS"
// AND ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE
// IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE ARE
// DISCLAIMED. IN NO EVENT SHALL THE COPYRIGHT HOLDER OR CONTRIBUTORS BE LIABLE
// FOR ANY DIRECT, INDIRECT, INCIDENTAL, SPECIAL, EXEMPLARY, OR CONSEQUENTIAL
// DAMAGES (INCLUDING, BUT NOT LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS OR
// SERVICES; LOSS OF USE, DATA, OR PROFITS; OR BUSINESS INTERRUPTION) HOWEVER
// CAUSED AND ON ANY THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT LIABILITY,
// OR TORT (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY OUT OF THE USE
// OF THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE.
#ifndef fishhook_h
#define fishhook_h
#include <stddef.h>
#include <stdint.h>
#if !defined(FISHHOOK_EXPORT)
#define FISHHOOK_VISIBILITY __attribute__((visibility("hidden")))
#else
#define FISHHOOK_VISIBILITY __attribute__((visibility("default")))
#endif
#ifdef __cplusplus
extern "C" {
#endif //__cplusplus
/*
* A structure representing a particular intended rebinding from a symbol
* name to its replacement
*/
struct rebinding {
const char *name;
void *replacement;
void **replaced;
};
/*
* For each rebinding in rebindings, rebinds references to external, indirect
* symbols with the specified name to instead point at replacement for each
* image in the calling process as well as for all future images that are loaded
* by the process. If rebind_functions is called more than once, the symbols to
* rebind are added to the existing list of rebindings, and if a given symbol
* is rebound more than once, the later rebinding will take precedence.
*/
FISHHOOK_VISIBILITY
int rebind_symbols(struct rebinding rebindings[], size_t rebindings_nel);
/*
* Rebinds as above, but only in the specified image. The header should point
* to the mach-o header, the slide should be the slide offset. Others as above.
*/
FISHHOOK_VISIBILITY
int rebind_symbols_image(void *header,
intptr_t slide,
struct rebinding rebindings[],
size_t rebindings_nel);
#ifdef __cplusplus
}
#endif //__cplusplus
#endif //fishhook_h
-12
View File
@@ -1,12 +0,0 @@
TARGET := iphone:clang:16.2:14.0
ARCHS := arm64
include $(THEOS)/makefiles/common.mk
TWEAK_NAME := zxPluginsInject
$(TWEAK_NAME)_FILES := $(shell find src -type f -name "*.*m") ../fishhook/fishhook.c
$(TWEAK_NAME)_CFLAGS := -fobjc-arc -Os
$(TWEAK_NAME)_LOGOS_DEFAULT_GENERATOR := internal
include $(THEOS_MAKE_PATH)/tweak.mk
-15
View File
@@ -1,15 +0,0 @@
#import <Foundation/Foundation.h>
extern NSString *accessGroupId;
extern NSString *bundleId;
extern void rebindSecFuncs();
extern BOOL createDirectoryIfNotExists(NSString *path);
extern NSURL *getAppGroupPathIfExists();
@interface LSBundleProxy: NSObject
@property(nonatomic, assign, readonly) NSDictionary *entitlements;
@property(nonatomic, assign, readonly) NSDictionary *groupContainerURLs;
+ (instancetype)bundleProxyForCurrentProcess;
@end
-38
View File
@@ -1,38 +0,0 @@
#import <objc/runtime.h>
#import "Header.h"
BOOL createDirectoryIfNotExists(NSString *path) {
NSFileManager *fileManager = [NSFileManager defaultManager];
if ([fileManager fileExistsAtPath:path]) return YES;
NSError *error = nil;
[fileManager createDirectoryAtPath:path
withIntermediateDirectories:YES
attributes:nil
error:&error];
return error == nil;
}
NSURL *getAppGroupPathIfExists() {
static NSURL *cachedAppGroupPath = nil;
static dispatch_once_t onceToken;
dispatch_once(&onceToken, ^{
LSBundleProxy *bundleProxy = [objc_getClass("LSBundleProxy") bundleProxyForCurrentProcess];
if (!bundleProxy) return;
NSDictionary *entitlements = bundleProxy.entitlements;
if (![entitlements isKindOfClass:[NSDictionary class]]) return;
NSArray *appGroups = entitlements[@"com.apple.security.application-groups"];
if (appGroups.count == 0) return;
NSDictionary *appGroupsPaths = bundleProxy.groupContainerURLs;
if (![appGroupsPaths isKindOfClass:[NSDictionary class]]) return;
cachedAppGroupPath = appGroupsPaths[[appGroups firstObject]];
});
return cachedAppGroupPath;
}
-43
View File
@@ -1,43 +0,0 @@
#import <Security/Security.h>
#import "Header.h"
#import "../../fishhook/fishhook.h"
static OSStatus (*origSecItemAdd)(CFDictionaryRef attributes, CFTypeRef *result);
static OSStatus (*origSecItemCopyMatching)(CFDictionaryRef query, CFTypeRef *result);
static OSStatus (*origSecItemUpdate)(CFDictionaryRef query, CFDictionaryRef attributesToUpdate);
static OSStatus (*origSecItemDelete)(CFDictionaryRef query);
static OSStatus zxSecItemAdd(CFDictionaryRef attributes, CFTypeRef *result) {
NSMutableDictionary *mutableAttributes = [(__bridge NSDictionary *)attributes mutableCopy];
mutableAttributes[(__bridge NSString *)kSecAttrAccessGroup] = accessGroupId;
return origSecItemAdd((__bridge CFDictionaryRef)mutableAttributes, result);
}
static OSStatus zxSecItemCopyMatching(CFDictionaryRef query, CFTypeRef *result) {
NSMutableDictionary *mutableQuery = [(__bridge NSDictionary *)query mutableCopy];
mutableQuery[(__bridge NSString *)kSecAttrAccessGroup] = accessGroupId;
return origSecItemCopyMatching((__bridge CFDictionaryRef)mutableQuery, result);
}
static OSStatus zxSecItemUpdate(CFDictionaryRef query, CFDictionaryRef attributesToUpdate) {
NSMutableDictionary *mutableQuery = [(__bridge NSDictionary *)query mutableCopy];
mutableQuery[(__bridge NSString *)kSecAttrAccessGroup] = accessGroupId;
return origSecItemUpdate((__bridge CFDictionaryRef)mutableQuery, attributesToUpdate);
}
static OSStatus zxSecItemDelete(CFDictionaryRef query) {
NSMutableDictionary *mutableQuery = [(__bridge NSDictionary *)query mutableCopy];
mutableQuery[(__bridge NSString *)kSecAttrAccessGroup] = accessGroupId;
return origSecItemDelete((__bridge CFDictionaryRef)mutableQuery);
}
void rebindSecFuncs() {
struct rebinding rebinds[4] = {
{"SecItemAdd", (void *)zxSecItemAdd, (void **)&origSecItemAdd},
{"SecItemCopyMatching", (void *)zxSecItemCopyMatching, (void **)&origSecItemCopyMatching},
{"SecItemUpdate", (void *)zxSecItemUpdate, (void **)&origSecItemUpdate},
{"SecItemDelete", (void *)zxSecItemDelete, (void **)&origSecItemDelete}
};
rebind_symbols(rebinds, 4);
}
@@ -1,57 +0,0 @@
#import "Header.h"
%hook CKContainer
- (id)_setupWithContainerID:(id)a options:(id)b { return nil; }
- (id)_initWithContainerIdentifier:(id)a { return nil; }
%end
%hook CKEntitlements
- (id)initWithEntitlementsDict:(NSDictionary *)entitlements {
NSMutableDictionary *mutEntitlements = [entitlements mutableCopy];
[mutEntitlements removeObjectForKey:@"com.apple.developer.icloud-container-environment"];
[mutEntitlements removeObjectForKey:@"com.apple.developer.icloud-services"];
return %orig([mutEntitlements copy]);
}
%end
%hook NSFileManager
- (NSURL *)containerURLForSecurityApplicationGroupIdentifier:(NSString *)groupIdentifier {
if (NSURL *ourAppGroupURL = getAppGroupPathIfExists()) {
NSURL *fakeAppGroupURL = [ourAppGroupURL URLByAppendingPathComponent:groupIdentifier];
createDirectoryIfNotExists(fakeAppGroupURL.path);
return fakeAppGroupURL;
}
NSArray *paths = NSSearchPathForDirectoriesInDomains(NSDocumentDirectory, NSUserDomainMask, YES);
NSString *fakePath = [[paths lastObject] stringByAppendingPathComponent:groupIdentifier];
createDirectoryIfNotExists(fakePath);
return [NSURL fileURLWithPath:fakePath];
}
%end
// Scoped to app-extension processes only. Appex needs the suite redirect so
// it reads the group.* defaults the main app wrote (rich push previews depend
// on it). Applying it in the main process breaks UI-dismiss flag persistence
// on IG 423+ (Friends Map "Not now" reappears every launch).
static BOOL sciIsAppExtensionProcess(void) {
static BOOL cached = NO;
static dispatch_once_t token;
dispatch_once(&token, ^{
cached = ([[NSBundle mainBundle] infoDictionary][@"NSExtension"] != nil);
});
return cached;
}
%hook NSUserDefaults
- (id)_initWithSuiteName:(NSString *)suiteName container:(NSURL *)container {
if (!sciIsAppExtensionProcess()) return %orig(suiteName, container);
NSURL *appGroupURL = getAppGroupPathIfExists();
if (!appGroupURL || ![suiteName hasPrefix:@"group"]) return %orig(suiteName, container);
if (NSURL *customContainerURL = [appGroupURL URLByAppendingPathComponent:suiteName]) {
return %orig(suiteName, customContainerURL);
}
return %orig(suiteName, container);
}
%end
@@ -1,29 +0,0 @@
#import "Header.h"
NSString *accessGroupId;
NSString *bundleId;
static void setRequiredIDs() {
NSDictionary *query = @{
(__bridge NSString *)kSecClass: (__bridge NSString *)kSecClassGenericPassword,
(__bridge NSString *)kSecAttrAccount: @"zxPluginsInjectGenericEntry",
(__bridge NSString *)kSecAttrService: @"",
(__bridge id)kSecReturnAttributes: (id)kCFBooleanTrue
};
CFDictionaryRef result = nil;
OSStatus status = SecItemCopyMatching((__bridge CFDictionaryRef)query, (CFTypeRef *)&result);
if (status == errSecItemNotFound) {
status = SecItemAdd((__bridge CFDictionaryRef)query, (CFTypeRef *)&result);
}
if (status != errSecSuccess) return;
bundleId = [[NSBundle mainBundle] bundleIdentifier];
accessGroupId = [(__bridge NSDictionary *)result objectForKey:(__bridge NSString *)kSecAttrAccessGroup];
if (result) CFRelease(result);
}
__attribute__((constructor)) static void init() {
setRequiredIDs();
rebindSecFuncs();
}
-53
View File
@@ -1,53 +0,0 @@
#!/bin/bash
# Downloads pre-built FFmpegKit frameworks for iOS arm64.
# Called by build.sh before compilation if modules/ffmpegkit/ is empty.
set -e
DEST="$(dirname "$0")/../modules/ffmpegkit"
MARKER="$DEST/.fetched"
# Skip if already fetched
if [ -f "$MARKER" ]; then
echo "[ffmpegkit] Already fetched, skipping."
exit 0
fi
# FFmpegKit 6.0 LTS — min-gpl variant (smallest, has x264)
VERSION="6.0"
VARIANT="min-gpl"
URL="https://github.com/arthenica/ffmpeg-kit/releases/download/v${VERSION}/ffmpeg-kit-${VARIANT}-${VERSION}-ios-xcframework.zip"
echo "[ffmpegkit] Downloading FFmpegKit ${VERSION} (${VARIANT})..."
TMPZIP=$(mktemp /tmp/ffmpegkit-XXXXXX.zip)
curl -L -o "$TMPZIP" "$URL"
echo "[ffmpegkit] Extracting..."
TMPDIR=$(mktemp -d /tmp/ffmpegkit-extract-XXXXXX)
unzip -q "$TMPZIP" -d "$TMPDIR"
# XCFrameworks contain ios-arm64 slices — extract the .framework from each
echo "[ffmpegkit] Installing frameworks..."
for xcfw in "$TMPDIR"/*.xcframework; do
NAME=$(basename "$xcfw" .xcframework)
# Find the ios-arm64 framework slice
ARM64_DIR=$(find "$xcfw" -type d -name "ios-arm64" -o -name "ios-arm64_armv7" 2>/dev/null | head -1)
if [ -z "$ARM64_DIR" ]; then
# Try the plain ios directory
ARM64_DIR=$(find "$xcfw" -type d -name "*.framework" | head -1)
ARM64_DIR=$(dirname "$ARM64_DIR")
fi
if [ -d "$ARM64_DIR/${NAME}.framework" ]; then
cp -R "$ARM64_DIR/${NAME}.framework" "$DEST/"
echo " + ${NAME}.framework"
else
echo " ! ${NAME}.framework not found in xcframework"
fi
done
# Cleanup
rm -rf "$TMPZIP" "$TMPDIR"
touch "$MARKER"
echo "[ffmpegkit] Done. Frameworks installed to modules/ffmpegkit/"
-36
View File
@@ -1,36 +0,0 @@
#!/bin/bash
# Downloads FFmpegKit xcframeworks and extracts arm64 device frameworks.
# Output: modules/ffmpegkit/{ffmpegkit,libav*,libsw*}.framework/
set -e
DEST="$(cd "$(dirname "$0")/.." && pwd)/modules/ffmpegkit"
URL="https://github.com/luthviar/ffmpeg-kit-ios-full/releases/download/6.0/ffmpeg-kit-ios-full.zip"
mkdir -p "$DEST"
# Already set up?
if [ -f "$DEST/ffmpegkit.framework/ffmpegkit" ]; then
echo "[ffmpegkit] Already present, skipping."
exit 0
fi
echo "[ffmpegkit] Downloading ffmpeg-kit-ios-full..."
TMPDIR=$(mktemp -d)
curl -L -o "$TMPDIR/ffmpegkit.zip" "$URL"
echo "[ffmpegkit] Extracting arm64 device frameworks..."
unzip -q "$TMPDIR/ffmpegkit.zip" -d "$TMPDIR"
# Copy the ios-arm64 slice from each xcframework
for xcfw in "$TMPDIR"/ffmpeg-kit-ios-full/*.xcframework; do
NAME=$(basename "$xcfw" .xcframework)
ARM64="$xcfw/ios-arm64/$NAME.framework"
if [ -d "$ARM64" ]; then
cp -R "$ARM64" "$DEST/"
echo "[ffmpegkit] $NAME.framework"
fi
done
rm -rf "$TMPDIR"
echo "[ffmpegkit] Done — $(ls -d "$DEST"/*.framework | wc -l | tr -d ' ') frameworks installed."
-37
View File
@@ -1,37 +0,0 @@
// SCIActionButton — wires a UIButton to the RyukGram action menu system.
// Tap fires the default action; long-press opens the full context menu.
#import <UIKit/UIKit.h>
#import "SCIMediaActions.h"
NS_ASSUME_NONNULL_BEGIN
typedef id _Nullable (^SCIActionMediaProvider)(UIView *sourceView);
@interface SCIActionButton : NSObject
/// Key for an optional dismiss callback block (void(^)(void)) stored on
/// the button via objc_setAssociatedObject. Called when the context menu
/// or UIMenu dismisses. Used by stories to resume playback.
extern const void *kSCIDismissKey;
/// Configure an existing UIButton with RyukGram action-menu behavior.
///
/// `prefKey` is the NSUserDefaults key storing the default-tap choice
/// (one of `menu`, `expand`, `download_share`, `download_photos`).
+ (void)configureButton:(UIButton *)button
context:(SCIActionContext)ctx
prefKey:(NSString *)prefKey
mediaProvider:(SCIActionMediaProvider)provider;
/// Build the deferred UIMenu for a given context + provider. Exposed so
/// callers that already have their own UIButton wiring can reuse just the
/// menu construction.
+ (UIMenu *)deferredMenuForContext:(SCIActionContext)ctx
fromView:(UIView *)sourceView
mediaProvider:(SCIActionMediaProvider)provider;
@end
NS_ASSUME_NONNULL_END
-181
View File
@@ -1,181 +0,0 @@
#import "SCIActionButton.h"
#import "SCIActionMenu.h"
#import "SCIRepostSheet.h"
#import "../Utils.h"
#import <objc/runtime.h>
// Associated-object keys for per-button config.
static const void *kSCICtxKey = &kSCICtxKey;
static const void *kSCIProviderKey = &kSCIProviderKey;
static const void *kSCIPrefKey = &kSCIPrefKey;
const void *kSCIDismissKey = &kSCIDismissKey;
@interface SCIActionButton () <UIContextMenuInteractionDelegate>
@end
@implementation SCIActionButton
// Singleton delegate for UIContextMenuInteraction.
+ (instancetype)shared {
static SCIActionButton *s;
static dispatch_once_t once;
dispatch_once(&once, ^{ s = [SCIActionButton new]; });
return s;
}
+ (UIMenu *)deferredMenuForContext:(SCIActionContext)ctx
fromView:(UIView *)sourceView
mediaProvider:(SCIActionMediaProvider)provider {
__weak UIView *weakSource = sourceView;
SCIActionMediaProvider capturedProvider = [provider copy];
UIDeferredMenuElement *deferred = [UIDeferredMenuElement
elementWithUncachedProvider:^(void (^completion)(NSArray<UIMenuElement *> * _Nonnull)) {
UIView *view = weakSource;
id media = (view && capturedProvider) ? capturedProvider(view) : nil;
NSArray *actions = [SCIMediaActions actionsForContext:ctx
media:media
fromView:view];
UIMenu *built = [SCIActionMenu buildMenuWithActions:actions];
completion(built.children);
}];
return [UIMenu menuWithTitle:@""
image:nil
identifier:nil
options:0
children:@[deferred]];
}
+ (void)configureButton:(UIButton *)button
context:(SCIActionContext)ctx
prefKey:(NSString *)prefKey
mediaProvider:(SCIActionMediaProvider)provider {
if (!button) return;
// Stash config on the button.
objc_setAssociatedObject(button, kSCICtxKey, @(ctx), OBJC_ASSOCIATION_RETAIN_NONATOMIC);
objc_setAssociatedObject(button, kSCIProviderKey, [provider copy], OBJC_ASSOCIATION_COPY_NONATOMIC);
objc_setAssociatedObject(button, kSCIPrefKey, [prefKey copy], OBJC_ASSOCIATION_COPY_NONATOMIC);
// Read default tap mode fresh.
NSString *defaultTap = [SCIUtils getStringPref:prefKey];
if (!defaultTap.length) defaultTap = @"menu";
// Remove previous wiring to stay idempotent.
[button removeTarget:nil action:NULL forControlEvents:UIControlEventTouchUpInside];
for (id<UIInteraction> it in [button.interactions copy]) {
if ([(id)it isKindOfClass:[UIContextMenuInteraction class]]) {
[button removeInteraction:it];
}
}
if ([defaultTap isEqualToString:@"menu"]) {
// Tap opens menu natively.
button.menu = [self deferredMenuForContext:ctx fromView:button mediaProvider:provider];
button.showsMenuAsPrimaryAction = YES;
return;
}
// Tap fires dedicated action; long-press opens menu.
button.showsMenuAsPrimaryAction = NO;
button.menu = nil;
[button addTarget:[self shared]
action:@selector(sciTapHandler:)
forControlEvents:UIControlEventTouchUpInside];
UIContextMenuInteraction *interaction =
[[UIContextMenuInteraction alloc] initWithDelegate:[self shared]];
[button addInteraction:interaction];
}
// Haptic + scale-bounce feedback.
+ (void)bounceButton:(UIView *)view {
UIImpactFeedbackGenerator *haptic =
[[UIImpactFeedbackGenerator alloc] initWithStyle:UIImpactFeedbackStyleMedium];
[haptic impactOccurred];
[UIView animateWithDuration:0.1
animations:^{ view.transform = CGAffineTransformMakeScale(0.82, 0.82); }
completion:^(BOOL _) {
[UIView animateWithDuration:0.1 animations:^{
view.transform = CGAffineTransformIdentity;
}];
}];
}
// Default-tap handler.
- (void)sciTapHandler:(UIButton *)sender {
[SCIActionButton bounceButton:sender];
NSNumber *ctxNum = objc_getAssociatedObject(sender, kSCICtxKey);
SCIActionMediaProvider provider = objc_getAssociatedObject(sender, kSCIProviderKey);
NSString *prefKey = objc_getAssociatedObject(sender, kSCIPrefKey);
if (!ctxNum || !provider) return;
NSString *tap = [SCIUtils getStringPref:prefKey];
if (!tap.length) tap = @"menu";
id media = provider(sender);
if (media == (id)kCFNull) return;
SCIActionContext tapCtx = (SCIActionContext)ctxNum.integerValue;
NSString *tapCtxLabel = [SCIMediaActions contextLabelForContext:tapCtx];
if ([tap isEqualToString:@"expand"]) {
[SCIMediaActions expandMedia:media fromView:sender caption:nil];
} else if ([tap isEqualToString:@"download_share"]) {
[SCIMediaActions setCurrentFilenameStem:[SCIMediaActions filenameStemForMedia:media contextLabel:tapCtxLabel]];
[SCIMediaActions downloadAndShareMedia:media];
} else if ([tap isEqualToString:@"download_photos"]) {
[SCIMediaActions setCurrentFilenameStem:[SCIMediaActions filenameStemForMedia:media contextLabel:tapCtxLabel]];
[SCIMediaActions downloadAndSaveMedia:media];
} else if ([tap isEqualToString:@"copy_link"]) {
[SCIMediaActions copyURLForMedia:media];
} else if ([tap isEqualToString:@"repost"]) {
NSURL *vidURL = [SCIUtils getVideoUrlForMedia:(id)media];
NSURL *imgURL = [SCIUtils getPhotoUrlForMedia:(id)media];
[SCIRepostSheet repostWithVideoURL:vidURL photoURL:imgURL];
} else if ([tap isEqualToString:@"view_mentions"]) {
UIViewController *host = [SCIUtils nearestViewControllerForView:sender];
if (host) {
extern void sciShowStoryMentions(UIViewController *, UIView *);
sciShowStoryMentions(host, sender);
}
}
}
// MARK: - UIContextMenuInteractionDelegate
- (UIContextMenuConfiguration *)contextMenuInteraction:(UIContextMenuInteraction *)interaction
configurationForMenuAtLocation:(CGPoint)location {
UIView *view = interaction.view;
NSNumber *ctxNum = objc_getAssociatedObject(view, kSCICtxKey);
SCIActionMediaProvider provider = objc_getAssociatedObject(view, kSCIProviderKey);
if (!ctxNum || !provider) return nil;
SCIActionContext ctx = (SCIActionContext)ctxNum.integerValue;
return [UIContextMenuConfiguration
configurationWithIdentifier:nil
previewProvider:nil
actionProvider:^UIMenu * _Nullable(NSArray<UIMenuElement *> * _Nonnull suggested) {
return [SCIActionButton deferredMenuForContext:ctx
fromView:view
mediaProvider:provider];
}];
}
- (void)contextMenuInteraction:(UIContextMenuInteraction *)interaction
willEndForConfiguration:(UIContextMenuConfiguration *)configuration
animator:(id<UIContextMenuInteractionAnimating>)animator {
UIView *view = interaction.view;
void (^dismiss)(void) = objc_getAssociatedObject(view, kSCIDismissKey);
if (dismiss) {
if (animator) {
[animator addCompletion:^{ dismiss(); }];
} else {
dismiss();
}
}
}
@end
-48
View File
@@ -1,48 +0,0 @@
// SCIActionMenu — reusable action menu model + UIMenu builder.
#import <UIKit/UIKit.h>
NS_ASSUME_NONNULL_BEGIN
/// One menu entry. Either a leaf (has handler) or a submenu (has children).
@interface SCIAction : NSObject
@property (nonatomic, copy, readonly) NSString *title;
@property (nonatomic, copy, readonly, nullable) NSString *subtitle;
@property (nonatomic, copy, readonly, nullable) NSString *systemIconName;
@property (nonatomic, copy, readonly, nullable) void (^handler)(void);
@property (nonatomic, copy, readonly, nullable) NSArray<SCIAction *> *children;
@property (nonatomic, assign, readonly) BOOL destructive;
@property (nonatomic, assign, readonly) BOOL isSeparator;
+ (instancetype)actionWithTitle:(NSString *)title
icon:(nullable NSString *)icon
handler:(void(^)(void))handler;
+ (instancetype)actionWithTitle:(NSString *)title
subtitle:(nullable NSString *)subtitle
icon:(nullable NSString *)icon
destructive:(BOOL)destructive
handler:(void(^)(void))handler;
+ (instancetype)actionWithTitle:(NSString *)title
icon:(nullable NSString *)icon
children:(NSArray<SCIAction *> *)children;
/// A visual group break. Rendered as an inline submenu divider in UIMenu.
+ (instancetype)separator;
@end
@interface SCIActionMenu : NSObject
/// Build a UIMenu from an array of SCIAction. Consecutive actions between
/// `separator` markers are grouped into inline submenus so they render as
/// divided sections (standard iOS menu aesthetic).
+ (UIMenu *)buildMenuWithActions:(NSArray<SCIAction *> *)actions;
/// Build a UIMenu with a header title shown at the top of the menu.
+ (UIMenu *)buildMenuWithActions:(NSArray<SCIAction *> *)actions title:(nullable NSString *)title;
@end
NS_ASSUME_NONNULL_END
-132
View File
@@ -1,132 +0,0 @@
#import "SCIActionMenu.h"
#pragma mark - SCIAction
@interface SCIAction ()
@property (nonatomic, copy, readwrite) NSString *title;
@property (nonatomic, copy, readwrite, nullable) NSString *subtitle;
@property (nonatomic, copy, readwrite, nullable) NSString *systemIconName;
@property (nonatomic, copy, readwrite, nullable) void (^handler)(void);
@property (nonatomic, copy, readwrite, nullable) NSArray<SCIAction *> *children;
@property (nonatomic, assign, readwrite) BOOL destructive;
@property (nonatomic, assign, readwrite) BOOL isSeparator;
@end
@implementation SCIAction
+ (instancetype)actionWithTitle:(NSString *)title
icon:(NSString *)icon
handler:(void(^)(void))handler {
return [self actionWithTitle:title subtitle:nil icon:icon destructive:NO handler:handler];
}
+ (instancetype)actionWithTitle:(NSString *)title
subtitle:(NSString *)subtitle
icon:(NSString *)icon
destructive:(BOOL)destructive
handler:(void(^)(void))handler {
SCIAction *a = [SCIAction new];
a.title = title ?: @"";
a.subtitle = subtitle;
a.systemIconName = icon;
a.handler = handler;
a.destructive = destructive;
return a;
}
+ (instancetype)actionWithTitle:(NSString *)title
icon:(NSString *)icon
children:(NSArray<SCIAction *> *)children {
SCIAction *a = [SCIAction new];
a.title = title ?: @"";
a.systemIconName = icon;
a.children = [children copy];
return a;
}
+ (instancetype)separator {
SCIAction *a = [SCIAction new];
a.isSeparator = YES;
return a;
}
@end
#pragma mark - SCIActionMenu
@implementation SCIActionMenu
+ (UIImage *)imageForIcon:(NSString *)name {
if (!name.length) return nil;
UIImageSymbolConfiguration *cfg = [UIImageSymbolConfiguration configurationWithPointSize:16 weight:UIImageSymbolWeightRegular];
return [UIImage systemImageNamed:name withConfiguration:cfg];
}
// Convert SCIAction to UIMenuElement.
+ (UIMenuElement *)elementForAction:(SCIAction *)action {
if (action.children.count) {
NSMutableArray<UIMenuElement *> *kids = [NSMutableArray arrayWithCapacity:action.children.count];
for (SCIAction *child in action.children) {
UIMenuElement *el = [self elementForAction:child];
if (el) [kids addObject:el];
}
return [UIMenu menuWithTitle:action.title
image:[self imageForIcon:action.systemIconName]
identifier:nil
options:0
children:kids];
}
UIAction *ua = [UIAction actionWithTitle:action.title
image:[self imageForIcon:action.systemIconName]
identifier:nil
handler:^(__kindof UIAction * _Nonnull a) {
if (action.handler) action.handler();
}];
if (@available(iOS 15.0, *)) {
if (action.subtitle.length) ua.subtitle = action.subtitle;
}
if (action.destructive) ua.attributes = UIMenuElementAttributesDestructive;
return ua;
}
+ (UIMenu *)buildMenuWithActions:(NSArray<SCIAction *> *)actions {
return [self buildMenuWithActions:actions title:nil];
}
+ (UIMenu *)buildMenuWithActions:(NSArray<SCIAction *> *)actions title:(NSString *)title {
// Group actions between separators into inline submenus.
NSMutableArray<UIMenuElement *> *top = [NSMutableArray array];
NSMutableArray<UIMenuElement *> *currentGroup = [NSMutableArray array];
void (^flush)(void) = ^{
if (currentGroup.count == 0) return;
UIMenu *group = [UIMenu menuWithTitle:@""
image:nil
identifier:nil
options:UIMenuOptionsDisplayInline
children:[currentGroup copy]];
[top addObject:group];
[currentGroup removeAllObjects];
};
for (SCIAction *a in actions) {
if (a.isSeparator) {
flush();
continue;
}
UIMenuElement *el = [self elementForAction:a];
if (el) [currentGroup addObject:el];
}
flush();
return [UIMenu menuWithTitle:title ?: @""
image:nil
identifier:nil
options:0
children:[top copy]];
}
@end
-121
View File
@@ -1,121 +0,0 @@
// SCIMediaActions — shared media extraction + action handlers for the action menu.
#import <UIKit/UIKit.h>
#import "../InstagramHeaders.h"
#import "../Downloader/Download.h"
#import "SCIActionMenu.h"
NS_ASSUME_NONNULL_BEGIN
/// Where the action is being invoked from. Used to target settings entries
/// and to pick context-specific language in HUDs.
typedef NS_ENUM(NSInteger, SCIActionContext) {
SCIActionContextFeed,
SCIActionContextReels,
SCIActionContextStories,
};
@interface SCIMediaActions : NSObject
// MARK: - Filename naming
// `@username_context_yyyyMMdd_HHmmss` (sanitized). UUID fallback on failure.
+ (NSString *)filenameStemForMedia:(nullable id)media contextLabel:(NSString *)ctxLabel;
// "feed" / "reels" / "stories".
+ (NSString *)contextLabelForContext:(SCIActionContext)ctx;
// Stem read by the download + mux write sites to name output files.
+ (nullable NSString *)currentFilenameStem;
+ (void)setCurrentFilenameStem:(nullable NSString *)stem;
// MARK: - Media extraction
/// Return the post's caption string. Tries selectors first, falls back to
/// reading `_fieldCache[@"caption"][@"text"]`.
+ (nullable NSString *)captionForMedia:(id)media;
/// YES if the media is a carousel (multi-photo/video sidecar).
+ (BOOL)isCarouselMedia:(id)media;
/// Ordered children of a carousel IGMedia. Empty array for non-carousels.
+ (NSArray *)carouselChildrenForMedia:(id)media;
/// YES if the media has an audio track (`has_audio` fieldCache == 1).
+ (BOOL)mediaHasAudio:(id)media;
/// Download the raw photo URL, skipping any video route.
+ (void)downloadPhotoOnlyForMedia:(id)media action:(DownloadAction)action;
/// Extract the audio-only track from the DASH manifest via FFmpeg. Photos
/// library can't hold audio, so both actions end at the share sheet.
+ (void)downloadAudioOnlyForMedia:(id)media action:(DownloadAction)action;
/// Best URL for a single (non-carousel) media item. Prefers video URL, falls
/// back to photo URL. Returns nil if nothing extractable.
+ (nullable NSURL *)bestURLForMedia:(id)media;
/// Cover/poster image URL for a video-type media (first frame). Works for
/// reels, feed videos, and story videos.
+ (nullable NSURL *)coverURLForMedia:(id)media;
// MARK: - Primary actions (each directly triggerable from a menu entry)
/// Present the media in the native QLPreview UI. Video URLs download first,
/// images preview directly. Optional caption is shown as a subtitle.
+ (void)expandMedia:(id)media
fromView:(UIView *)sourceView
caption:(nullable NSString *)caption;
/// Download the best URL for the media and hand off via share sheet.
+ (void)downloadAndShareMedia:(id)media;
/// Download the best URL for the media and save to Photos (respects album pref).
+ (void)downloadAndSaveMedia:(id)media;
/// Copy the direct CDN URL for the media to the clipboard.
+ (void)copyURLForMedia:(id)media;
/// Copy the post caption to the clipboard.
+ (void)copyCaptionForMedia:(id)media;
/// Trigger Instagram's native repost flow for the given context's currently
/// visible UFI bar. Uses the existing button ivars to avoid reimplementing.
+ (void)triggerRepostForContext:(SCIActionContext)ctx sourceView:(UIView *)sourceView;
/// Open the RyukGram settings page for the given context.
+ (void)openSettingsForContext:(SCIActionContext)ctx fromView:(UIView *)sourceView;
// MARK: - Carousel bulk actions
/// Download every child of a carousel and share as a batch.
+ (void)downloadAllAndShareMedia:(id)carouselMedia;
/// Download every child of a carousel and save to Photos.
+ (void)downloadAllAndSaveMedia:(id)carouselMedia;
/// Copy newline-joined CDN URLs for every child of a carousel.
+ (void)copyAllURLsForMedia:(id)carouselMedia;
// MARK: - Menu builders
// MARK: - Bulk URL download helpers
/// Download an array of URLs in parallel, show pill, call done with file URLs.
+ (void)bulkDownloadURLs:(NSArray<NSURL *> *)urls
title:(NSString *)title
done:(void(^)(NSArray<NSURL *> *fileURLs))done;
/// Save an array of local file URLs to Photos (sequential, respects album pref).
+ (void)bulkSaveFiles:(NSArray<NSURL *> *)files;
/// Build the full action menu for the given context + media + default tap.
/// If `defaultTap` is provided and non-menu, the builder may reorder or skip
/// its matching leaf so it's visible in the full menu.
+ (NSArray<SCIAction *> *)actionsForContext:(SCIActionContext)ctx
media:(nullable id)media
fromView:(UIView *)sourceView;
@end
NS_ASSUME_NONNULL_END
File diff suppressed because it is too large Load Diff
-24
View File
@@ -1,24 +0,0 @@
// SCIMediaViewer — full-screen media viewer. Supports single items and carousels.
#import <UIKit/UIKit.h>
/// One media item to display.
@interface SCIMediaViewerItem : NSObject
@property (nonatomic, strong) NSURL *videoURL; // nil for photos
@property (nonatomic, strong) NSURL *photoURL; // nil for videos
@property (nonatomic, copy) NSString *caption;
+ (instancetype)itemWithVideoURL:(NSURL *)videoURL photoURL:(NSURL *)photoURL caption:(NSString *)caption;
@end
@interface SCIMediaViewer : NSObject
/// Show a single media item.
+ (void)showItem:(SCIMediaViewerItem *)item;
/// Show multiple items (carousel). Starts at the given index.
+ (void)showItems:(NSArray<SCIMediaViewerItem *> *)items startIndex:(NSUInteger)index;
/// Convenience: auto-detect video vs photo for a single item.
+ (void)showWithVideoURL:(NSURL *)videoURL photoURL:(NSURL *)photoURL caption:(NSString *)caption;
@end
-470
View File
@@ -1,470 +0,0 @@
#import "SCIMediaViewer.h"
#import "../Utils.h"
#import "../SCIImageCache.h"
#import <AVFoundation/AVFoundation.h>
#import <AVKit/AVKit.h>
//
#pragma mark - Data model
//
@implementation SCIMediaViewerItem
+ (instancetype)itemWithVideoURL:(NSURL *)videoURL photoURL:(NSURL *)photoURL caption:(NSString *)caption {
SCIMediaViewerItem *i = [SCIMediaViewerItem new];
i.videoURL = videoURL;
i.photoURL = photoURL;
i.caption = caption;
return i;
}
@end
//
#pragma mark - Single photo page
//
@interface _SCIPhotoPageVC : UIViewController <UIScrollViewDelegate>
@property (nonatomic, strong) NSURL *photoURL;
@property (nonatomic, strong) UIScrollView *scrollView;
@property (nonatomic, strong) UIImageView *imageView;
@property (nonatomic, strong) UIActivityIndicatorView *spinner;
@end
@implementation _SCIPhotoPageVC
- (void)viewDidLoad {
[super viewDidLoad];
self.view.backgroundColor = [UIColor blackColor];
self.scrollView = [[UIScrollView alloc] initWithFrame:self.view.bounds];
self.scrollView.autoresizingMask = UIViewAutoresizingFlexibleWidth | UIViewAutoresizingFlexibleHeight;
self.scrollView.delegate = self;
self.scrollView.minimumZoomScale = 1.0;
self.scrollView.maximumZoomScale = 5.0;
self.scrollView.showsVerticalScrollIndicator = NO;
self.scrollView.showsHorizontalScrollIndicator = NO;
[self.view addSubview:self.scrollView];
self.imageView = [[UIImageView alloc] initWithFrame:self.scrollView.bounds];
self.imageView.contentMode = UIViewContentModeScaleAspectFit;
self.imageView.autoresizingMask = UIViewAutoresizingFlexibleWidth | UIViewAutoresizingFlexibleHeight;
[self.scrollView addSubview:self.imageView];
self.spinner = [[UIActivityIndicatorView alloc] initWithActivityIndicatorStyle:UIActivityIndicatorViewStyleMedium];
self.spinner.color = [UIColor whiteColor];
self.spinner.center = self.view.center;
self.spinner.autoresizingMask = UIViewAutoresizingFlexibleTopMargin | UIViewAutoresizingFlexibleBottomMargin
| UIViewAutoresizingFlexibleLeftMargin | UIViewAutoresizingFlexibleRightMargin;
[self.view addSubview:self.spinner];
[self.spinner startAnimating];
[SCIImageCache loadImageFromURL:self.photoURL completion:^(UIImage *img) {
[self.spinner stopAnimating];
if (img) self.imageView.image = img;
}];
// Double-tap to zoom
UITapGestureRecognizer *doubleTap = [[UITapGestureRecognizer alloc] initWithTarget:self action:@selector(handleDoubleTap:)];
doubleTap.numberOfTapsRequired = 2;
[self.scrollView addGestureRecognizer:doubleTap];
}
- (UIView *)viewForZoomingInScrollView:(UIScrollView *)sv { return self.imageView; }
- (void)handleDoubleTap:(UITapGestureRecognizer *)gr {
if (self.scrollView.zoomScale > 1.0) {
[self.scrollView setZoomScale:1.0 animated:YES];
} else {
CGPoint pt = [gr locationInView:self.imageView];
CGRect rect = CGRectMake(pt.x - 50, pt.y - 50, 100, 100);
[self.scrollView zoomToRect:rect animated:YES];
}
}
- (UIImage *)currentImage { return self.imageView.image; }
@end
//
#pragma mark - Single video page
//
@interface _SCIVideoPageVC : UIViewController
@property (nonatomic, strong) NSURL *videoURL;
@property (nonatomic, strong) AVPlayerViewController *playerVC;
@end
@implementation _SCIVideoPageVC
- (void)viewDidLoad {
[super viewDidLoad];
self.view.backgroundColor = [UIColor blackColor];
AVPlayer *player = [AVPlayer playerWithURL:self.videoURL];
self.playerVC = [[AVPlayerViewController alloc] init];
self.playerVC.player = player;
self.playerVC.showsPlaybackControls = YES;
[self addChildViewController:self.playerVC];
self.playerVC.view.frame = self.view.bounds;
self.playerVC.view.autoresizingMask = UIViewAutoresizingFlexibleWidth | UIViewAutoresizingFlexibleHeight;
[self.view addSubview:self.playerVC.view];
[self.playerVC didMoveToParentViewController:self];
[player play];
}
- (void)viewWillDisappear:(BOOL)animated {
[super viewWillDisappear:animated];
[self.playerVC.player pause];
}
@end
//
#pragma mark - Container VC (PageViewController-based)
//
@interface _SCIMediaViewerContainerVC : UIViewController <UIPageViewControllerDataSource, UIPageViewControllerDelegate, UIGestureRecognizerDelegate>
@property (nonatomic, strong) NSArray<SCIMediaViewerItem *> *items;
@property (nonatomic, assign) NSUInteger currentIndex;
@property (nonatomic, strong) UIPageViewController *pageVC;
@property (nonatomic, strong) UIView *topBar;
@property (nonatomic, strong) UIButton *closeBtn;
@property (nonatomic, strong) UILabel *counterLabel;
@property (nonatomic, strong) UIButton *shareBtn;
@property (nonatomic, strong) UIView *bottomBar;
@property (nonatomic, strong) UILabel *captionLabel;
@property (nonatomic, assign) BOOL chromeVisible;
@property (nonatomic, assign) BOOL captionExpanded;
@end
@implementation _SCIMediaViewerContainerVC
- (void)viewDidLoad {
[super viewDidLoad];
self.view.backgroundColor = [UIColor blackColor];
self.chromeVisible = YES;
// Page view controller
self.pageVC = [[UIPageViewController alloc]
initWithTransitionStyle:UIPageViewControllerTransitionStyleScroll
navigationOrientation:UIPageViewControllerNavigationOrientationHorizontal
options:nil];
self.pageVC.dataSource = self.items.count > 1 ? self : nil;
self.pageVC.delegate = self;
UIViewController *firstPage = [self viewControllerForIndex:self.currentIndex];
if (firstPage) [self.pageVC setViewControllers:@[firstPage] direction:UIPageViewControllerNavigationDirectionForward animated:NO completion:nil];
[self addChildViewController:self.pageVC];
self.pageVC.view.frame = self.view.bounds;
self.pageVC.view.autoresizingMask = UIViewAutoresizingFlexibleWidth | UIViewAutoresizingFlexibleHeight;
[self.view addSubview:self.pageVC.view];
[self.pageVC didMoveToParentViewController:self];
// Top bar
self.topBar = [[UIView alloc] init];
self.topBar.translatesAutoresizingMaskIntoConstraints = NO;
[self.view addSubview:self.topBar];
UIImageSymbolConfiguration *cfg = [UIImageSymbolConfiguration configurationWithPointSize:17 weight:UIImageSymbolWeightSemibold];
self.closeBtn = [UIButton buttonWithType:UIButtonTypeSystem];
[self.closeBtn setImage:[UIImage systemImageNamed:@"xmark" withConfiguration:cfg] forState:UIControlStateNormal];
self.closeBtn.tintColor = [UIColor whiteColor];
self.closeBtn.translatesAutoresizingMaskIntoConstraints = NO;
[self.closeBtn addTarget:self action:@selector(closeTapped) forControlEvents:UIControlEventTouchUpInside];
[self.topBar addSubview:self.closeBtn];
self.shareBtn = [UIButton buttonWithType:UIButtonTypeSystem];
[self.shareBtn setImage:[UIImage systemImageNamed:@"square.and.arrow.up" withConfiguration:cfg] forState:UIControlStateNormal];
self.shareBtn.tintColor = [UIColor whiteColor];
self.shareBtn.translatesAutoresizingMaskIntoConstraints = NO;
[self.shareBtn addTarget:self action:@selector(shareTapped) forControlEvents:UIControlEventTouchUpInside];
[self.topBar addSubview:self.shareBtn];
self.counterLabel = [[UILabel alloc] init];
self.counterLabel.textColor = [UIColor whiteColor];
self.counterLabel.font = [UIFont systemFontOfSize:15 weight:UIFontWeightSemibold];
self.counterLabel.textAlignment = NSTextAlignmentCenter;
self.counterLabel.translatesAutoresizingMaskIntoConstraints = NO;
[self.topBar addSubview:self.counterLabel];
[NSLayoutConstraint activateConstraints:@[
[self.topBar.topAnchor constraintEqualToAnchor:self.view.safeAreaLayoutGuide.topAnchor],
[self.topBar.leadingAnchor constraintEqualToAnchor:self.view.leadingAnchor],
[self.topBar.trailingAnchor constraintEqualToAnchor:self.view.trailingAnchor],
[self.topBar.heightAnchor constraintEqualToConstant:44],
[self.closeBtn.leadingAnchor constraintEqualToAnchor:self.topBar.leadingAnchor constant:16],
[self.closeBtn.centerYAnchor constraintEqualToAnchor:self.topBar.centerYAnchor],
[self.shareBtn.trailingAnchor constraintEqualToAnchor:self.topBar.trailingAnchor constant:-16],
[self.shareBtn.centerYAnchor constraintEqualToAnchor:self.topBar.centerYAnchor],
[self.counterLabel.centerXAnchor constraintEqualToAnchor:self.topBar.centerXAnchor],
[self.counterLabel.centerYAnchor constraintEqualToAnchor:self.topBar.centerYAnchor],
]];
// Bottom bar (caption tap to expand/collapse)
self.bottomBar = [[UIView alloc] init];
self.bottomBar.backgroundColor = [UIColor colorWithWhite:0 alpha:0.6];
self.bottomBar.translatesAutoresizingMaskIntoConstraints = NO;
[self.view addSubview:self.bottomBar];
self.captionLabel = [[UILabel alloc] init];
self.captionLabel.textColor = [UIColor whiteColor];
self.captionLabel.font = [UIFont systemFontOfSize:14];
self.captionLabel.numberOfLines = 3; // collapsed
self.captionLabel.translatesAutoresizingMaskIntoConstraints = NO;
self.captionLabel.userInteractionEnabled = YES;
[self.bottomBar addSubview:self.captionLabel];
UITapGestureRecognizer *captionTap = [[UITapGestureRecognizer alloc]
initWithTarget:self action:@selector(toggleCaption)];
[self.captionLabel addGestureRecognizer:captionTap];
[NSLayoutConstraint activateConstraints:@[
[self.bottomBar.leadingAnchor constraintEqualToAnchor:self.view.leadingAnchor],
[self.bottomBar.trailingAnchor constraintEqualToAnchor:self.view.trailingAnchor],
[self.bottomBar.bottomAnchor constraintEqualToAnchor:self.view.bottomAnchor],
[self.captionLabel.topAnchor constraintEqualToAnchor:self.bottomBar.topAnchor constant:12],
[self.captionLabel.leadingAnchor constraintEqualToAnchor:self.bottomBar.leadingAnchor constant:16],
[self.captionLabel.trailingAnchor constraintEqualToAnchor:self.bottomBar.trailingAnchor constant:-16],
[self.captionLabel.bottomAnchor constraintEqualToAnchor:self.view.safeAreaLayoutGuide.bottomAnchor constant:-8],
]];
// Swipe down to dismiss
UIPanGestureRecognizer *pan = [[UIPanGestureRecognizer alloc] initWithTarget:self action:@selector(handleDismissPan:)];
pan.delegate = (id<UIGestureRecognizerDelegate>)self;
[self.view addGestureRecognizer:pan];
// Single tap toggles chrome
UITapGestureRecognizer *tap = [[UITapGestureRecognizer alloc] initWithTarget:self action:@selector(toggleChrome)];
tap.cancelsTouchesInView = NO;
[self.pageVC.view addGestureRecognizer:tap];
[self updateChrome];
}
- (void)updateChrome {
SCIMediaViewerItem *item = self.items[self.currentIndex];
// Counter (hide for single items)
if (self.items.count > 1) {
self.counterLabel.text = [NSString stringWithFormat:@"%lu / %lu", (unsigned long)(self.currentIndex + 1), (unsigned long)self.items.count];
self.counterLabel.hidden = NO;
} else {
self.counterLabel.hidden = YES;
}
// Caption
if (item.caption.length) {
self.captionLabel.text = item.caption;
self.bottomBar.hidden = NO;
} else {
self.bottomBar.hidden = YES;
}
}
- (void)toggleChrome {
self.chromeVisible = !self.chromeVisible;
[UIView animateWithDuration:0.25 animations:^{
CGFloat a = self.chromeVisible ? 1.0 : 0.0;
self.topBar.alpha = a;
self.bottomBar.alpha = a;
}];
}
- (void)toggleCaption {
self.captionExpanded = !self.captionExpanded;
[UIView animateWithDuration:0.25 animations:^{
self.captionLabel.numberOfLines = self.captionExpanded ? 0 : 3;
[self.view layoutIfNeeded];
}];
}
- (BOOL)gestureRecognizerShouldBegin:(UIPanGestureRecognizer *)gr {
if (![gr isKindOfClass:[UIPanGestureRecognizer class]]) return YES;
CGPoint v = [gr velocityInView:self.view];
return fabs(v.y) > fabs(v.x) && v.y > 0;
}
- (void)handleDismissPan:(UIPanGestureRecognizer *)gr {
CGFloat ty = [gr translationInView:self.view].y;
CGFloat h = self.view.bounds.size.height;
CGFloat progress = fmin(fmax(ty / h, 0), 1);
switch (gr.state) {
case UIGestureRecognizerStateChanged: {
self.view.transform = CGAffineTransformMakeTranslation(0, ty);
self.view.alpha = 1.0 - progress * 0.5;
break;
}
case UIGestureRecognizerStateEnded:
case UIGestureRecognizerStateCancelled: {
CGFloat vy = [gr velocityInView:self.view].y;
if (progress > 0.25 || vy > 800) {
[UIView animateWithDuration:0.2 animations:^{
self.view.transform = CGAffineTransformMakeTranslation(0, h);
self.view.alpha = 0;
} completion:^(BOOL finished) {
[self dismissViewControllerAnimated:NO completion:nil];
}];
} else {
[UIView animateWithDuration:0.25 delay:0 usingSpringWithDamping:0.8 initialSpringVelocity:0 options:0 animations:^{
self.view.transform = CGAffineTransformIdentity;
self.view.alpha = 1;
} completion:nil];
}
break;
}
default: break;
}
}
- (void)closeTapped {
// Pause any playing video
UIViewController *current = self.pageVC.viewControllers.firstObject;
if ([current isKindOfClass:[_SCIVideoPageVC class]]) {
[(((_SCIVideoPageVC *)current).playerVC.player) pause];
}
[self dismissViewControllerAnimated:YES completion:nil];
}
- (void)shareTapped {
SCIMediaViewerItem *item = self.items[self.currentIndex];
NSMutableArray *shareItems = [NSMutableArray array];
UIViewController *current = self.pageVC.viewControllers.firstObject;
if ([current isKindOfClass:[_SCIPhotoPageVC class]]) {
UIImage *img = [(_SCIPhotoPageVC *)current currentImage];
if (img) [shareItems addObject:img];
}
// For videos or if no image loaded, share the URL
if (!shareItems.count) {
NSURL *url = item.videoURL ?: item.photoURL;
if (url) [shareItems addObject:url];
}
if (!shareItems.count) return;
UIActivityViewController *vc = [[UIActivityViewController alloc] initWithActivityItems:shareItems applicationActivities:nil];
vc.popoverPresentationController.sourceView = self.shareBtn;
[self presentViewController:vc animated:YES completion:nil];
}
// Page data source
- (UIViewController *)viewControllerForIndex:(NSUInteger)idx {
if (idx >= self.items.count) return nil;
SCIMediaViewerItem *item = self.items[idx];
if (item.videoURL) {
_SCIVideoPageVC *vc = [[_SCIVideoPageVC alloc] init];
vc.videoURL = item.videoURL;
vc.view.tag = (NSInteger)idx;
return vc;
} else if (item.photoURL) {
_SCIPhotoPageVC *vc = [[_SCIPhotoPageVC alloc] init];
vc.photoURL = item.photoURL;
vc.view.tag = (NSInteger)idx;
return vc;
}
return nil;
}
- (UIViewController *)pageViewController:(UIPageViewController *)pvc viewControllerBeforeViewController:(UIViewController *)vc {
NSInteger idx = vc.view.tag;
if (idx <= 0) return nil;
return [self viewControllerForIndex:idx - 1];
}
- (UIViewController *)pageViewController:(UIPageViewController *)pvc viewControllerAfterViewController:(UIViewController *)vc {
NSInteger idx = vc.view.tag;
if (idx + 1 >= (NSInteger)self.items.count) return nil;
return [self viewControllerForIndex:idx + 1];
}
- (void)pageViewController:(UIPageViewController *)pvc didFinishAnimating:(BOOL)finished
previousViewControllers:(NSArray<UIViewController *> *)prev transitionCompleted:(BOOL)completed {
if (!completed) return;
UIViewController *current = pvc.viewControllers.firstObject;
self.currentIndex = (NSUInteger)current.view.tag;
// Pause previous video
for (UIViewController *p in prev) {
if ([p isKindOfClass:[_SCIVideoPageVC class]]) {
[((_SCIVideoPageVC *)p).playerVC.player pause];
}
}
// Play new video
if ([current isKindOfClass:[_SCIVideoPageVC class]]) {
[((_SCIVideoPageVC *)current).playerVC.player play];
}
[self updateChrome];
}
- (BOOL)prefersStatusBarHidden { return YES; }
- (BOOL)prefersHomeIndicatorAutoHidden { return YES; }
@end
//
#pragma mark - Public API
//
@implementation SCIMediaViewer
+ (void)presentNativeVideoPlayer:(NSURL *)url {
dispatch_async(dispatch_get_main_queue(), ^{
AVPlayerViewController *playerVC = [[AVPlayerViewController alloc] init];
playerVC.player = [AVPlayer playerWithURL:url];
playerVC.modalPresentationStyle = UIModalPresentationFullScreen;
[topMostController() presentViewController:playerVC animated:YES completion:^{
[playerVC.player play];
}];
});
}
+ (void)showItem:(SCIMediaViewerItem *)item {
if (!item) { [SCIUtils showErrorHUDWithDescription:SCILocalized(@"No media to show")]; return; }
// Single video native AVPlayerViewController directly (no wrapper)
if (item.videoURL) {
[self presentNativeVideoPlayer:item.videoURL];
return;
}
// Single photo use our photo viewer container
[self showItems:@[item] startIndex:0];
}
+ (void)showItems:(NSArray<SCIMediaViewerItem *> *)items startIndex:(NSUInteger)index {
if (!items.count) { [SCIUtils showErrorHUDWithDescription:SCILocalized(@"No media to show")]; return; }
if (index >= items.count) index = 0;
// Single video item native player
if (items.count == 1 && items[0].videoURL) {
[self presentNativeVideoPlayer:items[0].videoURL];
return;
}
dispatch_async(dispatch_get_main_queue(), ^{
_SCIMediaViewerContainerVC *vc = [[_SCIMediaViewerContainerVC alloc] init];
vc.items = items;
vc.currentIndex = index;
vc.modalPresentationStyle = UIModalPresentationOverFullScreen;
vc.modalTransitionStyle = UIModalTransitionStyleCrossDissolve;
[topMostController() presentViewController:vc animated:YES completion:nil];
});
}
+ (void)showWithVideoURL:(NSURL *)videoURL photoURL:(NSURL *)photoURL caption:(NSString *)caption {
[self showItem:[SCIMediaViewerItem itemWithVideoURL:videoURL photoURL:photoURL caption:caption]];
}
@end
-10
View File
@@ -1,10 +0,0 @@
// SCIRepostSheet — download media, save to Photos, open IG's creation flow.
#import <UIKit/UIKit.h>
@interface SCIRepostSheet : NSObject
/// Download media, save to Photos, open IG's creation flow.
+ (void)repostWithVideoURL:(NSURL *)videoURL photoURL:(NSURL *)photoURL;
@end
-109
View File
@@ -1,109 +0,0 @@
#import "SCIRepostSheet.h"
#import "../Utils.h"
#import "../Downloader/Download.h"
#import "../PhotoAlbum.h"
#import <Photos/Photos.h>
@implementation SCIRepostSheet
+ (void)repostWithVideoURL:(NSURL *)videoURL photoURL:(NSURL *)photoURL {
NSURL *url = videoURL ?: photoURL;
if (!url) { [SCIUtils showErrorHUDWithDescription:SCILocalized(@"No media URL")]; return; }
// Show pill
SCIDownloadPillView *pill = [SCIDownloadPillView shared];
[pill resetState];
[pill setText:SCILocalized(@"Preparing repost...")];
[pill setSubtitle:nil];
UIView *hostView = [UIApplication sharedApplication].keyWindow ?: topMostController().view;
if (hostView) [pill showInView:hostView];
// Download to temp file
NSString *ext = [[url lastPathComponent] pathExtension];
if (!ext.length) ext = videoURL ? @"mp4" : @"jpg";
NSString *tmp = [NSTemporaryDirectory() stringByAppendingPathComponent:
[NSString stringWithFormat:@"repost_%@.%@", [[NSUUID UUID] UUIDString], ext]];
NSURLSessionDownloadTask *task = [[NSURLSession sharedSession]
downloadTaskWithURL:url completionHandler:^(NSURL *loc, NSURLResponse *resp, NSError *err) {
if (err || !loc) {
dispatch_async(dispatch_get_main_queue(), ^{
[pill showError:SCILocalized(@"Download failed")];
[pill dismissAfterDelay:2.0];
});
return;
}
NSError *mv = nil;
NSURL *fileURL = [NSURL fileURLWithPath:tmp];
[[NSFileManager defaultManager] moveItemAtURL:loc toURL:fileURL error:&mv];
if (mv) {
dispatch_async(dispatch_get_main_queue(), ^{
[pill showError:SCILocalized(@"Save failed")];
[pill dismissAfterDelay:2.0];
});
return;
}
// Save to Photos and get the localIdentifier
[self saveToPhotosAndOpenCreation:fileURL isVideo:(videoURL != nil) pill:pill];
}];
[task resume];
}
+ (void)saveToPhotosAndOpenCreation:(NSURL *)fileURL isVideo:(BOOL)isVideo pill:(SCIDownloadPillView *)pill {
[PHPhotoLibrary requestAuthorization:^(PHAuthorizationStatus status) {
if (status != PHAuthorizationStatusAuthorized) {
dispatch_async(dispatch_get_main_queue(), ^{
[pill showError:SCILocalized(@"Photos access denied")];
[pill dismissAfterDelay:2.0];
});
return;
}
__block NSString *localId = nil;
[[PHPhotoLibrary sharedPhotoLibrary] performChanges:^{
PHAssetCreationRequest *req;
if (isVideo) {
req = [PHAssetCreationRequest creationRequestForAssetFromVideoAtFileURL:fileURL];
} else {
UIImage *img = [UIImage imageWithContentsOfFile:fileURL.path];
if (img) {
req = [PHAssetCreationRequest creationRequestForAssetFromImage:img];
} else {
req = [PHAssetCreationRequest creationRequestForAsset];
PHAssetResourceCreationOptions *opts = [PHAssetResourceCreationOptions new];
opts.shouldMoveFile = YES;
[req addResourceWithType:PHAssetResourceTypePhoto fileURL:fileURL options:opts];
}
}
localId = req.placeholderForCreatedAsset.localIdentifier;
} completionHandler:^(BOOL success, NSError *error) {
dispatch_async(dispatch_get_main_queue(), ^{
if (!success || !localId.length) {
[pill showError:SCILocalized(@"Failed to save")];
[pill dismissAfterDelay:2.0];
return;
}
[pill showSuccess:SCILocalized(@"Opening creator...")];
[pill dismissAfterDelay:1.0];
// Open IG's native creation flow with the saved asset
NSString *urlStr = [NSString stringWithFormat:@"instagram://library?LocalIdentifier=%@",
[localId stringByAddingPercentEncodingWithAllowedCharacters:
[NSCharacterSet URLQueryAllowedCharacterSet]]];
NSURL *igURL = [NSURL URLWithString:urlStr];
if ([[UIApplication sharedApplication] canOpenURL:igURL]) {
[[UIApplication sharedApplication] openURL:igURL options:@{} completionHandler:nil];
} else {
// Fallback: show share sheet
[SCIUtils showShareVC:fileURL];
}
});
}];
}];
}
@end
Binary file not shown.

Before

Width:  |  Height:  |  Size: 4.0 KiB

Binary file not shown.

Before

Width:  |  Height:  |  Size: 4.5 KiB

Binary file not shown.

Before

Width:  |  Height:  |  Size: 3.5 MiB

-59
View File
@@ -1,59 +0,0 @@
#import <UIKit/UIKit.h>
#import <Foundation/Foundation.h>
#import "../../modules/JGProgressHUD/JGProgressHUD.h"
#import "../InstagramHeaders.h"
#import "../Utils.h"
#import "Manager.h"
@interface SCIDownloadPillView : UIView
@property (nonatomic, strong) UIProgressView *progressBar;
@property (nonatomic, strong) UILabel *textLabel;
@property (nonatomic, strong) UILabel *subtitleLabel;
@property (nonatomic, strong) UIImageView *iconView;
@property (nonatomic, copy) void (^onCancel)(void);
- (void)resetState;
- (void)showInView:(UIView *)view;
- (void)dismiss;
- (void)dismissAfterDelay:(NSTimeInterval)delay;
- (void)setProgress:(float)progress;
- (void)setText:(NSString *)text;
- (void)setSubtitle:(NSString *)text;
- (void)showSuccess:(NSString *)text;
- (void)showError:(NSString *)text;
- (void)showBulkProgress:(NSUInteger)completed total:(NSUInteger)total;
// Multi-download ticket API. All methods are safe from any thread.
// Tap-to-cancel pops the most recently pushed ticket.
- (NSString *)beginTicketWithTitle:(NSString *)title onCancel:(void (^)(void))cancel;
- (void)updateTicket:(NSString *)ticketId progress:(float)progress;
- (void)updateTicket:(NSString *)ticketId text:(NSString *)text;
- (void)finishTicket:(NSString *)ticketId successMessage:(NSString *)message;
- (void)finishTicket:(NSString *)ticketId errorMessage:(NSString *)message;
- (void)finishTicket:(NSString *)ticketId cancelled:(NSString *)message;
/// Shared singleton pill — reused across all downloads so only one shows at a time.
+ (instancetype)shared;
@end
@interface SCIDownloadDelegate : NSObject <SCIDownloadDelegateProtocol>
typedef NS_ENUM(NSUInteger, DownloadAction) {
share,
quickLook,
saveToPhotos
};
@property (nonatomic, readonly) DownloadAction action;
@property (nonatomic, readonly) BOOL showProgress;
@property (nonatomic, strong) SCIDownloadManager *downloadManager;
@property (nonatomic, strong) SCIDownloadPillView *pill;
@property (nonatomic, copy) NSString *ticketId;
- (instancetype)initWithAction:(DownloadAction)action showProgress:(BOOL)showProgress;
- (void)downloadFileWithURL:(NSURL *)url fileExtension:(NSString *)fileExtension hudLabel:(NSString *)hudLabel;
@end
-497
View File
@@ -1,497 +0,0 @@
#import "Download.h"
#import "../PhotoAlbum.h"
#import <Photos/Photos.h>
#pragma mark - Ticket slot
@interface SCIDownloadSlot : NSObject
@property (nonatomic, copy) NSString *ticketId;
@property (nonatomic, copy) NSString *title;
@property (nonatomic, assign) float progress;
@property (nonatomic, copy) void (^onCancel)(void);
@property (nonatomic, assign) BOOL finished;
@end
@implementation SCIDownloadSlot @end
#pragma mark - SCIDownloadPillView
@interface SCIDownloadPillView ()
@property (nonatomic, strong) NSMutableArray<SCIDownloadSlot *> *slots;
@end
@implementation SCIDownloadPillView
+ (instancetype)shared {
static SCIDownloadPillView *s;
static dispatch_once_t once;
dispatch_once(&once, ^{ s = [[SCIDownloadPillView alloc] init]; });
return s;
}
- (instancetype)init {
self = [super initWithFrame:CGRectZero];
if (self) {
_slots = [NSMutableArray array];
[[NSNotificationCenter defaultCenter] addObserver:self
selector:@selector(_sciAppDidBecomeActive)
name:UIApplicationDidBecomeActiveNotification object:nil];
[[NSNotificationCenter defaultCenter] addObserver:self
selector:@selector(_sciAppDidEnterBackground)
name:UIApplicationDidEnterBackgroundNotification object:nil];
UIBlurEffect *blur = [UIBlurEffect effectWithStyle:UIBlurEffectStyleSystemUltraThinMaterialDark];
UIVisualEffectView *blurView = [[UIVisualEffectView alloc] initWithEffect:blur];
blurView.translatesAutoresizingMaskIntoConstraints = NO;
blurView.layer.cornerRadius = 16;
blurView.clipsToBounds = YES;
[self addSubview:blurView];
[NSLayoutConstraint activateConstraints:@[
[blurView.topAnchor constraintEqualToAnchor:self.topAnchor],
[blurView.bottomAnchor constraintEqualToAnchor:self.bottomAnchor],
[blurView.leadingAnchor constraintEqualToAnchor:self.leadingAnchor],
[blurView.trailingAnchor constraintEqualToAnchor:self.trailingAnchor],
]];
self.layer.cornerRadius = 16;
self.clipsToBounds = YES;
self.alpha = 0;
// Icon
_iconView = [[UIImageView alloc] init];
_iconView.translatesAutoresizingMaskIntoConstraints = NO;
_iconView.tintColor = [UIColor whiteColor];
_iconView.contentMode = UIViewContentModeScaleAspectFit;
UIImageSymbolConfiguration *cfg = [UIImageSymbolConfiguration configurationWithPointSize:18 weight:UIImageSymbolWeightMedium];
_iconView.image = [UIImage systemImageNamed:@"arrow.down.circle" withConfiguration:cfg];
[self addSubview:_iconView];
// Text
_textLabel = [[UILabel alloc] init];
_textLabel.text = SCILocalized(@"Downloading...");
_textLabel.textColor = [UIColor whiteColor];
_textLabel.font = [UIFont systemFontOfSize:14 weight:UIFontWeightSemibold];
_textLabel.textAlignment = NSTextAlignmentCenter;
_textLabel.translatesAutoresizingMaskIntoConstraints = NO;
[self addSubview:_textLabel];
// Subtitle
_subtitleLabel = [[UILabel alloc] init];
_subtitleLabel.text = SCILocalized(@"Tap to cancel");
_subtitleLabel.textColor = [UIColor colorWithWhite:0.7 alpha:1.0];
_subtitleLabel.font = [UIFont systemFontOfSize:11 weight:UIFontWeightRegular];
_subtitleLabel.textAlignment = NSTextAlignmentCenter;
_subtitleLabel.translatesAutoresizingMaskIntoConstraints = NO;
[self addSubview:_subtitleLabel];
// Progress bar
_progressBar = [[UIProgressView alloc] initWithProgressViewStyle:UIProgressViewStyleDefault];
_progressBar.progressTintColor = [UIColor systemBlueColor];
_progressBar.trackTintColor = [UIColor colorWithWhite:0.3 alpha:0.5];
_progressBar.translatesAutoresizingMaskIntoConstraints = NO;
_progressBar.layer.cornerRadius = 1.5;
_progressBar.clipsToBounds = YES;
[self addSubview:_progressBar];
UITapGestureRecognizer *tap = [[UITapGestureRecognizer alloc] initWithTarget:self action:@selector(handleTap)];
[self addGestureRecognizer:tap];
[NSLayoutConstraint activateConstraints:@[
[_iconView.leadingAnchor constraintEqualToAnchor:self.leadingAnchor constant:14],
[_iconView.centerYAnchor constraintEqualToAnchor:self.centerYAnchor constant:-2],
[_iconView.widthAnchor constraintEqualToConstant:22],
[_iconView.heightAnchor constraintEqualToConstant:22],
[_textLabel.topAnchor constraintEqualToAnchor:self.topAnchor constant:10],
[_textLabel.leadingAnchor constraintEqualToAnchor:_iconView.trailingAnchor constant:10],
[_textLabel.trailingAnchor constraintEqualToAnchor:self.trailingAnchor constant:-14],
[_subtitleLabel.topAnchor constraintEqualToAnchor:_textLabel.bottomAnchor constant:1],
[_subtitleLabel.leadingAnchor constraintEqualToAnchor:_textLabel.leadingAnchor],
[_subtitleLabel.trailingAnchor constraintEqualToAnchor:_textLabel.trailingAnchor],
[_progressBar.bottomAnchor constraintEqualToAnchor:self.bottomAnchor],
[_progressBar.leadingAnchor constraintEqualToAnchor:self.leadingAnchor],
[_progressBar.trailingAnchor constraintEqualToAnchor:self.trailingAnchor],
[_progressBar.heightAnchor constraintEqualToConstant:3],
[_subtitleLabel.bottomAnchor constraintEqualToAnchor:_progressBar.topAnchor constant:-8],
]];
}
return self;
}
- (void)handleTap {
if (self.slots.count > 0) {
SCIDownloadSlot *top = self.slots.lastObject;
void (^cb)(void) = top.onCancel;
top.onCancel = nil;
if (cb) cb();
return;
}
void (^cb)(void) = self.onCancel;
self.onCancel = nil;
if (cb) cb();
}
- (void)resetState {
self.progressBar.progress = 0;
self.progressBar.hidden = NO;
self.subtitleLabel.hidden = NO;
self.subtitleLabel.text = SCILocalized(@"Tap to cancel");
self.textLabel.text = SCILocalized(@"Downloading...");
UIImageSymbolConfiguration *cfg = [UIImageSymbolConfiguration configurationWithPointSize:18 weight:UIImageSymbolWeightMedium];
self.iconView.image = [UIImage systemImageNamed:@"arrow.down.circle" withConfiguration:cfg];
self.iconView.tintColor = [UIColor whiteColor];
}
- (void)showInView:(UIView *)view {
[self removeFromSuperview];
self.translatesAutoresizingMaskIntoConstraints = NO;
[view addSubview:self];
[NSLayoutConstraint activateConstraints:@[
[self.topAnchor constraintEqualToAnchor:view.safeAreaLayoutGuide.topAnchor constant:8],
[self.centerXAnchor constraintEqualToAnchor:view.centerXAnchor],
[self.widthAnchor constraintGreaterThanOrEqualToConstant:200],
[self.widthAnchor constraintLessThanOrEqualToConstant:300],
]];
[UIView animateWithDuration:0.3 delay:0 usingSpringWithDamping:0.8 initialSpringVelocity:0.5
options:UIViewAnimationOptionCurveEaseOut animations:^{
self.alpha = 1;
} completion:nil];
}
- (void)dismiss {
dispatch_async(dispatch_get_main_queue(), ^{
// A new ticket raced in keep the pill alive.
if (self.slots.count > 0) return;
if (self.alpha <= 0.01 && !self.superview) return;
self.onCancel = nil;
[UIView animateWithDuration:0.25 animations:^{
self.alpha = 0;
self.transform = CGAffineTransformMakeScale(0.9, 0.9);
} completion:^(BOOL finished) {
[self removeFromSuperview];
self.transform = CGAffineTransformIdentity;
}];
});
}
- (void)dismissAfterDelay:(NSTimeInterval)delay {
dispatch_after(dispatch_time(DISPATCH_TIME_NOW, (int64_t)(delay * NSEC_PER_SEC)), dispatch_get_main_queue(), ^{
[self dismiss];
});
}
- (void)setProgress:(float)progress {
self.progressBar.hidden = NO;
[self.progressBar setProgress:progress animated:YES];
}
- (void)setText:(NSString *)text {
self.textLabel.text = text;
}
- (void)setSubtitle:(NSString *)text {
self.subtitleLabel.text = text;
self.subtitleLabel.hidden = (text.length == 0);
}
- (void)showSuccess:(NSString *)text {
UIImageSymbolConfiguration *cfg = [UIImageSymbolConfiguration configurationWithPointSize:18 weight:UIImageSymbolWeightMedium];
self.iconView.image = [UIImage systemImageNamed:@"checkmark.circle.fill" withConfiguration:cfg];
self.iconView.tintColor = [UIColor systemGreenColor];
self.textLabel.text = text;
self.subtitleLabel.hidden = YES;
self.progressBar.hidden = YES;
self.onCancel = nil;
}
- (void)showError:(NSString *)text {
UIImageSymbolConfiguration *cfg = [UIImageSymbolConfiguration configurationWithPointSize:18 weight:UIImageSymbolWeightMedium];
self.iconView.image = [UIImage systemImageNamed:@"xmark.circle.fill" withConfiguration:cfg];
self.iconView.tintColor = [UIColor systemRedColor];
self.textLabel.text = text;
self.subtitleLabel.hidden = YES;
self.progressBar.hidden = YES;
self.onCancel = nil;
}
- (void)showBulkProgress:(NSUInteger)completed total:(NSUInteger)total {
self.textLabel.text = [NSString stringWithFormat:@"Downloading %lu of %lu", (unsigned long)completed + 1, (unsigned long)total];
self.subtitleLabel.text = SCILocalized(@"Tap to cancel");
self.subtitleLabel.hidden = NO;
self.progressBar.hidden = NO;
[self.progressBar setProgress:(float)completed / (float)total animated:YES];
}
#pragma mark - Ticket API
- (void)_onMain:(dispatch_block_t)block {
if ([NSThread isMainThread]) block();
else dispatch_async(dispatch_get_main_queue(), block);
}
- (SCIDownloadSlot *)_slotForId:(NSString *)ticketId {
if (!ticketId) return nil;
for (SCIDownloadSlot *s in self.slots) {
if ([s.ticketId isEqualToString:ticketId]) return s;
}
return nil;
}
- (void)_renderTop {
SCIDownloadSlot *top = self.slots.lastObject;
if (!top) return;
UIImageSymbolConfiguration *cfg = [UIImageSymbolConfiguration configurationWithPointSize:18 weight:UIImageSymbolWeightMedium];
self.iconView.image = [UIImage systemImageNamed:@"arrow.down.circle" withConfiguration:cfg];
self.iconView.tintColor = [UIColor whiteColor];
self.textLabel.text = top.title ?: @"Downloading...";
self.progressBar.hidden = NO;
[self.progressBar setProgress:top.progress animated:YES];
self.subtitleLabel.hidden = NO;
if (self.slots.count > 1) {
self.subtitleLabel.text = [NSString stringWithFormat:@"%lu active — tap to cancel",
(unsigned long)self.slots.count];
} else {
self.subtitleLabel.text = SCILocalized(@"Tap to cancel");
}
}
- (NSString *)beginTicketWithTitle:(NSString *)title onCancel:(void (^)(void))cancel {
NSString *ticketId = [[NSUUID UUID] UUIDString];
void (^cancelCopy)(void) = [cancel copy];
[self _onMain:^{
SCIDownloadSlot *slot = [SCIDownloadSlot new];
slot.ticketId = ticketId;
slot.title = title ?: @"Downloading...";
slot.progress = 0;
slot.onCancel = cancelCopy;
[self.slots addObject:slot];
// Reset visual state so the prior download's final frame doesn't leak in.
[self.progressBar setProgress:0 animated:NO];
self.alpha = 1;
self.transform = CGAffineTransformIdentity;
if (!self.superview) {
UIView *host = [UIApplication sharedApplication].keyWindow ?: topMostController().view;
if (host) [self showInView:host];
}
[self _renderTop];
}];
return ticketId;
}
- (void)_sciAppDidBecomeActive {
[self _onMain:^{
if (self.slots.count == 0 && (self.superview || self.alpha > 0.01)) {
self.alpha = 0;
self.transform = CGAffineTransformIdentity;
[self removeFromSuperview];
} else if (self.slots.count > 0) {
[self _renderTop];
}
}];
}
// iOS suspends networking + ffmpeg on background cancel active tickets so the
// pill clears cleanly on return. User re-initiates the download.
- (void)_sciAppDidEnterBackground {
[self _onMain:^{
for (SCIDownloadSlot *slot in [self.slots copy]) {
void (^cb)(void) = slot.onCancel;
slot.onCancel = nil;
if (cb) cb();
}
}];
}
- (void)dealloc {
[[NSNotificationCenter defaultCenter] removeObserver:self];
}
- (void)updateTicket:(NSString *)ticketId progress:(float)progress {
[self _onMain:^{
SCIDownloadSlot *s = [self _slotForId:ticketId];
if (!s || s.finished) return;
s.progress = progress;
if (self.slots.lastObject == s) [self.progressBar setProgress:progress animated:YES];
}];
}
- (void)updateTicket:(NSString *)ticketId text:(NSString *)text {
[self _onMain:^{
SCIDownloadSlot *s = [self _slotForId:ticketId];
if (!s || s.finished) return;
s.title = text ?: s.title;
if (self.slots.lastObject == s) self.textLabel.text = s.title;
}];
}
- (void)_removeSlot:(SCIDownloadSlot *)slot
finalText:(NSString *)finalText
finalIcon:(NSString *)finalIcon
iconColor:(UIColor *)iconColor {
if (!slot || slot.finished) return;
slot.finished = YES;
slot.onCancel = nil;
[self.slots removeObject:slot];
if (self.slots.count > 0) {
[self _renderTop];
return;
}
UIImageSymbolConfiguration *cfg = [UIImageSymbolConfiguration configurationWithPointSize:18 weight:UIImageSymbolWeightMedium];
self.iconView.image = [UIImage systemImageNamed:finalIcon withConfiguration:cfg];
self.iconView.tintColor = iconColor;
self.textLabel.text = finalText;
self.subtitleLabel.hidden = YES;
self.progressBar.hidden = YES;
[self dismissAfterDelay:1.2];
}
- (void)finishTicket:(NSString *)ticketId successMessage:(NSString *)message {
[self _onMain:^{
SCIDownloadSlot *s = [self _slotForId:ticketId];
[self _removeSlot:s
finalText:message ?: @"Done"
finalIcon:@"checkmark.circle.fill"
iconColor:[UIColor systemGreenColor]];
}];
}
- (void)finishTicket:(NSString *)ticketId errorMessage:(NSString *)message {
[self _onMain:^{
SCIDownloadSlot *s = [self _slotForId:ticketId];
[self _removeSlot:s
finalText:message ?: @"Failed"
finalIcon:@"xmark.circle.fill"
iconColor:[UIColor systemRedColor]];
}];
}
- (void)finishTicket:(NSString *)ticketId cancelled:(NSString *)message {
[self _onMain:^{
SCIDownloadSlot *s = [self _slotForId:ticketId];
[self _removeSlot:s
finalText:message ?: @"Cancelled"
finalIcon:@"xmark.circle.fill"
iconColor:[UIColor systemOrangeColor]];
}];
}
@end
#pragma mark - SCIDownloadDelegate
@implementation SCIDownloadDelegate
- (instancetype)initWithAction:(DownloadAction)action showProgress:(BOOL)showProgress {
self = [super init];
if (self) {
_action = action;
_showProgress = showProgress;
self.downloadManager = [[SCIDownloadManager alloc] initWithDelegate:self];
}
return self;
}
- (void)downloadFileWithURL:(NSURL *)url fileExtension:(NSString *)fileExtension hudLabel:(NSString *)hudLabel {
SCIDownloadPillView *pill = [SCIDownloadPillView shared];
self.pill = pill;
__weak typeof(self) weakSelf = self;
self.ticketId = [pill beginTicketWithTitle:hudLabel ?: @"Downloading..." onCancel:^{
[weakSelf.downloadManager cancelDownload];
}];
NSLog(@"[SCInsta] Download: Will start download for url \"%@\" with file extension: \".%@\"", url, fileExtension);
[self.downloadManager downloadFileWithURL:url fileExtension:fileExtension];
}
- (void)downloadDidStart {
NSLog(@"[SCInsta] Download: Download started");
}
- (void)downloadDidCancel {
[self.pill finishTicket:self.ticketId cancelled:@"Cancelled"];
NSLog(@"[SCInsta] Download: Download cancelled");
}
- (void)downloadDidProgress:(float)progress {
if (!self.showProgress) return;
[self.pill updateTicket:self.ticketId progress:progress];
[self.pill updateTicket:self.ticketId text:[NSString stringWithFormat:@"Downloading %d%%", (int)(progress * 100)]];
}
- (void)downloadDidFinishWithError:(NSError *)error {
if (error && error.code != NSURLErrorCancelled) {
NSLog(@"[SCInsta] Download: Download failed with error: \"%@\"", error);
[self.pill finishTicket:self.ticketId errorMessage:SCILocalized(@"Download failed")];
}
}
- (void)downloadDidFinishWithFileURL:(NSURL *)fileURL {
dispatch_async(dispatch_get_main_queue(), ^{
NSLog(@"[SCInsta] Download: Finished with url: \"%@\"", [fileURL absoluteString]);
// saveToPhotos finishes the ticket after the PH completion fires.
if (self.action != saveToPhotos) {
[self.pill finishTicket:self.ticketId successMessage:SCILocalized(@"Done")];
}
switch (self.action) {
case share:
[SCIUtils showShareVC:fileURL];
break;
case quickLook:
[SCIUtils showQuickLookVC:@[fileURL]];
break;
case saveToPhotos: {
[PHPhotoLibrary requestAuthorization:^(PHAuthorizationStatus status) {
if (status != PHAuthorizationStatusAuthorized) {
dispatch_async(dispatch_get_main_queue(), ^{
[SCIUtils showErrorHUDWithDescription:SCILocalized(@"Photo library access denied")];
});
return;
}
BOOL useAlbum = [SCIUtils getBoolPref:@"save_to_ryukgram_album"];
void (^onDone)(BOOL, NSError *) = ^(BOOL success, NSError *error) {
dispatch_async(dispatch_get_main_queue(), ^{
if (success) {
[self.pill finishTicket:self.ticketId
successMessage:useAlbum ? SCILocalized(@"Saved to RyukGram") : SCILocalized(@"Saved to Photos")];
} else {
[self.pill finishTicket:self.ticketId errorMessage:SCILocalized(@"Failed to save")];
}
});
};
if (useAlbum) {
[SCIPhotoAlbum saveFileToAlbum:fileURL completion:onDone];
} else {
[[PHPhotoLibrary sharedPhotoLibrary] performChanges:^{
NSString *ext = [[fileURL pathExtension] lowercaseString];
BOOL isVideo = [@[@"mp4", @"mov", @"m4v"] containsObject:ext];
PHAssetCreationRequest *req = [PHAssetCreationRequest creationRequestForAsset];
PHAssetResourceCreationOptions *opts = [[PHAssetResourceCreationOptions alloc] init];
opts.shouldMoveFile = YES;
[req addResourceWithType:(isVideo ? PHAssetResourceTypeVideo : PHAssetResourceTypePhoto)
fileURL:fileURL options:opts];
req.creationDate = [NSDate date];
} completionHandler:onDone];
}
}];
break;
}
}
});
}
@end
-32
View File
@@ -1,32 +0,0 @@
#import <UIKit/UIKit.h>
#import <Foundation/Foundation.h>
@protocol SCIDownloadDelegateProtocol <NSObject>
// Methods
- (void)downloadDidStart;
- (void)downloadDidCancel;
- (void)downloadDidProgress:(float)progress;
- (void)downloadDidFinishWithError:(NSError *)error;
- (void)downloadDidFinishWithFileURL:(NSURL *)fileURL;
@end
@interface SCIDownloadManager : NSObject <NSURLSessionDownloadDelegate>
// Properties
@property (nonatomic, weak) id<SCIDownloadDelegateProtocol> delegate;
@property (nonatomic, strong) NSURLSession *session;
@property (nonatomic, strong) NSURLSessionDownloadTask *task;
@property (nonatomic, strong) NSString *fileExtension;
// Methods
- (instancetype)initWithDelegate:(id<SCIDownloadDelegateProtocol>)downloadDelegate;
- (void)downloadFileWithURL:(NSURL *)url fileExtension:(NSString *)fileExtension;
- (void)cancelDownload;
- (NSURL *)moveFileToCacheDir:(NSURL *)oldPath;
@end
-74
View File
@@ -1,74 +0,0 @@
#import "Manager.h"
#import "../ActionButton/SCIMediaActions.h"
@implementation SCIDownloadManager
- (instancetype)initWithDelegate:(id<SCIDownloadDelegateProtocol>)downloadDelegate {
self = [super init];
if (self) {
self.delegate = downloadDelegate;
}
return self;
}
- (void)downloadFileWithURL:(NSURL *)url fileExtension:(NSString *)fileExtension {
// Properties
self.session = [NSURLSession sessionWithConfiguration:[NSURLSessionConfiguration defaultSessionConfiguration] delegate:self delegateQueue:nil];
self.task = [self.session downloadTaskWithURL:url];
// Default to jpg if no other reasonable length extension is provided
self.fileExtension = [fileExtension length] >= 3 ? fileExtension : @"jpg";
[self.task resume];
[self.delegate downloadDidStart];
}
- (void)cancelDownload {
[self.task cancel];
[self.delegate downloadDidCancel];
}
// URLSession methods
- (void)URLSession:(NSURLSession *)session downloadTask:(NSURLSessionDownloadTask *)downloadTask didWriteData:(int64_t)bytesWritten totalBytesWritten:(int64_t)totalBytesWritten totalBytesExpectedToWrite:(int64_t)totalBytesExpectedToWrite {
float progress = (float)totalBytesWritten / (float)totalBytesExpectedToWrite;
[self.delegate downloadDidProgress:progress];
}
- (void)URLSession:(NSURLSession *)session downloadTask:(NSURLSessionDownloadTask *)downloadTask didFinishDownloadingToURL:(NSURL *)location {
// Move downloaded file to cache directory
NSURL *finalLocation = [self moveFileToCacheDir:location];
[self.delegate downloadDidFinishWithFileURL:finalLocation];
}
- (void)URLSession:(NSURLSession *)session task:(NSURLSessionTask *)task didCompleteWithError:(NSError *)error {
if (error) NSLog(@"[SCInsta] Download error: %@", error);
[self.delegate downloadDidFinishWithError:error];
}
// Rename downloaded file & move from documents dir -> cache dir
- (NSURL *)moveFileToCacheDir:(NSURL *)oldPath {
NSFileManager *fileManager = [NSFileManager defaultManager];
NSString *cacheDirectoryPath = NSSearchPathForDirectoriesInDomains(NSCachesDirectory, NSUserDomainMask, YES).firstObject;
NSString *stem = [SCIMediaActions currentFilenameStem] ?: NSUUID.UUID.UUIDString;
NSURL *newPath = [[NSURL fileURLWithPath:cacheDirectoryPath] URLByAppendingPathComponent:[NSString stringWithFormat:@"%@.%@", stem, self.fileExtension]];
NSLog(@"[SCInsta] Download Handler: Moving file from: %@ to: %@", oldPath.absoluteString, newPath.absoluteString);
// Move file to cache directory
NSError *fileMoveError;
[fileManager moveItemAtURL:oldPath toURL:newPath error:&fileMoveError];
if (fileMoveError) {
NSLog(@"[SCInsta] Download Handler: Error while moving file: %@", oldPath.absoluteString);
NSLog(@"[SCInsta] Download Handler: %@", fileMoveError);
}
return newPath;
}
@end
@@ -1,257 +0,0 @@
// Feed action button — hooks IGUFIInteractionCountsView.
// Media lives on sibling cells (IGFeedItemPhotoCell, IGModernFeedVideoCell)
// in the same collection view section, NOT on the UFI cell itself.
#import "../../InstagramHeaders.h"
#import "../../Utils.h"
#import "../../SCIChrome.h"
#import "../../ActionButton/SCIActionButton.h"
#import "../../ActionButton/SCIMediaActions.h"
#import <objc/runtime.h>
#import <objc/message.h>
static const NSInteger kFeedActionBtnTag = 13370;
static const void *kFeedPageIndexKey = &kFeedPageIndexKey;
// Read _currentMediaPK from IGFeedItemUFICell.
static NSString *sciFeedCurrentMediaPK(UIView *button) {
UIResponder *r = button;
Class ufiCls = NSClassFromString(@"IGFeedItemUFICell");
while (r && !(ufiCls && [r isKindOfClass:ufiCls])) r = [r nextResponder];
if (!r) return nil;
Ivar iv = class_getInstanceVariable(object_getClass(r), "_currentMediaPK");
if (!iv) return nil;
id val = object_getIvar(r, iv);
return [val isKindOfClass:[NSString class]] ? val : nil;
}
// Current carousel page index. Returns -1 if not found.
static NSInteger sciFeedCarouselPageIndex(UIView *button) {
// Walk up to collection view
UIView *v = button;
UICollectionViewCell *ufiCell = nil;
UICollectionView *cv = nil;
while (v) {
if (!ufiCell && [v isKindOfClass:[UICollectionViewCell class]]
&& [NSStringFromClass([v class]) containsString:@"UFI"]) {
ufiCell = (UICollectionViewCell *)v;
}
if ([v isKindOfClass:[UICollectionView class]]) {
cv = (UICollectionView *)v;
break;
}
v = v.superview;
}
if (!ufiCell || !cv) return -1;
NSIndexPath *ufiPath = [cv indexPathForCell:ufiCell];
if (!ufiPath) return -1;
NSInteger section = ufiPath.section;
// Find IGFeedItemPageCell in same section
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:@"Page"]) continue;
// BFS for IGPageMediaView
Class pmvCls = NSClassFromString(@"IGPageMediaView");
if (pmvCls) {
NSMutableArray *queue = [NSMutableArray arrayWithObject:cell];
int scanned = 0;
UIView *pmv = nil;
while (queue.count && scanned < 50) {
UIView *cur = queue.firstObject; [queue removeObjectAtIndex:0]; scanned++;
if ([cur isKindOfClass:pmvCls]) { pmv = cur; break; }
for (UIView *s in cur.subviews) [queue addObject:s];
}
if (pmv && [pmv respondsToSelector:@selector(currentMediaItem)] && [pmv respondsToSelector:@selector(items)]) {
@try {
id current = ((id(*)(id,SEL))objc_msgSend)(pmv, @selector(currentMediaItem));
NSArray *items = ((id(*)(id,SEL))objc_msgSend)(pmv, @selector(items));
if (current && items.count) {
NSUInteger idx = [items indexOfObjectIdenticalTo:current];
if (idx != NSNotFound) return (NSInteger)idx;
}
} @catch (__unused id e) {}
}
}
// Fallback: _currentIndex ivar on the page cell
Ivar idxIvar = class_getInstanceVariable([cell class], "_currentIndex");
if (!idxIvar) idxIvar = class_getInstanceVariable([cell class], "_currentPage");
if (!idxIvar) idxIvar = class_getInstanceVariable([cell class], "_currentMediaIndex");
if (idxIvar) {
ptrdiff_t offset = ivar_getOffset(idxIvar);
NSInteger idx = *(NSInteger *)((char *)(__bridge void *)cell + offset);
return idx;
}
// Fallback: compute page from scroll view content offset
{
NSMutableArray *sq = [NSMutableArray arrayWithObject:cell];
int sc = 0;
while (sq.count && sc < 100) {
UIView *cur = sq.firstObject; [sq removeObjectAtIndex:0]; sc++;
if ([cur isKindOfClass:[UIScrollView class]] && cur != cv) {
UIScrollView *sv = (UIScrollView *)cur;
CGFloat pageW = sv.bounds.size.width;
// Horizontal paging scroll view
if (pageW > 100 && sv.contentSize.width > pageW * 1.5) {
NSInteger idx = (NSInteger)round(sv.contentOffset.x / pageW);
return idx;
}
}
for (UIView *s in cur.subviews) [sq addObject:s];
}
}
}
return -1;
}
// Resolve current carousel child using page index.
static id sciFeedResolveCarouselChild(id parentMedia, UIView *button) {
if (!parentMedia) return nil;
if (![SCIMediaActions isCarouselMedia:parentMedia]) return parentMedia;
NSInteger idx = sciFeedCarouselPageIndex(button);
NSArray *children = [SCIMediaActions carouselChildrenForMedia:parentMedia];
if (idx >= 0 && (NSUInteger)idx < children.count) {
return children[idx];
}
return parentMedia;
}
// Extract IGMedia from sibling cells in the same collection view section.
static IGMedia *sciFeedMediaFromButton(UIView *button) {
if (!button) return nil;
Class mediaClass = NSClassFromString(@"IGMedia");
if (!mediaClass) return nil;
// Walk up to find UFI cell and collection view
UIView *v = button;
UICollectionViewCell *ufiCell = nil;
UICollectionView *cv = nil;
while (v) {
if (!ufiCell && [v isKindOfClass:[UICollectionViewCell class]]
&& [NSStringFromClass([v class]) containsString:@"UFI"]) {
ufiCell = (UICollectionViewCell *)v;
}
if ([v isKindOfClass:[UICollectionView class]]) {
cv = (UICollectionView *)v;
break;
}
v = v.superview;
}
if (!ufiCell || !cv) return nil;
// Get section
NSIndexPath *ufiPath = [cv indexPathForCell:ufiCell];
if (!ufiPath) return nil;
NSInteger section = ufiPath.section;
// Search sibling cells for IGMedia
for (UICollectionViewCell *cell in cv.visibleCells) {
NSIndexPath *path = [cv indexPathForCell:cell];
if (!path || path.section != section) continue;
if (cell == ufiCell) continue;
// Filter to media cell classes
NSString *cls = NSStringFromClass([cell class]);
if (![cls containsString:@"Photo"] && ![cls containsString:@"Video"]
&& ![cls containsString:@"Media"] && ![cls containsString:@"Page"]) continue;
// Scan ivars for IGMedia
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;
}
// Try .media selector on wrapper objects
if (val && [val respondsToSelector:@selector(media)]) {
id m = ((id(*)(id,SEL))objc_msgSend)(val, @selector(media));
if (m && [m isKindOfClass:mediaClass]) {
free(ivars);
return (IGMedia *)m;
}
}
} @catch (__unused id e) {}
}
if (ivars) free(ivars);
c = class_getSuperclass(c);
}
// Try mediaCellFeedItem (video cells)
if ([cell respondsToSelector:@selector(mediaCellFeedItem)]) {
@try {
id m = ((id(*)(id,SEL))objc_msgSend)(cell, @selector(mediaCellFeedItem));
if (m && [m isKindOfClass:mediaClass]) {
return (IGMedia *)m;
}
} @catch (__unused id e) {}
}
}
return nil;
}
%hook IGUFIInteractionCountsView
- (void)updateUFIWithButtonsConfig:(id)config interactionCountProvider:(id)provider {
%orig;
if (![SCIUtils getBoolPref:@"feed_action_button"]) return;
SCIChromeButton *btn = (SCIChromeButton *)[self viewWithTag:kFeedActionBtnTag];
if (![btn isKindOfClass:[SCIChromeButton class]]) btn = nil;
if (!btn) {
btn = [[SCIChromeButton alloc] initWithSymbol:@"ellipsis.circle" pointSize:21 diameter:36];
btn.tag = kFeedActionBtnTag;
btn.iconTint = [UIColor labelColor];
btn.bubbleColor = [UIColor clearColor];
[self addSubview:btn];
// Position: right side, left of bookmark. Shifted up 4pt to
// align with the native like/comment/share icons.
[NSLayoutConstraint activateConstraints:@[
[btn.trailingAnchor constraintEqualToAnchor:self.trailingAnchor constant:-44],
[btn.centerYAnchor constraintEqualToAnchor:self.centerYAnchor constant:-6],
[btn.widthAnchor constraintEqualToConstant:36],
[btn.heightAnchor constraintEqualToConstant:36],
]];
}
// Reconfigure with fresh media provider.
[SCIActionButton configureButton:btn
context:SCIActionContextFeed
prefKey:@"feed_action_default"
mediaProvider:^id (UIView *sourceView) {
id parentMedia = sciFeedMediaFromButton(sourceView);
if (!parentMedia) return nil;
if ([SCIMediaActions isCarouselMedia:parentMedia]) {
NSInteger idx = sciFeedCarouselPageIndex(sourceView);
NSArray *children = [SCIMediaActions carouselChildrenForMedia:parentMedia];
if (idx >= 0 && (NSUInteger)idx < children.count) {
// Stash page index for the menu builder to find the parent.
objc_setAssociatedObject(sourceView, kFeedPageIndexKey,
@(idx), OBJC_ASSOCIATION_RETAIN_NONATOMIC);
return children[idx];
}
}
return parentMedia;
}];
}
%end
@@ -1,177 +0,0 @@
// Reels action button — injects a RyukGram action button above the reel's
// vertical like/comment/share sidebar (IGSundialViewerVerticalUFI).
#import "../../InstagramHeaders.h"
#import "../../Utils.h"
#import "../../SCIChrome.h"
#import "../../ActionButton/SCIActionButton.h"
#import "../../ActionButton/SCIMediaActions.h"
#import <objc/runtime.h>
#import <objc/message.h>
static const NSInteger kReelActionBtnTag = 1337;
static UIView *sciFindSuperviewOfClass(UIView *view, NSString *className) {
Class cls = NSClassFromString(className);
if (!cls) return nil;
UIView *current = view.superview;
for (int depth = 0; current && depth < 20; depth++) {
if ([current isKindOfClass:cls]) return current;
current = current.superview;
}
return nil;
}
static id sciFindMediaIvar(UIView *view) {
if (!view) return nil;
Class mediaClass = NSClassFromString(@"IGMedia");
if (!mediaClass) return nil;
unsigned int count = 0;
Ivar *ivars = class_copyIvarList([view class], &count);
id found = nil;
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(view, ivars[i]);
if (val && [val isKindOfClass:mediaClass]) { found = val; break; }
} @catch (__unused id e) {}
}
if (ivars) free(ivars);
return found;
}
// Resolve the current carousel child from _currentIndex.
static id sciCurrentCarouselChildMedia(UIView *carouselCell, id parentMedia) {
if (!carouselCell || !parentMedia) return parentMedia;
// Try _currentIndex ivar
Ivar idxIvar = class_getInstanceVariable([carouselCell class], "_currentIndex");
NSInteger currentIdx = 0;
if (idxIvar) {
ptrdiff_t offset = ivar_getOffset(idxIvar);
currentIdx = *(NSInteger *)((char *)(__bridge void *)carouselCell + offset);
}
// Fallback: _currentFractionalIndex
if (!idxIvar || currentIdx == 0) {
Ivar fracIvar = class_getInstanceVariable([carouselCell class], "_currentFractionalIndex");
if (fracIvar) {
ptrdiff_t fOffset = ivar_getOffset(fracIvar);
double fracIdx = *(double *)((char *)(__bridge void *)carouselCell + fOffset);
NSInteger roundedIdx = (NSInteger)round(fracIdx);
if (roundedIdx > 0) currentIdx = roundedIdx;
}
}
// Fallback: inner collection view content offset
Ivar cvIvar = class_getInstanceVariable([carouselCell class], "_collectionView");
if (cvIvar) {
UICollectionView *cv = object_getIvar(carouselCell, cvIvar);
if (cv) {
CGFloat pageWidth = cv.bounds.size.width;
if (pageWidth > 0) {
NSInteger cvIdx = (NSInteger)round(cv.contentOffset.x / pageWidth);
if (cvIdx > currentIdx) currentIdx = cvIdx;
}
}
}
NSArray *children = [SCIMediaActions carouselChildrenForMedia:parentMedia];
if (currentIdx >= 0 && (NSUInteger)currentIdx < children.count) {
return children[currentIdx];
}
return parentMedia;
}
// Media provider for reels. Returns current page's child for carousels.
static id sciReelsMediaProvider(UIView *sourceView) {
// Video reel
UIView *videoCell = sciFindSuperviewOfClass(sourceView, @"IGSundialViewerVideoCell");
if (videoCell) {
id m = sciFindMediaIvar(videoCell);
if (m) return m;
}
// Photo reel
UIView *photoCell = sciFindSuperviewOfClass(sourceView, @"IGSundialViewerPhotoCell");
if (photoCell) {
id m = sciFindMediaIvar(photoCell);
if (m) return m;
}
// Carousel reel
UIView *carouselCell = sciFindSuperviewOfClass(sourceView, @"IGSundialViewerCarouselCell");
if (carouselCell) {
id parentMedia = sciFindMediaIvar(carouselCell);
if (parentMedia) {
return sciCurrentCarouselChildMedia(carouselCell, parentMedia);
}
}
return nil;
}
%hook IGSundialViewerVerticalUFI
- (void)didMoveToSuperview {
%orig;
if (![SCIUtils getBoolPref:@"reels_action_button"]) return;
if (!self.superview) return;
SCIChromeButton *btn = (SCIChromeButton *)[self viewWithTag:kReelActionBtnTag];
if (![btn isKindOfClass:[SCIChromeButton class]]) btn = nil;
if (!btn) {
UIImageSymbolConfiguration *symCfg =
[UIImageSymbolConfiguration configurationWithPointSize:24 weight:UIImageSymbolWeightSemibold];
UIImage *base = [UIImage systemImageNamed:@"ellipsis.circle" withConfiguration:symCfg];
// Bake the drop shadow into the image so no CALayer shadow is needed.
CGFloat pad = 8;
CGSize sz = CGSizeMake(base.size.width + pad * 2, base.size.height + pad * 2);
UIGraphicsImageRenderer *r = [[UIGraphicsImageRenderer alloc] initWithSize:sz];
UIImage *icon = [r imageWithActions:^(UIGraphicsImageRendererContext *ctx) {
CGContextRef c = ctx.CGContext;
CGContextSaveGState(c);
CGContextSetShadowWithColor(c, CGSizeMake(0, 1), 3,
[UIColor colorWithWhite:0 alpha:0.55].CGColor);
UIImage *tinted = [base imageWithTintColor:[UIColor whiteColor]
renderingMode:UIImageRenderingModeAlwaysOriginal];
[tinted drawInRect:CGRectMake(pad, pad, base.size.width, base.size.height)];
CGContextRestoreGState(c);
}];
btn = [[SCIChromeButton alloc] initWithSymbol:@"" pointSize:0 diameter:40];
btn.tag = kReelActionBtnTag;
btn.bubbleColor = [UIColor clearColor];
btn.iconView.image = icon;
// Capsule configuration gives us the native dark platter animation
// when the menu opens/closes — behaviour parity with IG's own chrome.
UIButtonConfiguration *cfg = [UIButtonConfiguration plainButtonConfiguration];
cfg.cornerStyle = UIButtonConfigurationCornerStyleCapsule;
cfg.background.backgroundColor = [UIColor clearColor];
cfg.contentInsets = NSDirectionalEdgeInsetsZero;
btn.configuration = cfg;
self.clipsToBounds = NO;
[self addSubview:btn];
[NSLayoutConstraint activateConstraints:@[
[btn.centerXAnchor constraintEqualToAnchor:self.centerXAnchor],
[btn.bottomAnchor constraintEqualToAnchor:self.topAnchor constant:-10],
[btn.widthAnchor constraintEqualToConstant:40],
[btn.heightAnchor constraintEqualToConstant:40]
]];
}
[SCIActionButton configureButton:btn
context:SCIActionContextReels
prefKey:@"reels_action_default"
mediaProvider:^id (UIView *sourceView) {
return sciReelsMediaProvider(sourceView);
}];
}
%end
-37
View File
@@ -1,37 +0,0 @@
#import "../../Utils.h"
%hook IGDirectThreadCallButtonsCoordinator
// 426+ dropped the sender arg
- (void)_didTapAudioButton {
if ([SCIUtils getBoolPref:@"voice_call_confirm"]) {
[SCIUtils showConfirmation:^(void) { %orig; }];
} else {
return %orig;
}
}
- (void)_didTapVideoButton {
if ([SCIUtils getBoolPref:@"video_call_confirm"]) {
[SCIUtils showConfirmation:^(void) { %orig; }];
} else {
return %orig;
}
}
// Pre-426 signatures
- (void)_didTapAudioButton:(id)arg1 {
if ([SCIUtils getBoolPref:@"voice_call_confirm"]) {
[SCIUtils showConfirmation:^(void) { %orig; }];
} else {
return %orig;
}
}
- (void)_didTapVideoButton:(id)arg1 {
if ([SCIUtils getBoolPref:@"video_call_confirm"]) {
[SCIUtils showConfirmation:^(void) { %orig; }];
} else {
return %orig;
}
}
%end
-35
View File
@@ -1,35 +0,0 @@
#import "../../InstagramHeaders.h"
#import "../../Utils.h"
%hook IGDirectThreadThemePickerViewController
- (void)themeNewPickerSectionController:(id)arg1 didSelectTheme:(id)arg2 atIndex:(NSInteger)arg3 {
if ([SCIUtils getBoolPref:@"change_direct_theme_confirm"]) {
NSLog(@"[SCInsta] Confirm change direct theme triggered");
[SCIUtils showConfirmation:^(void) { %orig; }];
} else {
return %orig;
}
}
- (void)themePickerSectionController:(id)arg1 didSelectThemeId:(id)arg2 {
if ([SCIUtils getBoolPref:@"change_direct_theme_confirm"]) {
NSLog(@"[SCInsta] Confirm change direct theme triggered");
[SCIUtils showConfirmation:^(void) { %orig; }];
} else {
return %orig;
}
}
%end
%hook IGDirectThreadThemeKitSwift.IGDirectThreadThemePreviewController
- (void)primaryButtonTapped {
if ([SCIUtils getBoolPref:@"change_direct_theme_confirm"]) {
NSLog(@"[SCInsta] Confirm change direct theme triggered");
[SCIUtils showConfirmation:^(void) { %orig; }];
} else {
return %orig;
}
}
%end

Some files were not shown because too many files have changed in this diff Show More