chore: point VERSION of source dev/builds to GH repo

For these source/dev builds:
- display "git master SHA" as the version number
- disable the "Check for updates" button
- use APP_VERSION in nim

Rationale: instead of updating git master VERSION text file manually each
time an official version is released, we will now mark source/dev builds
with the corresponding git commit hash and display that in the
Settings/About section
This commit is contained in:
Lukáš Tinkl 2023-01-31 16:52:57 +01:00 committed by Lukáš Tinkl
parent 09b5a104ca
commit 34686226d7
5 changed files with 15 additions and 10 deletions

View File

@ -12,9 +12,6 @@ import ../../../constants
logScope:
topics = "about-service"
# This is changed during compilation by reading the VERSION file
const DESKTOP_VERSION {.strdefine.} = "0.0.0"
const APP_UPDATES_ENS* = "desktop.status.eth"
type
@ -48,7 +45,7 @@ QtObject:
result.threadpool = threadpool
proc getAppVersion*(self: Service): string =
return DESKTOP_VERSION
return APP_VERSION
proc getNodeVersion*(self: Service): string =
try:
@ -58,7 +55,7 @@ QtObject:
proc checkForUpdates*(self: Service) =
try:
discard status_about.checkForUpdates(types.Mainnet, APP_UPDATES_ENS, DESKTOP_VERSION)
discard status_about.checkForUpdates(types.Mainnet, APP_UPDATES_ENS, self.getAppVersion())
except Exception as e:
error "Error checking for updates", msg=e.msg

View File

@ -1,4 +1,4 @@
import os, sequtils, strutils
import os, sequtils, strutils, strformat
import # vendor libs
confutils
@ -71,9 +71,11 @@ proc ensureDirectories*(dataDir, tmpDir, logDir: string) =
createDir(logDir)
# This is changed during compilation by reading the VERSION file
const DESKTOP_VERSION* {.strdefine.} = "0.0.0"
const DESKTOP_VERSION {.strdefine.} = "0.0.0"
# This is changed during compilation by executing git command
const GIT_COMMIT* {.strdefine.} = ""
const APP_VERSION* = if defined(production): DESKTOP_VERSION else: fmt("git master {GIT_COMMIT}")
# Name of the test environment var to check for
const TEST_ENVIRONMENT_VAR* = "TEST_ENVIRONMENT"
const TEST_ENVIRONMENT_VAR* = "TEST_ENVIRONMENT"

View File

@ -166,7 +166,7 @@ proc mainProc() =
keycardServiceQObjPointer = cast[pointer](appController.keycardService.vptr)
setupRemoteSignalsHandling()
info fmt("Version: {DESKTOP_VERSION}")
info fmt("Version: {APP_VERSION}")
info fmt("Commit: {GIT_COMMIT}")
info "Current date:", currentDateTime=now()

View File

@ -264,6 +264,8 @@ StatusSectionLayout {
contentWidth: d.contentWidth
store: QtObject {
readonly property bool isProduction: production
function checkForUpdates() {
return root.store.checkForUpdates()
}
@ -273,7 +275,10 @@ StatusSectionLayout {
}
function getReleaseNotes() {
openLink("https://github.com/status-im/status-desktop/releases/%1".arg(getCurrentVersion()))
const link = isProduction ? "https://github.com/status-im/status-desktop/releases/%1".arg(getCurrentVersion()) :
"https://github.com/status-im/status-desktop/"
openLink(link)
}
function openLink(url) {

View File

@ -16,6 +16,7 @@ SettingsContentBase {
property var store
titleRowComponentLoader.active: root.store.isProduction
titleRowComponentLoader.sourceComponent: StatusButton {
size: StatusBaseButton.Size.Small
text: qsTr("Check for updates")