Skip to content

Commit

Permalink
clear projects for workspaces when logged out
Browse files Browse the repository at this point in the history
  • Loading branch information
PeterPetrik committed Dec 1, 2023
1 parent a0fbf5e commit 3ec0814
Show file tree
Hide file tree
Showing 2 changed files with 14 additions and 0 deletions.
12 changes: 12 additions & 0 deletions app/projectsmodel.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -34,6 +34,7 @@ void ProjectsModel::initializeProjectsModel()

QObject::connect( mBackend, &MerginApi::projectDetached, this, &ProjectsModel::onProjectDetachedFromMergin );
QObject::connect( mBackend, &MerginApi::projectAttachedToMergin, this, &ProjectsModel::onProjectAttachedToMergin );
QObject::connect( mBackend, &MerginApi::authChanged, this, &ProjectsModel::onAuthChanged );

if ( mModelType == ProjectModelTypes::LocalProjectsModel )
{
Expand Down Expand Up @@ -543,6 +544,17 @@ void ProjectsModel::onProjectAttachedToMergin( const QString & )
listProjectsByName();
}

void ProjectsModel::onAuthChanged()
{
if ( !mBackend->userAuth() || !mBackend->userAuth()->hasAuthData() ) // user logged out, clear created and shared lists
{
if ( mModelType == WorkspaceProjectsModel )
{
clearProjects();
}
}
}

void ProjectsModel::setMerginApi( MerginApi *merginApi )
{
if ( !merginApi || mBackend == merginApi )
Expand Down
2 changes: 2 additions & 0 deletions app/projectsmodel.h
Original file line number Diff line number Diff line change
Expand Up @@ -163,6 +163,8 @@ class ProjectsModel : public QAbstractListModel
void onAboutToRemoveProject( const LocalProject &project );
void onProjectDataChanged( const LocalProject &project );

void onAuthChanged();

void setMerginApi( MerginApi *merginApi );
void setModelType( ProjectModelTypes modelType );
void setSyncManager( SynchronizationManager *newSyncManager );
Expand Down

1 comment on commit 3ec0814

@inputapp-bot
Copy link
Collaborator

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

iOS - version 23.12.492111 just submitted!

Please sign in to comment.