-
Notifications
You must be signed in to change notification settings - Fork 0
/
Copy pathpush_device_type.go
73 lines (64 loc) · 1.22 KB
/
push_device_type.go
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
52
53
54
55
56
57
58
59
60
61
62
63
64
65
66
67
68
69
70
71
72
73
package tdproto
type PushDeviceType int
const (
PushDeviceAndroid = PushDeviceType(1)
PushDeviceIOS = PushDeviceType(2)
PushDeviceWeb = PushDeviceType(3)
PushDeviceSafari = PushDeviceType(4)
PushDeviceIOSFB = PushDeviceType(5)
)
var MobilePushDevices = []PushDeviceType{
PushDeviceAndroid,
PushDeviceIOSFB,
PushDeviceIOS,
}
var IOSPushDevices = []PushDeviceType{
PushDeviceIOS,
PushDeviceIOSFB,
}
var AndroidPushDevices = []PushDeviceType{
PushDeviceAndroid,
}
func (t PushDeviceType) DbValue() int16 {
return int16(t)
}
func (t PushDeviceType) String() string {
switch t {
case PushDeviceAndroid:
return "Android"
case PushDeviceIOS:
return "iOS"
case PushDeviceWeb:
return "web"
case PushDeviceSafari:
return "safari"
case PushDeviceIOSFB:
return "iOS-firebase"
default:
return "?"
}
}
func (t PushDeviceType) Mobile() bool {
for _, v := range MobilePushDevices {
if v == t {
return true
}
}
return false
}
func (t PushDeviceType) Name() string {
switch t {
case PushDeviceAndroid:
return "android"
case PushDeviceIOS:
return "ios"
case PushDeviceWeb:
return "web"
case PushDeviceSafari:
return "safari"
case PushDeviceIOSFB:
return "iosfb"
default:
return "?"
}
}