mirror of
https://github.com/nextcloud/desktop.git
synced 2024-11-29 04:08:54 +03:00
Add method to fileproviderxpc to check if the file provider extension is reachable
Signed-off-by: Claudio Cambra <claudio.cambra@nextcloud.com>
This commit is contained in:
parent
d3d19fd2bf
commit
ea0ae333d9
2 changed files with 18 additions and 0 deletions
|
@ -34,6 +34,8 @@ class FileProviderXPC : public QObject
|
||||||
public:
|
public:
|
||||||
explicit FileProviderXPC(QObject *parent = nullptr);
|
explicit FileProviderXPC(QObject *parent = nullptr);
|
||||||
|
|
||||||
|
[[nodiscard]] bool fileProviderExtReachable(const QString &extensionAccountId) const;
|
||||||
|
|
||||||
// Returns enabled and set state of fast enumeration for the given extension
|
// Returns enabled and set state of fast enumeration for the given extension
|
||||||
[[nodiscard]] std::optional<std::pair<bool, bool>> fastEnumerationStateForExtension(const QString &extensionAccountId) const;
|
[[nodiscard]] std::optional<std::pair<bool, bool>> fastEnumerationStateForExtension(const QString &extensionAccountId) const;
|
||||||
|
|
||||||
|
|
|
@ -141,6 +141,22 @@ void FileProviderXPC::createDebugArchiveForExtension(const QString &extensionAcc
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
|
bool FileProviderXPC::fileProviderExtReachable(const QString &extensionAccountId) const
|
||||||
|
{
|
||||||
|
const auto service = (NSObject<ClientCommunicationProtocol> *)_clientCommServices.value(extensionAccountId);
|
||||||
|
if (service == nil) {
|
||||||
|
return false;
|
||||||
|
}
|
||||||
|
__block auto response = false;
|
||||||
|
dispatch_semaphore_t semaphore = dispatch_semaphore_create(0);
|
||||||
|
[service getExtensionAccountIdWithCompletionHandler:^(NSString *const, NSError *const) {
|
||||||
|
response = true;
|
||||||
|
dispatch_semaphore_signal(semaphore);
|
||||||
|
}];
|
||||||
|
dispatch_semaphore_wait(semaphore, dispatch_time(DISPATCH_TIME_NOW, semaphoreWaitDelta));
|
||||||
|
return response;
|
||||||
|
}
|
||||||
|
|
||||||
std::optional<std::pair<bool, bool>> FileProviderXPC::fastEnumerationStateForExtension(const QString &extensionAccountId) const
|
std::optional<std::pair<bool, bool>> FileProviderXPC::fastEnumerationStateForExtension(const QString &extensionAccountId) const
|
||||||
{
|
{
|
||||||
qCInfo(lcFileProviderXPC) << "Checking if fast enumeration is enabled for extension" << extensionAccountId;
|
qCInfo(lcFileProviderXPC) << "Checking if fast enumeration is enabled for extension" << extensionAccountId;
|
||||||
|
|
Loading…
Reference in a new issue