mirror of
https://github.com/nextcloud/desktop.git
synced 2024-11-26 06:55:59 +03:00
Submit tasks to do after readding file provider domain as completion blocks
Signed-off-by: Claudio Cambra <claudio.cambra@nextcloud.com>
This commit is contained in:
parent
002a75bca1
commit
89d48ec8cc
1 changed files with 49 additions and 37 deletions
|
@ -290,7 +290,7 @@ class FileProviderDomainManager::Private {
|
|||
Q_ASSERT(account);
|
||||
|
||||
const auto domainId = domainIdentifierForAccount(account);
|
||||
qCDebug(lcMacFileProviderDomainManager) << "Removing file provider domain with id: " << domainId;
|
||||
qCDebug(lcMacFileProviderDomainManager) << "Disconnecting file provider domain with id: " << domainId;
|
||||
|
||||
if(!_registeredDomains.contains(domainId)) {
|
||||
qCDebug(lcMacFileProviderDomainManager) << "File provider domain not found for id: " << domainId;
|
||||
|
@ -301,11 +301,7 @@ class FileProviderDomainManager::Private {
|
|||
Q_ASSERT(fileProviderDomain != nil);
|
||||
|
||||
NSFileProviderManager * const fpManager = [NSFileProviderManager managerForDomain:fileProviderDomain];
|
||||
if (fpManager == nil) {
|
||||
readdFileProviderDomain(fileProviderDomain);
|
||||
return;
|
||||
}
|
||||
|
||||
void (^disconnectBlock)(void) = ^{
|
||||
[fpManager disconnectWithReason:message.toNSString()
|
||||
options:NSFileProviderManagerDisconnectionOptionsTemporary
|
||||
completionHandler:^(NSError * const error) {
|
||||
|
@ -320,6 +316,14 @@ class FileProviderDomainManager::Private {
|
|||
qCDebug(lcMacFileProviderDomainManager) << "Successfully disconnected file provider domain: "
|
||||
<< fileProviderDomain.displayName;
|
||||
}];
|
||||
};
|
||||
|
||||
if (fpManager == nil) {
|
||||
readdFileProviderDomain(fileProviderDomain, disconnectBlock);
|
||||
return;
|
||||
}
|
||||
|
||||
disconnectBlock();
|
||||
}
|
||||
|
||||
void reconnectFileProviderDomainForAccount(const AccountState * const accountState)
|
||||
|
@ -329,7 +333,7 @@ class FileProviderDomainManager::Private {
|
|||
Q_ASSERT(account);
|
||||
|
||||
const auto domainId = domainIdentifierForAccount(account);
|
||||
qCDebug(lcMacFileProviderDomainManager) << "Removing file provider domain with id: " << domainId;
|
||||
qCDebug(lcMacFileProviderDomainManager) << "Reconnecting file provider domain with id: " << domainId;
|
||||
|
||||
if(!_registeredDomains.contains(domainId)) {
|
||||
qCDebug(lcMacFileProviderDomainManager) << "File provider domain not found for id: " << domainId;
|
||||
|
@ -340,11 +344,7 @@ class FileProviderDomainManager::Private {
|
|||
Q_ASSERT(fileProviderDomain != nil);
|
||||
|
||||
NSFileProviderManager * const fpManager = [NSFileProviderManager managerForDomain:fileProviderDomain];
|
||||
if (fpManager == nil) {
|
||||
readdFileProviderDomain(fileProviderDomain);
|
||||
return;
|
||||
}
|
||||
|
||||
void (^reconnectBlock)(void) = ^{
|
||||
[fpManager reconnectWithCompletionHandler:^(NSError * const error) {
|
||||
if (error) {
|
||||
qCDebug(lcMacFileProviderDomainManager) << "Error reconnecting file provider domain: "
|
||||
|
@ -357,6 +357,14 @@ class FileProviderDomainManager::Private {
|
|||
qCDebug(lcMacFileProviderDomainManager) << "Successfully reconnected file provider domain: "
|
||||
<< fileProviderDomain.displayName;
|
||||
}];
|
||||
};
|
||||
|
||||
if (fpManager == nil) {
|
||||
readdFileProviderDomain(fileProviderDomain, reconnectBlock);
|
||||
return;
|
||||
}
|
||||
|
||||
reconnectBlock();
|
||||
}
|
||||
|
||||
void signalEnumeratorChanged(const Account * const account)
|
||||
|
@ -375,17 +383,21 @@ class FileProviderDomainManager::Private {
|
|||
Q_ASSERT(fileProviderDomain != nil);
|
||||
|
||||
NSFileProviderManager * const fpManager = [NSFileProviderManager managerForDomain:fileProviderDomain];
|
||||
if (fpManager == nil) {
|
||||
readdFileProviderDomain(fileProviderDomain);
|
||||
return;
|
||||
}
|
||||
|
||||
void (^signalEnumeratorBlock)(void) = ^{
|
||||
[fpManager signalEnumeratorForContainerItemIdentifier:NSFileProviderWorkingSetContainerItemIdentifier completionHandler:^(NSError * const error) {
|
||||
if (error != nil) {
|
||||
qCDebug(lcMacFileProviderDomainManager) << "Error signalling enumerator changed for working set:"
|
||||
<< error.localizedDescription;
|
||||
}
|
||||
}];
|
||||
};
|
||||
|
||||
if (fpManager == nil) {
|
||||
readdFileProviderDomain(fileProviderDomain, signalEnumeratorBlock);
|
||||
return;
|
||||
}
|
||||
|
||||
signalEnumeratorBlock();
|
||||
}
|
||||
|
||||
private:
|
||||
|
|
Loading…
Reference in a new issue