Dola TENG %!s(int64=2) %!d(string=hai) anos
pai
achega
b1ed7d57b5

+ 1 - 1
app/src/main/java/com/sambath/klaklouk_main/app/ShareActivity.kt

@@ -291,7 +291,7 @@ class ShareActivity : AutoLogoutBaseActivity() {
         if (hasFocus) hideSystemUI()
     }
 
-    private fun getUserInfo(it: UserInformation) {
+    private fun getUserInfo(it: User) {
         Log.d("stateUser", it.toString())
         tv_amount.text = it.accountBalances?.let { it1 ->
             val balance = currencyFormat(it1)

+ 1 - 1
app/src/main/java/com/sambath/klaklouk_main/screen/main/MainDataViewState.kt

@@ -17,6 +17,6 @@ data class MainDataViewState(
 
     val isUserPro: Boolean = false,
     val errorUser: String? = null,
-    val userInfo: UserInformation? = null,
+    val userInfo: User? = null,
     val isUserSuccess: Boolean = false,
 )

+ 15 - 9
app/src/main/java/com/sambath/klaklouk_main/screen/main/MainViewModel.kt

@@ -11,10 +11,10 @@ import io.reactivex.android.schedulers.AndroidSchedulers
 import io.reactivex.schedulers.Schedulers
 import java.util.concurrent.TimeUnit
 
-class MainViewModel(val apiService: ApiService, val prefHelper: PrefHelper): BaseViewModel() {
+class MainViewModel(val apiService: ApiService, val prefHelper: PrefHelper) : BaseViewModel() {
     private val _stateChannel = MutableLiveData(MainDataViewState())
     val stateChannel: LiveData<MainDataViewState> = _stateChannel
-    fun getChannel(){
+    fun getChannel() {
         if (_stateChannel.value!!.isUserPro) return
         _stateChannel.value = prevChannel().copy(isUserPro = true)
         disposables.add(
@@ -32,20 +32,24 @@ class MainViewModel(val apiService: ApiService, val prefHelper: PrefHelper): Bas
                         )
                     } else {
                         _stateChannel.value =
-                            prevChannel().copy(isUserPro = false, errorUser = "[${it.message.description}]")
+                            prevChannel().copy(
+                                isUserPro = false,
+                                errorUser = "[${it.message.description}]"
+                            )
                     }
                 }, {
-//                    Log.d("dataxzsd", it.getErrorCode())
                     val message: String = "ប្រតិបត្តិការមិនជោគជ័យ\n" + it.getErrorCode()
                     _stateChannel.value = prevChannel().copy(isUserPro = false, errorUser = message)
                 })
         )
     }
+
     private fun prevChannel() = _stateChannel.value!!
 
     private val _stateUser = MutableLiveData(MainDataViewState())
     val stateUser: LiveData<MainDataViewState> = _stateUser
-    fun getUser(){
+
+    fun getUser() {
         if (_stateUser.value!!.isUserPro) return
         _stateUser.value = prevUser().copy(isUserPro = true)
         disposables.add(
@@ -55,7 +59,6 @@ class MainViewModel(val apiService: ApiService, val prefHelper: PrefHelper): Bas
                 .observeOn(AndroidSchedulers.mainThread())
                 .subscribe({
                     if (it.resultCode == "1") {
-//                        ModelPreferencesManager.put(it.data, Const.USER_KEY)
                         _stateUser.value = prevUser().copy(
                             isUserPro = false,
                             errorUser = null,
@@ -64,20 +67,23 @@ class MainViewModel(val apiService: ApiService, val prefHelper: PrefHelper): Bas
                         )
                     } else {
                         _stateUser.value =
-                            prevChannel().copy(isUserPro = false, errorUser = "[${it.message.description}]")
+                            prevChannel().copy(
+                                isUserPro = false,
+                                errorUser = "[${it.message.description}]"
+                            )
                     }
                 }, {
-//                    Log.d("dataxzsd", it.getErrorCode())
                     val message: String = "ប្រតិបត្តិការមិនជោគជ័យ\n" + it.getErrorCode()
                     _stateUser.value = prevUser().copy(isUserPro = false, errorUser = message)
                 })
         )
     }
+
     private fun prevUser() = _stateUser.value!!
 
     private val _state = MutableLiveData<CfResultViewState>(CfResultViewState())
     val state: LiveData<CfResultViewState> = _state
-    fun getCfResuleData(){
+    fun getCfResuleData() {
         if (_state.value!!.isProgress) return
         _state.value = prev().copy(isProgress = true)
         disposables.add(