Skip to content

Commit

Permalink
feat: logout
Browse files Browse the repository at this point in the history
  • Loading branch information
nattb8 committed May 29, 2024
1 parent dc99377 commit 1a764a7
Show file tree
Hide file tree
Showing 2 changed files with 9 additions and 3 deletions.
2 changes: 1 addition & 1 deletion Assets/Shared/Prefabs/UI/MainMenu.prefab
Original file line number Diff line number Diff line change
Expand Up @@ -1020,7 +1020,7 @@ MonoBehaviour:
m_EditorClassIdentifier:
m_StartButton: {fileID: 2691304556920018293}
m_StartButtonEvent: {fileID: 11400000, guid: b892538bd49f3487bbedf5106c094739, type: 2}
m_ConnectedAs: {fileID: 4794305795399722571}
m_Email: {fileID: 0}
m_LogoutButton: {fileID: 1880825616676340313}
m_Loading: {fileID: 7960696323686974425}
--- !u!1 &8405303144642299478
Expand Down
10 changes: 8 additions & 2 deletions Assets/Shared/Scripts/UI/MainMenu.cs
Original file line number Diff line number Diff line change
Expand Up @@ -62,7 +62,8 @@ async void OnEnable()
}

ShowLoading(false);
ShowStartButton(true);
// Show the logout button if the user is logged in
ShowLogoutButton(SaveManager.Instance.IsLoggedIn);
}

void OnDisable()
Expand All @@ -76,7 +77,7 @@ void OnStartButtonClick()
AudioManager.Instance.PlayEffect(SoundID.ButtonSound);
}

void OnLogoutButtonClick()
async void OnLogoutButtonClick()
{
try
{
Expand All @@ -86,6 +87,11 @@ void OnLogoutButtonClick()
ShowLoading(true);

// Logout
#if (UNITY_ANDROID && !UNITY_EDITOR_WIN) || (UNITY_IPHONE && !UNITY_EDITOR_WIN) || UNITY_STANDALONE_OSX
await passport.LogoutPKCE();
#else
await passport.Logout();
#endif

// Reset the login flag
SaveManager.Instance.IsLoggedIn = false;
Expand Down

0 comments on commit 1a764a7

Please sign in to comment.