Add back gesture support

This commit is contained in:
olcxja 2026-05-17 21:46:12 +02:00
commit 38f8c147ae
1250 changed files with 39332 additions and 21 deletions

View file

@ -9,6 +9,7 @@ android {
apply from: "../capacitor-cordova-android-plugins/cordova.variables.gradle"
dependencies {
implementation project(':capacitor-app')
implementation project(':capacitor-status-bar')
}

View file

@ -1,4 +1,8 @@
[
{
"pkg": "@capacitor/app",
"classpath": "com.capacitorjs.plugins.app.AppPlugin"
},
{
"pkg": "@capacitor/status-bar",
"classpath": "com.capacitorjs.plugins.statusbar.StatusBarPlugin"

View file

@ -801,10 +801,7 @@ async function switchDetailsContent(title, content)
roomsTopBarTransition.style.opacity = "0";
const rem = parseFloat(getComputedStyle(document.documentElement).fontSize);
if (window.innerWidth <= 52 * rem && !skipMobileSlide) {
}
else
{
if (window.innerWidth > 52 * rem) {
await delay(200);
}
@ -867,7 +864,8 @@ function clickAddDm()
var indicatorBeforeFixedMenu;
sidebarAddButton.addEventListener("click", (e) => {
e.stopPropagation();
console.log("hi")
history.pushState({trap: true}, "", location.href);
if (fixedContextMenu.classList.contains("show")) {
fixedContextMenu.classList.remove("show");
setActiveSidebarIndicator(indicatorBeforeFixedMenu);
@ -879,6 +877,8 @@ sidebarAddButton.addEventListener("click", (e) => {
});
document.addEventListener("click", (e) => {
history.pushState({trap: true}, "", location.href);
if (fixedContextMenu.classList.contains("show")) {
if (!fixedContextMenu.contains(e.target)) {
fixedContextMenu.classList.remove("show");
@ -896,8 +896,33 @@ document.addEventListener("click", (e) => {
}
}
}
backCounter = 0;
});
var backCounter = 0;
window.addEventListener("popstate", (e) => {
popstate();
});
const { App } = window.Capacitor?.Plugins || {};
if (App) {
App.addListener('backButton', () => {
popstate();
});
}
function popstate()
{
mobileNavBack();
backCounter++;
if (backCounter >= 4)
{
history.back();
if (App) {
App.minimizeApp();
}
}
}
function gotoSideProfilePopup() {
@ -908,13 +933,11 @@ function gotoInbox() {
}
function gotoCreateSpace() {
fixedContextMenu.classList.remove("show");
setActiveSidebarIndicator(sidebarAddIndicator);
switchRoomContent("title.create.space", createSpaceScreen, false);
}
function gotoJoinSpace() {
fixedContextMenu.classList.remove("show");
setActiveSidebarIndicator(sidebarAddIndicator);
switchRoomContent("title.join.space", joinSpaceScreen, false);
switchRoomContent("title.join.space", joinSpaceScreen, true);
}
function gotoHome() {
setActiveSidebarIndicator(sidebarHomeIndicator);
@ -928,9 +951,10 @@ function setActiveSidebarIndicator(element, skipDisabling = false)
for (let i = 0; i < indicators.length; i++) {
if (indicators[i].classList.contains("active"))
{
indicatorBeforeFixedMenu = indicators[i];
if (!skipDisabling)
if (!skipDisabling) //DOKONCZ JEBANY INDICATOR UZYJE DO TEGO indicatorBeforeFixedMenu ZE ON MA BYC AKTYWNY PO MOBILE COFCE
{
indicatorBeforeFixedMenu = indicators[i];
indicators[i].classList.remove("active");
}
}
@ -943,8 +967,12 @@ function mobileNavBack() {
if(mainScreen.classList.contains('mobile-details')) {
mainScreen.classList.remove('mobile-details');
mainScreen.classList.add('mobile-content');
setActiveSidebarIndicator(indicatorBeforeFixedMenu);
} else {
mainScreen.classList.remove('mobile-content');
setActiveSidebarIndicator(sidebarHomeIndicator);
}
}
function mobileNavDetails() {

View file

@ -2,5 +2,8 @@
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')
include ':capacitor-status-bar'
project(':capacitor-status-bar').projectDir = new File('../node_modules/@capacitor/status-bar/android')