Skip to content
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
1 change: 0 additions & 1 deletion libs/SalesforceSDK/res/values/strings.xml
Original file line number Diff line number Diff line change
Expand Up @@ -8,7 +8,6 @@
<string name="account_type">com.salesforce.androidsdk</string>
<string name="app_package">com.salesforce.androidsdk</string>
<string name="cannot_use_another_apps_login_qr_code">Cannot use another app\'s login QR Code. Please log in to this app.</string>
<string name="salesforce_welcome_is_disabled">This app doesn\'t support welcome.salesforce.com. Use another server.</string>

<!-- If you're only supporting recent versions of Android (e.g. 3.x and up), you can override this to be touch and get a better looking login UI -->
<string name="oauth_display_type">touch</string>
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -372,13 +372,6 @@ open class SalesforceSDKManager protected constructor(
@set:Synchronized
var useWebServerAuthentication = true


/**
* Whether or not the app supports welcome discovery. This should only be
* enabled if the connected app is supported.
*/
var supportsWelcomeDiscovery = false

/**
* Optionally, enables the hybrid authentication flow. Defaults to true
*/
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -111,7 +111,6 @@ import com.salesforce.androidsdk.R.color.sf__background_dark
import com.salesforce.androidsdk.R.color.sf__primary_color
import com.salesforce.androidsdk.R.drawable.sf__action_back
import com.salesforce.androidsdk.R.string.cannot_use_another_apps_login_qr_code
import com.salesforce.androidsdk.R.string.salesforce_welcome_is_disabled
import com.salesforce.androidsdk.R.string.sf__biometric_opt_in_title
import com.salesforce.androidsdk.R.string.sf__generic_authentication_error_title
import com.salesforce.androidsdk.R.string.sf__jwt_authentication_error
Expand Down Expand Up @@ -913,26 +912,6 @@ open class LoginActivity : FragmentActivity() {
}
}

/**
* Alerts the user if Salesforce Welcome Discovery is disabled.
* @param supportsWelcomeDiscovery Indicates if Salesforce Welcome Discovery
* is supported.
* @return Boolean true if the alert was displayed, false otherwise
*/
@VisibleForTesting
internal fun displayWelcomeUnsupportedToastIfNeeded(
supportsWelcomeDiscovery: Boolean
) = if (!supportsWelcomeDiscovery) {
runOnUiThread {
makeText(
this,
getString(salesforce_welcome_is_disabled),
LENGTH_LONG
).show()
}
true
} else false

/**
* Creates a Salesforce Welcome Discovery mobile URL using the provided
* Salesforce Welcome Discovery host and path URL.
Expand Down Expand Up @@ -1028,7 +1007,6 @@ open class LoginActivity : FragmentActivity() {
*/
private fun useSalesforceWelcomeDiscoveryMobileUrl(uri: Uri) {
if (isSalesforceWelcomeDiscoveryMobileUrl(uri)) {
displayWelcomeUnsupportedToastIfNeeded(SalesforceSDKManager.getInstance().supportsWelcomeDiscovery)
viewModel.loginUrl.postValue(uri.toString())
}
}
Expand Down Expand Up @@ -1470,11 +1448,6 @@ open class LoginActivity : FragmentActivity() {
if (!uri.isHierarchical) return false

val isDiscovery = isSalesforceWelcomeDiscoveryUrlPath(uri)
val discoveryEnabled = SalesforceSDKManager.getInstance().supportsWelcomeDiscovery

if (isDiscovery && !discoveryEnabled) {
w(TAG, "'${uri}' is a discovery domain, but welcome discovery isn't enabled.")
}

return isDiscovery && uri.queryParameterNames.contains(
SALESFORCE_WELCOME_DISCOVERY_MOBILE_URL_QUERY_PARAMETER_KEY_CLIENT_ID
Expand Down Expand Up @@ -1601,7 +1574,7 @@ open class LoginActivity : FragmentActivity() {
override fun onChanged(value: String) {
// Guard against observing a pending login server already provided by the intent data, such as a Salesforce Welcome Discovery mobile URL.
val pendingServerUri = value.toUri()
if (activity.intent.data?.host == pendingServerUri.host || activity.intent.getStringExtra(EXTRA_KEY_LOGIN_HOST) == pendingServerUri.host) {
if ((activity.intent.data?.host == pendingServerUri.host && activity.intent.data?.path == pendingServerUri.path) || activity.intent.getStringExtra(EXTRA_KEY_LOGIN_HOST) == pendingServerUri.host) {
activity.viewModel.previousPendingServer = value
return
}
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -516,7 +516,9 @@ open class LoginViewModel(val bootConfig: BootConfig) : ViewModel() {
) : Observer<String?> {
override fun onChanged(value: String?) {
if (!sdkManager.isBrowserLoginEnabled && !viewModel.isUsingFrontDoorBridge && value != null) {
val isNewServer = viewModel.loginUrl.value?.startsWith(value) != true
val valueUrl = value.toUri()
val loginUrl = viewModel.loginUrl.value?.toUri()
val isNewServer = loginUrl?.host != valueUrl.host || loginUrl?.path != valueUrl.path
if (isNewServer) {
scope.launch {
viewModel.loginUrl.value = viewModel.getAuthorizationUrl(value)
Expand Down
Original file line number Diff line number Diff line change
@@ -1,4 +1,4 @@
/*

Check failure on line 1 in libs/test/SalesforceSDKTest/src/com/salesforce/androidsdk/ui/LoginActivityTest.kt

View workflow job for this annotation

GitHub Actions / SalesforceSDK Test Results | api_35_test_result.xml

LoginActivityTest.viewModelIsUsingFrontDoorBridge_DefaultValue_onCreateWithoutQrCodeLoginIntent

FAILED
Raw output
FAILED
* Copyright (c) 2025-present, salesforce.com, inc.
* All rights reserved.
* Redistribution and use of this software in source and binary forms, with or
Expand Down Expand Up @@ -195,15 +195,8 @@

@Test
fun testIsWelcomeDiscoveryUri() {
val supportWelcomeDiscovery = SalesforceSDKManager.getInstance().supportsWelcomeDiscovery
SalesforceSDKManager.getInstance().supportsWelcomeDiscovery = false

val validUrl = "https://welcome.salesforce.com$SALESFORCE_WELCOME_DISCOVERY_URL_PATH?$SALESFORCE_WELCOME_DISCOVERY_MOBILE_URL_QUERY_PARAMETER_KEY_CLIENT_ID=X&$SALESFORCE_WELCOME_DISCOVERY_MOBILE_URL_QUERY_PARAMETER_KEY_CLIENT_VERSION=Y&$SALESFORCE_WELCOME_DISCOVERY_MOBILE_URL_QUERY_PARAMETER_KEY_CALLBACK_URL=Z"

assertTrue(isSalesforceWelcomeDiscoveryMobileUrl(validUrl.toUri()))

SalesforceSDKManager.getInstance().supportsWelcomeDiscovery = true

val nonHierarchicalUri = "mailto:test@example.com"

val incorrectPathUrl = "https://welcome.salesforce.com/other/path?$SALESFORCE_WELCOME_DISCOVERY_MOBILE_URL_QUERY_PARAMETER_KEY_CLIENT_ID=X&$SALESFORCE_WELCOME_DISCOVERY_MOBILE_URL_QUERY_PARAMETER_KEY_CLIENT_VERSION=Y&$SALESFORCE_WELCOME_DISCOVERY_MOBILE_URL_QUERY_PARAMETER_KEY_CALLBACK_URL=Z"
Expand Down Expand Up @@ -231,7 +224,5 @@
assertFalse("Missing callback URL parameter should return false", isSalesforceWelcomeDiscoveryMobileUrl(missingCallbackUrl.toUri()))

assertFalse("Non-welcome URL should return false", isSalesforceWelcomeDiscoveryMobileUrl(otherUrl.toUri()))

SalesforceSDKManager.getInstance().supportsWelcomeDiscovery = supportWelcomeDiscovery
}
}
Loading