Bladeren bron

v1.0.1开发:修复区号选择框异常重置的问题

#Suyghur 3 jaren geleden
bovenliggende
commit
693e28e3c3

+ 1 - 1
config.gradle

@@ -4,7 +4,7 @@ ext {
             remoteLib    : false,
             minifyEnabled: true,
             publish      : true,
-            language: 2
+            language     : 2
     ]
 
     android = [

+ 1 - 1
library_core/publish.gradle

@@ -4,7 +4,7 @@ apply plugin: 'signing'
 ext {
     PUBLISH_GROUP_ID = 'io.github.yyxxgame.sdk'
     PUBLISH_ARTIFACT_ID = 'eyuangame-sdk-ktx'
-    PUBLISH_VERSION = '1.0.1-rc1'
+    PUBLISH_VERSION = '1.0.1-rc2'
 }
 
 Properties properties = new Properties()

+ 2 - 1
library_core/src/main/java/cn/yyxx/eyuangame/core/entity/bean/init/InitBean.kt

@@ -18,8 +18,9 @@ class InitBean private constructor() {
     var rewardId = ""
     val areaCodeList = mutableListOf<String>()
 
+
     override fun toString(): String {
-        return "InitBean(noticeCfg=$noticeCfg, privacyCfg=$privacyCfg, floatCfg=$floatCfg, rewardId='$rewardId')"
+        return "InitBean(noticeCfg=$noticeCfg, privacyCfg=$privacyCfg, floatCfg=$floatCfg, rewardId='$rewardId', areaCodeList=$areaCodeList)"
     }
 
     companion object {

+ 34 - 15
library_core/src/main/java/cn/yyxx/eyuangame/core/impl/login/UserSignInImpl.kt

@@ -14,6 +14,7 @@ import cn.yyxx.eyuangame.core.internal.IRequestCallback
 import cn.yyxx.eyuangame.core.network.SdkRequest
 import cn.yyxx.eyuangame.core.ui.dialog.ScaleLoadingDialog
 import cn.yyxx.eyuangame.core.utils.SessionUtils
+import cn.yyxx.support.ResUtils
 import cn.yyxx.support.hawkeye.ToastUtils
 import com.facebook.*
 import com.facebook.login.LoginManager
@@ -72,20 +73,20 @@ class UserSignInImpl constructor(val activity: LoginActivity, private val callba
                         userLoginVerify(activity, jsonObject)
                     } catch (e: JSONException) {
                         e.printStackTrace()
-                        callback.onFailed("Facebook登录异常")
+                        callback.onFailed(ResUtils.getResString(activity, "yyxx_tips_launcher_error"))
                     }
                 }
             }
 
             override fun onCancel() {
-                callback.onFailed("Facebook登录取消")
+                callback.onFailed(ResUtils.getResString(activity, "yyxx_tips_launcher_error"))
             }
 
             override fun onError(error: FacebookException?) {
                 error?.apply {
                     Logger.e("FBLogin onError error : " + this.message)
                 }
-                callback.onFailed("Facebook登录失败")
+                callback.onFailed(ResUtils.getResString(activity, "yyxx_tips_launcher_error"))
             }
         })
         LoginManager.getInstance().logInWithReadPermissions(activity, Collections.singletonList("public_profile"))
@@ -94,7 +95,7 @@ class UserSignInImpl constructor(val activity: LoginActivity, private val callba
     fun googleLogin(activity: Activity) {
         if (GoogleApiAvailability.getInstance().isGooglePlayServicesAvailable(activity) != ConnectionResult.SUCCESS) {
             ToastUtils.toastInfo(activity, "Google Services is not available for this device")
-            callback.onFailed("谷歌登录服务不可用,登录失败")
+            callback.onFailed(ResUtils.getResString(activity, "yyxx_tips_launcher_error"))
             return
         }
 
@@ -119,11 +120,11 @@ class UserSignInImpl constructor(val activity: LoginActivity, private val callba
                 userLoginVerify(activity, jsonObject)
             } catch (e: JSONException) {
                 e.printStackTrace()
-                callback.onFailed("Google登录异常")
+                callback.onFailed(ResUtils.getResString(activity, "yyxx_tips_launcher_error"))
             }
         } catch (e: ApiException) {
             e.printStackTrace()
-            callback.onFailed("Google登录异常")
+            callback.onFailed(ResUtils.getResString(activity, "yyxx_tips_launcher_error"))
         }
     }
 
@@ -137,7 +138,7 @@ class UserSignInImpl constructor(val activity: LoginActivity, private val callba
             userLoginVerify(activity, jsonObject)
         } catch (e: JSONException) {
             e.printStackTrace()
-            callback.onFailed("游客登录异常")
+            callback.onFailed(ResUtils.getResString(activity, "yyxx_tips_launcher_error"))
         }
     }
 
@@ -150,7 +151,7 @@ class UserSignInImpl constructor(val activity: LoginActivity, private val callba
             userLoginVerify(context, jsonObject)
         } catch (e: JSONException) {
             e.printStackTrace()
-            callback.onFailed("用户登录异常")
+            callback.onFailed(ResUtils.getResString(context, "yyxx_tips_launcher_error"))
         }
     }
 
@@ -180,24 +181,33 @@ class UserSignInImpl constructor(val activity: LoginActivity, private val callba
                                 this.userName = userName
                                 this.pwd = pwd
                                 GlobalScope.launch(Dispatchers.IO) {
-                                    Logger.d("with io coroutines do save session")
                                     SessionUtils.instance.saveSession(context, this@with)
                                 }
                             }
                             callback.onSuccess(SdkBackLoginInfo.instance.toJsonString())
                         } catch (e: JSONException) {
                             e.printStackTrace()
-                            callback.onFailed("用户注册异常")
+                            val msg = if (TextUtils.isEmpty(resultInfo.msg)) {
+                                ResUtils.getResString(context, "yyxx_tips_register_error")
+                            } else {
+                                resultInfo.msg
+                            }
+                            callback.onFailed(msg)
                         }
                     } else {
-                        callback.onFailed("用户注册异常")
+                        val msg = if (TextUtils.isEmpty(resultInfo.msg)) {
+                            ResUtils.getResString(context, "yyxx_tips_register_error")
+                        } else {
+                            resultInfo.msg
+                        }
+                        callback.onFailed(msg)
                     }
                 }
             })
         } catch (e: Exception) {
             e.printStackTrace()
             hideLoadingDialog()
-            callback.onFailed("用户注册异常")
+            callback.onFailed(ResUtils.getResString(context, "yyxx_tips_register_error"))
         }
     }
 
@@ -224,17 +234,26 @@ class UserSignInImpl constructor(val activity: LoginActivity, private val callba
                                 pwd = loginParams.getString("pwd")
                             }
                             GlobalScope.launch(Dispatchers.IO) {
-                                Logger.d("with io coroutines do save session")
                                 SessionUtils.instance.saveSession(context, this@with)
                             }
                         }
                         callback.onSuccess(SdkBackLoginInfo.instance.toJsonString())
                     } catch (e: JSONException) {
                         e.printStackTrace()
-                        callback.onFailed("登录校验异常")
+                        val msg = if (TextUtils.isEmpty(resultInfo.msg)) {
+                            ResUtils.getResString(context, "yyxx_tips_launcher_error")
+                        } else {
+                            resultInfo.msg
+                        }
+                        callback.onFailed(msg)
                     }
                 } else {
-                    callback.onFailed("登录校验异常")
+                    val msg = if (TextUtils.isEmpty(resultInfo.msg)) {
+                        ResUtils.getResString(context, "yyxx_tips_launcher_error")
+                    } else {
+                        resultInfo.msg
+                    }
+                    callback.onFailed(msg)
                 }
             }
         })

+ 1 - 1
library_core/src/main/java/cn/yyxx/eyuangame/core/impl/login/fragment/LauncherFragment.kt

@@ -297,7 +297,7 @@ class LauncherFragment : Fragment(), View.OnClickListener {
             dismiss()
             forgetPwdDialog = null
         }
-        forgetPwdDialog = ForgetPwdDialog(requireContext(), SdkBridgeImpl.isLand, SdkBridgeImpl.initBean.areaCodeList)
+        forgetPwdDialog = ForgetPwdDialog(requireContext(), SdkBridgeImpl.isLand)
         forgetPwdDialog?.apply {
             loginImpl.hideLoginView()
             ivReturn.setOnClickListener {

+ 8 - 11
library_core/src/main/java/cn/yyxx/eyuangame/core/ui/dialog/ForgetPwdDialog.kt

@@ -15,7 +15,7 @@ import cn.yyxx.support.ResUtils
  * @author #Suyghur.
  * Created on 2021/06/23
  */
-class ForgetPwdDialog(context: Context, private val isLandscape: Boolean, private val areaCodeList: MutableList<String>) :
+class ForgetPwdDialog(context: Context, private val isLandscape: Boolean) :
     Dialog(context, ResUtils.getResId(context, "EYuanGameTheme", "style")) {
 
     lateinit var ivReturn: ImageView
@@ -37,6 +37,8 @@ class ForgetPwdDialog(context: Context, private val isLandscape: Boolean, privat
     var code = ""
         private set
 
+    private val areaCodeList: MutableList<String> = mutableListOf()
+
     init {
         setCanceledOnTouchOutside(false)
         window?.setBackgroundDrawable(ColorDrawable(Color.TRANSPARENT))
@@ -46,19 +48,13 @@ class ForgetPwdDialog(context: Context, private val isLandscape: Boolean, privat
 
     private fun initView(context: Context) {
 
-//        if (SdkBridgeImpl.isLand) {
-//            window?.setSoftInputMode(WindowManager.LayoutParams.SOFT_INPUT_ADJUST_PAN)
-//        }
-
         val view: View = LayoutInflater.from(context).inflate(ResUtils.getResId(context, "yyxx_forget_pwd_dialog", "layout"), null)
 
         setContentView(view)
 
-
         val attr = window?.attributes as WindowManager.LayoutParams
         //设置dialog 在布局中的位置
         attr.height = ViewGroup.LayoutParams.WRAP_CONTENT
-//        val w=DensityUtils.getHeightAndWidth(context)
         if (isLandscape) {
             attr.width = DensityUtils.getHeightAndWidth(context)[0] / 2
         } else {
@@ -66,8 +62,6 @@ class ForgetPwdDialog(context: Context, private val isLandscape: Boolean, privat
         }
         attr.gravity = Gravity.CENTER
 
-//        attr.softInputMode = WindowManager.LayoutParams.SOFT_INPUT_ADJUST_PAN or WindowManager.LayoutParams.SOFT_INPUT_STATE_VISIBLE
-
         imgUp = ResUtils.getResId(context, "yyxx_pack_up_white_img", "drawable")
         imgDown = ResUtils.getResId(context, "yyxx_pack_down_white_img", "drawable")
 
@@ -89,7 +83,6 @@ class ForgetPwdDialog(context: Context, private val isLandscape: Boolean, privat
         eetPhone = view.findViewById(ResUtils.getResId(context, "yyxx_eet_phone", "id"))
         eetPhone.editText.setHint(ResUtils.getResId(context, "yyxx_hint_forget_phone", "string"))
 
-
         rlAreaList = view.findViewById(ResUtils.getResId(context, "yyxx_rl_area_list", "id"))
         rlAreaList.visibility = View.GONE
         llAreaList = view.findViewById(ResUtils.getResId(context, "yyxx_ll_area_list", "id"))
@@ -100,7 +93,7 @@ class ForgetPwdDialog(context: Context, private val isLandscape: Boolean, privat
     }
 
     private fun autoFillAreaList(context: Context) {
-        if (areaCodeList.size == 0) {
+        if (SdkBridgeImpl.initBean.areaCodeList.isNullOrEmpty()) {
             //默认4个地区
             areaCodeList.add("86")
             //香港
@@ -109,6 +102,10 @@ class ForgetPwdDialog(context: Context, private val isLandscape: Boolean, privat
             areaCodeList.add("853")
             //台湾
             areaCodeList.add("886")
+        } else {
+            SdkBridgeImpl.initBean.areaCodeList.forEach {
+                areaCodeList.add(it)
+            }
         }
         initAreaList(context)
     }

+ 1 - 1
library_hk_language/publish.gradle

@@ -4,7 +4,7 @@ apply plugin: 'signing'
 ext {
     PUBLISH_GROUP_ID = 'io.github.yyxxgame.sdk'
     PUBLISH_ARTIFACT_ID = 'eyuangame-component-lang-hk'
-    PUBLISH_VERSION = '1.0.1-rc1'
+    PUBLISH_VERSION = '1.0.1-rc2'
 }
 
 Properties properties = new Properties()

+ 2 - 0
library_hk_language/src/main/res/values/yyxx_strings.xml

@@ -68,6 +68,8 @@
     <string name="yyxx_tips_phone_format_error">您輸入的手機門號格式有誤,請重新輸入</string>
     <string name="yyxx_tips_area_code_format_error">您選擇的區號有誤,請重新選擇</string>
     <string name="yyxx_tips_captcha_format_error">您輸入的手機驗證碼格式有誤,請重新輸入</string>
+    <string name="yyxx_tips_register_error">帳號註冊異常</string>
+    <string name="yyxx_tips_launcher_error">帳號登入校驗異常</string>
 
     <string name="yyxx_charge_tv_error">支付服務異常,請稍後重試</string>
     <string name="yyxx_charge_loading_tips">正在獲取訂單信息,請稍候…</string>

+ 1 - 1
library_vn_language/publish.gradle

@@ -4,7 +4,7 @@ apply plugin: 'signing'
 ext {
     PUBLISH_GROUP_ID = 'io.github.yyxxgame.sdk'
     PUBLISH_ARTIFACT_ID = 'eyuangame-component-lang-vn'
-    PUBLISH_VERSION = '1.0.1-rc1'
+    PUBLISH_VERSION = '1.0.1-rc2'
 }
 
 Properties properties = new Properties()

+ 2 - 0
library_vn_language/src/main/res/values/yyxx_strings.xml

@@ -67,6 +67,8 @@
     <string name="yyxx_tips_phone_format_error">Lỗi quy cách SĐT, hãy nhập lại</string>
     <string name="yyxx_tips_area_code_format_error">Lỗi mã vùng, hãy nhập lại</string>
     <string name="yyxx_tips_captcha_format_error">Lỗi quy cách mã xác minh, hãy nhập lại</string>
+    <string name="yyxx_tips_register_error">Đăng ký người dùng ngoại lệ</string>
+    <string name="yyxx_tips_launcher_error">Đăng nhập ngoại lệ xác minh</string>
 
     <string name="yyxx_charge_tv_error">Lỗi dịch vụ thanh toán, vui lòng thử lại sau</string>
     <string name="yyxx_charge_loading_tips">Đang nhận thông tin đơn hàng, vui lòng thử lại sau…</string>