fix: 一些闪退问题

This commit is contained in:
HuanCheng65 2023-07-23 20:39:54 +08:00
parent bb83341335
commit 8da97b5d04
No known key found for this signature in database
GPG Key ID: 5EC9DD60A32C7360
6 changed files with 13 additions and 39 deletions

View File

@ -103,8 +103,8 @@ interface MiniTiebaApi {
@Field("agree_type") agree_type: Int = 2,
@Field("obj_type") obj_type: Int = 3,
@Field("op_type") op_type: Int = 0,
@Field("tbs") tbs: String = AccountUtil.getLoginInfo()!!.tbs,
@Field("stoken") stoken: String = AccountUtil.getSToken()!!
@Field("tbs") tbs: String? = AccountUtil.getLoginInfo()?.tbs,
@Field("stoken") stoken: String? = AccountUtil.getSToken()
): Call<AgreeBean>
@Headers("${Header.FORCE_LOGIN}: ${Header.FORCE_LOGIN_TRUE}")

View File

@ -433,8 +433,8 @@ interface OfficialTiebaApi {
)
fun addStoreAsync(
@Field("data") data: String,
@Field("stoken") stoken: String = AccountUtil.getSToken()!!,
@retrofit2.http.Header("client_user_token") client_user_token: String? = AccountUtil.getUid(),
@Field("stoken") stoken: String? = AccountUtil.getSToken(),
@retrofit2.http.Header("client_user_token") clientUserToken: String? = AccountUtil.getUid(),
): Deferred<ApiResult<CommonResponse>>
@POST("/c/c/post/addstore")

View File

@ -1,42 +1,13 @@
package com.huanchengfly.tieba.post.models
import android.os.Parcel
import android.os.Parcelable
import kotlinx.parcelize.Parcelize
@Parcelize
data class PhotoViewBean @JvmOverloads constructor(
var url: String?,
var originUrl: String?,
var isLongPic: Boolean = false,
var index: String? = null,
var isGif: Boolean = false
) : Parcelable {
constructor(parcel: Parcel) : this(
parcel.readString(),
parcel.readString(),
parcel.readByte() != 0.toByte(),
parcel.readString(),
parcel.readByte() != 0.toByte()
)
override fun writeToParcel(parcel: Parcel, flags: Int) {
parcel.writeString(url)
parcel.writeString(originUrl)
parcel.writeByte(if (isLongPic) 1 else 0)
parcel.writeString(index)
parcel.writeByte(if (isGif) 1 else 0)
}
override fun describeContents(): Int {
return 0
}
companion object CREATOR : Parcelable.Creator<PhotoViewBean> {
override fun createFromParcel(parcel: Parcel): PhotoViewBean {
return PhotoViewBean(parcel)
}
override fun newArray(size: Int): Array<PhotoViewBean?> {
return arrayOfNulls(size)
}
}
}
) : Parcelable

View File

@ -399,7 +399,7 @@ fun ThreadPage(
seeLz: Boolean = false,
sortType: Int = 0,
from: String = "",
extra: ThreadPageExtra = ThreadPageNoExtra,
extra: ThreadPageExtra? = null,
threadInfo: ThreadInfo? = null,
scrollToReply: Boolean = false,
viewModel: ThreadViewModel = pageViewModel()

View File

@ -38,6 +38,7 @@ import com.huanchengfly.tieba.post.toJson
import kotlinx.coroutines.CoroutineScope
import kotlinx.coroutines.Dispatchers
import kotlinx.coroutines.launch
import kotlinx.coroutines.withContext
import java.io.File
import java.lang.ref.WeakReference
@ -173,7 +174,9 @@ object EmoticonManager {
}
updateCache()
coroutineScope.launch {
fetchEmoticons(context)
withContext(Dispatchers.IO) {
runCatching { fetchEmoticons(context) }
}
}
}

View File

@ -413,7 +413,7 @@ class ShowPermissionTipInterceptor(val permissions: List<String>, val descriptio
callback: OnPermissionCallback?
) {
mRequestFlag = false
tipDialog?.dismiss()
runCatching { tipDialog?.dismiss() }
}
}