mirror of
https://github.com/NoCrypt/migu.git
synced 2026-04-21 00:22:08 +00:00
fix: android clicks
This commit is contained in:
parent
082444f2a7
commit
aeee8f74e5
3 changed files with 27 additions and 20 deletions
|
|
@ -29,8 +29,9 @@ const capacitorConfig = {
|
||||||
alias: {
|
alias: {
|
||||||
...alias,
|
...alias,
|
||||||
wrtc: false,
|
wrtc: false,
|
||||||
|
'node-datachannel': false,
|
||||||
'bittorrent-tracker/lib/client/http-tracker.js': resolve('../node_modules/bittorrent-tracker/lib/client/http-tracker.js'),
|
'bittorrent-tracker/lib/client/http-tracker.js': resolve('../node_modules/bittorrent-tracker/lib/client/http-tracker.js'),
|
||||||
'webrtc-polyfill': resolve('../node_modules/webrtc-polyfill/browser.js')
|
'webrtc-polyfill': false // no webrtc on mobile, need the resources
|
||||||
}
|
}
|
||||||
},
|
},
|
||||||
target: 'node',
|
target: 'node',
|
||||||
|
|
|
||||||
|
|
@ -1,3 +1,5 @@
|
||||||
|
import { SUPPORTS } from '@/modules/support.js'
|
||||||
|
|
||||||
let lastTapElement = null
|
let lastTapElement = null
|
||||||
let lastHoverElement = null
|
let lastHoverElement = null
|
||||||
|
|
||||||
|
|
@ -26,12 +28,14 @@ export function click (node, cb = noop) {
|
||||||
node.addEventListener('pointerleave', e => {
|
node.addEventListener('pointerleave', e => {
|
||||||
e.stopPropagation()
|
e.stopPropagation()
|
||||||
})
|
})
|
||||||
node.addEventListener('keydown', e => {
|
if (!SUPPORTS.isAndroid) {
|
||||||
if (e.key === 'Enter') {
|
node.addEventListener('keydown', e => {
|
||||||
e.stopPropagation()
|
if (e.key === 'Enter') {
|
||||||
cb(e)
|
e.stopPropagation()
|
||||||
}
|
cb(e)
|
||||||
})
|
}
|
||||||
|
})
|
||||||
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
export function hoverClick (node, [cb = noop, hoverUpdate = noop]) {
|
export function hoverClick (node, [cb = noop, hoverUpdate = noop]) {
|
||||||
|
|
@ -57,19 +61,21 @@ export function hoverClick (node, [cb = noop, hoverUpdate = noop]) {
|
||||||
lastTapElement = hoverUpdate
|
lastTapElement = hoverUpdate
|
||||||
}
|
}
|
||||||
})
|
})
|
||||||
node.addEventListener('keydown', e => {
|
if (!SUPPORTS.isAndroid) {
|
||||||
if (e.key === 'Enter') {
|
node.addEventListener('keydown', e => {
|
||||||
e.stopPropagation()
|
if (e.key === 'Enter') {
|
||||||
lastTapElement?.(false)
|
e.stopPropagation()
|
||||||
if (lastTapElement === hoverUpdate) {
|
lastTapElement?.(false)
|
||||||
lastTapElement = null
|
if (lastTapElement === hoverUpdate) {
|
||||||
cb(e)
|
lastTapElement = null
|
||||||
} else {
|
cb(e)
|
||||||
hoverUpdate(true)
|
} else {
|
||||||
lastTapElement = hoverUpdate
|
hoverUpdate(true)
|
||||||
|
lastTapElement = hoverUpdate
|
||||||
|
}
|
||||||
}
|
}
|
||||||
}
|
})
|
||||||
})
|
}
|
||||||
node.addEventListener('pointerup', e => {
|
node.addEventListener('pointerup', e => {
|
||||||
e.stopPropagation()
|
e.stopPropagation()
|
||||||
if (e.pointerType === 'mouse') setTimeout(() => hoverUpdate(false))
|
if (e.pointerType === 'mouse') setTimeout(() => hoverUpdate(false))
|
||||||
|
|
|
||||||
|
|
@ -28,7 +28,7 @@ const announce = [
|
||||||
let storedSettings = {}
|
let storedSettings = {}
|
||||||
|
|
||||||
// HACK: this is https only, but electron doesnt run in https
|
// HACK: this is https only, but electron doesnt run in https
|
||||||
if (!globalThis.FileSystemFileHandle) global.FileSystemFileHandle = false
|
if (!globalThis.FileSystemFileHandle) globalThis.FileSystemFileHandle = false
|
||||||
|
|
||||||
try {
|
try {
|
||||||
storedSettings = JSON.parse(localStorage.getItem('settings')) || {}
|
storedSettings = JSON.parse(localStorage.getItem('settings')) || {}
|
||||||
|
|
|
||||||
Loading…
Reference in a new issue