class FileProviderSocketLineProcessor: NSObject, LineProcessor {
var delegate: FileProviderExtension
- init(delegate: FileProviderExtension) {
+ required init(delegate: FileProviderExtension) {
self.delegate = delegate
}
NSLog("Received command: %@", command)
if (command == "SEND_FILE_PROVIDER_DOMAIN_IDENTIFIER") {
delegate.sendFileProviderDomainIdentifier()
+ } else if (command == "ACCOUNT_NOT_AUTHENTICATED") {
+ delegate.removeAccountConfig()
} else if (command == "ACCOUNT_DETAILS") {
guard let accountDetailsSubsequence = splitLine.last else { return }
let splitAccountDetails = accountDetailsSubsequence.split(separator: "~", maxSplits: 2)
case AccountState::SignedOut:
case AccountState::AskingCredentials:
// Notify File Provider that it should show the not authenticated message
+ sendNotAuthenticated();
break;
case AccountState::Connected:
// Provide credentials
}
}
+void FileProviderSocketController::sendNotAuthenticated() const
+{
+ Q_ASSERT(_accountState);
+ const auto account = _accountState->account();
+ Q_ASSERT(account);
+
+ qCDebug(lcFileProviderSocketController) << "About to send not authenticated message to file provider extension"
+ << account->displayName();
+
+ const auto message = QString(QStringLiteral("ACCOUNT_NOT_AUTHENTICATED"));
+ sendMessage(message);
+}
+
void FileProviderSocketController::sendAccountDetails() const
{
Q_ASSERT(_accountState);
qCDebug(lcFileProviderSocketController) << "About to send account details to file provider extension"
<< account->displayName();
- connect(_accountState.data(), &AccountState::stateChanged, this, &FileProviderSocketController::slotAccountStateChanged);
+ 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"
void parseReceivedLine(const QString &receivedLine);
void requestFileProviderDomainInfo() const;
void sendAccountDetails() const;
+ void sendNotAuthenticated() const;
private:
static AccountStatePtr accountStateFromFileProviderDomainIdentifier(const QString &domainIdentifier);