-
Notifications
You must be signed in to change notification settings - Fork 1
Expand file tree
/
Copy pathEventManager.swift
More file actions
45 lines (36 loc) · 1.3 KB
/
EventManager.swift
File metadata and controls
45 lines (36 loc) · 1.3 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
//
// OrientationEventEmitter.swift
// react-native-orientation-director
//
// Created by gladiuscode on 18/05/2024.
//
import Foundation
public class EventManager: NSObject {
public weak var delegate: OrientationEventEmitterDelegate?
func sendDeviceOrientationDidChange(value: Int) {
guard let delegate = delegate else {
return
}
let params = Dictionary(dictionaryLiteral: ("orientation", value))
delegate.emitDeviceOrientationChanged(params: params as NSDictionary)
}
func sendInterfaceOrientationDidChange(value: Int) {
guard let delegate = delegate else {
return
}
let params = Dictionary(dictionaryLiteral: ("orientation", value))
delegate.emitInterfaceOrientationChanged(params: params as NSDictionary)
}
func sendLockDidChange(value: Bool) {
guard let delegate = delegate else {
return
}
let params = Dictionary(dictionaryLiteral: ("locked", value))
delegate.emitOnLockChanged(params: params as NSDictionary)
}
}
@objc public protocol OrientationEventEmitterDelegate {
func emitOnLockChanged(params: NSDictionary)
func emitDeviceOrientationChanged(params: NSDictionary)
func emitInterfaceOrientationChanged(params: NSDictionary)
}