diff --git a/capacitor.config.ts b/capacitor.config.ts index 3c391500..4b397bec 100644 --- a/capacitor.config.ts +++ b/capacitor.config.ts @@ -1,6 +1,7 @@ /// /// /// +/// import { CapacitorConfig } from '@capacitor/cli'; @@ -23,8 +24,11 @@ const config: CapacitorConfig = { iconColor: '#CE0B7C', }, PushNotifications: { - presentationOptions: ["alert", "sound"] - } + presentationOptions: ['alert', 'sound'], + }, + App: { + disableBackButtonHandler: false, + }, }, }; diff --git a/src/pages/App.tsx b/src/pages/App.tsx index 251f2c80..673a7290 100644 --- a/src/pages/App.tsx +++ b/src/pages/App.tsx @@ -118,6 +118,14 @@ const AppPage: React.FC = () => { await AppLauncher.openUrl({ url: '' }); }; + const enableBackButtonHandler = async () => { + await App.toggleBackButtonHandler({ enabled: true }); + }; + + const disableBackButtonHandler = async () => { + await App.toggleBackButtonHandler({ enabled: false }); + }; + useIonViewDidLeave(() => { stateChangeHandler.remove(); urlOpenHandler.remove(); @@ -160,8 +168,16 @@ const AppPage: React.FC = () => { Test Failing Call - - {/* If the link above ever expires, this is the HTML to test opening an intent for this app. + + Enable Back Button Handler + + + Disable Back Button Handler + + + {/* If the link above ever expires, this is the HTML to test opening an intent for this app.

Test: Open APP @@ -175,8 +191,7 @@ const AppPage: React.FC = () => { + rel="noopener noreferrer"> Read more