-
-
Notifications
You must be signed in to change notification settings - Fork 234
fix :huawei touch not working #101
New issue
Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.
By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.
Already on GitHub? Sign in to your account
base: main
Are you sure you want to change the base?
Conversation
Someone is attempting to deploy a commit to a Personal Account owned by @pacexy on Vercel. @pacexy first needs to authorize it. |
The latest updates on your projects. Learn more about Vercel for Git ↗︎
|
apps/reader/src/file.ts
Outdated
return ( | ||
book ?? | ||
fetch(url) | ||
fetch(proxyGithubUrl(url)) |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
why add this?
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Without this, download book from Github will occur CORS error.
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
It's better to move this to a new PR, but idk if we actually need this.
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
ok, I delete these code.
This reverts commit 9bbe1bc.
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
I would like to merge this PR. Could you explain with comments why addEventListener is needed?
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Pull Request Overview
Fixes touch navigation issues on Huawei devices by refactoring touch event handling into a reusable hook and adding a 'touchend' event listener. Additionally improves filename handling by URL-decoding filenames and exports a previously internal type.
- Extracts touch event logic from Reader component into dedicated
useTouchEvent
hook - Adds dual event listener approach for 'touchend' events to address Huawei device compatibility
- URL-decodes filenames in book fetching logic
Reviewed Changes
Copilot reviewed 5 out of 5 changed files in this pull request and generated 3 comments.
Show a summary per file
File | Description |
---|---|
apps/reader/src/models/reader.ts | Exports AsRef type for use in other modules |
apps/reader/src/hooks/useTouchEvent.ts | New hook implementing touch event handling with dual listener approach |
apps/reader/src/hooks/index.ts | Exports the new useTouchEvent hook |
apps/reader/src/file.ts | URL-decodes filenames when fetching books |
apps/reader/src/components/Reader.tsx | Replaces inline touch handling with useTouchEvent hook |
Tip: Customize your code reviews with copilot-instructions.md. Create the file or learn how to get started.
function (e: TouchEvent) { | ||
if (!iframe) return | ||
iframe.ontouchend = undefined | ||
console.log('params:', params.current) |
Copilot
AI
Sep 19, 2025
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Remove console.log statement from production code. This debug logging should be removed or replaced with proper logging.
console.log('params:', params.current) | |
Copilot uses AI. Check for mistakes.
// so instead of use `addEventlistener`, we should use `on*` | ||
// to remove the previous listener. | ||
iframe.ontouchend = handleTouchEnd |
Copilot
AI
Sep 19, 2025
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Potential race condition: Setting iframe.ontouchend
directly overwrites any existing handler. Consider checking if a handler already exists or use a more robust event management approach.
// so instead of use `addEventlistener`, we should use `on*` | |
// to remove the previous listener. | |
iframe.ontouchend = handleTouchEnd | |
// but we should not overwrite existing handlers. Use event listeners instead. |
Copilot uses AI. Check for mistakes.
Co-authored-by: Copilot <175728472+Copilot@users.noreply.github.com>
Touching to go next/prev page not working in the Huawei landtop, add an addEventListener of 'touchene'