Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Updated Lottery interaction #1934

Draft
wants to merge 17 commits into
base: master
Choose a base branch
from
Draft

Conversation

ArthurKun21
Copy link
Collaborator

@ArthurKun21 ArthurKun21 commented Dec 17, 2024

Updated Lottery interaction

Pull Request Type

  • Bugfix
  • Feature Implementation
  • Documentation
  • Other

Related issue

fixes #1936

Description

They actually moved the done location causing issues.

Added the long press for jp lottery

Screenshots

lotto

Testing

Additional context

@ArthurKun21 ArthurKun21 changed the title Fix JP lottery Location Updated Lottery interaction Dec 21, 2024
@ArthurKun21 ArthurKun21 requested a review from reconman December 22, 2024 08:49
private fun spin() {
// Don't increase this too much or you'll regret when you're not able to stop the script
// And your phone won't let you press anything
locations.lottery.spinClick.click(20)
}

private fun spinLongClick() {
locations.lottery.spinClick.longPress(lottoLongPress * 1_000)
Copy link
Collaborator Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

I did this to access the sharedpreference once and store that in memory

@@ -27,6 +29,8 @@ class TapperService : AccessibilityService() {
// We only want events from FGO
serviceInfo = serviceInfo.apply {
packageNames = GameServer.packageNames.keys.toTypedArray()
flags = AccessibilityServiceInfo.DEFAULT or AccessibilityServiceInfo.FLAG_REQUEST_TOUCH_EXPLORATION_MODE
eventTypes = AccessibilityEvent.TYPE_WINDOW_STATE_CHANGED or AccessibilityEvent.TYPE_WINDOW_STATE_CHANGED
Copy link
Collaborator

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

You used the same value twice for the or

Copy link
Collaborator Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

oh yeah, bad code that I forgot to delete

Comment on lines +59 to +62
val source = event?.source
source?.let {
source.performAction(AccessibilityNodeInfo.ACTION_LONG_CLICK)
}
Copy link
Collaborator

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

What does this do?

Copy link
Collaborator Author

@ArthurKun21 ArthurKun21 Dec 26, 2024

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

this is the one that handles the long press events

Copy link
Collaborator Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

I could have sworn, I remember that it didn't work with the initial setup until I added this.

Copy link
Collaborator

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

I can't really find any other people using these kinds of flags and event listeners.

What your code currently does is long press the screen when FGO is opened and when FGA dialogs are closed (for example when you press the play button and then click cancel)

I can't see the long presses or any effects, but this code doesn't seem right.

I also don't get what the touch exploration mode flag is used for.

Copy link
Collaborator Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

touch exploration mode flag is used for

this is also needed for long press

Copy link
Collaborator Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

ah this might be the one for long press and drag

Copy link
Collaborator

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Do you still have currency to test the code? For example remove the ACTION_LONG_CLICK and see if it still works.

Also, does the new lottery long press code only work for JP lotteries or may it also work for other servers?

Copy link
Collaborator Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Already empty

the long press QOL works much faster than the multiple clicks. I emptied it out before I even notice

Copy link

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Do you still have currency to test the code? For example remove the ACTION_LONG_CLICK and see if it still works.

I still have currency if testing is needed

does the new lottery long press code only work for JP lotteries or may it also work for other servers?

only for JP for now

Copy link
Collaborator Author

@ArthurKun21 ArthurKun21 Dec 26, 2024

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Also, does the new lottery long press code only work for JP lotteries or may it also work for other servers?

lmao me speed reading didn't read this.

yea there's a lock-in there as it is JP only feature so far.

/**
* Switch between the two different spin methods depending on the server
*/
private fun spinGameServer() = when (prefs.gameServer) {
is GameServer.Jp -> spinLongClick()
else -> spin()
}

if (Build.VERSION.SDK_INT >= Build.VERSION_CODES.O) {
longPress8(location, duration)
} else {
click(location, 2)
Copy link
Collaborator

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

I guess this will produce weird behavior for Android 7, but I think we should drop support for Android 7 anyways.

Copy link
Collaborator Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

I don't mind dropping the android 7

Copy link

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Perhaps it's a bit out of place to ask but it'd be nice to have a "Last working build" release for no-longer-supported Android versions

@ArthurKun21 ArthurKun21 force-pushed the lotto-jp-new-done-location branch from 428c187 to e05b7d2 Compare January 3, 2025 20:21
@ArthurKun21 ArthurKun21 marked this pull request as draft January 7, 2025 13:49
Copy link

Build 98

Download the latest APK for testing here

Note

You need a GitHub account to download the APK.

This URL is valid as long as the artifact has not expired yet.

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

Successfully merging this pull request may close these issues.

Hold lotto spin button QoL for faster rolls
3 participants