adjust 配置初步

This commit is contained in:
renhaoting 2025-12-31 18:48:19 +08:00
parent 80038162cf
commit 53d1acedc9
13 changed files with 172 additions and 0 deletions

1
StatisticReporter/.gitignore vendored Normal file
View File

@ -0,0 +1 @@
/build

View File

@ -0,0 +1,49 @@
plugins {
alias(libs.plugins.androidLibrary)
alias(libs.plugins.kotlinAndroid)
}
android {
namespace = "com.gamedog.statisticreporter"
compileSdk = 36
defaultConfig {
minSdk = 24
testInstrumentationRunner = "androidx.test.runner.AndroidJUnitRunner"
consumerProguardFiles("consumer-rules.pro")
}
buildTypes {
release {
isMinifyEnabled = false
proguardFiles(
getDefaultProguardFile("proguard-android-optimize.txt"),
"proguard-rules.pro"
)
}
}
compileOptions {
sourceCompatibility = JavaVersion.VERSION_11
targetCompatibility = JavaVersion.VERSION_11
}
kotlinOptions {
jvmTarget = "11"
}
}
dependencies {
implementation(libs.androidx.core.ktx)
implementation(libs.appcompat)
implementation(libs.material)
testImplementation(libs.junit)
androidTestImplementation(libs.androidx.test.ext.junit)
androidTestImplementation(libs.espresso.core)
api("com.adjust.sdk:adjust-android:5.5.0")
api("com.android.installreferrer:installreferrer:2.2")
// Add the following if you are using the Adjust SDK inside web views on your app
api("com.adjust.sdk:adjust-android-webbridge:5.5.0")
api("com.android.installreferrer:installreferrer:2.2")
api("com.adjust.sdk:adjust-android-huawei-referrer:5.0.0")
}

View File

21
StatisticReporter/proguard-rules.pro vendored Normal file
View File

@ -0,0 +1,21 @@
# Add project specific ProGuard rules here.
# You can control the set of applied configuration files using the
# proguardFiles setting in build.gradle.
#
# For more details, see
# http://developer.android.com/guide/developing/tools/proguard.html
# If your project uses WebView with JS, uncomment the following
# and specify the fully qualified class name to the JavaScript interface
# class:
#-keepclassmembers class fqcn.of.javascript.interface.for.webview {
# public *;
#}
# Uncomment this to preserve the line number information for
# debugging stack traces.
#-keepattributes SourceFile,LineNumberTable
# If you keep the line number information, uncomment this to
# hide the original source file name.
#-renamesourcefileattribute SourceFile

View File

@ -0,0 +1,24 @@
package com.gamedog.statisticreporter
import androidx.test.platform.app.InstrumentationRegistry
import androidx.test.ext.junit.runners.AndroidJUnit4
import org.junit.Test
import org.junit.runner.RunWith
import org.junit.Assert.*
/**
* Instrumented test, which will execute on an Android device.
*
* See [testing documentation](http://d.android.com/tools/testing).
*/
@RunWith(AndroidJUnit4::class)
class ExampleInstrumentedTest {
@Test
fun useAppContext() {
// Context of the app under test.
val appContext = InstrumentationRegistry.getInstrumentation().targetContext
assertEquals("com.gamedog.statisticreporter.test", appContext.packageName)
}
}

View File

@ -0,0 +1,7 @@
<?xml version="1.0" encoding="utf-8"?>
<manifest xmlns:android="http://schemas.android.com/apk/res/android">
<uses-permission android:name="android.permission.INTERNET"/>
<uses-permission android:name="android.permission.ACCESS_NETWORK_STATE"/>
<uses-permission android:name="android.permission.ACCESS_WIFI_STATE"/>
</manifest>

View File

@ -0,0 +1,38 @@
package com.gamedog.statisticreporter.adjust
import android.content.Context
import com.adjust.sdk.Adjust
import com.adjust.sdk.AdjustConfig
import com.adjust.sdk.LogLevel
import com.adjust.sdk.huawei.BuildConfig
class AdjustManager private constructor() {
companion object {
@Volatile
private var INSTANCE: AdjustManager? = null
fun instance(): AdjustManager {
return INSTANCE ?: synchronized(this) {
INSTANCE ?: AdjustManager().also { INSTANCE = it }
}
}
}
private lateinit var mAppContext: Context
fun initSdk(appToken: String) {
val isDebug = BuildConfig.DEBUG
val environment = if (isDebug) AdjustConfig.ENVIRONMENT_SANDBOX else AdjustConfig.ENVIRONMENT_PRODUCTION
val config = AdjustConfig(mAppContext, appToken, environment).apply {
setLogLevel(if (isDebug) LogLevel.VERBOSE else LogLevel.WARN)
}
Adjust.initSdk(config)
}
}

View File

@ -0,0 +1,4 @@
package com.gamedog.statisticreporter
class test {
}

View File

@ -0,0 +1,17 @@
package com.gamedog.statisticreporter
import org.junit.Test
import org.junit.Assert.*
/**
* Example local unit test, which will execute on the development machine (host).
*
* See [testing documentation](http://d.android.com/tools/testing).
*/
class ExampleUnitTest {
@Test
fun addition_isCorrect() {
assertEquals(4, 2 + 2)
}
}

View File

@ -75,6 +75,7 @@ dependencies {
implementation(project(":bill"))
implementation(project(":youtube:core"))
implementation(project(":youtube:custom-ui"))
implementation(project(":StatisticReporter"))
implementation libs.androidx.navigation.fragment.ktx
implementation(libs.startup)

View File

@ -3,6 +3,13 @@ package com.gamedog.vididin
object VidiConst {
const val ADJUST_TOKEN: String = "sa8ei0td10xs"
const val ADJUST_TOKEN_S2: String = "f3cff8c4bba54c6dc08b3401069ae06d"
const val ADJUST_WITHDRAW_SUCCESS_EVENT: String = "tjs3fp"
const val ADJUST_WITHDRAW_FAILED_EVENT: String = "33jp2j"
const val NEWBIE_GIFT_GOLD_NUM: Long = 100

View File

@ -1,6 +1,7 @@
package com.gamedog.vididin
import com.ama.core.architecture.BaseApp
import com.gamedog.statisticreporter.adjust.AdjustManager
import com.gamedog.vididin.core.login.login.AccountManager
import com.gamedog.vididin.manager.TaskManager
import dagger.hilt.android.HiltAndroidApp
@ -22,5 +23,6 @@ class VidiDinApp : BaseApp() {
AccountManager.getAccount()
TaskManager.instance().initNotificationData()
TaskManager.instance()
AdjustManager.instance().initSdk(VidiConst.ADJUST_TOKEN)
}
}

View File

@ -39,3 +39,4 @@ include ':app'
include ':bill'
include ':base'
include ':notification'
include ':StatisticReporter'