Merge branch 'fix-GHZS-1788' into 'dev'

fix: 神策数据埋点第一期—0323测试(调整AppLaunch事件) https://jira.shanqu.cc/browse/GHZS-1788

See merge request halo/android/assistant-android!849
This commit is contained in:
叶子维
2023-03-28 09:47:17 +08:00
2 changed files with 7 additions and 18 deletions

View File

@ -19,7 +19,6 @@ import androidx.viewpager.widget.ViewPager
import com.alibaba.android.arouter.facade.annotation.Route
import com.alibaba.android.arouter.launcher.ARouter
import com.g00fy2.versioncompare.Version
import com.gh.common.constant.Config
import com.gh.common.dialog.NewPrivacyPolicyDialogFragment
import com.gh.common.util.*
import com.gh.common.util.DialogUtils
@ -107,8 +106,6 @@ class SplashScreenActivity : BaseActivity() {
SPUtils.setLong(Constants.SP_INITIAL_USAGE_TIME, System.currentTimeMillis())
HaloApp.getInstance().isBrandNewInstall = true
if (!PackageFlavorHelper.IS_TEST_FLAVOR) {
initSensors()
logAppLaunch()
showPrivacyDialog(guideLayout)
} else {
// Test dex2oat
@ -122,16 +119,12 @@ class SplashScreenActivity : BaseActivity() {
object : EmptyCallback {
override fun onCallback() {
SPUtils.setBoolean(Constants.SP_IS_DEV_ENV, false)
initSensors()
logAppLaunch()
showPrivacyDialog(guideLayout)
}
},
object : EmptyCallback {
override fun onCallback() {
SPUtils.setBoolean(Constants.SP_IS_DEV_ENV, true)
initSensors()
logAppLaunch()
showPrivacyDialog(guideLayout)
}
@ -145,8 +138,6 @@ class SplashScreenActivity : BaseActivity() {
cancelPreviousUpdateTask()
guideLayout.visibility = View.VISIBLE
//requestPermission()
initSensors()
logAppLaunch()
}
} else {
if (com.gh.gamecenter.common.BuildConfig.BUILD_TIME != 0L) {
@ -161,13 +152,6 @@ class SplashScreenActivity : BaseActivity() {
}
}
private fun initSensors() {
// 仅官网渠道和测试包启用神策
if ("GH_206" == HaloApp.getInstance().channel || PackageFlavorHelper.IS_TEST_FLAVOR) {
SensorsBridge.init(HaloApp.getInstance(), HaloApp.getInstance().channel)
}
}
private fun logAppLaunch() {
val packageUtilsConfig =
ARouter.getInstance().build(RouteConsts.provider.packageUtils).navigation() as? IPackageUtilsProvider
@ -183,6 +167,7 @@ class SplashScreenActivity : BaseActivity() {
put("package_name", packageName)
put("signature", signatureHash)
put("app_name", appProvider?.getAppName())
put("install_first_time", if (HaloApp.getInstance().isBrandNewInstall) "" else "")
}
}
SensorsBridge.trackEvent("AppLaunch", trackEvent)
@ -308,11 +293,17 @@ class SplashScreenActivity : BaseActivity() {
overridePendingTransition(0, 0)
startActivity(intent)
doFlavorInit()
logAppLaunch()
finish()
}
private fun doFlavorInit() {
HaloApp.getInstance().flavorProvider.init(HaloApp.getInstance(), this)
// 仅官网渠道和测试包启用神策
if ("GH_206" == HaloApp.getInstance().channel || PackageFlavorHelper.IS_TEST_FLAVOR) {
SensorsBridge.init(HaloApp.getInstance(), HaloApp.getInstance().channel)
}
}
private fun getGitLogString(): String {

View File

@ -170,8 +170,6 @@ object TrackerLogger {
jsonObject.put("meta", getMeta())
}
uploadToLoghub(jsonObject, true)
SensorsBridge.trackEvent("AppLaunchSuccessful")
}
private fun uploadToLoghub(jsonObject: JSONObject, uploadImmediately: Boolean) {