class
DeviceAccess
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
private static let contactsPromise = Promise<Bool?>(nil)
static var contacts: Signal<Bool?, NoError> {
return self.contactsPromise.get()
|> distinctUntilChanged
}
private static let notificationsPromise = Promise<Bool?>(nil)
static var notifications: Signal<Bool?, NoError> {
return self.notificationsPromise.get()
}
private static let siriPromise = Promise<Bool?>(nil)
static var siri: Signal<Bool?, NoError> {
return self.siriPromise.get()
}
private static let locationPromise = Promise<Bool?>(nil)
static var location: Signal<Bool?, NoError> {
return self.locationPromise.get()
}
public static func isMicrophoneAccessAuthorized() -> Bool? {
return AVAudioSession.sharedInstance().recordPermission == .granted
}
public static func authorizeAccess(to subject: DeviceAccessSubject, registerForNotifications: ((@escaping (Bool) -> Void) -> Void)? = nil, requestSiriAuthorization: ((@escaping (Bool) -> Void) -> Void)? = nil, presentationData: PresentationData? = nil, present: @escaping (ViewController, Any?) -> Void = { _, _ in }, openSettings: @escaping () -> Void = { }, displayNotificationFromBackground: @escaping (String) -> Void = { _ in }, _ completion: @escaping (Bool) -> Void = { _ in }) {}
public static func authorizationStatus(applicationInForeground: Signal<Bool, NoError>? = nil, siriAuthorization: (() -> AccessType)? = nil, subject: DeviceAccessSubject) -> Signal<AccessType, NoError> {}