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:
parent
7e714e33fc
commit
57fc600d5e
3
Makefile
3
Makefile
|
@ -230,8 +230,11 @@ NIM_PARAMS += --outdir:./bin
|
||||||
|
|
||||||
# App version
|
# App version
|
||||||
VERSIONFILE=VERSION
|
VERSIONFILE=VERSION
|
||||||
|
SGVERSIONFILE=vendor/status-go/VERSION
|
||||||
DESKTOP_VERSION=`cat $(VERSIONFILE)`
|
DESKTOP_VERSION=`cat $(VERSIONFILE)`
|
||||||
|
STATUSGO_VERSION=`cat $(SGVERSIONFILE)`
|
||||||
NIM_PARAMS += -d:DESKTOP_VERSION="$(DESKTOP_VERSION)"
|
NIM_PARAMS += -d:DESKTOP_VERSION="$(DESKTOP_VERSION)"
|
||||||
|
NIM_PARAMS += -d:STATUSGO_VERSION="$(STATUSGO_VERSION)"
|
||||||
|
|
||||||
GIT_COMMIT=`git log --pretty=format:'%h' -n 1`
|
GIT_COMMIT=`git log --pretty=format:'%h' -n 1`
|
||||||
NIM_PARAMS += -d:GIT_COMMIT="$(GIT_COMMIT)"
|
NIM_PARAMS += -d:GIT_COMMIT="$(GIT_COMMIT)"
|
||||||
|
|
|
@ -34,3 +34,6 @@ proc checkForUpdates*(self: Controller) =
|
||||||
|
|
||||||
proc getNodeVersion*(self: Controller): string =
|
proc getNodeVersion*(self: Controller): string =
|
||||||
return self.aboutService.getNodeVersion()
|
return self.aboutService.getNodeVersion()
|
||||||
|
|
||||||
|
proc getStatusGoVersion*(self: Controller): string =
|
||||||
|
self.aboutService.getStatusGoVersion()
|
||||||
|
|
|
@ -17,6 +17,9 @@ method getAppVersion*(self: AccessInterface): string {.base.} =
|
||||||
method getNodeVersion*(self: AccessInterface): string {.base.} =
|
method getNodeVersion*(self: AccessInterface): string {.base.} =
|
||||||
raise newException(ValueError, "No implementation available")
|
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.} =
|
method versionFetched*(self: AccessInterface, available: bool, version: string, url: string) {.base.} =
|
||||||
raise newException(ValueError, "No implementation available")
|
raise newException(ValueError, "No implementation available")
|
||||||
|
|
||||||
|
|
|
@ -52,6 +52,9 @@ method getAppVersion*(self: Module): string =
|
||||||
method getNodeVersion*(self: Module): string =
|
method getNodeVersion*(self: Module): string =
|
||||||
return self.controller.getNodeVersion()
|
return self.controller.getNodeVersion()
|
||||||
|
|
||||||
|
method getStatusGoVersion*(self: Module): string =
|
||||||
|
self.controller.getStatusGoVersion()
|
||||||
|
|
||||||
method checkForUpdates*(self: Module) =
|
method checkForUpdates*(self: Module) =
|
||||||
self.controller.checkForUpdates()
|
self.controller.checkForUpdates()
|
||||||
|
|
||||||
|
|
|
@ -24,6 +24,9 @@ QtObject:
|
||||||
proc nodeVersion*(self: View): string {.slot.} =
|
proc nodeVersion*(self: View): string {.slot.} =
|
||||||
return self.delegate.getNodeVersion()
|
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 appVersionFetched*(self: View, available: bool, version: string, url: string) {.signal.}
|
||||||
|
|
||||||
proc fetchingChanged(self: View) {.signal.}
|
proc fetchingChanged(self: View) {.signal.}
|
||||||
|
|
|
@ -53,6 +53,9 @@ QtObject:
|
||||||
except Exception as e:
|
except Exception as e:
|
||||||
error "Error getting Node version"
|
error "Error getting Node version"
|
||||||
|
|
||||||
|
proc getStatusGoVersion*(self: Service): string =
|
||||||
|
STATUSGO_VERSION
|
||||||
|
|
||||||
proc checkForUpdates*(self: Service) =
|
proc checkForUpdates*(self: Service) =
|
||||||
try:
|
try:
|
||||||
discard status_about.checkForUpdates(types.Mainnet, APP_UPDATES_ENS, self.getAppVersion())
|
discard status_about.checkForUpdates(types.Mainnet, APP_UPDATES_ENS, self.getAppVersion())
|
||||||
|
|
|
@ -81,10 +81,11 @@ proc ensureDirectories*(dataDir, tmpDir, logDir: string) =
|
||||||
|
|
||||||
# This is changed during compilation by reading the VERSION file
|
# This is changed during compilation by reading the VERSION file
|
||||||
const DESKTOP_VERSION {.strdefine.} = "0.0.0"
|
const DESKTOP_VERSION {.strdefine.} = "0.0.0"
|
||||||
|
const STATUSGO_VERSION* {.strdefine.} = "0.0.0"
|
||||||
# This is changed during compilation by executing git command
|
# This is changed during compilation by executing git command
|
||||||
const GIT_COMMIT* {.strdefine.} = ""
|
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
|
# Name of the test environment var to check for
|
||||||
const TEST_ENVIRONMENT_VAR* = "TEST_ENVIRONMENT"
|
const TEST_ENVIRONMENT_VAR* = "TEST_ENVIRONMENT"
|
||||||
|
|
|
@ -21,22 +21,33 @@ SplitView {
|
||||||
contentWidth: parent.width
|
contentWidth: parent.width
|
||||||
|
|
||||||
store: QtObject {
|
store: QtObject {
|
||||||
readonly property bool isProduction: false
|
readonly property bool isProduction: ctrlProduction.checked
|
||||||
|
|
||||||
function checkForUpdates() {
|
function checkForUpdates() {
|
||||||
logs.logEvent("store::checkForUpdates")
|
logs.logEvent("store::checkForUpdates")
|
||||||
}
|
}
|
||||||
|
|
||||||
function getCurrentVersion() {
|
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() {
|
function getReleaseNotes() {
|
||||||
logs.logEvent("store::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) {
|
function openLink(url) {
|
||||||
logs.logEvent("store::openLink", ["url"], arguments)
|
logs.logEvent("store::openLink", ["url"], arguments)
|
||||||
|
Qt.openUrlExternally(url)
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
|
@ -52,13 +63,12 @@ SplitView {
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
Control {
|
Switch {
|
||||||
|
id: ctrlProduction
|
||||||
SplitView.minimumWidth: 300
|
SplitView.minimumWidth: 300
|
||||||
SplitView.preferredWidth: 300
|
SplitView.preferredWidth: 300
|
||||||
|
text: "Production"
|
||||||
font.pixelSize: 13
|
checked: true
|
||||||
|
|
||||||
// model editor will go here
|
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|
|
@ -283,11 +283,15 @@ StatusSectionLayout {
|
||||||
return root.store.getCurrentVersion()
|
return root.store.getCurrentVersion()
|
||||||
}
|
}
|
||||||
|
|
||||||
function getReleaseNotes() {
|
function getStatusGoVersion() {
|
||||||
const link = isProduction ? "https://github.com/status-im/status-desktop/releases/%1".arg(getCurrentVersion()) :
|
return root.store.getStatusGoVersion()
|
||||||
"https://github.com/status-im/status-desktop/"
|
}
|
||||||
|
|
||||||
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) {
|
function openLink(url) {
|
||||||
|
|
|
@ -157,6 +157,10 @@ QtObject {
|
||||||
return aboutModuleInst.getCurrentVersion()
|
return aboutModuleInst.getCurrentVersion()
|
||||||
}
|
}
|
||||||
|
|
||||||
|
function getStatusGoVersion() {
|
||||||
|
return aboutModuleInst.getStatusGoVersion()
|
||||||
|
}
|
||||||
|
|
||||||
function nodeVersion() {
|
function nodeVersion() {
|
||||||
return aboutModuleInst.nodeVersion()
|
return aboutModuleInst.nodeVersion()
|
||||||
}
|
}
|
||||||
|
|
|
@ -32,23 +32,23 @@ SettingsContentBase {
|
||||||
|
|
||||||
Column {
|
Column {
|
||||||
Layout.fillWidth: true
|
Layout.fillWidth: true
|
||||||
Image {
|
StatusIcon {
|
||||||
id: statusIcon
|
id: statusIcon
|
||||||
width: 80
|
width: 80
|
||||||
height: 80
|
height: 80
|
||||||
fillMode: Image.PreserveAspectFit
|
icon: root.store.isProduction ? Style.svg("status-logo-circle") : Style.svg("status-logo-dev-circle")
|
||||||
source: Style.png("status-logo")
|
|
||||||
anchors.horizontalCenter: parent.horizontalCenter
|
anchors.horizontalCenter: parent.horizontalCenter
|
||||||
cache: false
|
|
||||||
}
|
}
|
||||||
|
|
||||||
Item { width: 1; height: 8}
|
Item { width: 1; height: 8}
|
||||||
|
|
||||||
StatusBaseText {
|
StatusLinkText {
|
||||||
anchors.horizontalCenter: parent.horizontalCenter
|
anchors.horizontalCenter: parent.horizontalCenter
|
||||||
font.pixelSize: 22
|
font.pixelSize: 22
|
||||||
font.bold: true
|
font.bold: true
|
||||||
text: root.store.getCurrentVersion()
|
normalColor: Theme.palette.directColor1
|
||||||
|
text: (root.store.isProduction ? "" : "git:") + root.store.getCurrentVersion()
|
||||||
|
onClicked: root.store.getReleaseNotes()
|
||||||
}
|
}
|
||||||
|
|
||||||
StatusBaseText {
|
StatusBaseText {
|
||||||
|
@ -59,11 +59,29 @@ SettingsContentBase {
|
||||||
|
|
||||||
Item { width: 1; height: 17}
|
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 {
|
StatusButton {
|
||||||
anchors.horizontalCenter: parent.horizontalCenter
|
anchors.horizontalCenter: parent.horizontalCenter
|
||||||
size: StatusBaseButton.Size.Small
|
size: StatusBaseButton.Size.Small
|
||||||
icon.name: "info"
|
icon.name: "info"
|
||||||
text: qsTr("Release Notes")
|
text: qsTr("Release Notes")
|
||||||
|
visible: root.store.isProduction
|
||||||
onClicked: {
|
onClicked: {
|
||||||
root.store.getReleaseNotes()
|
root.store.getReleaseNotes()
|
||||||
}
|
}
|
||||||
|
|
Loading…
Reference in New Issue