mirror of
https://github.com/omnivore-app/omnivore.git
synced 2026-03-11 08:54:26 +00:00
Send mutation events from web to native
This commit is contained in:
parent
6daa599b76
commit
7f15f42358
2 changed files with 16 additions and 2 deletions
File diff suppressed because one or more lines are too long
|
|
@ -6,8 +6,15 @@ import { applyStoredTheme } from '@omnivore/web/lib/themeUpdater'
|
|||
import '@omnivore/web/styles/globals.css'
|
||||
import '@omnivore/web/styles/articleInnerStyling.css'
|
||||
|
||||
const mutation = (name, input) => {
|
||||
window?.webkit?.messageHandlers.viewerAction?.postMessage({
|
||||
actionID: name,
|
||||
...input
|
||||
})
|
||||
}
|
||||
|
||||
const App = () => {
|
||||
applyStoredTheme(false) // false to skip serevr sync
|
||||
applyStoredTheme(false)
|
||||
|
||||
return (
|
||||
<>
|
||||
|
|
@ -32,6 +39,13 @@ const App = () => {
|
|||
highlightsBaseURL="https://example.com"
|
||||
fontSize={window.fontSize ?? 18}
|
||||
margin={0}
|
||||
articleMutations={{
|
||||
createHighlightMutation: (input) => mutation('createHighlight', input),
|
||||
deleteHighlightMutation: (highlightId) => mutation('deleteHighlight', { highlightId }),
|
||||
mergeHighlightMutation: (input) => mutation('mergeHighlight', input),
|
||||
updateHighlightMutation: (input) => mutation('updateHighlight', input),
|
||||
articleReadingProgressMutation: (input) => mutation('articleReadingProgress', input),
|
||||
}}
|
||||
/>
|
||||
</VStack>
|
||||
</Box>
|
||||
|
|
|
|||
Loading…
Reference in a new issue