Skip to content

Commit

Permalink
refactor: more cleanup
Browse files Browse the repository at this point in the history
  • Loading branch information
Sculas committed Sep 14, 2022
1 parent a4b5fc4 commit 2f78af7
Showing 1 changed file with 41 additions and 71 deletions.
Original file line number Diff line number Diff line change
Expand Up @@ -11,6 +11,7 @@ import app.revanced.manager.flutter.utils.zip.structures.ZipEntry
import app.revanced.patcher.Patcher
import app.revanced.patcher.PatcherOptions
import app.revanced.patcher.extensions.PatchExtensions.patchName
import app.revanced.patcher.logging.Logger
import app.revanced.patcher.util.patch.impl.DexPatchBundle
import dalvik.system.DexClassLoader
import io.flutter.embedding.android.FlutterActivity
Expand Down Expand Up @@ -141,77 +142,7 @@ class MainActivity : FlutterActivity() {
resourcePatching,
Aapt.binary(applicationContext).absolutePath,
cacheDirPath,
logger =
object :
app.revanced.patcher.logging.Logger {
override fun error(msg: String) {
handler.post {
installerChannel
.invokeMethod(
"update",
mapOf(
"progress" to
-1.0,
"header" to
"",
"log" to
msg
)
)
}
}

override fun warn(msg: String) {
handler.post {
installerChannel
.invokeMethod(
"update",
mapOf(
"progress" to
-1.0,
"header" to
"",
"log" to
msg
)
)
}
}

override fun info(msg: String) {
handler.post {
installerChannel
.invokeMethod(
"update",
mapOf(
"progress" to
-1.0,
"header" to
"",
"log" to
msg
)
)
}
}

override fun trace(msg: String) {
handler.post {
installerChannel
.invokeMethod(
"update",
mapOf(
"progress" to
-1.0,
"header" to
"",
"log" to
msg
)
)
}
}
}
logger = ManagerLogger()
)
)

Expand Down Expand Up @@ -326,4 +257,43 @@ class MainActivity : FlutterActivity() {
}
.start()
}

inner class ManagerLogger : Logger {
override fun error(msg: String) {
handler.post {
installerChannel
.invokeMethod(
"update",
mapOf("progress" to -1.0, "header" to "", "log" to msg)
)
}
}

override fun warn(msg: String) {
handler.post {
installerChannel.invokeMethod(
"update",
mapOf("progress" to -1.0, "header" to "", "log" to msg)
)
}
}

override fun info(msg: String) {
handler.post {
installerChannel.invokeMethod(
"update",
mapOf("progress" to -1.0, "header" to "", "log" to msg)
)
}
}

override fun trace(msg: String) {
handler.post {
installerChannel.invokeMethod(
"update",
mapOf("progress" to -1.0, "header" to "", "log" to msg)
)
}
}
}
}

0 comments on commit 2f78af7

Please sign in to comment.