Skip to content

Add public API to trigger Login for Admin flow.#4026

Merged
brandonpage merged 2 commits intoforcedotcom:devfrom
brandonpage:login-for-admin-public-api
May 5, 2026
Merged

Add public API to trigger Login for Admin flow.#4026
brandonpage merged 2 commits intoforcedotcom:devfrom
brandonpage:login-for-admin-public-api

Conversation

@brandonpage
Copy link
Copy Markdown
Contributor

No description provided.

@github-actions
Copy link
Copy Markdown

github-actions Bot commented May 1, 2026

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 1579 15
SFUserAccountManager Nullability Memory error Null passed to a callee that requires a non-null 2nd parameter 1594 15
SFUserAccountManager Nullability Memory error nil passed to a callee that requires a non-null 2nd parameter 2229 13

Generated by 🚫 Danger

@github-actions
Copy link
Copy Markdown

github-actions Bot commented May 1, 2026

TestsPassed ☑️SkippedFailed ❌️
SalesforceSDKCore iOS ^26 Test Results625 ran624 ✅1 ❌
TestResult
SalesforceSDKCore iOS ^26 Test Results
testNonCallbackURL()❌ failure

@codecov
Copy link
Copy Markdown

codecov Bot commented May 1, 2026

Codecov Report

✅ All modified and coverable lines are covered by tests.
✅ Project coverage is 66.48%. Comparing base (e1b9698) to head (cd15628).

Additional details and impacted files
@@            Coverage Diff             @@
##              dev    #4026      +/-   ##
==========================================
+ Coverage   65.64%   66.48%   +0.83%     
==========================================
  Files         245      245              
  Lines       21449    21449              
==========================================
+ Hits        14081    14261     +180     
+ Misses       7368     7188     -180     
Components Coverage Δ
Analytics 70.78% <ø> (ø)
Common 70.69% <ø> (ø)
Core 58.99% <ø> (+1.30%) ⬆️
SmartStore 73.44% <ø> (ø)
MobileSync 88.79% <ø> (ø)
see 9 files with indirect coverage changes
🚀 New features to boost your workflow:
  • ❄️ Test Analytics: Detect flaky tests, report on failures, and find test suite problems.

@github-actions
Copy link
Copy Markdown

github-actions Bot commented May 1, 2026

TestsPassed ✅SkippedFailed
SalesforceSDKCore iOS ^18 Test Results625 ran625 ✅
TestResult
No test annotations available

@github-actions
Copy link
Copy Markdown

github-actions Bot commented May 1, 2026

TestsPassedSkippedFailed ❌️
AuthFlowTester UI Test Results all1 ran1 ❌
TestResult
AuthFlowTester UI Test Results all
AuthFlowTesterUITests.xctest
LegacyLoginTests.testCAOpaque_DefaultScopes_WebServerFlow()❌ failure

@param loginViewController The login view controller whose scene's active auth session should
switch to "Login for Admin". Its window's scene is used to locate the session.
*/
- (void)loginViewControllerDidSelectLoginForAdmin:(SFLoginViewController *)loginViewController NS_SWIFT_NAME(loginViewControllerDidSelectLoginForAdmin(_:)) SFSDK_DEPRECATED(13.2.1, 14.0, "Will be removed in 14.0 when a permanent solution if provided.");
Copy link
Copy Markdown
Contributor

Choose a reason for hiding this comment

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

Typo: "when a permanent solution if provided" should be "when a permanent solution is provided"

@param loginViewController The login view controller whose scene's active auth session should
switch to "Login for Admin". Its window's scene is used to locate the session.
*/
- (void)loginViewControllerDidSelectLoginForAdmin:(SFLoginViewController *)loginViewController NS_SWIFT_NAME(loginViewControllerDidSelectLoginForAdmin(_:)) SFSDK_DEPRECATED(13.2.1, 14.0, "Will be removed in 14.0 when a permanent solution if provided.");
Copy link
Copy Markdown
Member

Choose a reason for hiding this comment

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

Where would the app get the reference to the login view controller from? the window?

Copy link
Copy Markdown
Contributor Author

@brandonpage brandonpage May 4, 2026

Choose a reason for hiding this comment

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

@bbirman Good callout. As I see it they have two options:

  1. Retain a reference from UserAccountManager.shared.loginViewControllerConfig.loginViewControllerCreationBlock.
  2. Walk the view hierarchy.

I assume option 1 is preferred? Should I add that to the comment?

Copy link
Copy Markdown
Member

@bbirman bbirman May 4, 2026

Choose a reason for hiding this comment

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

Were you able to test with option 1? I think the reference would be to the block, not the view controller created by the block?

Otherwise I was wondering if option 2 could use SFSDKWindowManager's authWindow's topViewController, or if there's a way to get around the app providing the reference, but do we know if anyone is hiding the settings icon? Might not be worth it to invest more if not

Copy link
Copy Markdown
Contributor Author

Choose a reason for hiding this comment

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

I was thinking something like this:

UserAccountManager.shared.loginViewControllerConfig.loginViewControllerCreationBlock = { [weak self] in
  let vc = SalesforceLoginViewController()
  self?.currentLoginVC = vc   // retain weakly for later
  return vc
}

Copy link
Copy Markdown
Member

Choose a reason for hiding this comment

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

ah gotchya! no preference for me, whatever you think looks cleanest

@brandonpage brandonpage merged commit 5bef69b into forcedotcom:dev May 5, 2026
32 of 42 checks passed
brandonpage added a commit that referenced this pull request May 5, 2026
* Add public API to trigger Login for Admin flow.

* Improve code documentation for loginViewControllerDidSelectLoginForAdmin.
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