support for disabling the app’s built-in swipe-back navigation (#249)

This commit is contained in:
MaysWind
2025-09-20 21:57:53 +08:00
parent d947164eb6
commit 18b270debb
17 changed files with 42 additions and 1 deletions
+3 -1
View File
@@ -23,7 +23,7 @@ import { useExchangeRatesStore } from '@/stores/exchangeRates.ts';
import { APPLICATION_LOGO_PATH } from '@/consts/asset.ts';
import { ThemeType } from '@/core/theme.ts';
import { isProduction } from '@/lib/version.ts';
import { getTheme, isEnableAnimate } from '@/lib/settings.ts';
import { getTheme, isEnableSwipeBack, isEnableAnimate } from '@/lib/settings.ts';
import { initMapProvider } from '@/lib/map/index.ts';
import { isUserLogined, isUserUnlocked } from '@/lib/userstate.ts';
import { setExpenseAndIncomeAmountColor } from '@/lib/ui/common.ts';
@@ -98,7 +98,9 @@ const f7params = ref<Framework7Parameters>({
browserHistory: !isiOSHomeScreenMode(),
browserHistoryInitialMatch: true,
browserHistoryAnimate: false,
iosSwipeBack: isEnableSwipeBack(),
iosSwipeBackAnimateShadow: false,
mdSwipeBack: isEnableSwipeBack(),
mdSwipeBackAnimateShadow: false
}
});
+2
View File
@@ -28,6 +28,7 @@ export interface ApplicationSettings extends BaseApplicationSetting {
timeZone: string;
autoUpdateExchangeRatesData: boolean;
showAccountBalance: boolean;
swipeBack: boolean;
animate: boolean;
// Application Lock
applicationLock: boolean;
@@ -132,6 +133,7 @@ export const DEFAULT_APPLICATION_SETTINGS: ApplicationSettings = {
timeZone: '',
autoUpdateExchangeRatesData: true,
showAccountBalance: true,
swipeBack: true,
animate: true,
// Application Lock
applicationLock: false,
+4
View File
@@ -93,6 +93,10 @@ export function isEnableApplicationLock(): boolean {
return getApplicationSettings().applicationLock;
}
export function isEnableSwipeBack(): boolean {
return getApplicationSettings().swipeBack;
}
export function isEnableAnimate(): boolean {
return getApplicationSettings().animate;
}
+1
View File
@@ -2019,6 +2019,7 @@
"Accounts Included in Total": "Accounts Included in Total",
"Exchange Rates Data Page": "Wechselkursdatenseite",
"Exchange Rate": "Wechselkurs",
"Enable Swipe Back": "Enable Swipe Back",
"Enable Animation": "Animation aktivieren",
"Basic Information": "Grundlegende Informationen",
"User Information": "Benutzerinformationen",
+1
View File
@@ -2019,6 +2019,7 @@
"Accounts Included in Total": "Accounts Included in Total",
"Exchange Rates Data Page": "Exchange Rates Data Page",
"Exchange Rate": "Exchange Rate",
"Enable Swipe Back": "Enable Swipe Back",
"Enable Animation": "Enable Animation",
"Basic Information": "Basic Information",
"User Information": "User Information",
+1
View File
@@ -2019,6 +2019,7 @@
"Accounts Included in Total": "Accounts Included in Total",
"Exchange Rates Data Page": "Página de datos de tipos de cambio",
"Exchange Rate": "Tipo de cambio",
"Enable Swipe Back": "Enable Swipe Back",
"Enable Animation": "Habilitar animación",
"Basic Information": "Información básica",
"User Information": "Información del usuario",
+1
View File
@@ -2019,6 +2019,7 @@
"Accounts Included in Total": "Accounts Included in Total",
"Exchange Rates Data Page": "Pagina dati tassi di cambio",
"Exchange Rate": "Tasso di cambio",
"Enable Swipe Back": "Enable Swipe Back",
"Enable Animation": "Abilita animazione",
"Basic Information": "Informazioni di base",
"User Information": "Informazioni utente",
+1
View File
@@ -2019,6 +2019,7 @@
"Accounts Included in Total": "Accounts Included in Total",
"Exchange Rates Data Page": "為替レートデータページ",
"Exchange Rate": "為替レート",
"Enable Swipe Back": "Enable Swipe Back",
"Enable Animation": "アニメーションの有効",
"Basic Information": "基本情報",
"User Information": "ユーザー情報",
+1
View File
@@ -2019,6 +2019,7 @@
"Accounts Included in Total": "Rekeningen opgenomen in totaal",
"Exchange Rates Data Page": "Wisselkoersgegevenspagina",
"Exchange Rate": "Wisselkoers",
"Enable Swipe Back": "Enable Swipe Back",
"Enable Animation": "Animatie inschakelen",
"Basic Information": "Basisinformatie",
"User Information": "Gebruikersinformatie",
+1
View File
@@ -2019,6 +2019,7 @@
"Accounts Included in Total": "Accounts Included in Total",
"Exchange Rates Data Page": "Página de Dados de Taxas de Câmbio",
"Exchange Rate": "Taxa de Câmbio",
"Enable Swipe Back": "Enable Swipe Back",
"Enable Animation": "Habilitar Animação",
"Basic Information": "Informações Básicas",
"User Information": "Informações do Usuário",
+1
View File
@@ -2019,6 +2019,7 @@
"Accounts Included in Total": "Accounts Included in Total",
"Exchange Rates Data Page": "Страница данных о курсах валют",
"Exchange Rate": "Курс обмена",
"Enable Swipe Back": "Enable Swipe Back",
"Enable Animation": "Включить анимацию",
"Basic Information": "Основная информация",
"User Information": "Информация о пользователе",
+1
View File
@@ -2019,6 +2019,7 @@
"Accounts Included in Total": "Accounts Included in Total",
"Exchange Rates Data Page": "Сторінка курсів валют",
"Exchange Rate": "Курс обміну",
"Enable Swipe Back": "Enable Swipe Back",
"Enable Animation": "Увімкнути анімацію",
"Basic Information": "Основна інформація",
"User Information": "Інформація про користувача",
+1
View File
@@ -2019,6 +2019,7 @@
"Accounts Included in Total": "Accounts Included in Total",
"Exchange Rates Data Page": "Trang dữ liệu tỷ giá hối đoái",
"Exchange Rate": "Tỷ giá hối đoái",
"Enable Swipe Back": "Enable Swipe Back",
"Enable Animation": "Bật hoạt ảnh",
"Basic Information": "Thông tin cơ bản",
"User Information": "Thông tin người dùng",
+1
View File
@@ -2019,6 +2019,7 @@
"Accounts Included in Total": "计入总金额的账户",
"Exchange Rates Data Page": "汇率数据页面",
"Exchange Rate": "汇率",
"Enable Swipe Back": "启用侧滑返回",
"Enable Animation": "启用动画",
"Basic Information": "基本信息",
"User Information": "用户信息",
+1
View File
@@ -2019,6 +2019,7 @@
"Accounts Included in Total": "計入總金額的帳戶",
"Exchange Rates Data Page": "匯率資料頁面",
"Exchange Rate": "匯率",
"Enable Swipe Back": "啟用滑動返回",
"Enable Animation": "啟用動畫",
"Basic Information": "基本資訊",
"User Information": "使用者資訊",
+6
View File
@@ -155,6 +155,11 @@ export const useSettingsStore = defineStore('settings', () => {
updateUserApplicationCloudSettingValue('showAccountBalance', value);
}
function setEnableSwipeBack(value: boolean): void {
updateApplicationSettingsValue('swipeBack', value);
appSettings.value.swipeBack = value;
}
function setEnableAnimate(value: boolean): void {
updateApplicationSettingsValue('animate', value);
appSettings.value.animate = value;
@@ -430,6 +435,7 @@ export const useSettingsStore = defineStore('settings', () => {
setTimeZone,
setAutoUpdateExchangeRatesData,
setShowAccountBalance,
setEnableSwipeBack,
setEnableAnimate,
// -- Application Lock
setEnableApplicationLock,
+15
View File
@@ -75,6 +75,11 @@
<f7-list-item :title="tt('Statistics Settings')" link="/statistic/settings"></f7-list-item>
<f7-list-item :title="tt('Settings Sync')" link="/settings/sync"></f7-list-item>
<f7-list-item>
<span>{{ tt('Enable Swipe Back') }}</span>
<f7-toggle :checked="isEnableSwipeBack" @toggle:change="isEnableSwipeBack = $event"></f7-toggle>
</f7-list-item>
<f7-list-item>
<span>{{ tt('Enable Animation') }}</span>
<f7-toggle :checked="isEnableAnimate" @toggle:change="isEnableAnimate = $event"></f7-toggle>
@@ -146,6 +151,16 @@ const currentTimezoneName = computed<string>(() => {
return '';
});
const isEnableSwipeBack = computed<boolean>({
get: () => settingsStore.appSettings.swipeBack,
set: value => {
if (value !== settingsStore.appSettings.swipeBack) {
settingsStore.setEnableSwipeBack(value);
location.reload();
}
}
});
const isEnableAnimate = computed<boolean>({
get: () => settingsStore.appSettings.animate,
set: value => {