Use tablet constant
This commit is contained in:
@@ -70,6 +70,8 @@ const (
|
|||||||
Version = "Version"
|
Version = "Version"
|
||||||
Mobile = "Mobile"
|
Mobile = "Mobile"
|
||||||
Tablet = "Tablet"
|
Tablet = "Tablet"
|
||||||
|
|
||||||
|
tablet = "tablet"
|
||||||
)
|
)
|
||||||
|
|
||||||
// Parse user agent string returning UserAgent struct
|
// Parse user agent string returning UserAgent struct
|
||||||
@@ -95,7 +97,7 @@ func Parse(userAgent string) UserAgent {
|
|||||||
ua.OS = Android
|
ua.OS = Android
|
||||||
var osIndex int
|
var osIndex int
|
||||||
osIndex, ua.OSVersion = tokens.getIndexValue(Android)
|
osIndex, ua.OSVersion = tokens.getIndexValue(Android)
|
||||||
ua.Tablet = strings.Contains(strings.ToLower(ua.String), strings.ToLower(Tablet))
|
ua.Tablet = strings.Contains(strings.ToLower(ua.String), tablet)
|
||||||
ua.Device = tokens.findAndroidDevice(osIndex)
|
ua.Device = tokens.findAndroidDevice(osIndex)
|
||||||
|
|
||||||
case tokens.exists("iPhone"):
|
case tokens.exists("iPhone"):
|
||||||
@@ -672,7 +674,7 @@ func (p *properties) findAndroidDevice(startIndex int) string {
|
|||||||
case Chrome, Firefox, Safari, OperaMini, "Presto", Version, Mobile, MobileSafari, Mozilla, "AppleWebKit", WindowsNT, WindowsPhoneOS, Android, "Macintosh", Linux, CrOS:
|
case Chrome, Firefox, Safari, OperaMini, "Presto", Version, Mobile, MobileSafari, Mozilla, "AppleWebKit", WindowsNT, WindowsPhoneOS, Android, "Macintosh", Linux, CrOS:
|
||||||
// ignore these tokens, not device names
|
// ignore these tokens, not device names
|
||||||
default:
|
default:
|
||||||
if strings.Contains(strings.ToLower(dev), strings.ToLower(Tablet)) {
|
if strings.Contains(strings.ToLower(dev), tablet) {
|
||||||
p.list[i+1].Key = Tablet // leave Tablet tag for later table detection
|
p.list[i+1].Key = Tablet // leave Tablet tag for later table detection
|
||||||
} else {
|
} else {
|
||||||
p.list = append(p.list[:i+1], p.list[i+2:]...)
|
p.list = append(p.list[:i+1], p.list[i+2:]...)
|
||||||
|
|||||||
Reference in New Issue
Block a user