TP-17485 | VKYC - Android System Toast when volume < 20% (#5305)

* add: VKYC low volume System Toast

* move from Media Volume to Voice Call + add clickstream
This commit is contained in:
Shivam Goyal
2023-02-13 21:56:15 +05:30
committed by GitHub Enterprise
parent 1832ec952a
commit 3deb54a335
3 changed files with 22 additions and 0 deletions

View File

@@ -68,4 +68,5 @@
<string name="file_too_large">File too large</string>
<string name="request_callback">Request Callback</string>
<string name="select_policy">Select Policy</string>
<string name="increase_volume">Increase volume of your phone</string>
</resources>

View File

@@ -7,10 +7,13 @@
package com.navi.vkyc.presentation.fragments
import android.app.Activity
import android.media.AudioManager
import android.os.Bundle
import android.view.LayoutInflater
import android.view.View
import android.view.ViewGroup
import android.widget.Toast
import androidx.lifecycle.ViewModelProvider
import com.navi.base.deeplink.DeepLinkManager
import com.navi.base.model.CtaData
@@ -90,6 +93,20 @@ class VKYCWaitingForExecutiveFragment : BaseFragment(), NaviHeaderView.Interacti
resources.getString(R.string.vkyc_important_note_title),
resources.getString(R.string.vkyc_please_dont_leave)
)
showLowVolumeToast()
}
private fun showLowVolumeToast() {
val audioManager = context?.getSystemService(Activity.AUDIO_SERVICE) as AudioManager
val isVolumeLessThanTwentyPercent =
audioManager.getStreamVolume(AudioManager.STREAM_VOICE_CALL) <
0.2 * audioManager.getStreamMaxVolume(AudioManager.STREAM_VOICE_CALL)
if (isVolumeLessThanTwentyPercent) {
Toast.makeText(context, getString(R.string.increase_volume), Toast.LENGTH_LONG).show()
naviAnalyticsEventTracker.onLowVolumeToastShown()
}
}
private fun fetchVkycSettings() {

View File

@@ -119,6 +119,10 @@ class VkycNaviAnalytics private constructor() {
)
NaviTrackEvent.trackEventOnClickStream("PL_VKYC_Call_Connected", map)
}
fun onLowVolumeToastShown() {
NaviTrackEvent.trackEventOnClickStream("PL_VKYC_Low_Volume_Toast_Shown")
}
}
inner class VerdictScreen {