From 5e9d1ee4784d41905069778fa6f2457ec42fcb7f Mon Sep 17 00:00:00 2001 From: ThatOneCalculator Date: Fri, 19 Aug 2022 23:16:06 -0700 Subject: [PATCH] fix swipes? --- package.json | 2 +- packages/client/src/pages/timeline.vue | 44 ++++++++++++++------------ 2 files changed, 24 insertions(+), 22 deletions(-) diff --git a/package.json b/package.json index 1ef66b1cd..d49407e8d 100644 --- a/package.json +++ b/package.json @@ -1,6 +1,6 @@ { "name": "misskey", - "version": "12.118.1-calc.10.2", + "version": "12.118.1-calc.10.3", "codename": "aqua", "repository": { "type": "git", diff --git a/packages/client/src/pages/timeline.vue b/packages/client/src/pages/timeline.vue index 2a6f2740b..a3a215004 100644 --- a/packages/client/src/pages/timeline.vue +++ b/packages/client/src/pages/timeline.vue @@ -121,17 +121,6 @@ async function chooseAntenna(ev: MouseEvent): Promise { os.popupMenu(items, ev.currentTarget ?? ev.target); } -async function chooseChannel(ev: MouseEvent): Promise { - const channels = await os.api('channels/followed'); - const items = channels.map((channel) => ({ - type: 'link' as const, - text: channel.name, - indicate: channel.hasUnreadNote, - to: `/channels/${channel.id}`, - })); - os.popupMenu(items, ev.currentTarget ?? ev.target); -} - function saveSrc( newSrc: 'home' | 'local' | 'recommended' | 'social' | 'global' ): void { @@ -269,24 +258,37 @@ if (isMobile.value) { let xDiff = xDown - xUp; let yDiff = yDown - yUp; + let next = 'home'; + let timelines = ['home']; + + if (isLocalTimelineAvailable) { + timelines.push('local'); + } + if (isRecommendedTimelineAvailable) { + timelines.push('recommended'); + } + if (isLocalTimelineAvailable) { + timelines.push('social'); + } + if (isGlobalTimelineAvailable) { + timelines.push('global'); + } + if (Math.abs(xDiff) > Math.abs(yDiff)) { if (xDiff > 0) { console.log('right swipe'); - const current = headerTabs.values.find((x) => x.key === src.value); - const next = - headerTabs.values[ - (headerTabs.values.indexOf(current) + 1) % headerTabs.values.length + next = + timelines[ + (timelines.indexOf(src) + 1) % timelines.length ]; - saveSrc(next.key); } else { console.log('left swipe'); - const current = headerTabs.values.find((x) => x.key === src.value); - const next = - headerTabs.values[ - (headerTabs.values.indexOf(current) - 1) % headerTabs.values.length + next = + timelines[ + (timelines.indexOf(src) + 1) % timelines.length ]; - saveSrc(next.key); } + saveSrc(next); } /* else { if (yDiff > 0) { // down swipe