@@ -45,12 +45,15 @@ export class Mitchell_Importer extends Importer {
45
45
/** Delay between keystrokes when typing a word (e.g. calling keyboard.type(), time between each letter keypress). */
46
46
keyboard [ 'nativeAdapter' ] . keyboard . setKeyboardDelay ( inputSpeed * 50 ) ;
47
47
/** Path with the assets, where we put images for "Manual Line" button image-recognition */
48
+ // screen.config.resourceDirectory = isLookingForCommitButton
49
+ // ? this.getMitchellPathForCommitButton()
50
+ // : isLookingForCommitBtnInModal
51
+ // ? this.getMitchellPathForCommitButtonInModal()
52
+ // : this.getMitchellPathForAssets();
53
+
48
54
screen . config . resourceDirectory = isLookingForCommitButton
49
55
? this . getMitchellPathForCommitButton ( )
50
- : isLookingForCommitBtnInModal
51
- ? this . getMitchellPathForCommitButtonInModal ( )
52
56
: this . getMitchellPathForAssets ( ) ;
53
-
54
57
// ! Left only for debug purposes
55
58
// ? Uncomment if needed, do not deploy to prod
56
59
if ( isLookingForCommitButton ) {
@@ -111,7 +114,8 @@ export class Mitchell_Importer extends Importer {
111
114
) ;
112
115
113
116
if ( commitButtonCoordinates ) {
114
- await this . commitMitchellData ( commitButtonCoordinates , electronWindow ) ;
117
+ await this . commitMitchellData ( commitButtonCoordinates ) ;
118
+ // await this.commitMitchellData(commitButtonCoordinates, electronWindow);
115
119
} else {
116
120
log . error ( "Can't find the Commit Button." ) ;
117
121
}
@@ -158,9 +162,13 @@ export class Mitchell_Importer extends Importer {
158
162
const buttonCoordinates =
159
163
typeButton === MitchellButtons . manualLineButton
160
164
? await this . checkForButtonCoordinates ( MitchellButtons . manualLineButton , electronWindow )
161
- : typeButton === MitchellButtons . commitButton
162
- ? await this . checkForButtonCoordinates ( MitchellButtons . commitButton , electronWindow )
163
- : await this . checkForButtonCoordinates ( MitchellButtons . commitButtonInModal , electronWindow ) ;
165
+ : await this . checkForButtonCoordinates ( MitchellButtons . commitButton , electronWindow ) ;
166
+ // const buttonCoordinates =
167
+ // typeButton === MitchellButtons.manualLineButton
168
+ // ? await this.checkForButtonCoordinates(MitchellButtons.manualLineButton, electronWindow)
169
+ // : typeButton === MitchellButtons.commitButton
170
+ // ? await this.checkForButtonCoordinates(MitchellButtons.commitButton, electronWindow)
171
+ // : await this.checkForButtonCoordinates(MitchellButtons.commitButtonInModal, electronWindow);
164
172
if ( buttonCoordinates ) {
165
173
const messageToSendToReact =
166
174
typeButton === MitchellButtons . manualLineButton
@@ -182,9 +190,13 @@ export class Mitchell_Importer extends Importer {
182
190
const images =
183
191
typeButton === MitchellButtons . manualLineButton
184
192
? fs . readdirSync ( this . getMitchellPathForAssets ( ) )
185
- : typeButton === MitchellButtons . commitButton
186
- ? fs . readdirSync ( this . getMitchellPathForCommitButton ( ) )
187
- : fs . readdirSync ( this . getMitchellPathForCommitButtonInModal ( ) ) ;
193
+ : fs . readdirSync ( this . getMitchellPathForCommitButton ( ) ) ;
194
+ // const images =
195
+ // typeButton === MitchellButtons.manualLineButton
196
+ // ? fs.readdirSync(this.getMitchellPathForAssets())
197
+ // : typeButton === MitchellButtons.commitButton
198
+ // ? fs.readdirSync(this.getMitchellPathForCommitButton())
199
+ // : fs.readdirSync(this.getMitchellPathForCommitButtonInModal());
188
200
const result : ImageSearchResult = {
189
201
coordinates : null ,
190
202
errors : [ ] ,
@@ -413,24 +425,32 @@ export class Mitchell_Importer extends Importer {
413
425
await snooze ( 4000 ) ; // wait until modal is closed
414
426
} ;
415
427
416
- private commitMitchellData = async ( commitButtonCoordinates : Point , electronWindow : BrowserWindow ) => {
428
+ private commitMitchellData = async ( commitButtonCoordinates : Point ) => {
417
429
await mouse . setPosition ( commitButtonCoordinates ) ;
418
430
await mouse . leftClick ( ) ;
419
431
this . progressUpdater . update ( ) ;
420
- const inputSpeed = getInputSpeed ( ) ;
421
- const inputSpeedSeconds = getInputSpeedInSeconds ( inputSpeed ) ;
432
+ // logic for searching by image
433
+ // const inputSpeed = getInputSpeed();
434
+ // const inputSpeedSeconds = getInputSpeedInSeconds(inputSpeed);
422
435
423
- this . setMitchellConfig ( inputSpeedSeconds , false , true ) ;
436
+ // this.setMitchellConfig(inputSpeedSeconds, false, true);
424
437
await snooze ( 6000 ) ;
425
- const coordinatesOfButtonInModal = await this . getButtonCoordinates (
426
- electronWindow ,
427
- MitchellButtons . commitButtonInModal
428
- ) ;
429
- if ( coordinatesOfButtonInModal ) {
430
- await mouse . setPosition ( coordinatesOfButtonInModal ) ;
431
- await mouse . leftClick ( ) ;
432
- this . progressUpdater . setPercentage ( 100 ) ;
433
- }
438
+ await this . pressTabButton ( 3 ) ;
439
+ this . progressUpdater . update ( ) ;
440
+ await this . pressTabButton ( 3 ) ;
441
+ this . progressUpdater . update ( ) ;
442
+ await keyboard . pressKey ( Key . Enter ) ;
443
+ await keyboard . releaseKey ( Key . Enter ) ;
444
+ this . progressUpdater . setPercentage ( 100 ) ;
445
+ // const coordinatesOfButtonInModal = await this.getButtonCoordinates(
446
+ // electronWindow,
447
+ // MitchellButtons.commitButtonInModal
448
+ // );
449
+ // if (coordinatesOfButtonInModal) {
450
+ // await mouse.setPosition(coordinatesOfButtonInModal);
451
+ // await mouse.leftClick();
452
+ // this.progressUpdater.setPercentage(100);
453
+ // }
434
454
} ;
435
455
}
436
456
0 commit comments