NTP-33236 | Shiv Natani | place webview dir set under firebase flag (#14782)

This commit is contained in:
Shiv Natani
2025-02-04 18:24:43 +05:30
committed by GitHub
parent ed30690773
commit 88bf283ec8

View File

@@ -8,7 +8,6 @@
package com.naviapp.analytics.utils
import android.app.ActivityManager
import android.app.Application
import android.content.Context
import android.os.Build
import android.os.Process
@@ -47,6 +46,7 @@ import com.navi.common.utils.Constants.DEFAULT_ADVERSE_EVENT_SYNC_INTERVAL_IN_SE
import com.navi.common.utils.Constants.DEFAULT_ADVERSE_NETWORK_TIMEOUT
import com.navi.common.utils.Constants.DEFAULT_ADVERSE_RESPONSE_TTL_IN_SECS
import com.navi.common.utils.getSessionId
import com.navi.common.utils.log
import com.navi.common.utils.updateSessionId
import com.navi.pay.common.setup.NaviPayManager
import com.navi.payment.razorpay.RazorpayHelper
@@ -69,7 +69,12 @@ object NaviSDKHelper {
val currentProcess = getCurrentProcess(naviApplication)
if (currentProcess != naviApplication.packageName) {
if (Build.VERSION.SDK_INT >= Build.VERSION_CODES.P) {
WebView.setDataDirectorySuffix(Application.getProcessName())
try {
WebView.setDataDirectorySuffix(currentProcess)
} catch (e: Exception) {
val message = e.message + " for process: $currentProcess"
java.lang.Exception(message, e).log()
}
}
} else {
NaviTrackEvent.appInit(
@@ -233,7 +238,7 @@ object NaviSDKHelper {
)
}
private fun getCurrentProcess(context: Context): String? {
private fun getCurrentProcess(context: Context): String {
try {
val am = context.getSystemService(Context.ACTIVITY_SERVICE) as ActivityManager
val processInfos = am.runningAppProcesses ?: emptyList()
@@ -243,7 +248,9 @@ object NaviSDKHelper {
return info.processName
}
}
} catch (e: Exception) {}
return null
} catch (e: Exception) {
e.log()
}
return context.packageName
}
}