Add auto update default settings to all the clients.

#50
#19
This commit is contained in:
jliddev
2020-09-19 09:14:29 -05:00
parent 801fd978f7
commit 170466686c
8 changed files with 154 additions and 11 deletions

View File

@@ -2,7 +2,7 @@
"ChangeLogs": [
{
"Version": "1.16.1",
"Description": "Default addon channel can now be set separately per World of Warcraft client.\nAttempt to make updating safer with rollback ability.\nContext information added to the bottom screen bar.\nSmall indicator for auto updated addons.\nWhen closing WowUp maximized it should start back up maximized.\nUI updates.\nBug Fixes."
"Description": "Default addon channel can now be set separately per World of Warcraft client.\nAddons can now be set to auto update by default per World of Warcraft client.\nAttempt to make updating safer with rollback ability.\nContext information added to the bottom screen bar.\nSmall indicator for auto updated addons.\nWhen closing WowUp maximized it should start back up maximized.\nUI updates.\nBug Fixes."
},
{
"Version": "1.16.0",

View File

@@ -5,6 +5,7 @@
public static class Preferences
{
public const string ClientDefaultAddonChannelSuffix = "_default_addon_channel";
public const string ClientDefaultAutoUpdateSuffix = "_default_auto_update";
public const string WowUpReleaseChannelKey = "wowup_release_channel";
public const string CollapseToTrayKey = "collapse_to_tray";
public const string LastSelectedClientTypeKey = "last_selected_client_type";

View File

@@ -577,7 +577,8 @@ namespace WowUp.WPF.Services
DownloadUrl = latestFile.DownloadUrl,
ExternalUrl = searchResult.ExternalUrl,
ProviderName = searchResult.ProviderName,
ChannelType = channelType ?? _wowUpService.GetClientAddonChannelType(clientType)
ChannelType = channelType ?? _wowUpService.GetClientAddonChannelType(clientType),
AutoUpdateEnabled = _wowUpService.GetClientDefaultAutoUpdate(clientType)
};
}
}

View File

@@ -38,5 +38,8 @@ namespace WowUp.WPF.Services.Contracts
AddonChannelType GetClientAddonChannelType(WowClientType clientType);
void SetClientAddonChannelType(WowClientType clientType, AddonChannelType channelType);
bool GetClientDefaultAutoUpdate(WowClientType clientType);
void SetClientDefaultAutoUpdate(WowClientType clientType, bool autoUpdate);
}
}

View File

@@ -130,6 +130,20 @@ namespace WowUp.WPF.Services
SetPreference(Constants.Preferences.LastSelectedClientTypeKey, clientType.ToString());
}
public void SetClientDefaultAutoUpdate(WowClientType clientType, bool autoUpdate)
{
var preferenceKey = GetClientDefaultAutoUpdateKey(clientType);
SetPreference(preferenceKey, autoUpdate.ToString());
_analyticsService.TrackUserAction("WowUp", $"ClientDefaultAutoUpdate|{clientType}", autoUpdate.ToString());
}
public bool GetClientDefaultAutoUpdate(WowClientType clientType)
{
var preferenceKey = GetClientDefaultAutoUpdateKey(clientType);
var preference = _preferenceRepository.FindByKey(preferenceKey);
return bool.Parse(preference.Value);
}
public void SetClientAddonChannelType(WowClientType clientType, AddonChannelType channelType)
{
var preferenceKey = GetClientDefaultAddonChannelKey(clientType);
@@ -345,6 +359,11 @@ namespace WowUp.WPF.Services
return $"{clientType}{Constants.Preferences.ClientDefaultAddonChannelSuffix}".ToLower();
}
private string GetClientDefaultAutoUpdateKey(WowClientType clientType)
{
return $"{clientType}{Constants.Preferences.ClientDefaultAutoUpdateSuffix}".ToLower();
}
private void SetDefaultPreferences()
{
var pref = _preferenceRepository.FindByKey(Constants.Preferences.CollapseToTrayKey);
@@ -377,6 +396,13 @@ namespace WowUp.WPF.Services
{
SetClientAddonChannelType(clientType, AddonChannelType.Stable);
}
preferenceKey = GetClientDefaultAutoUpdateKey(clientType);
preference = _preferenceRepository.FindByKey(preferenceKey);
if (preference == null)
{
SetClientDefaultAutoUpdate(clientType, false);
}
}
}

View File

@@ -107,6 +107,41 @@ namespace WowUp.WPF.ViewModels
set { SetProperty(ref _selectedWowUpReleaseChannelType, value); }
}
private bool _retailAutoUpdateAddons;
public bool RetailAutoUpdateAddons
{
get => _retailAutoUpdateAddons;
set { SetProperty(ref _retailAutoUpdateAddons, value); }
}
private bool _retailPtrAutoUpdateAddons;
public bool RetailPtrAutoUpdateAddons
{
get => _retailPtrAutoUpdateAddons;
set { SetProperty(ref _retailPtrAutoUpdateAddons, value); }
}
private bool _classicAutoUpdateAddons;
public bool ClassicAutoUpdateAddons
{
get => _classicAutoUpdateAddons;
set { SetProperty(ref _classicAutoUpdateAddons, value); }
}
private bool _classicPtrAutoUpdateAddons;
public bool ClassicPtrAutoUpdateAddons
{
get => _classicPtrAutoUpdateAddons;
set { SetProperty(ref _classicPtrAutoUpdateAddons, value); }
}
private bool _betaAutoUpdateAddons;
public bool BetaAutoUpdateAddons
{
get => _betaAutoUpdateAddons;
set { SetProperty(ref _betaAutoUpdateAddons, value); }
}
public Command ShowLogsCommand { get; set; }
public Command TelemetryCheckCommand { get; set; }
public Command CollapseToTrayCheckCommand { get; set; }
@@ -117,12 +152,21 @@ namespace WowUp.WPF.ViewModels
public Command RescanFoldersCommand { get; set; }
public Command WowUpReleaseChannelChangedCommand { get; set; }
public Command DumpDebugDataCommand { get; set; }
// DEFAULT ADDON CHANNELS
public Command RetailAddonChannelChangeCommand { get; set; }
public Command RetailPtrAddonChannelChangeCommand { get; set; }
public Command ClassicAddonChannelChangeCommand { get; set; }
public Command ClassicPtrAddonChannelChangeCommand { get; set; }
public Command BetaAddonChannelChangeCommand { get; set; }
// AUTO UPDATE DEFAULTS
public Command RetailAutoUpdateChangeCommand { get; set; }
public Command RetailPtrAutoUpdateChangeCommand { get; set; }
public Command ClassicAutoUpdateChangeCommand { get; set; }
public Command ClassicPtrAutoUpdateChangeCommand { get; set; }
public Command BetaAutoUpdateChangeCommand { get; set; }
public ObservableCollection<AddonChannelType> AddonChannelNames { get; set; }
public ObservableCollection<WowUpReleaseChannelType> WowUpChannelNames { get; set; }
@@ -154,6 +198,12 @@ namespace WowUp.WPF.ViewModels
ClassicPtrAddonChannelChangeCommand = new Command(() => OnAddonChannelChange(WowClientType.ClassicPtr, SelectedClassicPtrAddonChannelType));
BetaAddonChannelChangeCommand = new Command(() => OnAddonChannelChange(WowClientType.Beta, SelectedBetaAddonChannelType));
RetailAutoUpdateChangeCommand = new Command(() => OnAddonAutoUpdateChange(WowClientType.Retail, RetailAutoUpdateAddons)); ;
RetailPtrAutoUpdateChangeCommand = new Command(() => OnAddonAutoUpdateChange(WowClientType.RetailPtr, RetailPtrAutoUpdateAddons)); ;
ClassicAutoUpdateChangeCommand = new Command(() => OnAddonAutoUpdateChange(WowClientType.Classic, ClassicAutoUpdateAddons)); ;
ClassicPtrAutoUpdateChangeCommand = new Command(() => OnAddonAutoUpdateChange(WowClientType.ClassicPtr, ClassicPtrAutoUpdateAddons)); ;
BetaAutoUpdateChangeCommand = new Command(() => OnAddonAutoUpdateChange(WowClientType.Beta, BetaAutoUpdateAddons)); ;
AddonChannelNames = new ObservableCollection<AddonChannelType>
{
AddonChannelType.Stable,
@@ -182,6 +232,12 @@ namespace WowUp.WPF.ViewModels
SelectedClassicPtrAddonChannelType = _wowUpService.GetClientAddonChannelType(WowClientType.ClassicPtr);
SelectedBetaAddonChannelType = _wowUpService.GetClientAddonChannelType(WowClientType.Beta);
RetailAutoUpdateAddons = _wowUpService.GetClientDefaultAutoUpdate(WowClientType.Retail);
RetailPtrAutoUpdateAddons = _wowUpService.GetClientDefaultAutoUpdate(WowClientType.RetailPtr);
ClassicAutoUpdateAddons = _wowUpService.GetClientDefaultAutoUpdate(WowClientType.Classic);
ClassicPtrAutoUpdateAddons = _wowUpService.GetClientDefaultAutoUpdate(WowClientType.ClassicPtr);
BetaAutoUpdateAddons = _wowUpService.GetClientDefaultAutoUpdate(WowClientType.Beta);
WowRetailLocation = _warcraftService.GetClientLocation(WowClientType.Retail);
WowRetailPtrLocation = _warcraftService.GetClientLocation(WowClientType.RetailPtr);
WowClassicLocation = _warcraftService.GetClientLocation(WowClientType.Classic);
@@ -236,6 +292,11 @@ namespace WowUp.WPF.ViewModels
_wowUpService.SetClientAddonChannelType(clientType, addonChannelType);
}
private void OnAddonAutoUpdateChange(WowClientType clientType, bool autoUpdate)
{
_wowUpService.SetClientDefaultAutoUpdate(clientType, autoUpdate);
}
private void OnWowUpReleaseChannelChange(WowUpReleaseChannelType type)
{
_wowUpService.SetWowUpReleaseChannel(type);

View File

@@ -35,6 +35,7 @@
<RowDefinition Height="Auto" />
<RowDefinition Height="Auto" />
<RowDefinition Height="Auto" />
<RowDefinition Height="Auto" />
</Grid.RowDefinitions>
<!--RE-SCAN-->
<Label Grid.Column="0" Grid.Row="0" FontWeight="Bold" HorizontalAlignment="Right" >Re-Scan</Label>
@@ -68,10 +69,11 @@
</Grid.ColumnDefinitions>
<Grid.RowDefinitions>
<RowDefinition Height="Auto" />
<RowDefinition Height="Auto" />
</Grid.RowDefinitions>
<!--DEFAULT ADDON CHANNEL-->
<Label Grid.Column="0" Grid.Row="0" FontWeight="Bold" HorizontalAlignment="Right" >Default Addon Channel</Label>
<StackPanel Grid.Column="1" Grid.Row="6" Margin="0 0 0 10" Orientation="Horizontal">
<StackPanel Grid.Column="1" Grid.Row="0" Margin="0 0 0 10" Orientation="Horizontal">
<ComboBox x:Name="RetailAddonChannelComboBox"
SelectedItem="{Binding SelectedRetailAddonChannelType}"
HorizontalAlignment="Left"
@@ -86,6 +88,15 @@
</i:Interaction.Triggers>
</ComboBox>
</StackPanel>
<!--DEFAULT AUTO UPDATE-->
<Label Grid.Column="0" Grid.Row="1" FontWeight="Bold" HorizontalAlignment="Right">Auto Update</Label>
<StackPanel Grid.Column="1" Grid.Row="1" Margin="0 0 0 0" VerticalAlignment="Center" Orientation="Horizontal">
<CheckBox IsChecked="{Binding RetailAutoUpdateAddons, Mode=TwoWay}"
VerticalAlignment="Center"
Command="{Binding RetailAutoUpdateChangeCommand}" Grid.Row="0" Grid.Column="1">
</CheckBox>
<Label VerticalAlignment="Top">Newly installed addons will be set to auto update by default</Label>
</StackPanel>
</Grid>
</Grid>
<!--RETAIL PTR LOCATION-->
@@ -111,10 +122,11 @@
</Grid.ColumnDefinitions>
<Grid.RowDefinitions>
<RowDefinition Height="Auto" />
<RowDefinition Height="Auto" />
</Grid.RowDefinitions>
<!--DEFAULT ADDON CHANNEL-->
<Label Grid.Column="0" Grid.Row="0" FontWeight="Bold" HorizontalAlignment="Right" >Default Addon Channel</Label>
<StackPanel Grid.Column="1" Grid.Row="6" Margin="0 0 0 10" Orientation="Horizontal">
<StackPanel Grid.Column="1" Grid.Row="0" Margin="0 0 0 10" Orientation="Horizontal">
<ComboBox x:Name="RetailPtrAddonChannelComboBox"
SelectedItem="{Binding SelectedRetailPtrAddonChannelType}"
HorizontalAlignment="Left"
@@ -129,6 +141,15 @@
</i:Interaction.Triggers>
</ComboBox>
</StackPanel>
<!--DEFAULT AUTO UPDATE-->
<Label Grid.Column="0" Grid.Row="1" FontWeight="Bold" HorizontalAlignment="Right">Auto Update</Label>
<StackPanel Grid.Column="1" Grid.Row="1" Margin="0 0 0 0" VerticalAlignment="Center" Orientation="Horizontal">
<CheckBox IsChecked="{Binding RetailPtrAutoUpdateAddons, Mode=TwoWay}"
VerticalAlignment="Center"
Command="{Binding RetailPtrAutoUpdateChangeCommand}" Grid.Row="0" Grid.Column="1">
</CheckBox>
<Label VerticalAlignment="Top">Newly installed addons will be set to auto update by default</Label>
</StackPanel>
</Grid>
</Grid>
<!--CLASSIC LOCATION-->
@@ -154,10 +175,11 @@
</Grid.ColumnDefinitions>
<Grid.RowDefinitions>
<RowDefinition Height="Auto" />
<RowDefinition Height="Auto" />
</Grid.RowDefinitions>
<!--DEFAULT ADDON CHANNEL-->
<Label Grid.Column="0" Grid.Row="0" FontWeight="Bold" HorizontalAlignment="Right" >Default Addon Channel</Label>
<StackPanel Grid.Column="1" Grid.Row="6" Margin="0 0 0 10" Orientation="Horizontal">
<StackPanel Grid.Column="1" Grid.Row="0" Margin="0 0 0 10" Orientation="Horizontal">
<ComboBox x:Name="ClassicAddonChannelComboBox"
SelectedItem="{Binding SelectedClassicAddonChannelType}"
HorizontalAlignment="Left"
@@ -172,6 +194,15 @@
</i:Interaction.Triggers>
</ComboBox>
</StackPanel>
<!--DEFAULT AUTO UPDATE-->
<Label Grid.Column="0" Grid.Row="1" FontWeight="Bold" HorizontalAlignment="Right">Auto Update</Label>
<StackPanel Grid.Column="1" Grid.Row="1" Margin="0 0 0 0" VerticalAlignment="Center" Orientation="Horizontal">
<CheckBox IsChecked="{Binding ClassicAutoUpdateAddons, Mode=TwoWay}"
VerticalAlignment="Center"
Command="{Binding ClassicAutoUpdateChangeCommand}" Grid.Row="0" Grid.Column="1">
</CheckBox>
<Label VerticalAlignment="Top">Newly installed addons will be set to auto update by default</Label>
</StackPanel>
</Grid>
</Grid>
<!--CLASSIC PTR LOCATION-->
@@ -197,10 +228,11 @@
</Grid.ColumnDefinitions>
<Grid.RowDefinitions>
<RowDefinition Height="Auto" />
<RowDefinition Height="Auto" />
</Grid.RowDefinitions>
<!--DEFAULT ADDON CHANNEL-->
<Label Grid.Column="0" Grid.Row="0" FontWeight="Bold" HorizontalAlignment="Right" >Default Addon Channel</Label>
<StackPanel Grid.Column="1" Grid.Row="6" Margin="0 0 0 10" Orientation="Horizontal">
<StackPanel Grid.Column="1" Grid.Row="0" Margin="0 0 0 10" Orientation="Horizontal">
<ComboBox x:Name="ClassicPtrAddonChannelComboBox"
SelectedItem="{Binding SelectedClassicPtrAddonChannelType}"
HorizontalAlignment="Left"
@@ -215,6 +247,15 @@
</i:Interaction.Triggers>
</ComboBox>
</StackPanel>
<!--DEFAULT AUTO UPDATE-->
<Label Grid.Column="0" Grid.Row="1" FontWeight="Bold" HorizontalAlignment="Right">Auto Update</Label>
<StackPanel Grid.Column="1" Grid.Row="1" Margin="0 0 0 0" VerticalAlignment="Center" Orientation="Horizontal">
<CheckBox IsChecked="{Binding ClassicPtrAutoUpdateAddons, Mode=TwoWay}"
VerticalAlignment="Center"
Command="{Binding ClassicPtrAutoUpdateChangeCommand}" Grid.Row="0" Grid.Column="1">
</CheckBox>
<Label VerticalAlignment="Top">Newly installed addons will be set to auto update by default</Label>
</StackPanel>
</Grid>
</Grid>
<!--BETA LOCATION-->
@@ -239,10 +280,11 @@
</Grid.ColumnDefinitions>
<Grid.RowDefinitions>
<RowDefinition Height="Auto" />
<RowDefinition Height="Auto" />
</Grid.RowDefinitions>
<!--DEFAULT ADDON CHANNEL-->
<Label Grid.Column="0" Grid.Row="0" FontWeight="Bold" HorizontalAlignment="Right" >Default Addon Channel</Label>
<StackPanel Grid.Column="1" Grid.Row="6" Margin="0 0 0 10" Orientation="Horizontal">
<StackPanel Grid.Column="1" Grid.Row="0" Margin="0 0 0 10" Orientation="Horizontal">
<ComboBox x:Name="BetaAddonChannelComboBox"
SelectedItem="{Binding SelectedBetaAddonChannelType}"
HorizontalAlignment="Left"
@@ -257,6 +299,15 @@
</i:Interaction.Triggers>
</ComboBox>
</StackPanel>
<!--DEFAULT AUTO UPDATE-->
<Label Grid.Column="0" Grid.Row="1" FontWeight="Bold" HorizontalAlignment="Right">Auto Update</Label>
<StackPanel Grid.Column="1" Grid.Row="1" Margin="0 0 0 0" VerticalAlignment="Center" Orientation="Horizontal">
<CheckBox IsChecked="{Binding BetaAutoUpdateAddons, Mode=TwoWay}"
VerticalAlignment="Center"
Command="{Binding BetaAutoUpdateChangeCommand}" Grid.Row="0" Grid.Column="1">
</CheckBox>
<Label VerticalAlignment="Top">Newly installed addons will be set to auto update by default</Label>
</StackPanel>
</Grid>
</Grid>
</Grid>
@@ -276,7 +327,7 @@
<RowDefinition Height="Auto" />
</Grid.RowDefinitions>
<!--RELEASE CHANNEL-->
<Label FontWeight="Bold" Grid.Row="0" Grid.Column="0" HorizontalAlignment="Right">WowUp Release Channel</Label>
<Label FontWeight="Bold" Grid.Row="0" Grid.Column="0" Margin="0 5" HorizontalAlignment="Right">WowUp Release Channel</Label>
<StackPanel Grid.Row="0" Grid.Column="1" Margin="0 5" Orientation="Horizontal">
<ComboBox x:Name="WowUpChannelComboBox"
SelectedItem="{Binding SelectedWowUpReleaseChannelType}"
@@ -295,7 +346,7 @@
</TextBlock>
</StackPanel>
<!--TELEMETRY-->
<Label FontWeight="Bold" Grid.Row="1" Grid.Column="0" HorizontalAlignment="Right">Telemetry</Label>
<Label FontWeight="Bold" Grid.Row="1" Grid.Column="0" Margin="0 5" HorizontalAlignment="Right">Telemetry</Label>
<StackPanel Grid.Row="1" Grid.Column="1" Margin="0 5" Orientation="Horizontal">
<CheckBox IsChecked="{Binding IsTelemetryEnabled, Mode=TwoWay}"
VerticalAlignment="Center"
@@ -304,7 +355,7 @@
<Label VerticalAlignment="Top">Help improve WowUp by sending anonymous install data and/or errors.</Label>
</StackPanel>
<!--MINIMIZE ON CLOSE-->
<Label FontWeight="Bold" Grid.Row="2" Grid.Column="0" HorizontalAlignment="Right">Minimize on close</Label>
<Label FontWeight="Bold" Grid.Row="2" Grid.Column="0" Margin="0 5" HorizontalAlignment="Right">Minimize on close</Label>
<StackPanel Grid.Row="2" Grid.Column="1" Margin="0 5" Orientation="Horizontal">
<CheckBox IsChecked="{Binding CollapseToTrayEnabled, Mode=TwoWay}"
VerticalAlignment="Center"

View File

@@ -10,7 +10,7 @@
<PackageId>WowUp</PackageId>
<Authors>Jliddev</Authors>
<Product>WowUp</Product>
<Version>1.16.1-beta.8</Version>
<Version>1.16.1-beta.9</Version>
<ApplicationIcon>wowup_logo_512np_RRT_icon.ico</ApplicationIcon>
<Copyright>jliddev</Copyright>
<PackageProjectUrl>https://wowup.io</PackageProjectUrl>