Skip to content

Commit

Permalink
Fix pet showing on island
Browse files Browse the repository at this point in the history
  • Loading branch information
ChrispyPeaches committed May 9, 2024
1 parent 9ae6450 commit 6e278f5
Show file tree
Hide file tree
Showing 2 changed files with 11 additions and 14 deletions.
10 changes: 5 additions & 5 deletions src/FocusApp.Client/Views/Controls/IslandDisplayView.cs
Original file line number Diff line number Diff line change
Expand Up @@ -48,20 +48,20 @@ public Decor DisplayDecor
#endregion

/// <summary>When the parent appears, generate the content for this view. </summary>
public Action ParentLoading { get; set; }
public Action ParentAppearing { get; set; }

enum Column {LeftWhiteSpace, PetAndDecor, RightWhiteSpace }

/// <summary>
/// Attach the parent's appearing event to the <see cref="ParentLoading"/> event,
/// Attach the <see cref="ParentLoading"/> event to the <see cref="GenerateContent"/> method, and
/// Attach the parent's appearing event to the <see cref="ParentAppearing"/> event,
/// Attach the <see cref="ParentAppearing"/> event to the <see cref="GenerateContent"/> method, and
/// generate the initial content.
/// </summary>
public IslandDisplayView(ContentPage parentPage)
{
parentPage.Loaded += (_, _) => ParentLoading.Invoke();
parentPage.Appearing += (_, _) => ParentAppearing.Invoke();

ParentLoading += GenerateContent;
ParentAppearing += GenerateContent;
GenerateContent();
}

Expand Down
15 changes: 6 additions & 9 deletions src/FocusApp.Client/Views/LoginPage.cs
Original file line number Diff line number Diff line change
Expand Up @@ -208,7 +208,6 @@ private async void LoginPage_Loaded(object sender, EventArgs e)
{
// Only show the content downloading popup for getting the essential data
await _popupService.ShowPopupAsync<SyncDataLoadingPopupInterface>();
Thread.Sleep(3000);
try
{
await _syncService.GatherEssentialDatabaseData();
Expand All @@ -223,8 +222,8 @@ await DisplayAlert(

await _popupService.HidePopupAsync<SyncDataLoadingPopupInterface>();

await TryLoginFromStoredToken();
_authenticationService.StartupSyncTask = Task.Run(_syncService.StartupSync);
_ = Task.Run(TryLoginFromStoredToken);
});
}

Expand All @@ -237,20 +236,18 @@ private async Task TryLoginFromStoredToken()

if (result.IsSuccessful)
{
await _popupService.HidePopupAsync<GenericLoadingPopupInterface>();
await MainThread.InvokeOnMainThreadAsync(async () => await Shell.Current.GoToAsync($"///" + nameof(TimerPage)));
return;
}
else
{
_logger.LogInformation(result.Message);
}
await _popupService.HidePopupAsync<GenericLoadingPopupInterface>();

_logger.LogInformation(result.Message);
}
catch (Exception ex)
{
_logger.LogError(ex, "User was not found in database, or the user had no identity token in secure storage. Please manually log in as the user.");
}

await _popupService.HidePopupAsync<GenericLoadingPopupInterface>();
}

}

0 comments on commit 6e278f5

Please sign in to comment.