dola 1 tahun lalu
induk
melakukan
ef4df629b8

+ 2 - 5
app/src/dev/java/com/sambath/kunkhmer/config/Config.kt

@@ -2,9 +2,6 @@ package com.sambath.kunkhmer.config
 
 object Config {
     //development
-    const val BASE_URL = "http://159.89.118.124:3081"
-    const val SOCKET_1 = "http://159.89.118.124:3082/chicken-online"
-    const val SOCKET_2 = "http://159.89.118.124:3082/sabong-sl"
-    const val SOCKET_3 = "http://159.89.118.124:3082/sabong-sl-3"
-    const val SOCKET_4 = "http://159.89.118.124:3082/sabong-sl-4"
+    const val BASE_URL = "http://143.198.207.249:30827"
+    const val SOCKET_1 = "http://143.198.207.249:30827/namespace-kun-khmer"
 }

+ 47 - 47
app/src/main/java/com/sambath/kunkhmer/app/ShareActivity.kt

@@ -66,18 +66,18 @@ class ShareActivity : AutoLogoutBaseActivity() {
         }
         super.onCreate(savedInstanceState)
         setContentView(R.layout.activity_main)
-        val balance = currencyFormat(userShare.accountBalances)
-        when (userShare.currencyType) {
-            1 -> {//dollar
-                tv_amount.text = "$balance $"
-            }
-            2 -> {//riel
-                tv_amount.text ="$balance ៛"
-            }
-            3 -> {//baht
-                tv_amount.text = "$balance ฿"
-            }
-        }
+//        val balance = currencyFormat(userShare.accountBalances)
+//        when (userShare.currencyType) {
+//            1 -> {//dollar
+//                tv_amount.text = "$balance $"
+//            }
+//            2 -> {//riel
+//                tv_amount.text ="$balance ៛"
+//            }
+//            3 -> {//baht
+//                tv_amount.text = "$balance ฿"
+//            }
+//        }
         tv_user_id.text = userShare.userName
         sharePref = App.injectPrefHelper()
         mtxt_switch_channel.text = "CH" + sharePref.getChannelType()
@@ -91,12 +91,12 @@ class ShareActivity : AutoLogoutBaseActivity() {
                 it.channelInfo?.let { it1 -> getChannelData(it1) }
             }
         })
-        mainViewModel.stateUser.observe(this, androidx.lifecycle.Observer {
-            Log.d("stateUser", it.toString())
-            if (it?.isUserSuccess == true) {
-                it.userInfo?.let { it1 -> getUserInfo(it1) }
-            }
-        })
+//        mainViewModel.stateUser.observe(this, androidx.lifecycle.Observer {
+//            Log.d("stateUser", it.toString())
+//            if (it?.isUserSuccess == true) {
+//                it.userInfo?.let { it1 -> getUserInfo(it1) }
+//            }
+//        })
         mainViewModel.state.observe(this, androidx.lifecycle.Observer {
             if (it.isSuccess) {
                 if (it.resultList.isNullOrEmpty() || isOpen == "true") {
@@ -180,20 +180,20 @@ class ShareActivity : AutoLogoutBaseActivity() {
                 }
             }
         })
-        shareViewModel.getUpdateUserInfo.observe(this, Observer {
-            Log.d("Socket", "getUpdateUserInfo" + it.toString())
-            if (!it.isNullOrEmpty()) {
-                val obj = JSONObject(it)
-                val balance = currencyFormat(obj.getInt("balance"))
-                if (userShare.currencyType == 1){//dollar
-                    tv_amount.text = "$$balance"
-                }else if(userShare.currencyType == 2){//riel
-                    tv_amount.text ="៛$balance"
-                }else{//baht
-                    tv_amount.text = "฿$balance"
-                }
-            }
-        })
+//        shareViewModel.getUpdateUserInfo.observe(this, Observer {
+//            Log.d("Socket", "getUpdateUserInfo" + it.toString())
+//            if (!it.isNullOrEmpty()) {
+//                val obj = JSONObject(it)
+//                val balance = currencyFormat(obj.getInt("balance"))
+//                if (userShare.currencyType == 1){//dollar
+//                    tv_amount.text = "$$balance"
+//                }else if(userShare.currencyType == 2){//riel
+//                    tv_amount.text ="៛$balance"
+//                }else{//baht
+//                    tv_amount.text = "฿$balance"
+//                }
+//            }
+//        })
         shareViewModel.getResult.observe(this, Observer {
             Log.d("Socket", "getResult")
             if (!it.isNullOrEmpty()) {
@@ -246,21 +246,21 @@ class ShareActivity : AutoLogoutBaseActivity() {
         if (hasFocus) hideSystemUI()
     }
 
-    private fun getUserInfo(it: User) {
-        Log.d("stateUser", it.toString())
-        tv_amount.text = it.accountBalances?.let { it1 ->
-            val balance = currencyFormat(it1)
-            if (userShare.currencyType == 1){//dollar
-                 "$$balance"
-            }else if(userShare.currencyType == 2){//riel
-                "៛$balance"
-            }else{//baht
-                "฿$balance"
-            }
-
-        }
-        btnBettingStatus.isActivated = true
-    }
+//    private fun getUserInfo(it: User) {
+//        Log.d("stateUser", it.toString())
+//        tv_amount.text = it.accountBalances?.let { it1 ->
+//            val balance = currencyFormat(it1)
+//            if (userShare.currencyType == 1){//dollar
+//                 "$$balance"
+//            }else if(userShare.currencyType == 2){//riel
+//                "៛$balance"
+//            }else{//baht
+//                "฿$balance"
+//            }
+//
+//        }
+//        btnBettingStatus.isActivated = true
+//    }
 
     private fun getChannelData(it: ChannelData) {
         Log.d("statechannel", it.toString())

+ 16 - 16
app/src/main/java/com/sambath/kunkhmer/base/BaseFragment.kt

@@ -26,22 +26,22 @@ abstract class BaseFragment(
         user = ModelPreferencesManager.get<User>(Const.USER_KEY)!!
     }
 
-    fun currencyType(): String {
-        when (user.currencyType) {
-            1 -> {//dollar
-                return "$"
-            }
-
-            2 -> {//riel
-                return "៛"
-            }
-
-            3 -> {//baht
-                return "฿"
-            }
-        }
-        return ""
-    }
+//    fun currencyType(): String {
+//        when (user.currencyType) {
+//            1 -> {//dollar
+//                return "$"
+//            }
+//
+//            2 -> {//riel
+//                return "៛"
+//            }
+//
+//            3 -> {//baht
+//                return "฿"
+//            }
+//        }
+//        return ""
+//    }
 
     override fun onCreateView(
         inflater: LayoutInflater, container: ViewGroup?, savedInstanceState: Bundle?

+ 20 - 19
app/src/main/java/com/sambath/kunkhmer/remote/LoginDataModel.kt

@@ -9,7 +9,9 @@ class LoginRequest(
     @Json(name = "user_name")
     val username: String,
     @Json(name = "password")
-    val password: String
+    val password: String,
+    @Json(name = "firebase_token")
+    val firebaseToken: String = "OiJIUzI1NiIsInR5cCI6IkpXVCJ9.eyJ1c2VyX2lkIjoiN"
 )
 
 @JsonClass(generateAdapter = true)
@@ -305,10 +307,6 @@ data class LoginData(
     val user: User?,
     @Json(name = "token")
     val token: String?,
-//    @Json(name = "lotoSetResult")
-//    val lottoSet: List<LottoSet>?,
-//    @Json(name = "limit")
-//    val limit: Limit?,
 )
 
 @JsonClass(generateAdapter = true)
@@ -383,20 +381,23 @@ data class LottoSet(
 data class User(
     @Json(name = "user_name")
     val userName: String,
-    @Json(name = "role")
-    val roles: String,
-    @Json(name = "enable")
-    val readOnly: Boolean,
-    @Json(name = "account_info")
-    var accountInfo: String?,
-    @Json(name = "account_name")
-    var accountName: String?,
-    @Json(name = "account_number")
-    var accountNumber: String?,
-    @Json(name = "balance")
-    val accountBalances: Double,
-    @Json(name = "currency_type")
-    val currencyType: Int,
+    @Json(name = "_id")
+    val id: String,
+
+//    @Json(name = "role")
+//    val roles: String,
+//    @Json(name = "enable")
+//    val readOnly: Boolean,
+//    @Json(name = "account_info")
+//    var accountInfo: String?,
+//    @Json(name = "account_name")
+//    var accountName: String?,
+//    @Json(name = "account_number")
+//    var accountNumber: String?,
+//    @Json(name = "balance")
+//    val accountBalances: Double,
+//    @Json(name = "currency_type")
+//    val currencyType: Int,
 )
 
 @JsonClass(generateAdapter = true)

+ 1 - 10
app/src/main/java/com/sambath/kunkhmer/remote/service/ApiService.kt

@@ -6,22 +6,13 @@ import retrofit2.http.*
 
 interface ApiService {
 
-    @POST("/v1/api/user/login")
+    @POST("/v1/user/login")
     @Headers("No-Authentication: true")
     fun login(@Body loginRequest: LoginRequest): Single<LoginResponse>
 
-//    @POST("/v1/api/user/register")
-//    fun createBetting(@Body register: Register): Single<RegisterResponse>
-
     @POST("/v1/api/user/changepassword")
     fun changePassword(@Body changePwd: ChangePwd): Single<ChangePwdResponse>
 
-//    @GET("/v1/api/user")
-//    fun getUserInfo(): Single<UserInfoResponse>
-//
-//    @PUT("/v1/api/user")
-//    fun updateUserInfo(@Body updateUser: UpdateUser): Single<UpdateResponse>
-
     @GET("/v1/api/channel")
     fun getChannel(): Single<ChannelResponse>
 

+ 4 - 12
app/src/main/java/com/sambath/kunkhmer/remote/service/SocketService.java

@@ -20,9 +20,9 @@ import io.socket.emitter.Emitter;
 public class SocketService extends BaseObservable<EventListener> {
     private static final String TAG = "Socket";
     private static final String SOCKET_1 = Config.SOCKET_1;
-    private static final String SOCKET_2 = Config.SOCKET_2;
-    private static final String SOCKET_3 = Config.SOCKET_3;
-    private static final String SOCKET_4 = Config.SOCKET_4;
+//    private static final String SOCKET_2 = Config.SOCKET_2;
+//    private static final String SOCKET_3 = Config.SOCKET_3;
+//    private static final String SOCKET_4 = Config.SOCKET_4;
     private static final String EVENT_CONNECT = Socket.EVENT_CONNECT;
     private static final String EVENT_CONNECT_ERROR = Socket.EVENT_CONNECT_ERROR;
     private static final String EVENT_DISCONNECT = Socket.EVENT_DISCONNECT;
@@ -40,15 +40,7 @@ public class SocketService extends BaseObservable<EventListener> {
                 .setExtraHeaders(singletonMap("authorization", singletonList(token)))
                 .build();
         Log.d("Socket", "startListening mSocket"+ channelType);
-        if (channelType == 2) {
-            mSocket = IO.socket(URI.create(SOCKET_2), options);
-        } else if (channelType == 3) {
-            mSocket = IO.socket(URI.create(SOCKET_3), options);
-        } else if(channelType == 4) {
-            mSocket = IO.socket(URI.create(SOCKET_4), options);
-        } else {
-            mSocket = IO.socket(URI.create(SOCKET_1), options);
-        }
+        mSocket = IO.socket(URI.create(SOCKET_1), options);
         mSocket.on(EVENT_CONNECT, connectListener);
         mSocket.on(EVENT_UPDATE_CHANNEL_INFO, updateChannelInfo);
         mSocket.on(EVENT_DEFINED_RESULT_AND_CHANNEL, definedResultAndChannel);

+ 21 - 21
app/src/main/java/com/sambath/kunkhmer/screen/login/LoginActivity.kt

@@ -27,27 +27,27 @@ class LoginActivity : AppCompatActivity() {
         if (user != null) et_username.setText(user?.userName)
         loginViewModel.state.observe(this, Observer(this::render))
         btn_login.setOnClickListener {
-//            til_username.isErrorEnabled = false
-//            til_username.error = null
-//            til_password.isErrorEnabled = false
-//            til_password.error = null
-//            val username = et_username.text //aaaaaa004  Bbbbbb001
-//            val password = et_password.text
-//            if (username.isNullOrEmpty()) {
-//                til_username.error = getString(R.string.err_not_empty)
-//                til_username.requestFocus()
-//                return@setOnClickListener
-//            }
-//            if (password.isNullOrEmpty()) {
-//                til_password.error = getString(R.string.err_not_empty)
-//                til_password.requestFocus()
-//                return@setOnClickListener
-//            }
-//            loginViewModel.login(username.toString(), password.toString())
+            til_username.isErrorEnabled = false
+            til_username.error = null
+            til_password.isErrorEnabled = false
+            til_password.error = null
+            val username = et_username.text
+            val password = et_password.text
+            if (username.isNullOrEmpty()) {
+                til_username.error = getString(R.string.err_not_empty)
+                til_username.requestFocus()
+                return@setOnClickListener
+            }
+            if (password.isNullOrEmpty()) {
+                til_password.error = getString(R.string.err_not_empty)
+                til_password.requestFocus()
+                return@setOnClickListener
+            }
+            loginViewModel.login(username.toString(), password.toString())
 
-            val intent = Intent(this, MainActivity::class.java)
-            startActivity(intent)
-            finishAffinity()
+//            val intent = Intent(this, MainActivity::class.java)
+//            startActivity(intent)
+//            finishAffinity()
         }
 
         btn_signup.setOnClickListener {
@@ -64,7 +64,7 @@ class LoginActivity : AppCompatActivity() {
         }
         if (state.isLoginSuccess) {
             //Toast.makeText(this@LoginActivity, "ចូលប្រព័ន្ធជោគជ័យ", Toast.LENGTH_LONG).show()
-            val intent = Intent(this, ShareActivity::class.java)
+            val intent = Intent(this, MainActivity::class.java)
             startActivity(intent)
             finishAffinity()
         }

+ 0 - 16
app/src/main/java/com/sambath/kunkhmer/screen/login/LoginViewModel.kt

@@ -40,22 +40,6 @@ class LoginViewModel(val apiService: ApiService, val prefHelper: PrefHelper) : B
                     }
                 }, {
                     val message: String = "ប្រតិបត្តិការមិនជោគជ័យ " + it.getErrorCode()
-//                    if (it is AppException && it.isEmpty) {
-//                        _state.value =
-//                            _state.value?.copy(isProgress = false, data = empty(), isEmpty = true)
-//                    } else {
-//                        val message: String =
-//                            if (it is AppException)
-//                                "មិនអាចទាញយកទិន្នន័យបាន\nError[${it.message}]"
-//                            else if (it is ConnectException || it is HttpException)
-//                                "មិនអាចភ្ជាប់ទៅប្រព័ន្ធបាន\nError[Client Connection]"
-//                            else if (it is TimeoutException)
-//                                "មិនអាចភ្ជាប់ទៅប្រព័ន្ធបាន\nError[Timeout]"
-//                            else
-//                                "មិនអាចភ្ជាប់ទៅប្រព័ន្ធបាន\nError[Client]"
-//                        _state.value =
-//                            _state.value?.copy(isProgress = false, error = message, data = null)
-//                    }
                     _state.value = prev().copy(isProgress = false, error = message)
                 })
         )

+ 121 - 121
app/src/main/java/com/sambath/kunkhmer/screen/main/cflive/Betting/CfBetFragment.kt

@@ -107,13 +107,13 @@ class CfBetFragment : BaseFragment(R.layout.fragment_cf_betting) {
             }
         })
 //      test user read only or not
-        if (userShare.readOnly) {
-            btnBetMeron.isEnabled = true
-            btnBetWala.isEnabled = true
-        } else {
-            btnBetMeron.isEnabled = false
-            btnBetWala.isEnabled = false
-        }
+//        if (userShare.readOnly) {
+//            btnBetMeron.isEnabled = true
+//            btnBetWala.isEnabled = true
+//        } else {
+//            btnBetMeron.isEnabled = false
+//            btnBetWala.isEnabled = false
+//        }
 //        Red side betting
         btnBetMeron.setOnClickListener {
             LogOutTimerUtil.resetLogoutTimer(null, null)
@@ -167,18 +167,18 @@ class CfBetFragment : BaseFragment(R.layout.fragment_cf_betting) {
                 edtBettingAmount.setText(string.substring(0, string.length - 1))
             }
         }
-        shareViewModel.getUpdatePayout.observe(viewLifecycleOwner, Observer {
-            Log.d("getUpdatePayout", "onUpdatePlayerBetting" + it)
-            if (!it.isNullOrEmpty()) {
-                if (isStopBetting == "true") {
-                    val obj = JSONObject(it)
-                    if (obj.getInt("currency_type") == userShare.currencyType) {
-                        txtMeronPayout.text = obj.getString("payout_wala")
-                        txtWalaPayout.text = obj.getString("payout_meron")
-                    }
-                }
-            }
-        })
+//        shareViewModel.getUpdatePayout.observe(viewLifecycleOwner, Observer {
+//            Log.d("getUpdatePayout", "onUpdatePlayerBetting" + it)
+//            if (!it.isNullOrEmpty()) {
+//                if (isStopBetting == "true") {
+//                    val obj = JSONObject(it)
+//                    if (obj.getInt("currency_type") == userShare.currencyType) {
+//                        txtMeronPayout.text = obj.getString("payout_wala")
+//                        txtWalaPayout.text = obj.getString("payout_meron")
+//                    }
+//                }
+//            }
+//        })
         shareViewModel.getResetAmount.observe(viewLifecycleOwner, Observer {
             Log.d("getResetAmount", "onUpdatePlayerBetting" + it)
             txtMeronAmount.text = "0"
@@ -196,57 +196,57 @@ class CfBetFragment : BaseFragment(R.layout.fragment_cf_betting) {
                 }
                 layMeronPayout.visibility = View.VISIBLE
                 layWalaPayout.visibility = View.VISIBLE
-                if (userShare.readOnly) {
-                    when (isStopBetting) {
-                        "true" -> {
-                            btnBetMeron.isEnabled = true
-                            btnBetWala.isEnabled = true
-                        }
-                        "false" -> {
-                            btnBetMeron.isEnabled = false
-                            btnBetWala.isEnabled = false
-                        }
-                        else -> {
-                            btnBetMeron.isEnabled = false
-                            btnBetWala.isEnabled = false
-                            layMeronPayout.visibility = View.INVISIBLE
-                            layWalaPayout.visibility = View.INVISIBLE
-//                            txtMeronAmount.text = currencyFormat(it.amountRed)
-//                            txtWalaAmount.text = currencyFormat(it.amountBlue)
-//                            txtMeronPayout.text = it.payoutRed.toString()
-//                            txtWalaPayout.text = it.payoutBlue.toString()
-                        }
-                    }
-                } else {
-                    btnBetMeron.isEnabled = false
-                    btnBetWala.isEnabled = false
-                    if (isStopBetting == "null") {
-                        layMeronPayout.visibility = View.INVISIBLE
-                        layWalaPayout.visibility = View.INVISIBLE
-                    }
-                }
-            }
-        })
-        shareViewModel.getUpdatePayout.observe(viewLifecycleOwner, Observer {
-            Log.d("getUpdatePayout", "onUpdatePlayerBetting" + it)
-            if (!it.isNullOrEmpty()) {
-                val obj = JSONObject(it)
-                if (userShare.currencyType == obj.getInt("currency_type")) {
-                    txtMeronPayout.text = obj.getString("payout_meron")
-                    txtWalaPayout.text = obj.getString("payout_wala")
-                }
-            }
-        })
-        shareViewModel.onUpdateBettingAmount.observe(viewLifecycleOwner, Observer {
-            Log.d("onUpdateBettingAmount", "onUpdatePlayerBetting" + it)
-            if (!it.isNullOrEmpty()) {
-                val arr = JSONArray(it)
-                txtMeronAmount.text =
-                    arr.getJSONObject(userShare.currencyType - 1).getString("meron_amount")
-                txtWalaAmount.text =
-                    arr.getJSONObject(userShare.currencyType - 1).getString("wala_amount")
+//                if (userShare.readOnly) {
+//                    when (isStopBetting) {
+//                        "true" -> {
+//                            btnBetMeron.isEnabled = true
+//                            btnBetWala.isEnabled = true
+//                        }
+//                        "false" -> {
+//                            btnBetMeron.isEnabled = false
+//                            btnBetWala.isEnabled = false
+//                        }
+//                        else -> {
+//                            btnBetMeron.isEnabled = false
+//                            btnBetWala.isEnabled = false
+//                            layMeronPayout.visibility = View.INVISIBLE
+//                            layWalaPayout.visibility = View.INVISIBLE
+////                            txtMeronAmount.text = currencyFormat(it.amountRed)
+////                            txtWalaAmount.text = currencyFormat(it.amountBlue)
+////                            txtMeronPayout.text = it.payoutRed.toString()
+////                            txtWalaPayout.text = it.payoutBlue.toString()
+//                        }
+//                    }
+//                } else {
+//                    btnBetMeron.isEnabled = false
+//                    btnBetWala.isEnabled = false
+//                    if (isStopBetting == "null") {
+//                        layMeronPayout.visibility = View.INVISIBLE
+//                        layWalaPayout.visibility = View.INVISIBLE
+//                    }
+//                }
             }
         })
+//        shareViewModel.getUpdatePayout.observe(viewLifecycleOwner, Observer {
+//            Log.d("getUpdatePayout", "onUpdatePlayerBetting" + it)
+//            if (!it.isNullOrEmpty()) {
+//                val obj = JSONObject(it)
+//                if (userShare.currencyType == obj.getInt("currency_type")) {
+//                    txtMeronPayout.text = obj.getString("payout_meron")
+//                    txtWalaPayout.text = obj.getString("payout_wala")
+//                }
+//            }
+//        })
+//        shareViewModel.onUpdateBettingAmount.observe(viewLifecycleOwner, Observer {
+//            Log.d("onUpdateBettingAmount", "onUpdatePlayerBetting" + it)
+//            if (!it.isNullOrEmpty()) {
+//                val arr = JSONArray(it)
+//                txtMeronAmount.text =
+//                    arr.getJSONObject(userShare.currencyType - 1).getString("meron_amount")
+//                txtWalaAmount.text =
+//                    arr.getJSONObject(userShare.currencyType - 1).getString("wala_amount")
+//            }
+//        })
         shareViewModel.onUpdateChanelDeveloper.observe(viewLifecycleOwner, Observer {
             if (!it.isNullOrEmpty()) {
 //                Log.d("getUpdateData", "onUpdateChanelDeveloper" + it)
@@ -268,35 +268,35 @@ class CfBetFragment : BaseFragment(R.layout.fragment_cf_betting) {
             txtWalaPayout.text = it.getString(K.PayoutBlue)
             layMeronPayout.visibility = View.VISIBLE
             layWalaPayout.visibility = View.VISIBLE
-            if (userShare.readOnly) {
-                when {
-                    it.getString(K.TypeOfPlay) == K.Open -> {
-                        btnBetMeron.isEnabled = true
-                        btnBetWala.isEnabled = true
-                    }
-                    it.getString(K.TypeOfPlay) == K.Close -> {
-                        btnBetMeron.isEnabled = false
-                        btnBetWala.isEnabled = false
-                    }
-                    else -> {
-                        btnBetMeron.isEnabled = false
-                        btnBetWala.isEnabled = false
-                        layMeronPayout.visibility = View.INVISIBLE
-                        layWalaPayout.visibility = View.INVISIBLE
-//                        txtMeronAmount.text = amountRed
-//                        txtWalaAmount.text = amountBlue
-//                        txtMeronPayout.text = payoutRed
-//                        txtWalaPayout.text = payoutBlue
-                    }
-                }
-            } else {
-                btnBetMeron.isEnabled = false
-                btnBetWala.isEnabled = false
-                if (it.getString(K.TypeOfPlay) == K.Live) {
-                    layMeronPayout.visibility = View.INVISIBLE
-                    layWalaPayout.visibility = View.INVISIBLE
-                }
-            }
+//            if (userShare.readOnly) {
+//                when {
+//                    it.getString(K.TypeOfPlay) == K.Open -> {
+//                        btnBetMeron.isEnabled = true
+//                        btnBetWala.isEnabled = true
+//                    }
+//                    it.getString(K.TypeOfPlay) == K.Close -> {
+//                        btnBetMeron.isEnabled = false
+//                        btnBetWala.isEnabled = false
+//                    }
+//                    else -> {
+//                        btnBetMeron.isEnabled = false
+//                        btnBetWala.isEnabled = false
+//                        layMeronPayout.visibility = View.INVISIBLE
+//                        layWalaPayout.visibility = View.INVISIBLE
+////                        txtMeronAmount.text = amountRed
+////                        txtWalaAmount.text = amountBlue
+////                        txtMeronPayout.text = payoutRed
+////                        txtWalaPayout.text = payoutBlue
+//                    }
+//                }
+//            } else {
+//                btnBetMeron.isEnabled = false
+//                btnBetWala.isEnabled = false
+//                if (it.getString(K.TypeOfPlay) == K.Live) {
+//                    layMeronPayout.visibility = View.INVISIBLE
+//                    layWalaPayout.visibility = View.INVISIBLE
+//                }
+//            }
             betMin = it.getInt("amount_min")
             betMax = it.getInt("amount_max")
             txtMax.text = currencyFormat(betMax)
@@ -305,30 +305,30 @@ class CfBetFragment : BaseFragment(R.layout.fragment_cf_betting) {
     }
 
     private fun confirmBet(betType: String, moneyBet: Int, chickenId: String) {
-        val builder = context?.let { AlertDialog.Builder(it) }
-        //set title for alert dialog
-        builder?.setTitle("Confirm betting!")
-        //set message for alert dialog
-        builder?.setMessage("You are betting $moneyBet ${currencyType()} on $betType!")
-//        builder?.setIcon(android.R.drawable.ic_dialog_alert)
-
-        //performing positive action
-        builder?.setPositiveButton("Yes") { dialogInterface, which ->
-
-            cfBetViewModel.createBetting(CreateBetting(moneyBet, chickenId))
-            dialogInterface.dismiss()
-        }
-        //performing negative action
-        builder?.setNegativeButton("No") { dialogInterface, which ->
-            btnBetMeron.isEnabled = true
-            btnBetWala.isEnabled = true
-            dialogInterface.dismiss()
-        }
-        // Create the AlertDialog
-        val alertDialog: AlertDialog? = builder?.create()
-        // Set other dialog properties
-        alertDialog?.setCancelable(false)
-        alertDialog?.show()
+//        val builder = context?.let { AlertDialog.Builder(it) }
+//        //set title for alert dialog
+//        builder?.setTitle("Confirm betting!")
+//        //set message for alert dialog
+//        builder?.setMessage("You are betting $moneyBet ${currencyType()} on $betType!")
+////        builder?.setIcon(android.R.drawable.ic_dialog_alert)
+//
+//        //performing positive action
+//        builder?.setPositiveButton("Yes") { dialogInterface, which ->
+//
+//            cfBetViewModel.createBetting(CreateBetting(moneyBet, chickenId))
+//            dialogInterface.dismiss()
+//        }
+//        //performing negative action
+//        builder?.setNegativeButton("No") { dialogInterface, which ->
+//            btnBetMeron.isEnabled = true
+//            btnBetWala.isEnabled = true
+//            dialogInterface.dismiss()
+//        }
+//        // Create the AlertDialog
+//        val alertDialog: AlertDialog? = builder?.create()
+//        // Set other dialog properties
+//        alertDialog?.setCancelable(false)
+//        alertDialog?.show()
     }
 
     private fun btnMaster(it: BtnMasterState) {

+ 11 - 11
app/src/main/java/com/sambath/kunkhmer/screen/main/cflive/currentbets/CurrentBetsFragment.kt

@@ -30,17 +30,17 @@ class CurrentBetsFragment : BaseFragment(R.layout.fragment_current_bets) {
             user = userShare
         }
         currentBetsViewModel = CurrentBetsViewModel(App.injectApiService(), App.injectPrefHelper())
-        when (user.currencyType) {
-            1 -> {//dollar
-                currency = "$"
-            }
-            2 -> {//riel
-                currency ="៛"
-            }
-            3 -> {//baht
-                currency = "฿"
-            }
-        }
+//        when (user.currencyType) {
+//            1 -> {//dollar
+//                currency = "$"
+//            }
+//            2 -> {//riel
+//                currency ="៛"
+//            }
+//            3 -> {//baht
+//                currency = "฿"
+//            }
+//        }
     }
 
     override fun onViewCreated(view: View, savedInstanceState: Bundle?) {

+ 1 - 1
app/src/main/java/com/sambath/kunkhmer/screen/main/cflive/statement/StatementDialogFragment.kt

@@ -65,7 +65,7 @@ class StatementDialogFragment : DialogFragment() {
     override fun onViewCreated(view: View, savedInstanceState: Bundle?) {
         super.onViewCreated(view, savedInstanceState)
         txtUserId.text = user.userName
-        txtSubRed.text = currencyFormat(user.accountBalances)
+//        txtSubRed.text = currencyFormat(user.accountBalances)
         img_back.setOnClickListener {
             dismiss()
         }

+ 11 - 11
app/src/main/java/com/sambath/kunkhmer/screen/report/StatementFragment.kt

@@ -88,17 +88,17 @@ class StatementFragment : BaseFragment(R.layout.fragment_statement) {
         (requireActivity() as ShareActivity).apply {
             user = userShare
         }
-        when (user.currencyType) {
-            1 -> {//dollar
-                currency = "$"
-            }
-            2 -> {//riel
-                currency ="៛"
-            }
-            3 -> {//baht
-                currency = "฿"
-            }
-        }
+//        when (user.currencyType) {
+//            1 -> {//dollar
+//                currency = "$"
+//            }
+//            2 -> {//riel
+//                currency ="៛"
+//            }
+//            3 -> {//baht
+//                currency = "฿"
+//            }
+//        }
     }
 
     override fun onViewCreated(view: View, savedInstanceState: Bundle?) {

+ 1 - 1
app/src/main/java/com/sambath/kunkhmer/util/PrefHelper.kt

@@ -19,7 +19,7 @@ class PrefHelper constructor(val context: Context) {
     fun setIsMute(value: Boolean) = sharedPreferences.edit().putBoolean(MUTE_KEY, value).apply()
     fun setIsAutoPrint(value: Boolean) = sharedPreferences.edit().putBoolean(AUTO_PRINT_KEY, value).apply()
 
-    fun setUserToken(token: String) = sharedPreferences.edit().putString(TOKEN_KEY, "Bearer $token").apply()
+    fun setUserToken(token: String) = sharedPreferences.edit().putString(TOKEN_KEY, "$token").apply()
 
     fun setChannelType(channelType: Int) = sharedPreferences.edit().putInt(CHANNEL_TYPE, channelType).apply()
 

+ 3 - 6
app/src/prod/java/com/sambath/sbc/config/Config.kt

@@ -1,10 +1,7 @@
-package com.sambath.sbc.config
+package com.sambath.kunkhmer.config
 
 object Config {
     //production
-    const val BASE_URL = "https://playerapi.wa855.net"
-    const val SOCKET_1 = "https://socket.wa855.net/chicken-online"
-    const val SOCKET_2 = "https://socket.wa855.net/sabong-sl"
-    const val SOCKET_3 = "https://socket.wa855.net/sabong-sl-3"
-    const val SOCKET_4 = "https://socket.wa855.net/sabong-sl-4"
+    const val BASE_URL = "http://143.198.207.249:30827"
+    const val SOCKET_1 = "http://143.198.207.249:30827/namespace-kun-khmer"
 }