|
@@ -2,8 +2,6 @@ import * as _ from 'lodash';
|
2
|
2
|
import { CommandsObserver } from '../events/CommandsObserver';
|
3
|
3
|
import { NativeCommandsSender } from '../adapters/NativeCommandsSender';
|
4
|
4
|
import { UniqueIdProvider } from '../adapters/UniqueIdProvider';
|
5
|
|
-import { Options } from '../interfaces/Options';
|
6
|
|
-import { Layout, LayoutRoot } from '../interfaces/Layout';
|
7
|
5
|
|
8
|
6
|
export class Commands {
|
9
|
7
|
constructor(
|
|
@@ -14,7 +12,7 @@ export class Commands {
|
14
|
12
|
private readonly uniqueIdProvider: UniqueIdProvider) {
|
15
|
13
|
}
|
16
|
14
|
|
17
|
|
- public setRoot(simpleApi: LayoutRoot) {
|
|
15
|
+ public setRoot(simpleApi) {
|
18
|
16
|
const input = _.cloneDeep(simpleApi);
|
19
|
17
|
const root = this.layoutTreeParser.parse(input.root);
|
20
|
18
|
this.layoutTreeCrawler.crawl(root);
|
|
@@ -37,7 +35,7 @@ export class Commands {
|
37
|
35
|
return result;
|
38
|
36
|
}
|
39
|
37
|
|
40
|
|
- public setDefaultOptions(options: Options) {
|
|
38
|
+ public setDefaultOptions(options) {
|
41
|
39
|
const input = _.cloneDeep(options);
|
42
|
40
|
this.layoutTreeCrawler.processOptions(input);
|
43
|
41
|
|
|
@@ -45,7 +43,7 @@ export class Commands {
|
45
|
43
|
this.commandsObserver.notify('setDefaultOptions', { options });
|
46
|
44
|
}
|
47
|
45
|
|
48
|
|
- public mergeOptions(componentId: string, options: Options) {
|
|
46
|
+ public mergeOptions(componentId, options) {
|
49
|
47
|
const input = _.cloneDeep(options);
|
50
|
48
|
this.layoutTreeCrawler.processOptions(input);
|
51
|
49
|
|
|
@@ -53,7 +51,7 @@ export class Commands {
|
53
|
51
|
this.commandsObserver.notify('mergeOptions', { componentId, options });
|
54
|
52
|
}
|
55
|
53
|
|
56
|
|
- public showModal(simpleApi: Layout) {
|
|
54
|
+ public showModal(simpleApi) {
|
57
|
55
|
const input = _.cloneDeep(simpleApi);
|
58
|
56
|
const layout = this.layoutTreeParser.parse(input);
|
59
|
57
|
this.layoutTreeCrawler.crawl(layout);
|
|
@@ -64,7 +62,7 @@ export class Commands {
|
64
|
62
|
return result;
|
65
|
63
|
}
|
66
|
64
|
|
67
|
|
- public dismissModal(componentId: string) {
|
|
65
|
+ public dismissModal(componentId) {
|
68
|
66
|
const commandId = this.uniqueIdProvider.generate('dismissModal');
|
69
|
67
|
const result = this.nativeCommandsSender.dismissModal(commandId, componentId);
|
70
|
68
|
this.commandsObserver.notify('dismissModal', { commandId, componentId });
|
|
@@ -78,7 +76,7 @@ export class Commands {
|
78
|
76
|
return result;
|
79
|
77
|
}
|
80
|
78
|
|
81
|
|
- public push(componentId: string, simpleApi: Layout) {
|
|
79
|
+ public push(componentId, simpleApi) {
|
82
|
80
|
const input = _.cloneDeep(simpleApi);
|
83
|
81
|
|
84
|
82
|
const layout = this.layoutTreeParser.parse(input);
|
|
@@ -90,28 +88,28 @@ export class Commands {
|
90
|
88
|
return result;
|
91
|
89
|
}
|
92
|
90
|
|
93
|
|
- public pop(componentId: string, options: Options) {
|
|
91
|
+ public pop(componentId, options) {
|
94
|
92
|
const commandId = this.uniqueIdProvider.generate('pop');
|
95
|
93
|
const result = this.nativeCommandsSender.pop(commandId, componentId, options);
|
96
|
94
|
this.commandsObserver.notify('pop', { commandId, componentId, options });
|
97
|
95
|
return result;
|
98
|
96
|
}
|
99
|
97
|
|
100
|
|
- public popTo(componentId: string) {
|
|
98
|
+ public popTo(componentId) {
|
101
|
99
|
const commandId = this.uniqueIdProvider.generate('popTo');
|
102
|
100
|
const result = this.nativeCommandsSender.popTo(commandId, componentId);
|
103
|
101
|
this.commandsObserver.notify('popTo', { commandId, componentId });
|
104
|
102
|
return result;
|
105
|
103
|
}
|
106
|
104
|
|
107
|
|
- public popToRoot(componentId: string) {
|
|
105
|
+ public popToRoot(componentId) {
|
108
|
106
|
const commandId = this.uniqueIdProvider.generate('popToRoot');
|
109
|
107
|
const result = this.nativeCommandsSender.popToRoot(commandId, componentId);
|
110
|
108
|
this.commandsObserver.notify('popToRoot', { commandId, componentId });
|
111
|
109
|
return result;
|
112
|
110
|
}
|
113
|
111
|
|
114
|
|
- public setStackRoot(componentId: string, simpleApi: Layout) {
|
|
112
|
+ public setStackRoot(componentId, simpleApi) {
|
115
|
113
|
const input = _.cloneDeep(simpleApi);
|
116
|
114
|
|
117
|
115
|
const layout = this.layoutTreeParser.parse(input);
|
|
@@ -123,7 +121,7 @@ export class Commands {
|
123
|
121
|
return result;
|
124
|
122
|
}
|
125
|
123
|
|
126
|
|
- public showOverlay(simpleApi: Layout) {
|
|
124
|
+ public showOverlay(simpleApi) {
|
127
|
125
|
const input = _.cloneDeep(simpleApi);
|
128
|
126
|
|
129
|
127
|
const layout = this.layoutTreeParser.parse(input);
|
|
@@ -135,7 +133,7 @@ export class Commands {
|
135
|
133
|
return result;
|
136
|
134
|
}
|
137
|
135
|
|
138
|
|
- public dismissOverlay(componentId: string) {
|
|
136
|
+ public dismissOverlay(componentId) {
|
139
|
137
|
const commandId = this.uniqueIdProvider.generate('dismissOverlay');
|
140
|
138
|
const result = this.nativeCommandsSender.dismissOverlay(commandId, componentId);
|
141
|
139
|
this.commandsObserver.notify('dismissOverlay', { commandId, componentId });
|