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

Remove the pending update version from the About dialog #15378

Merged
merged 1 commit into from
May 18, 2023
Merged
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
26 changes: 3 additions & 23 deletions src/cascadia/TerminalApp/AboutDialog.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -58,23 +58,6 @@ namespace winrt::TerminalApp::implementation
ShellExecute(nullptr, nullptr, currentPath.c_str(), nullptr, nullptr, SW_SHOW);
}

bool AboutDialog::UpdatesAvailable() const
{
return !_pendingUpdateVersion.empty();
}

winrt::hstring AboutDialog::PendingUpdateVersion() const
{
return _pendingUpdateVersion;
}

void AboutDialog::_SetPendingUpdateVersion(const winrt::hstring& version)
{
_pendingUpdateVersion = version;
_PropertyChangedHandlers(*this, WUX::Data::PropertyChangedEventArgs{ L"PendingUpdateVersion" });
_PropertyChangedHandlers(*this, WUX::Data::PropertyChangedEventArgs{ L"UpdatesAvailable" });
}

winrt::fire_and_forget AboutDialog::_queueUpdateCheck()
{
auto strongThis = get_strong();
Expand All @@ -91,7 +74,7 @@ namespace winrt::TerminalApp::implementation
}

co_await wil::resume_foreground(strongThis->Dispatcher());
_SetPendingUpdateVersion({});
UpdatesAvailable(false);
CheckingForUpdates(true);

try
Expand All @@ -101,7 +84,7 @@ namespace winrt::TerminalApp::implementation
// there is an update available. This lets us test the system.
co_await winrt::resume_after(std::chrono::seconds{ 3 });
co_await wil::resume_foreground(strongThis->Dispatcher());
_SetPendingUpdateVersion(L"X.Y.Z");
UpdatesAvailable(true);
#else // release build, likely has a store context
if (auto storeContext{ winrt::Windows::Services::Store::StoreContext::GetDefault() })
{
Expand All @@ -110,10 +93,7 @@ namespace winrt::TerminalApp::implementation
const auto numUpdates = updates.Size();
if (numUpdates > 0)
{
const auto update = updates.GetAt(0);
const auto version = update.Package().Id().Version();
const auto str = fmt::format(FMT_COMPILE(L"{}.{}.{}"), version.Major, version.Minor, version.Build);
_SetPendingUpdateVersion(winrt::hstring{ str });
UpdatesAvailable(true);
}
}
#endif
Expand Down
5 changes: 1 addition & 4 deletions src/cascadia/TerminalApp/AboutDialog.h
Original file line number Diff line number Diff line change
Expand Up @@ -14,19 +14,16 @@ namespace winrt::TerminalApp::implementation

winrt::hstring ApplicationDisplayName();
winrt::hstring ApplicationVersion();
bool UpdatesAvailable() const;
winrt::hstring PendingUpdateVersion() const;

WINRT_CALLBACK(PropertyChanged, Windows::UI::Xaml::Data::PropertyChangedEventHandler);
WINRT_OBSERVABLE_PROPERTY(bool, UpdatesAvailable, _PropertyChangedHandlers, false);
WINRT_OBSERVABLE_PROPERTY(bool, CheckingForUpdates, _PropertyChangedHandlers, false);

private:
friend struct AboutDialogT<AboutDialog>; // for Xaml to bind events

std::chrono::system_clock::time_point _lastUpdateCheck{};
winrt::hstring _pendingUpdateVersion;

void _SetPendingUpdateVersion(const winrt::hstring& pendingUpdateVersion);
void _ThirdPartyNoticesOnClick(const IInspectable& sender, const Windows::UI::Xaml::RoutedEventArgs& eventArgs);
void _SendFeedbackOnClick(const IInspectable& sender, const Windows::UI::Xaml::Controls::ContentDialogButtonClickEventArgs& eventArgs);
winrt::fire_and_forget _queueUpdateCheck();
Expand Down
1 change: 0 additions & 1 deletion src/cascadia/TerminalApp/AboutDialog.idl
Original file line number Diff line number Diff line change
Expand Up @@ -12,6 +12,5 @@ namespace TerminalApp

Boolean CheckingForUpdates { get; };
Boolean UpdatesAvailable { get; };
String PendingUpdateVersion { get; };
}
}
4 changes: 1 addition & 3 deletions src/cascadia/TerminalApp/AboutDialog.xaml
Original file line number Diff line number Diff line change
Expand Up @@ -40,9 +40,7 @@
Orientation="Vertical"
Visibility="{x:Bind UpdatesAvailable, Mode=OneWay}">
<TextBlock IsTextSelectionEnabled="False">
<Run x:Uid="AboutDialog_UpdateAvailableLabel" /> <LineBreak />
<Run x:Uid="AboutDialog_VersionLabel" />
<Run Text="{x:Bind PendingUpdateVersion, Mode=OneWay}" />
<Run x:Uid="AboutDialog_UpdateAvailableLabel" />
</TextBlock>
<!-- <Button x:Uid="AboutDialog_InstallUpdateButton"
Margin="0" />-->
Expand Down