Save serverHasValidsubcription in the account.

Signed-off-by: Camila Ayres <hello@camilasan.com>
This commit is contained in:
Camila Ayres 2024-10-17 18:40:06 +02:00
Родитель 664a13189b
Коммит d0f87c3496
Не найден ключ, соответствующий данной подписи
Идентификатор ключа GPG: 7A4A6121E88E2AD4
3 изменённых файлов: 24 добавлений и 4 удалений

Просмотреть файл

@ -338,7 +338,7 @@ void AccountManager::saveAccountHelper(Account *acc, QSettings &settings, bool s
settings.setValue(QLatin1String(serverVersionC), acc->_serverVersion);
settings.setValue(QLatin1String(serverColorC), acc->_serverColor);
settings.setValue(QLatin1String(serverTextColorC), acc->_serverTextColor);
settings.setValue(QLatin1String(serverHasValidSubscriptionC), acc->capabilities().serverHasValidSubscription());
settings.setValue(QLatin1String(serverHasValidSubscriptionC), acc->serverHasValidSubscription());
if (!acc->_skipE2eeMetadataChecksumValidation) {
settings.remove(QLatin1String(skipE2eeMetadataChecksumValidationC));

Просмотреть файл

@ -1076,13 +1076,28 @@ void Account::setAskUserForMnemonic(const bool ask)
emit askUserForMnemonicChanged();
}
bool Account::serverHasValidSubscription() const
{
return _serverHasValidSubscription;
}
void Account::setServerHasValidSubscription(bool valid)
{
if (_serverHasValidSubscription != valid) {
_serverHasValidSubscription = valid;
}
}
void Account::updateServerSubcription()
{
ConfigFile currentConfig;
if (const auto serverHasValidSubscription = _capabilities.serverHasValidSubscription();
serverHasValidSubscription != currentConfig.serverHasValidSubscription() && !serverHasValidSubscription) {
currentConfig.setServerHasValidSubscription(serverHasValidSubscription);
const auto capabilityValidSubscription = _capabilities.serverHasValidSubscription();
const auto configValidSubscription = currentConfig.serverHasValidSubscription();
if (capabilityValidSubscription != configValidSubscription && !configValidSubscription) {
currentConfig.setServerHasValidSubscription(capabilityValidSubscription);
}
setServerHasValidSubscription(capabilityValidSubscription);
}
void Account::updateDesktopEnterpriseChannel()

Просмотреть файл

@ -409,6 +409,9 @@ public:
[[nodiscard]] unsigned int downloadLimit() const;
void setDownloadLimit(unsigned int kbytes);
[[nodiscard]] bool serverHasValidSubscription() const;
void setServerHasValidSubscription(bool valid);
public slots:
/// Used when forgetting credentials
void clearQNAMCache();
@ -553,6 +556,8 @@ private:
unsigned int _uploadLimit = 0;
unsigned int _downloadLimit = 0;
bool _serverHasValidSubscription = false;
/* IMPORTANT - remove later - FIXME MS@2019-12-07 -->
* TODO: For "Log out" & "Remove account": Remove client CA certs and KEY!
*