-
-
Notifications
You must be signed in to change notification settings - Fork 197
/
Copy pathplatforms-data-service.ts
34 lines (30 loc) · 1022 Bytes
/
platforms-data-service.ts
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
import { IProjectData } from "../definitions/project";
import { IPlatformData, IPlatformsDataService } from "../definitions/platform";
import { injector } from "../common/yok";
import * as _ from "lodash";
export class PlatformsDataService implements IPlatformsDataService {
private platformsDataService: { [index: string]: any } = {};
constructor(
$androidProjectService: IPlatformProjectService,
$iOSProjectService: IPlatformProjectService
) {
this.platformsDataService = {
ios: $iOSProjectService,
android: $androidProjectService,
};
}
public getPlatformData(
platform: string,
projectData: IProjectData
): IPlatformData {
const platformKey = platform && _.first(platform.toLowerCase().split("@"));
let platformData: IPlatformData;
if (platformKey) {
platformData =
this.platformsDataService[platformKey] &&
this.platformsDataService[platformKey].getPlatformData(projectData);
}
return platformData;
}
}
injector.register("platformsDataService", PlatformsDataService);