Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

chore: merge dev to main #1079

Merged
merged 6 commits into from
Aug 3, 2023
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension


Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
46 changes: 0 additions & 46 deletions .github/workflows/crowdin.yml

This file was deleted.

82 changes: 41 additions & 41 deletions .github/workflows/build.yml → .github/workflows/pr-build.yml
Original file line number Diff line number Diff line change
@@ -1,41 +1,41 @@
name: PR Build
on:
pull_request:
jobs:
build:
name: Build
runs-on: ubuntu-latest
steps:
- name: Checkout
uses: actions/checkout@v3
with:
# Make sure the release step uses its own credentials:
# https://github.com/cycjimmy/semantic-release-action#private-packages
persist-credentials: false
fetch-depth: 0
- name: Setup JDK
uses: actions/setup-java@v3
with:
java-version: '11'
distribution: 'zulu'
cache: 'gradle'
- name: Setup Flutter
uses: subosito/flutter-action@v2
with:
channel: 'stable'
cache: true
- name: Install Flutter dependencies
run: flutter pub get
- name: Generate files with Builder
run: flutter packages pub run build_runner build --delete-conflicting-outputs
- name: Build with Flutter
env:
GITHUB_TOKEN: ${{ secrets.GITHUB_TOKEN }}
run: flutter build apk
- name: Upload build
uses: actions/upload-artifact@v3
with:
name: revanced-manager
path: build/app/outputs/flutter-apk/app-release.apk
name: PR Build

on:
pull_request:

jobs:
build:
name: Build
runs-on: ubuntu-latest
steps:
- name: Checkout
uses: actions/checkout@v3
with:
# Make sure the release step uses its own credentials:
# https://github.com/cycjimmy/semantic-release-action#private-packages
persist-credentials: false
fetch-depth: 0
- name: Setup JDK
uses: actions/setup-java@v3
with:
java-version: '11'
distribution: 'zulu'
cache: 'gradle'
- name: Setup Flutter
uses: subosito/flutter-action@v2
with:
channel: 'stable'
cache: true
- name: Install Flutter dependencies
run: flutter pub get
- name: Generate files with Builder
run: flutter packages pub run build_runner build --delete-conflicting-outputs
- name: Build with Flutter
env:
GITHUB_TOKEN: ${{ secrets.GITHUB_TOKEN }}
run: flutter build apk
- name: Upload build
uses: actions/upload-artifact@v3
with:
name: revanced-manager
path: build/app/outputs/flutter-apk/app-release.apk
68 changes: 0 additions & 68 deletions .github/workflows/release.yml

This file was deleted.

2 changes: 1 addition & 1 deletion android/app/build.gradle
Original file line number Diff line number Diff line change
Expand Up @@ -71,7 +71,7 @@ dependencies {
implementation "org.jetbrains.kotlin:kotlin-stdlib-jdk7:$kotlin_version"

// ReVanced
implementation "app.revanced:revanced-patcher:12.1.0"
implementation "app.revanced:revanced-patcher:12.1.1"

// Signing & aligning
implementation("org.bouncycastle:bcpkix-jdk15on:1.70")
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -27,6 +27,8 @@ private const val INSTALLER_CHANNEL = "app.revanced.manager.flutter/installer"
class MainActivity : FlutterActivity() {
private val handler = Handler(Looper.getMainLooper())
private lateinit var installerChannel: MethodChannel
private var cancel: Boolean = false
private var stopResult: MethodChannel.Result? = null

override fun configureFlutterEngine(@NonNull flutterEngine: FlutterEngine) {
super.configureFlutterEngine(flutterEngine)
Expand Down Expand Up @@ -57,6 +59,7 @@ class MainActivity : FlutterActivity() {
keyStoreFilePath != null &&
keystorePassword != null
) {
cancel = false
runPatcher(
result,
patchBundleFilePath,
Expand All @@ -74,6 +77,10 @@ class MainActivity : FlutterActivity() {
result.notImplemented()
}
}
"stopPatcher" -> {
cancel = true
stopResult = result
}
else -> result.notImplemented()
}
}
Expand Down Expand Up @@ -111,6 +118,12 @@ class MainActivity : FlutterActivity() {
)
)
}

if(cancel) {
handler.post { stopResult!!.success(null) }
return@Thread
}

originalFile.copyTo(inputFile, true)

handler.post {
Expand All @@ -123,6 +136,12 @@ class MainActivity : FlutterActivity() {
)
)
}

if(cancel) {
handler.post { stopResult!!.success(null) }
return@Thread
}

val patcher =
Patcher(
PatcherOptions(
Expand All @@ -134,6 +153,11 @@ class MainActivity : FlutterActivity() {
)
)

if(cancel) {
handler.post { stopResult!!.success(null) }
return@Thread
}

handler.post {
installerChannel.invokeMethod(
"update",
Expand All @@ -150,8 +174,19 @@ class MainActivity : FlutterActivity() {
)
)
}

if(cancel) {
handler.post { stopResult!!.success(null) }
return@Thread
}

patcher.addIntegrations(listOf(integrations)) {}

if(cancel) {
handler.post { stopResult!!.success(null) }
return@Thread
}

handler.post {
installerChannel.invokeMethod(
"update",
Expand All @@ -163,6 +198,11 @@ class MainActivity : FlutterActivity() {
)
}

if(cancel) {
handler.post { stopResult!!.success(null) }
return@Thread
}

val patches = if (Build.VERSION.SDK_INT >= Build.VERSION_CODES.CUPCAKE) {
PatchBundle.Dex(
patchBundleFilePath,
Expand All @@ -179,6 +219,12 @@ class MainActivity : FlutterActivity() {
} else {
TODO("VERSION.SDK_INT < CUPCAKE")
}

if(cancel) {
handler.post { stopResult!!.success(null) }
return@Thread
}

patcher.addPatches(patches)
patcher.executePatches().forEach { (patch, res) ->
if (res.isSuccess) {
Expand All @@ -193,15 +239,24 @@ class MainActivity : FlutterActivity() {
)
)
}
if(cancel) {
handler.post { stopResult!!.success(null) }
return@Thread
}
return@forEach
}
val msg = "Failed to apply $patch: " + "${res.exceptionOrNull()!!.message ?: res.exceptionOrNull()!!.cause!!::class.simpleName}"
val msg =
"Failed to apply $patch: " + "${res.exceptionOrNull()!!.message ?: res.exceptionOrNull()!!.cause!!::class.simpleName}"
handler.post {
installerChannel.invokeMethod(
"update",
mapOf("progress" to 0.5, "header" to "", "log" to msg)
)
}
if(cancel) {
handler.post { stopResult!!.success(null) }
return@Thread
}
}

handler.post {
Expand All @@ -214,9 +269,17 @@ class MainActivity : FlutterActivity() {
)
)
}
if(cancel) {
handler.post { stopResult!!.success(null) }
return@Thread
}
val res = patcher.save()
ZipFile(patchedFile).use { file ->
res.dexFiles.forEach {
if(cancel) {
handler.post { stopResult!!.success(null) }
return@Thread
}
file.addEntryCompressData(
ZipEntry.createWithName(it.name),
it.stream.readBytes()
Expand All @@ -233,6 +296,10 @@ class MainActivity : FlutterActivity() {
ZipAligner::getEntryAlignment
)
}
if(cancel) {
handler.post { stopResult!!.success(null) }
return@Thread
}
handler.post {
installerChannel.invokeMethod(
"update",
Expand All @@ -244,10 +311,12 @@ class MainActivity : FlutterActivity() {
)
}

// Signer("ReVanced", "s3cur3p@ssw0rd").signApk(patchedFile, outFile, keyStoreFile)

try {
Signer("ReVanced", keystorePassword).signApk(patchedFile, outFile, keyStoreFile)
Signer("ReVanced", keystorePassword).signApk(
patchedFile,
outFile,
keyStoreFile
)
} catch (e: Exception) {
//log to console
print("Error signing apk: ${e.message}")
Expand Down
Loading