@@ -18,6 +18,7 @@ import debugDriver from '../utils/debugDriver';
18
18
import create from '../utils/flooks' ;
19
19
import { queryService } from '../utils/query' ;
20
20
import { sendStatisticsEvent } from '../utils/statisticsUtils' ;
21
+ import * as switchUtils from '../utils/switchUtils' ;
21
22
22
23
export type ConnectionStoreType = ReturnType < typeof connectionStore > ;
23
24
@@ -390,42 +391,62 @@ const connectionStore = (store: any) => ({
390
391
}
391
392
} ,
392
393
393
- async setStopAtEntry ( value : boolean ) {
394
- const { selectedDevice } = store ( ) as ConnectionStoreType ;
394
+ async setStopAtEntryLegacy ( value : boolean ) {
395
+ const { selectedDevice, deviceInfoMap } = store ( ) as ConnectionStoreType ;
395
396
const { clientId } = selectedDevice ;
396
- if ( clientId ) {
397
+ if ( clientId === undefined ) {
398
+ return ;
399
+ }
400
+ try {
401
+ const deviceInfo = deviceInfoMap [ clientId ] ;
402
+ if ( deviceInfo === undefined ) {
403
+ return ;
404
+ }
397
405
await debugDriver . sendCustomMessageAsync ( {
398
406
type : ECustomDataType . D2RStopAtEntry ,
399
407
params : { stop_at_entry : value } ,
400
408
useParamsAsData : true ,
401
409
clientId
402
410
} ) ;
403
- const { deviceInfoMap } = store ( ) as ConnectionStoreType ;
404
- const deviceInfo = deviceInfoMap [ clientId ] ;
405
- if ( deviceInfo ) {
406
- deviceInfo . stopAtEntry = value ;
407
- store ( { deviceInfoMap : { ...deviceInfoMap } } ) ;
408
- }
411
+ deviceInfo . stopAtEntry = value ;
412
+ store ( { deviceInfoMap : { ...deviceInfoMap } } ) ;
413
+ } catch ( error : any ) {
414
+ console . error ( error . toString ( ) ) ;
409
415
}
410
416
} ,
411
- async setStopLepusAtEntry ( value : boolean ) {
412
- const { selectedDevice } = store ( ) as ConnectionStoreType ;
417
+ setStopAtEntry ( value : boolean ) {
418
+ switchUtils . setStopAtEntry ( 'DEFAULT' , value ) ;
419
+ const { setStopAtEntryLegacy } = store ( ) ;
420
+ setStopAtEntryLegacy ( value ) ;
421
+ } ,
422
+ async setStopLepusAtEntryLegacy ( value : boolean ) {
423
+ const { selectedDevice, deviceInfoMap } = store ( ) as ConnectionStoreType ;
413
424
const { clientId } = selectedDevice ;
414
- if ( clientId ) {
425
+ if ( clientId === undefined ) {
426
+ return ;
427
+ }
428
+ try {
429
+ const deviceInfo = deviceInfoMap [ clientId ] ;
430
+ if ( deviceInfo === undefined ) {
431
+ return ;
432
+ }
415
433
await debugDriver . sendCustomMessageAsync ( {
416
434
type : ECustomDataType . D2RStopLepusAtEntry ,
417
435
params : { stop_at_entry : value } ,
418
436
useParamsAsData : true ,
419
437
clientId
420
438
} ) ;
421
- const { deviceInfoMap } = store ( ) as ConnectionStoreType ;
422
- const deviceInfo = deviceInfoMap [ clientId ] ;
423
- if ( deviceInfo ) {
424
- deviceInfo . stopLepusAtEntry = value ;
425
- store ( { deviceInfoMap : { ...deviceInfoMap } } ) ;
426
- }
439
+ deviceInfo . stopLepusAtEntry = value ;
440
+ store ( { deviceInfoMap : { ...deviceInfoMap } } ) ;
441
+ } catch ( error : any ) {
442
+ console . error ( error . toString ( ) ) ;
427
443
}
428
444
} ,
445
+ setStopLepusAtEntry ( value : boolean ) {
446
+ switchUtils . setStopAtEntry ( 'MTS' , value ) ;
447
+ const { setStopLepusAtEntryLegacy } = store ( ) ;
448
+ setStopLepusAtEntryLegacy ( value ) ;
449
+ } ,
429
450
updateSessionScreenshot ( sessionId : number , data : string ) {
430
451
const { deviceInfoMap, selectedDevice } = store ( ) as ConnectionStoreType ;
431
452
const sessions = deviceInfoMap [ selectedDevice . clientId ?? 0 ] ?. sessions ;
0 commit comments