@@ -9,11 +9,20 @@ import { PLATFORMS_DIR_NAME, PACKAGE_JSON_FILE_NAME } from "../../../constants";
9
9
export class PreviewAppPluginsService implements IPreviewAppPluginsService {
10
10
private previewAppVersionWarnings : IDictionary < string [ ] > = { } ;
11
11
12
- constructor ( private $fs : IFileSystem ,
12
+ constructor ( private $errors : IErrors ,
13
+ private $fs : IFileSystem ,
13
14
private $logger : ILogger ,
14
15
private $pluginsService : IPluginsService ) { }
15
16
16
- public async comparePluginsOnDevice ( data : IPreviewAppLiveSyncData , device : Device ) : Promise < void > {
17
+ public getPluginsUsageWarnings ( data : IPreviewAppLiveSyncData , device : Device ) : string [ ] {
18
+ if ( ! device ) {
19
+ this . $errors . failWithoutHelp ( "No device provided." ) ;
20
+ }
21
+
22
+ if ( ! device . previewAppVersion ) {
23
+ this . $errors . failWithoutHelp ( "No version of preview app provided." ) ;
24
+ }
25
+
17
26
if ( ! this . previewAppVersionWarnings [ device . previewAppVersion ] ) {
18
27
const devicePlugins = this . getDevicePlugins ( device ) ;
19
28
const localPlugins = this . getLocalPlugins ( data . projectDir ) ;
@@ -27,7 +36,12 @@ export class PreviewAppPluginsService implements IPreviewAppPluginsService {
27
36
this . previewAppVersionWarnings [ device . previewAppVersion ] = warnings ;
28
37
}
29
38
30
- this . previewAppVersionWarnings [ device . previewAppVersion ] . map ( warning => this . $logger . warn ( warning ) ) ;
39
+ return this . previewAppVersionWarnings [ device . previewAppVersion ] ;
40
+ }
41
+
42
+ public async comparePluginsOnDevice ( data : IPreviewAppLiveSyncData , device : Device ) : Promise < void > {
43
+ const warnings = this . getPluginsUsageWarnings ( data , device ) ;
44
+ _ . map ( warnings , warning => this . $logger . warn ( warning ) ) ;
31
45
}
32
46
33
47
public getExternalPlugins ( device : Device ) : string [ ] {
0 commit comments