mirror of
https://github.com/SideStore/SideStore.git
synced 2026-02-09 06:43:25 +01:00
Supports joining Patreon via web view + downloading app in single flow
Asks user to connect Patreon account if they are signed-in inside WebViewController but not in AltStore settings.
This commit is contained in:
@@ -293,7 +293,12 @@ public extension PatreonAPI
|
||||
|
||||
extension PatreonAPI
|
||||
{
|
||||
private func saveAuthCookies() async
|
||||
public var authCookies: [HTTPCookie] {
|
||||
let cookies = HTTPCookieStorage.shared.cookies(for: URL(string: "https://www.patreon.com")!) ?? []
|
||||
return cookies
|
||||
}
|
||||
|
||||
public func saveAuthCookies() async
|
||||
{
|
||||
let cookieStore = await MainActor.run { WKWebsiteDataStore.default().httpCookieStore } // Must access from main actor
|
||||
|
||||
@@ -311,22 +316,15 @@ extension PatreonAPI
|
||||
|
||||
let cookieStore = await MainActor.run { WKWebsiteDataStore.default().httpCookieStore } // Must access from main actor
|
||||
|
||||
if let cookies = HTTPCookieStorage.shared.cookies(for: URL(string: "https://www.patreon.com")!)
|
||||
for cookie in self.authCookies
|
||||
{
|
||||
for cookie in cookies
|
||||
{
|
||||
Logger.main.debug("Deleting Patreon cookie \(cookie.name, privacy: .public) (Expires: \(cookie.expiresDate?.description ?? "nil", privacy: .public))")
|
||||
|
||||
await cookieStore.deleteCookie(cookie)
|
||||
HTTPCookieStorage.shared.deleteCookie(cookie)
|
||||
}
|
||||
Logger.main.debug("Deleting Patreon cookie \(cookie.name, privacy: .public) (Expires: \(cookie.expiresDate?.description ?? "nil", privacy: .public))")
|
||||
|
||||
Logger.main.info("Cleared Patreon cookie cache!")
|
||||
}
|
||||
else
|
||||
{
|
||||
Logger.main.info("No Patreon cookies to clear.")
|
||||
await cookieStore.deleteCookie(cookie)
|
||||
HTTPCookieStorage.shared.deleteCookie(cookie)
|
||||
}
|
||||
|
||||
Logger.main.info("Cleared Patreon cookie cache!")
|
||||
}
|
||||
}
|
||||
|
||||
|
||||
Reference in New Issue
Block a user