|
@@ -7,6 +7,7 @@ import Screen from './Screen';
|
7
|
7
|
import PropRegistry from './PropRegistry';
|
8
|
8
|
|
9
|
9
|
const registeredScreens = {};
|
|
10
|
+const _allNavigatorEventHandlers = {};
|
10
|
11
|
|
11
|
12
|
function registerScreen(screenID, generator) {
|
12
|
13
|
registeredScreens[screenID] = generator;
|
|
@@ -134,6 +135,25 @@ function startSingleScreenApp(params) {
|
134
|
135
|
return platformSpecific.startSingleScreenApp(params);
|
135
|
136
|
}
|
136
|
137
|
|
|
138
|
+function setEventHandler(navigatorEventID, eventHandler) {
|
|
139
|
+ _allNavigatorEventHandlers[navigatorEventID] = eventHandler;
|
|
140
|
+}
|
|
141
|
+
|
|
142
|
+function clearEventHandler(navigatorEventID) {
|
|
143
|
+ delete _allNavigatorEventHandlers[navigatorEventID];
|
|
144
|
+}
|
|
145
|
+
|
|
146
|
+function handleDeepLink(params = {}) {
|
|
147
|
+ if (!params.link) return;
|
|
148
|
+ const event = {
|
|
149
|
+ type: 'DeepLink',
|
|
150
|
+ link: params.link
|
|
151
|
+ };
|
|
152
|
+ for (let i in _allNavigatorEventHandlers) {
|
|
153
|
+ _allNavigatorEventHandlers[i](event);
|
|
154
|
+ }
|
|
155
|
+}
|
|
156
|
+
|
137
|
157
|
export default {
|
138
|
158
|
getRegisteredScreen,
|
139
|
159
|
registerComponent,
|
|
@@ -145,5 +165,8 @@ export default {
|
145
|
165
|
showInAppNotification: showInAppNotification,
|
146
|
166
|
dismissInAppNotification: dismissInAppNotification,
|
147
|
167
|
startTabBasedApp: startTabBasedApp,
|
148
|
|
- startSingleScreenApp: startSingleScreenApp
|
|
168
|
+ startSingleScreenApp: startSingleScreenApp,
|
|
169
|
+ setEventHandler: setEventHandler,
|
|
170
|
+ clearEventHandler: clearEventHandler,
|
|
171
|
+ handleDeepLink: handleDeepLink
|
149
|
172
|
};
|