Skip to content

Commit

Permalink
CU-861n8yh4d Show migration dialogue when Legacy CE servers version i…
Browse files Browse the repository at this point in the history
…s lower than 2023.2.0
  • Loading branch information
iiLubos committed Sep 14, 2023
1 parent 77f8c75 commit f63dbf1
Show file tree
Hide file tree
Showing 5 changed files with 34 additions and 0 deletions.
5 changes: 5 additions & 0 deletions app/inputhelp.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -136,6 +136,11 @@ QString InputHelp::whatsNewPostLink() const
return inputWeb + "/blog/introducing-workspaces-simplified-collaboration" + utmTagOther;
}

QString InputHelp::migrationGuides() const
{
return helpRoot + "/dev/ce-migration/" + utmTagHelp;
}

bool InputHelp::submitReportPending() const
{
return mSubmitReportPending;
Expand Down
2 changes: 2 additions & 0 deletions app/inputhelp.h
Original file line number Diff line number Diff line change
Expand Up @@ -40,6 +40,7 @@ class InputHelp: public QObject
Q_PROPERTY( QString merginTermsLink READ merginTermsLink NOTIFY linkChanged )
Q_PROPERTY( QString projectLoadingErrorHelpLink READ projectLoadingErrorHelpLink NOTIFY linkChanged )
Q_PROPERTY( QString whatsNewPostLink READ whatsNewPostLink NOTIFY linkChanged )
Q_PROPERTY( QString migrationGuides READ migrationGuides CONSTANT )

//! When adding new link, make sure you also create unit test for it in TestLinks

Expand Down Expand Up @@ -73,6 +74,7 @@ class InputHelp: public QObject
QString merginTermsLink() const;
QString projectLoadingErrorHelpLink() const;
QString whatsNewPostLink() const;
QString migrationGuides() const;

bool submitReportPending() const;
/**
Expand Down
18 changes: 18 additions & 0 deletions app/qml/main.qml
Original file line number Diff line number Diff line change
Expand Up @@ -643,6 +643,20 @@ ApplicationWindow {
}
}

MessageDialog {
id: migrationDialog

onAccepted: migrationDialog.close()
text: qsTr("Your server will soon be out of date \n\n Please contact your server administrator to upgrade your server to the latest version. Subsequent releases of our mobile app may not be compatible with your current server version.")
buttons: MessageDialog.Close | MessageDialog.Help
onButtonClicked: function(clickedButton) {
if (clickedButton === MessageDialog.Help) {
Qt.openUrlExternally(__inputHelp.migrationGuides)
}
close()
}
}

FormsStackManager {
id: formsStackManager

Expand Down Expand Up @@ -773,6 +787,10 @@ ApplicationWindow {
map.mapSettings.extentChanged()
}
}

function onMigrationRequested() {
migrationDialog.open()
}
}

Connections {
Expand Down
6 changes: 6 additions & 0 deletions core/merginapi.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -1364,6 +1364,11 @@ void MerginApi::checkMerginVersion( QString apiVersion, bool serverSupportsSubsc
{
setApiVersionStatus( MerginApiStatus::INCOMPATIBLE );
}

if ( ( MERGIN_SERVER_VERSION_MAJOR == major && MERGIN_SERVER_VERSION_MINOR > minor ) || ( MERGIN_SERVER_VERSION_MAJOR > major ) )
{
emit migrationRequested();
}
}
else
{
Expand Down Expand Up @@ -3363,6 +3368,7 @@ void MerginApi::getServerConfigReplyFinished()
if ( statusCode == 404 ) // legacy (old) server
{
setServerType( MerginServerType::OLD );
emit migrationRequested();
}
else
{
Expand Down
3 changes: 3 additions & 0 deletions core/merginapi.h
Original file line number Diff line number Diff line change
Expand Up @@ -370,6 +370,8 @@ class MerginApi: public QObject

static const int MERGIN_API_VERSION_MAJOR = 2020;
static const int MERGIN_API_VERSION_MINOR = 4;
static const int MERGIN_SERVER_VERSION_MAJOR = 2023;
static const int MERGIN_SERVER_VERSION_MINOR = 2;
static const QString sMetadataFile;
static const QString sMetadataFolder;
static const QString sMerginConfigFile;
Expand Down Expand Up @@ -567,6 +569,7 @@ class MerginApi: public QObject

void storageLimitReached( qreal uploadSize );
void projectLimitReached( int maxProjects, const QString &message );
void migrationRequested();
void notify( const QString &message );
void authRequested();
void authChanged();
Expand Down

1 comment on commit f63dbf1

@inputapp-bot
Copy link
Collaborator

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

iOS - version 23.09.456311 just submitted!

Please sign in to comment.