Skip to content

Comments

@W-20798759: [MSDK] Add ability to programmatically update servers list#2841

Merged
JohnsonEricAtSalesforce merged 2 commits intoforcedotcom:devfrom
JohnsonEricAtSalesforce:feature/w-20798759_msdk-add-ability-to-programmatically-update-servers-list
Feb 19, 2026
Merged

@W-20798759: [MSDK] Add ability to programmatically update servers list#2841
JohnsonEricAtSalesforce merged 2 commits intoforcedotcom:devfrom
JohnsonEricAtSalesforce:feature/w-20798759_msdk-add-ability-to-programmatically-update-servers-list

Conversation

@JohnsonEricAtSalesforce
Copy link
Contributor

@JohnsonEricAtSalesforce JohnsonEricAtSalesforce commented Feb 17, 2026

🎸 Ready For Review 🥁

This adds two new methods to the login server manager: Replace and re-order login server. For 13.2 point release, this only adds behavior and maintains API compatibility. To that end, this keeps this source in Java for now and attempts to follow the style of the existing code.

There are new unit tests to validate and cover the new methods. Also, here's a video where I added a few menu options to test interactively. Note in the video how the index of the updated login server is corrected when needed so it does not exceed the last index or precede the non-custom login servers which have higher priority and are immutable. The video doesn't show it, but the reset action also included all the negative tests that are present in the unit tests.

@JohnsonEricAtSalesforce JohnsonEricAtSalesforce force-pushed the feature/w-20798759_msdk-add-ability-to-programmatically-update-servers-list branch 4 times, most recently from 2d4444f to c9fad55 Compare February 17, 2026 19:37
* it is not it will be automatically corrected
*/
@SuppressWarnings("unused")
public void reorderCustomLoginServer(
Copy link
Contributor Author

Choose a reason for hiding this comment

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

The documentation comment should provide adequate guidance, particularly where the boundary of non-custom and custom login server indexes is guarded.

Copy link
Contributor

@brandonpage brandonpage Feb 19, 2026

Choose a reason for hiding this comment

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

Is this the interface they wanted? I was envisioning something like:
public void reorderLoginServers(List<LoginServer> reorderedList)

Where they just gave us the list of servers in the order they wanted.

Copy link
Contributor

Choose a reason for hiding this comment

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

And this only reorders custom login servers. Is that what they want?

loginServers.remove(originalIndex);
loginServers.add(updatedIndex, originalLoginServer);

// Edit each login server indexed after the updated index.
Copy link
Contributor Author

Choose a reason for hiding this comment

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

This "re-indexing" logic is very similar to what's already in remove login server.

@JohnsonEricAtSalesforce JohnsonEricAtSalesforce force-pushed the feature/w-20798759_msdk-add-ability-to-programmatically-update-servers-list branch from c9fad55 to a3f81a9 Compare February 17, 2026 19:41
* login server this method will do nothing.
*/
@SuppressWarnings("unused")
public void replaceCustomLoginServer(
Copy link
Contributor Author

Choose a reason for hiding this comment

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

The documentation comment here should guide callers around legal parameters.

Copy link
Contributor

Choose a reason for hiding this comment

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

Is it not possible to add an update(name, url) method to LoginServer itself?

@JohnsonEricAtSalesforce JohnsonEricAtSalesforce marked this pull request as ready for review February 17, 2026 19:51
@JohnsonEricAtSalesforce
Copy link
Contributor Author

Note the checks haven't run tests or code coverage, so there might be a little more work to do. That said, this ought to be really close to the mark.

@JohnsonEricAtSalesforce JohnsonEricAtSalesforce force-pushed the feature/w-20798759_msdk-add-ability-to-programmatically-update-servers-list branch from a3f81a9 to ed5c8e9 Compare February 17, 2026 21:36
@JohnsonEricAtSalesforce JohnsonEricAtSalesforce force-pushed the feature/w-20798759_msdk-add-ability-to-programmatically-update-servers-list branch from ed5c8e9 to 0762987 Compare February 17, 2026 22:27
@github-actions
Copy link

github-actions bot commented Feb 17, 2026

1 Warning
⚠️ libs/SalesforceSDK/src/com/salesforce/androidsdk/config/LoginServerManager.java#L439 - Use of this function is discouraged because resource reflection makes it harder to perform build optimizations and compile-time verification of code. It is much more efficient to retrieve resources by identifier (e.g. R.foo.bar) than by name (e.g. getIdentifier("bar", "foo", null)).

Generated by 🚫 Danger

@codecov
Copy link

codecov bot commented Feb 17, 2026

Codecov Report

✅ All modified and coverable lines are covered by tests.
✅ Project coverage is 64.63%. Comparing base (999ba74) to head (3e8734b).
⚠️ Report is 6 commits behind head on dev.

Additional details and impacted files
@@             Coverage Diff              @@
##                dev    #2841      +/-   ##
============================================
+ Coverage     63.30%   64.63%   +1.32%     
- Complexity     2836     2928      +92     
============================================
  Files           216      222       +6     
  Lines         16996    17323     +327     
  Branches       2420     2471      +51     
============================================
+ Hits          10760    11196     +436     
+ Misses         5069     4924     -145     
- Partials       1167     1203      +36     
Components Coverage Δ
Analytics 47.92% <ø> (ø)
SalesforceSDK 59.18% <89.97%> (+2.71%) ⬆️
Hybrid 59.05% <ø> (ø)
SmartStore 78.20% <ø> (ø)
MobileSync 81.68% <ø> (ø)
React 52.36% <ø> (ø)
Files with missing lines Coverage Δ
...lesforce/androidsdk/config/LoginServerManager.java 75.10% <100.00%> (+4.40%) ⬆️

... and 8 files 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 feature/w-20798759_msdk-add-ability-to-programmatically-update-servers-list branch 2 times, most recently from 3e5215a to 0487f07 Compare February 18, 2026 18:28
@JohnsonEricAtSalesforce JohnsonEricAtSalesforce force-pushed the feature/w-20798759_msdk-add-ability-to-programmatically-update-servers-list branch from 0487f07 to 3e8734b Compare February 18, 2026 20:25
@JohnsonEricAtSalesforce
Copy link
Contributor Author

@wmathurin, I did make a few minor logic updates to preemptively fix bugs as I increased code coverage.

@JohnsonEricAtSalesforce JohnsonEricAtSalesforce merged commit 8c57824 into forcedotcom:dev Feb 19, 2026
20 checks passed
@JohnsonEricAtSalesforce JohnsonEricAtSalesforce deleted the feature/w-20798759_msdk-add-ability-to-programmatically-update-servers-list branch February 19, 2026 18:49
LoginServer server = new LoginServer(name, url, isCustom);

// Only notify livedata consumers if the value has changed.
// Only notify live data consumers if the value has changed.
Copy link
Contributor

Choose a reason for hiding this comment

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

NIT: I think LiveData is probably the most correct. Google never writes it as two words.

* it is not it will be automatically corrected
*/
@SuppressWarnings("unused")
public void reorderCustomLoginServer(
Copy link
Contributor

@brandonpage brandonpage Feb 19, 2026

Choose a reason for hiding this comment

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

Is this the interface they wanted? I was envisioning something like:
public void reorderLoginServers(List<LoginServer> reorderedList)

Where they just gave us the list of servers in the order they wanted.

* it is not it will be automatically corrected
*/
@SuppressWarnings("unused")
public void reorderCustomLoginServer(
Copy link
Contributor

Choose a reason for hiding this comment

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

And this only reorders custom login servers. Is that what they want?

* login server this method will do nothing.
*/
@SuppressWarnings("unused")
public void replaceCustomLoginServer(
Copy link
Contributor

Choose a reason for hiding this comment

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

Is it not possible to add an update(name, url) method to LoginServer itself?

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