Skip to content

Commit 38d9299

Browse files
chore: Add branding license text file (#6179)
1 parent dfdbbfa commit 38d9299

File tree

6 files changed

+44
-3
lines changed

6 files changed

+44
-3
lines changed
Lines changed: 25 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,25 @@
1+
package app.revanced.patches.shared.layout.branding
2+
3+
import app.revanced.patcher.patch.rawResourcePatch
4+
import app.revanced.util.inputStreamFromBundledResource
5+
import java.nio.file.Files
6+
7+
/**
8+
* Copies a branding license text file to the target apk.
9+
*
10+
* This patch must be a dependency for all patches that add ReVanced branding to the target app.
11+
*/
12+
internal val addBrandLicensePatch = rawResourcePatch {
13+
execute {
14+
val brandingLicenseFileName = "LICENSE_REVANCED.TXT"
15+
16+
val inputFileStream = inputStreamFromBundledResource(
17+
"branding-license",
18+
brandingLicenseFileName
19+
)!!
20+
21+
val targetFile = get(brandingLicenseFileName, false).toPath()
22+
23+
Files.copy(inputFileStream, targetFile)
24+
}
25+
}

patches/src/main/kotlin/app/revanced/patches/shared/layout/branding/BaseCustomBrandingPatch.kt

Lines changed: 1 addition & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -123,6 +123,7 @@ internal fun baseCustomBrandingPatch(
123123
dependsOn(
124124
addResourcesPatch,
125125
resourceMappingPatch,
126+
addBrandLicensePatch,
126127
bytecodePatch {
127128
execute {
128129
mainActivityOnCreateFingerprint.method.addInstruction(

patches/src/main/kotlin/app/revanced/patches/shared/misc/settings/SettingsPatch.kt

Lines changed: 6 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -6,6 +6,7 @@ import app.revanced.patcher.patch.resourcePatch
66
import app.revanced.patches.all.misc.resources.addResource
77
import app.revanced.patches.all.misc.resources.addResources
88
import app.revanced.patches.all.misc.resources.addResourcesPatch
9+
import app.revanced.patches.shared.layout.branding.addBrandLicensePatch
910
import app.revanced.patches.shared.misc.settings.preference.BasePreference
1011
import app.revanced.patches.shared.misc.settings.preference.IntentPreference
1112
import app.revanced.patches.shared.misc.settings.preference.PreferenceCategory
@@ -61,7 +62,11 @@ fun settingsPatch (
6162
rootPreferences: List<Pair<BasePreference, String>>? = null,
6263
preferences: Set<BasePreference>,
6364
) = resourcePatch {
64-
dependsOn(addResourcesPatch, settingsColorPatch)
65+
dependsOn(
66+
addResourcesPatch,
67+
settingsColorPatch,
68+
addBrandLicensePatch
69+
)
6570

6671
execute {
6772
copyResources(

patches/src/main/kotlin/app/revanced/patches/tiktok/misc/settings/SettingsPatch.kt

Lines changed: 2 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -5,6 +5,7 @@ import app.revanced.patcher.extensions.InstructionExtensions.addInstructionsWith
55
import app.revanced.patcher.extensions.InstructionExtensions.getInstruction
66
import app.revanced.patcher.patch.bytecodePatch
77
import app.revanced.patcher.util.smali.ExternalLabel
8+
import app.revanced.patches.shared.layout.branding.addBrandLicensePatch
89
import app.revanced.patches.tiktok.misc.extension.sharedExtensionPatch
910
import com.android.tools.smali.dexlib2.Opcode
1011
import com.android.tools.smali.dexlib2.iface.instruction.formats.Instruction22c
@@ -18,7 +19,7 @@ val settingsPatch = bytecodePatch(
1819
name = "Settings",
1920
description = "Adds ReVanced settings to TikTok.",
2021
) {
21-
dependsOn(sharedExtensionPatch)
22+
dependsOn(sharedExtensionPatch, addBrandLicensePatch)
2223

2324
compatibleWith(
2425
"com.ss.android.ugc.trill"("36.5.4"),

patches/src/main/kotlin/app/revanced/patches/youtube/layout/branding/header/ChangeHeaderPatch.kt

Lines changed: 5 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -9,6 +9,7 @@ import app.revanced.patcher.patch.stringOption
99
import app.revanced.patcher.util.Document
1010
import app.revanced.patches.all.misc.resources.addResources
1111
import app.revanced.patches.all.misc.resources.addResourcesPatch
12+
import app.revanced.patches.shared.layout.branding.addBrandLicensePatch
1213
import app.revanced.patches.shared.misc.mapping.get
1314
import app.revanced.patches.shared.misc.mapping.resourceMappingPatch
1415
import app.revanced.patches.shared.misc.mapping.resourceMappings
@@ -54,7 +55,10 @@ private val customHeaderResourceFileNames = variants.map { variant ->
5455
private const val EXTENSION_CLASS_DESCRIPTOR = "Lapp/revanced/extension/youtube/patches/ChangeHeaderPatch;"
5556

5657
private val changeHeaderBytecodePatch = bytecodePatch {
57-
dependsOn(resourceMappingPatch)
58+
dependsOn(
59+
resourceMappingPatch,
60+
addBrandLicensePatch
61+
)
5862

5963
execute {
6064
// Verify images exist. Resources are not used during patching but extension code does.
Lines changed: 5 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,5 @@
1+
The ReVanced branding found in this software is copyrighted and not covered under the GPL.
2+
3+
To use or distribute ReVanced branding, you must obtain permission by contacting [email protected]
4+
5+
For more information see https://github.com/ReVanced/revanced-branding

0 commit comments

Comments
 (0)