日期2025.9.3

集成openinststall注册量
This commit is contained in:
level 2025-09-03 19:55:56 +08:00
parent d94193f721
commit 54109cb164
6 changed files with 152 additions and 55 deletions

View File

@ -15,7 +15,7 @@ dependencies {
implementation(fileTree(mapOf("dir" to "src/main/libs", "include" to listOf("*.aar")))) implementation(fileTree(mapOf("dir" to "src/main/libs", "include" to listOf("*.aar"))))
implementation("androidx.swiperefreshlayout:swiperefreshlayout:1.1.0") implementation("androidx.swiperefreshlayout:swiperefreshlayout:1.1.0")
// implementation(files("src\\main\\libs\\Baidu_ocpc_action_2_7_2.aar")) // implementation(files("src\\main\\libs\\Baidu_ocpc_action_2_7_2.aar"))
// implementation(files("src\\main\\libs\\OpenInstall.jar")) implementation(files("src\\main\\libs\\OpenInstall.jar"))
// implementation("com.google.firebase:firebase-crashlytics-buildtools:3.0.2") // implementation("com.google.firebase:firebase-crashlytics-buildtools:3.0.2")
// implementation(files("src/main/libs/openinstall.jar")) // implementation(files("src/main/libs/openinstall.jar"))

View File

@ -59,6 +59,12 @@
<intent-filter> <intent-filter>
<action android:name="android.service.quicksettings.action.QS_TILE_PREFERENCES" /> <action android:name="android.service.quicksettings.action.QS_TILE_PREFERENCES" />
</intent-filter> </intent-filter>
<intent-filter>
<action android:name="android.intent.action.VIEW"/>
<category android:name="android.intent.category.DEFAULT"/>
<category android:name="android.intent.category.BROWSABLE"/>
<data android:scheme="ltbqy7"/>
</intent-filter>
</activity> </activity>
<activity <activity
android:name=".act.AgreementAndPrivacyActivity" android:name=".act.AgreementAndPrivacyActivity"
@ -143,6 +149,14 @@
<meta-data <meta-data
android:name="android.webkit.WebView.EnableSafeBrowsing" android:name="android.webkit.WebView.EnableSafeBrowsing"
android:value="false" /> android:value="false" />
<!--openinstall 使用广告推广-->
<meta-data
android:name="com.openinstall.APP_KEY"
android:value="ltbqy7"/>
<meta-data
android:name="com.openinstall.AD_TRACK"
android:value="true"/>
</application> </application>
</manifest> </manifest>

View File

@ -5,6 +5,7 @@ import android.content.Intent
import android.net.Uri import android.net.Uri
import android.os.Build import android.os.Build
import android.os.Bundle import android.os.Bundle
import android.provider.Settings
import android.text.TextUtils import android.text.TextUtils
import android.util.Log import android.util.Log
import android.view.View import android.view.View
@ -21,11 +22,20 @@ import androidx.core.content.FileProvider
import androidx.lifecycle.ViewModelProvider import androidx.lifecycle.ViewModelProvider
import androidx.lifecycle.lifecycleScope import androidx.lifecycle.lifecycleScope
import com.afollestad.materialdialogs.MaterialDialog import com.afollestad.materialdialogs.MaterialDialog
import com.cncat.vpn.common.Global
import com.cncat.vpn.service.ClashManager import com.cncat.vpn.service.ClashManager
import com.cncat.vpn.service.remote.IClashManager import com.cncat.vpn.service.remote.IClashManager
import com.cncat.vpn.service.remote.wrap import com.cncat.vpn.service.remote.wrap
import com.fm.openinstall.Configuration
import com.fm.openinstall.OpenInstall
import com.fm.openinstall.listener.AppInstallAdapter
import com.fm.openinstall.listener.AppInstallListener
import com.fm.openinstall.listener.AppWakeUpAdapter
import com.fm.openinstall.model.AppData
import com.fm.openinstall.model.Error
import com.github.gzuliyujiang.oaid.DeviceID import com.github.gzuliyujiang.oaid.DeviceID
import com.github.gzuliyujiang.oaid.DeviceIdentifier import com.github.gzuliyujiang.oaid.DeviceIdentifier
import com.google.gson.Gson
import com.google.gson.JsonObject import com.google.gson.JsonObject
import com.tencent.mmkv.MMKV import com.tencent.mmkv.MMKV
import com.yingmao.clash.BuildConfig import com.yingmao.clash.BuildConfig
@ -76,6 +86,7 @@ class SplashActivity : BaseActivity() {
var registerKey = "" var registerKey = ""
var registerIV2 = "" var registerIV2 = ""
lateinit var username: String lateinit var username: String
var InviteCode=""
} }
private var captchaInfo = "" private var captchaInfo = ""
@ -128,6 +139,8 @@ class SplashActivity : BaseActivity() {
private fun initApplication() { private fun initApplication() {
username = Utils.getUniqueID(this) username = Utils.getUniqueID(this)
MainApplication.initUtil() MainApplication.initUtil()
// 获取拉起参数
openinstall()
val oaId = OAID val oaId = OAID
Log.i("SplashActOAID", "OAID::" + OAID + "oaId.isEmpty()::" + oaId.isEmpty()) Log.i("SplashActOAID", "OAID::" + OAID + "oaId.isEmpty()::" + oaId.isEmpty())
if(oaId.isEmpty()){ if(oaId.isEmpty()){
@ -185,26 +198,24 @@ class SplashActivity : BaseActivity() {
// val byteArrayToHexStr = // val byteArrayToHexStr =
// AESUtil.byteArrayToHexStr(AESUtil.encrypt("https://api.yijianlianjsq.com+https://yjl.kuaifei.net+https://api.onetouchjsq.com+https://yjl.jimao.xyz")) // AESUtil.byteArrayToHexStr(AESUtil.encrypt("https://api.yijianlianjsq.com+https://yjl.kuaifei.net+https://api.onetouchjsq.com+https://yjl.jimao.xyz"))
// android.util.Log.i("AAAAAAAAAAA","data:::"+byteArrayToHexStr) // android.util.Log.i("AAAAAAAAAAA","data:::"+byteArrayToHexStr)
// 获取拉起参数
// openinstall()
} }
// override fun onNewIntent(intent: Intent?) { override fun onNewIntent(intent: Intent?) {
// super.onNewIntent(intent) super.onNewIntent(intent)
// // 此处要调用否则App在后台运行时会无法获取 // 此处要调用否则App在后台运行时会无法获取
// OpenInstall.getWakeUp(intent, wakeUpAdapter) OpenInstall.getWakeUp(intent, wakeUpAdapter)
// } }
// private var wakeUpAdapter: AppWakeUpAdapter = object : AppWakeUpAdapter() { private var wakeUpAdapter: AppWakeUpAdapter = object : AppWakeUpAdapter() {
// override fun onWakeUp(appData: AppData) { override fun onWakeUp(appData: AppData) {
// // 打印数据便于调试 // 打印数据便于调试
// Log.d("OpenInstall", "getWakeUp : wakeupData = $appData") Log.d("OpenInstallAAAAA", "getWakeUp : wakeupData = " + appData.toString());
// // 获取渠道编号参数 // 获取渠道编号参数
// val channelCode = appData.getChannel() val channelCode = appData.getChannel()
// // 获取自定义参数 // 获取自定义参数
// val bindData = appData.getData() val bindData = appData.getData()
// Log.d("OpenInstall", "channelCode : bindData = $channelCode"+"bindData::"+bindData) Log.d("OpenInstallAAAAA", "channelCode : bindData = $channelCode"+"bindData::"+bindData)
// } }
// } }
@SuppressLint("JavascriptInterface", "SetJavaScriptEnabled") @SuppressLint("JavascriptInterface", "SetJavaScriptEnabled")
private fun setWebView() { private fun setWebView() {
rlPb.visibility = View.INVISIBLE rlPb.visibility = View.INVISIBLE
@ -363,29 +374,84 @@ class SplashActivity : BaseActivity() {
} }
} }
val reqJson = JsonObject() OpenInstall.getInstall(object : AppInstallListener {
reqJson.addProperty("password", BZYConstants.defaultPassword) override fun onInstallFinish(appData: AppData?, error: Error?) {
reqJson.addProperty("checkPassword", BZYConstants.defaultPassword) if (error != null && error.shouldRetry()) {
reqJson.addProperty("invitationCode", BuildConfig.productId) // 获取数据异常,可以尝试重新获取
reqJson.addProperty("clientIp", "127.0.0.1") Log.d("OpenInstallError", "数据错误" + error.toString())
reqJson.addProperty("from", "5") val reqJson = JsonObject()
reqJson.addProperty("androidDevice", username) reqJson.addProperty("password", BZYConstants.defaultPassword)
reqJson.addProperty("userAgent", userAgent) reqJson.addProperty("checkPassword", BZYConstants.defaultPassword)
reqJson.addProperty("oaid", oaId) reqJson.addProperty("invitationCode", BuildConfig.productId)
reqJson.addProperty("equipmentModel", equipmentModel) reqJson.addProperty("clientIp", "127.0.0.1")
reqJson.addProperty("pkg", BuildConfig.applicationId) reqJson.addProperty("from", "5")
if (captchaInfo.isNotEmpty()) { reqJson.addProperty("androidDevice", username)
reqJson.addProperty("captchaVerifyParam", captchaInfo) reqJson.addProperty("userAgent", userAgent)
} reqJson.addProperty("oaid", oaId)
if (registerKey.isNotEmpty() && registerIV2.isNotEmpty()) { reqJson.addProperty("equipmentModel", equipmentModel)
val data = AESUtil.byteArrayToHexStr( reqJson.addProperty("pkg", BuildConfig.applicationId)
AESUtil.RegisterEncrypt(reqJson.toString(), registerKey, registerIV2) if (captchaInfo.isNotEmpty()) {
) reqJson.addProperty("captchaVerifyParam", captchaInfo)
val params: Map<String, String> = mutableMapOf( }
"data" to data if (registerKey.isNotEmpty() && registerIV2.isNotEmpty()) {
) val data = AESUtil.byteArrayToHexStr(
splashAtyVM.registerByEncryption(params) AESUtil.RegisterEncrypt(reqJson.toString(), registerKey, registerIV2)
} )
val params: Map<String, String> = mutableMapOf(
"data" to data
)
splashAtyVM.registerByEncryption(params)
}
} else {
val safeAppData = appData ?: AppData()
val channelCode = safeAppData.channel // 获取渠道编号参数
val bindData = safeAppData.data // 获取自定义参数
android.util.Log.d("OpenInstallSuccess", "获取数据" + safeAppData.toString()+"channelCode::${channelCode}"+"bindData::${bindData}")
val data = Gson().fromJson(bindData, InviteData::class.java)
InviteCode=data.InviteCode
android.util.Log.d("OpenInstallSuccess", "InviteCode:::${InviteCode}")
val reqJson = JsonObject()
reqJson.addProperty("password", BZYConstants.defaultPassword)
reqJson.addProperty("checkPassword", BZYConstants.defaultPassword)
if(InviteCode.isEmpty()){
Log.i(
"InviteCodeIsEmpty()",
"InviteCode::${InviteCode}"
)
reqJson.addProperty("invitationCode", BuildConfig.productId)
}else{
reqJson.addProperty("invitationCode", InviteCode)
Log.i(
"OpenInstallSuccessInviteCode",
"InviteCode::${InviteCode}"
)
}
reqJson.addProperty("clientIp", "127.0.0.1")
reqJson.addProperty("from", "5")
reqJson.addProperty("androidDevice", username)
reqJson.addProperty("userAgent", userAgent)
reqJson.addProperty("oaid", oaId)
reqJson.addProperty("equipmentModel", equipmentModel)
reqJson.addProperty("pkg", BuildConfig.applicationId)
if (captchaInfo.isNotEmpty()) {
reqJson.addProperty("captchaVerifyParam", captchaInfo)
}
if (registerKey.isNotEmpty() && registerIV2.isNotEmpty()) {
val data = AESUtil.byteArrayToHexStr(
AESUtil.RegisterEncrypt(reqJson.toString(), registerKey, registerIV2)
)
val params: Map<String, String> = mutableMapOf(
"data" to data
)
splashAtyVM.registerByEncryption(params)
}
}
}
})
} }
@SuppressLint("ClickableViewAccessibility") @SuppressLint("ClickableViewAccessibility")
@ -420,6 +486,8 @@ class SplashActivity : BaseActivity() {
if (decodeBool) { if (decodeBool) {
MMKV.defaultMMKV().encode(BZYConstants.INITIALIZATION, true) MMKV.defaultMMKV().encode(BZYConstants.INITIALIZATION, true)
} }
// 用户注册成功后调用
OpenInstall.reportRegister()
splashAtyVM.login(encryName, encryPsw) splashAtyVM.login(encryName, encryPsw)
} else if (code == "20062") { } else if (code == "20062") {
message?.let { message?.let {
@ -701,12 +769,20 @@ class SplashActivity : BaseActivity() {
} }
startActivity(intent) startActivity(intent)
} }
// private fun openinstall() { private fun openinstall() {
// // 所有的设备标识符开发者都可控制,请参考集成文档 val androidId =
// val configuration: Configuration? = Configuration.Builder() Settings.System.getString(baseContext.contentResolver, Settings.Secure.ANDROID_ID)
// .build() // 所有的设备标识符开发者都可控制,请参考集成文档
// val configuration: Configuration? = Configuration.Builder()
// OpenInstall.init(this, configuration) .androidId(androidId)
// OpenInstall.getWakeUp(intent, wakeUpAdapter) .serialNumber("10086")
// } .build()
OpenInstall.clipBoardEnabled(false); //false为不读取true为读取
OpenInstall.init(this, configuration)
OpenInstall.getWakeUp(intent, wakeUpAdapter)
}
data class InviteData(
val InviteCode: String
)
} }

View File

@ -12,15 +12,22 @@ import androidx.core.content.getSystemService
import com.cncat.vpn.common.Global import com.cncat.vpn.common.Global
import com.cncat.vpn.common.compat.currentProcessName import com.cncat.vpn.common.compat.currentProcessName
import com.cncat.vpn.common.log.Log import com.cncat.vpn.common.log.Log
import com.fm.openinstall.OpenInstall
import com.fm.openinstall.listener.AppInstallListener
import com.fm.openinstall.model.AppData
import com.fm.openinstall.model.Error
import com.github.gzuliyujiang.oaid.DeviceID import com.github.gzuliyujiang.oaid.DeviceID
import com.github.gzuliyujiang.oaid.DeviceIdentifier import com.github.gzuliyujiang.oaid.DeviceIdentifier
import com.github.gzuliyujiang.oaid.IGetter import com.github.gzuliyujiang.oaid.IGetter
import com.google.gson.Gson
import com.jakewharton.processphoenix.ProcessPhoenix import com.jakewharton.processphoenix.ProcessPhoenix
import com.orhanobut.logger.Logger import com.orhanobut.logger.Logger
import com.stripe.android.PaymentConfiguration import com.stripe.android.PaymentConfiguration
import com.tencent.mmkv.MMKV import com.tencent.mmkv.MMKV
import com.yingmao.clash.R import com.yingmao.clash.R
import com.yingmao.clash.act.SplashActivity.Companion.InviteCode
import com.yingmao.clash.act.SplashActivity.InviteData
import com.yingmao.clash.conf.Constants import com.yingmao.clash.conf.Constants
import com.yingmao.clash.entity.UserData import com.yingmao.clash.entity.UserData
import com.yingmao.clash.util.CrashCatchHandler import com.yingmao.clash.util.CrashCatchHandler
@ -110,7 +117,7 @@ class MainApplication : Application() {
mainApplication, mainApplication,
"pk_live_51Nkl6vLWP3xWXY4LfXtdMtXzHazv6pav2rH1p1BfICeh5meGGjglExiw4GgmSzWO7NptEM1c549Fe11zRy9nCfxs009zEwLpXP" "pk_live_51Nkl6vLWP3xWXY4LfXtdMtXzHazv6pav2rH1p1BfICeh5meGGjglExiw4GgmSzWO7NptEM1c549Fe11zRy9nCfxs009zEwLpXP"
) )
// OpenInstall.preInit(mainApplication) OpenInstall.preInit(mainApplication)
} }
} }

Binary file not shown.

View File

@ -93,7 +93,7 @@ subprojects {
} }
productFlavors { productFlavors {
flavorDimensions("feature") flavorDimensions("feature")
create("3333") { create("8279") {
isDefault = true isDefault = true
dimension = flavorDimensionList[0] dimension = flavorDimensionList[0]
buildConfigField("boolean", "PREMIUM", "Boolean.parseBoolean(\"false\")") buildConfigField("boolean", "PREMIUM", "Boolean.parseBoolean(\"false\")")
@ -101,7 +101,7 @@ subprojects {
buildConfigField("boolean", "is_back_cn", "false") buildConfigField("boolean", "is_back_cn", "false")
buildConfigField("String", "applicationId", "\"com.jsq.wufu\"") buildConfigField("String", "applicationId", "\"com.jsq.wufu\"")
buildConfigField("String", "service_url", "\"https://api.yijianlianjsq.com/\"") buildConfigField("String", "service_url", "\"https://api.yijianlianjsq.com/\"")
buildConfigField("String", "productId", "\"3333\"") buildConfigField("String", "productId", "\"8279\"")
manifestPlaceholders( manifestPlaceholders(
mapOf( mapOf(
"APP_NAME" to "@string/wf", "APP_NAME" to "@string/wf",
@ -112,7 +112,7 @@ subprojects {
} }
sourceSets { sourceSets {
getByName("3333") { getByName("8279") {
java.srcDirs("src/foss/java") java.srcDirs("src/foss/java")
} }
} }