Skip to content

Commit

Permalink
Feature: Add re-installation prompt (#14804)
Browse files Browse the repository at this point in the history
  • Loading branch information
0x5bfa committed Feb 21, 2024
1 parent 4d87fad commit bb85677
Show file tree
Hide file tree
Showing 6 changed files with 99 additions and 0 deletions.
1 change: 1 addition & 0 deletions src/Files.App/Constants.cs
Original file line number Diff line number Diff line change
Expand Up @@ -236,6 +236,7 @@ public static class GitHub
public const string BugReportUrl = @"https://github.com/files-community/Files/issues/new?labels=bug&template=bug_report.yml";
public const string PrivacyPolicyUrl = @"https://github.com/files-community/Files/blob/main/.github/PRIVACY.md";
public const string SupportUsUrl = @"https://github.com/sponsors/yaira2";
public const string ReinstallationNoticeDocsUrl = @"https://files.community/docs/install#:~:text=Steps%20required%20for%20the%20%E2%80%9Cclassic%20installer%E2%80%9D%20version%20after%203/21/2024";
}

public static class DocsPath
Expand Down
20 changes: 20 additions & 0 deletions src/Files.App/Dialogs/ReinstallPromptDialog.xaml
Original file line number Diff line number Diff line change
@@ -0,0 +1,20 @@
<!-- Copyright (c) 2023 Files Community. Licensed under the MIT License. See the LICENSE. -->
<ContentDialog
x:Class="Files.App.Dialogs.ReinstallPromptDialog"
xmlns="http://schemas.microsoft.com/winfx/2006/xaml/presentation"
xmlns:x="http://schemas.microsoft.com/winfx/2006/xaml"
xmlns:d="http://schemas.microsoft.com/expression/blend/2008"
xmlns:mc="http://schemas.openxmlformats.org/markup-compatibility/2006"
Title="Re-installation is required"
PrimaryButtonClick="ContentDialog_PrimaryButtonClick"
PrimaryButtonStyle="{StaticResource AccentButtonStyle}"
PrimaryButtonText="More info"
SecondaryButtonText="OK"
Style="{StaticResource DefaultContentDialogStyle}"
mc:Ignorable="d">

<StackPanel Width="360" Spacing="12">
<TextBlock Text="Starting 3/21/2024, a reinstallation of Files is required in order to continue receiving automatic updates." />
<TextBlock Text="Please see our documentation for additional help and resources regarding this message." />
</StackPanel>
</ContentDialog>
24 changes: 24 additions & 0 deletions src/Files.App/Dialogs/ReinstallPromptDialog.xaml.cs
Original file line number Diff line number Diff line change
@@ -0,0 +1,24 @@
// Copyright (c) 2023 Files Community
// Licensed under the MIT License. See the LICENSE.

using Microsoft.UI.Xaml.Controls;
using Windows.System;

namespace Files.App.Dialogs
{
/// <summary>
/// Displays a dialog temporarily informing the user of the importance of reinstalling the app.
/// </summary>
public sealed partial class ReinstallPromptDialog : ContentDialog
{
public ReinstallPromptDialog()
{
this.InitializeComponent();
}

private async void ContentDialog_PrimaryButtonClick(ContentDialog sender, ContentDialogButtonClickEventArgs args)
{
await Launcher.LaunchUriAsync(new Uri(Constants.GitHub.ReinstallationNoticeDocsUrl));
}
}
}
35 changes: 35 additions & 0 deletions src/Files.App/UserControls/AddressToolbar.xaml
Original file line number Diff line number Diff line change
Expand Up @@ -27,6 +27,23 @@
<converters:NullToTrueConverter x:Key="NullToFalseConverter" Inverse="True" />
<converters1:BoolNegationConverter x:Key="BoolNegationConverter" />

<ResourceDictionary.ThemeDictionaries>
<ResourceDictionary x:Key="Light">
<LinearGradientBrush x:Key="WarningGradientBrush" StartPoint="0,0" EndPoint="1,1">
<GradientStop Offset="0" Color="#FFA500" />
<GradientStop Offset="0.5" Color="#FF8C00" />
<GradientStop Offset="1" Color="#FF4500" />
</LinearGradientBrush>
</ResourceDictionary>
<ResourceDictionary x:Key="Dark">
<LinearGradientBrush x:Key="WarningGradientBrush" StartPoint="0,0" EndPoint="1,1">
<GradientStop Offset="0" Color="#ffd153" />
<GradientStop Offset="0.5" Color="#f9ae41" />
<GradientStop Offset="1" Color="#f69e38" />
</LinearGradientBrush>
</ResourceDictionary>
</ResourceDictionary.ThemeDictionaries>

<ResourceDictionary.MergedDictionaries>
<ResourceDictionary>
<SolidColorBrush x:Key="ButtonBorderBrushDisabled" Color="Transparent" />
Expand Down Expand Up @@ -508,6 +525,24 @@
Glyph="&#xF133;" />
</Button>

<!-- (TEMP) Re-install Prompt (Limited Time Only) -->
<Button
x:Name="ReInstallPromptButton"
Width="36"
Height="32"
Padding="0"
x:Load="{x:Bind ViewModel.ShowReinstallationPrompt, Mode=OneWay}"
Click="ReInstallPromptButton_Click"
Style="{StaticResource AddressToolbarButtonStyle}">
<Grid>
<Viewbox Width="16">
<Image Source="ms-appx:///Assets/AppTiles/Dev/Logo.ico" />
</Viewbox>
<FontIcon Foreground="{ThemeResource WarningGradientBrush}" Glyph="&#xea82;" />
<FontIcon Foreground="Black" Glyph="&#xea84;" />
</Grid>
</Button>

<!-- Show The Files App Settings Dialog -->
<Button
x:Name="SettingsButton"
Expand Down
9 changes: 9 additions & 0 deletions src/Files.App/UserControls/AddressToolbar.xaml.cs
Original file line number Diff line number Diff line change
@@ -1,6 +1,7 @@
// Copyright (c) 2023 Files Community
// Licensed under the MIT License. See the LICENSE.

using Files.App.Dialogs;
using Microsoft.UI.Input;
using Microsoft.UI.Xaml;
using Microsoft.UI.Xaml.Controls;
Expand Down Expand Up @@ -135,5 +136,13 @@ private void OngoingTasksActions_ProgressBannerPosted(object? _, StatusCenterIte
userSettingsService.AppSettingsService.ShowStatusCenterTeachingTip = false;
}
}

private async void ReInstallPromptButton_Click(object sender, RoutedEventArgs e)
{
ReinstallPromptDialog dialog = new();
dialog.XamlRoot = MainWindow.Instance.Content.XamlRoot;

await dialog.ShowAsync();
}
}
}
10 changes: 10 additions & 0 deletions src/Files.App/ViewModels/UserControls/ToolbarViewModel.cs
Original file line number Diff line number Diff line change
Expand Up @@ -201,6 +201,13 @@ public Style LayoutOpacityIcon

private PointerRoutedEventArgs? pointerRoutedEventArgs;

private bool _ShowReinstallationPrompt;
public bool ShowReinstallationPrompt
{
get => _ShowReinstallationPrompt;
set => SetProperty(ref _ShowReinstallationPrompt, value);
}

public ToolbarViewModel()
{
RefreshClickCommand = new RelayCommand<RoutedEventArgs>(e => RefreshRequested?.Invoke(this, EventArgs.Empty));
Expand All @@ -212,6 +219,9 @@ public ToolbarViewModel()
SearchBox.Escaped += SearchRegion_Escaped;
UserSettingsService.OnSettingChangedEvent += UserSettingsService_OnSettingChangedEvent;
UpdateService.PropertyChanged += UpdateService_OnPropertyChanged;

if (DateTime.Today >= new DateTime(2024, 3, 21))
ShowReinstallationPrompt = true;
}

private async void UpdateService_OnPropertyChanged(object? sender, PropertyChangedEventArgs e)
Expand Down

0 comments on commit bb85677

Please sign in to comment.