Skip to content

Commit

Permalink
Bitrise build 11846
Browse files Browse the repository at this point in the history
  • Loading branch information
Bitrise Buildbot committed Oct 29, 2024
1 parent 31c2d44 commit 24616b9
Show file tree
Hide file tree
Showing 6 changed files with 28 additions and 5 deletions.
2 changes: 1 addition & 1 deletion geotabdrivesdk/build.gradle.kts
Original file line number Diff line number Diff line change
@@ -1,6 +1,6 @@
import java.util.Properties

val versionName = "6.7.1_72672"
val versionName = "6.7.0_72846"

plugins {
id("com.android.library")
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -225,6 +225,10 @@ class DriveFragment :
activity?.let { WebViewModule(it, goBack) }
}

private val ssoModule: SSOModule by lazy {
SSOModule(this.parentFragmentManager, preference)
}

private val secureStorageModule: SecureStorageModule by lazy {
SecureStorageModule(requireContext())
}
Expand All @@ -248,7 +252,7 @@ class DriveFragment :
ioxUsbModule,
geolocationModule,
ioxbleModule,
context?.let { SSOModule(this.parentFragmentManager) },
ssoModule,
secureStorageModule
)
}
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -93,6 +93,10 @@ class MyGeotabFragment :
UserAgentUtil(requireContext())
}

private val ssoModule: SSOModule by lazy {
SSOModule(this.parentFragmentManager, preference)
}

private val cookieManager: CookieManager by lazy {
CookieManager.getInstance()
}
Expand All @@ -113,7 +117,7 @@ class MyGeotabFragment :
deviceModule,
context?.let { BrowserModule(this.parentFragmentManager, it) },
webViewModule,
context?.let { SSOModule(this.parentFragmentManager) }
ssoModule
)
}

Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -23,6 +23,7 @@ import com.geotab.mobile.sdk.BuildConfig
import com.geotab.mobile.sdk.Error
import com.geotab.mobile.sdk.R
import com.geotab.mobile.sdk.databinding.ActivityBrowserBinding
import com.geotab.mobile.sdk.logging.InternalAppLogging
import com.geotab.mobile.sdk.models.enums.GeotabDriveError
import com.geotab.mobile.sdk.module.Failure
import com.geotab.mobile.sdk.module.Result
Expand All @@ -42,6 +43,7 @@ class BrowserFragment : Fragment() {
var samlCallback: ((Result<Success<String>, Failure>) -> Unit)? = null
var url: String? = null
var script: String? = null
var isUserAgentKillSwitchOn = false
private var isCallbackCompleted = false

private val userAgentUtil: UserAgentUtil by lazy {
Expand All @@ -51,6 +53,7 @@ class BrowserFragment : Fragment() {
@Keep
companion object {
private const val ARG_URL = "url"
private const val TAG = "BrowserFragment"

/**
* Use this factory method to create a new instance of
Expand Down Expand Up @@ -123,7 +126,15 @@ class BrowserFragment : Fragment() {
domStorageEnabled = true
cacheMode = WebSettings.LOAD_DEFAULT
setSupportMultipleWindows(true)
userAgentString = userAgentUtil.getUserAgent(webView.settings.userAgentString)
userAgentString = if (isUserAgentKillSwitchOn) {
userAgentUtil.getUserAgent(webView.settings.userAgentString)
} else {
InternalAppLogging.appLogger?.error(
TAG,
"UserAgent: ${userAgentUtil.getUserAgent(webView.settings.userAgentString)}"
)
userAgentUtil.getUserAgent(webView.settings.userAgentString).replace("; wv", "")
}
setGeolocationEnabled(true)
}
}
Expand Down
Original file line number Diff line number Diff line change
@@ -1,5 +1,6 @@
package com.geotab.mobile.sdk.module.sso

import android.content.SharedPreferences
import androidx.fragment.app.FragmentManager
import com.geotab.mobile.sdk.module.Module
import kotlinx.coroutines.CoroutineScope
Expand All @@ -8,7 +9,8 @@ import java.util.concurrent.Executors
import kotlin.coroutines.CoroutineContext

class SSOModule(
fragmentManager: FragmentManager
fragmentManager: FragmentManager,
val preference: SharedPreferences?
) : Module(MODULE_NAME), CoroutineScope {

companion object {
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -50,6 +50,8 @@ class SamlLoginFunction(

browserFragment.script = moduleScripts
browserFragment.samlCallback = samlCallback
browserFragment.isUserAgentKillSwitchOn =
module.preference?.getBoolean("DRIVE.ANDROID_ONLY_USER_AGENT_KILL_SWITCH", false) ?: false
replaceFragment(browserFragment, BrowserModule.BROWSER_TAG, fragmentManager)
}
}
Expand Down

0 comments on commit 24616b9

Please sign in to comment.