Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Fix: re-logging while on GC causes failed login state #3014

Closed
wants to merge 3 commits into from
Closed
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
Original file line number Diff line number Diff line change
Expand Up @@ -128,7 +128,7 @@ public async UniTask ExecuteAsync(UserInAppInitializationFlowParameters paramete
{
// If we are coming from a logout, we teleport the user to Genesis Plaza and force realm change to reset the scene properly
var url = URLDomain.FromString(decentralandUrlsSource.Url(DecentralandUrl.Genesis));
var changeRealmResult = await realmNavigator.TryChangeRealmAsync(url, ct);
var changeRealmResult = await realmNavigator.TryChangeRealmAsync(url, ct, ignoreRealmChecks:true);

if (changeRealmResult.Success == false)
ReportHub.LogError(ReportCategory.AUTHENTICATION, changeRealmResult.AsResult().ErrorMessage!);
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -33,7 +33,8 @@ public interface IRealmNavigator
UniTask<EnumResult<ChangeRealmError>> TryChangeRealmAsync(
URLDomain realm,
CancellationToken ct,
Vector2Int parcelToTeleport = default
Vector2Int parcelToTeleport = default,
bool ignoreRealmChecks = false
);

UniTask<Result> TeleportToParcelAsync(Vector2Int parcel, CancellationToken ct, bool isLocal);
Expand Down
11 changes: 8 additions & 3 deletions Explorer/Assets/Scripts/Global/Dynamic/RealmNavigator.cs
Original file line number Diff line number Diff line change
Expand Up @@ -128,16 +128,21 @@ public bool CheckIsNewRealm(URLDomain realm)
public async UniTask<EnumResult<ChangeRealmError>> TryChangeRealmAsync(
URLDomain realm,
CancellationToken ct,
Vector2Int parcelToTeleport = default
Vector2Int parcelToTeleport = default,
bool ignoreRealmChecks = false
)
{
if (ct.IsCancellationRequested)
return EnumResult<ChangeRealmError>.ErrorResult(ChangeRealmError.ChangeCancelled);

if (CheckIsNewRealm(realm) == false)
//if the ignoreRealmChecks flag is set, we are coming from the logout screen, which means we dont care if we are
//in the same realm and also we know the realm was reacheable. This last part was added because this async check of the realm
//causes visual issues (login screen closes and GP is visible during some seconds while the request to check if the realm
//is reachable happen). This is a temporal fix.
if (!ignoreRealmChecks && CheckIsNewRealm(realm) == false)
return EnumResult<ChangeRealmError>.ErrorResult(ChangeRealmError.SameRealm);

if (await realmController.IsReachableAsync(realm, ct) == false)
if (!ignoreRealmChecks && await realmController.IsReachableAsync(realm, ct) == false)
return EnumResult<ChangeRealmError>.ErrorResult(ChangeRealmError.NotReachable);

var operation = DoChangeRealmAsync(realm, realmController.CurrentDomain, parcelToTeleport);
Expand Down
Loading