0 | module Web.Internal.PermissionsTypes
11 | namespace PermissionState
14 | data PermissionState = Granted | Denied | Prompt
17 | Show PermissionState where
18 | show Granted = "granted"
19 | show Denied = "denied"
20 | show Prompt = "prompt"
23 | Eq PermissionState where
24 | (==) = (==) `on` show
27 | Ord PermissionState where
28 | compare = compare `on` show
31 | read : String -> Maybe PermissionState
32 | read "granted" = Just Granted
33 | read "denied" = Just Denied
34 | read "prompt" = Just Prompt
38 | ToFFI PermissionState String where
42 | FromFFI PermissionState String where
46 | namespace PermissionName
49 | data PermissionName =
62 | | AmbientLightSensor
72 | Show PermissionName where
73 | show Geolocation = "geolocation"
74 | show Notifications = "notifications"
77 | show Camera = "camera"
78 | show Microphone = "microphone"
79 | show SpeakerSelection = "speaker-selection"
80 | show DeviceInfo = "device-info"
81 | show BackgroundFetch = "background-fetch"
82 | show BackgroundSync = "background-sync"
83 | show Bluetooth = "bluetooth"
84 | show PersistentStorage = "persistent-storage"
85 | show AmbientLightSensor = "ambient-light-sensor"
86 | show Accelerometer = "accelerometer"
87 | show Gyroscope = "gyroscope"
88 | show Magnetometer = "magnetometer"
89 | show ClipboardRead = "clipboard-read"
90 | show ClipboardWrite = "clipboard-write"
91 | show DisplayCapture = "display-capture"
95 | Eq PermissionName where
96 | (==) = (==) `on` show
99 | Ord PermissionName where
100 | compare = compare `on` show
103 | read : String -> Maybe PermissionName
104 | read "geolocation" = Just Geolocation
105 | read "notifications" = Just Notifications
106 | read "push" = Just Push
107 | read "midi" = Just Midi
108 | read "camera" = Just Camera
109 | read "microphone" = Just Microphone
110 | read "speaker-selection" = Just SpeakerSelection
111 | read "device-info" = Just DeviceInfo
112 | read "background-fetch" = Just BackgroundFetch
113 | read "background-sync" = Just BackgroundSync
114 | read "bluetooth" = Just Bluetooth
115 | read "persistent-storage" = Just PersistentStorage
116 | read "ambient-light-sensor" = Just AmbientLightSensor
117 | read "accelerometer" = Just Accelerometer
118 | read "gyroscope" = Just Gyroscope
119 | read "magnetometer" = Just Magnetometer
120 | read "clipboard-read" = Just ClipboardRead
121 | read "clipboard-write" = Just ClipboardWrite
122 | read "display-capture" = Just DisplayCapture
123 | read "nfc" = Just Nfc
127 | ToFFI PermissionName String where
131 | FromFFI PermissionName String where
140 | export data PermissionStatus : Type where [external]
143 | ToFFI PermissionStatus PermissionStatus where toFFI = id
146 | FromFFI PermissionStatus PermissionStatus where fromFFI = Just
149 | SafeCast PermissionStatus where
150 | safeCast = unsafeCastOnPrototypeName "PermissionStatus"
152 | export data Permissions : Type where [external]
155 | ToFFI Permissions Permissions where toFFI = id
158 | FromFFI Permissions Permissions where fromFFI = Just
161 | SafeCast Permissions where
162 | safeCast = unsafeCastOnPrototypeName "Permissions"
169 | export data CameraDevicePermissionDescriptor : Type where [external]
172 | ToFFI CameraDevicePermissionDescriptor CameraDevicePermissionDescriptor where toFFI = id
175 | FromFFI CameraDevicePermissionDescriptor CameraDevicePermissionDescriptor where fromFFI = Just
177 | export data DevicePermissionDescriptor : Type where [external]
180 | ToFFI DevicePermissionDescriptor DevicePermissionDescriptor where toFFI = id
183 | FromFFI DevicePermissionDescriptor DevicePermissionDescriptor where fromFFI = Just
185 | export data MidiPermissionDescriptor : Type where [external]
188 | ToFFI MidiPermissionDescriptor MidiPermissionDescriptor where toFFI = id
191 | FromFFI MidiPermissionDescriptor MidiPermissionDescriptor where fromFFI = Just
193 | export data PermissionDescriptor : Type where [external]
196 | ToFFI PermissionDescriptor PermissionDescriptor where toFFI = id
199 | FromFFI PermissionDescriptor PermissionDescriptor where fromFFI = Just
201 | export data PermissionSetParameters : Type where [external]
204 | ToFFI PermissionSetParameters PermissionSetParameters where toFFI = id
207 | FromFFI PermissionSetParameters PermissionSetParameters where fromFFI = Just
209 | export data PushPermissionDescriptor : Type where [external]
212 | ToFFI PushPermissionDescriptor PushPermissionDescriptor where toFFI = id
215 | FromFFI PushPermissionDescriptor PushPermissionDescriptor where fromFFI = Just