80 lines
1.8 KiB
Go
80 lines
1.8 KiB
Go
package source
|
|
|
|
const (
|
|
// PlatAndroid is int8 for android.
|
|
PlatAndroid = int8(0)
|
|
// PlatIPhone is int8 for iphone.
|
|
PlatIPhone = int8(1)
|
|
// PlatIPad is int8 for ipad.
|
|
PlatIPad = int8(2)
|
|
// PlatWPhone is int8 for wphone.
|
|
PlatWPhone = int8(3)
|
|
// PlatAndroidG is int8 for Android Googleplay.
|
|
PlatAndroidG = int8(4)
|
|
// PlatIPhoneI is int8 for Iphone Global.
|
|
PlatIPhoneI = int8(5)
|
|
// PlatIPadI is int8 for IPAD Global.
|
|
PlatIPadI = int8(6)
|
|
// PlatAndroidTV is int8 for AndroidTV Global.
|
|
PlatAndroidTV = int8(7)
|
|
// PlatAndroidI is int8 for Android Global.
|
|
PlatAndroidI = int8(8)
|
|
// PlatIpadHD is int8 for IpadHD
|
|
PlatIpadHD = int8(9)
|
|
// PlatAndroidB is int8 for Android Blue.
|
|
PlatAndroidB = int8(10)
|
|
)
|
|
|
|
// IsAndroid check plat is android or ipad.
|
|
func IsAndroid(plat int8) bool {
|
|
return plat == PlatAndroid || plat == PlatAndroidG || plat == PlatAndroidI || plat == PlatAndroidB
|
|
}
|
|
|
|
// IsIOS check plat is iphone or ipad.
|
|
func IsIOS(plat int8) bool {
|
|
return plat == PlatIPad || plat == PlatIPhone || plat == PlatIPadI || plat == PlatIPhoneI
|
|
}
|
|
|
|
// IsIPhone check plat is iphone.
|
|
func IsIPhone(plat int8) bool {
|
|
return plat == PlatIPhone || plat == PlatIPhoneI
|
|
}
|
|
|
|
// IsIPad check plat is ipad.
|
|
func IsIPad(plat int8) bool {
|
|
return plat == PlatIPad
|
|
}
|
|
|
|
// Plat return plat by platStr or mobiApp
|
|
func Plat(mobiApp, device string) int8 {
|
|
switch mobiApp {
|
|
case "iphone":
|
|
if device == "pad" {
|
|
return PlatIPad
|
|
}
|
|
return PlatIPhone
|
|
case "white":
|
|
return PlatIPhone
|
|
case "ipad":
|
|
return PlatIPad
|
|
case "android", "android_b":
|
|
return PlatAndroid
|
|
case "win":
|
|
return PlatWPhone
|
|
case "android_G":
|
|
return PlatAndroidG
|
|
case "android_i":
|
|
return PlatAndroidI
|
|
case "iphone_i":
|
|
if device == "pad" {
|
|
return PlatIPadI
|
|
}
|
|
return PlatIPhoneI
|
|
case "ipad_i":
|
|
return PlatIPadI
|
|
case "android_tv":
|
|
return PlatAndroidTV
|
|
}
|
|
return PlatIPhone
|
|
}
|