fix: 修复特殊打包选择首页 tab 异常的问题

This commit is contained in:
chenjuntao
2023-07-21 17:38:32 +08:00
parent 0c437d32bd
commit 4f0c81420e
3 changed files with 9 additions and 12 deletions

View File

@ -84,6 +84,7 @@ class HomeSearchToolWrapperViewModel(application: Application) : AndroidViewMode
if (pkgLinkEntity.type == tab.type
&& (pkgLinkEntity.link == tab.link || tab.link == null)) {
defaultTabPosition = index
PkgHelper.markConfigUsed()
break
}
}

View File

@ -26,7 +26,7 @@ object PkgHelper {
/**
* 获取激活比例
*/
fun getActivateRatio() : Int {
fun getActivateRatio(): Int {
return if (mActivateRatioFromInternet > 0) {
mActivateRatioFromInternet
} else {
@ -42,19 +42,18 @@ object PkgHelper {
}
fun getPkgConfig(isFromHomeTopTab: Boolean): PkgConfigEntity.PkgLinkEntity? {
if (mPkgConfigLink == null
&& !SPUtils.getBoolean(SP_PKG_CONFIG_IS_USED, false)
if (!SPUtils.getBoolean(SP_PKG_CONFIG_IS_USED, false)
&& BuildConfig.FIRST_LAUNCH.isNotEmpty()
) {
mPkgConfigLink =
String(Base64.decode(BuildConfig.FIRST_LAUNCH, Base64.DEFAULT), Charset.defaultCharset()).toObject()
if (mPkgConfigLink == null) {
mPkgConfigLink =
String(Base64.decode(BuildConfig.FIRST_LAUNCH, Base64.DEFAULT), Charset.defaultCharset()).toObject()
}
mTempPkgConfigEntity = mPkgConfigLink
return if (isFromHomeTopTab) {
if (mPkgConfigLink?.shouldStayAtHomePage != true && mPkgConfigLink?.homeBottomTab == "home") {
markConfigUsed()
if (mPkgConfigLink?.shouldStayAtHomePage == true && mPkgConfigLink?.homeBottomTab == "home") {
mPkgConfigLink
} else {
null
@ -77,7 +76,7 @@ object PkgHelper {
}
/**
* 获取特殊包配置
* 从接口获取特殊包配置
*/
fun requestPkgConfig(configId: String) {
if (SPUtils.getBoolean(SP_PKG_CONFIG_IS_USED, false)) return