Skip to content

Commit d9f0da4

Browse files
authored
Merge branch 'main' into ci/github-attest-slsa-l2
2 parents 98c4589 + 4c51ad3 commit d9f0da4

File tree

82 files changed

+607
-574
lines changed

Some content is hidden

Large Commits have some content hidden by default. Use the searchbox below for content that may be hidden.

82 files changed

+607
-574
lines changed

.github/workflows/release.yml

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -55,7 +55,7 @@ jobs:
5555

5656
- name: Setup keystore
5757
run: |
58-
echo "${{ secrets.KEYSTORE }}" | base64 --decode > "keystore.jks"
58+
echo "${{ secrets.KEYSTORE }}" | base64 --decode > "android/app/keystore.jks"
5959
6060
- name: Release
6161
env:

android/app/build.gradle.kts

Lines changed: 19 additions & 7 deletions
Original file line numberDiff line numberDiff line change
@@ -7,7 +7,7 @@ plugins {
77

88
android {
99
namespace = "app.revanced.manager.flutter"
10-
compileSdk = 34
10+
compileSdk = 35
1111
ndkVersion = "27.0.12077973"
1212

1313
compileOptions {
@@ -24,9 +24,19 @@ android {
2424
defaultConfig {
2525
applicationId = "app.revanced.manager.flutter"
2626
minSdk = 26
27-
targetSdk = 34
27+
targetSdk = 35
2828
versionCode = flutter.versionCode
2929
versionName = flutter.versionName
30+
31+
resValue("string", "app_name", "ReVanced Manager")
32+
}
33+
34+
applicationVariants.all {
35+
outputs.all {
36+
this as com.android.build.gradle.internal.api.ApkVariantOutputImpl
37+
38+
outputFileName = "revanced-manager-$versionName.apk"
39+
}
3040
}
3141

3242
buildTypes {
@@ -37,7 +47,6 @@ android {
3747
signingConfig = signingConfigs["debug"]
3848

3949
ndk.abiFilters += setOf("armeabi-v7a", "arm64-v8a", "x86_64")
40-
setProperty("archivesBaseName", "revanced-manager-v${flutter.versionName}")
4150
}
4251

4352
release {
@@ -52,19 +61,21 @@ android {
5261
keyAlias = System.getenv("KEYSTORE_ENTRY_ALIAS")
5362
keyPassword = System.getenv("KEYSTORE_ENTRY_PASSWORD")
5463
}
64+
65+
resValue("string", "app_name", "ReVanced Manager")
5566
} else {
56-
resValue("string", "app_name", "ReVanced Manager (Debug)")
5767
applicationIdSuffix = ".debug"
5868

5969
signingConfig = signingConfigs["debug"]
60-
}
6170

62-
resValue("string", "app_name", "ReVanced Manager")
71+
resValue("string", "app_name", "ReVanced Manager (Debug signed)")
72+
}
6373
}
6474

6575
debug {
66-
resValue("string", "app_name", "ReVanced Manager (Debug)")
6776
applicationIdSuffix = ".debug"
77+
78+
resValue("string", "app_name", "ReVanced Manager (Debug)")
6879
}
6980
}
7081

@@ -80,6 +91,7 @@ android {
8091
}
8192
}
8293

94+
8395
flutter {
8496
source = "../.."
8597
}

android/app/src/main/kotlin/app/revanced/manager/flutter/ExportSettingsActivity.kt

Lines changed: 2 additions & 4 deletions
Original file line numberDiff line numberDiff line change
@@ -3,7 +3,6 @@ package app.revanced.manager.flutter
33
import android.app.Activity
44
import android.content.Context
55
import android.content.Intent
6-
import android.content.pm.PackageInfo
76
import android.content.pm.PackageManager
87
import android.os.Bundle
98
import android.util.Base64
@@ -17,9 +16,8 @@ import java.security.MessageDigest
1716
class ExportSettingsActivity : Activity() {
1817
override fun onCreate(savedInstanceState: Bundle?) {
1918
super.onCreate(savedInstanceState)
20-
val callingPackageName = getCallingPackage()!!
2119

22-
if (getFingerprint(callingPackageName) == getFingerprint(getPackageName())) {
20+
if (getFingerprint(callingPackage!!) == getFingerprint(packageName)) {
2321
// Create JSON Object
2422
val json = JSONObject()
2523

@@ -64,7 +62,7 @@ class ExportSettingsActivity : Activity() {
6462
fun getFingerprint(packageName: String): String {
6563
// Get the signature of the app that matches the package name
6664
val packageInfo = packageManager.getPackageInfo(packageName, PackageManager.GET_SIGNATURES)
67-
val signature = packageInfo.signatures[0]
65+
val signature = packageInfo.signatures!![0]
6866

6967
// Get the raw certificate data
7068
val rawCert = signature.toByteArray()

android/app/src/main/kotlin/app/revanced/manager/flutter/MainActivity.kt

Lines changed: 28 additions & 29 deletions
Original file line numberDiff line numberDiff line change
@@ -9,14 +9,15 @@ import android.os.Handler
99
import android.os.Looper
1010
import app.revanced.library.ApkUtils
1111
import app.revanced.library.ApkUtils.applyTo
12+
import app.revanced.library.installation.installer.LocalInstaller
1213
import app.revanced.manager.flutter.utils.Aapt
1314
import app.revanced.manager.flutter.utils.packageInstaller.InstallerReceiver
1415
import app.revanced.manager.flutter.utils.packageInstaller.UninstallerReceiver
15-
import app.revanced.patcher.PatchBundleLoader
16-
import app.revanced.patcher.PatchSet
1716
import app.revanced.patcher.Patcher
1817
import app.revanced.patcher.PatcherConfig
18+
import app.revanced.patcher.patch.Patch
1919
import app.revanced.patcher.patch.PatchResult
20+
import app.revanced.patcher.patch.loadPatchesFromDex
2021
import io.flutter.embedding.android.FlutterActivity
2122
import io.flutter.embedding.engine.FlutterEngine
2223
import io.flutter.plugin.common.MethodChannel
@@ -37,7 +38,7 @@ class MainActivity : FlutterActivity() {
3738
private var cancel: Boolean = false
3839
private var stopResult: MethodChannel.Result? = null
3940

40-
private lateinit var patches: PatchSet
41+
private lateinit var patches: Set<Patch<*>>
4142

4243
override fun configureFlutterEngine(flutterEngine: FlutterEngine) {
4344
super.configureFlutterEngine(flutterEngine)
@@ -70,7 +71,6 @@ class MainActivity : FlutterActivity() {
7071
"runPatcher" -> {
7172
val inFilePath = call.argument<String>("inFilePath")
7273
val outFilePath = call.argument<String>("outFilePath")
73-
val integrationsPath = call.argument<String>("integrationsPath")
7474
val selectedPatches = call.argument<List<String>>("selectedPatches")
7575
val options = call.argument<Map<String, Map<String, Any>>>("options")
7676
val tmpDirPath = call.argument<String>("tmpDirPath")
@@ -80,7 +80,6 @@ class MainActivity : FlutterActivity() {
8080
if (
8181
inFilePath != null &&
8282
outFilePath != null &&
83-
integrationsPath != null &&
8483
selectedPatches != null &&
8584
options != null &&
8685
tmpDirPath != null &&
@@ -92,14 +91,17 @@ class MainActivity : FlutterActivity() {
9291
result,
9392
inFilePath,
9493
outFilePath,
95-
integrationsPath,
9694
selectedPatches,
9795
options,
9896
tmpDirPath,
9997
keyStoreFilePath,
10098
keystorePassword
10199
)
102-
} else result.notImplemented()
100+
} else result.error(
101+
"INVALID_ARGUMENTS",
102+
"Invalid arguments",
103+
"One or more arguments are missing"
104+
)
103105
}
104106

105107
"stopPatcher" -> {
@@ -113,14 +115,16 @@ class MainActivity : FlutterActivity() {
113115
try {
114116
val patchBundleFile = File(patchBundleFilePath)
115117
patchBundleFile.setWritable(false)
116-
patches = PatchBundleLoader.Dex(
117-
patchBundleFile,
118+
patches = loadPatchesFromDex(
119+
setOf(patchBundleFile),
118120
optimizedDexDirectory = codeCacheDir
119121
)
120-
} catch (ex: Exception) {
121-
return@setMethodCallHandler result.notImplemented()
122-
} catch (err: Error) {
123-
return@setMethodCallHandler result.notImplemented()
122+
} catch (t: Throwable) {
123+
return@setMethodCallHandler result.error(
124+
"PATCH_BUNDLE_ERROR",
125+
"Failed to load patch bundle",
126+
t.stackTraceToString()
127+
)
124128
}
125129

126130
JSONArray().apply {
@@ -130,13 +134,13 @@ class MainActivity : FlutterActivity() {
130134
put("description", it.description)
131135
put("excluded", !it.use)
132136
put("compatiblePackages", JSONArray().apply {
133-
it.compatiblePackages?.forEach { compatiblePackage ->
137+
it.compatiblePackages?.forEach { (name, versions) ->
134138
val compatiblePackageJson = JSONObject().apply {
135-
put("name", compatiblePackage.name)
139+
put("name", name)
136140
put(
137141
"versions",
138142
JSONArray().apply {
139-
compatiblePackage.versions?.forEach { version ->
143+
versions?.forEach { version ->
140144
put(version)
141145
}
142146
})
@@ -172,7 +176,7 @@ class MainActivity : FlutterActivity() {
172176
}
173177
})
174178
} ?: put("values", null)
175-
put("valueType", option.valueType)
179+
put("type", option.type)
176180
}.let(::put)
177181
}
178182
})
@@ -211,7 +215,6 @@ class MainActivity : FlutterActivity() {
211215
result: MethodChannel.Result,
212216
inFilePath: String,
213217
outFilePath: String,
214-
integrationsPath: String,
215218
selectedPatches: List<String>,
216219
options: Map<String, Map<String, Any>>,
217220
tmpDirPath: String,
@@ -223,7 +226,6 @@ class MainActivity : FlutterActivity() {
223226
inFile.setWritable(true)
224227
inFile.setReadable(true)
225228
val outFile = File(outFilePath)
226-
val integrations = File(integrationsPath)
227229
val keyStoreFile = File(keyStoreFilePath)
228230
val tmpDir = File(tmpDirPath)
229231

@@ -281,16 +283,15 @@ class MainActivity : FlutterActivity() {
281283
tmpDir,
282284
Aapt.binary(applicationContext).absolutePath,
283285
tmpDir.path,
284-
true // TODO: Add option to disable this
285286
)
286287
)
287288

288289
if (cancel(patcher::close)) return@Thread
289290
updateProgress(0.02, "Loading patches...", "Loading patches")
290291

291292
val patches = patches.filter { patch ->
292-
val isCompatible = patch.compatiblePackages?.any {
293-
it.name == patcher.context.packageMetadata.packageName
293+
val isCompatible = patch.compatiblePackages?.any { (name, _) ->
294+
name == patcher.context.packageMetadata.packageName
294295
} ?: false
295296

296297
val compatibleOrUniversal =
@@ -307,18 +308,15 @@ class MainActivity : FlutterActivity() {
307308
updateProgress(0.05, "Executing...", "")
308309

309310
val patcherResult = patcher.use {
310-
patcher.apply {
311-
acceptIntegrations(setOf(integrations))
312-
acceptPatches(patches)
313-
}
311+
it += patches
314312

315313
runBlocking {
316314
// Update the progress bar every time a patch is executed from 0.15 to 0.7
317315
val totalPatchesCount = patches.size
318316
val progressStep = 0.55 / totalPatchesCount
319317
var progress = 0.05
320318

321-
patcher.apply(false).collect(FlowCollector { patchResult: PatchResult ->
319+
patcher().collect(FlowCollector { patchResult: PatchResult ->
322320
if (cancel(patcher::close)) return@FlowCollector
323321

324322
val msg = patchResult.exception?.let {
@@ -346,10 +344,11 @@ class MainActivity : FlutterActivity() {
346344

347345
if (cancel(patcher::close)) return@Thread
348346

349-
ApkUtils.sign(
347+
ApkUtils.signApk(
350348
inFile,
351349
outFile,
352-
ApkUtils.SigningOptions(
350+
"ReVanced",
351+
ApkUtils.KeyStoreDetails(
353352
keyStoreFile,
354353
keystorePassword,
355354
"alias",

android/build.gradle.kts

Lines changed: 11 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -1,4 +1,5 @@
11
import com.android.build.api.dsl.CommonExtension
2+
import org.jetbrains.kotlin.gradle.tasks.KotlinCompile
23

34
allprojects {
45
repositories {
@@ -17,11 +18,20 @@ allprojects {
1718

1819
layout.buildDirectory = File("../build")
1920

21+
project(":screenshot_callback") {
22+
tasks.withType<KotlinCompile>().configureEach {
23+
kotlinOptions {
24+
jvmTarget = "17"
25+
}
26+
}
27+
}
28+
2029
subprojects {
2130
afterEvaluate {
2231
extensions.findByName("android")?.let {
2332
it as CommonExtension<*, *, *, *, *, *>
24-
it.compileSdk = 34
33+
if (it.compileSdk != null && it.compileSdk!! < 31)
34+
it.compileSdk = 34
2535
}
2636
}
2737

android/gradle.properties

Lines changed: 0 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -3,6 +3,5 @@ android.useAndroidX=true
33
org.gradle.parallel=true
44
org.gradle.daemon=true
55
org.gradle.caching=true
6-
android.defaults.buildfeatures.buildconfig=true
76
android.nonTransitiveRClass=false
87
android.nonFinalResIds=false

android/gradle/libs.versions.toml

Lines changed: 3 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -1,7 +1,7 @@
11
[versions]
2-
revanced-patcher = "19.3.1" # TODO: Update to non-dev
3-
revanced-library = "2.2.1"
4-
desugar_jdk_libs = "2.1.2"
2+
revanced-patcher = "21.0.0"
3+
revanced-library = "3.0.2"
4+
desugar_jdk_libs = "2.1.3"
55

66
[libraries]
77
revanced-patcher = { module = "app.revanced:revanced-patcher", version.ref = "revanced-patcher" }

android/settings.gradle.kts

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -17,7 +17,7 @@ pluginManagement {
1717

1818
plugins {
1919
id("dev.flutter.flutter-plugin-loader") version "1.0.0"
20-
id("com.android.application") version "8.7.0" apply false
20+
id("com.android.application") version "8.7.2" apply false
2121
id("org.jetbrains.kotlin.android") version "2.0.20" apply false
2222
}
2323

assets/i18n/strings.i18n.json

Lines changed: 9 additions & 5 deletions
Original file line numberDiff line numberDiff line change
@@ -158,20 +158,18 @@
158158
"languageLabel": "Language",
159159
"languageUpdated": "Language updated",
160160
"sourcesLabel": "Alternative sources",
161-
"sourcesLabelHint": "Configure the alternative sources for ReVanced Patches and ReVanced Integrations",
162-
"sourcesIntegrationsLabel": "Integrations source",
161+
"sourcesLabelHint": "Configure the alternative sources for ReVanced Patches",
163162
"useAlternativeSources": "Use alternative sources",
164-
"useAlternativeSourcesHint": "Use alternative sources for ReVanced Patches and ReVanced Integrations instead of the API",
163+
"useAlternativeSourcesHint": "Use alternative sources for ReVanced Patches instead of the API",
165164
"sourcesResetDialogTitle": "Reset",
166165
"sourcesResetDialogText": "Are you sure you want to reset your sources to their default values?",
167166
"apiURLResetDialogText": "Are you sure you want to reset your API URL to its default value?",
168-
"sourcesUpdateNote": "Note: This will automatically download ReVanced Patches and ReVanced Integrations from the alternative sources.\n\nThis will connect you to the alternative source.",
167+
"sourcesUpdateNote": "Note: This will automatically download ReVanced Patches from the alternative sources.\n\nThis will connect you to the alternative source.",
169168
"apiURLLabel": "API URL",
170169
"apiURLHint": "Configure the API URL of ReVanced Manager",
171170
"selectApiURL": "API URL",
172171
"orgPatchesLabel": "Patches organization",
173172
"sourcesPatchesLabel": "Patches source",
174-
"orgIntegrationsLabel": "Integrations organization",
175173
"contributorsLabel": "Contributors",
176174
"contributorsHint": "A list of contributors of ReVanced",
177175
"logsLabel": "Share logs",
@@ -199,6 +197,12 @@
199197
"deleteTempDirLabel": "Delete temporary files",
200198
"deleteTempDirHint": "Delete unused temporary files",
201199
"deletedTempDir": "Temporary files deleted",
200+
"exportSettingsLabel": "Export settings",
201+
"exportSettingsHint": "Export settings to a JSON file",
202+
"exportedSettings": "Settings exported",
203+
"importSettingsLabel": "Import settings",
204+
"importSettingsHint": "Import settings from a JSON file",
205+
"importedSettings": "Settings imported",
202206
"exportPatchesLabel": "Export patch selection",
203207
"exportPatchesHint": "Export patch selection to a JSON file",
204208
"exportedPatches": "Patch selection exported",

0 commit comments

Comments
 (0)