feat: Add status-go version to About screen

- Settings/About now displays the `status-go` version, read from its
`VERSION` file
- use the actual app icon, to differentiate between prod/dev version
- make the version numbers clickable, taking the user to either the
release notes (prod) or the GH commit browser (dev)
- add "Is production" switch to the About page in storybook

Closes #11424
This commit is contained in:
Lukáš Tinkl 2023-07-26 16:34:21 +02:00 committed by Lukáš Tinkl
parent 7e714e33fc
commit 57fc600d5e
11 changed files with 73 additions and 18 deletions

View File

@ -230,8 +230,11 @@ NIM_PARAMS += --outdir:./bin
# App version
VERSIONFILE=VERSION
SGVERSIONFILE=vendor/status-go/VERSION
DESKTOP_VERSION=`cat $(VERSIONFILE)`
STATUSGO_VERSION=`cat $(SGVERSIONFILE)`
NIM_PARAMS += -d:DESKTOP_VERSION="$(DESKTOP_VERSION)"
NIM_PARAMS += -d:STATUSGO_VERSION="$(STATUSGO_VERSION)"
GIT_COMMIT=`git log --pretty=format:'%h' -n 1`
NIM_PARAMS += -d:GIT_COMMIT="$(GIT_COMMIT)"

View File

@ -34,3 +34,6 @@ proc checkForUpdates*(self: Controller) =
proc getNodeVersion*(self: Controller): string =
return self.aboutService.getNodeVersion()
proc getStatusGoVersion*(self: Controller): string =
self.aboutService.getStatusGoVersion()

View File

@ -17,6 +17,9 @@ method getAppVersion*(self: AccessInterface): string {.base.} =
method getNodeVersion*(self: AccessInterface): string {.base.} =
raise newException(ValueError, "No implementation available")
method getStatusGoVersion*(self: AccessInterface): string {.base.} =
raise newException(ValueError, "No implementation available")
method versionFetched*(self: AccessInterface, available: bool, version: string, url: string) {.base.} =
raise newException(ValueError, "No implementation available")

View File

@ -52,6 +52,9 @@ method getAppVersion*(self: Module): string =
method getNodeVersion*(self: Module): string =
return self.controller.getNodeVersion()
method getStatusGoVersion*(self: Module): string =
self.controller.getStatusGoVersion()
method checkForUpdates*(self: Module) =
self.controller.checkForUpdates()

View File

@ -24,6 +24,9 @@ QtObject:
proc nodeVersion*(self: View): string {.slot.} =
return self.delegate.getNodeVersion()
proc getStatusGoVersion*(self: View): string {.slot.} =
return self.delegate.getStatusGoVersion()
proc appVersionFetched*(self: View, available: bool, version: string, url: string) {.signal.}
proc fetchingChanged(self: View) {.signal.}

View File

@ -53,6 +53,9 @@ QtObject:
except Exception as e:
error "Error getting Node version"
proc getStatusGoVersion*(self: Service): string =
STATUSGO_VERSION
proc checkForUpdates*(self: Service) =
try:
discard status_about.checkForUpdates(types.Mainnet, APP_UPDATES_ENS, self.getAppVersion())

View File

@ -81,10 +81,11 @@ proc ensureDirectories*(dataDir, tmpDir, logDir: string) =
# This is changed during compilation by reading the VERSION file
const DESKTOP_VERSION {.strdefine.} = "0.0.0"
const STATUSGO_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}")
const APP_VERSION* = if defined(production): DESKTOP_VERSION else: fmt("{GIT_COMMIT}")
# Name of the test environment var to check for
const TEST_ENVIRONMENT_VAR* = "TEST_ENVIRONMENT"

View File

@ -21,22 +21,33 @@ SplitView {
contentWidth: parent.width
store: QtObject {
readonly property bool isProduction: false
readonly property bool isProduction: ctrlProduction.checked
function checkForUpdates() {
logs.logEvent("store::checkForUpdates")
}
function getCurrentVersion() {
return "storybook-version"
logs.logEvent("store::getCurrentVersion")
return isProduction ? "0.13.2" : "45784cf0c"
}
function getStatusGoVersion() {
logs.logEvent("store::getStatusGoVersion")
return "0.162.9"
}
function getReleaseNotes() {
logs.logEvent("store::getReleaseNotes")
const link = isProduction ? "https://github.com/status-im/status-desktop/releases/tag/%1" :
"https://github.com/status-im/status-desktop/commit/%1"
openLink(link.arg(getCurrentVersion()))
}
function openLink(url) {
logs.logEvent("store::openLink", ["url"], arguments)
Qt.openUrlExternally(url)
}
}
@ -52,13 +63,12 @@ SplitView {
}
}
Control {
Switch {
id: ctrlProduction
SplitView.minimumWidth: 300
SplitView.preferredWidth: 300
font.pixelSize: 13
// model editor will go here
text: "Production"
checked: true
}
}

View File

@ -283,11 +283,15 @@ StatusSectionLayout {
return root.store.getCurrentVersion()
}
function getReleaseNotes() {
const link = isProduction ? "https://github.com/status-im/status-desktop/releases/%1".arg(getCurrentVersion()) :
"https://github.com/status-im/status-desktop/"
function getStatusGoVersion() {
return root.store.getStatusGoVersion()
}
openLink(link)
function getReleaseNotes() {
const link = isProduction ? "https://github.com/status-im/status-desktop/releases/tag/%1" :
"https://github.com/status-im/status-desktop/commit/%1"
openLink(link.arg(getCurrentVersion()))
}
function openLink(url) {

View File

@ -157,6 +157,10 @@ QtObject {
return aboutModuleInst.getCurrentVersion()
}
function getStatusGoVersion() {
return aboutModuleInst.getStatusGoVersion()
}
function nodeVersion() {
return aboutModuleInst.nodeVersion()
}

View File

@ -32,23 +32,23 @@ SettingsContentBase {
Column {
Layout.fillWidth: true
Image {
StatusIcon {
id: statusIcon
width: 80
height: 80
fillMode: Image.PreserveAspectFit
source: Style.png("status-logo")
icon: root.store.isProduction ? Style.svg("status-logo-circle") : Style.svg("status-logo-dev-circle")
anchors.horizontalCenter: parent.horizontalCenter
cache: false
}
Item { width: 1; height: 8}
StatusBaseText {
StatusLinkText {
anchors.horizontalCenter: parent.horizontalCenter
font.pixelSize: 22
font.bold: true
text: root.store.getCurrentVersion()
normalColor: Theme.palette.directColor1
text: (root.store.isProduction ? "" : "git:") + root.store.getCurrentVersion()
onClicked: root.store.getReleaseNotes()
}
StatusBaseText {
@ -59,11 +59,29 @@ SettingsContentBase {
Item { width: 1; height: 17}
StatusLinkText {
anchors.horizontalCenter: parent.horizontalCenter
font.pixelSize: 17
font.bold: true
normalColor: Theme.palette.directColor1
text: root.store.getStatusGoVersion()
onClicked: root.store.openLink("https://github.com/status-im/status-go/tree/v%1".arg(root.store.getStatusGoVersion()))
}
StatusBaseText {
anchors.horizontalCenter: parent.horizontalCenter
font.pixelSize: 13
text: qsTr("Status Go Version")
}
Item { width: 1; height: 17}
StatusButton {
anchors.horizontalCenter: parent.horizontalCenter
size: StatusBaseButton.Size.Small
icon.name: "info"
text: qsTr("Release Notes")
visible: root.store.isProduction
onClicked: {
root.store.getReleaseNotes()
}