33 lines
1.1 KiB
Kotlin
33 lines
1.1 KiB
Kotlin
package com.gh.common.chain
|
|
|
|
import android.content.Context
|
|
import com.gh.gamecenter.R
|
|
import com.gh.gamecenter.common.utils.DialogHelper
|
|
import com.gh.gamecenter.common.utils.toResString
|
|
import com.gh.gamecenter.feature.entity.GameEntity
|
|
|
|
class VersionNumberHandler : ChainHandler() {
|
|
|
|
override fun handleRequest(context: Context, gameEntity: GameEntity) {
|
|
val confirmCallback = {
|
|
if (hasNext()) {
|
|
getNext()?.handleRequest(context, gameEntity)
|
|
} else {
|
|
processEndCallback?.invoke(null)
|
|
}
|
|
}
|
|
if (!gameEntity.isShowVersionNumber()) {
|
|
confirmCallback.invoke()
|
|
} else {
|
|
DialogHelper.showGuideDialog(
|
|
context,
|
|
"温馨提示",
|
|
gameEntity.getVersionNumberString(),
|
|
"继续下载",
|
|
R.string.cancel.toResString(),
|
|
{ confirmCallback.invoke() },
|
|
extraConfig = DialogHelper.Config(titleIcon = R.drawable.ic_dialog_tips)
|
|
)
|
|
}
|
|
}
|
|
} |