Skip to content

Conversation

@wmathurin
Copy link
Contributor

@wmathurin wmathurin commented Nov 8, 2025

Matching the Android work: forcedotcom/SalesforceMobileSDK-Android#2801

Overview

  • Added a new button "Login Options" - only shown when on the login screen
  • "Login Options" brings up an action sheet to configure the auth flow (toggles for web server flow, hybrid flow and supports welcome discovery), use of the static bootconfig or a dynamic bootconfig
  • Also fixed dev info so it does not crash when invoked without a current user

Notes

  • the code for the new screen was refactored out of AuthFlowTester into SalesforceSDKCore
  • AuthFlowTester no longer does a "deferred" login
  • Toggle for "supports welcome discovery" is new in this PR

LoginOptions

@github-actions
Copy link

github-actions bot commented Nov 8, 2025

1 Warning
⚠️ Static Analysis found an issue with one or more files you modified. Please fix the issue(s).

Clang Static Analysis Issues

File Type Category Description Line Col
SFUserAccountManager Nullability Memory error Null passed to a callee that requires a non-null 2nd parameter 1552 15
SFUserAccountManager Nullability Memory error Null passed to a callee that requires a non-null 2nd parameter 1567 15
SFUserAccountManager Nullability Memory error nil passed to a callee that requires a non-null 2nd parameter 2199 13
SalesforceSDKManager Nil value used as mutex for @synchronized() (no synchronization will occur) Logic error Nil value used as mutex for @synchronized() (no synchronization will occur) 144 5
SalesforceSDKManager Nil value used as mutex for @synchronized() (no synchronization will occur) Logic error Nil value used as mutex for @synchronized() (no synchronization will occur) 156 5

Generated by 🚫 Danger

@codecov
Copy link

codecov bot commented Nov 8, 2025

Codecov Report

❌ Patch coverage is 87.71499% with 50 lines in your changes missing coverage. Please review.
✅ Project coverage is 63.55%. Comparing base (c3b9d38) to head (dfda66a).
⚠️ Report is 37 commits behind head on dev.

Files with missing lines Patch % Lines
...forceSDKCore/Classes/Common/SalesforceSDKManager.m 63.85% 30 Missing ⚠️
...eSDKCore/Classes/Views/DevInfoViewController.swift 92.52% 8 Missing ⚠️
...gin/DevConfig/BootConfigPickerViewController.swift 96.40% 5 Missing ⚠️
...lesforceSDKCore/Classes/OAuth/SFOAuthCoordinator.m 73.33% 4 Missing ⚠️
...SDKCore/Classes/UserAccount/SFUserAccountManager.m 93.54% 2 Missing ⚠️
...re/Classes/Login/DevConfig/AuthFlowTypesView.swift 90.90% 1 Missing ⚠️
Additional details and impacted files
@@            Coverage Diff             @@
##              dev    #3950      +/-   ##
==========================================
+ Coverage   62.57%   63.55%   +0.97%     
==========================================
  Files         249      252       +3     
  Lines       21715    22098     +383     
==========================================
+ Hits        13588    14044     +456     
+ Misses       8127     8054      -73     
Components Coverage Δ
Analytics 70.78% <ø> (ø)
Common 69.76% <ø> (-0.47%) ⬇️
Core 54.24% <87.68%> (+1.73%) ⬆️
SmartStore 74.59% <100.00%> (+0.59%) ⬆️
MobileSync 87.41% <ø> (ø)
Files with missing lines Coverage Δ
...ore/Classes/Login/DevConfig/BootConfigEditor.swift 51.47% <100.00%> (ø)
...Classes/Login/NativeLogin/NativeLoginManager.swift 42.85% <ø> (ø)
...Login/NativeLogin/NativeLoginManagerInternal.swift 27.70% <ø> (ø)
...Core/SalesforceSDKCore/Classes/OAuth/SFOAuthInfo.m 100.00% <100.00%> (+37.93%) ⬆️
...artStore/SmartStore/Classes/SmartStoreSDKManager.m 82.22% <100.00%> (+36.76%) ⬆️
...re/Classes/Login/DevConfig/AuthFlowTypesView.swift 89.65% <90.90%> (ø)
...SDKCore/Classes/UserAccount/SFUserAccountManager.m 36.28% <93.54%> (+0.59%) ⬆️
...lesforceSDKCore/Classes/OAuth/SFOAuthCoordinator.m 42.00% <73.33%> (+1.51%) ⬆️
...gin/DevConfig/BootConfigPickerViewController.swift 96.40% <96.40%> (ø)
...eSDKCore/Classes/Views/DevInfoViewController.swift 92.52% <92.52%> (ø)
... and 1 more

... and 7 files with indirect coverage changes

🚀 New features to boost your workflow:
  • ❄️ Test Analytics: Detect flaky tests, report on failures, and find test suite problems.

@wmathurin wmathurin marked this pull request as ready for review November 8, 2025 01:34
@wmathurin wmathurin marked this pull request as draft November 8, 2025 01:37

// Check if we're showing the login screen
BOOL isShowingLogin = [presentedViewController isKindOfClass:[SFLoginViewController class]] ||
[presentedViewController.presentingViewController isKindOfClass:[SFSDKAuthRootController class]];
Copy link
Contributor Author

Choose a reason for hiding this comment

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

Is there a cleaner way to do that?

Copy link
Member

Choose a reason for hiding this comment

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

Could potentially call isEnabled on the authWindow here, but from a different issue I've been wanting to add an autoCreate param to that method so that it doesn't always create the window if one doesn't already exist (could be separate work)

Copy link
Contributor Author

Choose a reason for hiding this comment

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

For now we could only support showing login options with regular login. So I would remove line 481.
For advanced auth, I'm missing the code to restart the auth flow once login options have been changed (see https://github.com/forcedotcom/SalesforceMobileSDK-iOS/pull/3950/files#diff-1334e2942ea2928b6db7bca76fdebd960b717bc0463c404244b998a86ee08121R497).

Copy link
Contributor Author

Choose a reason for hiding this comment

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

Done here: a21a187

@wmathurin
Copy link
Contributor Author

Also, I am not restarting the login flow so the new settings chosen in the action sheet won't be applied. I'll look at it on Monday.

@github-actions
Copy link

1 Warning
⚠️ Big PR, try to keep changes smaller if you can.

Generated by 🚫 Danger

Also info is grouped in sections for better readability
@wmathurin
Copy link
Contributor Author

I added more information in the dev infos part of the dev menu (see 2538b76).
Also I converted the code for the dev infos to Swift UI and made it an action sheet (see 4ba4d12) and it now has collapsible sections (see 796a518).

DevMenuWithSections

@wmathurin
Copy link
Contributor Author

Also, I am not restarting the login flow so the new settings chosen in the action sheet won't be applied. I'll look at it on Monday.

Done with 0330aa9

@wmathurin wmathurin marked this pull request as ready for review November 12, 2025 00:00
Comment on lines +480 to +481
// TODO uncomment to support advanced auth case (once we add code to restart auth in that case below)
// || [presentedViewController.presentingViewController isKindOfClass:[SFSDKAuthRootController class]];
Copy link
Contributor

Choose a reason for hiding this comment

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

Restarting Auth is included now, right?

Copy link
Contributor Author

Choose a reason for hiding this comment

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

Only if it's regular auth - for now I commented out the case it's advanced auth.

@brandonpage
Copy link
Contributor

@wmathurin Still reviewing, but isn't moving NativeLoginManager a SemVer issue?

@wmathurin
Copy link
Contributor Author

wmathurin commented Nov 14, 2025

@wmathurin Still reviewing, but isn't moving NativeLoginManager a SemVer issue?

I don't think so.
The grouping in the xcode project did not match the actual folders. I guess it does not have to.
So I just moved the files in the repo and made sure the group mapped to the folder.
There were also some test classes that were in the SalesforceSDKCore folder (but that might have been in the last PR).

}]];

// Login Options - only show on login screen
if (isShowingLogin) {
Copy link
Contributor

Choose a reason for hiding this comment

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

NIT: Is there a reason to only show it on the login screen?

Copy link
Contributor Author

Choose a reason for hiding this comment

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

It's only useful if you do a login right after - and if you do a login (let's say after a logout or when adding a new user), then you will get a chance to bring up the screen when the login screen is shown. So it feels like login is the right time to show the login options screen. The oauth settings should be inspectable through dev infos at any time though.

}

// Logout - only show if there's a current user and not on login screen
if (currentUser && !isShowingLogin) {
Copy link
Contributor

Choose a reason for hiding this comment

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

I was thinking about exactly this the other day. Android doesn't take deferred auth into account, I need to also check for a user.

@wmathurin
Copy link
Contributor Author

Last run, I was down to a single failure (one of DomainDiscoveryCoordinatorTests) - now it's back to 4.
I'll merge and work on stabilizing the flappers in seperate PRs.

@wmathurin wmathurin merged commit 61e2236 into forcedotcom:dev Nov 18, 2025
26 of 32 checks passed
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.

3 participants