Skip to content

Commit

Permalink
Fix offline issues in Projects page with no/expired token (#3326)
Browse files Browse the repository at this point in the history
1. incorrect "no workspace detected" message
2. endless busy wait on the home tab (unable to switch projects)
3. endless loop of requesting projects in the second tab
  • Loading branch information
wonder-sk authored Apr 17, 2024
1 parent bcb1967 commit 53b2f34
Show file tree
Hide file tree
Showing 2 changed files with 7 additions and 3 deletions.
8 changes: 6 additions & 2 deletions app/qml/project/MMProjectController.qml
Original file line number Diff line number Diff line change
Expand Up @@ -303,7 +303,7 @@ Item {
if ( !__merginApi.apiSupportsWorkspaces ) {
return false;
}
if ( !__merginApi.userAuth.hasAuthData() ) {
if ( !__merginApi.userAuth.hasValidToken() ) {
return false;
}
// do not show the banner in case of accepting invitation or creating a workspace
Expand Down Expand Up @@ -623,6 +623,10 @@ Item {
stackView.pending = false
}

function onListProjectsFailed() {
stackView.pending = false
}

function onApiVersionStatusChanged() {
stackView.pending = false

Expand All @@ -642,7 +646,7 @@ Item {
function onAuthChanged() {
stackView.pending = false

if ( __merginApi.userAuth.hasAuthData() ) {
if ( __merginApi.userAuth.hasValidToken() ) {

if ( __merginApi.serverType === MM.MerginServerType.OLD || ( stackView.currentItem.objectName === "loginPage" ) ) {
stackView.popPage( "loginPage" )
Expand Down
2 changes: 1 addition & 1 deletion core/merginuserauth.h
Original file line number Diff line number Diff line change
Expand Up @@ -36,7 +36,7 @@ class MerginUserAuth: public QObject

//! Returns true if we have a token and it is not expired,
//! i.e. we should be good to do authenticated requests.
bool hasValidToken() const;
Q_INVOKABLE bool hasValidToken() const;

void clear();

Expand Down

1 comment on commit 53b2f34

@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 24.04.593511 just submitted!

Please sign in to comment.