mirror of
https://github.com/bitsocialnet/5chan.git
synced 2026-08-03 07:41:04 +02:00
fix back button on android app
This commit is contained in:
@@ -9,7 +9,7 @@ android {
|
||||
|
||||
apply from: "../capacitor-cordova-android-plugins/cordova.variables.gradle"
|
||||
dependencies {
|
||||
|
||||
implementation project(':capacitor-app')
|
||||
|
||||
}
|
||||
|
||||
|
||||
@@ -1 +1,6 @@
|
||||
[]
|
||||
[
|
||||
{
|
||||
"pkg": "@capacitor/app",
|
||||
"classpath": "com.capacitorjs.plugins.app.AppPlugin"
|
||||
}
|
||||
]
|
||||
|
||||
@@ -1,3 +1,6 @@
|
||||
// DO NOT EDIT THIS FILE! IT IS GENERATED EACH TIME "capacitor update" IS RUN
|
||||
include ':capacitor-android'
|
||||
project(':capacitor-android').projectDir = new File('../node_modules/@capacitor/android/capacitor')
|
||||
|
||||
include ':capacitor-app'
|
||||
project(':capacitor-app').projectDir = new File('../node_modules/@capacitor/app/android')
|
||||
|
||||
@@ -3,6 +3,7 @@
|
||||
"version": "0.1.10",
|
||||
"private": true,
|
||||
"dependencies": {
|
||||
"@capacitor/app": "1.1.1",
|
||||
"@babel/core": "7.21.3",
|
||||
"@babel/plugin-syntax-flow": "7.18.6",
|
||||
"@babel/plugin-transform-react-jsx": "7.21.0",
|
||||
|
||||
@@ -4,6 +4,7 @@ import App from './App';
|
||||
import { HelmetProvider } from 'react-helmet-async';
|
||||
import { HashRouter } from 'react-router-dom';
|
||||
import * as serviceWorkerRegistration from './serviceWorkerRegistration';
|
||||
import { App as CapacitorApp } from '@capacitor/app';
|
||||
|
||||
import PlebbitJs from '@plebbit/plebbit-js';
|
||||
// inject native functions into renderer
|
||||
@@ -25,3 +26,12 @@ root.render(
|
||||
|
||||
// set up PWA https://cra.link/PWA
|
||||
serviceWorkerRegistration.register();
|
||||
|
||||
// add back button in android app
|
||||
CapacitorApp.addListener('backButton', ({canGoBack}) => {
|
||||
if (canGoBack) {
|
||||
window.history.back();
|
||||
} else {
|
||||
CapacitorApp.exitApp();
|
||||
}
|
||||
});
|
||||
|
||||
@@ -1229,6 +1229,11 @@
|
||||
resolved "https://registry.yarnpkg.com/@capacitor/android/-/android-3.6.0.tgz#60438a0614415c7c242dda48a031cd45335e067a"
|
||||
integrity sha512-X6n0OLy7BE3c6qfVuL7UYyq/aIwEsqIAqtyDOwMdj5k+P1rLQVsGaWERXUtC0BGeoKBD5YgbWiyKwAwg5Spjdg==
|
||||
|
||||
"@capacitor/app@1.1.1":
|
||||
version "1.1.1"
|
||||
resolved "https://registry.yarnpkg.com/@capacitor/app/-/app-1.1.1.tgz#bde7202faad1b47c4ae2c4a622285d7569384c5e"
|
||||
integrity sha512-8ADkldHnoE1xkWvPUsGlERVGm6/Zvcxy6hCI80AxydIKyaCG7kbDAvUclebbnw/eFRxj2zBoVatGLjmJNvTbYw==
|
||||
|
||||
"@capacitor/cli@3.6.0":
|
||||
version "3.6.0"
|
||||
resolved "https://registry.yarnpkg.com/@capacitor/cli/-/cli-3.6.0.tgz#31c07f364828e750d20a8e6bb2d516f0d21be81d"
|
||||
|
||||
Reference in New Issue
Block a user