-
Notifications
You must be signed in to change notification settings - Fork 47
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
Merge pull request #1397 from Nexus-Mods/feat/888-completed-downloads
Completed downloads section on Downloads page
- Loading branch information
Showing
21 changed files
with
1,484 additions
and
513 deletions.
There are no files selected for viewing
19 changes: 19 additions & 0 deletions
19
src/Abstractions/NexusMods.Abstractions.MnemonicDB.Attributes/DateTimeAttribute.cs
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,19 @@ | ||
using NexusMods.MnemonicDB.Abstractions.Attributes; | ||
using NexusMods.MnemonicDB.Abstractions.ElementComparers; | ||
|
||
namespace NexusMods.Abstractions.MnemonicDB.Attributes; | ||
|
||
/// <summary> | ||
/// A MneumonicDB attribute for a DateTime value | ||
/// </summary> | ||
/// <remarks> | ||
/// Depending on use case, consider using transaction timestamps instead of a dedicated DateTimeAttribute. | ||
/// </remarks> | ||
public class DateTimeAttribute(string ns, string name) : ScalarAttribute<DateTime, long>(ValueTags.Int64, ns, name) | ||
{ | ||
/// <inheritdoc /> | ||
protected override long ToLowLevel(DateTime value) => value.ToBinary(); | ||
|
||
/// <inheritdoc /> | ||
protected override DateTime FromLowLevel(long value, ValueTags tags) => DateTime.FromBinary(value); | ||
} |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
48 changes: 48 additions & 0 deletions
48
src/Networking/NexusMods.Networking.Downloaders/Tasks/State/CompletedDownloadState.cs
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,48 @@ | ||
using NexusMods.Abstractions.MnemonicDB.Attributes; | ||
using NexusMods.MnemonicDB.Abstractions; | ||
|
||
namespace NexusMods.Networking.Downloaders.Tasks.State; | ||
|
||
/// <summary> | ||
/// Additional state for a <see cref="DownloaderState"/> that is completed | ||
/// </summary> | ||
public static class CompletedDownloadState | ||
{ | ||
private const string Namespace = "NexusMods.Networking.Downloaders.Tasks.DownloaderState"; | ||
|
||
/// <summary> | ||
/// The timestamp the download was completed at | ||
/// </summary> | ||
public static readonly DateTimeAttribute CompletedDateTime= new(Namespace, nameof(CompletedDateTime)); | ||
|
||
/// <summary> | ||
/// Whether the download is hidden (clear action) in the UI | ||
/// </summary> | ||
public static readonly BooleanAttribute Hidden = new(Namespace, nameof(Hidden)); | ||
|
||
/// <summary> | ||
/// Model for reading and writing CompletedDownloadStates | ||
/// </summary> | ||
/// <param name="tx"></param> | ||
public class Model(ITransaction tx) : DownloaderState.Model(tx) | ||
{ | ||
|
||
/// <summary> | ||
/// The timestamp the download was completed at | ||
/// </summary> | ||
public DateTime CompletedAt | ||
{ | ||
get => CompletedDateTime.Get(this, default(DateTime)); | ||
set => CompletedDateTime.Add(this, value); | ||
} | ||
|
||
/// <summary> | ||
/// Whether the download is hidden (clear action) in the UI | ||
/// </summary> | ||
public bool IsHidden | ||
{ | ||
get => Hidden.Get(this, false); | ||
set => Hidden.Add(this, value); | ||
} | ||
} | ||
} |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
4 changes: 0 additions & 4 deletions
4
src/NexusMods.App.UI/LeftMenu/Loadout/LoadoutLeftMenuViewModel.cs
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Oops, something went wrong.