From a37b4e8f60688eafbd7f23bd37e94ce515ffab21 Mon Sep 17 00:00:00 2001 From: timbze Date: Fri, 7 Apr 2023 07:48:39 -0600 Subject: [PATCH 1/3] Fix StepBible link --- app/bibleview-js/src/utils.ts | 6 +++--- 1 file changed, 3 insertions(+), 3 deletions(-) diff --git a/app/bibleview-js/src/utils.ts b/app/bibleview-js/src/utils.ts index 53ee9ef6d4..dc511da900 100644 --- a/app/bibleview-js/src/utils.ts +++ b/app/bibleview-js/src/utils.ts @@ -616,6 +616,6 @@ export function sprintf(format: string, ...args: any[]) { } export function formatExportLink({ref, v11n, doc}: {ref: string, v11n: string, doc?: string}) { - const docStr = doc ? `&document=${doc}`: "" - return `https://stepbible.org/?q=reference=${ref}&v11n=${v11n}${docStr}` -} \ No newline at end of file + const docStr = doc ? `|version=${doc}`: "" + return `https://stepbible.org/?q=reference=${ref}${docStr}&v11n=${v11n}` +} From dab64e06e4524fbd45ebcd837e1759000a3b46eb Mon Sep 17 00:00:00 2001 From: timbze Date: Fri, 7 Apr 2023 10:22:07 -0600 Subject: [PATCH 2/3] Study pad fix link to export with document --- app/bibleview-js/src/components/StudyPadRow.vue | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/app/bibleview-js/src/components/StudyPadRow.vue b/app/bibleview-js/src/components/StudyPadRow.vue index e1a9e7f316..be2cbe750b 100644 --- a/app/bibleview-js/src/components/StudyPadRow.vue +++ b/app/bibleview-js/src/components/StudyPadRow.vue @@ -178,7 +178,7 @@ const bibleUrl = computed( const osis = bookmarkItem.osisRef; if(exportMode.value) { - return formatExportLink({ref: osis, v11n: bookmarkItem.v11n}) + return formatExportLink({ref: osis, v11n: bookmarkItem.v11n, doc: bookmarkItem.bookInitials}); } else { return `osis://?osis=${osis}&v11n=${bookmarkItem.v11n}`; } From 923e94386f962fcb45a76f51e96d9a3f41f47acf Mon Sep 17 00:00:00 2001 From: timbze Date: Sat, 15 Apr 2023 10:25:59 -0600 Subject: [PATCH 3/3] Fix intent parsing for stepbible.org --- app/bibleview-js/src/utils.ts | 1 + .../view/activity/page/MainBibleActivity.kt | 17 ++++++++++------- 2 files changed, 11 insertions(+), 7 deletions(-) diff --git a/app/bibleview-js/src/utils.ts b/app/bibleview-js/src/utils.ts index dc511da900..588a517ffc 100644 --- a/app/bibleview-js/src/utils.ts +++ b/app/bibleview-js/src/utils.ts @@ -617,5 +617,6 @@ export function sprintf(format: string, ...args: any[]) { export function formatExportLink({ref, v11n, doc}: {ref: string, v11n: string, doc?: string}) { const docStr = doc ? `|version=${doc}`: "" + // this is parsed in MainBibleActivity::openLink(uri: Uri) function for intent parsing return `https://stepbible.org/?q=reference=${ref}${docStr}&v11n=${v11n}` } diff --git a/app/src/main/java/net/bible/android/view/activity/page/MainBibleActivity.kt b/app/src/main/java/net/bible/android/view/activity/page/MainBibleActivity.kt index 659b0c1664..589133d651 100644 --- a/app/src/main/java/net/bible/android/view/activity/page/MainBibleActivity.kt +++ b/app/src/main/java/net/bible/android/view/activity/page/MainBibleActivity.kt @@ -1038,18 +1038,21 @@ class MainBibleActivity : CustomTitlebarActivityBase() { windowControl.showLink(doc, key) } "stepbible.org" -> { - val docStr = uri.getQueryParameter("document") - val doc = if (docStr != null) Books.installed().getBook(docStr) else null + val qParam = uri.getQueryParameter("q") ?: return + + val docRegex = Regex("""version=([^&|]+)""") + val refRegex = Regex("""reference=([^&|]+)""") + + val versionMatch = docRegex.find(qParam) + val version = if (versionMatch != null) versionMatch.groups[1]?.value else null + val doc = if (version != null) Books.installed().getBook(version) else null val defV11n = if (doc is SwordBook) doc.versification else KJVA val v11nStr = uri.getQueryParameter("v11n") val v11n = if (v11nStr == null) defV11n else Versifications.instance().getVersification(v11nStr) ?: defV11n - val refStr = uri.getQueryParameter("q")?:return - val refRegex = Regex("""reference=(.*)""") - val match = refRegex.find(refStr) ?: return - - val keyStr = match.groups[1]?.value ?: return + val refMatch = refRegex.find(qParam) ?: return + val keyStr = refMatch.groups[1]?.value ?: return val key = PassageKeyFactory.instance().getKey(v11n, keyStr) windowControl.showLink(doc, key)