Skip to content

Commit

Permalink
fix: the profile picture display the full image of the avatar
Browse files Browse the repository at this point in the history
  • Loading branch information
sandrade-dcl committed Nov 27, 2023
1 parent eff9e5c commit 48e28b9
Show file tree
Hide file tree
Showing 3 changed files with 23 additions and 8 deletions.
Original file line number Diff line number Diff line change
Expand Up @@ -106,7 +106,7 @@ public BackpackEditorHUDController(
dataStore.HUDs.avatarEditorVisible.OnChange += OnBackpackVisibleChanged;
dataStore.HUDs.isAvatarEditorInitialized.Set(true);
dataStore.exploreV2.configureBackpackInFullscreenMenu.OnChange += ConfigureBackpackInFullscreenMenuChanged;
dataStore.common.isSignUpFlow.OnChange += OnSignUpFlowChanged;
dataStore.backpackV2.isWaitingToBeSavedAfterSignUp.OnChange += OnIsWaitingToBeSavedAfterSignUpChanged;

ConfigureBackpackInFullscreenMenuChanged(dataStore.exploreV2.configureBackpackInFullscreenMenu.Get(), null);

Expand Down Expand Up @@ -193,7 +193,7 @@ public void Dispose()
ownUserProfile.OnUpdate -= LoadUserProfileFromProfileUpdate;
dataStore.HUDs.avatarEditorVisible.OnChange -= OnBackpackVisibleChanged;
dataStore.exploreV2.configureBackpackInFullscreenMenu.OnChange -= ConfigureBackpackInFullscreenMenuChanged;
dataStore.common.isSignUpFlow.OnChange -= OnSignUpFlowChanged;
dataStore.backpackV2.isWaitingToBeSavedAfterSignUp.OnChange -= OnIsWaitingToBeSavedAfterSignUpChanged;

backpackEmotesSectionController.OnNewEmoteAdded -= OnNewEmoteAdded;
backpackEmotesSectionController.OnEmotePreviewed -= OnEmotePreviewed;
Expand Down Expand Up @@ -298,9 +298,9 @@ private void CloseView()
private void ConfigureBackpackInFullscreenMenuChanged(Transform currentParentTransform, Transform previousParentTransform) =>
view.SetAsFullScreenMenuMode(currentParentTransform);

private void OnSignUpFlowChanged(bool current, bool previous)
private void OnIsWaitingToBeSavedAfterSignUpChanged(bool current, bool previous)
{
if (current)
if (!current)
return;

view.SetSignUpStage(SignUpStage.CustomizeAvatar);
Expand Down Expand Up @@ -453,6 +453,10 @@ private async UniTask SaveAsync(CancellationToken cancellationToken)
try
{
await TakeSnapshotsAndSaveAvatarAsync(cancellationToken);

if (dataStore.backpackV2.isWaitingToBeSavedAfterSignUp.Get())
dataStore.backpackV2.isWaitingToBeSavedAfterSignUp.Set(false);

CloseView();
}
catch (OperationCanceledException) { }
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -51,6 +51,7 @@ public SignupHUDController(
this.browserBridge = browserBridge;
this.subscriptionsAPIService = subscriptionsAPIService;
loadingScreenDataStore.decoupledLoadingHUD.visible.OnChange += OnLoadingScreenAppear;
DataStore.i.backpackV2.isWaitingToBeSavedAfterSignUp.OnChange += OnTermsOfServiceAgreedStepAfterSaveBackpack;
}

public void Initialize()
Expand All @@ -62,7 +63,7 @@ public void Initialize()

view.OnNameScreenNext += OnNameScreenNext;
view.OnEditAvatar += OnEditAvatar;
view.OnTermsOfServiceAgreed += OnTermsOfServiceAgreed;
view.OnTermsOfServiceAgreed += OnTermsOfServiceAgreedStepBeforeSaveBackpack;
view.OnTermsOfServiceBack += OnTermsOfServiceBack;
view.OnLinkClicked += OnLinkClicked;

Expand Down Expand Up @@ -104,10 +105,10 @@ internal void OnEditAvatar()
dataStoreHUDs.avatarEditorVisible.Set(true, true);
}

internal void OnTermsOfServiceAgreed()
private void OnTermsOfServiceAgreedStepBeforeSaveBackpack()
{
WebInterface.SendPassport(name, email);
DataStore.i.common.isSignUpFlow.Set(false);
DataStore.i.backpackV2.isWaitingToBeSavedAfterSignUp.Set(true);
newUserExperienceAnalytics?.SendTermsOfServiceAcceptedNux(name, email);

if (!isNewTermsOfServiceAndEmailSubscriptionEnabled)
Expand All @@ -117,6 +118,14 @@ internal void OnTermsOfServiceAgreed()
CreateSubscriptionAsync(email, createSubscriptionCts.Token).Forget();
}

private void OnTermsOfServiceAgreedStepAfterSaveBackpack(bool current, bool previous)
{
if (current)
return;

DataStore.i.common.isSignUpFlow.Set(false);
}

private async UniTaskVoid CreateSubscriptionAsync(string emailAddress, CancellationToken cancellationToken)
{
try
Expand Down Expand Up @@ -157,9 +166,10 @@ public void Dispose()
return;
view.OnNameScreenNext -= OnNameScreenNext;
view.OnEditAvatar -= OnEditAvatar;
view.OnTermsOfServiceAgreed -= OnTermsOfServiceAgreed;
view.OnTermsOfServiceAgreed -= OnTermsOfServiceAgreedStepBeforeSaveBackpack;
view.OnTermsOfServiceBack -= OnTermsOfServiceBack;
CommonScriptableObjects.isFullscreenHUDOpen.OnChange -= OnLoadingScreenAppear;
DataStore.i.backpackV2.isWaitingToBeSavedAfterSignUp.OnChange -= OnTermsOfServiceAgreedStepAfterSaveBackpack;
loadingScreenDataStore.decoupledLoadingHUD.visible.OnChange -= OnLoadingScreenAppear;
createSubscriptionCts.SafeCancelAndDispose();
view.Dispose();
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -4,5 +4,6 @@ public class DataStore_BackpackV2
{
public readonly BaseCollection<string> previewEquippedWearables = new ();
public readonly BaseVariable<string> previewBodyShape = new ();
public readonly BaseVariable<bool> isWaitingToBeSavedAfterSignUp = new (false);
}
}

0 comments on commit 48e28b9

Please sign in to comment.