Skip to content
This repository has been archived by the owner on Feb 17, 2024. It is now read-only.

Commit

Permalink
fix: 偶现跳转时闪退
Browse files Browse the repository at this point in the history
  • Loading branch information
HuanCheng65 committed Oct 8, 2023
1 parent 622bd78 commit 65af565
Showing 1 changed file with 24 additions and 0 deletions.
Original file line number Diff line number Diff line change
@@ -0,0 +1,24 @@
package com.huanchengfly.tieba.post.components

import android.util.Log
import com.huanchengfly.tieba.post.api.models.protos.ThreadInfo
import com.huanchengfly.tieba.post.api.urlDecode
import com.huanchengfly.tieba.post.api.urlEncode
import com.ramcosta.composedestinations.navargs.DestinationsNavTypeSerializer
import com.ramcosta.composedestinations.navargs.NavTypeSerializer
import com.ramcosta.composedestinations.navargs.utils.base64ToByteArray
import com.ramcosta.composedestinations.navargs.utils.toBase64Str

@NavTypeSerializer
class ThreadInfoSerializer : DestinationsNavTypeSerializer<ThreadInfo> {
override fun toRouteString(value: ThreadInfo): String {
val routeStr = ThreadInfo.ADAPTER.encode(value).toBase64Str().urlEncode()
Log.d("ThreadInfoSerializer", "toRouteString: $routeStr")
return routeStr
}

override fun fromRouteString(routeStr: String): ThreadInfo {
Log.d("ThreadInfoSerializer", "fromRouteString: $routeStr")
return ThreadInfo.ADAPTER.decode(routeStr.urlDecode().base64ToByteArray())
}
}

0 comments on commit 65af565

Please sign in to comment.