Commit 05738987 authored by sheteng's avatar sheteng

v2.0 开发 11 切换app支付

parent 60c23e3a
...@@ -140,4 +140,6 @@ dependencies { ...@@ -140,4 +140,6 @@ dependencies {
implementation("com.tencent.bugly:crashreport_upgrade:latest.release")//其中latest.release指代最新版本号,也可以指定明确的版本号,例如1.2.0 implementation("com.tencent.bugly:crashreport_upgrade:latest.release")//其中latest.release指代最新版本号,也可以指定明确的版本号,例如1.2.0
implementation("com.tencent.bugly:nativecrashreport:latest.release") implementation("com.tencent.bugly:nativecrashreport:latest.release")
implementation("com.tencent.tpns:tpns:1.3.2.0-release") implementation("com.tencent.tpns:tpns:1.3.2.0-release")
//支付宝支付
implementation("com.alipay.sdk:alipaysdk-android:+@aar")
} }
\ No newline at end of file
...@@ -272,3 +272,24 @@ ...@@ -272,3 +272,24 @@
-keep class com.linkedin.** { *; } -keep class com.linkedin.** { *; }
-keep class com.android.dingtalk.share.ddsharemodule.** { *; } -keep class com.android.dingtalk.share.ddsharemodule.** { *; }
-keepattributes Signature -keepattributes Signature
-keep class com.alipay.android.app.IAlixPay{*;}
-keep class com.alipay.android.app.IAlixPay$Stub{*;}
-keep class com.alipay.android.app.IRemoteServiceCallback{*;}
-keep class com.alipay.android.app.IRemoteServiceCallback$Stub{*;}
-keep class com.alipay.sdk.app.PayTask{ public *;}
-keep class com.alipay.sdk.app.AuthTask{ public *;}
-keep class com.alipay.sdk.app.H5PayCallback {
<fields>;
<methods>;
}
-keep class com.alipay.android.phone.mrpc.core.** { *; }
-keep class com.alipay.apmobilesecuritysdk.** { *; }
-keep class com.alipay.mobile.framework.service.annotation.** { *; }
-keep class com.alipay.mobilesecuritysdk.face.** { *; }
-keep class com.alipay.tscenter.biz.rpc.** { *; }
-keep class org.json.alipay.** { *; }
-keep class com.alipay.tscenter.** { *; }
-keep class com.ta.utdid2.** { *;}
-keep class com.ut.device.** { *;}
\ No newline at end of file
...@@ -144,6 +144,18 @@ ...@@ -144,6 +144,18 @@
<!-- android:name="android.support.FILE_PROVIDER_PATHS"--> <!-- android:name="android.support.FILE_PROVIDER_PATHS"-->
<!-- android:resource="@xml/filepaths"/>--> <!-- android:resource="@xml/filepaths"/>-->
<!-- </provider>--> <!-- </provider>-->
<!-- <activity-->
<!-- android:name="com.alipay.sdk.app.H5PayActivity"-->
<!-- android:configChanges="orientation|keyboardHidden|navigation"-->
<!-- android:exported="false"-->
<!-- android:screenOrientation="behind" >-->
<!-- </activity>-->
<!-- <activity-->
<!-- android:name="com.alipay.sdk.auth.AuthActivity"-->
<!-- android:configChanges="orientation|keyboardHidden|navigation"-->
<!-- android:exported="false"-->
<!-- android:screenOrientation="behind" >-->
<!-- </activity>-->
<activity <activity
android:name="com.chuanglan.shanyan_sdk.view.CmccLoginActivity" android:name="com.chuanglan.shanyan_sdk.view.CmccLoginActivity"
......
...@@ -57,7 +57,7 @@ class GameListModel : ViewModel() { ...@@ -57,7 +57,7 @@ class GameListModel : ViewModel() {
suspend fun getSupportGameList(xPageFragment: XPageFragment) { suspend fun getSupportGameList(xPageFragment: XPageFragment) {
val res = val res =
HttpGo.getSync<List<String>>("/api/new/game/getPackageNameList") HttpGo.getSync<List<String>>("/api/new/game/getPackageNameList?channelId=${SysUtils.getChannel()}")
res?.let { res?.let {
it.data?.let { it1 -> gameList.addAll(it1) } it.data?.let { it1 -> gameList.addAll(it1) }
} }
......
package com.ccwangluo.accelerator.ui.login package com.ccwangluo.accelerator.ui.login
import android.os.Handler
import android.os.Looper
import android.os.Message
import android.view.LayoutInflater import android.view.LayoutInflater
import android.view.View import android.view.View
import android.view.ViewGroup import android.view.ViewGroup
import android.widget.Toast
import androidx.lifecycle.lifecycleScope import androidx.lifecycle.lifecycleScope
import com.alipay.sdk.app.PayTask
import com.ccwangluo.accelerator.databinding.FragmentSplashBinding import com.ccwangluo.accelerator.databinding.FragmentSplashBinding
import com.ccwangluo.accelerator.ui.BottomNavigationFragment import com.ccwangluo.accelerator.ui.BottomNavigationFragment
import com.ccwangluo.accelerator.utils.AcceleratorUtils
import com.ccwangluo.accelerator.utils.SysUtils
import com.ccwangluo.accelerator.utils.http.HttpGo
import com.tencent.map.geolocation.TencentLocationManager import com.tencent.map.geolocation.TencentLocationManager
import com.xuexiang.xpage.annotation.Page import com.xuexiang.xpage.annotation.Page
import com.xuexiang.xpage.base.XPageFragment import com.xuexiang.xpage.base.XPageFragment
...@@ -25,17 +27,16 @@ class SplashFragment : XPageFragment() { ...@@ -25,17 +27,16 @@ class SplashFragment : XPageFragment() {
override fun initTitleBar(): TitleBar? { override fun initTitleBar(): TitleBar? {
return null return null
} }
override fun inflateView(inflater: LayoutInflater?, container: ViewGroup?): View { override fun inflateView(inflater: LayoutInflater?, container: ViewGroup?): View {
val inflate = FragmentSplashBinding.inflate(inflater!!, container, false) val inflate = FragmentSplashBinding.inflate(inflater!!, container, false)
return inflate.root return inflate.root
} }
override fun initViews() { override fun initViews() {
TencentLocationManager.getInstance(context) TencentLocationManager.getInstance(context)
lifecycleScope.launch(Dispatchers.IO) { lifecycleScope.launch(Dispatchers.IO) {
// val map = mutableMapOf<String, Any>()
// map.put("packageNameList", SysUtils.getAllAppInfo(context!!))
// HttpGo.postSync<String>("/api/game/addHotGame",map)
delay(1000) delay(1000)
withContext(Dispatchers.Main) { withContext(Dispatchers.Main) {
openPage(BottomNavigationFragment::class.java, false) openPage(BottomNavigationFragment::class.java, false)
......
...@@ -188,7 +188,7 @@ class NewsObjectFragment : XPageFragment() { ...@@ -188,7 +188,7 @@ class NewsObjectFragment : XPageFragment() {
newsViewModel?.greate( newsViewModel?.greate(
this@NewsObjectFragment, this@NewsObjectFragment,
itemData.type, itemData.type,
itemData.gameId, gameId,
itemData.id, itemData.id,
it it
) { ) {
...@@ -251,8 +251,9 @@ class NewsObjectFragment : XPageFragment() { ...@@ -251,8 +251,9 @@ class NewsObjectFragment : XPageFragment() {
PageOption.to(CommonWebViewFragment::class.java) PageOption.to(CommonWebViewFragment::class.java)
.putString( .putString(
CommonWebViewFragment.WEBVIEW_URL_KEY, HttpConfig.UI_MAIN_URL + CommonWebViewFragment.WEBVIEW_URL_KEY, HttpConfig.UI_MAIN_URL +
"/gameDetail?gameId=${gameId}&id=${itemData.id}" "/gameDetail?id=${itemData.id}"
) )
.putInt(CommonWebViewFragment.GAME_ID,gameId)
.setRequestCode(CLICK_GREAT_REQUEST_CODE) .setRequestCode(CLICK_GREAT_REQUEST_CODE)
.open(this) .open(this)
} }
......
...@@ -58,7 +58,10 @@ class NewsObjectModel : ViewModel() { ...@@ -58,7 +58,10 @@ class NewsObjectModel : ViewModel() {
map.put("type", it) map.put("type", it)
} }
if (LoginUtils.token == null) { if (LoginUtils.token == null) {
xPageFragment.context?.let { LoginUtils.login(it, {}) } xPageFragment.context?.let { LoginUtils.login(it) {
callback()
}
}
return return
} }
viewModelScope.launch(Dispatchers.IO) { viewModelScope.launch(Dispatchers.IO) {
......
...@@ -11,14 +11,23 @@ import com.xuexiang.xutil.system.PermissionUtils ...@@ -11,14 +11,23 @@ import com.xuexiang.xutil.system.PermissionUtils
import android.content.Intent import android.content.Intent
import android.net.Uri import android.net.Uri
import android.os.Handler import android.os.Handler
import android.os.Looper
import android.os.Message
import android.provider.Settings import android.provider.Settings
import android.widget.Toast
import androidx.lifecycle.lifecycleScope
import com.alipay.sdk.app.PayTask
import com.ccwangluo.accelerator.manager.DownloadUtils import com.ccwangluo.accelerator.manager.DownloadUtils
import com.ccwangluo.accelerator.manager.LoginUtils import com.ccwangluo.accelerator.manager.LoginUtils
import com.ccwangluo.accelerator.utils.* import com.ccwangluo.accelerator.utils.*
import com.ccwangluo.accelerator.utils.datareport.DataRePortUtils import com.ccwangluo.accelerator.utils.datareport.DataRePortUtils
import com.github.shadowsocks.Core.activity
import com.github.shadowsocks.bg.AuthManager import com.github.shadowsocks.bg.AuthManager
import com.github.shadowsocks.bg.BaseService import com.github.shadowsocks.bg.BaseService
import com.tencent.bugly.beta.Beta import com.tencent.bugly.beta.Beta
import com.umeng.socialize.utils.DeviceConfigInternal.context
import kotlinx.coroutines.Dispatchers
import kotlinx.coroutines.launch
/** /**
...@@ -30,6 +39,40 @@ class AndroidInterface( ...@@ -30,6 +39,40 @@ class AndroidInterface(
var gameId: Int = -1 var gameId: Int = -1
) { ) {
private var handler = object : Handler(Looper.getMainLooper()) {
override fun handleMessage(msg: Message) {
if (msg.what == SDK_PAY_FLAG) {
// msg.obj 返回给前端
agentWeb.getJsAccessEntrace()
.quickCallJs(payCallback, payOrderId)
}
}
}
val SDK_PAY_FLAG = 1000
var payCallback = ""
var payOrderId = ""
@JavascriptInterface
fun callAliPay(callback: String, orderId: String, orderInfo: String) {
this.payCallback = callback
this.payOrderId = orderId
xPageFragment.activity?.let {
xPageFragment.lifecycleScope.launch(Dispatchers.IO){
val alipay = PayTask(it)
val result = alipay.payV2(orderInfo, true)
val msg = Message()
msg.what = SDK_PAY_FLAG
msg.obj = result
handler.sendMessage(msg)
}
}
}
@JavascriptInterface @JavascriptInterface
fun callAndroid(msg: String) { fun callAndroid(msg: String) {
XToastUtils.toast("这是Js调用Android的方法,内容:$msg") XToastUtils.toast("这是Js调用Android的方法,内容:$msg")
...@@ -177,7 +220,6 @@ class AndroidInterface( ...@@ -177,7 +220,6 @@ class AndroidInterface(
} }
} }
private val handler: Handler = Handler()
/** /**
* 点击游戏主页下面的加速按钮调用 * 点击游戏主页下面的加速按钮调用
......
package com.ccwangluo.accelerator.ui.web package com.ccwangluo.accelerator.ui.web
import android.app.Activity
import android.app.AlertDialog
import android.content.DialogInterface
import android.content.Intent
import android.graphics.Bitmap import android.graphics.Bitmap
import android.graphics.Color import android.graphics.Color
import android.net.Uri
import android.text.TextUtils import android.text.TextUtils
import android.view.KeyEvent import android.view.KeyEvent
import android.view.LayoutInflater import android.view.LayoutInflater
import android.view.View import android.view.View
import android.view.ViewGroup import android.view.ViewGroup
import android.webkit.WebChromeClient import android.webkit.WebChromeClient
import android.webkit.WebResourceRequest
import android.webkit.WebView import android.webkit.WebView
import android.webkit.WebViewClient import android.webkit.WebViewClient
import android.widget.FrameLayout import android.widget.FrameLayout
import androidx.fragment.app.Fragment import androidx.fragment.app.Fragment
import com.ccwangluo.accelerator.databinding.FragmentWebviewBinding import com.ccwangluo.accelerator.databinding.FragmentWebviewBinding
import com.ccwangluo.accelerator.utils.AcceleratorUtils
import com.ccwangluo.accelerator.manager.LoginUtils import com.ccwangluo.accelerator.manager.LoginUtils
import com.ccwangluo.accelerator.utils.SysUtils import com.ccwangluo.accelerator.utils.SysUtils
import com.github.shadowsocks.http.HttpConfig import com.github.shadowsocks.http.HttpConfig
...@@ -105,7 +110,9 @@ class CommonWebViewFragment : XPageFragment() { ...@@ -105,7 +110,9 @@ class CommonWebViewFragment : XPageFragment() {
} }
} }
} }
} }
val mWebChromeClient: WebChromeClient = object : WebChromeClient() { val mWebChromeClient: WebChromeClient = object : WebChromeClient() {
override fun onProgressChanged(view: WebView?, newProgress: Int) { override fun onProgressChanged(view: WebView?, newProgress: Int) {
//do you work //do you work
...@@ -127,6 +134,7 @@ class CommonWebViewFragment : XPageFragment() { ...@@ -127,6 +134,7 @@ class CommonWebViewFragment : XPageFragment() {
binding.webClose.visibility = View.GONE binding.webClose.visibility = View.GONE
} }
} }
} }
override fun initListeners() { override fun initListeners() {
......
...@@ -135,7 +135,6 @@ object SysUtils { ...@@ -135,7 +135,6 @@ object SysUtils {
fun initChannel(context: Context) { fun initChannel(context: Context) {
if (SettingSPUtils.channel == 0) {
channelString = PackerNg.getChannel(context) channelString = PackerNg.getChannel(context)
SettingSPUtils.channel = when (channelString) { SettingSPUtils.channel = when (channelString) {
"v2_guanwang" -> 1 "v2_guanwang" -> 1
...@@ -151,7 +150,6 @@ object SysUtils { ...@@ -151,7 +150,6 @@ object SysUtils {
else -> 1 else -> 1
} }
} }
}
fun joinQQGroup(context: Context) { fun joinQQGroup(context: Context) {
......
Markdown is supported
0%
or
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment