File tree 5 files changed +22
-15
lines changed
5 files changed +22
-15
lines changed Original file line number Diff line number Diff line change @@ -19,17 +19,11 @@ export class PreviewCommand implements ICommand {
19
19
this . $logger . info ( message ) ;
20
20
} ) ;
21
21
22
- await this . $liveSyncService . liveSync ( [ ] , {
23
- syncToPreviewApp : true ,
24
- projectDir : this . $projectData . projectDir ,
25
- skipWatcher : ! this . $options . watch ,
26
- watchAllFiles : this . $options . syncAllFiles ,
27
- clean : this . $options . clean ,
22
+ await this . $liveSyncService . liveSyncToPreviewApp ( {
28
23
bundle : ! ! this . $options . bundle ,
29
- release : this . $options . release ,
30
- env : this . $options . env ,
31
- timeout : this . $options . timeout ,
32
- useHotModuleReload : this . $options . hmr
24
+ useHotModuleReload : this . $options . hmr ,
25
+ projectDir : this . $projectData . projectDir ,
26
+ env : this . $options . env
33
27
} ) ;
34
28
35
29
await this . $previewQrCodeService . printLiveSyncQrCode ( { useHotModuleReload : this . $options . hmr , link : this . $options . link } ) ;
Original file line number Diff line number Diff line change @@ -242,6 +242,13 @@ interface ILiveSyncService {
242
242
*/
243
243
liveSync ( deviceDescriptors : ILiveSyncDeviceInfo [ ] , liveSyncData : ILiveSyncInfo ) : Promise < void > ;
244
244
245
+ /**
246
+ * Starts LiveSync operation to Preview app.
247
+ * @param {IPreviewAppLiveSyncData } data Describes information about the current operation.
248
+ * @returns {Promise<IQrCodeImageData> } Data of the QR code that should be used to start the LiveSync operation.
249
+ */
250
+ liveSyncToPreviewApp ( data : IPreviewAppLiveSyncData ) : Promise < IQrCodeImageData > ;
251
+
245
252
/**
246
253
* Stops LiveSync operation for specified directory.
247
254
* @param {string } projectDir The directory for which to stop the operation.
Original file line number Diff line number Diff line change @@ -137,11 +137,13 @@ export class LiveSyncService extends EventEmitter implements IDebugLiveSyncServi
137
137
return currentDescriptors || [ ] ;
138
138
}
139
139
140
- @cache ( )
141
140
private attachToPreviewAppLiveSyncError ( ) : void {
142
- this . $previewAppLiveSyncService . on ( LiveSyncEvents . previewAppLiveSyncError , liveSyncData => {
143
- this . emit ( LiveSyncEvents . previewAppLiveSyncError , liveSyncData ) ;
144
- } ) ;
141
+ if ( ! this . $usbLiveSyncService . isInitialized ) {
142
+ this . $previewAppLiveSyncService . on ( LiveSyncEvents . previewAppLiveSyncError , liveSyncData => {
143
+ this . $logger . error ( liveSyncData . error ) ;
144
+ this . emit ( LiveSyncEvents . previewAppLiveSyncError , liveSyncData ) ;
145
+ } ) ;
146
+ }
145
147
}
146
148
147
149
private handleWarnings ( liveSyncData : ILiveSyncInfo , projectData : IProjectData ) {
Original file line number Diff line number Diff line change @@ -43,7 +43,7 @@ export class PreviewAppLiveSyncService extends EventEmitter implements IPreviewA
43
43
this . deviceInitializationPromise [ device . id ] = null ;
44
44
}
45
45
} catch ( error ) {
46
- this . $logger . error ( error ) ;
46
+ this . $logger . trace ( `Error while sending files on device ${ device && device . id } . Error is` , error ) ;
47
47
this . emit ( PreviewAppLiveSyncEvents . PREVIEW_APP_LIVE_SYNC_ERROR , {
48
48
error,
49
49
data,
Original file line number Diff line number Diff line change @@ -661,6 +661,10 @@ export class DebugServiceStub extends EventEmitter implements IDeviceDebugServic
661
661
}
662
662
663
663
export class LiveSyncServiceStub implements ILiveSyncService {
664
+ public async liveSyncToPreviewApp ( data : IPreviewAppLiveSyncData ) : Promise < IQrCodeImageData > {
665
+ return ;
666
+ }
667
+
664
668
public async liveSync ( deviceDescriptors : ILiveSyncDeviceInfo [ ] , liveSyncData : ILiveSyncInfo ) : Promise < void > {
665
669
return ;
666
670
}
You can’t perform that action at this time.
0 commit comments