You've already forked revanced-integrations
mirror of
https://github.com/revanced/revanced-integrations
synced 2025-11-19 03:23:27 +01:00
Compare commits
55 Commits
v1.2.1-dev
...
v1.4.1-dev
| Author | SHA1 | Date | |
|---|---|---|---|
|
|
c7ae3355a1 | ||
|
|
eee3f352c5 | ||
|
|
36aa6c9aa8 | ||
|
|
e5aa30ebe5 | ||
|
|
5d14f53acd | ||
|
|
67673d089f | ||
|
|
07482094a3 | ||
|
|
7fcb244cfb | ||
|
|
4ec76435d5 | ||
|
|
eea4a48cd5 | ||
|
|
db7e24994b | ||
|
|
da57fb9523 | ||
|
|
486911ff2e | ||
|
|
fb4aab792a | ||
|
|
c5383d6ea2 | ||
|
|
7f5e7dfd68 | ||
|
|
b1437d43f5 | ||
|
|
b4ab5f65d5 | ||
|
|
b40687c5c7 | ||
|
|
381fbc6b7b | ||
|
|
80973c77c0 | ||
|
|
216b0060e1 | ||
|
|
0dc61d9da4 | ||
|
|
4d0db8c4fb | ||
|
|
9b23f77abe | ||
|
|
95ca632d40 | ||
|
|
608c520a00 | ||
|
|
2cee15ad88 | ||
|
|
6ee90ef788 | ||
|
|
2f5973d4a0 | ||
|
|
0b0d46f518 | ||
|
|
b866036715 | ||
|
|
a8c82ad27b | ||
|
|
85504f6f65 | ||
|
|
27421fb578 | ||
|
|
f43b71be45 | ||
|
|
bd37368c13 | ||
|
|
cdd8db766e | ||
|
|
f72faa761c | ||
|
|
48b968f3be | ||
|
|
9996b2dc02 | ||
|
|
1a4c61d301 | ||
|
|
ea5748ca8e | ||
|
|
04c10d8a00 | ||
|
|
26345522a7 | ||
|
|
ba3e602569 | ||
|
|
0eb7f3f3af | ||
|
|
fd3ae89918 | ||
|
|
04621f8a36 | ||
|
|
38dd645e11 | ||
|
|
2c7320937a | ||
|
|
f1e0365487 | ||
|
|
d0edafb1af | ||
|
|
192faf04ad | ||
|
|
c17eae2342 |
3
.editorconfig
Normal file
3
.editorconfig
Normal file
@@ -0,0 +1,3 @@
|
||||
[*.{kt,kts}]
|
||||
ktlint_code_style = intellij_idea
|
||||
ktlint_standard_no-wildcard-imports = disabled
|
||||
28
.github/workflows/build_pull_request.yml
vendored
Normal file
28
.github/workflows/build_pull_request.yml
vendored
Normal file
@@ -0,0 +1,28 @@
|
||||
name: Build pull request
|
||||
|
||||
on:
|
||||
workflow_dispatch:
|
||||
pull_request:
|
||||
branches:
|
||||
- dev
|
||||
|
||||
jobs:
|
||||
release:
|
||||
name: Build
|
||||
runs-on: ubuntu-latest
|
||||
steps:
|
||||
- name: Checkout
|
||||
uses: actions/checkout@v4
|
||||
with:
|
||||
fetch-depth: 0
|
||||
|
||||
- name: Cache Gradle
|
||||
uses: burrunan/gradle-cache-action@v1
|
||||
|
||||
- name: Setup Java
|
||||
run: echo "JAVA_HOME=$JAVA_HOME_17_X64" >> $GITHUB_ENV
|
||||
|
||||
- name: Build
|
||||
env:
|
||||
GITHUB_TOKEN: ${{ secrets.GITHUB_TOKEN }}
|
||||
run: ./gradlew build --no-daemon
|
||||
11
.github/workflows/release.yml
vendored
11
.github/workflows/release.yml
vendored
@@ -6,10 +6,6 @@ on:
|
||||
branches:
|
||||
- main
|
||||
- dev
|
||||
pull_request:
|
||||
branches:
|
||||
- main
|
||||
- dev
|
||||
|
||||
jobs:
|
||||
release:
|
||||
@@ -44,6 +40,13 @@ jobs:
|
||||
- name: Install dependencies
|
||||
run: npm install
|
||||
|
||||
- name: Import GPG key
|
||||
uses: crazy-max/ghaction-import-gpg@v6
|
||||
with:
|
||||
gpg_private_key: ${{ secrets.GPG_PRIVATE_KEY }}
|
||||
passphrase: ${{ secrets.GPG_PASSPHRASE }}
|
||||
fingerprint: ${{ env.GPG_FINGERPRINT }}
|
||||
|
||||
- name: Release
|
||||
env:
|
||||
GITHUB_TOKEN: ${{ secrets.REPOSITORY_PUSH_ACCESS }}
|
||||
|
||||
15
.gitignore
vendored
15
.gitignore
vendored
@@ -1,17 +1,12 @@
|
||||
*.iml
|
||||
.gradle
|
||||
/local.properties
|
||||
/.idea/caches
|
||||
/.idea/libraries
|
||||
/.idea/modules.xml
|
||||
/.idea/workspace.xml
|
||||
/.idea/navEditor.xml
|
||||
/.idea/assetWizardSettings.xml
|
||||
/.idea
|
||||
/.vscode
|
||||
.DS_Store
|
||||
/build
|
||||
/captures
|
||||
.externalNativeBuild
|
||||
.cxx
|
||||
/.idea
|
||||
/.vscode
|
||||
/*.log
|
||||
node_modules
|
||||
local.properties
|
||||
node_modules
|
||||
|
||||
@@ -25,7 +25,7 @@
|
||||
{
|
||||
"assets": [
|
||||
{
|
||||
"path": "app/build/outputs/apk/release/*.apk"
|
||||
"path": "app/build/outputs/apk/release/revanced-integrations*"
|
||||
}
|
||||
],
|
||||
successComment: false
|
||||
|
||||
175
CHANGELOG.md
175
CHANGELOG.md
@@ -1,3 +1,178 @@
|
||||
## [1.4.1-dev.2](https://github.com/ReVanced/revanced-integrations/compare/v1.4.1-dev.1...v1.4.1-dev.2) (2024-03-04)
|
||||
|
||||
|
||||
### Bug Fixes
|
||||
|
||||
* **YouTube - Client spoof:** Allow playback for links with timestamp ([#582](https://github.com/ReVanced/revanced-integrations/issues/582)) ([eee3f35](https://github.com/ReVanced/revanced-integrations/commit/eee3f352c59141f47f6bda6c6cd350f1a16f1450))
|
||||
|
||||
## [1.4.1-dev.1](https://github.com/ReVanced/revanced-integrations/compare/v1.4.0...v1.4.1-dev.1) (2024-03-02)
|
||||
|
||||
|
||||
### Bug Fixes
|
||||
|
||||
* **YouTube - Announcements:** Only compare ID to not show same announcement after a fix-up ([#579](https://github.com/ReVanced/revanced-integrations/issues/579)) ([5d14f53](https://github.com/ReVanced/revanced-integrations/commit/5d14f53acd0b1eabd6951543edd7d7c662b6c502))
|
||||
|
||||
# [1.4.0](https://github.com/ReVanced/revanced-integrations/compare/v1.3.2...v1.4.0) (2024-03-02)
|
||||
|
||||
|
||||
### Bug Fixes
|
||||
|
||||
* **Twitter - Hide ads:** Hide ads in search ([b40687c](https://github.com/ReVanced/revanced-integrations/commit/b40687c5c7fa301c78035219b27c0bd85c968bb2))
|
||||
* **YouTube - Disable suggested end screen:** Reliably hide end screen ([b4ab5f6](https://github.com/ReVanced/revanced-integrations/commit/b4ab5f65d5607678a000783aae14257b845706b5))
|
||||
* **YouTube - Hide ads:** Do not show error toast and hide full screen ads ([#569](https://github.com/ReVanced/revanced-integrations/issues/569)) ([0b0d46f](https://github.com/ReVanced/revanced-integrations/commit/0b0d46f5183c88f73d58c8f7b9320d38976ddd4e))
|
||||
* **YouTube - Hide Shorts:** Hide Shorts in feed when using tablet layout ([#572](https://github.com/ReVanced/revanced-integrations/issues/572)) ([7f5e7df](https://github.com/ReVanced/revanced-integrations/commit/7f5e7dfd68ad0200e9ea36d45f18a85ddfe534f8))
|
||||
* **YouTube - Spoof app version:** Remove broken versions ([#573](https://github.com/ReVanced/revanced-integrations/issues/573)) ([fb4aab7](https://github.com/ReVanced/revanced-integrations/commit/fb4aab792ae93fc7e7decbc19bd71ae700d5d235))
|
||||
|
||||
|
||||
### Features
|
||||
|
||||
* **Sync for Reddit:** Add `Fix /s/ links` patch ([a8c82ad](https://github.com/ReVanced/revanced-integrations/commit/a8c82ad27b74e929311536227dee0909ebc27ee1))
|
||||
* **X:** Add `Open links as query` patch ([#570](https://github.com/ReVanced/revanced-integrations/issues/570)) ([95ca632](https://github.com/ReVanced/revanced-integrations/commit/95ca632d40b90ea8160dbbf33fd5d7f2281cf711))
|
||||
* **YouTube - Change start page:** Add more start pages ([27421fb](https://github.com/ReVanced/revanced-integrations/commit/27421fb5783e677075ab0c220030d6af64cfaa18))
|
||||
* **YouTube - Spoof app version:** Add target versions ([#574](https://github.com/ReVanced/revanced-integrations/issues/574)) ([da57fb9](https://github.com/ReVanced/revanced-integrations/commit/da57fb95233ed251518fbd5c56a92bc39c4e0015))
|
||||
* **YouTube:** Reorganize settings menu ([#571](https://github.com/ReVanced/revanced-integrations/issues/571)) ([eea4a48](https://github.com/ReVanced/revanced-integrations/commit/eea4a48cd565712c09d0ddd35ae256871ebe1964))
|
||||
|
||||
# [1.4.0-dev.9](https://github.com/ReVanced/revanced-integrations/compare/v1.4.0-dev.8...v1.4.0-dev.9) (2024-03-02)
|
||||
|
||||
|
||||
### Features
|
||||
|
||||
* **YouTube:** Reorganize settings menu ([#571](https://github.com/ReVanced/revanced-integrations/issues/571)) ([eea4a48](https://github.com/ReVanced/revanced-integrations/commit/eea4a48cd565712c09d0ddd35ae256871ebe1964))
|
||||
|
||||
# [1.4.0-dev.8](https://github.com/ReVanced/revanced-integrations/compare/v1.4.0-dev.7...v1.4.0-dev.8) (2024-03-02)
|
||||
|
||||
|
||||
### Features
|
||||
|
||||
* **YouTube - Spoof app version:** Add target versions ([#574](https://github.com/ReVanced/revanced-integrations/issues/574)) ([da57fb9](https://github.com/ReVanced/revanced-integrations/commit/da57fb95233ed251518fbd5c56a92bc39c4e0015))
|
||||
|
||||
# [1.4.0-dev.7](https://github.com/ReVanced/revanced-integrations/compare/v1.4.0-dev.6...v1.4.0-dev.7) (2024-02-29)
|
||||
|
||||
|
||||
### Bug Fixes
|
||||
|
||||
* **YouTube - Spoof app version:** Remove broken versions ([#573](https://github.com/ReVanced/revanced-integrations/issues/573)) ([fb4aab7](https://github.com/ReVanced/revanced-integrations/commit/fb4aab792ae93fc7e7decbc19bd71ae700d5d235))
|
||||
|
||||
# [1.4.0-dev.6](https://github.com/ReVanced/revanced-integrations/compare/v1.4.0-dev.5...v1.4.0-dev.6) (2024-02-28)
|
||||
|
||||
|
||||
### Bug Fixes
|
||||
|
||||
* **YouTube - Hide Shorts:** Hide Shorts in feed when using tablet layout ([#572](https://github.com/ReVanced/revanced-integrations/issues/572)) ([7f5e7df](https://github.com/ReVanced/revanced-integrations/commit/7f5e7dfd68ad0200e9ea36d45f18a85ddfe534f8))
|
||||
|
||||
# [1.4.0-dev.5](https://github.com/ReVanced/revanced-integrations/compare/v1.4.0-dev.4...v1.4.0-dev.5) (2024-02-25)
|
||||
|
||||
|
||||
### Bug Fixes
|
||||
|
||||
* **Twitter - Hide ads:** Hide ads in search ([b40687c](https://github.com/ReVanced/revanced-integrations/commit/b40687c5c7fa301c78035219b27c0bd85c968bb2))
|
||||
* **YouTube - Disable suggested end screen:** Reliably hide end screen ([b4ab5f6](https://github.com/ReVanced/revanced-integrations/commit/b4ab5f65d5607678a000783aae14257b845706b5))
|
||||
|
||||
# [1.4.0-dev.4](https://github.com/ReVanced/revanced-integrations/compare/v1.4.0-dev.3...v1.4.0-dev.4) (2024-02-21)
|
||||
|
||||
|
||||
### Features
|
||||
|
||||
* **X:** Add `Open links as query` patch ([#570](https://github.com/ReVanced/revanced-integrations/issues/570)) ([95ca632](https://github.com/ReVanced/revanced-integrations/commit/95ca632d40b90ea8160dbbf33fd5d7f2281cf711))
|
||||
|
||||
# [1.4.0-dev.3](https://github.com/ReVanced/revanced-integrations/compare/v1.4.0-dev.2...v1.4.0-dev.3) (2024-02-13)
|
||||
|
||||
|
||||
### Bug Fixes
|
||||
|
||||
* **YouTube - Hide ads:** Do not show error toast and hide full screen ads ([#569](https://github.com/ReVanced/revanced-integrations/issues/569)) ([0b0d46f](https://github.com/ReVanced/revanced-integrations/commit/0b0d46f5183c88f73d58c8f7b9320d38976ddd4e))
|
||||
|
||||
# [1.4.0-dev.2](https://github.com/ReVanced/revanced-integrations/compare/v1.4.0-dev.1...v1.4.0-dev.2) (2024-02-09)
|
||||
|
||||
|
||||
### Features
|
||||
|
||||
* **Sync for Reddit:** Add `Fix /s/ links` patch ([a8c82ad](https://github.com/ReVanced/revanced-integrations/commit/a8c82ad27b74e929311536227dee0909ebc27ee1))
|
||||
|
||||
# [1.4.0-dev.1](https://github.com/ReVanced/revanced-integrations/compare/v1.3.2...v1.4.0-dev.1) (2024-02-09)
|
||||
|
||||
|
||||
### Features
|
||||
|
||||
* **YouTube - Change start page:** Add more start pages ([27421fb](https://github.com/ReVanced/revanced-integrations/commit/27421fb5783e677075ab0c220030d6af64cfaa18))
|
||||
|
||||
## [1.3.2](https://github.com/ReVanced/revanced-integrations/compare/v1.3.1...v1.3.2) (2024-02-08)
|
||||
|
||||
|
||||
### Bug Fixes
|
||||
|
||||
* **YouTube - Litho Filter:** Ignore null buffers ([#565](https://github.com/ReVanced/revanced-integrations/issues/565)) ([f72faa7](https://github.com/ReVanced/revanced-integrations/commit/f72faa761cca306952f270208bee4a8f59c59dda))
|
||||
|
||||
## [1.3.2-dev.1](https://github.com/ReVanced/revanced-integrations/compare/v1.3.1...v1.3.2-dev.1) (2024-02-07)
|
||||
|
||||
|
||||
### Bug Fixes
|
||||
|
||||
* **YouTube - Litho Filter:** Ignore null buffers ([#565](https://github.com/ReVanced/revanced-integrations/issues/565)) ([f72faa7](https://github.com/ReVanced/revanced-integrations/commit/f72faa761cca306952f270208bee4a8f59c59dda))
|
||||
|
||||
## [1.3.1](https://github.com/ReVanced/revanced-integrations/compare/v1.3.0...v1.3.1) (2024-02-07)
|
||||
|
||||
|
||||
### Bug Fixes
|
||||
|
||||
* **YouTube - Litho Filter:** Do not show toast if protobuffer is empty or null ([#563](https://github.com/ReVanced/revanced-integrations/issues/563)) ([ea5748c](https://github.com/ReVanced/revanced-integrations/commit/ea5748ca8e0c7130face5ca4c86cfe5e00a3ed65))
|
||||
|
||||
## [1.3.1-dev.1](https://github.com/ReVanced/revanced-integrations/compare/v1.3.0...v1.3.1-dev.1) (2024-02-07)
|
||||
|
||||
|
||||
### Bug Fixes
|
||||
|
||||
* **YouTube - Litho Filter:** Do not show toast if protobuffer is empty or null ([#563](https://github.com/ReVanced/revanced-integrations/issues/563)) ([ea5748c](https://github.com/ReVanced/revanced-integrations/commit/ea5748ca8e0c7130face5ca4c86cfe5e00a3ed65))
|
||||
|
||||
# [1.3.0](https://github.com/ReVanced/revanced-integrations/compare/v1.2.1...v1.3.0) (2024-02-05)
|
||||
|
||||
|
||||
### Bug Fixes
|
||||
|
||||
* **TikTok:** Add missing settings strings ([#561](https://github.com/ReVanced/revanced-integrations/issues/561)) ([04621f8](https://github.com/ReVanced/revanced-integrations/commit/04621f8a36490df0b35a3940ecc1fbebd6ee287f))
|
||||
* **YouTube - ReturnYouTubeDislike:** Do not show more than 1 connection toasts if the API is broken ([#560](https://github.com/ReVanced/revanced-integrations/issues/560)) ([2c73209](https://github.com/ReVanced/revanced-integrations/commit/2c7320937adc01221017c740b86c4d6851c96797))
|
||||
* **YouTube:** Correctly show channel page on tablet devices ([#558](https://github.com/ReVanced/revanced-integrations/issues/558)) ([d0edafb](https://github.com/ReVanced/revanced-integrations/commit/d0edafb1afc7b87a8eeb085a9e48dc2d20af2f3a))
|
||||
|
||||
|
||||
### Features
|
||||
|
||||
* **YouTube - Custom filter:** Custom filtering of the protocol buffer ([#562](https://github.com/ReVanced/revanced-integrations/issues/562)) ([0eb7f3f](https://github.com/ReVanced/revanced-integrations/commit/0eb7f3f3af99bf6566526f9c48db2248d93e166c))
|
||||
|
||||
# [1.3.0-dev.1](https://github.com/ReVanced/revanced-integrations/compare/v1.2.2-dev.3...v1.3.0-dev.1) (2024-02-02)
|
||||
|
||||
|
||||
### Features
|
||||
|
||||
* **YouTube - Custom filter:** Custom filtering of the protocol buffer ([#562](https://github.com/ReVanced/revanced-integrations/issues/562)) ([0eb7f3f](https://github.com/ReVanced/revanced-integrations/commit/0eb7f3f3af99bf6566526f9c48db2248d93e166c))
|
||||
|
||||
## [1.2.2-dev.3](https://github.com/ReVanced/revanced-integrations/compare/v1.2.2-dev.2...v1.2.2-dev.3) (2024-01-31)
|
||||
|
||||
|
||||
### Bug Fixes
|
||||
|
||||
* **TikTok:** Add missing settings strings ([#561](https://github.com/ReVanced/revanced-integrations/issues/561)) ([04621f8](https://github.com/ReVanced/revanced-integrations/commit/04621f8a36490df0b35a3940ecc1fbebd6ee287f))
|
||||
|
||||
## [1.2.2-dev.2](https://github.com/ReVanced/revanced-integrations/compare/v1.2.2-dev.1...v1.2.2-dev.2) (2024-01-29)
|
||||
|
||||
|
||||
### Bug Fixes
|
||||
|
||||
* **YouTube - ReturnYouTubeDislike:** Do not show more than 1 connection toasts if the API is broken ([#560](https://github.com/ReVanced/revanced-integrations/issues/560)) ([2c73209](https://github.com/ReVanced/revanced-integrations/commit/2c7320937adc01221017c740b86c4d6851c96797))
|
||||
|
||||
## [1.2.2-dev.1](https://github.com/ReVanced/revanced-integrations/compare/v1.2.1...v1.2.2-dev.1) (2024-01-28)
|
||||
|
||||
|
||||
### Bug Fixes
|
||||
|
||||
* **YouTube:** Correctly show channel page on tablet devices ([#558](https://github.com/ReVanced/revanced-integrations/issues/558)) ([d0edafb](https://github.com/ReVanced/revanced-integrations/commit/d0edafb1afc7b87a8eeb085a9e48dc2d20af2f3a))
|
||||
|
||||
## [1.2.1](https://github.com/ReVanced/revanced-integrations/compare/v1.2.0...v1.2.1) (2024-01-28)
|
||||
|
||||
|
||||
### Bug Fixes
|
||||
|
||||
* **Twitch:** Correct patch resources to fix build ([fe03467](https://github.com/ReVanced/revanced-integrations/commit/fe034678392b3600f03362489f5fd96644b35995))
|
||||
|
||||
## [1.2.1-dev.1](https://github.com/ReVanced/revanced-integrations/compare/v1.2.0...v1.2.1-dev.1) (2024-01-27)
|
||||
|
||||
|
||||
|
||||
2
app/.gitignore
vendored
2
app/.gitignore
vendored
@@ -1 +1 @@
|
||||
/build
|
||||
/build
|
||||
@@ -1,18 +1,27 @@
|
||||
plugins {
|
||||
id("com.android.application")
|
||||
id("org.jetbrains.kotlin.android")
|
||||
alias(libs.plugins.android.application)
|
||||
alias(libs.plugins.kotlin)
|
||||
publishing
|
||||
}
|
||||
|
||||
android {
|
||||
compileSdk = 33
|
||||
namespace = "app.revanced.integrations"
|
||||
compileSdk = 33
|
||||
|
||||
applicationVariants.all {
|
||||
outputs.all {
|
||||
this as com.android.build.gradle.internal.api.ApkVariantOutputImpl
|
||||
|
||||
outputFileName = "${rootProject.name}-$versionName.apk"
|
||||
}
|
||||
}
|
||||
|
||||
defaultConfig {
|
||||
applicationId = "app.revanced.integrations"
|
||||
minSdk = 23
|
||||
targetSdk = 33
|
||||
multiDexEnabled = false
|
||||
versionName = project.version as String
|
||||
versionName = version as String
|
||||
}
|
||||
|
||||
buildTypes {
|
||||
@@ -20,32 +29,52 @@ android {
|
||||
isMinifyEnabled = true
|
||||
proguardFiles(
|
||||
getDefaultProguardFile("proguard-android-optimize.txt"),
|
||||
"proguard-rules.pro"
|
||||
"proguard-rules.pro",
|
||||
)
|
||||
}
|
||||
applicationVariants.all {
|
||||
outputs.all {
|
||||
this as com.android.build.gradle.internal.api.ApkVariantOutputImpl
|
||||
}
|
||||
|
||||
outputFileName = "${rootProject.name}-$versionName.apk"
|
||||
}
|
||||
}
|
||||
}
|
||||
compileOptions {
|
||||
sourceCompatibility(JavaVersion.VERSION_11)
|
||||
targetCompatibility(JavaVersion.VERSION_11)
|
||||
sourceCompatibility = JavaVersion.VERSION_11
|
||||
targetCompatibility = JavaVersion.VERSION_11
|
||||
}
|
||||
|
||||
kotlinOptions {
|
||||
jvmTarget = JavaVersion.VERSION_11.toString()
|
||||
}
|
||||
}
|
||||
|
||||
dependencies {
|
||||
compileOnly(project(mapOf("path" to ":dummy")))
|
||||
compileOnly("androidx.annotation:annotation:1.7.0")
|
||||
compileOnly("androidx.appcompat:appcompat:1.7.0-alpha03")
|
||||
compileOnly("com.squareup.okhttp3:okhttp:5.0.0-alpha.11")
|
||||
compileOnly("com.squareup.retrofit2:retrofit:2.9.0")
|
||||
compileOnly(libs.appcompat)
|
||||
compileOnly(libs.annotation)
|
||||
compileOnly(libs.okhttp)
|
||||
compileOnly(libs.retrofit)
|
||||
|
||||
compileOnly(project(":stub"))
|
||||
}
|
||||
|
||||
tasks.register("publish") { dependsOn("build") }
|
||||
tasks {
|
||||
// Because the signing plugin doesn't support signing APKs, do it manually.
|
||||
register("sign") {
|
||||
group = "signing"
|
||||
|
||||
dependsOn(build)
|
||||
|
||||
doLast {
|
||||
val outputDirectory = layout.buildDirectory.dir("outputs/apk/release").get().asFile
|
||||
val integrationsApk = outputDirectory.resolve("${rootProject.name}-$version.apk")
|
||||
|
||||
org.gradle.security.internal.gnupg.GnupgSignatoryFactory().createSignatory(project).sign(
|
||||
integrationsApk.inputStream(),
|
||||
outputDirectory.resolve("${integrationsApk.name}.asc").outputStream(),
|
||||
)
|
||||
}
|
||||
}
|
||||
|
||||
// Needed by gradle-semantic-release-plugin.
|
||||
// Tracking: https://github.com/KengoTODA/gradle-semantic-release-plugin/issues/435
|
||||
publish {
|
||||
dependsOn(build)
|
||||
dependsOn("sign")
|
||||
}
|
||||
}
|
||||
|
||||
23
app/proguard-rules.pro
vendored
23
app/proguard-rules.pro
vendored
@@ -1,27 +1,6 @@
|
||||
# Add project specific ProGuard rules here.
|
||||
# You can control the set of applied configuration files using the
|
||||
# proguardFiles setting in build.gradle.
|
||||
#
|
||||
# For more details, see
|
||||
# http://developer.android.com/guide/developing/tools/proguard.html
|
||||
|
||||
# If your project uses WebView with JS, uncomment the following
|
||||
# and specify the fully qualified class name to the JavaScript interface
|
||||
# class:
|
||||
#-keepclassmembers class fqcn.of.javascript.interface.for.webview {
|
||||
# public *;
|
||||
#}
|
||||
|
||||
# Uncomment this to preserve the line number information for
|
||||
# debugging stack traces.
|
||||
#-keepattributes SourceFile,LineNumberTable
|
||||
|
||||
# If you keep the line number information, uncomment this to
|
||||
# hide the original source file name.
|
||||
#-renamesourcefileattribute SourceFile
|
||||
-dontobfuscate
|
||||
-dontoptimize
|
||||
-keepattributes * # https://www.guardsquare.com/manual/configuration/attributes
|
||||
-keepattributes *
|
||||
-keep class app.revanced.** {
|
||||
*;
|
||||
}
|
||||
|
||||
@@ -1,5 +1,5 @@
|
||||
<?xml version="1.0" encoding="utf-8"?>
|
||||
<manifest xmlns:android="http://schemas.android.com/apk/res/android">
|
||||
|
||||
<uses-permission android:name="android.permission.ACCESS_NETWORK_STATE" />
|
||||
<uses-permission android:name="android.permission.SCHEDULE_EXACT_ALARM" />
|
||||
</manifest>
|
||||
|
||||
@@ -12,6 +12,7 @@ import android.os.Handler;
|
||||
import android.os.Looper;
|
||||
import android.preference.Preference;
|
||||
import android.preference.PreferenceGroup;
|
||||
import android.preference.PreferenceScreen;
|
||||
import android.view.View;
|
||||
import android.view.ViewGroup;
|
||||
import android.view.animation.Animation;
|
||||
@@ -26,10 +27,7 @@ import androidx.annotation.NonNull;
|
||||
import androidx.annotation.Nullable;
|
||||
|
||||
import java.text.Bidi;
|
||||
import java.util.Locale;
|
||||
import java.util.Objects;
|
||||
import java.util.SortedMap;
|
||||
import java.util.TreeMap;
|
||||
import java.util.*;
|
||||
import java.util.concurrent.Callable;
|
||||
import java.util.concurrent.Future;
|
||||
import java.util.concurrent.SynchronousQueue;
|
||||
@@ -102,7 +100,6 @@ public class Utils {
|
||||
view.setVisibility(View.GONE);
|
||||
}
|
||||
|
||||
|
||||
/**
|
||||
* General purpose pool for network calls and other background tasks.
|
||||
* All tasks run at max thread priority.
|
||||
@@ -205,7 +202,9 @@ public class Utils {
|
||||
public static <T extends View> T getChildView(@NonNull ViewGroup viewGroup, @NonNull MatchFilter filter) {
|
||||
for (int i = 0, childCount = viewGroup.getChildCount(); i < childCount; i++) {
|
||||
View childAt = viewGroup.getChildAt(i);
|
||||
//noinspection unchecked
|
||||
if (filter.matches(childAt)) {
|
||||
//noinspection unchecked
|
||||
return (T) childAt;
|
||||
}
|
||||
}
|
||||
@@ -345,6 +344,12 @@ public class Utils {
|
||||
}
|
||||
}
|
||||
|
||||
public enum NetworkType {
|
||||
NONE,
|
||||
MOBILE,
|
||||
OTHER,
|
||||
}
|
||||
|
||||
public static boolean isNetworkConnected() {
|
||||
NetworkType networkType = getNetworkType();
|
||||
return networkType == NetworkType.MOBILE
|
||||
@@ -393,48 +398,104 @@ public class Utils {
|
||||
}
|
||||
}
|
||||
|
||||
/**
|
||||
* {@link PreferenceScreen} and {@link PreferenceGroup} sorting styles.
|
||||
*/
|
||||
private enum Sort {
|
||||
/**
|
||||
* Sort by the localized preference title.
|
||||
*/
|
||||
BY_TITLE("_sort_by_title"),
|
||||
|
||||
/**
|
||||
* Sort by the preference keys.
|
||||
*/
|
||||
BY_KEY("_sort_by_key"),
|
||||
|
||||
/**
|
||||
* Unspecified sorting.
|
||||
*/
|
||||
UNSORTED("_sort_by_unsorted");
|
||||
|
||||
final String keySuffix;
|
||||
|
||||
Sort(String keySuffix) {
|
||||
this.keySuffix = keySuffix;
|
||||
}
|
||||
|
||||
/**
|
||||
* Defaults to {@link #UNSORTED} if key is null or has no sort suffix.
|
||||
*/
|
||||
@NonNull
|
||||
static Sort fromKey(@Nullable String key) {
|
||||
if (key != null) {
|
||||
for (Sort sort : values()) {
|
||||
if (key.endsWith(sort.keySuffix)) {
|
||||
return sort;
|
||||
}
|
||||
}
|
||||
}
|
||||
return UNSORTED;
|
||||
}
|
||||
}
|
||||
|
||||
private static final Regex punctuationRegex = new Regex("\\p{P}+");
|
||||
|
||||
/**
|
||||
* Sort the preferences by title and ignore the casing.
|
||||
*
|
||||
* Android Preferences are automatically sorted by title,
|
||||
* but if using a localized string key it sorts on the key and not the actual title text that's used at runtime.
|
||||
*
|
||||
* @param menuDepthToSort Maximum menu depth to sort. Menus deeper than this value
|
||||
* will show preferences in the order created in patches.
|
||||
* Strips all punctuation and converts to lower case. A null parameter returns an empty string.
|
||||
*/
|
||||
public static void sortPreferenceGroupByTitle(PreferenceGroup group, int menuDepthToSort) {
|
||||
if (menuDepthToSort == 0) return;
|
||||
|
||||
SortedMap<String, Preference> preferences = new TreeMap<>();
|
||||
for (int i = 0, prefCount = group.getPreferenceCount(); i < prefCount; i++) {
|
||||
Preference preference = group.getPreference(i);
|
||||
if (preference instanceof PreferenceGroup) {
|
||||
sortPreferenceGroupByTitle((PreferenceGroup) preference, menuDepthToSort - 1);
|
||||
}
|
||||
preferences.put(removePunctuationConvertToLowercase(preference.getTitle()), preference);
|
||||
}
|
||||
|
||||
int prefIndex = 0;
|
||||
for (Preference pref : preferences.values()) {
|
||||
int indexToSet = prefIndex++;
|
||||
if (pref instanceof PreferenceGroup || pref.getIntent() != null) {
|
||||
// Place preference groups last.
|
||||
// Use an offset to push the group to the end.
|
||||
indexToSet += 1000;
|
||||
}
|
||||
pref.setOrder(indexToSet);
|
||||
}
|
||||
}
|
||||
|
||||
public static String removePunctuationConvertToLowercase(CharSequence original) {
|
||||
public static String removePunctuationConvertToLowercase(@Nullable CharSequence original) {
|
||||
if (original == null) return "";
|
||||
return punctuationRegex.replace(original, "").toLowerCase();
|
||||
}
|
||||
|
||||
public enum NetworkType {
|
||||
NONE,
|
||||
MOBILE,
|
||||
OTHER,
|
||||
/**
|
||||
* Sort a PreferenceGroup and all it's sub groups by title or key.
|
||||
*
|
||||
* Sort order is determined by the preferences key {@link Sort} suffix.
|
||||
*
|
||||
* If a preference has no key or no {@link Sort} suffix,
|
||||
* then the preferences are left unsorted.
|
||||
*/
|
||||
public static void sortPreferenceGroups(@NonNull PreferenceGroup group) {
|
||||
Sort sort = Sort.fromKey(group.getKey());
|
||||
SortedMap<String, Preference> preferences = new TreeMap<>();
|
||||
|
||||
for (int i = 0, prefCount = group.getPreferenceCount(); i < prefCount; i++) {
|
||||
Preference preference = group.getPreference(i);
|
||||
|
||||
if (preference instanceof PreferenceGroup) {
|
||||
sortPreferenceGroups((PreferenceGroup) preference);
|
||||
}
|
||||
|
||||
final String sortValue;
|
||||
switch (sort) {
|
||||
case BY_TITLE:
|
||||
sortValue = removePunctuationConvertToLowercase(preference.getTitle());
|
||||
break;
|
||||
case BY_KEY:
|
||||
sortValue = preference.getKey();
|
||||
break;
|
||||
case UNSORTED:
|
||||
continue; // Keep original sorting.
|
||||
default:
|
||||
throw new IllegalStateException();
|
||||
}
|
||||
|
||||
preferences.put(sortValue, preference);
|
||||
}
|
||||
|
||||
int index = 0;
|
||||
for (Preference pref : preferences.values()) {
|
||||
int order = index++;
|
||||
|
||||
// If the preference is a PreferenceScreen or is an intent preference, move to the top.
|
||||
if (pref instanceof PreferenceScreen || pref.getIntent() != null) {
|
||||
// Arbitrary high number.
|
||||
order -= 1000;
|
||||
}
|
||||
|
||||
pref.setOrder(order);
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
@@ -97,7 +97,7 @@ public abstract class Setting<T> {
|
||||
@NonNull
|
||||
private static List<Setting<?>> allLoadedSettingsSorted() {
|
||||
Collections.sort(SETTINGS, (Setting<?> o1, Setting<?> o2) -> o1.key.compareTo(o2.key));
|
||||
return Collections.unmodifiableList(SETTINGS);
|
||||
return allLoadedSettings();
|
||||
}
|
||||
|
||||
/**
|
||||
@@ -131,6 +131,7 @@ public abstract class Setting<T> {
|
||||
|
||||
/**
|
||||
* Confirmation message to display, if the user tries to change the setting from the default value.
|
||||
* Currently this works only for Boolean setting types.
|
||||
*/
|
||||
@Nullable
|
||||
public final StringRef userDialogMessage;
|
||||
@@ -206,10 +207,9 @@ public abstract class Setting<T> {
|
||||
/**
|
||||
* Migrate a setting value if the path is renamed but otherwise the old and new settings are identical.
|
||||
*/
|
||||
public static void migrateOldSettingToNew(@NonNull Setting<?> oldSetting, @NonNull Setting newSetting) {
|
||||
public static <T> void migrateOldSettingToNew(@NonNull Setting<T> oldSetting, @NonNull Setting<T> newSetting) {
|
||||
if (!oldSetting.isSetToDefault()) {
|
||||
Logger.printInfo(() -> "Migrating old setting value: " + oldSetting + " into replacement setting: " + newSetting);
|
||||
//noinspection unchecked
|
||||
newSetting.save(oldSetting.value);
|
||||
oldSetting.resetToDefault();
|
||||
}
|
||||
|
||||
@@ -7,6 +7,8 @@ import android.content.SharedPreferences;
|
||||
import android.os.Bundle;
|
||||
import android.preference.*;
|
||||
import androidx.annotation.NonNull;
|
||||
import androidx.annotation.Nullable;
|
||||
|
||||
import app.revanced.integrations.shared.Logger;
|
||||
import app.revanced.integrations.shared.Utils;
|
||||
import app.revanced.integrations.shared.settings.BooleanSetting;
|
||||
@@ -25,6 +27,13 @@ public abstract class AbstractPreferenceFragment extends PreferenceFragment {
|
||||
*/
|
||||
public static boolean settingImportInProgress;
|
||||
|
||||
/**
|
||||
* Confirm and restart dialog button text and title.
|
||||
* Set by subclasses if Strings cannot be added as a resource.
|
||||
*/
|
||||
@Nullable
|
||||
protected static String restartDialogButtonText, restartDialogTitle, confirmDialogTitle;
|
||||
|
||||
/**
|
||||
* Used to prevent showing reboot dialog, if user cancels a setting user dialog.
|
||||
*/
|
||||
@@ -76,15 +85,19 @@ public abstract class AbstractPreferenceFragment extends PreferenceFragment {
|
||||
|
||||
if (identifier == 0) return;
|
||||
addPreferencesFromResource(identifier);
|
||||
Utils.sortPreferenceGroupByTitle(getPreferenceScreen(), 2);
|
||||
Utils.sortPreferenceGroups(getPreferenceScreen());
|
||||
}
|
||||
|
||||
private void showSettingUserDialogConfirmation(SwitchPreference switchPref, BooleanSetting setting) {
|
||||
final var context = getContext();
|
||||
Utils.verifyOnMainThread();
|
||||
|
||||
final var context = getContext();
|
||||
if (confirmDialogTitle == null) {
|
||||
confirmDialogTitle = str("revanced_settings_confirm_user_dialog_title");
|
||||
}
|
||||
showingUserDialogMessage = true;
|
||||
new AlertDialog.Builder(context)
|
||||
.setTitle(str("revanced_settings_confirm_user_dialog_title"))
|
||||
.setTitle(confirmDialogTitle)
|
||||
.setMessage(setting.userDialogMessage.toString())
|
||||
.setPositiveButton(android.R.string.ok, (dialog, id) -> {
|
||||
if (setting.rebootApp) {
|
||||
@@ -201,12 +214,17 @@ public abstract class AbstractPreferenceFragment extends PreferenceFragment {
|
||||
}
|
||||
|
||||
public static void showRestartDialog(@NonNull final Context context) {
|
||||
String positiveButton = str("revanced_settings_restart");
|
||||
|
||||
new AlertDialog.Builder(context).setMessage(str("revanced_settings_restart_title"))
|
||||
.setPositiveButton(positiveButton, (dialog, id) -> {
|
||||
Utils.restartApp(context);
|
||||
})
|
||||
Utils.verifyOnMainThread();
|
||||
if (restartDialogTitle == null) {
|
||||
restartDialogTitle = str("revanced_settings_restart_title");
|
||||
}
|
||||
if (restartDialogButtonText == null) {
|
||||
restartDialogButtonText = str("revanced_settings_restart");
|
||||
}
|
||||
new AlertDialog.Builder(context)
|
||||
.setMessage(restartDialogTitle)
|
||||
.setPositiveButton(restartDialogButtonText, (dialog, id)
|
||||
-> Utils.restartApp(context))
|
||||
.setNegativeButton(android.R.string.cancel, null)
|
||||
.setCancelable(false)
|
||||
.show();
|
||||
|
||||
@@ -0,0 +1,42 @@
|
||||
package app.revanced.integrations.syncforreddit;
|
||||
|
||||
import android.os.StrictMode;
|
||||
import app.revanced.integrations.shared.Logger;
|
||||
|
||||
import java.net.HttpURLConnection;
|
||||
import java.net.URL;
|
||||
|
||||
public final class FixSLinksPatch {
|
||||
public static String resolveSLink(String link) {
|
||||
if (link.matches(".*reddit\\.com/r/[^/]+/s/[^/]+")) {
|
||||
Logger.printInfo(() -> "Resolving " + link);
|
||||
try {
|
||||
URL url = new URL(link);
|
||||
HttpURLConnection connection = (HttpURLConnection) url.openConnection();
|
||||
connection.setInstanceFollowRedirects(false);
|
||||
connection.setRequestMethod("HEAD");
|
||||
|
||||
// Disable strict mode in order to allow network access on the main thread.
|
||||
// This is not ideal, but it's the easiest solution for now.
|
||||
final var currentPolicy = StrictMode.getThreadPolicy();
|
||||
StrictMode.ThreadPolicy policy = new StrictMode.ThreadPolicy.Builder().permitAll().build();
|
||||
StrictMode.setThreadPolicy(policy);
|
||||
|
||||
connection.connect();
|
||||
String location = connection.getHeaderField("location");
|
||||
connection.disconnect();
|
||||
|
||||
// Restore the original strict mode policy.
|
||||
StrictMode.setThreadPolicy(currentPolicy);
|
||||
|
||||
Logger.printInfo(() -> "Resolved " + link + " -> " + location);
|
||||
|
||||
return location;
|
||||
} catch (Exception e) {
|
||||
Logger.printException(() -> "Failed to resolve " + link, e);
|
||||
}
|
||||
}
|
||||
|
||||
return link;
|
||||
}
|
||||
}
|
||||
@@ -17,6 +17,12 @@ public class ReVancedPreferenceFragment extends AbstractPreferenceFragment {
|
||||
protected void initialize() {
|
||||
final var context = getContext();
|
||||
|
||||
// Currently no resources can be compiled for TikTok (fails with aapt error).
|
||||
// So all TikTok Strings are hard coded in integrations.
|
||||
restartDialogTitle = "Refresh and restart";
|
||||
restartDialogButtonText = "Restart";
|
||||
confirmDialogTitle = "Do you wish to proceed?";
|
||||
|
||||
PreferenceScreen preferenceScreen = getPreferenceManager().createPreferenceScreen(context);
|
||||
setPreferenceScreen(preferenceScreen);
|
||||
|
||||
|
||||
@@ -28,7 +28,7 @@ public class AppCompatActivityHook {
|
||||
public static void startSettingsActivity() {
|
||||
Logger.printDebug(() -> "Launching ReVanced settings");
|
||||
|
||||
final var context = app.revanced.integrations.shared.Utils.getContext();
|
||||
final var context = Utils.getContext();
|
||||
|
||||
if (context != null) {
|
||||
Intent intent = new Intent(context, SettingsActivity.class);
|
||||
|
||||
@@ -6,4 +6,4 @@ abstract class BaseJsonHook : JsonHook {
|
||||
abstract fun apply(json: JSONObject)
|
||||
|
||||
override fun transform(json: JSONObject) = json.apply { apply(json) }
|
||||
}
|
||||
}
|
||||
|
||||
@@ -12,4 +12,4 @@ interface JsonHook : Hook<JSONObject> {
|
||||
fun transform(json: JSONObject): JSONObject
|
||||
|
||||
override fun hook(type: JSONObject) = transform(type)
|
||||
}
|
||||
}
|
||||
|
||||
@@ -27,4 +27,4 @@ object JsonHookPatch {
|
||||
|
||||
return StreamUtils.fromString(jsonObject.toString())
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
@@ -6,4 +6,4 @@ interface Hook<T> {
|
||||
* @param type The type to hook
|
||||
*/
|
||||
fun hook(type: T): T
|
||||
}
|
||||
}
|
||||
|
||||
@@ -4,7 +4,6 @@ import app.revanced.integrations.twitter.patches.hook.json.BaseJsonHook
|
||||
import app.revanced.integrations.twitter.patches.hook.twifucker.TwiFucker
|
||||
import org.json.JSONObject
|
||||
|
||||
|
||||
object AdsHook : BaseJsonHook() {
|
||||
/**
|
||||
* Strips JSONObject from promoted ads.
|
||||
@@ -12,4 +11,4 @@ object AdsHook : BaseJsonHook() {
|
||||
* @param json The JSONObject.
|
||||
*/
|
||||
override fun apply(json: JSONObject) = TwiFucker.hidePromotedAds(json)
|
||||
}
|
||||
}
|
||||
|
||||
@@ -11,4 +11,4 @@ object DummyHook : BaseJsonHook() {
|
||||
override fun apply(json: JSONObject) {
|
||||
// Do nothing.
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
@@ -4,7 +4,6 @@ import app.revanced.integrations.twitter.patches.hook.json.BaseJsonHook
|
||||
import app.revanced.integrations.twitter.patches.hook.twifucker.TwiFucker
|
||||
import org.json.JSONObject
|
||||
|
||||
|
||||
object RecommendedUsersHook : BaseJsonHook() {
|
||||
/**
|
||||
* Strips JSONObject from recommended users.
|
||||
@@ -12,4 +11,4 @@ object RecommendedUsersHook : BaseJsonHook() {
|
||||
* @param json The JSONObject.
|
||||
*/
|
||||
override fun apply(json: JSONObject) = TwiFucker.hideRecommendedUsers(json)
|
||||
}
|
||||
}
|
||||
|
||||
@@ -9,8 +9,7 @@ import org.json.JSONObject
|
||||
// https://raw.githubusercontent.com/Dr-TSNG/TwiFucker/880cdf1c1622e54ab45561ffcb4f53d94ed97bae/app/src/main/java/icu/nullptr/twifucker/hook/JsonHook.kt
|
||||
internal object TwiFucker {
|
||||
// root
|
||||
private fun JSONObject.jsonGetInstructions(): JSONArray? =
|
||||
optJSONObject("timeline")?.optJSONArray("instructions")
|
||||
private fun JSONObject.jsonGetInstructions(): JSONArray? = optJSONObject("timeline")?.optJSONArray("instructions")
|
||||
|
||||
private fun JSONObject.jsonGetData(): JSONObject? = optJSONObject("data")
|
||||
|
||||
@@ -42,10 +41,12 @@ internal object TwiFucker {
|
||||
|
||||
// data
|
||||
private fun JSONObject.dataGetInstructions(): JSONArray? {
|
||||
val timeline = optJSONObject("user_result")?.optJSONObject("result")
|
||||
?.optJSONObject("timeline_response")?.optJSONObject("timeline")
|
||||
?: optJSONObject("timeline_response")?.optJSONObject("timeline")
|
||||
?: optJSONObject("timeline_response")
|
||||
val timeline =
|
||||
optJSONObject("user_result")?.optJSONObject("result")
|
||||
?.optJSONObject("timeline_response")?.optJSONObject("timeline")
|
||||
?: optJSONObject("timeline_response")?.optJSONObject("timeline")
|
||||
?: optJSONObject("search")?.optJSONObject("timeline_response")?.optJSONObject("timeline")
|
||||
?: optJSONObject("timeline_response")
|
||||
return timeline?.optJSONArray("instructions")
|
||||
}
|
||||
|
||||
@@ -64,7 +65,6 @@ internal object TwiFucker {
|
||||
}
|
||||
}?.optJSONObject("legacy")
|
||||
|
||||
|
||||
// entry
|
||||
private fun JSONObject.entryHasPromotedMetadata(): Boolean =
|
||||
optJSONObject("content")?.optJSONObject("item")?.optJSONObject("content")
|
||||
@@ -77,11 +77,9 @@ internal object TwiFucker {
|
||||
optJSONObject("content")?.optJSONArray("items")
|
||||
?: optJSONObject("content")?.optJSONObject("timelineModule")?.optJSONArray("items")
|
||||
|
||||
private fun JSONObject.entryIsTweetDetailRelatedTweets(): Boolean =
|
||||
optString("entryId").startsWith("tweetdetailrelatedtweets-")
|
||||
private fun JSONObject.entryIsTweetDetailRelatedTweets(): Boolean = optString("entryId").startsWith("tweetdetailrelatedtweets-")
|
||||
|
||||
private fun JSONObject.entryGetTrends(): JSONArray? =
|
||||
optJSONObject("content")?.optJSONObject("timelineModule")?.optJSONArray("items")
|
||||
private fun JSONObject.entryGetTrends(): JSONArray? = optJSONObject("content")?.optJSONObject("timelineModule")?.optJSONArray("items")
|
||||
|
||||
// trend
|
||||
private fun JSONObject.trendHasPromotedMetadata(): Boolean =
|
||||
@@ -104,8 +102,7 @@ internal object TwiFucker {
|
||||
// instruction
|
||||
private fun JSONObject.instructionTimelineAddEntries(): JSONArray? = optJSONArray("entries")
|
||||
|
||||
private fun JSONObject.instructionGetAddEntries(): JSONArray? =
|
||||
optJSONObject("addEntries")?.optJSONArray("entries")
|
||||
private fun JSONObject.instructionGetAddEntries(): JSONArray? = optJSONObject("addEntries")?.optJSONArray("entries")
|
||||
|
||||
private fun JSONObject.instructionCheckAndRemove(action: (JSONArray) -> Unit) {
|
||||
instructionTimelineAddEntries()?.let(action)
|
||||
@@ -164,9 +161,10 @@ internal object TwiFucker {
|
||||
entriesRemoveTweetDetailRelatedTweets()
|
||||
}
|
||||
|
||||
private fun JSONObject.entryIsWhoToFollow(): Boolean = optString("entryId").let {
|
||||
it.startsWith("whoToFollow-") || it.startsWith("who-to-follow-") || it.startsWith("connect-module-")
|
||||
}
|
||||
private fun JSONObject.entryIsWhoToFollow(): Boolean =
|
||||
optString("entryId").let {
|
||||
it.startsWith("whoToFollow-") || it.startsWith("who-to-follow-") || it.startsWith("connect-module-")
|
||||
}
|
||||
|
||||
private fun JSONObject.itemContainsPromotedUser(): Boolean =
|
||||
optJSONObject("item")?.optJSONObject("content")
|
||||
@@ -217,4 +215,4 @@ internal object TwiFucker {
|
||||
instruction.instructionCheckAndRemove(action)
|
||||
}
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
@@ -0,0 +1,12 @@
|
||||
package app.revanced.integrations.twitter.patches.links;
|
||||
|
||||
import android.content.Context;
|
||||
import android.content.Intent;
|
||||
|
||||
public final class OpenLinksWithAppChooserPatch {
|
||||
public static void openWithChooser(final Context context, final Intent intent) {
|
||||
intent.setAction("android.intent.action.VIEW");
|
||||
|
||||
context.startActivity(Intent.createChooser(intent, null));
|
||||
}
|
||||
}
|
||||
@@ -10,4 +10,4 @@ object JsonUtils {
|
||||
@JvmStatic
|
||||
@Throws(IOException::class, JSONException::class)
|
||||
fun parseJson(jsonInputStream: InputStream) = JSONObject(StreamUtils.toString(jsonInputStream))
|
||||
}
|
||||
}
|
||||
|
||||
@@ -21,4 +21,4 @@ object StreamUtils {
|
||||
fun fromString(string: String): InputStream {
|
||||
return ByteArrayInputStream(string.toByteArray())
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
@@ -27,4 +27,3 @@ class Event<T> {
|
||||
observer.invoke(value)
|
||||
}
|
||||
}
|
||||
|
||||
|
||||
@@ -231,47 +231,57 @@ public abstract class TrieSearch<T> {
|
||||
}
|
||||
|
||||
/**
|
||||
* This method is static and uses a loop to avoid all recursion.
|
||||
* This is done for performance since the JVM does not do tail recursion optimization.
|
||||
*
|
||||
* @param startNode Node to start the search from.
|
||||
* @param searchText Text to search for patterns in.
|
||||
* @param searchTextLength Length of the search text.
|
||||
* @param searchTextIndex Current recursive search text index. Also, the end index of the current pattern match.
|
||||
* @param currentMatchLength current search depth, and also the length of the current pattern match.
|
||||
* @return If any pattern matches, and it's associated callback halted the search.
|
||||
*/
|
||||
private boolean matches(T searchText, int searchTextLength, int searchTextIndex, int currentMatchLength,
|
||||
Object callbackParameter) {
|
||||
if (leaf != null && leaf.matches(this,
|
||||
searchText, searchTextLength, searchTextIndex, callbackParameter)) {
|
||||
return true; // Leaf exists and it matched the search text.
|
||||
}
|
||||
if (endOfPatternCallback != null) {
|
||||
final int matchStartIndex = searchTextIndex - currentMatchLength;
|
||||
for (@Nullable TriePatternMatchedCallback<T> callback : endOfPatternCallback) {
|
||||
if (callback == null) {
|
||||
return true; // No callback and all matches are valid.
|
||||
}
|
||||
if (callback.patternMatched(searchText, matchStartIndex, currentMatchLength, callbackParameter)) {
|
||||
return true; // Callback confirmed the match.
|
||||
private static <T> boolean matches(final TrieNode<T> startNode, final T searchText, final int searchTextLength,
|
||||
int searchTextIndex, final Object callbackParameter) {
|
||||
TrieNode<T> node = startNode;
|
||||
int currentMatchLength = 0;
|
||||
|
||||
while (true) {
|
||||
TrieCompressedPath<T> leaf = node.leaf;
|
||||
if (leaf != null && leaf.matches(node, searchText, searchTextLength, searchTextIndex, callbackParameter)) {
|
||||
return true; // Leaf exists and it matched the search text.
|
||||
}
|
||||
List<TriePatternMatchedCallback<T>> endOfPatternCallback = node.endOfPatternCallback;
|
||||
if (endOfPatternCallback != null) {
|
||||
final int matchStartIndex = searchTextIndex - currentMatchLength;
|
||||
for (@Nullable TriePatternMatchedCallback<T> callback : endOfPatternCallback) {
|
||||
if (callback == null) {
|
||||
return true; // No callback and all matches are valid.
|
||||
}
|
||||
if (callback.patternMatched(searchText, matchStartIndex, currentMatchLength, callbackParameter)) {
|
||||
return true; // Callback confirmed the match.
|
||||
}
|
||||
}
|
||||
}
|
||||
}
|
||||
if (children == null) {
|
||||
return false; // Reached a graph end point and there's no further patterns to search.
|
||||
}
|
||||
if (searchTextIndex == searchTextLength) {
|
||||
return false; // Reached end of the search text and found no matches.
|
||||
}
|
||||
TrieNode<T>[] children = node.children;
|
||||
if (children == null) {
|
||||
return false; // Reached a graph end point and there's no further patterns to search.
|
||||
}
|
||||
if (searchTextIndex == searchTextLength) {
|
||||
return false; // Reached end of the search text and found no matches.
|
||||
}
|
||||
|
||||
final char character = getCharValue(searchText, searchTextIndex);
|
||||
if (isInvalidRange(character)) {
|
||||
return false; // Not an ASCII letter/number/symbol.
|
||||
// Use the start node to reduce VM method lookup, since all nodes are the same class type.
|
||||
final char character = startNode.getCharValue(searchText, searchTextIndex);
|
||||
final int arrayIndex = hashIndexForTableSize(children.length, character);
|
||||
TrieNode<T> child = children[arrayIndex];
|
||||
if (child == null || child.nodeValue != character) {
|
||||
return false;
|
||||
}
|
||||
|
||||
node = child;
|
||||
searchTextIndex++;
|
||||
currentMatchLength++;
|
||||
}
|
||||
final int arrayIndex = hashIndexForTableSize(children.length, character);
|
||||
TrieNode<T> child = children[arrayIndex];
|
||||
if (child == null || child.nodeValue != character) {
|
||||
return false;
|
||||
}
|
||||
return child.matches(searchText, searchTextLength, searchTextIndex + 1,
|
||||
currentMatchLength + 1, callbackParameter);
|
||||
}
|
||||
|
||||
/**
|
||||
@@ -388,7 +398,7 @@ public abstract class TrieSearch<T> {
|
||||
return false; // No patterns were added.
|
||||
}
|
||||
for (int i = startIndex; i < endIndex; i++) {
|
||||
if (root.matches(textToSearch, endIndex, i, 0, callbackParameter)) return true;
|
||||
if (TrieNode.matches(root, textToSearch, endIndex, i, callbackParameter)) return true;
|
||||
}
|
||||
return false;
|
||||
}
|
||||
|
||||
Some files were not shown because too many files have changed in this diff Show More
Reference in New Issue
Block a user