stub logs in for web action handler in web reader view Model

This commit is contained in:
Satindar Dhillon 2022-09-26 13:34:18 -07:00
parent 30c6252360
commit 2be59bdf89
5 changed files with 31 additions and 20 deletions

File diff suppressed because one or more lines are too long

View file

@ -114,18 +114,33 @@ class WebReaderViewModel @Inject constructor(
}
fun handleIncomingWebMessage(actionID: String, json: JSONObject) {
Log.d("Loggo", "receive action ID: $actionID, with json values: $json")
// 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),
when (actionID) {
"createHighlight" -> {
Log.d("Loggo", "receive create highlight action: $json")
}
"deleteHighlight" -> {
// { highlightId }
Log.d("Loggo", "receive delete highlight action: $json")
}
"updateHighlight" -> {
Log.d("Loggo", "receive update highlight action: $json")
}
"articleReadingProgress" -> {
Log.d("Loggo", "received article reading progress action: $json")
}
"annotate" -> {
Log.d("Loggo", "received annotate action: $json")
}
"existingHighlightTap" -> {
Log.d("Loggo", "receive create highlight action: $json")
}
"shareHighlight" -> {
// unimplemented
}
else -> {
Log.d("Loggo", "receive unrecognized action of $actionID with json: $json")
}
}
}
fun reset() {

File diff suppressed because one or more lines are too long

View file

@ -79,16 +79,12 @@ export function Article(props: ArticleProps): JSX.Element {
}, [props.articleId, readingProgress])
// Post message to webkit so apple app embeds get progress updates
// TODO: verify if ios still needs this code...seeems to be duplicated
useEffect(() => {
if (typeof window?.webkit != 'undefined') {
window.webkit.messageHandlers.readingProgressUpdate?.postMessage({
progress: readingProgress,
})
} else if (typeof window?.AndroidWebKitMessenger != 'undefined') {
window.AndroidWebKitMessenger.handleIdentifiableMessage(
'readingProgressUpdate',
JSON.stringify({ progress: readingProgress })
)
}
}, [readingProgress])

View file

@ -358,7 +358,7 @@ export function HighlightsLayer(props: HighlightsLayerProps): JSX.Element {
}
window?.AndroidWebKitMessenger?.handleIdentifiableMessage(
'share',
'shareHighlight',
JSON.stringify({
highlightID: focusedHighlight?.id,
})