fix swipes?

This commit is contained in:
ThatOneCalculator 2022-08-19 23:16:06 -07:00
parent 04a7e9c147
commit 5e9d1ee478
2 changed files with 24 additions and 22 deletions

View File

@ -1,6 +1,6 @@
{ {
"name": "misskey", "name": "misskey",
"version": "12.118.1-calc.10.2", "version": "12.118.1-calc.10.3",
"codename": "aqua", "codename": "aqua",
"repository": { "repository": {
"type": "git", "type": "git",

View File

@ -121,17 +121,6 @@ async function chooseAntenna(ev: MouseEvent): Promise<void> {
os.popupMenu(items, ev.currentTarget ?? ev.target); os.popupMenu(items, ev.currentTarget ?? ev.target);
} }
async function chooseChannel(ev: MouseEvent): Promise<void> {
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( function saveSrc(
newSrc: 'home' | 'local' | 'recommended' | 'social' | 'global' newSrc: 'home' | 'local' | 'recommended' | 'social' | 'global'
): void { ): void {
@ -269,24 +258,37 @@ if (isMobile.value) {
let xDiff = xDown - xUp; let xDiff = xDown - xUp;
let yDiff = yDown - yUp; 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 (Math.abs(xDiff) > Math.abs(yDiff)) {
if (xDiff > 0) { if (xDiff > 0) {
console.log('right swipe'); console.log('right swipe');
const current = headerTabs.values.find((x) => x.key === src.value); next =
const next = timelines[
headerTabs.values[ (timelines.indexOf(src) + 1) % timelines.length
(headerTabs.values.indexOf(current) + 1) % headerTabs.values.length
]; ];
saveSrc(next.key);
} else { } else {
console.log('left swipe'); console.log('left swipe');
const current = headerTabs.values.find((x) => x.key === src.value); next =
const next = timelines[
headerTabs.values[ (timelines.indexOf(src) + 1) % timelines.length
(headerTabs.values.indexOf(current) - 1) % headerTabs.values.length
]; ];
saveSrc(next.key);
} }
saveSrc(next);
} /* else { } /* else {
if (yDiff > 0) { if (yDiff > 0) {
// down swipe // down swipe