1*8d307f52SEvan Baconimport chalk from 'chalk';
2*8d307f52SEvan Bacon
3*8d307f52SEvan Baconimport * as Log from '../../log';
4*8d307f52SEvan Bacon
5*8d307f52SEvan Bacon/** An abstract class for interacting with a native device. */
6*8d307f52SEvan Baconexport abstract class DeviceManager<IDevice> {
7*8d307f52SEvan Bacon  constructor(public device: IDevice) {}
8*8d307f52SEvan Bacon
9*8d307f52SEvan Bacon  abstract get name(): string;
10*8d307f52SEvan Bacon
11*8d307f52SEvan Bacon  abstract get identifier(): string;
12*8d307f52SEvan Bacon
13*8d307f52SEvan Bacon  logOpeningUrl(url: string) {
14*8d307f52SEvan Bacon    Log.log(chalk`\u203A Opening {underline ${url}} on {bold ${this.name}}`);
15*8d307f52SEvan Bacon  }
16*8d307f52SEvan Bacon
17*8d307f52SEvan Bacon  abstract startAsync(): Promise<IDevice>;
18*8d307f52SEvan Bacon
19*8d307f52SEvan Bacon  abstract getAppVersionAsync(applicationId: string): Promise<string | null>;
20*8d307f52SEvan Bacon
21*8d307f52SEvan Bacon  abstract installAppAsync(binaryPath: string): Promise<void>;
22*8d307f52SEvan Bacon
23*8d307f52SEvan Bacon  abstract uninstallAppAsync(applicationId: string): Promise<void>;
24*8d307f52SEvan Bacon
25*8d307f52SEvan Bacon  abstract isAppInstalledAsync(applicationId: string): Promise<boolean>;
26*8d307f52SEvan Bacon
27*8d307f52SEvan Bacon  abstract openUrlAsync(url: string): Promise<void>;
28*8d307f52SEvan Bacon
29*8d307f52SEvan Bacon  abstract activateWindowAsync(): Promise<void>;
30*8d307f52SEvan Bacon
31*8d307f52SEvan Bacon  abstract ensureExpoGoAsync(sdkVersion?: string): Promise<boolean>;
32*8d307f52SEvan Bacon}
33