Skip to content

Commit 6f8d928

Browse files
authored
chore: Merge branch dev to main (#2943)
2 parents 86def3e + ab2260a commit 6f8d928

File tree

15 files changed

+185
-74
lines changed

15 files changed

+185
-74
lines changed

.github/workflows/sync_crowdin.yml

Lines changed: 39 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,39 @@
1+
name: Sync Crowdin
2+
3+
on:
4+
workflow_dispatch:
5+
schedule:
6+
- cron: 0 * 1 * *
7+
push:
8+
paths:
9+
- /src/main/resources/addresources/values/strings.xml
10+
11+
jobs:
12+
sync:
13+
name: Sync translations
14+
runs-on: ubuntu-latest
15+
steps:
16+
- name: Checkout
17+
uses: actions/checkout@v4
18+
with:
19+
fetch-depth: 0
20+
21+
- name: Sync translations
22+
uses: crowdin/github-action@v1
23+
with:
24+
config: crowdin.yml
25+
upload_sources: true
26+
upload_translations: false
27+
download_translations: true
28+
localization_branch_name: feat/translations
29+
create_pull_request: true
30+
pull_request_title: "chore: Sync translations"
31+
pull_request_body: "Sync translations from [crowdin.com/project/revanced](https://crowdin.com/project/revanced)"
32+
pull_request_base_branch_name: "dev"
33+
commit_message: "chore: Sync translations"
34+
github_user_name: revanced-bot
35+
github_user_email: [email protected]
36+
env:
37+
GITHUB_TOKEN: ${{ secrets.REPOSITORY_PUSH_ACCESS }}
38+
CROWDIN_PROJECT_ID: ${{ secrets.CROWDIN_PROJECT_ID }}
39+
CROWDIN_PERSONAL_TOKEN: ${{ secrets.CROWDIN_PERSONAL_TOKEN }}

CHANGELOG.md

Lines changed: 14 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -1,3 +1,17 @@
1+
# [4.5.0-dev.2](https://github.com/ReVanced/revanced-patches/compare/v4.5.0-dev.1...v4.5.0-dev.2) (2024-03-30)
2+
3+
4+
### Features
5+
6+
* **YouTube - GmsCore:** Require ignoring battery optimizations ([#2952](https://github.com/ReVanced/revanced-patches/issues/2952)) ([c0bef25](https://github.com/ReVanced/revanced-patches/commit/c0bef255909ca884838675ca6f7ac5b0e2e21730))
7+
8+
# [4.5.0-dev.1](https://github.com/ReVanced/revanced-patches/compare/v4.4.0...v4.5.0-dev.1) (2024-03-29)
9+
10+
11+
### Features
12+
13+
* **YouTube - Alternative thumbnails:** Selectively enable for home / subscription / search ([#2926](https://github.com/ReVanced/revanced-patches/issues/2926)) ([8549e1b](https://github.com/ReVanced/revanced-patches/commit/8549e1ba58ad1e1608f5e3ceacd31eeb94578949))
14+
115
# [4.4.0](https://github.com/ReVanced/revanced-patches/compare/v4.3.0...v4.4.0) (2024-03-27)
216

317

crowdin.yml

Lines changed: 8 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,8 @@
1+
project_id_env: "CROWDIN_PROJECT_ID"
2+
api_token_env: "CROWDIN_PERSONAL_TOKEN"
3+
4+
preserve_hierarchy: false
5+
files:
6+
- source: src/main/resources/addresources/values/strings.xml
7+
translation: src/main/resources/addresources/values-%android_code%/strings.xml
8+
skip_untranslated_strings: true

gradle.properties

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -1,4 +1,4 @@
11
org.gradle.parallel = true
22
org.gradle.caching = true
33
kotlin.code.style = official
4-
version = 4.4.0
4+
version = 4.5.0-dev.2

src/main/kotlin/app/revanced/patches/music/misc/gms/GmsCoreSupportPatch.kt

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -34,5 +34,5 @@ object GmsCoreSupportPatch : BaseGmsCoreSupportPatch(
3434
PrimeMethodFingerprint,
3535
),
3636
) {
37-
override val gmsCoreVendor by gmsCoreVendorGroupIdOption
37+
override val gmsCoreVendorGroupId by gmsCoreVendorGroupIdOption
3838
}

src/main/kotlin/app/revanced/patches/shared/misc/gms/BaseGmsCoreSupportPatch.kt

Lines changed: 19 additions & 15 deletions
Original file line numberDiff line numberDiff line change
@@ -2,7 +2,7 @@ package app.revanced.patches.shared.misc.gms
22

33
import app.revanced.patcher.PatchClass
44
import app.revanced.patcher.data.BytecodeContext
5-
import app.revanced.patcher.extensions.InstructionExtensions.addInstruction
5+
import app.revanced.patcher.extensions.InstructionExtensions.addInstructions
66
import app.revanced.patcher.extensions.InstructionExtensions.getInstructions
77
import app.revanced.patcher.extensions.InstructionExtensions.replaceInstruction
88
import app.revanced.patcher.fingerprint.MethodFingerprint
@@ -12,7 +12,7 @@ import app.revanced.patches.shared.misc.gms.BaseGmsCoreSupportPatch.Constants.AC
1212
import app.revanced.patches.shared.misc.gms.BaseGmsCoreSupportPatch.Constants.AUTHORITIES
1313
import app.revanced.patches.shared.misc.gms.BaseGmsCoreSupportPatch.Constants.PERMISSIONS
1414
import app.revanced.patches.shared.misc.gms.fingerprints.GmsCoreSupportFingerprint
15-
import app.revanced.patches.shared.misc.gms.fingerprints.GmsCoreSupportFingerprint.GET_GMS_CORE_VENDOR_METHOD_NAME
15+
import app.revanced.patches.shared.misc.gms.fingerprints.GmsCoreSupportFingerprint.GET_GMS_CORE_VENDOR_GROUP_ID_METHOD_NAME
1616
import app.revanced.util.exception
1717
import app.revanced.util.getReference
1818
import app.revanced.util.returnEarly
@@ -32,7 +32,7 @@ import com.android.tools.smali.dexlib2.util.MethodUtil
3232
* @param toPackageName The package name to fall back to if no custom package name is specified in patch options.
3333
* @param primeMethodFingerprint The fingerprint of the "prime" method that needs to be patched.
3434
* @param earlyReturnFingerprints The fingerprints of methods that need to be returned early.
35-
* @param mainActivityOnCreateFingerprint The fingerprint of the main activity's onCreate method.
35+
* @param mainActivityOnCreateFingerprint The fingerprint of the main activity onCreate method.
3636
* @param integrationsPatchDependency The patch responsible for the integrations.
3737
* @param gmsCoreSupportResourcePatch The corresponding resource patch that is used to patch the resources.
3838
* @param dependencies Additional dependencies of this patch.
@@ -60,15 +60,18 @@ abstract class BaseGmsCoreSupportPatch(
6060
integrationsPatchDependency,
6161
) + dependencies,
6262
compatiblePackages = compatiblePackages,
63-
fingerprints = setOf(GmsCoreSupportFingerprint, mainActivityOnCreateFingerprint) + fingerprints,
63+
fingerprints = setOf(
64+
GmsCoreSupportFingerprint,
65+
mainActivityOnCreateFingerprint,
66+
) + fingerprints,
6467
requiresIntegrations = true,
6568
) {
6669
init {
6770
// Manually register all options of the resource patch so that they are visible in the patch API.
6871
gmsCoreSupportResourcePatch.options.values.forEach(options::register)
6972
}
7073

71-
internal abstract val gmsCoreVendor: String?
74+
internal abstract val gmsCoreVendorGroupId: String?
7275

7376
override fun execute(context: BytecodeContext) {
7477
val packageName = ChangePackageNamePatch.setOrGetFallbackPackageName(toPackageName)
@@ -93,16 +96,17 @@ abstract class BaseGmsCoreSupportPatch(
9396
// Return these methods early to prevent the app from crashing.
9497
earlyReturnFingerprints.toList().returnEarly()
9598

96-
// Check the availability of GmsCore.
97-
mainActivityOnCreateFingerprint.result?.mutableMethod?.addInstruction(
98-
1, // Hack to not disturb other patches (such as the integrations patch).
99-
"invoke-static {}, Lapp/revanced/integrations/shared/GmsCoreSupport;->checkAvailability()V",
99+
// Verify GmsCore is installed and whitelisted for power optimizations and background usage.
100+
mainActivityOnCreateFingerprint.result?.mutableMethod?.addInstructions(
101+
1, // Hack to not disturb other patches (such as the YTMusic integrations patch).
102+
"invoke-static/range { p0 .. p0 }, Lapp/revanced/integrations/shared/GmsCoreSupport;->" +
103+
"checkGmsCore(Landroid/content/Context;)V",
100104
) ?: throw mainActivityOnCreateFingerprint.exception
101105

102106
// Change the vendor of GmsCore in ReVanced Integrations.
103107
GmsCoreSupportFingerprint.result?.mutableClass?.methods
104-
?.single { it.name == GET_GMS_CORE_VENDOR_METHOD_NAME }
105-
?.replaceInstruction(0, "const-string v0, \"$gmsCoreVendor\"")
108+
?.single { it.name == GET_GMS_CORE_VENDOR_GROUP_ID_METHOD_NAME }
109+
?.replaceInstruction(0, "const-string v0, \"$gmsCoreVendorGroupId\"")
106110
?: throw GmsCoreSupportFingerprint.exception
107111
}
108112

@@ -146,10 +150,10 @@ abstract class BaseGmsCoreSupportPatch(
146150
in PERMISSIONS,
147151
in ACTIONS,
148152
in AUTHORITIES,
149-
-> referencedString.replace("com.google", gmsCoreVendor!!)
153+
-> referencedString.replace("com.google", gmsCoreVendorGroupId!!)
150154

151155
// No vendor prefix for whatever reason...
152-
"subscribedfeeds" -> "$gmsCoreVendor.subscribedfeeds"
156+
"subscribedfeeds" -> "$gmsCoreVendorGroupId.subscribedfeeds"
153157
else -> null
154158
}
155159

@@ -162,15 +166,15 @@ abstract class BaseGmsCoreSupportPatch(
162166
if (str.startsWith(uriPrefix)) {
163167
return str.replace(
164168
uriPrefix,
165-
"content://${authority.replace("com.google", gmsCoreVendor!!)}",
169+
"content://${authority.replace("com.google", gmsCoreVendorGroupId!!)}",
166170
)
167171
}
168172
}
169173

170174
// gms also has a 'subscribedfeeds' authority, check for that one too
171175
val subFeedsUriPrefix = "content://subscribedfeeds"
172176
if (str.startsWith(subFeedsUriPrefix)) {
173-
return str.replace(subFeedsUriPrefix, "content://$gmsCoreVendor.subscribedfeeds")
177+
return str.replace(subFeedsUriPrefix, "content://$gmsCoreVendorGroupId.subscribedfeeds")
174178
}
175179
}
176180

src/main/kotlin/app/revanced/patches/shared/misc/gms/BaseGmsCoreSupportResourcePatch.kt

Lines changed: 0 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -121,7 +121,6 @@ abstract class BaseGmsCoreSupportResourcePatch(
121121
}
122122

123123
private companion object {
124-
private const val VANCED_VENDOR = "com.mgoogle"
125124
private const val PACKAGE_NAME_REGEX_PATTERN = "^[a-z]\\w*(\\.[a-z]\\w*)+\$"
126125
}
127126
}

src/main/kotlin/app/revanced/patches/shared/misc/gms/fingerprints/GmsCoreSupportFingerprint.kt

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -5,7 +5,7 @@ import app.revanced.patcher.fingerprint.MethodFingerprint
55
internal object GmsCoreSupportFingerprint : MethodFingerprint(
66
customFingerprint = { _, classDef ->
77
classDef.type.endsWith("GmsCoreSupport;")
8-
}
8+
},
99
) {
10-
const val GET_GMS_CORE_VENDOR_METHOD_NAME = "getGmsCoreVendor"
10+
const val GET_GMS_CORE_VENDOR_GROUP_ID_METHOD_NAME = "getGmsCoreVendorGroupId"
1111
}

src/main/kotlin/app/revanced/patches/youtube/interaction/downloads/DownloadsPatch.kt

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -14,7 +14,7 @@ import app.revanced.util.resultOrThrow
1414

1515
@Patch(
1616
name = "Downloads",
17-
description = "Adds support to download videos with an external downloader app" +
17+
description = "Adds support to download videos with an external downloader app " +
1818
"using the in-app download button or a video player action button.",
1919
dependencies = [
2020
DownloadsResourcePatch::class,

src/main/kotlin/app/revanced/patches/youtube/layout/thumbnails/AlternativeThumbnailsPatch.kt

Lines changed: 34 additions & 10 deletions
Original file line numberDiff line numberDiff line change
@@ -22,6 +22,8 @@ import app.revanced.patches.youtube.layout.thumbnails.fingerprints.cronet.reques
2222
import app.revanced.patches.youtube.layout.thumbnails.fingerprints.cronet.request.callback.OnResponseStartedFingerprint
2323
import app.revanced.patches.youtube.layout.thumbnails.fingerprints.cronet.request.callback.OnSucceededFingerprint
2424
import app.revanced.patches.youtube.misc.integrations.IntegrationsPatch
25+
import app.revanced.patches.youtube.misc.navigation.NavigationBarHookPatch
26+
import app.revanced.patches.youtube.misc.playertype.PlayerTypeHookPatch
2527
import app.revanced.patches.youtube.misc.settings.SettingsPatch
2628
import app.revanced.util.resultOrThrow
2729
import com.android.tools.smali.dexlib2.AccessFlags
@@ -38,6 +40,8 @@ import com.android.tools.smali.dexlib2.immutable.ImmutableMethod
3840
IntegrationsPatch::class,
3941
SettingsPatch::class,
4042
AddResourcesPatch::class,
43+
NavigationBarHookPatch::class,
44+
PlayerTypeHookPatch::class
4145
],
4246
compatiblePackages = [
4347
CompatiblePackage(
@@ -127,25 +131,45 @@ object AlternativeThumbnailsPatch : BytecodePatch(
127131
override fun execute(context: BytecodeContext) {
128132
AddResourcesPatch(this::class)
129133

134+
val entries = "revanced_alt_thumbnail_options_entries"
135+
val values = "revanced_alt_thumbnail_options_entry_values"
130136
SettingsPatch.PreferenceScreen.ALTERNATIVE_THUMBNAILS.addPreferences(
131-
NonInteractivePreference(
132-
"revanced_alt_thumbnail_about",
133-
null, // Summary is dynamically updated based on the current settings.
134-
tag = "app.revanced.integrations.youtube.settings.preference.AlternativeThumbnailsStatusPreference",
137+
ListPreference("revanced_alt_thumbnail_home",
138+
summaryKey = null,
139+
entriesKey = entries,
140+
entryValuesKey = values
141+
),
142+
ListPreference("revanced_alt_thumbnail_subscription",
143+
summaryKey = null,
144+
entriesKey = entries,
145+
entryValuesKey = values
146+
),
147+
ListPreference("revanced_alt_thumbnail_library",
148+
summaryKey = null,
149+
entriesKey = entries,
150+
entryValuesKey = values
151+
),
152+
ListPreference("revanced_alt_thumbnail_player",
153+
summaryKey = null,
154+
entriesKey = entries,
155+
entryValuesKey = values
156+
),
157+
ListPreference("revanced_alt_thumbnail_search",
158+
summaryKey = null,
159+
entriesKey = entries,
160+
entryValuesKey = values
135161
),
136-
SwitchPreference("revanced_alt_thumbnail_dearrow"),
137-
SwitchPreference("revanced_alt_thumbnail_dearrow_connection_toast"),
138-
TextPreference("revanced_alt_thumbnail_dearrow_api_url"),
139162
NonInteractivePreference(
140163
"revanced_alt_thumbnail_dearrow_about",
141164
// Custom about preference with link to the DeArrow website.
142165
tag = "app.revanced.integrations.youtube.settings.preference.AlternativeThumbnailsAboutDeArrowPreference",
143166
selectable = true,
144167
),
145-
SwitchPreference("revanced_alt_thumbnail_stills"),
146-
ListPreference("revanced_alt_thumbnail_stills_time", summaryKey = null),
147-
SwitchPreference("revanced_alt_thumbnail_stills_fast"),
168+
SwitchPreference("revanced_alt_thumbnail_dearrow_connection_toast"),
169+
TextPreference("revanced_alt_thumbnail_dearrow_api_url"),
148170
NonInteractivePreference("revanced_alt_thumbnail_stills_about"),
171+
SwitchPreference("revanced_alt_thumbnail_stills_fast"),
172+
ListPreference("revanced_alt_thumbnail_stills_time", summaryKey = null)
149173
)
150174

151175
fun MethodFingerprint.alsoResolve(fingerprint: MethodFingerprint) =

0 commit comments

Comments
 (0)