diff --git a/IWantToHeal-Thor-v1.1.6.apk b/IWantToHeal-Thor-v1.1.6.apk new file mode 100644 index 0000000..f97238b Binary files /dev/null and b/IWantToHeal-Thor-v1.1.6.apk differ diff --git a/android/app/build.gradle b/android/app/build.gradle index 4206613..6902e40 100644 --- a/android/app/build.gradle +++ b/android/app/build.gradle @@ -7,8 +7,8 @@ android { applicationId "com.warren.iwanttoheal" minSdkVersion rootProject.ext.minSdkVersion targetSdkVersion rootProject.ext.targetSdkVersion - versionCode 84 - versionName "1.1.5" + versionCode 85 + versionName "1.1.6" testInstrumentationRunner "androidx.test.runner.AndroidJUnitRunner" aaptOptions { // Files and dirs to omit from the packaged assets dir, modified to accommodate modern web apps. diff --git a/android/app/src/main/java/com/warren/iwanttoheal/ControllerBridgeActivity.java b/android/app/src/main/java/com/warren/iwanttoheal/ControllerBridgeActivity.java index 3949d12..727e9e5 100644 --- a/android/app/src/main/java/com/warren/iwanttoheal/ControllerBridgeActivity.java +++ b/android/app/src/main/java/com/warren/iwanttoheal/ControllerBridgeActivity.java @@ -18,8 +18,8 @@ public abstract class ControllerBridgeActivity extends BridgeActivity { public static final String EXTRA_INITIAL_URL = "com.warren.iwanttoheal.INITIAL_URL"; private static final String PREFS_NAME = "com.warren.iwanttoheal.performance"; private static final String CACHE_CLEARED_VERSION_KEY = "webview_cache_cleared_version"; - private static final long DPAD_THROTTLE_MS = 220; - private long lastDpadDispatchAt = 0; + private static final long DPAD_THROTTLE_MS = 55; + private final long[] lastDpadDispatchAt = new long[16]; @Override public void onCreate(Bundle savedInstanceState) { @@ -139,7 +139,7 @@ public abstract class ControllerBridgeActivity extends BridgeActivity { if (event.getAction() == KeyEvent.ACTION_DOWN) { boolean repeat = event.getRepeatCount() > 0; - if (isDpadToken(token) && shouldThrottleDpad()) return true; + if (isDpadToken(token) && shouldThrottleDpad(token)) return true; String script = "window.dispatchEvent(new CustomEvent('ashen-halls-native-controller'," + "{detail:{token:'" + token + "',repeat:" + repeat + "}}));"; @@ -153,10 +153,11 @@ public abstract class ControllerBridgeActivity extends BridgeActivity { return true; } - private boolean shouldThrottleDpad() { + private boolean shouldThrottleDpad(String token) { + int buttonIndex = Integer.parseInt(token.substring("Button".length())); long now = SystemClock.uptimeMillis(); - if (now - lastDpadDispatchAt < DPAD_THROTTLE_MS) return true; - lastDpadDispatchAt = now; + if (now - lastDpadDispatchAt[buttonIndex] < DPAD_THROTTLE_MS) return true; + lastDpadDispatchAt[buttonIndex] = now; return false; } diff --git a/src/admin.tsx b/src/admin.tsx index d314694..ee35ec2 100644 --- a/src/admin.tsx +++ b/src/admin.tsx @@ -3,9 +3,12 @@ import { createRoot } from 'react-dom/client' import './index.css' import './App.css' import { AdminScreen } from './components/AdminScreen' +import { InputProvider } from './input' createRoot(document.getElementById('root')!).render( - window.close()} /> + + window.close()} /> + , ) diff --git a/src/components/PvpRoguelikeScreen.tsx b/src/components/PvpRoguelikeScreen.tsx index 93bdb02..fd6ac34 100644 --- a/src/components/PvpRoguelikeScreen.tsx +++ b/src/components/PvpRoguelikeScreen.tsx @@ -1509,6 +1509,7 @@ export function PvPRoguelikeScreen({ bindings={activeBindings} canCast={status === 'playing' && !playerDone && playerAlive} className="pvp-bottom-spell-bar" + focusable={false} iconStyle={controllerIconStyle} onCast={castPlayerSpell} resource={playerSide.resource} diff --git a/src/components/PvpStadiumScreen.tsx b/src/components/PvpStadiumScreen.tsx index ab6125b..c908160 100644 --- a/src/components/PvpStadiumScreen.tsx +++ b/src/components/PvpStadiumScreen.tsx @@ -1289,6 +1289,7 @@ export function PvpStadiumScreen({ bindings={activeBindings} canCast={status === 'playing' && playerAlive} className="pvp-bottom-spell-bar" + focusable={false} iconStyle={controllerIconStyle} onCast={castPlayerSpell} resource={playerSide.resource} diff --git a/src/components/SpellBars.tsx b/src/components/SpellBars.tsx index de7cef7..a97cd9b 100644 --- a/src/components/SpellBars.tsx +++ b/src/components/SpellBars.tsx @@ -40,6 +40,7 @@ export const SpellButton = memo(function SpellButton({ iconStyle, resourceName, disabled, + focusable = true, onCast, emptyKeyPrefix = 'empty', }: { @@ -48,6 +49,7 @@ export const SpellButton = memo(function SpellButton({ iconStyle: ControllerIconStyle resourceName: string disabled?: boolean + focusable?: boolean onCast: (spell: Spell) => void emptyKeyPrefix?: string }) { @@ -61,9 +63,11 @@ export const SpellButton = memo(function SpellButton({ return (