|
@@ -78,8 +78,8 @@ internal class CommSdkImpl(context: Context) {
|
|
|
}
|
|
|
TraceEventManager.instance.initialize(application) { id ->
|
|
|
Logger.d("onTraceIdRead: $id")
|
|
|
- CommSdkDrive.instance.setCommParam("aid", id)
|
|
|
- MMKVManager.instance.eventKV.encode("adjust_id", id)
|
|
|
+ CommSdkDrive.getInstance().setCommParam("aid", id)
|
|
|
+ MMKVManager.getInstance().eventKV.encode("adjust_id", id)
|
|
|
}
|
|
|
SdkProxyManager.call(Function.INIT_APPLICATION, arrayOf(Application::class.java), arrayOf(application))
|
|
|
}
|
|
@@ -111,13 +111,13 @@ internal class CommSdkImpl(context: Context) {
|
|
|
}
|
|
|
|
|
|
//获取当前屏幕尺寸
|
|
|
- CommSdkDrive.instance.setCommParam("screen", DensityUtils.getResolutionByFullScreen(activity))
|
|
|
+ CommSdkDrive.getInstance().setCommParam("screen", DensityUtils.getResolutionByFullScreen(activity))
|
|
|
|
|
|
- val adjustId = MMKVManager.instance.eventKV.decodeString("adjust_id")
|
|
|
+ val adjustId = MMKVManager.getInstance().eventKV.decodeString("adjust_id")
|
|
|
if (TextUtils.isEmpty(adjustId)) {
|
|
|
- CommSdkDrive.instance.setCommParam("aid", "")
|
|
|
+ CommSdkDrive.getInstance().setCommParam("aid", "")
|
|
|
} else {
|
|
|
- CommSdkDrive.instance.setCommParam("aid", adjustId!!)
|
|
|
+ CommSdkDrive.getInstance().setCommParam("aid", adjustId!!)
|
|
|
}
|
|
|
|
|
|
// 有些CP在资源再加时候回重复调用初始化,这里拦截一下
|
|
@@ -172,7 +172,7 @@ internal class CommSdkImpl(context: Context) {
|
|
|
}
|
|
|
|
|
|
private fun startInitCommSdk(activity: Activity, callback: ICallback) {
|
|
|
- SdkRequest.instance.initSdk(activity, "") { resultInfo ->
|
|
|
+ SdkRequest.getInstance().initSdk(activity, "") { resultInfo ->
|
|
|
initLoadingDialog?.apply {
|
|
|
dismiss()
|
|
|
initLoadingDialog = null
|
|
@@ -220,20 +220,20 @@ internal class CommSdkImpl(context: Context) {
|
|
|
val channelCallback = object : ICallback {
|
|
|
override fun onResult(code: Int, result: String) {
|
|
|
if (code == 0) {
|
|
|
- SdkRequest.instance.userVerify(activity, result) { resultInfo ->
|
|
|
+ SdkRequest.getInstance().userVerify(activity, result) { resultInfo ->
|
|
|
if (resultInfo.code == 1) {
|
|
|
if (!TextUtils.isEmpty(resultInfo.data)) {
|
|
|
val jsonObject = JSONObject(resultInfo.data)
|
|
|
- SdkLoginInfo.instance.userId = jsonObject.getString("uid")
|
|
|
- SdkLoginInfo.instance.token = jsonObject.getString("token")
|
|
|
- SdkLoginInfo.instance.isRegUser = jsonObject.getInt("is_reg_user") == 1
|
|
|
- if (SdkLoginInfo.instance.isRegUser) {
|
|
|
+ SdkLoginInfo.getInstance().userId = jsonObject.getString("uid")
|
|
|
+ SdkLoginInfo.getInstance().token = jsonObject.getString("token")
|
|
|
+ SdkLoginInfo.getInstance().isRegUser = jsonObject.getInt("is_reg_user") == 1
|
|
|
+ if (SdkLoginInfo.getInstance().isRegUser) {
|
|
|
TraceEventManager.instance.register(activity)
|
|
|
}
|
|
|
TraceEventManager.instance.login(activity)
|
|
|
}
|
|
|
showFloatBall(activity)
|
|
|
- callback.onResult(0, SdkLoginInfo.instance.toJsonString())
|
|
|
+ callback.onResult(0, SdkLoginInfo.getInstance().toJsonString())
|
|
|
} else {
|
|
|
callback.onResult(-1, resultInfo.msg)
|
|
|
}
|
|
@@ -263,7 +263,7 @@ internal class CommSdkImpl(context: Context) {
|
|
|
val channelCallback = object : ICallback {
|
|
|
override fun onResult(code: Int, result: String) {
|
|
|
if (code == 0) {
|
|
|
- SdkLoginInfo.instance.reset()
|
|
|
+ SdkLoginInfo.getInstance().reset()
|
|
|
}
|
|
|
callback.onResult(code, result)
|
|
|
}
|
|
@@ -305,7 +305,7 @@ internal class CommSdkImpl(context: Context) {
|
|
|
|
|
|
showPayLoadingDialog(activity)
|
|
|
|
|
|
- SdkRequest.instance.createOrder(activity, "", innerChargeInfo) { resultInfo ->
|
|
|
+ SdkRequest.getInstance().createOrder(activity, "", innerChargeInfo) { resultInfo ->
|
|
|
dismissPayLoadingDsmiialog(activity)
|
|
|
if (resultInfo.code == 1 && !TextUtils.isEmpty(resultInfo.data)) {
|
|
|
val jsonObject = JSONObject(resultInfo.data)
|
|
@@ -350,13 +350,13 @@ internal class CommSdkImpl(context: Context) {
|
|
|
return
|
|
|
}
|
|
|
|
|
|
- SdkLoginInfo.instance.currentRoleId = roleInfo.roleId
|
|
|
- SdkLoginInfo.instance.currentRoleName = roleInfo.roleName
|
|
|
- SdkLoginInfo.instance.currentRoleLevel = roleInfo.roleLevel
|
|
|
- SdkLoginInfo.instance.currentServerId = roleInfo.serverId
|
|
|
- SdkLoginInfo.instance.currentServerName = roleInfo.serverName
|
|
|
+ SdkLoginInfo.getInstance().currentRoleId = roleInfo.roleId
|
|
|
+ SdkLoginInfo.getInstance().currentRoleName = roleInfo.roleName
|
|
|
+ SdkLoginInfo.getInstance().currentRoleLevel = roleInfo.roleLevel
|
|
|
+ SdkLoginInfo.getInstance().currentServerId = roleInfo.serverId
|
|
|
+ SdkLoginInfo.getInstance().currentServerName = roleInfo.serverName
|
|
|
|
|
|
- SdkRequest.instance.submitRoleData(activity, roleInfo, "createRole") { resultInfo ->
|
|
|
+ SdkRequest.getInstance().submitRoleData(activity, roleInfo, "createRole") { resultInfo ->
|
|
|
Logger.d(resultInfo.toString())
|
|
|
}
|
|
|
|
|
@@ -377,13 +377,13 @@ internal class CommSdkImpl(context: Context) {
|
|
|
return
|
|
|
}
|
|
|
|
|
|
- SdkLoginInfo.instance.currentRoleId = roleInfo.roleId
|
|
|
- SdkLoginInfo.instance.currentRoleName = roleInfo.roleName
|
|
|
- SdkLoginInfo.instance.currentRoleLevel = roleInfo.roleLevel
|
|
|
- SdkLoginInfo.instance.currentServerId = roleInfo.serverId
|
|
|
- SdkLoginInfo.instance.currentServerName = roleInfo.serverName
|
|
|
+ SdkLoginInfo.getInstance().currentRoleId = roleInfo.roleId
|
|
|
+ SdkLoginInfo.getInstance().currentRoleName = roleInfo.roleName
|
|
|
+ SdkLoginInfo.getInstance().currentRoleLevel = roleInfo.roleLevel
|
|
|
+ SdkLoginInfo.getInstance().currentServerId = roleInfo.serverId
|
|
|
+ SdkLoginInfo.getInstance().currentServerName = roleInfo.serverName
|
|
|
|
|
|
- SdkRequest.instance.submitRoleData(activity, roleInfo, "enterGame") { resultInfo ->
|
|
|
+ SdkRequest.getInstance().submitRoleData(activity, roleInfo, "enterGame") { resultInfo ->
|
|
|
Logger.d(resultInfo.toString())
|
|
|
}
|
|
|
|
|
@@ -404,11 +404,11 @@ internal class CommSdkImpl(context: Context) {
|
|
|
return
|
|
|
}
|
|
|
|
|
|
- SdkLoginInfo.instance.currentRoleId = roleInfo.roleId
|
|
|
- SdkLoginInfo.instance.currentRoleName = roleInfo.roleName
|
|
|
- SdkLoginInfo.instance.currentRoleLevel = roleInfo.roleLevel
|
|
|
- SdkLoginInfo.instance.currentServerId = roleInfo.serverId
|
|
|
- SdkLoginInfo.instance.currentServerName = roleInfo.serverName
|
|
|
+ SdkLoginInfo.getInstance().currentRoleId = roleInfo.roleId
|
|
|
+ SdkLoginInfo.getInstance().currentRoleName = roleInfo.roleName
|
|
|
+ SdkLoginInfo.getInstance().currentRoleLevel = roleInfo.roleLevel
|
|
|
+ SdkLoginInfo.getInstance().currentServerId = roleInfo.serverId
|
|
|
+ SdkLoginInfo.getInstance().currentServerName = roleInfo.serverName
|
|
|
|
|
|
SdkProxyManager.call(Function.ROLE_LEVEL_UP, arrayOf(Activity::class.java, SdkRoleInfo::class.java), arrayOf(activity, roleInfo))
|
|
|
}
|
|
@@ -519,54 +519,7 @@ internal class CommSdkImpl(context: Context) {
|
|
|
SdkProxyManager.call(Function.ON_NEW_INTENT, arrayOf(Activity::class.java, Intent::class.java), arrayOf(activity, intent))
|
|
|
}
|
|
|
|
|
|
- fun getCurrentUserId(): String = SdkLoginInfo.instance.userId
|
|
|
-
|
|
|
-// fun getChannelVersion(): String {
|
|
|
-// if (checkSdkProxyNull(Function.GET_CHANNEL_VERSION, null)) {
|
|
|
-// return ""
|
|
|
-// }
|
|
|
-// if (checkSdkNonInit(Function.GET_CHANNEL_VERSION, null)) {
|
|
|
-// return ""
|
|
|
-// }
|
|
|
-//
|
|
|
-// return SdkProxyManager.callback(Function.GET_CHANNEL_VERSION, emptyArray(), emptyArray()).toString()
|
|
|
-// }
|
|
|
-//
|
|
|
-// fun getChannelName(): String {
|
|
|
-// if (checkSdkProxyNull(Function.GET_CHANNEL_NAME, null)) {
|
|
|
-// return ""
|
|
|
-// }
|
|
|
-// if (checkSdkNonInit(Function.GET_CHANNEL_NAME, null)) {
|
|
|
-// return ""
|
|
|
-// }
|
|
|
-//
|
|
|
-// return SdkProxyManager.callback(Function.GET_CHANNEL_NAME, emptyArray(), emptyArray()).toString()
|
|
|
-// }
|
|
|
-
|
|
|
-// fun linkingEvent(context: Context, sdkEvent: SdkEvent) {
|
|
|
-// if (checkSdkProxyNull(Function.LINKING_EVENT, null)) {
|
|
|
-// return
|
|
|
-// }
|
|
|
-// if (checkSdkNonInit(Function.LINKING_EVENT, null)) {
|
|
|
-// return
|
|
|
-// }
|
|
|
-//
|
|
|
-// SdkProxyManager.call(Function.LINKING_EVENT, arrayOf(Context::class.kotlin, SdkEvent::class.kotlin), arrayOf(context, sdkEvent))
|
|
|
-// }
|
|
|
-//
|
|
|
-// fun share(activity: Activity, line: String, tag: String, quote: String, callback: ICallback) {
|
|
|
-// if (checkSdkProxyNull(Function.SHARE, null)) {
|
|
|
-// return
|
|
|
-// }
|
|
|
-// if (checkSdkNonInit(Function.SHARE, null)) {
|
|
|
-// return
|
|
|
-// }
|
|
|
-//
|
|
|
-// SdkProxyManager.call(
|
|
|
-// Function.SHARE, arrayOf(Activity::class.kotlin, String::class.kotlin, String::class.kotlin, String::class.kotlin, ICallback::class.kotlin),
|
|
|
-// arrayOf(activity, line, tag, quote, callback)
|
|
|
-// )
|
|
|
-// }
|
|
|
+ fun getCurrentUserId(): String = SdkLoginInfo.getInstance().userId
|
|
|
|
|
|
/**
|
|
|
* SDK浮窗账号切换
|