变更数据分析接口为PostHog

This commit is contained in:
TonyJiangWJ 2024-03-27 22:09:13 +08:00
parent 750c9acaa5
commit 2a9747df3f
3 changed files with 20 additions and 12 deletions

View File

@ -12,7 +12,7 @@ def storePasswd = System.getenv('autojspasswd')
def keyPasswd = System.getenv('autojspasswd')
def alias = System.getenv('autojsalias')
def buglyAppId = System.getenv("bugly_app_id")
def flurryAppId = System.getenv("flurry_app_id")
def posthogAppId = System.getenv("posthog_app_id")
def signSupport = false
@ -43,7 +43,7 @@ android {
versionCode versions.appVersionCode
versionName versions.appVersionName
buildConfigField "String", "BUGLY_APP_ID", "\"${buglyAppId ?: ''}\""
buildConfigField "String", "FLURRY_APP_ID", "\"${flurryAppId ?: ''}\""
buildConfigField "String", "POSTHOG_APP_ID", "\"${posthogAppId ?: ''}\""
testInstrumentationRunner "androidx.test.runner.AndroidJUnitRunner"
multiDexEnabled true
javaCompileOptions {
@ -220,8 +220,8 @@ dependencies {
implementation 'joda-time:joda-time:2.12.5'
// Tasker Plugin
implementation 'com.twofortyfouram:android-plugin-client-sdk-for-locale:4.0.3'
// Flurry
implementation 'com.flurry.android:analytics:14.4.0@aar'
// PostHog
implementation("com.posthog:posthog-android:3.1.15")
// Bugly
implementation 'com.tencent.bugly:crashreport:4.0.4'
// 4.+

View File

@ -104,9 +104,9 @@
-keepattributes EnclosingMethod
# Required to preserve the Flurry SDK
-keep class com.flurry.** { *; }
-dontwarn com.flurry.**
# Required to preserve the PostHog SDK
-keep class com.posthog.** { *; }
-dontwarn com.posthog.**
-keepattributes *Annotation*,EnclosingMethod,Signature
-keepclasseswithmembers class * {

View File

@ -13,7 +13,9 @@ import androidx.multidex.MultiDexApplication
import com.bumptech.glide.Glide
import com.bumptech.glide.request.target.SimpleTarget
import com.bumptech.glide.request.transition.Transition
import com.flurry.android.FlurryAgent
import com.posthog.android.PostHogAndroid
import com.posthog.android.PostHogAndroidConfig
import com.stardust.app.GlobalAppContext
import com.stardust.autojs.core.ui.inflater.ImageLoader
import com.stardust.autojs.core.ui.inflater.util.Drawables
@ -34,6 +36,7 @@ import org.autojs.autojs.timing.TimedTaskScheduler
import org.autojs.autojs.tool.CrashHandler
import org.autojs.autojs.ui.error.ErrorReportActivity
import java.lang.ref.WeakReference
import java.util.*
/**
* Created by Stardust on 2017/1/27.
@ -53,11 +56,16 @@ class App : MultiDexApplication() {
}
private fun setUpStaticsTool() {
if (BuildConfig.DEBUG || StringUtils.isEmpty(BuildConfig.FLURRY_APP_ID))
if (BuildConfig.DEBUG || StringUtils.isEmpty(BuildConfig.POSTHOG_APP_ID))
return
FlurryAgent.Builder()
.withLogEnabled(BuildConfig.DEBUG)
.build(this, BuildConfig.FLURRY_APP_ID)
// Create a PostHog Config with the given API key and host
val config = PostHogAndroidConfig(
apiKey = BuildConfig.POSTHOG_APP_ID,
host = "https://app.posthog.com"
)
// Setup PostHog with the given Context and Config
PostHogAndroid.setup(this, config)
}
@SuppressLint("HardwareIds")