33 lines
1.2 KiB
Kotlin
33 lines
1.2 KiB
Kotlin
package com.gh.common.provider
|
|
|
|
import android.content.Context
|
|
import androidx.fragment.app.FragmentActivity
|
|
import com.alibaba.android.arouter.facade.annotation.Route
|
|
import com.gh.common.util.DialogUtils
|
|
import com.gh.gamecenter.common.constant.RouteConsts
|
|
import com.gh.gamecenter.core.provider.IUpdateManagerProvider
|
|
import com.gh.gamecenter.core.utils.ToastUtils
|
|
import com.gh.gamecenter.update.UpdateHelper
|
|
|
|
@Route(path = RouteConsts.provider.updateManager, name = "UpdateManager暴露服务")
|
|
class UpdateManagerProviderImpl: IUpdateManagerProvider {
|
|
override fun checkUpdate(activity: FragmentActivity, ignoreSuppressOption: Boolean) {
|
|
val dialog = DialogUtils.showWaitDialog(activity, "检查更新中...")
|
|
|
|
UpdateHelper.getUpdate(ignoreSuppressOption) {
|
|
dialog.dismiss()
|
|
|
|
if (UpdateHelper.isUpdateValid(ignoreSuppressOption)) {
|
|
UpdateHelper.showUpdateDialog(activity) {
|
|
// Do nothing
|
|
}
|
|
} else {
|
|
ToastUtils.toast("您的光环助手已是最新版本")
|
|
}
|
|
}
|
|
}
|
|
|
|
override fun init(context: Context?) {
|
|
// Do nothing
|
|
}
|
|
} |