GODT-1458: Splash screen and wording.

This commit is contained in:
Jakub
2021-12-09 11:50:42 +01:00
committed by Jakub Cuth
parent ad6b84d4e0
commit f0d05aeb79
12 changed files with 289 additions and 14 deletions

View File

@ -57,7 +57,8 @@ type Bridge struct {
// Bridge's global errors list.
errors []error
lastVersion string
isFirstStart bool
lastVersion string
}
func New(
@ -91,8 +92,7 @@ func New(
)
b := &Bridge{
Users: u,
Users: u,
locations: locations,
settings: setting,
clientManager: clientManager,
@ -100,9 +100,11 @@ func New(
versioner: versioner,
cacheProvider: cacheProvider,
autostart: autostart,
isFirstStart: false,
}
if setting.GetBool(settings.FirstStartKey) {
b.isFirstStart = true
if err := b.SendMetric(metrics.New(metrics.Setup, metrics.FirstStart, metrics.Label(constants.Version))); err != nil {
logrus.WithError(err).Error("Failed to send metric")
}
@ -110,7 +112,6 @@ func New(
if err := b.EnableAutostart(); err != nil {
log.WithError(err).Error("Failed to enable autostart")
}
setting.SetBool(settings.FirstStartKey, false)
}
@ -294,7 +295,14 @@ func (b *Bridge) HasError(err error) bool {
return false
}
// GetLastVersion returns the version which was used in previous execution of Bridge.
// GetLastVersion returns the version which was used in previous execution of
// Bridge.
func (b *Bridge) GetLastVersion() string {
return b.lastVersion
}
// IsFirstStart returns true when Bridge is running for first time or after
// factory reset.
func (b *Bridge) IsFirstStart() bool {
return b.isFirstStart
}

View File

@ -292,9 +292,7 @@ Window {
StackLayout {
anchors.fill: parent
currentIndex: tabBar.currentIndex
anchors.margins: 10
RowLayout {
@ -341,8 +339,6 @@ Window {
ProtonStyle.currentStyle = ProtonStyle.darkStyle
}
}
}
CheckBox {
@ -355,6 +351,16 @@ Window {
}
}
CheckBox {
id: showSplashScreen
colorScheme: root.colorScheme
text: "Show splash screen"
checked: root.showSplashScreen
onCheckedChanged: {
root.showSplashScreen = checked
}
}
Button {
colorScheme: root.colorScheme
//Layout.fillWidth: true
@ -802,6 +808,7 @@ Window {
signal userDisconnected(string username)
signal apiCertIssue()
property bool showSplashScreen: true
function login(username, password) {

View File

@ -98,6 +98,10 @@ ApplicationWindow {
property bool _showSetup: false
currentIndex: {
if (backend.showSplashScreen) {
return 3
}
// show welcome when there are no users or only one non-logged-in user is present
if (backend.users.count === 0) {
return 1
@ -122,7 +126,7 @@ ApplicationWindow {
return 0
}
ContentWrapper {
ContentWrapper { // 0
id: contentWrapper
colorScheme: root.colorScheme
backend: root.backend
@ -136,7 +140,7 @@ ApplicationWindow {
}
}
WelcomeGuide {
WelcomeGuide { // 1
colorScheme: root.colorScheme
backend: root.backend
@ -144,7 +148,7 @@ ApplicationWindow {
Layout.fillWidth: true
}
SetupGuide {
SetupGuide { // 2
id: setupGuide
colorScheme: root.colorScheme
backend: root.backend
@ -163,6 +167,15 @@ ApplicationWindow {
root.showSetup(null,"")
}
}
SplashScreen { // 3
id: splashScreen
colorScheme: root.colorScheme
backend: root.backend
Layout.fillHeight: true
Layout.fillWidth: true
}
}
NotificationPopups {

View File

@ -65,7 +65,7 @@ SettingsView {
id: starttlsButton
colorScheme: root.colorScheme
ButtonGroup.group: protocolSelection
text: qsTr("STARTLS")
text: qsTr("STARTTLS")
}
}

View File

@ -289,7 +289,6 @@ Item {
onLinkActivated: {
Qt.openUrlExternally(link)
}
}
}

View File

@ -0,0 +1,148 @@
// Copyright (c) 2021 Proton Technologies AG
//
// This file is part of ProtonMail Bridge.
//
// ProtonMail Bridge is free software: you can redistribute it and/or modify
// it under the terms of the GNU General Public License as published by
// the Free Software Foundation, either version 3 of the License, or
// (at your option) any later version.
//
// ProtonMail Bridge is distributed in the hope that it will be useful,
// but WITHOUT ANY WARRANTY; without even the implied warranty of
// MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
// GNU General Public License for more details.
//
// You should have received a copy of the GNU General Public License
// along with ProtonMail Bridge. If not, see <https://www.gnu.org/licenses/>.
import QtQml 2.12
import QtQuick 2.13
import QtQuick.Layouts 1.12
import QtQuick.Controls 2.12
import QtQuick.Controls.impl 2.12
import Proton 4.0
Rectangle {
id: root
property ColorScheme colorScheme
property var backend
color: root.colorScheme.background_norm
ColumnLayout {
anchors.centerIn: root
//width: 320
spacing: 20
Label {
Layout.bottomMargin: 12;
Layout.alignment: Qt.AlignHCenter;
colorScheme: root.colorScheme;
text: "What's new in Bridge"
type: Label.Heading
horizontalAlignment: Text.AlignCenter
}
Repeater {
model: ListModel {
ListElement { icon: "ic-illustrative-view-html-code" ; title: qsTr("New interface") ; description: qsTr("Entirely redesigned GUI with more intuitive setup.")}
ListElement { icon: "ic-card-identity" ; title: qsTr("Status view") ; description: qsTr("Important notifications and available storage at a glance.")}
ListElement { icon: "ic-drive" ; title: qsTr("Local cache") ; description: qsTr("New and improved cache for major stability and performance enhancements.")}
}
Item {
implicitWidth: children[0].implicitWidth
implicitHeight: children[0].implicitHeight
RowLayout {
id: row
spacing: 25
Item {
Layout.topMargin: itemTitle.height/2
Layout.alignment: Qt.AlignTop
Layout.preferredWidth: 24
Layout.preferredHeight: 24
ColorImage {
anchors.top: parent.top
anchors.left: parent.left
color: root.colorScheme.interaction_norm
source: "./icons/"+model.icon+".svg"
width: parent.width
sourceSize.width: parent.width
}
}
ColumnLayout {
spacing: 0
Label {
id: itemTitle
colorScheme: root.colorScheme
text: model.title
type: Label.Body_bold
}
Label {
Layout.preferredWidth: 320
colorScheme: root.colorScheme
text: model.description
wrapMode: Text.WordWrap
}
}
}
}
}
Item {
Layout.alignment: Qt.AlignHCenter;
implicitWidth: children[0].width
implicitHeight: children[0].height
RowLayout {
spacing: 10
Label {
colorScheme: root.colorScheme;
text: qsTr("Full release notes")
Layout.alignment: Qt.AlignHCenter
type: Label.LabelType.Body
onLinkActivated: Qt.openUrlExternally(link)
color: root.colorScheme.interaction_norm
}
ColorImage {
color: root.colorScheme.interaction_norm
source: "./icons/ic-external-link.svg"
width: 16
sourceSize.width: 16
}
}
MouseArea {
anchors.fill: parent
cursorShape: Qt.PointingHandCursor
onClicked: Qt.openUrlExternally(root.backend.releaseNotesLink)
}
}
Button {
Layout.topMargin: 12
Layout.fillWidth: true
colorScheme: root.colorScheme
text: "Start using Bridge"
onClicked: root.backend.showSplashScreen = false
}
}
}

View File

@ -0,0 +1,62 @@
<?xml version="1.0" encoding="UTF-8" standalone="no"?>
<svg
width="16"
height="16"
viewBox="0 0 16 16"
fill="none"
version="1.1"
id="svg12"
sodipodi:docname="ic-card-identity.svg"
inkscape:version="1.1.1 (3bf5ae0d25, 2021-09-20, custom)"
xmlns:inkscape="http://www.inkscape.org/namespaces/inkscape"
xmlns:sodipodi="http://sodipodi.sourceforge.net/DTD/sodipodi-0.dtd"
xmlns="http://www.w3.org/2000/svg"
xmlns:svg="http://www.w3.org/2000/svg">
<defs
id="defs16" />
<sodipodi:namedview
id="namedview14"
pagecolor="#505050"
bordercolor="#ffffff"
borderopacity="1"
inkscape:pageshadow="0"
inkscape:pageopacity="0"
inkscape:pagecheckerboard="1"
showgrid="false"
inkscape:zoom="40.25"
inkscape:cx="7.9875776"
inkscape:cy="8"
inkscape:window-width="2556"
inkscape:window-height="1401"
inkscape:window-x="0"
inkscape:window-y="18"
inkscape:window-maximized="1"
inkscape:current-layer="svg12" />
<g
id="ic-card-identity"
transform="translate(0,-3.9095641)">
<g
id="icon">
<path
fill-rule="evenodd"
clip-rule="evenodd"
d="M 5.32,9.64 C 5.96894,9.64404 6.55605,9.25571 6.80626,8.65693 7.05647,8.05815 6.92022,7.36754 6.46134,6.90866 6.00246,6.44978 5.31185,6.31353 4.71307,6.56374 4.11429,6.81395 3.72596,7.40106 3.73,8.05 c 0,0.87813 0.71187,1.59 1.59,1.59 z m 0,-2.19 C 5.61898,7.48884 5.8427,7.74351 5.8427,8.045 5.8427,8.34649 5.61898,8.60116 5.32,8.64 5.02102,8.60116 4.7973,8.34649 4.7973,8.045 4.7973,7.74351 5.02102,7.48884 5.32,7.45 Z"
fill="#0c0c14"
id="path2" />
<path
d="m 9,8 h 4 V 9 H 9 Z"
fill="#0c0c14"
id="path4" />
<path
d="M 13,10 H 9 v 1 h 4 z"
fill="#0c0c14"
id="path6" />
<path
fill-rule="evenodd"
clip-rule="evenodd"
d="M 1,14 V 4 H 15 V 14 Z M 3.64,12.49 V 13 H 7 V 12.49 L 6.1,11.57 H 4.54 Z M 14,13 H 8 V 12.08 L 6.52,10.57 H 4.12 L 2.64,12.08 V 13 H 2 V 5 h 12 z"
fill="#0c0c14"
id="path8" />
</g>
</g>
</svg>

After

Width:  |  Height:  |  Size: 2.1 KiB

View File

@ -0,0 +1,3 @@
<svg width="16" height="17" viewBox="0 0 16 17" fill="none" xmlns="http://www.w3.org/2000/svg">
<path fill-rule="evenodd" clip-rule="evenodd" d="M11.8561 3.06675L13.9015 7.66688H2.09846L4.14391 3.06675H11.8561ZM14 8.68913H2V12.267H14V8.68913ZM12.5 2.04449H3.5L1 7.66688V13.2893H15V7.66688L12.5 2.04449ZM12 10.9381V9.91584H13V10.9381H12ZM10 10.9381H11V9.91584H10V10.9381Z" fill="#0C0C14"/>
</svg>

After

Width:  |  Height:  |  Size: 396 B

View File

@ -0,0 +1,8 @@
<svg width="16" height="16" viewBox="0 0 16 16" fill="none" xmlns="http://www.w3.org/2000/svg">
<g id="ic-illustrative-view-html-code">
<g id="icon">
<path fill-rule="evenodd" clip-rule="evenodd" d="M4.8 9.83C5.017 9.94015 5.25665 9.99835 5.5 10C5.66952 10.0069 5.8389 9.98323 6 9.93C6.67538 9.71289 7.10403 9.04971 7.02464 8.34474C6.94525 7.63978 6.37983 7.08855 5.67308 7.02709C4.96633 6.96564 4.31425 7.411 4.11437 8.09168C3.91448 8.77236 4.22223 9.49957 4.85 9.83H4.8ZM5.06 8.27C5.11328 8.14244 5.21896 8.04404 5.35 8H5.5C5.5806 7.9995 5.65991 8.0202 5.73 8.06C5.85756 8.11328 5.95596 8.21896 6 8.35C6.05001 8.47173 6.05001 8.60827 6 8.73C5.93418 8.87156 5.80363 8.97227 5.65 9C5.52827 9.05001 5.39173 9.05001 5.27 9C5.12844 8.93418 5.02773 8.80363 5 8.65C4.96852 8.5204 4.99012 8.3836 5.06 8.27Z" fill="#0C0C14"/>
<path fill-rule="evenodd" clip-rule="evenodd" d="M1 2V15H15V2H1ZM14 14H2V12.79L4.2 11.49L6.56 12L10.45 10.05L14 12.75V14ZM10.55 8.92L14 11.5V6H2V11.63L4 10.43L6.44 11L10.55 8.92ZM14 5H2V3H10V4H11V3H12V4H13V3H14V5Z" fill="#0C0C14"/>
</g>
</g>
</svg>

After

Width:  |  Height:  |  Size: 1.0 KiB

View File

@ -25,6 +25,7 @@ import (
"os"
"runtime"
"github.com/Masterminds/semver/v3"
qmlLog "github.com/ProtonMail/proton-bridge/internal/frontend/qt/log"
"github.com/therecipe/qt/core"
"github.com/therecipe/qt/qml"
@ -94,3 +95,25 @@ func (f *FrontendQt) initiateQtApplication() error {
return nil
}
func (f *FrontendQt) setShowSplashScreen() {
f.qml.SetShowSplashScreen(false)
// Splash screen should not be shown to new users or after factory reset.
if f.bridge.IsFirstStart() {
return
}
ver, err := semver.NewVersion(f.bridge.GetLastVersion())
if err != nil {
f.log.WithError(err).WithField("last", f.bridge.GetLastVersion()).Debug("Cannot parse last version")
return
}
// Current splash screen contains update on "What's new" in facelift.
// Therefore, it should be shown only if the last used version was less
// than 1.9.0.
if ver.LessThan(semver.MustParse("1.9.0")) {
f.qml.SetShowSplashScreen(true)
}
}

View File

@ -43,6 +43,7 @@ type QMLBackend struct {
_ func() `slot:"restart"`
_ bool `property:showOnStartup`
_ bool `property:showSplashScreen`
_ bool `property:dockIconVisible`
@ -255,6 +256,7 @@ func (q *QMLBackend) setup(f *FrontendQt) {
}()
})
f.setShowSplashScreen()
f.setVersion()
f.setLogsPath()
// release notes link is set by update

View File

@ -90,6 +90,8 @@ type Bridger interface {
IsAutostartEnabled() bool
EnableAutostart() error
DisableAutostart() error
GetLastVersion() string
IsFirstStart() bool
}
type bridgeWrap struct {