Skip to content

Conversation

@JohnsonEricAtSalesforce
Copy link
Contributor

@JohnsonEricAtSalesforce JohnsonEricAtSalesforce commented Jan 23, 2026

🎸 Ready For Review 🥁

This is the 13.2 counterpart for #2831

This resolves issues with the function of the singleServerCustomTabActivity property which was introduced in MSDK 13.0.0. The logic worked as intended at that time, but had regressed partially in 13.1.0 and fully in the pending 13.1.1 release.

The MSDK sample apps behave in exactly the same way with this update as they did in 13.1.0. Here's a video that demonstrates that in the REST Explorer sample app. Note that the activity timing in this sample app isn't perfect since this app is not built as the target app would be and defaults to the login view instead of an app activity.
Screen_recording_20260122_180115.webm

Also, this property now has detailed unit tests and high code coverage to prevent future regression.

@codecov
Copy link

codecov bot commented Jan 23, 2026

Codecov Report

✅ All modified and coverable lines are covered by tests.
✅ Project coverage is 62.61%. Comparing base (7c821ad) to head (46f8c83).
⚠️ Report is 4 commits behind head on dev.

Additional details and impacted files
@@             Coverage Diff              @@
##                dev    #2832      +/-   ##
============================================
- Coverage     62.64%   62.61%   -0.03%     
+ Complexity     2809     2803       -6     
============================================
  Files           216      216              
  Lines         16997    16982      -15     
  Branches       2414     2418       +4     
============================================
- Hits          10647    10633      -14     
+ Misses         5188     5187       -1     
  Partials       1162     1162              
Components Coverage Δ
Analytics 47.92% <ø> (ø)
SalesforceSDK 56.34% <100.00%> (-0.07%) ⬇️
Hybrid 59.05% <ø> (ø)
SmartStore 78.20% <ø> (ø)
MobileSync 81.68% <ø> (ø)
React 37.36% <ø> (ø)
Files with missing lines Coverage Δ
.../src/com/salesforce/androidsdk/ui/LoginActivity.kt 43.11% <100.00%> (-0.67%) ⬇️
...src/com/salesforce/androidsdk/ui/LoginViewModel.kt 89.74% <100.00%> (+0.16%) ⬆️

... and 1 file with indirect coverage changes

🚀 New features to boost your workflow:
  • ❄️ Test Analytics: Detect flaky tests, report on failures, and find test suite problems.
  • 📦 JS Bundle Analysis: Save yourself from yourself by tracking and limiting bundle sizes in JS merges.

@JohnsonEricAtSalesforce JohnsonEricAtSalesforce force-pushed the bugfix/w-21006714_singleservercustomtabactivity-is-malfunctioning_13.2 branch from 57d24ac to 2698993 Compare January 23, 2026 05:10
…implification And Unit Tests For 100% Patch Code Coverage)
@JohnsonEricAtSalesforce JohnsonEricAtSalesforce force-pushed the bugfix/w-21006714_singleservercustomtabactivity-is-malfunctioning_13.2 branch from 2698993 to 46f8c83 Compare January 23, 2026 19:11
) : Observer<String?> {
override fun onChanged(value: String?) {
if (!sdkManager.isBrowserLoginEnabled && !viewModel.isUsingFrontDoorBridge && value != null) {
if (!sdkManager.isBrowserLoginEnabled && !singleServerCustomTabActivity && !viewModel.isUsingFrontDoorBridge && value != null) {
Copy link
Contributor Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Part 1 is making sure loginUrl is not set when using singleServerCustomTabActivity since the web view will not be used.

) : Observer<String> {
override fun onChanged(value: String) {
if (sdkManager.isBrowserLoginEnabled && !viewModel.isUsingFrontDoorBridge) {
val useBrowserCustomTab = sdkManager.isBrowserLoginEnabled || singleServerCustomTabActivity
Copy link
Contributor Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Part 2 is making sure customBrowserTabUrl is set when using singleServerCustomTabActivity.

if (activity.viewModel.singleServerCustomTabActivity) {
// Show blank page and spinner until PKCE is done.
activity.viewModel.loginUrl.value = ABOUT_BLANK
finish()
Copy link
Contributor Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Part 3 is restoring the missing finish call in the activity result.

The repeated cycle of tapping back and returning to a brand new instance of LoginActivity which re-displays the browser custom tab is because when LoginActivity finishes without authenticating the default behavior of SalesforceActivity.onResume() is to detect there is no authenticated REST Client and restart LoginActivity. That's also what caused both 13.0.0 and now this version to briefly show a new LoginActivity while authentication is occurring in the custom tab.

The behavior here now matches 13.0.0 so I reckon it resolves the bug. Would we ever need this to behave better in an app that defaults to login?

Copy link
Contributor

@brandonpage brandonpage left a comment

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

LGTM. Thanks you for the tests!

@JohnsonEricAtSalesforce JohnsonEricAtSalesforce merged commit f303061 into forcedotcom:dev Jan 23, 2026
20 checks passed
@JohnsonEricAtSalesforce JohnsonEricAtSalesforce deleted the bugfix/w-21006714_singleservercustomtabactivity-is-malfunctioning_13.2 branch January 23, 2026 23:32
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

None yet

Projects

None yet

Development

Successfully merging this pull request may close these issues.

2 participants