From e7d518e406ed39f5f505d829057d800564c84111 Mon Sep 17 00:00:00 2001 From: CounterFire2023 <136581895+CounterFire2023@users.noreply.github.com> Date: Mon, 6 Nov 2023 17:56:00 +0800 Subject: [PATCH] =?UTF-8?q?=E9=87=8D=E6=9E=84?= MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit --- app/src/com/ctf/games/release/MainActivity.kt | 15 +++++++-------- .../ctf/games/release/activity/WebPageActivity.kt | 3 +-- .../com/ctf/games/release/wallet/WalletUtil.kt | 2 +- 3 files changed, 9 insertions(+), 11 deletions(-) diff --git a/app/src/com/ctf/games/release/MainActivity.kt b/app/src/com/ctf/games/release/MainActivity.kt index dc0f081..f825f43 100644 --- a/app/src/com/ctf/games/release/MainActivity.kt +++ b/app/src/com/ctf/games/release/MainActivity.kt @@ -49,7 +49,6 @@ import org.cocos2dx.lib.Cocos2dxHelper.Cocos2dxHelperListener import org.cocos2dx.lib.CocosJSHelper import org.json.JSONException import org.json.JSONObject -import java.io.File import java.util.Arrays import java.util.concurrent.ExecutorService import java.util.concurrent.Executors @@ -202,7 +201,7 @@ class MainActivity : UnityPlayerActivity(), Cocos2dxHelperListener { } else { Log.w( TAG, - "already login, accessToken not expired, id token:: " + state.idToken + "already login, accessToken not expired, id token:: ${state.idToken}" ) JcSDK.nativeCb(this.funId, null, state.idToken) } @@ -221,7 +220,7 @@ class MainActivity : UnityPlayerActivity(), Cocos2dxHelperListener { try { val account = completedTask.getResult(ApiException::class.java) Log.w(TAG, "signIn success: ") - Log.w(TAG, "gsa idToken: " + account.idToken) + Log.w(TAG, "gsa idToken: ${account.idToken}") JcSDK.nativeCb(funId, null, account.idToken) // Signed in successfully, show authenticated UI. } catch (e: ApiException) { @@ -406,10 +405,10 @@ class MainActivity : UnityPlayerActivity(), Cocos2dxHelperListener { } fun storagePass(funID: String?, account: String?, password: String?) { - Log.i(TAG, String.format("storagePass with: %s | %s", funID, account)) + Log.i(TAG, "storagePass with: $funID | $account") funId = funID mWalletUtil!!.updateParams(funID, account) - mWalletUtil!!.savePassToLocal(password) { _file: File? -> + mWalletUtil!!.savePassToLocal(password) { if (isGooglePlayServicesAvailable) { if (!GoogleSignIn.hasPermissions( GoogleSignIn.getLastSignedInAccount(Cocos2dxHelper.getActivity()), @@ -469,7 +468,7 @@ class MainActivity : UnityPlayerActivity(), Cocos2dxHelperListener { ) { loginAndRequestDrivePermission(RC_REQUEST_DRIVE_TO_READ) } else { - mWalletUtil!!.downloadCfgWithGPS { _file: File? -> mWalletUtil!!.passLocal } + mWalletUtil!!.downloadCfgWithGPS { mWalletUtil!!.passLocal } } } else { mWalletUtil!!.passLocal @@ -483,7 +482,7 @@ class MainActivity : UnityPlayerActivity(), Cocos2dxHelperListener { if (state.isAuthorized) { if (state.needsTokenRefresh) { Log.d(TAG, "need refresh accessToken") - mAppAuthSvr!!.refreshToken(funID) { _result: String? -> + mAppAuthSvr!!.refreshToken(funID) { mWalletUtil!!.downloadCfgWithApi( state.accessToken ) { mWalletUtil!!.passLocal } @@ -517,7 +516,7 @@ class MainActivity : UnityPlayerActivity(), Cocos2dxHelperListener { } fun getClientId(funID: String?) { - Log.i(TAG, "getClientId ") + Log.i(TAG, "getClientId with funId: $funID") } companion object { diff --git a/app/src/com/ctf/games/release/activity/WebPageActivity.kt b/app/src/com/ctf/games/release/activity/WebPageActivity.kt index e15334c..9f37567 100644 --- a/app/src/com/ctf/games/release/activity/WebPageActivity.kt +++ b/app/src/com/ctf/games/release/activity/WebPageActivity.kt @@ -34,9 +34,9 @@ import org.json.JSONException import org.json.JSONObject import java.util.function.Consumer +const val FUNID_PREFIX = "webpage_" class WebPageActivity : Activity() { private var mWebView: WebView? = null - private val FUNID_PREFIX = "webpage_" private val actionMap: MutableMap> = Maps.newHashMap() @SuppressLint("SetJavaScriptEnabled", "DefaultLocale") override fun onCreate(savedInstanceState: Bundle?) { @@ -50,7 +50,6 @@ class WebPageActivity : Activity() { webSettings?.domStorageEnabled = true webSettings?.databaseEnabled = true webSettings?.allowContentAccess = true - webSettings?.setAppCacheEnabled(true) webSettings?.builtInZoomControls = true webSettings?.useWideViewPort = true webSettings?.loadWithOverviewMode = true diff --git a/app/src/com/ctf/games/release/wallet/WalletUtil.kt b/app/src/com/ctf/games/release/wallet/WalletUtil.kt index 88a0a02..562165b 100644 --- a/app/src/com/ctf/games/release/wallet/WalletUtil.kt +++ b/app/src/com/ctf/games/release/wallet/WalletUtil.kt @@ -34,7 +34,7 @@ class WalletUtil(private val mContext: Context) { account = null } - public fun errorCB(msg: String?) { + fun errorCB(msg: String?) { JcSDK.nativeCb(funID, msg, null) clearParams() }