File tree Expand file tree Collapse file tree 4 files changed +21
-15
lines changed Expand file tree Collapse file tree 4 files changed +21
-15
lines changed Original file line number Diff line number Diff line change @@ -19,17 +19,11 @@ export class PreviewCommand implements ICommand {
1919 this . $logger . info ( message ) ;
2020 } ) ;
2121
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 ( {
2823 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
3327 } ) ;
3428
3529 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 {
242242 */
243243 liveSync ( deviceDescriptors : ILiveSyncDeviceInfo [ ] , liveSyncData : ILiveSyncInfo ) : Promise < void > ;
244244
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+
245252 /**
246253 * Stops LiveSync operation for specified directory.
247254 * @param {string } projectDir The directory for which to stop the operation.
Original file line number Diff line number Diff line change @@ -137,12 +137,13 @@ export class LiveSyncService extends EventEmitter implements IDebugLiveSyncServi
137137 return currentDescriptors || [ ] ;
138138 }
139139
140- @cache ( )
141140 private attachToPreviewAppLiveSyncError ( ) : void {
142- this . $previewAppLiveSyncService . on ( LiveSyncEvents . previewAppLiveSyncError , liveSyncData => {
143- this . $logger . error ( liveSyncData . error ) ;
144- this . emit ( LiveSyncEvents . previewAppLiveSyncError , liveSyncData ) ;
145- } ) ;
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+ }
146147 }
147148
148149 private handleWarnings ( liveSyncData : ILiveSyncInfo , projectData : IProjectData ) {
Original file line number Diff line number Diff line change @@ -661,6 +661,10 @@ export class DebugServiceStub extends EventEmitter implements IDeviceDebugServic
661661}
662662
663663export class LiveSyncServiceStub implements ILiveSyncService {
664+ public async liveSyncToPreviewApp ( data : IPreviewAppLiveSyncData ) : Promise < IQrCodeImageData > {
665+ return ;
666+ }
667+
664668 public async liveSync ( deviceDescriptors : ILiveSyncDeviceInfo [ ] , liveSyncData : ILiveSyncInfo ) : Promise < void > {
665669 return ;
666670 }
You can’t perform that action at this time.
0 commit comments