Skip to content

Commit 66d6c67

Browse files
authored
Merge pull request #9008 from nextcloud/bugfix/8990/vfs-status-mapping
fix(file-provider): use correct FP domain identifier for sync status check
2 parents 4818fcd + d46bee6 commit 66d6c67

File tree

4 files changed

+23
-4
lines changed

4 files changed

+23
-4
lines changed

src/gui/macOS/fileproviderdomainmanager.h

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -24,7 +24,7 @@ class FileProviderDomainManager : public QObject
2424
~FileProviderDomainManager() override;
2525

2626
static AccountStatePtr accountStateFromFileProviderDomainIdentifier(const QString &domainIdentifier);
27-
static QString fileProviderDomainIdentifierFromAccountState(const AccountStatePtr &accountState);
27+
QString fileProviderDomainIdentifierFromAccountId(const QString &accountId);
2828

2929
void start();
3030
void* domainForAccount(const OCC::AccountState * const accountState);

src/gui/macOS/fileproviderdomainmanager_mac.mm

Lines changed: 19 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -308,6 +308,18 @@ void findExistingFileProviderDomains()
308308
return nil;
309309
}
310310

311+
QString fileProviderDomainIdentifierForAccountId(const QString &accountId)
312+
{
313+
if (@available(macOS 11.0, *)) {
314+
if (_registeredDomains.contains(accountId)) {
315+
const auto fileProviderDomain = _registeredDomains[accountId];
316+
return QString::fromNSString([fileProviderDomain identifier]);
317+
}
318+
}
319+
320+
return {};
321+
}
322+
311323
void addFileProviderDomain(const AccountState * const accountState)
312324
{
313325
if (@available(macOS 11.0, *)) {
@@ -597,6 +609,7 @@ QStringList getAccountIdsOfFoundFileProviderDomains() const
597609
}
598610

599611
private:
612+
//! keys are accountId, i.e. userIdAtHostWithPort
600613
QHash<QString, NSFileProviderDomain*> _registeredDomains;
601614
};
602615

@@ -806,9 +819,13 @@ QStringList getAccountIdsOfFoundFileProviderDomains() const
806819
return accountForReceivedDomainIdentifier;
807820
}
808821

809-
QString FileProviderDomainManager::fileProviderDomainIdentifierFromAccountState(const AccountStatePtr &accountState)
822+
QString FileProviderDomainManager::fileProviderDomainIdentifierFromAccountId(const QString &accountId)
810823
{
811-
return uuidDomainIdentifierForAccount(accountState->account());
824+
if (!d || accountId.isEmpty()) {
825+
return {};
826+
}
827+
828+
return d->fileProviderDomainIdentifierForAccountId(accountId);
812829
}
813830

814831
void* FileProviderDomainManager::domainForAccount(const AccountState * const accountState)

src/gui/macOS/fileproviderxpc.h

Lines changed: 2 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -43,7 +43,9 @@ private slots:
4343
void slotAccountStateChanged(AccountState::State state) const;
4444

4545
private:
46+
//! keys are File Provider domain identifiers
4647
QHash<QString, void*> _clientCommServices;
48+
//! keys are File Provider domain identifiers
4749
QHash<QString, QDateTime> _unreachableFileProviderDomains;
4850
};
4951

src/gui/owncloudgui.cpp

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -318,7 +318,7 @@ void ownCloudGui::slotComputeOverallSyncStatus()
318318
}
319319
allPaused = false;
320320
const auto fileProvider = Mac::FileProvider::instance();
321-
const auto accountFpId = Mac::FileProviderDomainManager::fileProviderDomainIdentifierFromAccountState(accountState);
321+
const auto accountFpId = fileProvider->domainManager()->fileProviderDomainIdentifierFromAccountId(userIdAtHostWithPort);
322322
const auto displayName = account->displayName();
323323
const auto accountTooltipLabel = displayName.isEmpty() ? userIdAtHostWithPort : displayName;
324324

0 commit comments

Comments
 (0)