* release 1.62. * removed trucaller drop call sdk (#1390)
This commit is contained in:
committed by
GitHub Enterprise
parent
e516783712
commit
b52987bcee
@@ -15,7 +15,7 @@ plugins {
|
||||
id('com.google.firebase.firebase-perf')
|
||||
}
|
||||
|
||||
def VERSION_NAME = "1.6.1"
|
||||
def VERSION_NAME = "1.6.2"
|
||||
|
||||
android {
|
||||
compileSdkVersion 29
|
||||
@@ -34,7 +34,7 @@ android {
|
||||
applicationId "com.naviapp"
|
||||
minSdkVersion 21
|
||||
targetSdkVersion 29
|
||||
versionCode 63
|
||||
versionCode 64
|
||||
versionName VERSION_NAME
|
||||
multiDexEnabled true
|
||||
testInstrumentationRunner "androidx.test.runner.AndroidJUnitRunner"
|
||||
@@ -353,8 +353,8 @@ dependencies {
|
||||
implementation 'com.google.android.play:core-ktx:1.8.1'
|
||||
|
||||
// for Trucaller
|
||||
// implementation "com.truecaller.android.sdk:truecaller-sdk:2.6.0"
|
||||
implementation project(":truecallersdk-2.6.1-releasePartner")
|
||||
implementation "com.truecaller.android.sdk:truecaller-sdk:2.6.0"
|
||||
//implementation project(":truecallersdk-2.6.1-releasePartner")
|
||||
|
||||
// for GI Insurance
|
||||
debugImplementation 'com.navi.insurance:android.sdk-debug:1.1.5'
|
||||
|
||||
@@ -27,7 +27,6 @@ import com.naviapp.dashboard.listeners.FragmentInteractionListener
|
||||
import com.naviapp.databinding.LoginFragmentBinding
|
||||
import com.naviapp.registration.OtpFragment.Companion.OTP_TOKEN
|
||||
import com.naviapp.registration.RegistrationActivity.Companion.OTP_SCREEN
|
||||
import com.naviapp.registration.listeners.TrueCallerStateListener
|
||||
import com.naviapp.registration.viewmodel.RegistrationSharedVM
|
||||
import com.naviapp.registration.viewmodel.RegistrationVM
|
||||
import com.naviapp.sharedpref.PreferenceManager
|
||||
@@ -40,8 +39,7 @@ class LoginFragment : BaseFragment(), View.OnClickListener {
|
||||
private val registrationVM by lazy { ViewModelProvider(this).get(RegistrationVM::class.java) }
|
||||
private var listener: FragmentInteractionListener? = null
|
||||
private var fragmentStateListener: FragmentStateListener? = null
|
||||
private var trueCallerActionListener: TrueCallerStateListener? = null
|
||||
private var isTrueCallerEnabled: Boolean? = null
|
||||
|
||||
|
||||
override fun onCreateView(
|
||||
inflater: LayoutInflater,
|
||||
@@ -66,18 +64,6 @@ class LoginFragment : BaseFragment(), View.OnClickListener {
|
||||
private fun initListeners() {
|
||||
binding.getOtpBtn.setOnClickListener {
|
||||
if (!validateLoginDetails()) return@setOnClickListener
|
||||
|
||||
/* val isTrueCallerDropCallEnabled =
|
||||
PreferenceManager.getBooleanPreference(TRUECALLER_DROP_CALL_ENABLED).orFalse()
|
||||
if (isTrueCallerDropCallEnabled && isTrueCallerDropCallEnabled.orFalse()) {
|
||||
saveWhatsappNotificationStatus()
|
||||
NaviAnalytics.naviAnalytics.Registration().onValidatePhoneNumber()
|
||||
displayInvalidNumberError(false)
|
||||
context?.let { hideKeyboard(it, binding.root) }
|
||||
showLoader()
|
||||
trueCallerActionListener?.onDropCall(COUNTRY_ISO, binding.phoneEdit.text.toString())
|
||||
} else {
|
||||
*/
|
||||
saveWhatsappNotificationStatus()
|
||||
NaviAnalytics.naviAnalytics.Registration().onValidatePhoneNumber()
|
||||
displayInvalidNumberError(false)
|
||||
@@ -87,8 +73,8 @@ class LoginFragment : BaseFragment(), View.OnClickListener {
|
||||
binding.phoneEdit.text.toString(),
|
||||
deviceId
|
||||
)
|
||||
//}
|
||||
}
|
||||
|
||||
binding.whatsappConsentView.whatsappConsentTv.setOnClickListener(this)
|
||||
}
|
||||
|
||||
@@ -199,19 +185,6 @@ class LoginFragment : BaseFragment(), View.OnClickListener {
|
||||
handleLoginViaMobile()
|
||||
}
|
||||
}
|
||||
|
||||
sharedVM.isTrueCallerDropCallFail.observeNonNull(this) {
|
||||
if (it) {
|
||||
registrationVM.onValidPhoneNumber(
|
||||
binding.phoneEdit.text.toString(),
|
||||
deviceId
|
||||
)
|
||||
} else
|
||||
hideLoader()
|
||||
}
|
||||
sharedVM.isTrueCallerEnabled.observeNullable(this) {
|
||||
isTrueCallerEnabled = it
|
||||
}
|
||||
}
|
||||
|
||||
private fun handleLoginViaMobile() {
|
||||
@@ -235,7 +208,6 @@ class LoginFragment : BaseFragment(), View.OnClickListener {
|
||||
super.onAttach(context)
|
||||
listener = context as? FragmentInteractionListener
|
||||
fragmentStateListener = context as? FragmentStateListener
|
||||
trueCallerActionListener = context as? TrueCallerStateListener
|
||||
}
|
||||
|
||||
override val screenName: String
|
||||
|
||||
@@ -9,9 +9,7 @@ package com.naviapp.registration
|
||||
import android.content.Intent
|
||||
import android.content.IntentFilter
|
||||
import android.os.Bundle
|
||||
import android.os.Handler
|
||||
import android.view.View
|
||||
import androidx.core.os.postDelayed
|
||||
import androidx.databinding.DataBindingUtil
|
||||
import androidx.fragment.app.Fragment
|
||||
import androidx.fragment.app.FragmentTransaction
|
||||
@@ -27,24 +25,29 @@ import com.naviapp.common.listeners.FragmentStateListener
|
||||
import com.naviapp.dashboard.listeners.FragmentInteractionListener
|
||||
import com.naviapp.databinding.RegistrationActivityBinding
|
||||
import com.naviapp.firebasedb.FirebaseStatusType.SUCCESS
|
||||
import com.naviapp.models.*
|
||||
import com.naviapp.models.PageStatusType
|
||||
import com.naviapp.models.RedirectPageStatus
|
||||
import com.naviapp.models.TrueProfileData
|
||||
import com.naviapp.models.UserDetail
|
||||
import com.naviapp.network.ApiConstants.API_SUCCESS_CODE
|
||||
import com.naviapp.network.ApiErrorTagType
|
||||
import com.naviapp.pushnotification.NotificationHandler
|
||||
import com.naviapp.receiver.OtpReceiveListener
|
||||
import com.naviapp.receiver.SmsAutoReadReceiver
|
||||
import com.naviapp.registration.helper.TrueCallerHelper
|
||||
import com.naviapp.registration.listeners.TrueCallerStateListener
|
||||
import com.naviapp.registration.navigator.RegistrationNavigator
|
||||
import com.naviapp.registration.viewmodel.RegistrationSharedVM
|
||||
import com.naviapp.registration.viewmodel.RegistrationVM
|
||||
import com.naviapp.sharedpref.PreferenceManager
|
||||
import com.naviapp.utils.*
|
||||
import com.truecaller.android.sdk.*
|
||||
import com.truecaller.android.sdk.ITrueCallback
|
||||
import com.truecaller.android.sdk.TrueError
|
||||
import com.truecaller.android.sdk.TrueProfile
|
||||
import com.truecaller.android.sdk.TruecallerSDK
|
||||
|
||||
|
||||
class RegistrationActivity : BaseActivity(), FragmentInteractionListener, FragmentStateListener,
|
||||
ITrueCallback, TrueCallerStateListener {
|
||||
ITrueCallback {
|
||||
private lateinit var binding: RegistrationActivityBinding
|
||||
|
||||
private val registrationVM by lazy { ViewModelProvider(this).get(RegistrationVM::class.java) }
|
||||
@@ -58,8 +61,7 @@ class RegistrationActivity : BaseActivity(), FragmentInteractionListener, Fragme
|
||||
private lateinit var auth: FirebaseAuth
|
||||
private var randomRequestId: String? = null
|
||||
private var isTrueCallerEnabled: Boolean? = null
|
||||
private var phoneNumber: String? = null
|
||||
private var handler: Handler? = null
|
||||
|
||||
|
||||
override fun onCreate(savedInstanceState: Bundle?) {
|
||||
super.onCreate(savedInstanceState)
|
||||
@@ -69,12 +71,10 @@ class RegistrationActivity : BaseActivity(), FragmentInteractionListener, Fragme
|
||||
randomRequestId = getUniqueRandomNumber()
|
||||
FcmAnalyticsUtil.analytics.setCrashlyticRandomRequestId(randomRequestId)
|
||||
trueCallHelper.init(this, this, randomRequestId)
|
||||
// trueCallHelper.initVerificationCallBack(this)
|
||||
}
|
||||
initListener()
|
||||
initErrors()
|
||||
navigateTo(LOGIN_SCREEN)
|
||||
registrationSharedVM.setTrueCallerEnable(isTrueCallerEnabled.orFalse())
|
||||
initObservers()
|
||||
if (isTrueCallerEnabled.orFalse())
|
||||
onFragmentOpen(null)
|
||||
@@ -235,15 +235,8 @@ class RegistrationActivity : BaseActivity(), FragmentInteractionListener, Fragme
|
||||
registrationVM.loginViaTrueCaller(data)
|
||||
}
|
||||
|
||||
override fun onVerificationRequired(error: TrueError?) {
|
||||
override fun onVerificationRequired(p0: TrueError?) {
|
||||
//will only be called whenTruecallerSdkScope#SDK_OPTION_WITH_OTP is selected
|
||||
if (error?.errorType == TrueError.ERROR_TYPE_CONTINUE_WITH_DIFFERENT_NUMBER) {
|
||||
NaviAnalytics.naviAnalytics.Registration().onTrueCallerWithDiffNumber()
|
||||
} else {
|
||||
NaviAnalytics.naviAnalytics.Registration()
|
||||
.onTrueCallerLoginError(error?.errorType.orZero().toString())
|
||||
}
|
||||
registrationSharedVM.setLoginViaMobile(true)
|
||||
}
|
||||
|
||||
override fun onFragmentOpen(type: String?) {
|
||||
@@ -271,64 +264,6 @@ class RegistrationActivity : BaseActivity(), FragmentInteractionListener, Fragme
|
||||
}
|
||||
}
|
||||
|
||||
override fun onDropCall(countryISO: String, phone: String) {
|
||||
phoneNumber = phone
|
||||
trueCallHelper.requestVerification(
|
||||
this,
|
||||
countryISO,
|
||||
phone
|
||||
)
|
||||
}
|
||||
|
||||
override fun onMissCallInitiated() {
|
||||
handler?.removeCallbacksAndMessages(null)
|
||||
handler = Handler()
|
||||
handler?.postDelayed({
|
||||
if (isDead()) return@postDelayed
|
||||
registrationSharedVM.setTrueCallerDropCallFail(true)
|
||||
}, TRUECALLER_MISS_CALL_MAX_WAIT)
|
||||
}
|
||||
|
||||
override fun onMissCallReceived() {
|
||||
handler?.removeCallbacksAndMessages(null)
|
||||
trueCallHelper.verifyMissedCall()
|
||||
}
|
||||
|
||||
override fun onVerificationCompleted(accessToken: String) {
|
||||
dropCallApi(accessToken, phoneNumber.orEmpty())
|
||||
}
|
||||
|
||||
override fun onProfileVerifiedBefore(data: TrueProfile) {
|
||||
dropCallApi(data.accessToken.orEmpty(), phoneNumber.orEmpty(), true)
|
||||
}
|
||||
|
||||
override fun onProfileVerifiedWithoutName(accessToken: String) {
|
||||
dropCallApi(accessToken, phoneNumber.orEmpty())
|
||||
}
|
||||
|
||||
private fun dropCallApi(
|
||||
accessToken: String,
|
||||
phone: String,
|
||||
isProfileVerifiedBefore: Boolean = false
|
||||
) {
|
||||
handler?.removeCallbacksAndMessages(null)
|
||||
if (isProfileVerifiedBefore)
|
||||
PreferenceManager.setBooleanPreference(TRUECALLER_PROFILE_VERIFIED, true)
|
||||
else
|
||||
PreferenceManager.setStringPreference(TRUECALLER_ACCESS_TOKEN, accessToken)
|
||||
|
||||
registrationVM.trueCallerDropCall(
|
||||
TrueCallerDropCallData(
|
||||
accessToken = accessToken,
|
||||
phoneNumber = phone
|
||||
)
|
||||
)
|
||||
}
|
||||
|
||||
override fun onMissCallFailure(errorCode: Int?) {
|
||||
registrationSharedVM.setTrueCallerDropCallFail(true)
|
||||
}
|
||||
|
||||
override fun onPause() {
|
||||
super.onPause()
|
||||
unregisterReceiver(otpReceiver)
|
||||
@@ -347,6 +282,5 @@ class RegistrationActivity : BaseActivity(), FragmentInteractionListener, Fragme
|
||||
const val LOGIN_SCREEN = "LOGIN_SCREEN"
|
||||
const val OTP_SCREEN = "OTP_SCREEN"
|
||||
const val TAG = "REGISTRATION_ACTIVITY"
|
||||
const val TRUECALLER_MISS_CALL_MAX_WAIT = 12000L
|
||||
}
|
||||
}
|
||||
@@ -8,82 +8,17 @@ package com.naviapp.registration.helper
|
||||
|
||||
import android.content.Context
|
||||
import com.naviapp.R
|
||||
import com.naviapp.common.BaseActivity
|
||||
import com.naviapp.registration.listeners.TrueCallerStateListener
|
||||
import com.naviapp.utils.log
|
||||
import com.naviapp.utils.orFalse
|
||||
import com.truecaller.android.sdk.*
|
||||
import com.truecaller.android.sdk.clients.ProfileCallback
|
||||
import com.truecaller.android.sdk.clients.VerificationCallback
|
||||
import com.truecaller.android.sdk.clients.VerificationDataBundle
|
||||
import com.truecaller.android.sdk.ITrueCallback
|
||||
import com.truecaller.android.sdk.TruecallerSDK
|
||||
|
||||
import com.truecaller.android.sdk.TruecallerSdkScope
|
||||
|
||||
|
||||
class TrueCallerHelper {
|
||||
|
||||
private var isInit: Boolean? = null
|
||||
private var trueCallerVerificationCallback: VerificationCallback? = null
|
||||
private var trueCallerStateListener: TrueCallerStateListener? = null
|
||||
private var profileCallBack: ProfileCallback? = null
|
||||
|
||||
|
||||
fun initProfileCallback() {
|
||||
profileCallBack = object : ProfileCallback {
|
||||
override fun onSuccessProfileCreated() {
|
||||
}
|
||||
|
||||
override fun onFailureProfileCreated(p0: TrueException) {
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
fun initVerificationCallBack(tcStateListener: TrueCallerStateListener?) {
|
||||
this.trueCallerStateListener = tcStateListener
|
||||
trueCallerVerificationCallback = object : VerificationCallback {
|
||||
override fun onRequestFailure(p0: Int, p1: TrueException) {
|
||||
trueCallerStateListener?.onMissCallFailure(p0)
|
||||
}
|
||||
|
||||
override fun onRequestSuccess(requestCode: Int, extras: VerificationDataBundle?) {
|
||||
when (requestCode) {
|
||||
VerificationCallback.TYPE_MISSED_CALL_INITIATED -> {
|
||||
trueCallerStateListener?.onMissCallInitiated()
|
||||
}
|
||||
VerificationCallback.TYPE_MISSED_CALL_RECEIVED -> {
|
||||
trueCallerStateListener?.onMissCallReceived()
|
||||
}
|
||||
VerificationCallback.TYPE_VERIFICATION_COMPLETE -> {
|
||||
//KEY_ACCESS_TOKEN, Access token
|
||||
trueCallerStateListener?.onVerificationCompleted(
|
||||
extras?.getString(
|
||||
VerificationDataBundle.KEY_ACCESS_TOKEN
|
||||
).orEmpty()
|
||||
)
|
||||
}
|
||||
VerificationCallback.TYPE_PROFILE_VERIFIED_BEFORE -> {
|
||||
// first name, last name, phone number, no need to do profile setting again
|
||||
val data = if (extras?.profile != null) extras.profile else TrueProfile()
|
||||
data?.let {
|
||||
trueCallerStateListener?.onProfileVerifiedBefore(
|
||||
it
|
||||
)
|
||||
}
|
||||
}
|
||||
VerificationCallback.TYPE_USER_VERIFIED_WITHOUT_NAME -> {
|
||||
//KEY_ACCESS_TOKEN
|
||||
trueCallerStateListener?.onProfileVerifiedWithoutName(
|
||||
extras?.getString(
|
||||
VerificationDataBundle.KEY_ACCESS_TOKEN
|
||||
).orEmpty()
|
||||
)
|
||||
}
|
||||
else -> {
|
||||
trueCallerStateListener?.onMissCallFailure(requestCode)
|
||||
}
|
||||
}
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
|
||||
fun init(context: Context, tcCallBack: ITrueCallback, requestId: String? = null) {
|
||||
initImpl(context, tcCallBack, requestId)
|
||||
@@ -100,7 +35,7 @@ class TrueCallerHelper {
|
||||
.buttonShapeOptions(TruecallerSdkScope.BUTTON_SHAPE_ROUNDED)
|
||||
.footerType(TruecallerSdkScope.FOOTER_TYPE_CONTINUE)
|
||||
.consentTitleOption(TruecallerSdkScope.SDK_CONSENT_TITLE_LOG_IN)
|
||||
.sdkOptions(TruecallerSdkScope.SDK_OPTION_WITH_OTP)
|
||||
.sdkOptions(TruecallerSdkScope.SDK_OPTION_WITHOUT_OTP)
|
||||
.build()
|
||||
|
||||
TruecallerSDK.init(trueScope)
|
||||
@@ -112,40 +47,9 @@ class TrueCallerHelper {
|
||||
}
|
||||
}
|
||||
|
||||
fun requestVerification(
|
||||
activity: BaseActivity,
|
||||
countryISO: String,
|
||||
phone: String
|
||||
) {
|
||||
try {
|
||||
trueCallerVerificationCallback?.let {
|
||||
TruecallerSDK.getInstance()
|
||||
.requestVerification(countryISO, phone, it, activity)
|
||||
}
|
||||
} catch (e: Exception) {
|
||||
e.log()
|
||||
}
|
||||
}
|
||||
|
||||
fun verifyMissedCall() {
|
||||
trueCallerVerificationCallback?.let {
|
||||
TruecallerSDK.getInstance().verifyMissedCall(it)
|
||||
}
|
||||
}
|
||||
|
||||
fun createProfile(accessToken: String, profile: TrueProfile) {
|
||||
profileCallBack?.let {
|
||||
try {
|
||||
TruecallerSDK.getInstance().createProfile(accessToken, profile, it)
|
||||
} catch (e: Exception) {
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
fun clear() {
|
||||
try {
|
||||
isInit = null
|
||||
trueCallerVerificationCallback = null
|
||||
TruecallerSDK.clear()
|
||||
} catch (e: Exception) {
|
||||
|
||||
|
||||
@@ -1,3 +1,2 @@
|
||||
include ':truecallersdk-2.6.1-releasePartner'
|
||||
include ':app', ':digio-esign-v2.8.0', ':digio-kyc-1.0.13'
|
||||
rootProject.name='android-customer-app'
|
||||
|
||||
Reference in New Issue
Block a user