Remove window.dataExplorerPlatform (#279)

More cleanup for #253 
- Remove window.dataExplorerPlatform
- Remove explorer factories
This commit is contained in:
Steve Faulkner
2020-10-14 22:25:13 -05:00
committed by GitHub
parent 39f7ef331a
commit 821f665e78
25 changed files with 63 additions and 143 deletions

View File

@@ -1,17 +1,17 @@
import { configContext, Platform } from "../ConfigContext";
import * as ViewModels from "../Contracts/ViewModels";
import { PlatformType } from "../PlatformType";
import { PortalTokenProvider } from "./PortalTokenProvider";
export class TokenProviderFactory {
private constructor() {}
public static create(): ViewModels.TokenProvider {
const platformType = window.dataExplorerPlatform;
const platformType = configContext.platform;
switch (platformType) {
case PlatformType.Portal:
case PlatformType.Hosted:
case Platform.Portal:
case Platform.Hosted:
return new PortalTokenProvider();
case PlatformType.Emulator:
case Platform.Emulator:
default:
// should never get into this state
throw new Error(`Unknown platform ${platformType}`);