Skip to content

Commit bbfde73

Browse files
authored
Feature: Added progress ring when updating app (#10970)
1 parent 604c5f6 commit bbfde73

File tree

5 files changed

+62
-3
lines changed

5 files changed

+62
-3
lines changed

src/Files.App/ServicesImplementation/SideloadUpdateService.cs

Lines changed: 13 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -1,5 +1,6 @@
11
using CommunityToolkit.Mvvm.ComponentModel;
22
using CommunityToolkit.Mvvm.DependencyInjection;
3+
using CommunityToolkit.WinUI.Helpers;
34
using Files.Backend.Services;
45
using Files.Shared;
56
using System;
@@ -54,6 +55,13 @@ public bool IsUpdating
5455
private set => SetProperty(ref _isUpdating, value);
5556
}
5657

58+
private bool _isAppUpdated;
59+
public bool IsAppUpdated
60+
{
61+
get => _isAppUpdated;
62+
private set => SetProperty(ref _isAppUpdated, value);
63+
}
64+
5765
public async Task DownloadUpdates()
5866
{
5967
await ApplyPackageUpdate();
@@ -64,6 +72,11 @@ public Task DownloadMandatoryUpdates()
6472
return Task.CompletedTask;
6573
}
6674

75+
public SideloadUpdateService()
76+
{
77+
IsAppUpdated = SystemInformation.Instance.IsAppUpdated;
78+
}
79+
6780
public async Task CheckForUpdates()
6881
{
6982
try

src/Files.App/ServicesImplementation/UpdateService.cs

Lines changed: 10 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -1,4 +1,5 @@
11
using CommunityToolkit.Mvvm.ComponentModel;
2+
using CommunityToolkit.WinUI.Helpers;
23
using Files.App.Extensions;
34
using Files.Backend.Services;
45
using Microsoft.UI.Xaml.Controls;
@@ -20,24 +21,31 @@ internal sealed class UpdateService : ObservableObject, IUpdateService
2021
private bool IsMandatory => _updatePackages?.Where(e => e.Mandatory).ToList().Count >= 1;
2122

2223
private bool _isUpdateAvailable;
23-
2424
public bool IsUpdateAvailable
2525
{
2626
get => _isUpdateAvailable;
2727
set => SetProperty(ref _isUpdateAvailable, value);
2828
}
2929

3030
private bool _isUpdating;
31-
3231
public bool IsUpdating
3332
{
3433
get => _isUpdating;
3534
private set => SetProperty(ref _isUpdating, value);
3635
}
3736

37+
private bool _isAppUpdated;
38+
public bool IsAppUpdated
39+
{
40+
get => _isAppUpdated;
41+
private set => SetProperty(ref _isAppUpdated, value);
42+
}
43+
3844
public UpdateService()
3945
{
4046
_updatePackages = new List<StorePackageUpdate>();
47+
48+
IsAppUpdated = SystemInformation.Instance.IsAppUpdated;
4149
}
4250

4351
public async Task DownloadUpdates()

src/Files.App/Strings/en-US/Resources.resw

Lines changed: 3 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -2874,4 +2874,7 @@
28742874
<data name="EditSettingsFile" xml:space="preserve">
28752875
<value>Edit Settings File</value>
28762876
</data>
2877+
<data name="ReleaseNotes" xml:space="preserve">
2878+
<value>Release Notes</value>
2879+
</data>
28772880
</root>

src/Files.App/UserControls/AddressToolbar.xaml

Lines changed: 31 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -259,6 +259,7 @@
259259
Value="{x:Bind OngoingTasksViewModel.InfoBadgeValue, Mode=OneWay}" />
260260
</Grid>
261261

262+
<!-- Install Update Notification -->
262263
<Button
263264
x:Name="UpdateButton"
264265
HorizontalContentAlignment="Stretch"
@@ -270,10 +271,39 @@
270271
IsEnabled="{x:Bind ViewModel.UpdateService.IsUpdating, Mode=OneWay, Converter={StaticResource BoolNegationConverter}}"
271272
Style="{StaticResource AddressToolbarButtonStyle}"
272273
ToolTipService.ToolTip="{helpers:ResourceString Name=UpdateFiles}">
274+
<Grid>
275+
<!-- Icon -->
276+
<FontIcon
277+
x:Name="UpdateIcon"
278+
x:Load="{x:Bind ViewModel.UpdateService.IsUpdating, Mode=OneWay, Converter={StaticResource BoolNegationConverter}}"
279+
FontSize="14"
280+
Foreground="{ThemeResource SystemAccentColor}"
281+
Glyph="&#xE896;" />
282+
283+
<!-- Progress -->
284+
<ProgressRing
285+
x:Name="UpdateProgressRing"
286+
Width="20"
287+
Height="20"
288+
x:Load="{x:Bind ViewModel.UpdateService.IsUpdating, Mode=OneWay}"
289+
IsIndeterminate="True" />
290+
</Grid>
291+
</Button>
292+
293+
<!-- Update Release Notes -->
294+
<Button
295+
x:Name="ViewReleaseNotesButton"
296+
HorizontalContentAlignment="Stretch"
297+
VerticalContentAlignment="Stretch"
298+
x:Load="{x:Bind ViewModel.UpdateService.IsAppUpdated, Mode=OneWay}"
299+
AccessKey="2"
300+
AutomationProperties.Name="{helpers:ResourceString Name=ReleaseNotes}"
301+
Style="{StaticResource AddressToolbarButtonStyle}"
302+
ToolTipService.ToolTip="{helpers:ResourceString Name=ReleaseNotes}">
273303
<FontIcon
274304
FontSize="14"
275305
Foreground="{ThemeResource SystemAccentColor}"
276-
Glyph="&#xE896;" />
306+
Glyph="&#xF133;" />
277307
</Button>
278308

279309
<Button

src/Files.Backend/Services/IUpdateService.cs

Lines changed: 5 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -15,6 +15,11 @@ public interface IUpdateService : INotifyPropertyChanged
1515
/// </summary>
1616
bool IsUpdating { get; }
1717

18+
/// <summary>
19+
/// Gets a value indicating if the apps being used the first time after an update.
20+
/// </summary>
21+
bool IsAppUpdated { get; }
22+
1823
Task DownloadUpdates();
1924

2025
Task DownloadMandatoryUpdates();

0 commit comments

Comments
 (0)