mirror of
https://github.com/nextcloud/desktop.git
synced 2025-10-26 11:17:43 +00:00
Simplify and clarify utility of socket system for file provider
Signed-off-by: Claudio Cambra <claudio.cambra@nextcloud.com>
This commit is contained in:
parent
a01e55272a
commit
a44454daf8
@ -112,7 +112,6 @@ void FileProviderSocketController::sendMessage(const QString &message) const
|
||||
}
|
||||
}
|
||||
|
||||
|
||||
void FileProviderSocketController::start()
|
||||
{
|
||||
Q_ASSERT(_socket);
|
||||
@ -121,6 +120,12 @@ void FileProviderSocketController::start()
|
||||
return;
|
||||
}
|
||||
|
||||
/*
|
||||
* We have a new file provider extension connection. When this happens, we:
|
||||
* 1. Request the file provider domain identifier
|
||||
* 2. Receive the file provider domain identifier from the extension
|
||||
* 3. Send the account details to the extension according to the domain identifier
|
||||
*/
|
||||
requestFileProviderDomainInfo();
|
||||
}
|
||||
|
||||
@ -181,7 +186,11 @@ void FileProviderSocketController::sendAccountDetails() const
|
||||
qCDebug(lcFileProviderSocketController) << "About to send account details to file provider extension"
|
||||
<< account->displayName();
|
||||
|
||||
connect(_accountState.data(), &AccountState::stateChanged, this, &FileProviderSocketController::slotAccountStateChanged, Qt::UniqueConnection);
|
||||
// Even though we have XPC send over the account details and related calls when the account state changes, in the
|
||||
// brief window where we start the file provider extension on app startup and the account state changes, we need to
|
||||
// be able to send over the details when the account is done getting configured.
|
||||
connect(_accountState.data(), &AccountState::stateChanged,
|
||||
this, &FileProviderSocketController::slotAccountStateChanged, Qt::UniqueConnection);
|
||||
|
||||
if (!_accountState->isConnected()) {
|
||||
qCDebug(lcFileProviderSocketController) << "Not sending account details yet as account is not connected"
|
||||
|
||||
@ -26,6 +26,19 @@ using FileProviderSocketControllerPtr = QPointer<FileProviderSocketController>;
|
||||
|
||||
QString fileProviderSocketPath();
|
||||
|
||||
/*
|
||||
* Establishes communication between the app and the file provider extension.
|
||||
* This is done via a local socket server.
|
||||
* Note that this should be used for extension->client communication.
|
||||
*
|
||||
* We can communicate bidirectionally, but the File Provider XPC API is a better interface for this as we cannot account
|
||||
* for the lifetime of a file provider extension when using sockets, and cannot control this on the client side.
|
||||
* Use FileProviderXPC for client->extension communication when possible.
|
||||
*
|
||||
* This socket system is critical for the file provider extensions to be able to request authentication details.
|
||||
*
|
||||
* TODO: This should rewritten to use XPC instead of sockets
|
||||
*/
|
||||
class FileProviderSocketServer : public QObject
|
||||
{
|
||||
Q_OBJECT
|
||||
|
||||
Loading…
Reference in New Issue
Block a user