Skip to content

Add Clear Caches menu item to login view - #2752

Merged
wmathurin merged 2 commits into
forcedotcom:devfrom
wmathurin:clearcache
Sep 5, 2025
Merged

Add Clear Caches menu item to login view#2752
wmathurin merged 2 commits into
forcedotcom:devfrom
wmathurin:clearcache

Conversation

@wmathurin

Copy link
Copy Markdown
Contributor
  • Add sf__clear_caches string resource
  • Implement clearCaches method using webView.clearCache(true)
  • Add Clear Caches menu item to login dropdown
  • Add unit and UI tests for new functionality

- Add sf__clear_caches string resource
- Implement clearCaches method using webView.clearCache(true)
- Add Clear Caches menu item to login dropdown
- Add unit and UI tests for new functionality
@codecov

codecov Bot commented Aug 29, 2025

Copy link
Copy Markdown

Codecov Report

❌ Patch coverage is 29.41176% with 12 lines in your changes missing coverage. Please review.
✅ Project coverage is 56.05%. Comparing base (a99d2c9) to head (4e9b74a).
⚠️ Report is 5 commits behind head on dev.

Files with missing lines Patch % Lines
...m/salesforce/androidsdk/ui/components/LoginView.kt 33.33% 10 Missing ⚠️
...src/com/salesforce/androidsdk/ui/LoginViewModel.kt 0.00% 2 Missing ⚠️

❌ Your patch check has failed because the patch coverage (29.41%) is below the target coverage (80.00%). You can increase the patch coverage or adjust the target coverage.

Additional details and impacted files
@@             Coverage Diff              @@
##                dev    #2752      +/-   ##
============================================
- Coverage     56.11%   56.05%   -0.07%     
+ Complexity     2488     2486       -2     
============================================
  Files           211      211              
  Lines         17239    17256      +17     
  Branches       2408     2408              
============================================
- Hits           9673     9672       -1     
- Misses         6518     6535      +17     
- Partials       1048     1049       +1     
Components Coverage Δ
Analytics 47.92% <ø> (ø)
SalesforceSDK 43.74% <29.41%> (-0.10%) ⬇️
Hybrid 58.05% <ø> (ø)
SmartStore 78.20% <ø> (ø)
MobileSync 79.23% <ø> (ø)
React 46.94% <ø> (ø)
Files with missing lines Coverage Δ
...src/com/salesforce/androidsdk/ui/LoginViewModel.kt 60.40% <0.00%> (-0.83%) ⬇️
...m/salesforce/androidsdk/ui/components/LoginView.kt 37.03% <33.33%> (-0.58%) ⬇️

... and 2 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.

/** Clear WebView Caches. */
open fun clearCaches(webView: android.webkit.WebView) {
webView.clearCache(true)
}

@brandonpage brandonpage Aug 29, 2025

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.

Do we want to also reload after clearing cache? I believe we do that when we clear cookies.

Should be noted that reloading will cycle the web server code verifier but I don't think that will matter.

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.

The caller does the reload, see https://github.com/forcedotcom/SalesforceMobileSDK-Android/pull/2752/files#diff-321c03965ac0663f16817520073fbe2d6def698c5568ab388f1161c35536d069R303

NB: it's the same with clearCookies.

    open fun clearCookies() =
        CookieManager.getInstance().removeAllCookies(null)

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.

Whoops, I missed that. Great!

Renaming methods accordingly
Fixed test
@wmathurin
wmathurin merged commit 07fe0e4 into forcedotcom:dev Sep 5, 2025
5 of 8 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.

2 participants