parent
d94193f721
commit
54109cb164
|
|
@ -15,7 +15,7 @@ dependencies {
|
|||
implementation(fileTree(mapOf("dir" to "src/main/libs", "include" to listOf("*.aar"))))
|
||||
implementation("androidx.swiperefreshlayout:swiperefreshlayout:1.1.0")
|
||||
// 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(files("src/main/libs/openinstall.jar"))
|
||||
|
||||
|
|
|
|||
|
|
@ -59,6 +59,12 @@
|
|||
<intent-filter>
|
||||
<action android:name="android.service.quicksettings.action.QS_TILE_PREFERENCES" />
|
||||
</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
|
||||
android:name=".act.AgreementAndPrivacyActivity"
|
||||
|
|
@ -143,6 +149,14 @@
|
|||
<meta-data
|
||||
android:name="android.webkit.WebView.EnableSafeBrowsing"
|
||||
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>
|
||||
|
||||
</manifest>
|
||||
|
|
@ -5,6 +5,7 @@ import android.content.Intent
|
|||
import android.net.Uri
|
||||
import android.os.Build
|
||||
import android.os.Bundle
|
||||
import android.provider.Settings
|
||||
import android.text.TextUtils
|
||||
import android.util.Log
|
||||
import android.view.View
|
||||
|
|
@ -21,11 +22,20 @@ import androidx.core.content.FileProvider
|
|||
import androidx.lifecycle.ViewModelProvider
|
||||
import androidx.lifecycle.lifecycleScope
|
||||
import com.afollestad.materialdialogs.MaterialDialog
|
||||
import com.cncat.vpn.common.Global
|
||||
import com.cncat.vpn.service.ClashManager
|
||||
import com.cncat.vpn.service.remote.IClashManager
|
||||
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.DeviceIdentifier
|
||||
import com.google.gson.Gson
|
||||
import com.google.gson.JsonObject
|
||||
import com.tencent.mmkv.MMKV
|
||||
import com.yingmao.clash.BuildConfig
|
||||
|
|
@ -76,6 +86,7 @@ class SplashActivity : BaseActivity() {
|
|||
var registerKey = ""
|
||||
var registerIV2 = ""
|
||||
lateinit var username: String
|
||||
var InviteCode=""
|
||||
}
|
||||
|
||||
private var captchaInfo = ""
|
||||
|
|
@ -128,6 +139,8 @@ class SplashActivity : BaseActivity() {
|
|||
private fun initApplication() {
|
||||
username = Utils.getUniqueID(this)
|
||||
MainApplication.initUtil()
|
||||
// 获取拉起参数
|
||||
openinstall()
|
||||
val oaId = OAID
|
||||
Log.i("SplashActOAID", "OAID::" + OAID + "oaId.isEmpty()::" + oaId.isEmpty())
|
||||
if(oaId.isEmpty()){
|
||||
|
|
@ -185,26 +198,24 @@ class SplashActivity : BaseActivity() {
|
|||
// val byteArrayToHexStr =
|
||||
// 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)
|
||||
|
||||
// 获取拉起参数
|
||||
// openinstall()
|
||||
}
|
||||
// override fun onNewIntent(intent: Intent?) {
|
||||
// super.onNewIntent(intent)
|
||||
// // 此处要调用,否则App在后台运行时,会无法获取
|
||||
// OpenInstall.getWakeUp(intent, wakeUpAdapter)
|
||||
// }
|
||||
// private var wakeUpAdapter: AppWakeUpAdapter = object : AppWakeUpAdapter() {
|
||||
// override fun onWakeUp(appData: AppData) {
|
||||
// // 打印数据便于调试
|
||||
// Log.d("OpenInstall", "getWakeUp : wakeupData = $appData")
|
||||
// // 获取渠道编号参数
|
||||
// val channelCode = appData.getChannel()
|
||||
// // 获取自定义参数
|
||||
// val bindData = appData.getData()
|
||||
// Log.d("OpenInstall", "channelCode : bindData = $channelCode"+"bindData::"+bindData)
|
||||
// }
|
||||
// }
|
||||
override fun onNewIntent(intent: Intent?) {
|
||||
super.onNewIntent(intent)
|
||||
// 此处要调用,否则App在后台运行时,会无法获取
|
||||
OpenInstall.getWakeUp(intent, wakeUpAdapter)
|
||||
}
|
||||
private var wakeUpAdapter: AppWakeUpAdapter = object : AppWakeUpAdapter() {
|
||||
override fun onWakeUp(appData: AppData) {
|
||||
// 打印数据便于调试
|
||||
Log.d("OpenInstallAAAAA", "getWakeUp : wakeupData = " + appData.toString());
|
||||
// 获取渠道编号参数
|
||||
val channelCode = appData.getChannel()
|
||||
// 获取自定义参数
|
||||
val bindData = appData.getData()
|
||||
Log.d("OpenInstallAAAAA", "channelCode : bindData = $channelCode"+"bindData::"+bindData)
|
||||
}
|
||||
}
|
||||
|
||||
@SuppressLint("JavascriptInterface", "SetJavaScriptEnabled")
|
||||
private fun setWebView() {
|
||||
rlPb.visibility = View.INVISIBLE
|
||||
|
|
@ -363,29 +374,84 @@ class SplashActivity : BaseActivity() {
|
|||
}
|
||||
|
||||
}
|
||||
val reqJson = JsonObject()
|
||||
reqJson.addProperty("password", BZYConstants.defaultPassword)
|
||||
reqJson.addProperty("checkPassword", BZYConstants.defaultPassword)
|
||||
reqJson.addProperty("invitationCode", BuildConfig.productId)
|
||||
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)
|
||||
}
|
||||
OpenInstall.getInstall(object : AppInstallListener {
|
||||
override fun onInstallFinish(appData: AppData?, error: Error?) {
|
||||
if (error != null && error.shouldRetry()) {
|
||||
// 获取数据异常,可以尝试重新获取
|
||||
Log.d("OpenInstallError", "数据错误" + error.toString())
|
||||
val reqJson = JsonObject()
|
||||
reqJson.addProperty("password", BZYConstants.defaultPassword)
|
||||
reqJson.addProperty("checkPassword", BZYConstants.defaultPassword)
|
||||
reqJson.addProperty("invitationCode", BuildConfig.productId)
|
||||
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)
|
||||
}
|
||||
} 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")
|
||||
|
|
@ -420,6 +486,8 @@ class SplashActivity : BaseActivity() {
|
|||
if (decodeBool) {
|
||||
MMKV.defaultMMKV().encode(BZYConstants.INITIALIZATION, true)
|
||||
}
|
||||
// 用户注册成功后调用
|
||||
OpenInstall.reportRegister()
|
||||
splashAtyVM.login(encryName, encryPsw)
|
||||
} else if (code == "20062") {
|
||||
message?.let {
|
||||
|
|
@ -701,12 +769,20 @@ class SplashActivity : BaseActivity() {
|
|||
}
|
||||
startActivity(intent)
|
||||
}
|
||||
// private fun openinstall() {
|
||||
// // 所有的设备标识符开发者都可控制,请参考集成文档
|
||||
// val configuration: Configuration? = Configuration.Builder()
|
||||
// .build()
|
||||
//
|
||||
// OpenInstall.init(this, configuration)
|
||||
// OpenInstall.getWakeUp(intent, wakeUpAdapter)
|
||||
// }
|
||||
private fun openinstall() {
|
||||
val androidId =
|
||||
Settings.System.getString(baseContext.contentResolver, Settings.Secure.ANDROID_ID)
|
||||
// 所有的设备标识符开发者都可控制,请参考集成文档
|
||||
val configuration: Configuration? = Configuration.Builder()
|
||||
.androidId(androidId)
|
||||
.serialNumber("10086")
|
||||
.build()
|
||||
|
||||
OpenInstall.clipBoardEnabled(false); //false为不读取,true为读取
|
||||
OpenInstall.init(this, configuration)
|
||||
OpenInstall.getWakeUp(intent, wakeUpAdapter)
|
||||
}
|
||||
data class InviteData(
|
||||
val InviteCode: String
|
||||
)
|
||||
}
|
||||
|
|
@ -12,15 +12,22 @@ import androidx.core.content.getSystemService
|
|||
import com.cncat.vpn.common.Global
|
||||
import com.cncat.vpn.common.compat.currentProcessName
|
||||
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.DeviceIdentifier
|
||||
import com.github.gzuliyujiang.oaid.IGetter
|
||||
import com.google.gson.Gson
|
||||
|
||||
import com.jakewharton.processphoenix.ProcessPhoenix
|
||||
import com.orhanobut.logger.Logger
|
||||
import com.stripe.android.PaymentConfiguration
|
||||
import com.tencent.mmkv.MMKV
|
||||
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.entity.UserData
|
||||
import com.yingmao.clash.util.CrashCatchHandler
|
||||
|
|
@ -110,7 +117,7 @@ class MainApplication : Application() {
|
|||
mainApplication,
|
||||
"pk_live_51Nkl6vLWP3xWXY4LfXtdMtXzHazv6pav2rH1p1BfICeh5meGGjglExiw4GgmSzWO7NptEM1c549Fe11zRy9nCfxs009zEwLpXP"
|
||||
)
|
||||
// OpenInstall.preInit(mainApplication)
|
||||
OpenInstall.preInit(mainApplication)
|
||||
}
|
||||
}
|
||||
|
||||
|
|
|
|||
Binary file not shown.
|
|
@ -93,7 +93,7 @@ subprojects {
|
|||
}
|
||||
productFlavors {
|
||||
flavorDimensions("feature")
|
||||
create("3333") {
|
||||
create("8279") {
|
||||
isDefault = true
|
||||
dimension = flavorDimensionList[0]
|
||||
buildConfigField("boolean", "PREMIUM", "Boolean.parseBoolean(\"false\")")
|
||||
|
|
@ -101,7 +101,7 @@ subprojects {
|
|||
buildConfigField("boolean", "is_back_cn", "false")
|
||||
buildConfigField("String", "applicationId", "\"com.jsq.wufu\"")
|
||||
buildConfigField("String", "service_url", "\"https://api.yijianlianjsq.com/\"")
|
||||
buildConfigField("String", "productId", "\"3333\"")
|
||||
buildConfigField("String", "productId", "\"8279\"")
|
||||
manifestPlaceholders(
|
||||
mapOf(
|
||||
"APP_NAME" to "@string/wf",
|
||||
|
|
@ -112,7 +112,7 @@ subprojects {
|
|||
|
||||
}
|
||||
sourceSets {
|
||||
getByName("3333") {
|
||||
getByName("8279") {
|
||||
java.srcDirs("src/foss/java")
|
||||
}
|
||||
}
|
||||
|
|
|
|||
Loading…
Reference in New Issue