Skip to content

some refactorings and code organizing#4

Open
ninjamuffin99 wants to merge 4 commits into
mainfrom
push-qppqlnzprwuz
Open

some refactorings and code organizing#4
ninjamuffin99 wants to merge 4 commits into
mainfrom
push-qppqlnzprwuz

Conversation

@ninjamuffin99

Copy link
Copy Markdown
Collaborator
  • split the code into backends. These are the files that connect with our native java/obj-c code, and are meant to be our "cross-platform" functionality that we call from Haptic.hx
    • HapticIOS.hx -> IOSHapticBackend.hx
    • HapticAndroid.hx -> AndroidHapticBackend.hx
    • EmptyBackend.hx for use when on desktop/html5, so we don't need to wrap every Haptic.vibrate() call in a #if mobile conditional. In there are just empty functions so it does nothing.
  • HapticIOS.hx and HapticAndroid.hx have now become our "platform specific" functions. Things like vibratePatternFromData() to load (currently) apple specific .ahap files, are in HapticIOS.hx and isPrimitiveSupported() is now in HapticAndroid.hx as it's Android specific functionality.
  • Haptic.hx now has no platform specific code inside of it, it's merely a facade which calls our backends.

These changes should allow easier organization

Lil other misc changes

  • Changed from 0 to CHHapticTimeImmediate which could have no effect at all and just be value 0. But I saw it in some of the Apple sample code so I figured we can use it as our constant here.

I have only tested on iOS, but core functionality should generally be the same. All the previous developer facing function calls should work the exact same way (Haptic.vibrateOneshot() should vibrate the same way as previous).
I have android phone on me for further testing of this, but if u have notes lemme know @MAJigsaw77

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.

1 participant