commit 1b566db184f19d349e2c28a0ee1cb8f939ee959a
parent dd755af5be3be51fab88f09042cfca5d0f76a830
Author: rhunk <101876869+rhunk@users.noreply.github.com>
Date: Sun, 31 Dec 2023 15:56:41 +0100
refactor: ProfilePictureDownloader
Diffstat:
1 file changed, 2 insertions(+), 9 deletions(-)
diff --git a/core/src/main/kotlin/me/rhunk/snapenhance/core/features/impl/downloader/ProfilePictureDownloader.kt b/core/src/main/kotlin/me/rhunk/snapenhance/core/features/impl/downloader/ProfilePictureDownloader.kt
@@ -59,15 +59,8 @@ class ProfilePictureDownloader : Feature("ProfilePictureDownloader", loadParams
context.event.subscribe(NetworkApiRequestEvent::class) { event ->
if (!event.url.endsWith("/rpc/getPublicProfile")) return@subscribe
- Hooker.ephemeralHookObjectMethod(event.callback::class.java, event.callback, "onSucceeded", HookStage.BEFORE) { methodParams ->
- val content = methodParams.arg<ByteBuffer>(2).run {
- ByteArray(capacity()).also {
- get(it)
- position(0)
- }
- }
-
- ProtoReader(content).followPath(1, 1, 2) {
+ event.onSuccess { buffer ->
+ ProtoReader(buffer ?: return@onSuccess).followPath(1, 1, 2) {
friendUsername = getString(2) ?: return@followPath
followPath(4) {
backgroundUrl = getString(2)