Commit 1116ccfd authored by shohboz's avatar shohboz

[FIX] MUS-212 Feature, fixed ussd bug and other changes

parent c848c636
package com.mobiuz.app.dev.network.model package com.mobiuz.app.dev.network.model
data class Customer( data class Customer(
var customer: CustomerData? val events:List<Events>,
val customer: CustomerData?
) )
data class CustomerData( data class CustomerData(
......
package com.mobiuz.app.dev.network.model
data class Events(
val id:Int,
val url:String,
val image:String
)
...@@ -109,12 +109,12 @@ class CheckPhoneFragment : BaseFragment(R.layout.fragment_check_phone) { ...@@ -109,12 +109,12 @@ class CheckPhoneFragment : BaseFragment(R.layout.fragment_check_phone) {
viewModel.checkPhoneUiState.collect { viewModel.checkPhoneUiState.collect {
when (it) { when (it) {
is UiStateObject.SUCCESS -> { is UiStateObject.SUCCESS -> {
showProgressDialog(false) if (it.data.action == CONSTANTS.REGISTER) {
if (it.data.action == "register") {
navController.navigate(R.id.registerFragment, bundleOf(CONSTANTS.PHONE to phone), Utils.navOptions()) navController.navigate(R.id.registerFragment, bundleOf(CONSTANTS.PHONE to phone), Utils.navOptions())
} else { } else {
navController.navigate(R.id.loginFragment, bundleOf(CONSTANTS.PHONE to phoneRaw), Utils.navOptions()) navController.navigate(R.id.loginFragment, bundleOf(CONSTANTS.PHONE to phoneRaw), Utils.navOptions())
} }
showProgressDialog(false)
} }
is UiStateObject.ERROR -> { is UiStateObject.ERROR -> {
showProgressDialog(false) showProgressDialog(false)
......
...@@ -80,7 +80,6 @@ class LoginFragment : BaseFragment(R.layout.fragment_login) { ...@@ -80,7 +80,6 @@ class LoginFragment : BaseFragment(R.layout.fragment_login) {
inputPassword.addTextChangedListener(object : TextWatcherWrapper() { inputPassword.addTextChangedListener(object : TextWatcherWrapper() {
override fun onTextChanged(s: CharSequence?, start: Int, before: Int, count: Int) { override fun onTextChanged(s: CharSequence?, start: Int, before: Int, count: Int) {
super.onTextChanged(s, start, before, count) super.onTextChanged(s, start, before, count)
bn.helperPassword.isVisible = false
btnLogin.isEnabled = (s.toString().length > 3) btnLogin.isEnabled = (s.toString().length > 3)
} }
}) })
...@@ -100,7 +99,7 @@ class LoginFragment : BaseFragment(R.layout.fragment_login) { ...@@ -100,7 +99,7 @@ class LoginFragment : BaseFragment(R.layout.fragment_login) {
) )
} }
else -> { else -> {
viewModel.login(UserAuth(phone.replace(" ", "").replace("+", ""), password)) viewModel.login(UserAuth(phone.filter { it.isDigit() }, password))
} }
} }
...@@ -119,20 +118,14 @@ class LoginFragment : BaseFragment(R.layout.fragment_login) { ...@@ -119,20 +118,14 @@ class LoginFragment : BaseFragment(R.layout.fragment_login) {
when (it) { when (it) {
is UiStateObject.SUCCESS -> { is UiStateObject.SUCCESS -> {
showProgressDialog(false) showProgressDialog(false)
bn.helperPassword.isVisible = false
bn.helperPhone.isVisible = false
navController.navigate(R.id.myVerificationFragment, bundleOf(CONSTANTS.PHONE to phone, CONSTANTS.PIN_CODE to it.data), Utils.navOptions()) navController.navigate(R.id.myVerificationFragment, bundleOf(CONSTANTS.PHONE to phone, CONSTANTS.PIN_CODE to it.data), Utils.navOptions())
} }
is UiStateObject.ERROR -> { is UiStateObject.ERROR -> {
showProgressDialog(false) showProgressDialog(false)
showToastMessage(it.message) showToastMessage(it.message)
bn.helperPassword.isVisible = false
bn.helperPhone.isVisible = false
} }
is UiStateObject.LOADING -> { is UiStateObject.LOADING -> {
bn.helperPassword.isVisible = false
bn.helperPhone.isVisible = false
showProgressDialog(true) showProgressDialog(true)
} }
else -> Unit else -> Unit
......
...@@ -75,7 +75,7 @@ class RegisterFragment : BaseFragment(R.layout.fragment_register) { ...@@ -75,7 +75,7 @@ class RegisterFragment : BaseFragment(R.layout.fragment_register) {
}) })
txtHelperMobiuz.makeLinks( txtHelperMobiuz.makeLinks(
Pair("www.mobi.uz", View.OnClickListener { Pair(CONSTANTS.HTTP_MOBI_UZ, View.OnClickListener {
val uri = Uri.parse(CONSTANTS.HTTP_MOBI_UZ) val uri = Uri.parse(CONSTANTS.HTTP_MOBI_UZ)
val intent = Intent(Intent.ACTION_VIEW) val intent = Intent(Intent.ACTION_VIEW)
intent.data = uri intent.data = uri
...@@ -84,7 +84,7 @@ class RegisterFragment : BaseFragment(R.layout.fragment_register) { ...@@ -84,7 +84,7 @@ class RegisterFragment : BaseFragment(R.layout.fragment_register) {
) )
txtAgree.makeLinks( txtAgree.makeLinks(
Pair("Terms of Use", View.OnClickListener { Pair(CONSTANTS.TERMS_OF_USE, View.OnClickListener {
val uri = Uri.parse( val uri = Uri.parse(
when (pref.language) { when (pref.language) {
...@@ -98,7 +98,7 @@ class RegisterFragment : BaseFragment(R.layout.fragment_register) { ...@@ -98,7 +98,7 @@ class RegisterFragment : BaseFragment(R.layout.fragment_register) {
startActivity(intent) startActivity(intent)
}), }),
Pair("Privacy Policy", View.OnClickListener { Pair(CONSTANTS.PRIVACY_POLICY, View.OnClickListener {
val uri = Uri.parse( val uri = Uri.parse(
when (pref.language) { when (pref.language) {
CONSTANTS.UZ -> CONSTANTS.PRIVACY_POLICY_UZ CONSTANTS.UZ -> CONSTANTS.PRIVACY_POLICY_UZ
......
...@@ -13,6 +13,8 @@ object CONSTANTS { ...@@ -13,6 +13,8 @@ object CONSTANTS {
const val HELP_BOT = "@MobiuzHelpBot" const val HELP_BOT = "@MobiuzHelpBot"
const val HTTP_MOBI_UZ = "https://mobi.uz" const val HTTP_MOBI_UZ = "https://mobi.uz"
const val FEEDBACK = "https://company.mobi.uz/ru/feedback/" const val FEEDBACK = "https://company.mobi.uz/ru/feedback/"
const val TERMS_OF_USE = "Terms of Use"
const val PRIVACY_POLICY = "Privacy Policy"
const val LICENSE_UZ = "http://10.160.45.60/uploads/licenses/license_uz.html" const val LICENSE_UZ = "http://10.160.45.60/uploads/licenses/license_uz.html"
const val LICENSE_RU = "http://10.160.45.60/uploads/licenses/license_ru.html" const val LICENSE_RU = "http://10.160.45.60/uploads/licenses/license_ru.html"
...@@ -26,7 +28,6 @@ object CONSTANTS { ...@@ -26,7 +28,6 @@ object CONSTANTS {
const val PAYSYS_LICENSE_RU = "http://10.160.45.60/uploads/paysys/license_ru.html" const val PAYSYS_LICENSE_RU = "http://10.160.45.60/uploads/paysys/license_ru.html"
const val PAYSYS_LICENSE_EN = "http://10.160.45.60/uploads/paysys/license_en.html" const val PAYSYS_LICENSE_EN = "http://10.160.45.60/uploads/paysys/license_en.html"
const val MAIN_URL2 = "https://mobi.uz/"
const val PHONE1 = "0890" const val PHONE1 = "0890"
const val PHONE2 = "+998 97 130 09 09" const val PHONE2 = "+998 97 130 09 09"
const val PHONE3 = "+998 97 203 10 10" const val PHONE3 = "+998 97 203 10 10"
...@@ -38,6 +39,7 @@ object CONSTANTS { ...@@ -38,6 +39,7 @@ object CONSTANTS {
const val PHONE = "phone" const val PHONE = "phone"
const val TYPE_AUTH = "type_auth" const val TYPE_AUTH = "type_auth"
const val LOGIN = "login" const val LOGIN = "login"
const val REGISTER = "register"
const val TYPE_VERIFICATION = "type_verification" const val TYPE_VERIFICATION = "type_verification"
const val TYPE_FORGET = "type_forget" const val TYPE_FORGET = "type_forget"
const val PIN_CODE = "PIN_CODE" const val PIN_CODE = "PIN_CODE"
......
package com.mobiuz.app.dev.ui.global package com.mobiuz.app.dev.ui.global
import android.Manifest
import android.content.Intent import android.content.Intent
import android.net.Uri
import android.os.Bundle import android.os.Bundle
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 androidx.core.view.isVisible
import com.google.android.material.bottomsheet.BottomSheetDialogFragment import com.google.android.material.bottomsheet.BottomSheetDialogFragment
import com.mobiuz.app.databinding.BottomSheetUssdBinding
import com.mobiuz.app.databinding.LayoutOfflineBottomSheetBinding import com.mobiuz.app.databinding.LayoutOfflineBottomSheetBinding
import com.mobiuz.app.dev.OfflineActivity import com.mobiuz.app.dev.OfflineActivity
import com.mobiuz.app.dev.model.SharedPref import com.mobiuz.app.dev.model.SharedPref
import com.mobiuz.app.dev.model.UssdData
import com.mobiuz.app.dev.utils.extensions.checkPermission
import com.mobiuz.app.dev.utils.extensions.getCurrentName
import dagger.hilt.android.AndroidEntryPoint import dagger.hilt.android.AndroidEntryPoint
import javax.inject.Inject import javax.inject.Inject
...@@ -55,7 +48,8 @@ class OfflineBottomSheet() : BottomSheetDialogFragment() { ...@@ -55,7 +48,8 @@ class OfflineBottomSheet() : BottomSheetDialogFragment() {
}) })
} }
} }
fun navigate(){
fun navigate() {
val intent = Intent(requireContext(), OfflineActivity::class.java) val intent = Intent(requireContext(), OfflineActivity::class.java)
intent.flags = Intent.FLAG_ACTIVITY_NEW_TASK or Intent.FLAG_ACTIVITY_TASK_ON_HOME intent.flags = Intent.FLAG_ACTIVITY_NEW_TASK or Intent.FLAG_ACTIVITY_TASK_ON_HOME
startActivity(intent) startActivity(intent)
......
...@@ -85,14 +85,9 @@ class PinFragment : BaseFragment(R.layout.fragment_pin) { ...@@ -85,14 +85,9 @@ class PinFragment : BaseFragment(R.layout.fragment_pin) {
} }
} }
} }
else -> {
BiometricManager.BIOMETRIC_ERROR_NO_HARDWARE -> {
bn.btnFingerPrint.isVisible = false
}
BiometricManager.BIOMETRIC_ERROR_HW_UNAVAILABLE -> {
bn.btnFingerPrint.isVisible = false bn.btnFingerPrint.isVisible = false
} }
else -> Unit
} }
} }
......
...@@ -188,6 +188,7 @@ class HomeFragment : BaseFragment(R.layout.fragment_home) { ...@@ -188,6 +188,7 @@ class HomeFragment : BaseFragment(R.layout.fragment_home) {
is UiStateObject.SUCCESS -> { is UiStateObject.SUCCESS -> {
showProgressDialog(false) showProgressDialog(false)
bn.cardRoaming.isVisible = it.data.name != null bn.cardRoaming.isVisible = it.data.name != null
bn.txtRoaming.text = it.data.name ?: ""
} }
is UiStateObject.ERROR -> { is UiStateObject.ERROR -> {
showProgressDialog(false) showProgressDialog(false)
......
...@@ -8,11 +8,13 @@ import androidx.core.content.ContextCompat ...@@ -8,11 +8,13 @@ import androidx.core.content.ContextCompat
import androidx.recyclerview.widget.RecyclerView import androidx.recyclerview.widget.RecyclerView
import com.mobiuz.app.R import com.mobiuz.app.R
import com.mobiuz.app.databinding.ItemHomeBinding import com.mobiuz.app.databinding.ItemHomeBinding
import com.mobiuz.app.dev.network.model.Events
import com.mobiuz.app.dev.utils.extensions.SingleBlock
class SliderAdapter : RecyclerView.Adapter<SliderAdapter.SliderViewHolder>() { class SliderAdapter : RecyclerView.Adapter<SliderAdapter.SliderViewHolder>() {
private var listener: ((String) -> Unit)? = null private var listener: SingleBlock<Events>? = null
private val sliderItems: ArrayList<String> = ArrayList() private val sliderItems: ArrayList<Events> = ArrayList()
override fun onCreateViewHolder(parent: ViewGroup, viewType: Int): SliderViewHolder { override fun onCreateViewHolder(parent: ViewGroup, viewType: Int): SliderViewHolder {
return SliderViewHolder( return SliderViewHolder(
...@@ -38,11 +40,11 @@ class SliderAdapter : RecyclerView.Adapter<SliderAdapter.SliderViewHolder>() { ...@@ -38,11 +40,11 @@ class SliderAdapter : RecyclerView.Adapter<SliderAdapter.SliderViewHolder>() {
} }
fun setOnClickListener(block: (String) -> Unit) { fun setOnClickListener(block: SingleBlock<Events>) {
listener = block listener = block
} }
fun submitList(ls: List<String>) { fun submitList(ls: List<Events>) {
sliderItems.clear() sliderItems.clear()
sliderItems.addAll(ls) sliderItems.addAll(ls)
notifyDataSetChanged() notifyDataSetChanged()
......
...@@ -60,7 +60,11 @@ class UssdBottomSheetDialog(val data: UssdData) : BottomSheetDialogFragment() { ...@@ -60,7 +60,11 @@ class UssdBottomSheetDialog(val data: UssdData) : BottomSheetDialogFragment() {
try { try {
pref.blockedTime = System.currentTimeMillis() pref.blockedTime = System.currentTimeMillis()
pref.isShowPin = false pref.isShowPin = false
val ussd = data.code.replace("#", "") + Uri.encode("#") var ussd = ""
data.code.forEach {
if(it == '#') ussd += Uri.encode("#")
else ussd+= it
}
val intent = Intent(Intent.ACTION_CALL, Uri.parse("tel:$ussd")) val intent = Intent(Intent.ACTION_CALL, Uri.parse("tel:$ussd"))
startActivity(intent) startActivity(intent)
......
...@@ -396,6 +396,7 @@ ...@@ -396,6 +396,7 @@
android:textSize="14sp" /> android:textSize="14sp" />
<TextView <TextView
android:id="@+id/txt_roaming"
android:layout_width="0dp" android:layout_width="0dp"
android:layout_height="wrap_content" android:layout_height="wrap_content"
android:layout_gravity="end" android:layout_gravity="end"
......
...@@ -60,24 +60,9 @@ ...@@ -60,24 +60,9 @@
android:imeOptions="actionNext" android:imeOptions="actionNext"
android:inputType="phone" android:inputType="phone"
android:paddingVertical="@dimen/_12sdp" android:paddingVertical="@dimen/_12sdp"
android:paddingStart="@dimen/_12sdp" /> android:paddingHorizontal="@dimen/_12sdp" />
</com.google.android.material.textfield.TextInputLayout> </com.google.android.material.textfield.TextInputLayout>
<TextView
android:id="@+id/helper_phone"
android:layout_width="wrap_content"
android:layout_height="wrap_content"
android:text="@string/phone"
android:visibility="gone"
android:textStyle="bold"
app:layout_constraintStart_toStartOf="@id/layout_input_password"
app:layout_constraintTop_toBottomOf="@id/layout_input_password"
android:layout_marginTop="@dimen/_4sdp"
android:layout_marginStart="@dimen/_12sdp"
android:layout_gravity="start"
android:textColor="@color/primary100"
/>
<TextView <TextView
android:id="@+id/txt_hint_confirm" android:id="@+id/txt_hint_confirm"
...@@ -113,20 +98,7 @@ ...@@ -113,20 +98,7 @@
android:paddingStart="@dimen/_12sdp" android:paddingStart="@dimen/_12sdp"
tools:ignore="RtlSymmetry" /> tools:ignore="RtlSymmetry" />
</com.google.android.material.textfield.TextInputLayout> </com.google.android.material.textfield.TextInputLayout>
<TextView
android:id="@+id/helper_password"
android:layout_width="wrap_content"
android:layout_height="wrap_content"
android:text="@string/phone"
android:visibility="gone"
android:textStyle="bold"
app:layout_constraintStart_toStartOf="@id/layout_input_confirm"
app:layout_constraintTop_toBottomOf="@id/layout_input_confirm"
android:layout_marginTop="@dimen/_4sdp"
android:layout_marginStart="@dimen/_12sdp"
android:layout_gravity="start"
android:textColor="@color/primary100"
/>
<TextView <TextView
android:id="@+id/txt_forget_password" android:id="@+id/txt_forget_password"
......
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