From 38d9299dfe53aacd0338a507ade2f360f0d2a3f1 Mon Sep 17 00:00:00 2001 From: LisoUseInAIKyrios <118716522+LisoUseInAIKyrios@users.noreply.github.com> Date: Thu, 30 Oct 2025 09:26:18 +0100 Subject: [PATCH] chore: Add branding license text file (#6179) --- .../layout/branding/AddBrandLicensePatch.kt | 25 +++++++++++++++++++ .../branding/BaseCustomBrandingPatch.kt | 1 + .../shared/misc/settings/SettingsPatch.kt | 7 +++++- .../tiktok/misc/settings/SettingsPatch.kt | 3 ++- .../branding/header/ChangeHeaderPatch.kt | 6 ++++- .../branding-license/LICENSE_REVANCED.TXT | 5 ++++ 6 files changed, 44 insertions(+), 3 deletions(-) create mode 100644 patches/src/main/kotlin/app/revanced/patches/shared/layout/branding/AddBrandLicensePatch.kt create mode 100644 patches/src/main/resources/branding-license/LICENSE_REVANCED.TXT diff --git a/patches/src/main/kotlin/app/revanced/patches/shared/layout/branding/AddBrandLicensePatch.kt b/patches/src/main/kotlin/app/revanced/patches/shared/layout/branding/AddBrandLicensePatch.kt new file mode 100644 index 000000000..629a53e2e --- /dev/null +++ b/patches/src/main/kotlin/app/revanced/patches/shared/layout/branding/AddBrandLicensePatch.kt @@ -0,0 +1,25 @@ +package app.revanced.patches.shared.layout.branding + +import app.revanced.patcher.patch.rawResourcePatch +import app.revanced.util.inputStreamFromBundledResource +import java.nio.file.Files + +/** + * Copies a branding license text file to the target apk. + * + * This patch must be a dependency for all patches that add ReVanced branding to the target app. + */ +internal val addBrandLicensePatch = rawResourcePatch { + execute { + val brandingLicenseFileName = "LICENSE_REVANCED.TXT" + + val inputFileStream = inputStreamFromBundledResource( + "branding-license", + brandingLicenseFileName + )!! + + val targetFile = get(brandingLicenseFileName, false).toPath() + + Files.copy(inputFileStream, targetFile) + } +} diff --git a/patches/src/main/kotlin/app/revanced/patches/shared/layout/branding/BaseCustomBrandingPatch.kt b/patches/src/main/kotlin/app/revanced/patches/shared/layout/branding/BaseCustomBrandingPatch.kt index d3e718085..a2b88d7f1 100644 --- a/patches/src/main/kotlin/app/revanced/patches/shared/layout/branding/BaseCustomBrandingPatch.kt +++ b/patches/src/main/kotlin/app/revanced/patches/shared/layout/branding/BaseCustomBrandingPatch.kt @@ -123,6 +123,7 @@ internal fun baseCustomBrandingPatch( dependsOn( addResourcesPatch, resourceMappingPatch, + addBrandLicensePatch, bytecodePatch { execute { mainActivityOnCreateFingerprint.method.addInstruction( diff --git a/patches/src/main/kotlin/app/revanced/patches/shared/misc/settings/SettingsPatch.kt b/patches/src/main/kotlin/app/revanced/patches/shared/misc/settings/SettingsPatch.kt index 9d13d1e55..c721044cc 100644 --- a/patches/src/main/kotlin/app/revanced/patches/shared/misc/settings/SettingsPatch.kt +++ b/patches/src/main/kotlin/app/revanced/patches/shared/misc/settings/SettingsPatch.kt @@ -6,6 +6,7 @@ import app.revanced.patcher.patch.resourcePatch import app.revanced.patches.all.misc.resources.addResource import app.revanced.patches.all.misc.resources.addResources import app.revanced.patches.all.misc.resources.addResourcesPatch +import app.revanced.patches.shared.layout.branding.addBrandLicensePatch import app.revanced.patches.shared.misc.settings.preference.BasePreference import app.revanced.patches.shared.misc.settings.preference.IntentPreference import app.revanced.patches.shared.misc.settings.preference.PreferenceCategory @@ -61,7 +62,11 @@ fun settingsPatch ( rootPreferences: List>? = null, preferences: Set, ) = resourcePatch { - dependsOn(addResourcesPatch, settingsColorPatch) + dependsOn( + addResourcesPatch, + settingsColorPatch, + addBrandLicensePatch + ) execute { copyResources( diff --git a/patches/src/main/kotlin/app/revanced/patches/tiktok/misc/settings/SettingsPatch.kt b/patches/src/main/kotlin/app/revanced/patches/tiktok/misc/settings/SettingsPatch.kt index 3b4840a83..bc6cc2bff 100644 --- a/patches/src/main/kotlin/app/revanced/patches/tiktok/misc/settings/SettingsPatch.kt +++ b/patches/src/main/kotlin/app/revanced/patches/tiktok/misc/settings/SettingsPatch.kt @@ -5,6 +5,7 @@ import app.revanced.patcher.extensions.InstructionExtensions.addInstructionsWith import app.revanced.patcher.extensions.InstructionExtensions.getInstruction import app.revanced.patcher.patch.bytecodePatch import app.revanced.patcher.util.smali.ExternalLabel +import app.revanced.patches.shared.layout.branding.addBrandLicensePatch import app.revanced.patches.tiktok.misc.extension.sharedExtensionPatch import com.android.tools.smali.dexlib2.Opcode import com.android.tools.smali.dexlib2.iface.instruction.formats.Instruction22c @@ -18,7 +19,7 @@ val settingsPatch = bytecodePatch( name = "Settings", description = "Adds ReVanced settings to TikTok.", ) { - dependsOn(sharedExtensionPatch) + dependsOn(sharedExtensionPatch, addBrandLicensePatch) compatibleWith( "com.ss.android.ugc.trill"("36.5.4"), diff --git a/patches/src/main/kotlin/app/revanced/patches/youtube/layout/branding/header/ChangeHeaderPatch.kt b/patches/src/main/kotlin/app/revanced/patches/youtube/layout/branding/header/ChangeHeaderPatch.kt index 1a5e131ba..a7b33cd48 100644 --- a/patches/src/main/kotlin/app/revanced/patches/youtube/layout/branding/header/ChangeHeaderPatch.kt +++ b/patches/src/main/kotlin/app/revanced/patches/youtube/layout/branding/header/ChangeHeaderPatch.kt @@ -9,6 +9,7 @@ import app.revanced.patcher.patch.stringOption import app.revanced.patcher.util.Document import app.revanced.patches.all.misc.resources.addResources import app.revanced.patches.all.misc.resources.addResourcesPatch +import app.revanced.patches.shared.layout.branding.addBrandLicensePatch import app.revanced.patches.shared.misc.mapping.get import app.revanced.patches.shared.misc.mapping.resourceMappingPatch import app.revanced.patches.shared.misc.mapping.resourceMappings @@ -54,7 +55,10 @@ private val customHeaderResourceFileNames = variants.map { variant -> private const val EXTENSION_CLASS_DESCRIPTOR = "Lapp/revanced/extension/youtube/patches/ChangeHeaderPatch;" private val changeHeaderBytecodePatch = bytecodePatch { - dependsOn(resourceMappingPatch) + dependsOn( + resourceMappingPatch, + addBrandLicensePatch + ) execute { // Verify images exist. Resources are not used during patching but extension code does. diff --git a/patches/src/main/resources/branding-license/LICENSE_REVANCED.TXT b/patches/src/main/resources/branding-license/LICENSE_REVANCED.TXT new file mode 100644 index 000000000..c32047dba --- /dev/null +++ b/patches/src/main/resources/branding-license/LICENSE_REVANCED.TXT @@ -0,0 +1,5 @@ +The ReVanced branding found in this software is copyrighted and not covered under the GPL. + +To use or distribute ReVanced branding, you must obtain permission by contacting branding@revanced.app + +For more information see https://github.com/ReVanced/revanced-branding