customer support WiP

This commit is contained in:
2026-10-16 14:00:52 +05:30
parent 053665c690
commit a1b2b41912
35 changed files with 14855 additions and 349 deletions
+27
View File
@@ -64,9 +64,16 @@ public class LoginManager : MonoBehaviour
bool _appFocused = true;
bool _handlingKeepaliveUnauthorized;
string _pendingAuthMessage;
string _pendingSessionPassword;
public static string AuthToken { get; private set; }
/// <summary>Username from the last successful login/register (memory only).</summary>
public static string SessionUsername { get; private set; }
/// <summary>Game password kept in memory only after a successful login/register. Cleared on logout.</summary>
public static string SessionPassword { get; private set; }
/// <summary>Assigned side from the matchmaker <c>your_team</c> field. <c>null</c> until a room is found or after clear.</summary>
public static Team? MatchYourTeam { get; private set; }
@@ -175,6 +182,8 @@ public class LoginManager : MonoBehaviour
// Dev: log in with clone-aware credentials instead of resuming a saved session.
StopKeepalive();
AuthToken = "";
SessionUsername = "";
SessionPassword = "";
PlayerPrefs.DeleteKey(PlayerPrefsAuthKey);
PlayerPrefs.Save();
@@ -185,6 +194,7 @@ public class LoginManager : MonoBehaviour
if (passwordInputLogin != null) passwordInputLogin.text = devPass;
string loginJson = BuildLoginBody(devUser, devPass);
// _pendingSessionPassword = devPass;
// StartCoroutine(AuthPostCoroutine(AuthBaseUrl + "/auth/login", loginJson, "Signed in."));
SetBusy(false);
#else
@@ -250,6 +260,8 @@ public class LoginManager : MonoBehaviour
if (instance != null)
instance.StopKeepalive();
AuthToken = "";
SessionUsername = "";
SessionPassword = "";
ClearLocalUserProfile();
ClearMatchYourTeam();
PlayerPrefs.DeleteKey(PlayerPrefsAuthKey);
@@ -274,10 +286,13 @@ public class LoginManager : MonoBehaviour
}
AuthToken = "";
SessionUsername = "";
SessionPassword = "";
ClearLocalUserProfile();
MainMenuManager.ClearCachedSettingsProfile();
ClearMatchYourTeam();
OnUserDataUpdated = null;
SupportClient.ClearSession();
Cupid.ClearSession();
CupidLobby.ClearUsername();
GameManager.ClearMatchSession();
@@ -390,6 +405,7 @@ public class LoginManager : MonoBehaviour
return;
}
_pendingSessionPassword = password;
StartCoroutine(AuthPostCoroutine(AuthBaseUrl + "/auth/login", BuildLoginBody(username, password), "Signed in."));
}
@@ -427,6 +443,7 @@ public class LoginManager : MonoBehaviour
return;
}
_pendingSessionPassword = password;
StartCoroutine(AuthPostCoroutine(AuthBaseUrl + "/auth/register", BuildRegisterBody(username, email, password), "Account created."));
}
@@ -713,12 +730,16 @@ public class LoginManager : MonoBehaviour
if (profileOk)
{
SessionUsername = _currentUser != null ? _currentUser.username : "";
SessionPassword = _pendingSessionPassword ?? "";
_pendingSessionPassword = null;
enteredMenu = true;
StartKeepalive();
ProceedToMainMenu();
}
else
{
_pendingSessionPassword = null;
InvalidateStoredSession();
ShowAuthMessage(string.IsNullOrEmpty(profileErr)
? PlayerConnectionError
@@ -727,6 +748,7 @@ public class LoginManager : MonoBehaviour
}
else
{
_pendingSessionPassword = null;
string serverError = resp != null ? resp.error : null;
if (string.IsNullOrEmpty(serverError) && resp != null && resp.code == AlreadyLoggedInCode)
serverError = "Already logged in on another device";
@@ -739,7 +761,10 @@ public class LoginManager : MonoBehaviour
finally
{
if (!enteredMenu)
{
_pendingSessionPassword = null;
SetBusy(false);
}
}
}
@@ -905,6 +930,8 @@ public class LoginManager : MonoBehaviour
static void ApplyUserData(UserData u)
{
_currentUser = u;
if (u != null)
SupportClient.ClearSessionIfDifferentUser(u.username);
OnUserDataUpdated?.Invoke(u);
}