From a477f3aaba6a75ff462b62cf93f51b31a162d955 Mon Sep 17 00:00:00 2001 From: Tuomas Airaksinen Date: Fri, 16 Jun 2023 21:32:00 +0300 Subject: [PATCH] Show window id in UI in beta mode (if errorbox is enabled) --- app/bibleview-js/src/components/BibleView.vue | 19 +++++++++++++++++++ app/bibleview-js/src/composables/config.ts | 2 ++ .../android/control/page/window/Window.kt | 2 +- .../android/view/activity/page/BibleView.kt | 3 ++- .../net/bible/service/common/CommonUtils.kt | 2 +- 5 files changed, 25 insertions(+), 3 deletions(-) diff --git a/app/bibleview-js/src/components/BibleView.vue b/app/bibleview-js/src/components/BibleView.vue index 983ec4d000..3ffa7f6f26 100644 --- a/app/bibleview-js/src/components/BibleView.vue +++ b/app/bibleview-js/src/components/BibleView.vue @@ -25,6 +25,7 @@ +
{{appSettings.windowId}}
@@ -484,4 +485,22 @@ a { text-decoration: none; display: inline-block; } + +.window-id { + top: var(--top-offset); + position: fixed; + padding: 0.5em; + color: red; + + [dir=ltr] & { + right: 0; + } + + [dir=rtl] & { + left: 0; + } + + width: 5em; + height: 1em; +} diff --git a/app/bibleview-js/src/composables/config.ts b/app/bibleview-js/src/composables/config.ts index f38cc53c4b..bfca825628 100644 --- a/app/bibleview-js/src/composables/config.ts +++ b/app/bibleview-js/src/composables/config.ts @@ -102,6 +102,7 @@ export type AppSettings = { hasActiveIndicator: boolean, activeSince: number, limitAmbiguousModalSize: boolean, + windowId: IdType, } export type CalculatedConfig = Ref<{ @@ -175,6 +176,7 @@ export function useConfig(documentType: Ref) { hasActiveIndicator: false, activeSince: 0, limitAmbiguousModalSize: false, + windowId: "", }); function calcMmInPx() { diff --git a/app/src/main/java/net/bible/android/control/page/window/Window.kt b/app/src/main/java/net/bible/android/control/page/window/Window.kt index 749101b53a..f6e49406fe 100644 --- a/app/src/main/java/net/bible/android/control/page/window/Window.kt +++ b/app/src/main/java/net/bible/android/control/page/window/Window.kt @@ -72,7 +72,7 @@ class Window ( val isPrimaryLinksWindow get() = isLinksWindow && id == windowRepository.primaryTargetLinksWindowId val id = entity.id - val displayId = id.toString().substring(0, 4) + val displayId = id.toString().substring(0, 5) var weight: Float get() = diff --git a/app/src/main/java/net/bible/android/view/activity/page/BibleView.kt b/app/src/main/java/net/bible/android/view/activity/page/BibleView.kt index eb48ab05fa..9d37d5a7d0 100644 --- a/app/src/main/java/net/bible/android/view/activity/page/BibleView.kt +++ b/app/src/main/java/net/bible/android/view/activity/page/BibleView.kt @@ -1123,8 +1123,9 @@ class BibleView(val mainBibleActivity: MainBibleActivity, recentLabels: $recentLabels, hideCompareDocuments: $hideCompareDocuments, limitAmbiguousModalSize: $limitAmbiguousModalSize, + windowId: '${window.displayId}', }, - initial: $initial + initial: $initial, }); """ } diff --git a/app/src/main/java/net/bible/service/common/CommonUtils.kt b/app/src/main/java/net/bible/service/common/CommonUtils.kt index 3b9004d5d3..3a5bc3da7e 100644 --- a/app/src/main/java/net/bible/service/common/CommonUtils.kt +++ b/app/src/main/java/net/bible/service/common/CommonUtils.kt @@ -278,7 +278,7 @@ object CommonUtils : CommonUtilsBase() { val isBeta: Boolean get() { val verFull = applicationVersionName val ver = verFull.split("#")[0] - return ver.endsWith("-beta") or ver.endsWith("-alpha") + return ver.endsWith("-beta") || ver.endsWith("-alpha") || application.packageName.endsWith(".next") || isDebugMode } val applicationVersionNumber: Int