-
Notifications
You must be signed in to change notification settings - Fork 24
Expand file tree
/
Copy pathBrowserPermission.php
More file actions
214 lines (205 loc) Β· 7.12 KB
/
Copy pathBrowserPermission.php
File metadata and controls
214 lines (205 loc) Β· 7.12 KB
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
74
75
76
77
78
79
80
81
82
83
84
85
86
87
88
89
90
91
92
93
94
95
96
97
98
99
100
101
102
103
104
105
106
107
108
109
110
111
112
113
114
115
116
117
118
119
120
121
122
123
124
125
126
127
128
129
130
131
132
133
134
135
136
137
138
139
140
141
142
143
144
145
146
147
148
149
150
151
152
153
154
155
156
157
158
159
160
161
162
163
164
165
166
167
168
169
170
171
172
173
174
175
176
177
178
179
180
181
182
183
184
185
186
187
188
189
190
191
192
193
194
195
196
197
198
199
200
201
202
203
204
205
206
207
208
209
210
211
212
213
214
<?php
namespace Appwrite\Enums;
use JsonSerializable;
class BrowserPermission implements JsonSerializable
{
private static BrowserPermission $GEOLOCATION;
private static BrowserPermission $CAMERA;
private static BrowserPermission $MICROPHONE;
private static BrowserPermission $NOTIFICATIONS;
private static BrowserPermission $MIDI;
private static BrowserPermission $PUSH;
private static BrowserPermission $CLIPBOARDREAD;
private static BrowserPermission $CLIPBOARDWRITE;
private static BrowserPermission $PAYMENTHANDLER;
private static BrowserPermission $USB;
private static BrowserPermission $BLUETOOTH;
private static BrowserPermission $ACCELEROMETER;
private static BrowserPermission $GYROSCOPE;
private static BrowserPermission $MAGNETOMETER;
private static BrowserPermission $AMBIENTLIGHTSENSOR;
private static BrowserPermission $BACKGROUNDSYNC;
private static BrowserPermission $PERSISTENTSTORAGE;
private static BrowserPermission $SCREENWAKELOCK;
private static BrowserPermission $WEBSHARE;
private static BrowserPermission $XRSPATIALTRACKING;
private string $value;
private function __construct(string $value)
{
$this->value = $value;
}
public function __toString(): string
{
return $this->value;
}
public function jsonSerialize(): string
{
return $this->value;
}
public static function GEOLOCATION(): BrowserPermission
{
if (!isset(self::$GEOLOCATION)) {
self::$GEOLOCATION = new BrowserPermission('geolocation');
}
return self::$GEOLOCATION;
}
public static function CAMERA(): BrowserPermission
{
if (!isset(self::$CAMERA)) {
self::$CAMERA = new BrowserPermission('camera');
}
return self::$CAMERA;
}
public static function MICROPHONE(): BrowserPermission
{
if (!isset(self::$MICROPHONE)) {
self::$MICROPHONE = new BrowserPermission('microphone');
}
return self::$MICROPHONE;
}
public static function NOTIFICATIONS(): BrowserPermission
{
if (!isset(self::$NOTIFICATIONS)) {
self::$NOTIFICATIONS = new BrowserPermission('notifications');
}
return self::$NOTIFICATIONS;
}
public static function MIDI(): BrowserPermission
{
if (!isset(self::$MIDI)) {
self::$MIDI = new BrowserPermission('midi');
}
return self::$MIDI;
}
public static function PUSH(): BrowserPermission
{
if (!isset(self::$PUSH)) {
self::$PUSH = new BrowserPermission('push');
}
return self::$PUSH;
}
public static function CLIPBOARDREAD(): BrowserPermission
{
if (!isset(self::$CLIPBOARDREAD)) {
self::$CLIPBOARDREAD = new BrowserPermission('clipboard-read');
}
return self::$CLIPBOARDREAD;
}
public static function CLIPBOARDWRITE(): BrowserPermission
{
if (!isset(self::$CLIPBOARDWRITE)) {
self::$CLIPBOARDWRITE = new BrowserPermission('clipboard-write');
}
return self::$CLIPBOARDWRITE;
}
public static function PAYMENTHANDLER(): BrowserPermission
{
if (!isset(self::$PAYMENTHANDLER)) {
self::$PAYMENTHANDLER = new BrowserPermission('payment-handler');
}
return self::$PAYMENTHANDLER;
}
public static function USB(): BrowserPermission
{
if (!isset(self::$USB)) {
self::$USB = new BrowserPermission('usb');
}
return self::$USB;
}
public static function BLUETOOTH(): BrowserPermission
{
if (!isset(self::$BLUETOOTH)) {
self::$BLUETOOTH = new BrowserPermission('bluetooth');
}
return self::$BLUETOOTH;
}
public static function ACCELEROMETER(): BrowserPermission
{
if (!isset(self::$ACCELEROMETER)) {
self::$ACCELEROMETER = new BrowserPermission('accelerometer');
}
return self::$ACCELEROMETER;
}
public static function GYROSCOPE(): BrowserPermission
{
if (!isset(self::$GYROSCOPE)) {
self::$GYROSCOPE = new BrowserPermission('gyroscope');
}
return self::$GYROSCOPE;
}
public static function MAGNETOMETER(): BrowserPermission
{
if (!isset(self::$MAGNETOMETER)) {
self::$MAGNETOMETER = new BrowserPermission('magnetometer');
}
return self::$MAGNETOMETER;
}
public static function AMBIENTLIGHTSENSOR(): BrowserPermission
{
if (!isset(self::$AMBIENTLIGHTSENSOR)) {
self::$AMBIENTLIGHTSENSOR = new BrowserPermission('ambient-light-sensor');
}
return self::$AMBIENTLIGHTSENSOR;
}
public static function BACKGROUNDSYNC(): BrowserPermission
{
if (!isset(self::$BACKGROUNDSYNC)) {
self::$BACKGROUNDSYNC = new BrowserPermission('background-sync');
}
return self::$BACKGROUNDSYNC;
}
public static function PERSISTENTSTORAGE(): BrowserPermission
{
if (!isset(self::$PERSISTENTSTORAGE)) {
self::$PERSISTENTSTORAGE = new BrowserPermission('persistent-storage');
}
return self::$PERSISTENTSTORAGE;
}
public static function SCREENWAKELOCK(): BrowserPermission
{
if (!isset(self::$SCREENWAKELOCK)) {
self::$SCREENWAKELOCK = new BrowserPermission('screen-wake-lock');
}
return self::$SCREENWAKELOCK;
}
public static function WEBSHARE(): BrowserPermission
{
if (!isset(self::$WEBSHARE)) {
self::$WEBSHARE = new BrowserPermission('web-share');
}
return self::$WEBSHARE;
}
public static function XRSPATIALTRACKING(): BrowserPermission
{
if (!isset(self::$XRSPATIALTRACKING)) {
self::$XRSPATIALTRACKING = new BrowserPermission('xr-spatial-tracking');
}
return self::$XRSPATIALTRACKING;
}
public static function from(string $value): self
{
return match ($value) {
'geolocation' => self::GEOLOCATION(),
'camera' => self::CAMERA(),
'microphone' => self::MICROPHONE(),
'notifications' => self::NOTIFICATIONS(),
'midi' => self::MIDI(),
'push' => self::PUSH(),
'clipboard-read' => self::CLIPBOARDREAD(),
'clipboard-write' => self::CLIPBOARDWRITE(),
'payment-handler' => self::PAYMENTHANDLER(),
'usb' => self::USB(),
'bluetooth' => self::BLUETOOTH(),
'accelerometer' => self::ACCELEROMETER(),
'gyroscope' => self::GYROSCOPE(),
'magnetometer' => self::MAGNETOMETER(),
'ambient-light-sensor' => self::AMBIENTLIGHTSENSOR(),
'background-sync' => self::BACKGROUNDSYNC(),
'persistent-storage' => self::PERSISTENTSTORAGE(),
'screen-wake-lock' => self::SCREENWAKELOCK(),
'web-share' => self::WEBSHARE(),
'xr-spatial-tracking' => self::XRSPATIALTRACKING(),
default => throw new \InvalidArgumentException('Unknown BrowserPermission value: ' . $value),
};
}
}