【光环助手V5.7.0】后台优化汇总2月第3周(9(2)) https://git.shanqu.cc/pm/halo-app-issues/-/issues/1726

This commit is contained in:
jack
2022-02-22 15:03:31 +08:00
parent 6e2b6cc397
commit fffdd596d2
3 changed files with 102 additions and 65 deletions

View File

@ -46,7 +46,13 @@ object DefaultUrlHandler {
when (host) {
"article" -> context.startActivity(NewsDetailActivity.getIntentById(context, id, entrance))
"game" -> DirectUtils.directToGameDetail(context, id = id, tab = uri.getQueryParameter("to"), autoDownload = uri.getQueryParameter("auto_download") == "true", entrance = entrance)
"game" -> DirectUtils.directToGameDetail(
context,
id = id,
tab = uri.getQueryParameter("to"),
autoDownload = uri.getQueryParameter("auto_download") == "true",
entrance = entrance
)
"column" -> SubjectActivity.startSubjectActivity(context, id, uri.getQueryParameter("name"), false, entrance)
@ -122,8 +128,9 @@ object DefaultUrlHandler {
}
if ("articles" == type) {
DirectUtils.directToCommunityArticle(
context, typeId, communityId,
entrance, "文章链接")
context, typeId, communityId,
entrance, "文章链接"
)
}
}
EntranceUtils.HOST_UPLOAD_VIDEO -> {
@ -154,7 +161,7 @@ object DefaultUrlHandler {
val fieldId = uri.getQueryParameter("fieldId") ?: ""
val sectionName = uri.getQueryParameter("sectionName") ?: ""
val paginationType = uri.getQueryParameter("paginationType")
?: "page"//活动分页方式 page filter
?: "page"//活动分页方式 page filter
val location = if (!TextUtils.isEmpty(act)) {
VideoDetailContainerViewModel.Location.VIDEO_ACTIVITY.value
} else if (!TextUtils.isEmpty(fieldId)) {
@ -162,15 +169,31 @@ object DefaultUrlHandler {
} else {
id
}
directToLegacyVideoDetail(context, id, location, false, gameId, entrance, "", referer, type, act, paginationType, fieldId, sectionName)
directToLegacyVideoDetail(
context,
id,
location,
false,
gameId,
entrance,
"",
referer,
type,
act,
paginationType,
fieldId,
sectionName
)
}
EntranceUtils.HOST_VIDEO_DETAIL -> {
DirectUtils.directToVideoDetail(context, id, entrance, path)
}
EntranceUtils.HOST_VIDEO_SINGLE -> {
val referer = uri.getQueryParameter("referer") ?: ""
DirectUtils.directToVideoDetail(context, id, VideoDetailContainerViewModel.Location.SINGLE_VIDEO.value,
false, "", entrance, "", if (TextUtils.isEmpty(referer)) "" else referer)
DirectUtils.directToVideoDetail(
context, id, VideoDetailContainerViewModel.Location.SINGLE_VIDEO.value,
false, "", entrance, "", if (TextUtils.isEmpty(referer)) "" else referer
)
}
EntranceUtils.HOST_VIDEO_STREAMING_HOME -> {
intent = Intent(context, MainActivity::class.java)
@ -213,7 +236,7 @@ object DefaultUrlHandler {
EntranceUtils.HOST_BLOCK -> {
val name = uri.getQueryParameter("name")
?: ""
?: ""
val entity = SubjectRecommendEntity(link = id, name = name, text = name)
DirectUtils.directToBlock(context, entity, entrance)
}
@ -228,13 +251,13 @@ object DefaultUrlHandler {
EntranceUtils.HOST_HELP -> {
val name = uri.getQueryParameter("name")
?: ""
?: ""
DirectUtils.directToQa(context, name, id)
}
EntranceUtils.HOST_HELP_COLLECTION -> {
val name = uri.getQueryParameter("name")
?: ""
?: ""
DirectUtils.directToQaCollection(context, name, id)
}
@ -262,10 +285,11 @@ object DefaultUrlHandler {
EntranceUtils.HOST_GAME_NEWS -> {
DirectUtils.directToGameNews(
context,
uri.getQueryParameter(EntranceUtils.KEY_GAME_ID),
uri.getQueryParameter(EntranceUtils.KEY_GAME_NAME),
entrance);
context,
uri.getQueryParameter(EntranceUtils.KEY_GAME_ID),
uri.getQueryParameter(EntranceUtils.KEY_GAME_NAME),
entrance
);
}
EntranceUtils.HOST_GAME_CALENDAR -> {
@ -282,10 +306,11 @@ object DefaultUrlHandler {
EntranceUtils.HOST_GAME_RATING_DETAIL -> {
DirectUtils.directToGameRatingDetail(
context,
uri.getQueryParameter(EntranceUtils.KEY_GAME_ID),
uri.getQueryParameter(EntranceUtils.KEY_COMMENT_ID),
EntranceUtils.ENTRANCE_BROWSER)
context,
uri.getQueryParameter(EntranceUtils.KEY_GAME_ID),
uri.getQueryParameter(EntranceUtils.KEY_COMMENT_ID),
EntranceUtils.ENTRANCE_BROWSER
)
}
EntranceUtils.HOST_FORUM -> {
@ -301,19 +326,28 @@ object DefaultUrlHandler {
val forumId = uri.getQueryParameter("forum_id") ?: ""
val forumIcon = uri.getQueryParameter("forum_icon") ?: ""
val forumType = uri.getQueryParameter("forum_type") ?: BbsType.OFFICIAL_BBS.value
val gameId = uri.getQueryParameter("game_id") ?: ""
val gameName = uri.getQueryParameter("game_name") ?: ""
val icon = uri.getQueryParameter("game_icon") ?: ""
val iconSubscript = uri.getQueryParameter("game_icon_subscript") ?: ""
val gameEntity = if (forumType == BbsType.OFFICIAL_BBS.value) {
GameEntity(id = gameId, mName = gameName, mIcon = icon, mIconSubscript = iconSubscript)
} else null
val activityLabelEntity = ActivityLabelEntity(id = activityId, name = activityName)
val communityEntity = CommunityEntity(id = forumId, name = forumName, icon = forumIcon)
context.startActivity(VideoPublishActivity.getIntent(
context.startActivity(
VideoPublishActivity.getIntent(
context,
communityEntity,
gameEntity,
activityLabelEntity,
forumType,
false,
entrance,
""
))
)
)
}
EntranceUtils.HOST_SUGGESTION -> {
@ -322,13 +356,17 @@ object DefaultUrlHandler {
val gameId = uri.getQueryParameter(EntranceUtils.KEY_GAMEID)
val packageMd5 = uri.getQueryParameter(EntranceUtils.KEY_PACKAGE_MD5)
val isQaFeedback = uri.getQueryParameter(EntranceUtils.KEY_IS_QA_FEEDBACK) == "true"
val content = if (TextUtils.isEmpty(gameId) || TextUtils.isEmpty(packageMd5)) String.format("%s-%s-V%s",
uri.getQueryParameter(EntranceUtils.KEY_GAME_NAME),
if (TextUtils.isEmpty(platformName)) platform else platformName,
uri.getQueryParameter(EntranceUtils.KEY_VERSION)) else String.format("%s-%s-V%s\n游戏ID%s\n游戏包MD5%s\n",
uri.getQueryParameter(EntranceUtils.KEY_GAME_NAME),
if (TextUtils.isEmpty(platformName)) platform else platformName,
uri.getQueryParameter(EntranceUtils.KEY_VERSION), gameId, packageMd5)
val content = if (TextUtils.isEmpty(gameId) || TextUtils.isEmpty(packageMd5)) String.format(
"%s-%s-V%s",
uri.getQueryParameter(EntranceUtils.KEY_GAME_NAME),
if (TextUtils.isEmpty(platformName)) platform else platformName,
uri.getQueryParameter(EntranceUtils.KEY_VERSION)
) else String.format(
"%s-%s-V%s\n游戏ID%s\n游戏包MD5%s\n",
uri.getQueryParameter(EntranceUtils.KEY_GAME_NAME),
if (TextUtils.isEmpty(platformName)) platform else platformName,
uri.getQueryParameter(EntranceUtils.KEY_VERSION), gameId, packageMd5
)
val qaId = uri.getQueryParameter("qa_id") ?: ""
val qaContentId = uri.getQueryParameter(EntranceUtils.KEY_QA_CONTENT_ID) ?: ""
val qaTitle = uri.getQueryParameter(EntranceUtils.KEY_QA_TITLE)
@ -423,10 +461,11 @@ object DefaultUrlHandler {
fun transformNormalScheme(context: Context, url: String, entrance: String): Boolean {
val uri = Uri.parse(url)
if (uri.host == "www.ghzs666.com"
|| uri.host == "www.ghzs.com"
|| uri.host == "ask.ghzs.com"
|| uri.host == "m.ghzs.com"
|| uri.host == "m.ghzs666.com") {
|| uri.host == "www.ghzs.com"
|| uri.host == "ask.ghzs.com"
|| uri.host == "m.ghzs.com"
|| uri.host == "m.ghzs666.com"
) {
Utils.log(uri.path)
uri.path?.apply {
when {
@ -449,7 +488,9 @@ object DefaultUrlHandler {
var communityId = ""
var type = ""
var typeId = ""
val split = replace("/communities", "").replace("/bbs", "").replace(".html", "").split("/".toRegex()).dropLastWhile { it.isEmpty() }.toTypedArray()
val split =
replace("/communities", "").replace("/bbs", "").replace(".html", "").split("/".toRegex()).dropLastWhile { it.isEmpty() }
.toTypedArray()
for (text in split) {
if (TextUtils.isEmpty(communityId)) {
communityId = text
@ -465,8 +506,9 @@ object DefaultUrlHandler {
}
if ("articles" == type || "article" == type) {
DirectUtils.directToCommunityArticle(
context, typeId, communityId,
entrance, "文章链接")
context, typeId, communityId,
entrance, "文章链接"
)
}
}
contains("article") -> {

View File

@ -8,10 +8,7 @@ import com.gh.base.ToolBarActivity
import com.gh.common.util.EntranceUtils
import com.gh.gamecenter.NormalActivity
import com.gh.gamecenter.R
import com.gh.gamecenter.entity.ActivityLabelEntity
import com.gh.gamecenter.entity.CommunityEntity
import com.gh.gamecenter.entity.ForumVideoEntity
import com.gh.gamecenter.entity.VideoDraftEntity
import com.gh.gamecenter.entity.*
import com.gh.gamecenter.qa.BbsType
class VideoPublishActivity : NormalActivity() {
@ -25,16 +22,20 @@ class VideoPublishActivity : NormalActivity() {
companion object {
@JvmStatic
fun getIntent(context: Context,
communityEntity: CommunityEntity? = null,
activityLabel: ActivityLabelEntity? = null,
type: String,
disableForumSelection: Boolean = false,
entrance: String,
path: String): Intent {
fun getIntent(
context: Context,
communityEntity: CommunityEntity? = null,
gameEntity: GameEntity? = null,
activityLabel: ActivityLabelEntity? = null,
type: String,
disableForumSelection: Boolean = false,
entrance: String,
path: String
): Intent {
val bundle = Bundle()
bundle.putParcelable(CommunityEntity::class.java.simpleName, communityEntity)
bundle.putParcelable(ActivityLabelEntity::class.java.simpleName, activityLabel)
bundle.putParcelable(GameEntity::class.java.simpleName, gameEntity)
bundle.putString(BbsType::class.java.simpleName, type)
bundle.putBoolean(VideoPublishFragment.IS_FORUM_SELECTION_DISABLED, disableForumSelection)
bundle.putString(EntranceUtils.KEY_ENTRANCE, ToolBarActivity.mergeEntranceAndPath(entrance, path))

View File

@ -56,8 +56,7 @@ class VideoPublishFragment : NormalFragment(), KeyboardHeightObserver {
override fun getLayoutId(): Int = 0
override fun getInflatedLayout(): View {
mBinding =
FragmentVideoPublishBinding.inflate(LayoutInflater.from(requireContext()), null, false)
mBinding = FragmentVideoPublishBinding.inflate(LayoutInflater.from(requireContext()), null, false)
return mBinding.root
}
@ -70,10 +69,9 @@ class VideoPublishFragment : NormalFragment(), KeyboardHeightObserver {
mViewModel = viewModelProvider()
mViewModel.videoDraft = arguments?.getParcelable(VideoDraftEntity::class.java.simpleName)
mViewModel.videoPatch = arguments?.getParcelable(ForumVideoEntity::class.java.simpleName)
mViewModel.communityEntity =
arguments?.getParcelable(CommunityEntity::class.java.simpleName)
mViewModel.selectActivityLabelEntity =
arguments?.getParcelable(ActivityLabelEntity::class.java.simpleName)
mViewModel.communityEntity = arguments?.getParcelable(CommunityEntity::class.java.simpleName)
mViewModel.gameEntity = arguments?.getParcelable(GameEntity::class.java.simpleName)
mViewModel.selectActivityLabelEntity = arguments?.getParcelable(ActivityLabelEntity::class.java.simpleName)
mViewModel.type = arguments?.getString(BbsType::class.java.simpleName) ?: ""
mIsForumSelectionDisabled = arguments?.getBoolean(IS_FORUM_SELECTION_DISABLED) ?: false
@ -317,8 +315,7 @@ class VideoPublishFragment : NormalFragment(), KeyboardHeightObserver {
mBinding.videoPoster.setImageURI("file://$imagePath")
mUpdatedPosterPath = imagePath ?: ""
} else if (requestCode == ChooseForumActivity.CHOOSE_FORUM_REQUEST) {
val community =
data.getParcelableExtra<CommunityEntity>(EntranceUtils.KEY_COMMUNITY_DATA)
val community = data.getParcelableExtra<CommunityEntity>(EntranceUtils.KEY_COMMUNITY_DATA)
mViewModel.communityEntity = community
mViewModel.type = community?.type ?: ""
if (mViewModel.type == BbsType.GAME_BBS.value) {
@ -387,8 +384,7 @@ class VideoPublishFragment : NormalFragment(), KeyboardHeightObserver {
mViewModel.videoDraft?.let {
if (it.bbsId.isNotEmpty() && it.game != null) {
mViewModel.communityEntity = CommunityEntity(
it.bbsId, it.game?.name
?: "", icon = it.game?.icon, iconSubscript = it.game?.iconSubscript
it.bbsId, it.game?.name ?: "", icon = it.game?.icon, iconSubscript = it.game?.iconSubscript
)
mViewModel.gameEntity = it.game
}
@ -478,8 +474,7 @@ class VideoPublishFragment : NormalFragment(), KeyboardHeightObserver {
}
}
mVideoFileEntity =
VideoFileEntity(videoPath, null, poster, timeInSecond, videoFile.length(), format)
mVideoFileEntity = VideoFileEntity(videoPath, null, poster, timeInSecond, videoFile.length(), format)
createUploadTask(videoPath)
}
@ -497,12 +492,13 @@ class VideoPublishFragment : NormalFragment(), KeyboardHeightObserver {
mBinding.uploadStatus.text = "视频上传中..."
mBinding.uploadSpeed.visibility = View.VISIBLE
mBinding.pauseButton.visibility = View.VISIBLE
mBinding.uploadSpeed.text =
(SpeedUtils.getSpeed(speed) + "预计还需" + SpeedUtils.getRemainTime(
mBinding.uploadSpeed.text = "${SpeedUtils.getSpeed(speed)}预计还需${
SpeedUtils.getRemainTime(
totalSize,
currentSize,
speed
))
)
}"
mBinding.uploadProgress.update(((360 * currentSize) / totalSize).toInt(), "")
}
}
@ -660,8 +656,7 @@ class VideoPublishFragment : NormalFragment(), KeyboardHeightObserver {
when {
mVideoFileEntity?.url?.isNotEmpty() == true -> {
val videoEntity = VideoEntity(
length = mVideoFileEntity?.length
?: 0, url = mVideoFileEntity?.url ?: ""
length = mVideoFileEntity?.length ?: 0, url = mVideoFileEntity?.url ?: ""
)
intent = PosterEditActivity.getIntentByVideo(
requireContext(),
@ -670,8 +665,7 @@ class VideoPublishFragment : NormalFragment(), KeyboardHeightObserver {
}
mVideoFileEntity?.path?.isNotEmpty() == true -> {
intent = PosterEditActivity.getIntentByPath(
requireContext(), mVideoFileEntity?.url
?: ""
requireContext(), mVideoFileEntity?.url ?: ""
)
}
else -> {