Skip to content

Commit c3b9d38

Browse files
authored
Merge pull request forcedotcom#3948 from bbirman/settings-follow-up
Fixes for settings menu
2 parents ecb52c4 + 71acdb5 commit c3b9d38

File tree

3 files changed

+7
-39
lines changed

3 files changed

+7
-39
lines changed

libs/SalesforceSDKCore/SalesforceSDKCore/Classes/Login/LoginHost/SFSDKLoginHostStorage.m

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -107,7 +107,7 @@ - (id)init {
107107
*/
108108
if (![self loginHostForHostAddress:customHost]) {
109109
[self.loginHostList removeAllObjects];
110-
if ([SFUserAccountManager sharedInstance].loginViewControllerConfig.showSettingsIcon) {
110+
if ([SFUserAccountManager sharedInstance].loginViewControllerConfig.showSettingsIcon && [SFUserAccountManager sharedInstance].loginViewControllerConfig.showServerPicker) {
111111
[self.loginHostList addObject:production];
112112
[self.loginHostList addObject:sandbox];
113113
}

libs/SalesforceSDKCore/SalesforceSDKCore/Classes/UserAccount/SFUserAccountManager.m

Lines changed: 6 additions & 4 deletions
Original file line numberDiff line numberDiff line change
@@ -1055,13 +1055,15 @@ - (void)loginViewController:(SFLoginViewController *)loginViewController didChan
10551055
}
10561056

10571057
- (void)loginViewControllerDidClearCache:(SFLoginViewController *)loginViewController {
1058-
[SFSDKWebViewStateManager clearCacheWithCompletionHandler:^{}];
1059-
[self restartAuthenticationForViewController:loginViewController];
1058+
[SFSDKWebViewStateManager clearCacheWithCompletionHandler:^{
1059+
[self restartAuthenticationForViewController:loginViewController];
1060+
}];
10601061
}
10611062

10621063
- (void)loginViewControllerDidClearCookies:(SFLoginViewController *)loginViewController {
1063-
[SFSDKWebViewStateManager removeSessionForcefullyWithCompletionHandler:^{}];
1064-
[self restartAuthenticationForViewController:loginViewController];
1064+
[SFSDKWebViewStateManager removeSessionForcefullyWithCompletionHandler:^{
1065+
[self restartAuthenticationForViewController:loginViewController];
1066+
}];
10651067
}
10661068

10671069
- (void)loginViewControllerDidReload:(SFLoginViewController *)loginViewController {

libs/SalesforceSDKCore/SalesforceSDKCoreTests/WebViewStateManagerTests.swift

Lines changed: 0 additions & 34 deletions
Original file line numberDiff line numberDiff line change
@@ -35,38 +35,4 @@ final class WebViewStateManagerTests: XCTestCase {
3535
SFSDKWebViewStateManager.sessionCookieManagementDisabled = false
3636
XCTAssertFalse(SFSDKWebViewStateManager.sessionCookieManagementDisabled)
3737
}
38-
39-
@MainActor
40-
func testClearCache() async throws {
41-
// Add some test data
42-
let html = "<html><body><script>localStorage.setItem('test', 'value');</script></body></html>"
43-
let webView = WKWebView(frame: CGRect(x: 0, y: 0, width: 100, height: 100), configuration: WKWebViewConfiguration())
44-
45-
// Load HTML and wait for JavaScript to execute
46-
webView.loadHTMLString(html, baseURL: URL(string: "https://test.salesforce.com"))
47-
try await Task.sleep(for: .seconds(1))
48-
49-
// Define data types to check
50-
let dataTypes: Set<String> = [WKWebsiteDataTypeDiskCache,
51-
WKWebsiteDataTypeMemoryCache,
52-
WKWebsiteDataTypeFetchCache,
53-
WKWebsiteDataTypeLocalStorage,
54-
WKWebsiteDataTypeSessionStorage,
55-
WKWebsiteDataTypeIndexedDBDatabases,
56-
WKWebsiteDataTypeWebSQLDatabases,
57-
WKWebsiteDataTypeOfflineWebApplicationCache,
58-
WKWebsiteDataTypeServiceWorkerRegistrations]
59-
60-
let dataStore = WKWebsiteDataStore.default()
61-
// Verify data exists before clearing
62-
let initialRecords = await dataStore.dataRecords(ofTypes: dataTypes)
63-
XCTAssertFalse(initialRecords.isEmpty, "Expected data to exist before clearing")
64-
65-
// Clear the cache
66-
await SFSDKWebViewStateManager.clearCache()
67-
68-
// Verify data was cleared
69-
let records = await dataStore.dataRecords(ofTypes: dataTypes)
70-
XCTAssertTrue(records.isEmpty, "Expected data to be cleared")
71-
}
7238
}

0 commit comments

Comments
 (0)