Skip to content

Commit

Permalink
feat: add capability support for multiple personal spaces (#11956)
Browse files Browse the repository at this point in the history
  • Loading branch information
DeepDiver1975 authored Oct 24, 2024
1 parent 493080b commit 726fa08
Show file tree
Hide file tree
Showing 3 changed files with 11 additions and 3 deletions.
1 change: 1 addition & 0 deletions src/libsync/capabilities.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -304,6 +304,7 @@ SpaceSupport::SpaceSupport(const QVariantMap &spaces_support)
return;
}
enabled = spaces_support.value(QStringLiteral("enabled")).toBool();
hasMultiplePersonalSpaces = spaces_support.value(QStringLiteral("has_multiple_personal_spaces")).toBool();
version = QVersionNumber::fromString(spaces_support.value(QStringLiteral("version")).toString());
}

Expand Down
8 changes: 5 additions & 3 deletions src/libsync/capabilities.h
Original file line number Diff line number Diff line change
Expand Up @@ -20,8 +20,8 @@

#include "common/checksumalgorithms.h"

#include <QVariantMap>
#include <QStringList>
#include <QVariantMap>
#include <QVersionNumber>

namespace OCC {
Expand Down Expand Up @@ -81,11 +81,13 @@ struct OWNCLOUDSYNC_EXPORT SpaceSupport
/**
"spaces": {
"version": "0.0.1",
"enabled": true
"enabled": true,
"has_multiple_personal_spaces": true
}
*/
SpaceSupport(const QVariantMap &spaces_support);
bool enabled = false;
bool hasMultiplePersonalSpaces = false;
QVersionNumber version;

bool isValid() const;
Expand Down Expand Up @@ -305,4 +307,4 @@ class OWNCLOUDSYNC_EXPORT Capabilities
};
}

#endif //CAPABILITIES_H
#endif // CAPABILITIES_H
5 changes: 5 additions & 0 deletions src/libsync/graphapi/space.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -97,6 +97,11 @@ void SpaceImage::update()

QString Space::displayName() const
{
auto hasManyPersonalSpaces = _spaceManager->account()->capabilities().spacesSupport().enabled;
if (hasManyPersonalSpaces) {
return _drive.getName();
}

if (_drive.getDriveType() == personalC) {
return tr("Personal");
} else if (_drive.getId() == sharesIdC) {
Expand Down

0 comments on commit 726fa08

Please sign in to comment.