1.0.80
All checks were successful
Build and Release / build-and-release (push) Successful in 13m27s

This commit is contained in:
Bryan1029384756
2026-04-15 20:06:44 -05:00
parent f2dc627b76
commit 26dd013b05
16 changed files with 398 additions and 18 deletions

View File

@@ -147,6 +147,37 @@ if (window.Capacitor?.isNativePlatform?.()) {
webPlatform.systemBars = { setColors: (opts) => SystemBars.setColors(opts) };
webPlatform.features.hasSystemBars = true;
}
// Android hardware back button → dispatch to the app-level registry.
// We expose a `detail.handled` flag so in-tree listeners (see
// `useBackHandler`) can claim the event. When nothing claims it, we
// fall back to `App.minimizeApp()` so the user lands on their home
// screen instead of force-exiting the process.
const AppPlugin = window.Capacitor.Plugins.App;
if (AppPlugin && typeof AppPlugin.addListener === 'function') {
AppPlugin.addListener('backButton', () => {
const detail = { handled: false };
try {
window.dispatchEvent(
new CustomEvent('brycord:android-back', { detail }),
);
} catch (e) {
console.warn('[backButton] dispatch failed', e);
}
if (!detail.handled) {
try {
if (typeof AppPlugin.minimizeApp === 'function') {
AppPlugin.minimizeApp();
} else if (typeof AppPlugin.exitApp === 'function') {
AppPlugin.exitApp();
}
} catch (e) {
console.warn('[backButton] fallback failed', e);
}
}
});
webPlatform.features.hasBackButton = true;
}
}
export default webPlatform;