diff --git a/app/src/main/java/com/gh/gamecenter/cloudarchive/MyShareArchiveFragment.kt b/app/src/main/java/com/gh/gamecenter/cloudarchive/MyShareArchiveFragment.kt index 889d6ac781..821e11127e 100644 --- a/app/src/main/java/com/gh/gamecenter/cloudarchive/MyShareArchiveFragment.kt +++ b/app/src/main/java/com/gh/gamecenter/cloudarchive/MyShareArchiveFragment.kt @@ -17,7 +17,7 @@ class MyShareArchiveFragment : MyArchiveFragment() { override fun onViewCreated(view: View, savedInstanceState: Bundle?) { super.onViewCreated(view, savedInstanceState) mBinding.tipsTv.visibility = View.GONE - mBinding.reuseNoneData.reuseNoneDataTv.text = "还没有您分享存档噢~" + mBinding.reuseNoneData.reuseNoneDataTv.text = "您还没有分享存档噢~" mBinding.reuseNoneData.reuseNoneDataDescTv.text = "快快把您的有趣存档分享给大家吧!" } diff --git a/app/src/main/java/com/gh/vspace/VHelper.kt b/app/src/main/java/com/gh/vspace/VHelper.kt index 95db5b5249..b9991ae5f5 100644 --- a/app/src/main/java/com/gh/vspace/VHelper.kt +++ b/app/src/main/java/com/gh/vspace/VHelper.kt @@ -161,6 +161,8 @@ object VHelper { ) if (it.type == EBPackage.TYPE_INSTALLED) { + SensorsBridge.trackEvent("HaloFunInstallDone", "space_schema_type", if (isVSpace32) "32位" else "64位") + if (skip64VSpaceInstalled) return@PackageChangeListener // 帮用户启动因为没有安装畅玩组件而没法进行的下载任务 @@ -184,7 +186,6 @@ object VHelper { AppExecutor.uiExecutor.executeWithDelay({ connectService() }, 500) - SensorsBridge.trackEvent("HaloFunInstallDone", "space_schema_type", if (isVSpace32) "32位" else "64位") } else if (it.type == EBPackage.TYPE_UNINSTALLED) { if (isVSpace64) { // 执行卸载逻辑 @@ -1534,7 +1535,7 @@ object VHelper { return if (configSettings == null) { isVIsUsed() } else { - "off" == configSettings.gameSmooth + "on" == configSettings.gameSmooth } } diff --git a/app/src/main/java/com/gh/vspace/VSpace32DialogFragment.kt b/app/src/main/java/com/gh/vspace/VSpace32DialogFragment.kt index 1cf8080e80..8259670bd8 100644 --- a/app/src/main/java/com/gh/vspace/VSpace32DialogFragment.kt +++ b/app/src/main/java/com/gh/vspace/VSpace32DialogFragment.kt @@ -24,6 +24,8 @@ import com.gh.gamecenter.common.constant.Constants import com.gh.gamecenter.common.constant.EntranceConsts import com.gh.gamecenter.common.utils.* import com.gh.gamecenter.core.AppExecutor +import com.gh.gamecenter.core.utils.SPUtils +import com.gh.gamecenter.core.utils.ToastUtils import com.gh.gamecenter.databinding.DialogVspace32Binding import com.gh.gamecenter.entity.AppEntity import com.gh.gamecenter.feature.entity.GameEntity @@ -33,6 +35,7 @@ import com.lightgame.download.DownloadConfig import com.lightgame.download.DownloadEntity import com.lightgame.download.DownloadStatus.* import com.lightgame.utils.AppManager +import java.io.File class VSpace32DialogFragment : BaseDraggableDialogFragment() { @@ -42,6 +45,7 @@ class VSpace32DialogFragment : BaseDraggableDialogFragment() { private val mDownloadUrl by lazy { mAppEntity?.url ?: "" } private val mBinding by lazy { DialogVspace32Binding.inflate(layoutInflater) } private var mIsLogInstallShow = false + private var mIsLogAutoInstallClick = false private val mDataWatcher = object : DataWatcher() { override fun onDataChanged(downloadEntity: DownloadEntity) { if (downloadEntity.url == mDownloadUrl && isAdded) { @@ -97,6 +101,7 @@ class VSpace32DialogFragment : BaseDraggableDialogFragment() { if (downloadSnapshot?.status == done) { NewFlatLogUtils.logHaloFunEvent("halo_fun_32_install_tip_dialog_show") SensorsBridge.trackEvent("HaloFunExpandInstallDialogShow") + mIsLogInstallShow = true } else { NewFlatLogUtils.logHaloFun32DialogEvent("halo_fun_32_download_tip_dialog_show", mGameId, mGameName) SensorsBridge.trackEvent("HaloFunExpandDownloadDialogShow", "game_id", mGameId, "game_name", mGameName) @@ -104,9 +109,15 @@ class VSpace32DialogFragment : BaseDraggableDialogFragment() { mBinding.downloadBtn.setOnClickListener { if (downloadSnapshot?.status == done) { - PackageInstaller.install(requireContext(), downloadSnapshot) - NewFlatLogUtils.logHaloFunEvent("halo_fun_32_install_tip_dialog_click") - SensorsBridge.trackEvent("HaloFunExpandInstallButtonClick") + if (!File(downloadSnapshot.path).exists()) { + ToastUtils.toast("畅玩组件已损坏,即将重新下载") + DownloadManager.getInstance().cancel(downloadSnapshot.url) + DownloadManager.getInstance().add(downloadSnapshot) + } else { + PackageInstaller.install(requireContext(), downloadSnapshot) + NewFlatLogUtils.logHaloFunEvent("halo_fun_32_install_tip_dialog_click") + SensorsBridge.trackEvent("HaloFunExpandInstallButtonClick") + } } else { val downloadEntity = DownloadEntity() @@ -207,10 +218,25 @@ class VSpace32DialogFragment : BaseDraggableDialogFragment() { mIsLogInstallShow = true } - downloadBtn.setOnClickListener { - PackageInstaller.install(requireContext(), downloadEntity) + val isVSpace32DownloadOnly = + downloadEntity.getMetaExtra(Constants.EXTRA_DOWNLOAD_TYPE) == Constants.VSPACE_32_DOWNLOAD_ONLY + val isAutoInstall = SPUtils.getBoolean(Constants.SP_AUTO_INSTALL, true) + if (!isVSpace32DownloadOnly && isAutoInstall && !mIsLogAutoInstallClick) { NewFlatLogUtils.logHaloFunEvent("halo_fun_32_install_tip_dialog_click") SensorsBridge.trackEvent("HaloFunExpandInstallButtonClick") + mIsLogAutoInstallClick = true + } + + downloadBtn.setOnClickListener { + if (!File(downloadEntity.path).exists()) { + ToastUtils.toast("畅玩组件已损坏,即将重新下载") + DownloadManager.getInstance().cancel(downloadEntity.url) + DownloadManager.getInstance().add(downloadEntity) + } else { + PackageInstaller.install(requireContext(), downloadEntity) + NewFlatLogUtils.logHaloFunEvent("halo_fun_32_install_tip_dialog_click") + SensorsBridge.trackEvent("HaloFunExpandInstallButtonClick") + } } } diff --git a/app/src/main/java/com/gh/vspace/VSpaceDialogFragment.kt b/app/src/main/java/com/gh/vspace/VSpaceDialogFragment.kt index 6eae9ee313..8c51e96d82 100644 --- a/app/src/main/java/com/gh/vspace/VSpaceDialogFragment.kt +++ b/app/src/main/java/com/gh/vspace/VSpaceDialogFragment.kt @@ -24,6 +24,7 @@ import com.gh.gamecenter.common.constant.Constants import com.gh.gamecenter.common.constant.EntranceConsts import com.gh.gamecenter.common.utils.* import com.gh.gamecenter.core.AppExecutor +import com.gh.gamecenter.core.utils.SPUtils import com.gh.gamecenter.core.utils.ToastUtils import com.gh.gamecenter.databinding.DialogVspaceBinding import com.gh.gamecenter.entity.AppEntity @@ -50,6 +51,7 @@ class VSpaceDialogFragment : BaseDraggableDialogFragment() { private val mDownloadUrl32 by lazy { mAppEntity32?.url ?: "" } private val mBinding by lazy { DialogVspaceBinding.inflate(layoutInflater) } private var mIsLogInstallShow = false + private var mIsLogAutoInstallClick = false private val mDataWatcher = object : DataWatcher() { override fun onDataChanged(downloadEntity: DownloadEntity) { if (((mAppEntity64 != null && downloadEntity.url == mDownloadUrl64) || (mAppEntity64 == null && downloadEntity.url == mDownloadUrl32)) && isAdded) { @@ -176,7 +178,9 @@ class VSpaceDialogFragment : BaseDraggableDialogFragment() { "game_name", mGameName, "space_schema_type", - architecture + architecture, + "game_schema_type", + if (mBit == "32") "32位" else "64位" ) } @@ -284,6 +288,11 @@ class VSpaceDialogFragment : BaseDraggableDialogFragment() { mIsLogInstallShow = true } + if (SPUtils.getBoolean(Constants.SP_AUTO_INSTALL, true) && !mIsLogAutoInstallClick) { + SensorsBridge.trackEvent("HaloFunInstallButtonClick", "space_schema_type", vSpaceType) + mIsLogAutoInstallClick = true + } + downloadBtn.setOnClickListener { if (!File(downloadEntity.path).exists()) { ToastUtils.toast("畅玩组件已损坏,即将重新下载") diff --git a/app/src/main/java/com/gh/vspace/VSpaceUpdate32DialogFragment.kt b/app/src/main/java/com/gh/vspace/VSpaceUpdate32DialogFragment.kt index 638036c96d..602226d07a 100644 --- a/app/src/main/java/com/gh/vspace/VSpaceUpdate32DialogFragment.kt +++ b/app/src/main/java/com/gh/vspace/VSpaceUpdate32DialogFragment.kt @@ -22,6 +22,7 @@ import com.gh.gamecenter.common.base.fragment.BaseDialogFragment import com.gh.gamecenter.common.constant.EntranceConsts import com.gh.gamecenter.common.utils.* import com.gh.gamecenter.core.AppExecutor +import com.gh.gamecenter.core.utils.ToastUtils import com.gh.gamecenter.databinding.DialogVspaceUpdate32Binding import com.gh.gamecenter.entity.AppEntity import com.gh.gamecenter.feature.entity.GameEntity @@ -31,6 +32,7 @@ import com.lightgame.download.DownloadConfig import com.lightgame.download.DownloadEntity import com.lightgame.download.DownloadStatus.* import com.lightgame.utils.AppManager +import java.io.File class VSpaceUpdate32DialogFragment : BaseDialogFragment() { @@ -87,7 +89,13 @@ class VSpaceUpdate32DialogFragment : BaseDialogFragment() { mBinding.downloadBtn.setOnClickListener { NewFlatLogUtils.logHaloFun32DialogEvent("halo_fun_32_update_tip_dialog_click", mGameId, mGameName) if (downloadSnapshot?.status == done) { - PackageInstaller.install(requireContext(), downloadSnapshot) + if (!File(downloadSnapshot.path).exists()) { + ToastUtils.toast("畅玩组件已损坏,即将重新下载") + DownloadManager.getInstance().cancel(downloadSnapshot.url) + DownloadManager.getInstance().add(downloadSnapshot) + } else { + PackageInstaller.install(requireContext(), downloadSnapshot) + } } else { val downloadEntity = DownloadEntity() @@ -184,8 +192,18 @@ class VSpaceUpdate32DialogFragment : BaseDialogFragment() { downloadBtn.buttonStyle = DownloadButton.ButtonStyle.INSTALL_NORMAL downloadBtn.setOnClickListener { - PackageInstaller.install(requireContext(), downloadEntity) - NewFlatLogUtils.logHaloFun32DialogEvent("halo_fun_32_update_tip_dialog_click", mGameId, mGameName) + if (!File(downloadEntity.path).exists()) { + ToastUtils.toast("畅玩组件已损坏,即将重新下载") + DownloadManager.getInstance().cancel(downloadEntity.url) + DownloadManager.getInstance().add(downloadEntity) + } else { + PackageInstaller.install(requireContext(), downloadEntity) + NewFlatLogUtils.logHaloFun32DialogEvent( + "halo_fun_32_update_tip_dialog_click", + mGameId, + mGameName + ) + } } }