@@ -125,6 +125,7 @@ import com.salesforce.androidsdk.R.string.sf__ssl_unknown_error
125125import com.salesforce.androidsdk.R.string.sf__ssl_untrusted
126126import com.salesforce.androidsdk.accounts.UserAccount
127127import com.salesforce.androidsdk.app.Features.FEATURE_QR_CODE_LOGIN
128+ import com.salesforce.androidsdk.app.Features.FEATURE_WELCOME_DISCOVERY_LOGIN
128129import com.salesforce.androidsdk.app.SalesforceSDKManager
129130import com.salesforce.androidsdk.app.SalesforceSDKManager.Theme.DARK
130131import com.salesforce.androidsdk.auth.HttpAccess
@@ -901,6 +902,20 @@ open class LoginActivity : FragmentActivity() {
901902 */
902903 private fun applySalesforceWelcomeDiscoveryIntent (intent : Intent ) {
903904
905+ // Set welcome discovery feature flag if applicable
906+ if (isLoginWithWelcomeDiscovery(intent)) {
907+ SalesforceSDKManager .getInstance()
908+ .registerUsedAppFeature(FEATURE_WELCOME_DISCOVERY_LOGIN );
909+ }
910+ else {
911+ SalesforceSDKManager .getInstance().unregisterUsedAppFeature(
912+ FEATURE_WELCOME_DISCOVERY_LOGIN
913+ );
914+ }
915+
916+ // Re-apply user agent to WebView
917+ webView.settings.userAgentString = SalesforceSDKManager .getInstance().userAgent
918+
904919 // Apply the intent extras' Salesforce Welcome Login hint and host for use in the OAuth authorize URL, if applicable.
905920 applySalesforceWelcomeLoginHintAndHost(intent)
906921
@@ -929,6 +944,19 @@ open class LoginActivity : FragmentActivity() {
929944 }
930945 }
931946
947+ /* *
948+ * Returns true if intent is for a login with Welcome discovery
949+ * - either because the the login url is Welcome discovery (part 1 of the flow)
950+ * - there is a login hint (part 2 of the flow)
951+ *
952+ * @return true when the intent is for a login with Welcome discovery
953+ */
954+ private fun isLoginWithWelcomeDiscovery (intent : Intent ): Boolean {
955+ val isWelcomeDiscoveryUrl = intent.data?.let { isSalesforceWelcomeDiscoveryMobileUrl(it) } == true
956+ val hasLoginHint = intent.getStringExtra(EXTRA_KEY_LOGIN_HINT ) != null
957+ return isWelcomeDiscoveryUrl || hasLoginHint
958+ }
959+
932960 /* *
933961 * Creates a Salesforce Welcome Discovery mobile URL using the provided
934962 * Salesforce Welcome Discovery host and path URL.
0 commit comments