mirror of
https://github.com/rhunk/SnapEnhance.git
synced 2025-05-03 16:04:30 +02:00
refactor: ProfilePictureDownloader
This commit is contained in:
parent
dd755af5be
commit
1b566db184
@ -59,15 +59,8 @@ class ProfilePictureDownloader : Feature("ProfilePictureDownloader", loadParams
|
|||||||
|
|
||||||
context.event.subscribe(NetworkApiRequestEvent::class) { event ->
|
context.event.subscribe(NetworkApiRequestEvent::class) { event ->
|
||||||
if (!event.url.endsWith("/rpc/getPublicProfile")) return@subscribe
|
if (!event.url.endsWith("/rpc/getPublicProfile")) return@subscribe
|
||||||
Hooker.ephemeralHookObjectMethod(event.callback::class.java, event.callback, "onSucceeded", HookStage.BEFORE) { methodParams ->
|
event.onSuccess { buffer ->
|
||||||
val content = methodParams.arg<ByteBuffer>(2).run {
|
ProtoReader(buffer ?: return@onSuccess).followPath(1, 1, 2) {
|
||||||
ByteArray(capacity()).also {
|
|
||||||
get(it)
|
|
||||||
position(0)
|
|
||||||
}
|
|
||||||
}
|
|
||||||
|
|
||||||
ProtoReader(content).followPath(1, 1, 2) {
|
|
||||||
friendUsername = getString(2) ?: return@followPath
|
friendUsername = getString(2) ?: return@followPath
|
||||||
followPath(4) {
|
followPath(4) {
|
||||||
backgroundUrl = getString(2)
|
backgroundUrl = getString(2)
|
||||||
|
Loading…
x
Reference in New Issue
Block a user