-
Notifications
You must be signed in to change notification settings - Fork 10
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
- Loading branch information
1 parent
89d6984
commit c29b19d
Showing
10 changed files
with
149 additions
and
26 deletions.
There are no files selected for viewing
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,73 @@ | ||
// | ||
// Edge.swift | ||
// UserAgency | ||
// | ||
// Created by Terry Huang on 2020/12/27. | ||
// | ||
|
||
import Foundation | ||
|
||
public class Edge: UserApp { | ||
weak var userDevice: UserDevice? | ||
|
||
var layoutEngine_iOS = "605.1.15" | ||
var version_iOS = "14.0" | ||
var build_iOS = "15E148" | ||
|
||
var softwareVersion_Chrome = "87.0.4280.101" | ||
|
||
var layoutEngine = "537.36" | ||
var softwareVersion = "45.12.24.5121" | ||
|
||
/* | ||
// iPhone / iPad | ||
AppleWebKit/{$layoutEngine_iOS} (KHTML, like Gecko) Version/{$version_iOS} EdgiOS/{$softwareVersion} Mobile/{$build_iOS} Safari/{$layoutEngine_iOS} | ||
// Android Phone / Tablet | ||
AppleWebKit/{$layoutEngine} (KHTML, like Gecko) Chrome/{$softwareVersion_Chrome} Mobile Safari/{$layoutEngine_iOS} EdgA/{$softwareVersion} | ||
// Mac / WindowsPC | ||
AppleWebKit/{$layoutEngine} (KHTML, like Gecko) Chrome/{$softwareVersion_Chrome} Safari/{$layoutEngine} Edg/{$softwareVersion_Chrome} | ||
*/ | ||
|
||
public init() { | ||
} | ||
|
||
public func setUserDevice(_ device: UserDevice?) { | ||
userDevice = device | ||
} | ||
|
||
public func getResultSystemInformation() -> String { | ||
return "" | ||
} | ||
|
||
public func getResultPlatform() -> String { | ||
if userDevice == nil { | ||
return "" | ||
} | ||
|
||
if userDevice is iPhone | ||
|| userDevice is iPad { | ||
return String(format: "AppleWebKit/%@ (KHTML, like Gecko) Version/%@ EdgiOS/%@ Mobile/%@ Safari/%@", | ||
arguments: [layoutEngine_iOS, | ||
version_iOS, | ||
softwareVersion, | ||
build_iOS, | ||
layoutEngine_iOS]) | ||
} | ||
|
||
if userDevice is Mac | ||
|| userDevice is WindowsPC { | ||
return String(format: "AppleWebKit/%@ (KHTML, like Gecko) Chrome/%@ Safari/%@ Edg/%@", | ||
arguments: [layoutEngine, | ||
softwareVersion_Chrome, | ||
layoutEngine, | ||
softwareVersion_Chrome]) | ||
} | ||
|
||
return String(format: "AppleWebKit/%@ (KHTML, like Gecko) Chrome/%@ Mobile Safari/%@ EdgA/%@", | ||
arguments: [layoutEngine, | ||
softwareVersion_Chrome, | ||
layoutEngine_iOS, | ||
softwareVersion]) | ||
} | ||
} | ||
|
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,42 @@ | ||
// | ||
// IE.swift | ||
// UserAgency | ||
// | ||
// Created by Terry Huang on 2020/12/27. | ||
// | ||
|
||
import Foundation | ||
|
||
public class IE: UserApp { | ||
weak var userDevice: UserDevice? | ||
|
||
var layoutEngine = "7.0" | ||
var softwareVersion = "11.0" | ||
|
||
/* | ||
// WindowsPC | ||
; Trident/{$layoutEngine}; rv:{$softwareVersion} | ||
like Gecko | ||
*/ | ||
|
||
public init() { | ||
} | ||
|
||
public func setUserDevice(_ device: UserDevice?) { | ||
userDevice = device | ||
} | ||
|
||
public func getResultSystemInformation() -> String { | ||
return String(format: "; Trident/%@; rv:%@", | ||
arguments: [layoutEngine, | ||
softwareVersion]) | ||
} | ||
|
||
public func getResultPlatform() -> String { | ||
if userDevice == nil { | ||
return "" | ||
} | ||
|
||
return "like Gecko" | ||
} | ||
} |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
|
@@ -23,7 +23,7 @@ class UserAgencyTests: XCTestCase { | |
iPhone(), | ||
iPad(), | ||
Mac(), | ||
PC() | ||
WindowsPC() | ||
] | ||
|
||
allApp = [ | ||
|
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters