mirror of
https://github.com/nextcloud/desktop.git
synced 2025-10-26 11:17:43 +00:00
Fix the logic to determine update channels available, default value and what info to show the user.
Signed-off-by: Camila Ayres <hello@camilasan.com>
This commit is contained in:
parent
0663282b2b
commit
e51324dc9a
@ -281,11 +281,7 @@ void GeneralSettings::loadMiscSettings()
|
||||
_ui->monoIconsCheckBox->setChecked(cfgFile.monoIcons());
|
||||
|
||||
#if defined(BUILD_UPDATER)
|
||||
auto validUpdateChannels = cfgFile.validUpdateChannels();
|
||||
if (const auto serverHasValidSubscription = cfgFile.serverHasValidSubscription();
|
||||
serverHasValidSubscription && !Theme::instance()->isBranded()) {
|
||||
validUpdateChannels << QStringLiteral("enterprise");
|
||||
}
|
||||
const auto validUpdateChannels = cfgFile.validUpdateChannels();
|
||||
_ui->updateChannel->addItems(validUpdateChannels);
|
||||
const auto currentUpdateChannelIndex = validUpdateChannels.indexOf(cfgFile.currentUpdateChannel());
|
||||
_ui->updateChannel->setCurrentIndex(currentUpdateChannelIndex != -1? currentUpdateChannelIndex : 0);
|
||||
@ -386,12 +382,14 @@ void GeneralSettings::slotUpdateChannelChanged()
|
||||
}
|
||||
};
|
||||
|
||||
ConfigFile configFile;
|
||||
const auto channel = updateChannelFromLocalized(_ui->updateChannel->currentIndex());
|
||||
if (channel == ConfigFile().currentUpdateChannel()) {
|
||||
if (channel == configFile.currentUpdateChannel()) {
|
||||
return;
|
||||
}
|
||||
|
||||
const auto enterprise = _ui->updateChannel->count() > 3 ? "- enterprise: contains stable versions for customers.\n" : "";
|
||||
const auto enterprise = configFile.validUpdateChannels().contains("enterprise") ? "- enterprise: contains stable versions for customers.\n"
|
||||
: "";
|
||||
auto msgBox = new QMessageBox(
|
||||
QMessageBox::Warning,
|
||||
tr("Changing update channel?"),
|
||||
|
||||
@ -110,8 +110,9 @@ static constexpr char forceLoginV2C[] = "forceLoginV2";
|
||||
static constexpr char certPath[] = "http_certificatePath";
|
||||
static constexpr char certPasswd[] = "http_certificatePasswd";
|
||||
|
||||
static const QStringList validUpdateChannelsList { QStringLiteral("stable"), QStringLiteral("beta"), QStringLiteral("daily") };
|
||||
static constexpr char defaultUpdateChannelName[] = "stable";
|
||||
static const QStringList defaultUpdateChannelsList { QStringLiteral("stable"), QStringLiteral("beta"), QStringLiteral("daily") };
|
||||
static constexpr QString defaultUpdateChannelName = "stable";
|
||||
static constexpr char defaultEnterpriseChannel[] = "enterprise";
|
||||
static constexpr char serverHasValidSubscriptionC[] = "serverHasValidSubscription";
|
||||
static constexpr char desktopEnterpriseChannelName[] = "desktopEnterpriseChannel";
|
||||
}
|
||||
@ -691,18 +692,32 @@ int ConfigFile::updateSegment() const
|
||||
|
||||
QStringList ConfigFile::validUpdateChannels() const
|
||||
{
|
||||
return validUpdateChannelsList;
|
||||
auto updateChannelsList = defaultUpdateChannelsList;
|
||||
if (serverHasValidSubscription() && !Theme::instance()->isBranded()) {
|
||||
updateChannelsList << defaultEnterpriseChannel;
|
||||
}
|
||||
|
||||
return updateChannelsList;
|
||||
}
|
||||
|
||||
QString ConfigFile::defaultUpdateChannel() const
|
||||
{
|
||||
auto defaultUpdateChannel = defaultUpdateChannelName;
|
||||
if (serverHasValidSubscription() && !Theme::instance()->isBranded()) {
|
||||
if (const auto serverChannel = desktopEnterpriseChannel();
|
||||
validUpdateChannels().contains(serverChannel)) {
|
||||
qCWarning(lcConfigFile()) << "Enforcing update channel" << serverChannel << "because that is the desktop enterprise channel returned by the server.";
|
||||
defaultUpdateChannel = serverChannel;
|
||||
}
|
||||
}
|
||||
|
||||
if (const auto currentVersionSuffix = Theme::instance()->versionSuffix();
|
||||
validUpdateChannels().contains(currentVersionSuffix)) {
|
||||
qCWarning(lcConfigFile()) << "Enforcing update channel" << currentVersionSuffix << "because of the version suffix of the current client.";
|
||||
return currentVersionSuffix;
|
||||
defaultUpdateChannel = currentVersionSuffix;
|
||||
}
|
||||
|
||||
return defaultUpdateChannelName;
|
||||
return defaultUpdateChannel;
|
||||
}
|
||||
|
||||
QString ConfigFile::currentUpdateChannel() const
|
||||
|
||||
Loading…
Reference in New Issue
Block a user