@iternio/react-native-auto-play 0.0.5 → 0.0.6
This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
|
@@ -12,8 +12,6 @@ import CarPlay
|
|
|
12
12
|
#endif
|
|
13
13
|
|
|
14
14
|
class AutoPlayScene: UIResponder {
|
|
15
|
-
public private(set) var state: VisibilityState = .diddisappear
|
|
16
|
-
|
|
17
15
|
var initialProperties: [String: Any] = [:]
|
|
18
16
|
var moduleName: String?
|
|
19
17
|
var window: UIWindow?
|
|
@@ -75,16 +73,11 @@ class AutoPlayScene: UIResponder {
|
|
|
75
73
|
}
|
|
76
74
|
|
|
77
75
|
func setState(state: VisibilityState) {
|
|
78
|
-
self.state = state
|
|
79
|
-
|
|
80
76
|
guard let moduleName = self.moduleName else {
|
|
81
77
|
return
|
|
82
78
|
}
|
|
83
79
|
|
|
84
|
-
|
|
85
|
-
moduleName: moduleName,
|
|
86
|
-
state: state
|
|
87
|
-
)
|
|
80
|
+
SceneStore.setState(moduleName: moduleName, state: state)
|
|
88
81
|
}
|
|
89
82
|
|
|
90
83
|
func initRootView() {
|
|
@@ -10,6 +10,9 @@ import CarPlay
|
|
|
10
10
|
class SceneStore {
|
|
11
11
|
static let rootModuleName = "AutoPlayRoot"
|
|
12
12
|
static let dashboardModuleName = "CarPlayDashboard"
|
|
13
|
+
static let windowSceneModuleName = "main"
|
|
14
|
+
|
|
15
|
+
private static var renderState = [String: VisibilityState]()
|
|
13
16
|
|
|
14
17
|
private static var store: [String: AutoPlayScene] = [:]
|
|
15
18
|
|
|
@@ -34,7 +37,16 @@ class SceneStore {
|
|
|
34
37
|
}
|
|
35
38
|
|
|
36
39
|
static func getState(moduleName: String) -> VisibilityState? {
|
|
37
|
-
return
|
|
40
|
+
return renderState[moduleName]
|
|
41
|
+
}
|
|
42
|
+
|
|
43
|
+
static func setState(moduleName: String, state: VisibilityState) {
|
|
44
|
+
renderState[moduleName] = state
|
|
45
|
+
|
|
46
|
+
HybridAutoPlay.emitRenderState(
|
|
47
|
+
moduleName: moduleName,
|
|
48
|
+
state: state
|
|
49
|
+
)
|
|
38
50
|
}
|
|
39
51
|
|
|
40
52
|
static func getDashboardScene() throws -> DashboardSceneDelegate? {
|
|
@@ -67,11 +79,11 @@ class SceneStore {
|
|
|
67
79
|
|
|
68
80
|
return scene as? ClusterSceneDelegate
|
|
69
81
|
}
|
|
70
|
-
|
|
82
|
+
|
|
71
83
|
static func getRootScene() -> AutoPlayScene? {
|
|
72
84
|
return store[SceneStore.rootModuleName]
|
|
73
85
|
}
|
|
74
|
-
|
|
86
|
+
|
|
75
87
|
static func getRootTraitCollection() -> UITraitCollection {
|
|
76
88
|
return store[SceneStore.rootModuleName]!.traitCollection
|
|
77
89
|
}
|
|
@@ -33,21 +33,30 @@ class WindowApplicationSceneDelegate: UIResponder, UIWindowSceneDelegate {
|
|
|
33
33
|
}
|
|
34
34
|
|
|
35
35
|
func sceneDidBecomeActive(_ scene: UIScene) {
|
|
36
|
-
|
|
36
|
+
SceneStore.setState(
|
|
37
|
+
moduleName: SceneStore.windowSceneModuleName,
|
|
38
|
+
state: .didappear
|
|
39
|
+
)
|
|
37
40
|
}
|
|
38
41
|
|
|
39
42
|
func sceneWillResignActive(_ scene: UIScene) {
|
|
40
|
-
|
|
41
|
-
moduleName:
|
|
43
|
+
SceneStore.setState(
|
|
44
|
+
moduleName: SceneStore.windowSceneModuleName,
|
|
42
45
|
state: .willdisappear
|
|
43
46
|
)
|
|
44
47
|
}
|
|
45
48
|
|
|
46
49
|
func sceneWillEnterForeground(_ scene: UIScene) {
|
|
47
|
-
|
|
50
|
+
SceneStore.setState(
|
|
51
|
+
moduleName: SceneStore.windowSceneModuleName,
|
|
52
|
+
state: .willappear
|
|
53
|
+
)
|
|
48
54
|
}
|
|
49
55
|
|
|
50
56
|
func sceneDidEnterBackground(_ scene: UIScene) {
|
|
51
|
-
|
|
57
|
+
SceneStore.setState(
|
|
58
|
+
moduleName: SceneStore.windowSceneModuleName,
|
|
59
|
+
state: .diddisappear
|
|
60
|
+
)
|
|
52
61
|
}
|
|
53
62
|
}
|