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

[Infrared] Support tap emulate #262

Open
wants to merge 4 commits into
base: dev
Choose a base branch
from

Conversation

Programistich
Copy link
Contributor

No description provided.

@Programistich Programistich force-pushed the feature/single-tap-emulate branch from 6ce5cab to 22f615f Compare December 2, 2024 17:18
} else {
guard let flipper = device.flipper else { return }

if flipper.hasSingleEmulateSupport {
Copy link
Member

Choose a reason for hiding this comment

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

seems like it should be other way around

@@ -2,5 +2,7 @@ import Core
import SwiftUI

extension EnvironmentValues {
@Entry var emulateAction: (InfraredKeyID) -> Void = { _ in }
@Entry var emulateAction: (
InfraredKeyID, Emulate.EmulateType
Copy link
Member

Choose a reason for hiding this comment

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

please separate arguments with a new line

onTap()
}
.gesture(
LongPressGesture()
Copy link
Member

Choose a reason for hiding this comment

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

not sure about that

@@ -24,6 +24,11 @@ public class Emulate: ObservableObject {
case byIndex(Int)
}

public enum EmulateType {
case infinite
Copy link
Member

Choose a reason for hiding this comment

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

continuous fits better

case .infinite:
try await application.buttonPress(index: index)
case .single:
try await application.buttonPressRelease(index: index)
Copy link
Member

Choose a reason for hiding this comment

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

do we still need waitForMinimumDuration if we call press&release?

@Programistich Programistich force-pushed the feature/single-tap-emulate branch from 0443d5e to 8700c80 Compare December 3, 2024 09:16
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.

2 participants