Skip to content

Commit

Permalink
add params to url
Browse files Browse the repository at this point in the history
  • Loading branch information
ahmedshortcut committed Mar 9, 2022
1 parent eb1f7ac commit f4c2706
Showing 1 changed file with 9 additions and 20 deletions.
Original file line number Diff line number Diff line change
Expand Up @@ -15,30 +15,19 @@ internal class TrustedWebHandler(
) {

fun open() {
val uri = Uri.parse(twaUrl)
val urLBuilder= uri
.buildUpon()
getTWAParams(context).let { map ->
for ((key, value) in map) {
urLBuilder.appendQueryParameter(key,value.toString())
}
if (twaUrl.isEmpty()){
throw RuntimeException("you should set twa url first in analytics instance")
}
urLBuilder.build()
val builder = TrustedWebActivityIntentBuilder(uri)
val uri = Uri.parse(twaUrl).buildUpon()
.appendQueryParameter("sifo_config","trackPanelistOnly=$trackPanelistOnly")
.appendQueryParameter("isWebViewBased",isWebViewBased.toString())
.appendQueryParameter("sdkVersion",BuildConfig.VERSION_NAME)
.appendQueryParameter("appVersion", context.getApplicationVersion())
.appendQueryParameter("domain",TagStringsAndValues.DOMAIN_CODIGO)
.build()
val launcher = TwaLauncher(context)
launcher.launch(uri)
}


private fun getTWAParams(context: Context): Map<String, Any> {
return mapOf<String, Any>().apply {
"sifo_config" to "trackPanelistOnly=$trackPanelistOnly"
"isWebViewBased" to isWebViewBased
"sdkVersion" to BuildConfig.VERSION_NAME
"appVersion" to context.getApplicationVersion()
"domain" to TagStringsAndValues.DOMAIN_CODIGO
}
}

}

0 comments on commit f4c2706

Please sign in to comment.