Skip to content
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
Original file line number Diff line number Diff line change
Expand Up @@ -107,7 +107,7 @@ - (id)init {
*/
if (![self loginHostForHostAddress:customHost]) {
[self.loginHostList removeAllObjects];
if ([SFUserAccountManager sharedInstance].loginViewControllerConfig.showSettingsIcon) {
if ([SFUserAccountManager sharedInstance].loginViewControllerConfig.showSettingsIcon && [SFUserAccountManager sharedInstance].loginViewControllerConfig.showServerPicker) {
[self.loginHostList addObject:production];
[self.loginHostList addObject:sandbox];
}
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -1048,13 +1048,15 @@ - (void)loginViewController:(SFLoginViewController *)loginViewController didChan
}

- (void)loginViewControllerDidClearCache:(SFLoginViewController *)loginViewController {
[SFSDKWebViewStateManager clearCacheWithCompletionHandler:^{}];
[self restartAuthenticationForViewController:loginViewController];
[SFSDKWebViewStateManager clearCacheWithCompletionHandler:^{
[self restartAuthenticationForViewController:loginViewController];
}];
}

- (void)loginViewControllerDidClearCookies:(SFLoginViewController *)loginViewController {
[SFSDKWebViewStateManager removeSessionForcefullyWithCompletionHandler:^{}];
[self restartAuthenticationForViewController:loginViewController];
[SFSDKWebViewStateManager removeSessionForcefullyWithCompletionHandler:^{
[self restartAuthenticationForViewController:loginViewController];
}];
}

- (void)loginViewControllerDidReload:(SFLoginViewController *)loginViewController {
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -16,7 +16,7 @@
@MainActor
func testProcessPoolIsNil() {
// TODO remove this test in 14.0 when we remove sharedProcessPool from SFSDKWebViewStateManager
XCTAssertNil(SFSDKWebViewStateManager.sharedProcessPool)

Check warning on line 19 in libs/SalesforceSDKCore/SalesforceSDKCoreTests/WebViewStateManagerTests.swift

View workflow job for this annotation

GitHub Actions / ios-pr (SalesforceSDKCore, ^18) / test-ios

'sharedProcessPool' is deprecated: Deprecated in Salesforce Mobile SDK 13.2 and will be removed in Salesforce Mobile SDK 14.0. WKProcessPool creation has no effect on iOS 15+ and this property will be removed.
}

@MainActor
Expand All @@ -35,38 +35,4 @@
SFSDKWebViewStateManager.sessionCookieManagementDisabled = false
XCTAssertFalse(SFSDKWebViewStateManager.sessionCookieManagementDisabled)
}

@MainActor
func testClearCache() async throws {
// Add some test data
let html = "<html><body><script>localStorage.setItem('test', 'value');</script></body></html>"
let webView = WKWebView(frame: CGRect(x: 0, y: 0, width: 100, height: 100), configuration: WKWebViewConfiguration())

// Load HTML and wait for JavaScript to execute
webView.loadHTMLString(html, baseURL: URL(string: "https://test.salesforce.com"))
try await Task.sleep(for: .seconds(1))

// Define data types to check
let dataTypes: Set<String> = [WKWebsiteDataTypeDiskCache,
WKWebsiteDataTypeMemoryCache,
WKWebsiteDataTypeFetchCache,
WKWebsiteDataTypeLocalStorage,
WKWebsiteDataTypeSessionStorage,
WKWebsiteDataTypeIndexedDBDatabases,
WKWebsiteDataTypeWebSQLDatabases,
WKWebsiteDataTypeOfflineWebApplicationCache,
WKWebsiteDataTypeServiceWorkerRegistrations]

let dataStore = WKWebsiteDataStore.default()
// Verify data exists before clearing
let initialRecords = await dataStore.dataRecords(ofTypes: dataTypes)
XCTAssertFalse(initialRecords.isEmpty, "Expected data to exist before clearing")

// Clear the cache
await SFSDKWebViewStateManager.clearCache()

// Verify data was cleared
let records = await dataStore.dataRecords(ofTypes: dataTypes)
XCTAssertTrue(records.isEmpty, "Expected data to be cleared")
}
}
Loading