Skip to content

Commit

Permalink
Allow viewing the onboarding help again
Browse files Browse the repository at this point in the history
  • Loading branch information
levinli303 committed Mar 29, 2023
1 parent 959ed06 commit 8958822
Showing 1 changed file with 50 additions and 25 deletions.
75 changes: 50 additions & 25 deletions CelestiaUWP/MainPage.xaml.cs
Original file line number Diff line number Diff line change
Expand Up @@ -333,30 +333,10 @@ private async void OpenFileOrURL()
return;
}
}
if (!isXbox)
{
if (!AppSettings.OnboardMessageDisplayed)
{
AppSettings.OnboardMessageDisplayed = true;
AppSettings.Save(ApplicationData.Current.LocalSettings);
ShowPage(typeof(SafeWebPage), new Size(450, 0), GenerateWebArgsForPath("/help/welcome"));
return;
}
}
else

if (ShowHelpIfNeeded())
{
if (!DidShowXboxWelcomeMessage && !AppSettings.IgnoreXboxWelcomeMessage)
{
DidShowXboxWelcomeMessage = true;
var welcomeDialog = new WelcomeDialog();
await ContentDialogHelper.ShowContentDialogAsync(this, welcomeDialog);
if (welcomeDialog.ShouldNotShowMessageAgain)
{
AppSettings.IgnoreXboxWelcomeMessage = true;
AppSettings.Save(ApplicationData.Current.LocalSettings);
}
return;
}
return;
}

{
Expand Down Expand Up @@ -1143,9 +1123,12 @@ void AppendCharEnterItem(MenuBarItem item, string title, short input, KeyboardAc
ShowAddonManagement();
});
helpItem.Items.Add(new MenuFlyoutSeparator());
AppendItem(helpItem, LocalizationHelper.Localize("User Guide"), (sender, arg) =>
AppendItem(helpItem, LocalizationHelper.Localize("Celestia Help"), async (sender, arg) =>
{
_ = Launcher.LaunchUriAsync(new Uri("https://github.com/levinli303/Celestia/wiki"));
if (isXbox)
ShowXboxHelp();
else
ShowNonXboxHelp();
});
AppendItem(helpItem, LocalizationHelper.Localize("About Celestia"), (sender, arg) =>
{
Expand Down Expand Up @@ -1222,6 +1205,48 @@ async void PickScript()
if (file != null)
OpenFileIfReady(file);
}

async void ShowXboxHelp()
{
var welcomeDialog = new WelcomeDialog();
await ContentDialogHelper.ShowContentDialogAsync(this, welcomeDialog);

if (welcomeDialog.ShouldNotShowMessageAgain)
{
AppSettings.IgnoreXboxWelcomeMessage = true;
AppSettings.Save(ApplicationData.Current.LocalSettings);
}
}

void ShowNonXboxHelp()
{
ShowPage(typeof(SafeWebPage), new Size(450, 0), GenerateWebArgsForPath("/help/welcome"));
}

bool ShowHelpIfNeeded()
{
if (!isXbox)
{
if (!AppSettings.OnboardMessageDisplayed)
{
AppSettings.OnboardMessageDisplayed = true;
AppSettings.Save(ApplicationData.Current.LocalSettings);
ShowNonXboxHelp();
return true;
}
}
else
{
if (!DidShowXboxWelcomeMessage && !AppSettings.IgnoreXboxWelcomeMessage)
{
DidShowXboxWelcomeMessage = true;
ShowXboxHelp();
return true;
}
}
return false;
}

void ShowTourGuide()
{
ShowPage(typeof(TourGuidePage), new Size(400, 0), (mAppCore, mRenderer));
Expand Down

0 comments on commit 8958822

Please sign in to comment.