mirror of
https://github.com/Artemis-RGB/Artemis
synced 2025-12-13 05:48:35 +00:00
Workshop - Added indicator for official workshop entries
This commit is contained in:
parent
b00f5ca73a
commit
a45d98c171
@ -14,6 +14,7 @@ public class EntryEntity
|
|||||||
public int EntryType { get; set; }
|
public int EntryType { get; set; }
|
||||||
|
|
||||||
public string Author { get; set; } = string.Empty;
|
public string Author { get; set; } = string.Empty;
|
||||||
|
public bool IsOfficial { get; set; }
|
||||||
public string Name { get; set; } = string.Empty;
|
public string Name { get; set; } = string.Empty;
|
||||||
public string Summary { get; set; } = string.Empty;
|
public string Summary { get; set; } = string.Empty;
|
||||||
public long Downloads { get; set; }
|
public long Downloads { get; set; }
|
||||||
|
|||||||
@ -11,8 +11,8 @@ using Microsoft.EntityFrameworkCore.Storage.ValueConversion;
|
|||||||
namespace Artemis.Storage.Migrations
|
namespace Artemis.Storage.Migrations
|
||||||
{
|
{
|
||||||
[DbContext(typeof(ArtemisDbContext))]
|
[DbContext(typeof(ArtemisDbContext))]
|
||||||
[Migration("20240706131336_ExpandInstalledEntry")]
|
[Migration("20240722084220_AutoUpdating")]
|
||||||
partial class ExpandInstalledEntry
|
partial class AutoUpdating
|
||||||
{
|
{
|
||||||
/// <inheritdoc />
|
/// <inheritdoc />
|
||||||
protected override void BuildTargetModel(ModelBuilder modelBuilder)
|
protected override void BuildTargetModel(ModelBuilder modelBuilder)
|
||||||
@ -264,6 +264,9 @@ namespace Artemis.Storage.Migrations
|
|||||||
b.Property<DateTimeOffset>("InstalledAt")
|
b.Property<DateTimeOffset>("InstalledAt")
|
||||||
.HasColumnType("TEXT");
|
.HasColumnType("TEXT");
|
||||||
|
|
||||||
|
b.Property<bool>("IsOfficial")
|
||||||
|
.HasColumnType("INTEGER");
|
||||||
|
|
||||||
b.Property<long?>("LatestReleaseId")
|
b.Property<long?>("LatestReleaseId")
|
||||||
.HasColumnType("INTEGER");
|
.HasColumnType("INTEGER");
|
||||||
|
|
||||||
@ -6,7 +6,7 @@ using Microsoft.EntityFrameworkCore.Migrations;
|
|||||||
namespace Artemis.Storage.Migrations
|
namespace Artemis.Storage.Migrations
|
||||||
{
|
{
|
||||||
/// <inheritdoc />
|
/// <inheritdoc />
|
||||||
public partial class ExpandInstalledEntry : Migration
|
public partial class AutoUpdating : Migration
|
||||||
{
|
{
|
||||||
/// <inheritdoc />
|
/// <inheritdoc />
|
||||||
protected override void Up(MigrationBuilder migrationBuilder)
|
protected override void Up(MigrationBuilder migrationBuilder)
|
||||||
@ -38,6 +38,13 @@ namespace Artemis.Storage.Migrations
|
|||||||
nullable: false,
|
nullable: false,
|
||||||
defaultValue: 0L);
|
defaultValue: 0L);
|
||||||
|
|
||||||
|
migrationBuilder.AddColumn<bool>(
|
||||||
|
name: "IsOfficial",
|
||||||
|
table: "Entries",
|
||||||
|
type: "INTEGER",
|
||||||
|
nullable: false,
|
||||||
|
defaultValue: false);
|
||||||
|
|
||||||
migrationBuilder.AddColumn<long>(
|
migrationBuilder.AddColumn<long>(
|
||||||
name: "LatestReleaseId",
|
name: "LatestReleaseId",
|
||||||
table: "Entries",
|
table: "Entries",
|
||||||
@ -50,7 +57,7 @@ namespace Artemis.Storage.Migrations
|
|||||||
type: "TEXT",
|
type: "TEXT",
|
||||||
nullable: false,
|
nullable: false,
|
||||||
defaultValue: "");
|
defaultValue: "");
|
||||||
|
|
||||||
// Enable auto-update on all entries that are not profiles
|
// Enable auto-update on all entries that are not profiles
|
||||||
migrationBuilder.Sql("UPDATE Entries SET AutoUpdate = 1 WHERE EntryType != 2");
|
migrationBuilder.Sql("UPDATE Entries SET AutoUpdate = 1 WHERE EntryType != 2");
|
||||||
|
|
||||||
@ -87,6 +94,10 @@ namespace Artemis.Storage.Migrations
|
|||||||
name: "Downloads",
|
name: "Downloads",
|
||||||
table: "Entries");
|
table: "Entries");
|
||||||
|
|
||||||
|
migrationBuilder.DropColumn(
|
||||||
|
name: "IsOfficial",
|
||||||
|
table: "Entries");
|
||||||
|
|
||||||
migrationBuilder.DropColumn(
|
migrationBuilder.DropColumn(
|
||||||
name: "LatestReleaseId",
|
name: "LatestReleaseId",
|
||||||
table: "Entries");
|
table: "Entries");
|
||||||
@ -261,6 +261,9 @@ namespace Artemis.Storage.Migrations
|
|||||||
b.Property<DateTimeOffset>("InstalledAt")
|
b.Property<DateTimeOffset>("InstalledAt")
|
||||||
.HasColumnType("TEXT");
|
.HasColumnType("TEXT");
|
||||||
|
|
||||||
|
b.Property<bool>("IsOfficial")
|
||||||
|
.HasColumnType("INTEGER");
|
||||||
|
|
||||||
b.Property<long?>("LatestReleaseId")
|
b.Property<long?>("LatestReleaseId")
|
||||||
.HasColumnType("INTEGER");
|
.HasColumnType("INTEGER");
|
||||||
|
|
||||||
|
|||||||
@ -39,7 +39,7 @@
|
|||||||
<TextBlock Grid.Row="0" Margin="0 0 0 5" TextTrimming="CharacterEllipsis">
|
<TextBlock Grid.Row="0" Margin="0 0 0 5" TextTrimming="CharacterEllipsis">
|
||||||
<Run Classes="h5" Text="{CompiledBinding Entry.Name, FallbackValue=Title}" />
|
<Run Classes="h5" Text="{CompiledBinding Entry.Name, FallbackValue=Title}" />
|
||||||
<Run Classes="subtitle">by you</Run>
|
<Run Classes="subtitle">by you</Run>
|
||||||
<Run Classes="subtitle" Text="{CompiledBinding Emoji}" />
|
<Run Text="{CompiledBinding Emoji}" />
|
||||||
</TextBlock>
|
</TextBlock>
|
||||||
<TextBlock Grid.Row="1"
|
<TextBlock Grid.Row="1"
|
||||||
Classes="subtitle"
|
Classes="subtitle"
|
||||||
|
|||||||
@ -11,7 +11,7 @@ namespace Artemis.UI.Screens.Workshop.Library.Tabs;
|
|||||||
|
|
||||||
public class SubmissionsTabItemViewModel : ViewModelBase
|
public class SubmissionsTabItemViewModel : ViewModelBase
|
||||||
{
|
{
|
||||||
private static readonly string[] Emojis = ["❤️", "🧡", "💛", "💚", "💙", "💜", "🤍", "💔", "❣️", "💕", "💞", "💓", "💗", "💖", "💘", "💝", "😍", "🥰"];
|
private static readonly string[] Emojis = ["❤️", "🧡", "💛", "💚", "💙", "💜", "💔", "❣️", "💕", "💞", "💓", "💗", "💖", "💘", "💝", "😍", "🥰"];
|
||||||
private readonly IRouter _router;
|
private readonly IRouter _router;
|
||||||
|
|
||||||
public SubmissionsTabItemViewModel(IGetSubmittedEntries_SubmittedEntries entry, IRouter router)
|
public SubmissionsTabItemViewModel(IGetSubmittedEntries_SubmittedEntries entry, IRouter router)
|
||||||
|
|||||||
@ -4,7 +4,6 @@ using System.Threading.Tasks;
|
|||||||
using Artemis.Core;
|
using Artemis.Core;
|
||||||
using Artemis.Core.Services;
|
using Artemis.Core.Services;
|
||||||
using Artemis.UI.Services.Interfaces;
|
using Artemis.UI.Services.Interfaces;
|
||||||
using Artemis.UI.Shared.Services;
|
|
||||||
using Artemis.UI.Shared.Utilities;
|
using Artemis.UI.Shared.Utilities;
|
||||||
using Artemis.WebClient.Workshop;
|
using Artemis.WebClient.Workshop;
|
||||||
using Artemis.WebClient.Workshop.Handlers.InstallationHandlers;
|
using Artemis.WebClient.Workshop.Handlers.InstallationHandlers;
|
||||||
@ -19,13 +18,11 @@ public class WorkshopUpdateService : IWorkshopUpdateService
|
|||||||
{
|
{
|
||||||
private readonly ILogger _logger;
|
private readonly ILogger _logger;
|
||||||
private readonly IWorkshopClient _client;
|
private readonly IWorkshopClient _client;
|
||||||
private readonly INotificationService _notificationService;
|
|
||||||
private readonly IWorkshopService _workshopService;
|
private readonly IWorkshopService _workshopService;
|
||||||
private readonly Lazy<IUpdateNotificationProvider> _updateNotificationProvider;
|
private readonly Lazy<IUpdateNotificationProvider> _updateNotificationProvider;
|
||||||
private readonly PluginSetting<bool> _showNotifications;
|
private readonly PluginSetting<bool> _showNotifications;
|
||||||
|
|
||||||
public WorkshopUpdateService(ILogger logger, IWorkshopClient client, IWorkshopService workshopService, ISettingsService settingsService,
|
public WorkshopUpdateService(ILogger logger, IWorkshopClient client, IWorkshopService workshopService, ISettingsService settingsService, Lazy<IUpdateNotificationProvider> updateNotificationProvider)
|
||||||
Lazy<IUpdateNotificationProvider> updateNotificationProvider)
|
|
||||||
{
|
{
|
||||||
_logger = logger;
|
_logger = logger;
|
||||||
_client = client;
|
_client = client;
|
||||||
@ -69,15 +66,27 @@ public class WorkshopUpdateService : IWorkshopUpdateService
|
|||||||
|
|
||||||
_logger.Information("Auto-updating entry {Entry} to version {Version}", entry, latestRelease.Version);
|
_logger.Information("Auto-updating entry {Entry} to version {Version}", entry, latestRelease.Version);
|
||||||
|
|
||||||
EntryInstallResult updateResult = await _workshopService.InstallEntry(entry, latestRelease, new Progress<StreamProgress>(), CancellationToken.None);
|
try
|
||||||
|
{
|
||||||
|
EntryInstallResult updateResult = await _workshopService.InstallEntry(entry, latestRelease, new Progress<StreamProgress>(), CancellationToken.None);
|
||||||
|
|
||||||
// This happens during installation too but not on our reference of the entry
|
// This happens during installation too but not on our reference of the entry
|
||||||
if (updateResult.IsSuccess)
|
if (updateResult.IsSuccess)
|
||||||
entry.ApplyRelease(latestRelease);
|
entry.ApplyRelease(latestRelease);
|
||||||
|
|
||||||
_logger.Information("Auto-update result: {Result}", updateResult);
|
if (updateResult.IsSuccess)
|
||||||
|
_logger.Information("Auto-update successful for entry {Entry}", entry);
|
||||||
|
else
|
||||||
|
_logger.Warning("Auto-update failed for entry {Entry}: {Message}", entry, updateResult.Message);
|
||||||
|
|
||||||
return updateResult.IsSuccess;
|
return updateResult.IsSuccess;
|
||||||
|
}
|
||||||
|
catch (Exception e)
|
||||||
|
{
|
||||||
|
_logger.Warning(e, "Auto-update failed for entry {Entry}", entry);
|
||||||
|
}
|
||||||
|
|
||||||
|
return false;
|
||||||
}
|
}
|
||||||
|
|
||||||
/// <inheritdoc />
|
/// <inheritdoc />
|
||||||
|
|||||||
@ -65,6 +65,7 @@ public class InstalledEntry : CorePropertyChanged, IEntrySummary
|
|||||||
{
|
{
|
||||||
Id = Entity.EntryId;
|
Id = Entity.EntryId;
|
||||||
Author = Entity.Author;
|
Author = Entity.Author;
|
||||||
|
IsOfficial = Entity.IsOfficial;
|
||||||
Name = Entity.Name;
|
Name = Entity.Name;
|
||||||
Summary = Entity.Summary;
|
Summary = Entity.Summary;
|
||||||
EntryType = (EntryType) Entity.EntryType;
|
EntryType = (EntryType) Entity.EntryType;
|
||||||
@ -87,6 +88,7 @@ public class InstalledEntry : CorePropertyChanged, IEntrySummary
|
|||||||
Entity.EntryType = (int) EntryType;
|
Entity.EntryType = (int) EntryType;
|
||||||
|
|
||||||
Entity.Author = Author;
|
Entity.Author = Author;
|
||||||
|
Entity.IsOfficial = IsOfficial;
|
||||||
Entity.Name = Name;
|
Entity.Name = Name;
|
||||||
Entity.Summary = Summary;
|
Entity.Summary = Summary;
|
||||||
Entity.Downloads = Downloads;
|
Entity.Downloads = Downloads;
|
||||||
|
|||||||
Loading…
x
Reference in New Issue
Block a user