Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Fix #6310: always use Safari UA for desktop #6468

Merged
merged 2 commits into from
Apr 27, 2020
Merged
Changes from 1 commit
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
14 changes: 3 additions & 11 deletions Shared/UserAgent.swift
Original file line number Diff line number Diff line change
Expand Up @@ -43,7 +43,7 @@ open class UserAgent {
}

public static func desktopUserAgent() -> String {
return UserAgentBuilder.defaultDesktopUserAgent().userAgent()
return "Mozilla/5.0 (Macintosh; Intel Mac OS X 10_15_4) AppleWebKit/605.1.15 (KHTML, like Gecko) Version/13.1 Safari/605.1.15"
}

public static func mobileUserAgent() -> String {
Expand All @@ -62,11 +62,7 @@ open class UserAgent {
public static func getUserAgent(domain: String, platform: UserAgentPlatform) -> String {
switch platform {
case .Desktop:
if let customUA = CustomUserAgentConstant.desktopUserAgent[domain] {
return customUA
} else {
return desktopUserAgent()
}
return desktopUserAgent()
case .Mobile:
if let customUA = CustomUserAgentConstant.mobileUserAgent[domain] {
return customUA
Expand Down Expand Up @@ -98,11 +94,7 @@ public struct CustomUserAgentConstant {
public static let mobileUserAgent = [
"paypal.com": defaultMobileUA,
"yahoo.com": defaultMobileUA ]
public static let desktopUserAgent = [
"paypal.com": customDesktopUA,
"yahoo.com": customDesktopUA,
"youtube.com": customDesktopUA,
"whatsapp.com": customDesktopUA ]

}

public struct UserAgentBuilder {
Expand Down