Fix/alfred3.3.20 (#6170)
* TP-2164 | added control to disable screenshot for dialog * TP-2164 | fixed firebase listener callback * TP-2164 | removed logs * TP-2164 | refactored Co-authored-by: snehabanka <129893809+snehabanka@users.noreply.github.com> Co-authored-by: shankar yadav <shankar.yadav@navi.com>
This commit is contained in:
committed by
GitHub Enterprise
parent
b13196d9bf
commit
6773c0a896
@@ -14,13 +14,16 @@ import android.content.Context
|
||||
import android.content.pm.PackageManager
|
||||
import android.net.Uri
|
||||
import android.os.Bundle
|
||||
import android.util.Log
|
||||
import com.android.installreferrer.api.InstallReferrerClient
|
||||
import com.android.installreferrer.api.InstallReferrerStateListener
|
||||
import com.android.installreferrer.api.ReferrerDetails
|
||||
import com.navi.analytics.alfred.AlfredManager
|
||||
import com.navi.analytics.utils.NaviTrackEvent
|
||||
import com.navi.base.deeplink.util.DeeplinkConstants
|
||||
import com.navi.base.model.CtaData
|
||||
import com.navi.base.sharedpref.CommonPrefConstants
|
||||
import com.navi.base.sharedpref.CommonPrefConstants.ALFRED_DIALOG_SCREENSHOT
|
||||
import com.navi.base.sharedpref.PreferenceManager
|
||||
import com.navi.base.utils.BaseUtils
|
||||
import com.navi.common.constants.DEVICE_ID
|
||||
@@ -40,7 +43,6 @@ import com.navi.common.utils.log
|
||||
import com.naviapp.BuildConfig
|
||||
import com.naviapp.analytics.utils.NaviAnalytics
|
||||
import com.naviapp.analytics.utils.NaviAnalytics.Companion.LOGIN_FLAG
|
||||
import com.naviapp.analytics.utils.NaviSDKHelper
|
||||
import com.naviapp.app.NaviApplication
|
||||
import com.naviapp.common.navigator.NaviDeepLinkNavigator
|
||||
import com.naviapp.common.navigator.ScreenNavigator
|
||||
@@ -478,6 +480,11 @@ object DeeplinkManager {
|
||||
updatedPulseBaseUrl = firebaseResponse.metadata?.get(CommonPrefConstants.PULSE_BASE_URL),
|
||||
context = context
|
||||
)
|
||||
handleAlfredDialogScreenShot(
|
||||
firebaseResponse.metadata?.get(
|
||||
ALFRED_DIALOG_SCREENSHOT
|
||||
)
|
||||
)
|
||||
handleNewLogo(context, firebaseResponse.metadata)
|
||||
}
|
||||
}
|
||||
@@ -487,6 +494,12 @@ object DeeplinkManager {
|
||||
)
|
||||
}
|
||||
|
||||
private fun handleAlfredDialogScreenShot(firebaseResponse: String?) {
|
||||
firebaseResponse?.let { status ->
|
||||
AlfredManager.config.setDisableDialogScreenShot(status == CommonPrefConstants.DISABLE)
|
||||
}
|
||||
}
|
||||
|
||||
private fun handleNewLogo(context: Context, metadata: Map<String, String>?) {
|
||||
val isNewLogoUpdated = BaseUtils.checkDiffAndSaveDataInSharedPreference(
|
||||
sharedPrefKey = CommonPrefConstants.NEW_APP_LOGO,
|
||||
|
||||
@@ -46,7 +46,8 @@ data class AlfredConfig(
|
||||
private var disableScreenList: List<String>? = null,
|
||||
private var disableModuleList: List<String>? = null,
|
||||
private var snapshotPerSecond: Int = 1,
|
||||
private var enableAlfred: Boolean = false
|
||||
private var enableAlfred: Boolean = false,
|
||||
private var disableDialogScreenShot: Boolean = false
|
||||
|
||||
) {
|
||||
|
||||
@@ -225,4 +226,11 @@ data class AlfredConfig(
|
||||
}
|
||||
fun getMetricsApiEnableStatus(): Boolean = this.metricsApiEnableStatus
|
||||
|
||||
fun setDisableDialogScreenShot(status: Boolean){
|
||||
this.disableDialogScreenShot=status
|
||||
}
|
||||
|
||||
fun getDisableDialogScreenShot(): Boolean {
|
||||
return this.disableDialogScreenShot
|
||||
}
|
||||
}
|
||||
|
||||
@@ -208,6 +208,9 @@ object AlfredManager {
|
||||
rootBmp: Bitmap? = null,
|
||||
moduleName: String? = null
|
||||
) {
|
||||
if(config.getDisableDialogScreenShot()){
|
||||
return
|
||||
}
|
||||
val bottomSheetView = dialog?.window?.decorView?.rootView
|
||||
if (bottomSheetView != null) {
|
||||
val bottomSheetCanvasForBitmap = createBitmapForView(bottomSheetView)
|
||||
|
||||
@@ -26,8 +26,9 @@ object CommonPrefConstants {
|
||||
const val NEW_APP_LOGO = "newAppLogo"
|
||||
const val APP_BASE_URL = "appBaseUrl"
|
||||
const val PULSE_BASE_URL = "pulseBaseUrl"
|
||||
const val UXCAM_CONFIG = "cruise_control_key_test"
|
||||
const val UPDATED_PULSE_BASE_URL = "updatedPulseBaseUrl"
|
||||
const val WHATS_APP_LOGIN_CONFIG = "WHATS_APP_LOGIN_CONFIG"
|
||||
const val WHATS_APP_LOGIN_CONFIG_PARAMETERS = "WHATS_APP_LOGIN_CONFIG_PARAMETERS"
|
||||
const val ALFRED_DIALOG_SCREENSHOT = "ALFRED_DIALOG_SCREENSHOT"
|
||||
const val DISABLE = "DISABLE"
|
||||
}
|
||||
|
||||
@@ -14,6 +14,7 @@ import android.content.pm.PackageManager
|
||||
import android.net.ConnectivityManager
|
||||
import android.provider.Settings
|
||||
import com.navi.base.sharedpref.CommonPrefConstants
|
||||
import com.navi.base.sharedpref.CommonPrefConstants.ALFRED_DIALOG_SCREENSHOT
|
||||
import com.navi.base.sharedpref.CommonPrefConstants.UPDATED_BASE_URL
|
||||
import com.navi.base.sharedpref.CommonPrefConstants.UPDATED_PULSE_BASE_URL
|
||||
import com.navi.base.sharedpref.PreferenceManager
|
||||
@@ -291,6 +292,9 @@ object BaseUtils {
|
||||
fun getUpdatedPulseBaseUrl(): String? =
|
||||
PreferenceManager.getStringPreferenceApp(key = UPDATED_PULSE_BASE_URL)
|
||||
|
||||
fun getAlfredDialogDisabledStatus(): String? =
|
||||
PreferenceManager.getStringPreferenceApp(key = ALFRED_DIALOG_SCREENSHOT)
|
||||
|
||||
fun saveBaseUrlsAndRestart(
|
||||
updatedBaseUrl: String?,
|
||||
updatedPulseBaseUrl: String?,
|
||||
|
||||
@@ -18,6 +18,8 @@ class FirebaseDataHelperGlobal {
|
||||
}
|
||||
|
||||
fun clear() {
|
||||
firebaseDataReceiveManager?.deInitializeFirebase() // to remove Listener
|
||||
firebaseDataReceiveManager?.clean()
|
||||
firebaseDataReceiveManager = null
|
||||
}
|
||||
}
|
||||
|
||||
@@ -12,6 +12,7 @@ class FirebaseDataReceiveManagerGlobal(
|
||||
listener: FirebaseDataReceiveListener?
|
||||
) {
|
||||
private var firebaseReceiveDataHandler: FirebaseReceiveDataHandler? = null
|
||||
private var listener: FirebaseDataReceiveListener? = null
|
||||
|
||||
private val dataReceiveDatabaseRef by lazy {
|
||||
val firebasePath = "messages/app-config"
|
||||
@@ -19,9 +20,25 @@ class FirebaseDataReceiveManagerGlobal(
|
||||
}
|
||||
|
||||
init {
|
||||
this.listener = listener
|
||||
firebaseReceiveDataHandler = FirebaseReceiveDataHandler(listener)
|
||||
firebaseReceiveDataHandler?.let {
|
||||
dataReceiveDatabaseRef.addValueEventListener(it)
|
||||
}
|
||||
}
|
||||
|
||||
fun clean() {
|
||||
dataReceiveDatabaseRef.onDisconnect()
|
||||
firebaseReceiveDataHandler?.clear()
|
||||
firebaseReceiveDataHandler = null
|
||||
listener = null
|
||||
}
|
||||
|
||||
fun deInitializeFirebase() {
|
||||
firebaseReceiveDataHandler?.let {
|
||||
dataReceiveDatabaseRef.removeEventListener(
|
||||
it
|
||||
)
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
@@ -12,7 +12,7 @@ import com.google.firebase.database.DatabaseError
|
||||
import com.google.firebase.database.ValueEventListener
|
||||
import timber.log.Timber
|
||||
|
||||
class FirebaseReceiveDataHandler(private val listener: FirebaseDataReceiveListener?) :
|
||||
class FirebaseReceiveDataHandler(private var listener: FirebaseDataReceiveListener?) :
|
||||
ValueEventListener {
|
||||
|
||||
override fun onDataChange(dataSnapshot: DataSnapshot) {
|
||||
@@ -28,4 +28,8 @@ class FirebaseReceiveDataHandler(private val listener: FirebaseDataReceiveListen
|
||||
|
||||
override fun onCancelled(databaseError: DatabaseError) {
|
||||
}
|
||||
|
||||
fun clear() {
|
||||
listener = null
|
||||
}
|
||||
}
|
||||
|
||||
@@ -41,10 +41,16 @@ abstract class BaseDialogFragment<T : ViewDataBinding>(
|
||||
savedInstanceState: Bundle?,
|
||||
): View? {
|
||||
binding = DataBindingUtil.inflate(inflater, layoutId, container, false, null)
|
||||
AlfredManager.dialog = this.dialog
|
||||
return binding.root
|
||||
}
|
||||
|
||||
override fun onResume() {
|
||||
super.onResume()
|
||||
if(isBindingInitialized()){
|
||||
AlfredManager.dialog = this.dialog
|
||||
}
|
||||
}
|
||||
|
||||
override fun onActivityCreated(savedInstanceState: Bundle?) {
|
||||
super.onActivityCreated(savedInstanceState)
|
||||
initUI()
|
||||
@@ -59,9 +65,13 @@ abstract class BaseDialogFragment<T : ViewDataBinding>(
|
||||
return ::binding.isInitialized
|
||||
}
|
||||
|
||||
override fun onStop() {
|
||||
super.onStop()
|
||||
AlfredManager.dialog = null
|
||||
}
|
||||
|
||||
override fun onDestroyView() {
|
||||
super.onDestroyView()
|
||||
AlfredManager.dialog = null
|
||||
binding.unbind()
|
||||
}
|
||||
}
|
||||
|
||||
@@ -1,18 +1,17 @@
|
||||
package com.navi.common.ui.fragment
|
||||
|
||||
import android.os.Bundle
|
||||
import android.view.View
|
||||
import com.google.android.material.bottomsheet.BottomSheetDialogFragment
|
||||
import com.navi.analytics.alfred.AlfredManager
|
||||
|
||||
abstract class NaviAnalyticsBaseBottomSheet : BottomSheetDialogFragment() {
|
||||
override fun onViewCreated(view: View, savedInstanceState: Bundle?) {
|
||||
super.onViewCreated(view, savedInstanceState)
|
||||
|
||||
override fun onResume() {
|
||||
super.onResume()
|
||||
AlfredManager.dialog = this.dialog
|
||||
}
|
||||
|
||||
override fun onDestroyView() {
|
||||
super.onDestroyView()
|
||||
override fun onStop() {
|
||||
super.onStop()
|
||||
AlfredManager.dialog = null
|
||||
}
|
||||
}
|
||||
Reference in New Issue
Block a user