Merge remote-tracking branch 'origin/release' into dev

This commit is contained in:
chenjuntao
2025-04-24 15:16:28 +08:00
28 changed files with 141 additions and 132 deletions

View File

@ -13,11 +13,14 @@ import android.text.SpannableString;
import android.text.TextUtils;
import android.text.style.ForegroundColorSpan;
import android.view.View;
import android.view.ViewParent;
import android.widget.LinearLayout;
import android.widget.TextView;
import androidx.annotation.Nullable;
import androidx.appcompat.app.AppCompatActivity;
import androidx.constraintlayout.widget.ConstraintLayout;
import androidx.constraintlayout.widget.ConstraintSet;
import com.gh.common.chain.BrowserInstallHandler;
import com.gh.common.chain.CheckDownloadHandler;
@ -531,19 +534,14 @@ public class BindingAdapters {
binding.tvSellingPoints.setVisibility(View.GONE);
}
Context context = layout.getContext();
binding.gtcvTags.removeAllViews();
ArrayList<TagStyleEntity> tagStyle = gameEntity.getTagStyle();
StringBuilder tagText = new StringBuilder();
for (int i = 0; i < tagStyle.size(); i++) {
if (i < 3) {
TextView textView = new TextView(layout.getContext());
textView.setTextColor(ExtensionsKt.toColor(com.gh.gamecenter.common.R.color.text_tertiary, context));
textView.setTextSize(10);
textView.setText((i == 0 ? "" : "·") + tagStyle.get(i).getName());
binding.gtcvTags.addView(textView);
tagText.append(i == 0 ? "" : "·").append(tagStyle.get(i).getName());
}
}
binding.gtcvTags.setText(tagText);
} else {
layout.setVisibility(View.VISIBLE);
binding.getRoot().setVisibility(View.GONE);
@ -570,6 +568,20 @@ public class BindingAdapters {
break;
}
}
ViewParent parent = binding.getRoot().getParent();
if (parent instanceof ConstraintLayout) {
ConstraintLayout constraintLayout = (ConstraintLayout) parent;
ConstraintSet constraintSet = new ConstraintSet();
constraintSet.clone(constraintLayout);
constraintSet.clear(R.id.gameDesSpace, ConstraintSet.BOTTOM);
if (subjectTag.equals(SUBJECT_TAG_SELLING_POINT)) {
constraintSet.connect(R.id.gameDesSpace, ConstraintSet.BOTTOM, R.id.layout_selling_points, ConstraintSet.TOP);
} else {
constraintSet.connect(R.id.gameDesSpace, ConstraintSet.BOTTOM, R.id.label_list, ConstraintSet.TOP);
}
constraintSet.applyTo(constraintLayout);
}
}
public static void setVideoDetailGameTags(LinearLayout layout, GameEntity gameEntity) {

View File

@ -1,5 +1,6 @@
package com.gh.common.provider
import com.gh.common.util.PackageUtils
import com.gh.gamecenter.core.provider.IAcceleratorDataHolderProvider
import com.gh.gamecenter.feature.entity.VipEntity
import com.halo.assistant.accelerator.repository.AcceleratorDataHolder
@ -12,12 +13,8 @@ class IAcceleratorDataHolderProviderImpl : IAcceleratorDataHolderProvider {
}
}
override fun addInitFunResult(result: String) {
AcceleratorDataHolder.instance.addInitFunResult(result)
}
override fun getInitFunResults(): List<String> {
return AcceleratorDataHolder.instance.initResults
override fun getGhVersionName(): String {
return PackageUtils.getGhVersionName()
}
override fun clear() {

View File

@ -306,21 +306,14 @@ object XapkInstaller : XApkUnZipCallback, XApkUnZipOutputFactory {
DownloadNotificationHelper.addOrUpdateDownloadNotification(downloadEntity)
NDataChanger.notifyDataChanged(downloadEntity)
DownloadManager.getInstance().updateDownloadEntity(downloadEntity)
// 仅官网渠道上报 XAPK 异常信息
if (HaloApp.getInstance().channel == "GH_206") {
SentryHelper.onEvent(
"XAPK_UNZIP_ERROR",
"gameName", downloadEntity.name,
"errorDigest", exception.localizedMessage
)
}
DownloadDataHelper.uploadDownloadStatusEvent(downloadEntity, "xapk解压失败")
SensorsBridge.trackGameDecompressionFailed(
downloadEntity.gameId,
downloadEntity.name,
downloadEntity.categoryChinese
downloadEntity.categoryChinese,
exception.localizedMessage ?: "unknown error"
)
}

View File

@ -45,6 +45,7 @@ import com.gh.gamecenter.common.base.fragment.BaseLazyFragment
import com.gh.gamecenter.common.constant.Constants
import com.gh.gamecenter.common.constant.EntranceConsts
import com.gh.gamecenter.common.entity.LinkEntity
import com.gh.gamecenter.common.eventbus.EBReuse
import com.gh.gamecenter.common.exposure.ExposureSource
import com.gh.gamecenter.common.json.json
import com.gh.gamecenter.common.mvvm.Status
@ -1111,6 +1112,13 @@ class GameDetailWrapperFragment : BaseLazyFragment(), IScrollable {
return true
}
@Subscribe(threadMode = ThreadMode.MAIN)
fun onEventMainThread(reuse: EBReuse) {
if ("download" == reuse.type) {
downloadBinding.detailProgressbar.performClick()
}
}
@Subscribe(threadMode = ThreadMode.MAIN)
fun onEventMainThread(status: EBDownloadStatus) {
updateDownloadCountHint(packageViewModel.filterSameUpdateLiveData.value)

View File

@ -21,13 +21,14 @@ class StartingAcceleratorViewModel : ViewModel() {
val useCase = AccelerationUseCase()
private val _restartingAcceleratorAction = MutableLiveData<Event<Boolean>>()
val restartingAcceleratorAction: LiveData<Event<Boolean>> = _restartingAcceleratorAction
private val _restartingAcceleratorAction = MutableLiveData<Event<Unit>>()
val restartingAcceleratorAction: LiveData<Event<Unit>> = _restartingAcceleratorAction
fun loadAcceleratorToken() {
val userId = UserManager.getInstance().userId
if (userId.isNotBlank()) {
UserRepository.getInstance().setAcceleratorToken(userId) {
_restartingAcceleratorAction.value = Event(it)
// 这里就算setToken失败也要调用启动加速失败会走正常的日志上报
_restartingAcceleratorAction.value = Event(Unit)
}
}
}

View File

@ -311,7 +311,7 @@ class GameDetailFragment : LazyFragment(), IScrollable {
private fun initDetailRv() {
binding.detailRv.run {
(itemAnimator as DefaultItemAnimator).supportsChangeAnimations = false
itemAnimator = null
layoutManager = detailLayoutManager
adapter = detailListAdapter
addOnScrollListener(object : OnScrollListener() {

View File

@ -46,7 +46,7 @@ class GameDetailBriefItemViewHolder(
highlightedTextClickListener = TextHelper.CopyToClipboardHighlightedTextClick()
)
briefTv.post {
expandTv.isVisible = briefTv.lineCount == 3 && briefTv.layout.getEllipsisCount(2) > 0
expandTv.isVisible = briefTv.lineCount == 3 && (briefTv.layout?.getEllipsisCount(2) ?: 0) > 0
}
expandTv.setOnClickListener {
SensorsBridge.trackGameDetailModuleClick(

View File

@ -194,6 +194,8 @@ class GameDetailComprehensivePanelItemViewHolder(
maxLines = if (parentViewHolder.showPart && !parentViewHolder.isExpand) 1 else Int.MAX_VALUE
text = data.text
post {
if (layout == null) return@post
val hasEllipsize = layout.getEllipsisCount(0) > 0
if (parentViewHolder.showPart && hasEllipsize && !parentViewHolder.binding.expandTv.isVisible) {
parentViewHolder.binding.expandTv.isVisible = true

View File

@ -27,7 +27,7 @@ class GameDetailDeveloperWordItemViewHolder(
.fromHtmlCompat(PicassoImageGetter(contentTv), ExtraTagHandler())
)
contentTv.post {
expandTv.isVisible = (contentTv.lineCount == 3 && contentTv.layout.getEllipsisCount(2) > 0) || contentTv.lineCount > 3
expandTv.isVisible = (contentTv.lineCount == 3 && (contentTv.layout?.getEllipsisCount(2) ?: 0) > 0) || contentTv.lineCount > 3
}
expandTv.background = R.drawable.bg_ui_surface_expand_gradient.toDrawable(context)
expandTv.setTextColor(com.gh.gamecenter.common.R.color.text_theme.toColor(context))

View File

@ -36,7 +36,7 @@ class GameDetailUpdateItemViewHolder(
}
contentTv.text = entity.updateDes
contentTv.post {
expandTv.isVisible = contentTv.lineCount == 3 && contentTv.layout.getEllipsisCount(2) > 0
expandTv.isVisible = contentTv.lineCount == 3 && (contentTv.layout?.getEllipsisCount(2) ?: 0) > 0
}
expandTv.background = R.drawable.bg_ui_surface_expand_gradient.toDrawable(context)
expandTv.setTextColor(com.gh.gamecenter.common.R.color.text_theme.toColor(context))

View File

@ -63,7 +63,7 @@ class HistoryApkListAdapter(
holder.binding.expandTv.setTextColor(com.gh.gamecenter.common.R.color.text_theme.toColor(mContext))
holder.binding.updateDescTv.text = apkEntity.updateDesc
holder.binding.updateDescTv.post {
holder.binding.expandTv.isVisible = holder.binding.updateDescTv.lineCount == 3 && holder.binding.updateDescTv.layout.getEllipsisCount(2) > 0
holder.binding.expandTv.isVisible = holder.binding.updateDescTv.lineCount == 3 && (holder.binding.updateDescTv.layout?.getEllipsisCount(2) ?: 0) > 0
}
holder.binding.versionTv.text = "版本${apkEntity.version}"
holder.binding.releaseDateTv.text = TimeUtils.getFormatTime(apkEntity.updateTime)

View File

@ -52,7 +52,7 @@ class UploadThread(
.setCancelHook(true)
.setCheckpointFile(recordDirectory)
.setPartSize(10 * 1024 * 1024)
.setTaskNum(2)
.setTaskNum(1)
.setDataTransferListener {
Utils.log(
"OssUpload",
@ -74,9 +74,9 @@ class UploadThread(
mUploadInput = this
}
val config = TransportConfig.builder()
.readTimeoutMills(15 * 1000)
.writeTimeoutMills(15 * 1000)
.connectTimeoutMills(15 * 1000)
.readTimeoutMills(5 * 1000)
.writeTimeoutMills(5 * 1000)
.connectTimeoutMills(5 * 1000)
.maxRetryCount(2)
.build()

View File

@ -26,6 +26,7 @@ import org.json.JSONException
import org.json.JSONObject
import java.io.File
import java.io.IOException
import java.net.MalformedURLException
import java.net.URL
import java.net.URLConnection
import java.text.DecimalFormat
@ -341,6 +342,9 @@ object NDownloadBridge : InnerDownloadListener, IErrorRetryHandler {
// 由于这里的异常不会影响正常下载,所以直接打印异常,不做处理
// 具体可见 https://sentry.shanqu.cc/organizations/lightgame/issues/371082/
e.printStackTrace()
} catch (e: MalformedURLException) {
// 由于重定向的 url 可能是一个不合法的 url这里捕获异常
e.printStackTrace()
}
NDataChanger.notifyDataChanged(downloadEntity)

View File

@ -20,14 +20,6 @@ class AcceleratorDataHolder {
private val listeners = mutableSetOf<OnDataHolderListener>()
private val _initResults = arrayListOf<String>()
val initResults: List<String>
get() = _initResults
fun addInitFunResult(result: String) {
_initResults.add(result)
}
private var _hasAcctGameInfoInLocal = false
val hasAcctGameInfoInLocal: Boolean
get() = _hasAcctGameInfoInLocal

View File

@ -106,7 +106,8 @@ class RealNameInfoFragment : ToolbarFragment() {
}
private fun initEditingView() {
val bodyString = getText(R.string.realname_body_tv)
val bodyString =
"为响应《国家新闻出版署关于防止未成年沉迷网络游戏的通知》,请认真填写您的身份信息。您提供的证件信息将受到严格保护,仅用于用户实名制认证,不会用作其他用途,请放心填写。前往了解更多信息>>"
mBinding.bodyTv.text =
SpanBuilder(bodyString)
.click(
@ -124,13 +125,13 @@ class RealNameInfoFragment : ToolbarFragment() {
.build()
mBinding.bodyTv.movementMethod = CustomLinkMovementMethod.getInstance()
val hintString = getText(R.string.realname_hint_tv)
val hintString = "特别说明:由于部分用户之前的实名信息不正确或认证失败,可能需要重新认证,请提交真实的信息进行认证即可。部分游戏仅对成年用户进行开放"
mBinding.hintTv.text =
SpanBuilder(hintString)
.bold(0, 5)
.build()
val manualHintString = getText(R.string.realname_manual_hint_tv)
val manualHintString = "若您提交的真实身份信息未通过认证或者您持有的为港澳台\\国外身份证件,可转交人工审核"
mBinding.manualHintTv.text =
SpanBuilder(manualHintString)
.click(
@ -160,9 +161,6 @@ class RealNameInfoFragment : ToolbarFragment() {
mBinding.nameEt.doOnTextChanged { _, _, _, _ ->
updateSubmitBtn()
}
mBinding.textDotIndicator.setOnClickListener {
mBinding.nameEt.text.insert(mBinding.nameEt.selectionStart, "\u00B7")
}
mBinding.idCardEt.doOnTextChanged { _, _, _, _ ->
updateSubmitBtn()
}