From f9f5a7df2025df3bee0cc68ebd29e7a0d641ae9c Mon Sep 17 00:00:00 2001 From: freeplay Date: Mon, 26 Jun 2023 14:36:28 -0400 Subject: [PATCH] feat: toggle-able swiping --- locales/en-US.yml | 1 + packages/client/src/pages/settings/general.vue | 7 +++++++ packages/client/src/pages/timeline.vue | 7 +------ packages/client/src/store.ts | 4 ++++ 4 files changed, 13 insertions(+), 6 deletions(-) diff --git a/locales/en-US.yml b/locales/en-US.yml index e9580b9d5..8897cc0e1 100644 --- a/locales/en-US.yml +++ b/locales/en-US.yml @@ -1053,6 +1053,7 @@ recommendedInstancesDescription: "Recommended servers separated by line breaks t caption: "Auto Caption" splash: "Splash Screen" updateAvailable: "There might be an update available!" +swipeOnMobile: "Allow swiping between pages" swipeOnDesktop: "Allow mobile-style swiping on desktop" logoImageUrl: "Logo image URL" showAdminUpdates: "Indicate a new Calckey version is avaliable (admin only)" diff --git a/packages/client/src/pages/settings/general.vue b/packages/client/src/pages/settings/general.vue index 36a4e2a13..18afb3b9f 100644 --- a/packages/client/src/pages/settings/general.vue +++ b/packages/client/src/pages/settings/general.vue @@ -45,6 +45,9 @@ class="_formBlock" >{{ i18n.ts.useReactionPickerForContextMenu }} + {{ + i18n.ts.swipeOnMobile + }} {{ i18n.ts.swipeOnDesktop }} @@ -339,6 +342,9 @@ const showUpdates = computed(defaultStore.makeGetterSetter("showUpdates")); const swipeOnDesktop = computed( defaultStore.makeGetterSetter("swipeOnDesktop") ); +const swipeOnMobile = computed( + defaultStore.makeGetterSetter("swipeOnMobile") +); const showAdminUpdates = computed( defaultStore.makeGetterSetter("showAdminUpdates") ); @@ -379,6 +385,7 @@ watch( overridedDeviceKind, showAds, showUpdates, + swipeOnMobile, swipeOnDesktop, seperateRenoteQuote, showAdminUpdates, diff --git a/packages/client/src/pages/timeline.vue b/packages/client/src/pages/timeline.vue index 88c41d283..9a496c3c4 100644 --- a/packages/client/src/pages/timeline.vue +++ b/packages/client/src/pages/timeline.vue @@ -45,12 +45,7 @@ :modules="[Virtual]" :space-between="20" :virtual="true" - :allow-touch-move=" - !( - deviceKind === 'desktop' && - !defaultStore.state.swipeOnDesktop - ) - " + :allow-touch-move="defaultStore.state.swipeOnMobile && ( deviceKind !== 'desktop' || defaultStore.state.swipeOnDesktop )" @swiper="setSwiperRef" @slide-change="onSlideChange" > diff --git a/packages/client/src/store.ts b/packages/client/src/store.ts index e7be5135c..044a98356 100644 --- a/packages/client/src/store.ts +++ b/packages/client/src/store.ts @@ -314,6 +314,10 @@ export const defaultStore = markRaw( where: "device", default: false, }, + swipeOnMobile: { + where: "device", + default: true, + }, showAdminUpdates: { where: "account", default: true,