mirror of
https://github.com/Artemis-RGB/Artemis
synced 2026-11-12 03:48:56 +00:00
Workshop - Fixed deep linking to an entry
Workshop - Added the ability to upload new releases to existing submissions
This commit is contained in:
1 parent
bf3d5fc75d
commit
2ee170b803
25 files changed
+375
-133
No files matched your search
@@ -118,11 +118,9 @@ internal class Navigation
|
||||
Completed = true;
|
||||
}
|
||||
|
||||
public bool PathEquals(string path, bool allowPartialMatch)
|
||||
public bool PathEquals(string path, RouterNavigationOptions options)
|
||||
{
|
||||
if (allowPartialMatch)
|
||||
return _resolution.Path.StartsWith(path, StringComparison.InvariantCultureIgnoreCase);
|
||||
return string.Equals(_resolution.Path, path, StringComparison.InvariantCultureIgnoreCase);
|
||||
return options.PathEquals(_resolution.Path, path);
|
||||
}
|
||||
|
||||
private bool CancelIfRequested(NavigationArguments args, string stage, object screen)
|
||||
|
||||
@@ -58,11 +58,9 @@ internal class Router : CorePropertyChanged, IRouter, IDisposable
|
||||
return false;
|
||||
}
|
||||
|
||||
private bool PathEquals(string path, bool allowPartialMatch)
|
||||
private bool PathEquals(string path, RouterNavigationOptions options)
|
||||
{
|
||||
if (allowPartialMatch)
|
||||
return _currentRouteSubject.Value != null && _currentRouteSubject.Value.StartsWith(path, StringComparison.InvariantCultureIgnoreCase);
|
||||
return string.Equals(_currentRouteSubject.Value, path, StringComparison.InvariantCultureIgnoreCase);
|
||||
return _currentRouteSubject.Value != null && options.PathEquals(_currentRouteSubject.Value, path);
|
||||
}
|
||||
|
||||
/// <inheritdoc />
|
||||
@@ -84,7 +82,7 @@ internal class Router : CorePropertyChanged, IRouter, IDisposable
|
||||
{
|
||||
if (_root == null)
|
||||
throw new ArtemisRoutingException("Cannot navigate without a root having been set");
|
||||
if (PathEquals(path, options.IgnoreOnPartialMatch) || (_currentNavigation != null && _currentNavigation.PathEquals(path, options.IgnoreOnPartialMatch)))
|
||||
if (PathEquals(path, options) || (_currentNavigation != null && _currentNavigation.PathEquals(path, options)))
|
||||
return;
|
||||
|
||||
string? previousPath = _currentRouteSubject.Value;
|
||||
|
||||
@@ -1,3 +1,5 @@
|
||||
using System;
|
||||
|
||||
namespace Artemis.UI.Shared.Routing;
|
||||
|
||||
/// <summary>
|
||||
@@ -21,9 +23,31 @@ public class RouterNavigationOptions
|
||||
/// <example>If set to true, a route change from <c>page/subpage1/subpage2</c> to <c>page/subpage1</c> will be ignored.</example>
|
||||
public bool IgnoreOnPartialMatch { get; set; } = false;
|
||||
|
||||
/// <summary>
|
||||
/// Gets or sets the path to use when determining whether the path is a partial match,
|
||||
/// only has any effect if <see cref="IgnoreOnPartialMatch"/> is <see langword="true"/>.
|
||||
/// </summary>
|
||||
public string? PartialMatchOverride { get; set; }
|
||||
|
||||
/// <summary>
|
||||
/// Gets or sets a boolean value indicating whether logging should be enabled.
|
||||
/// <remarks>Errors and warnings are always logged.</remarks>
|
||||
/// </summary>
|
||||
public bool EnableLogging { get; set; } = true;
|
||||
|
||||
/// <summary>
|
||||
/// Determines whether the given two paths are considered equal using these navigation options.
|
||||
/// </summary>
|
||||
/// <param name="current">The current path.</param>
|
||||
/// <param name="target">The target path.</param>
|
||||
/// <returns><see langword="true"/> if the paths are considered equal; otherwise <see langword="false"/>.</returns>
|
||||
internal bool PathEquals(string current, string target)
|
||||
{
|
||||
if (PartialMatchOverride != null && IgnoreOnPartialMatch)
|
||||
target = PartialMatchOverride;
|
||||
|
||||
if (IgnoreOnPartialMatch)
|
||||
return current.StartsWith(target, StringComparison.InvariantCultureIgnoreCase);
|
||||
return string.Equals(current, target, StringComparison.InvariantCultureIgnoreCase);
|
||||
}
|
||||
}
|
||||
Reference in new issue
Block a user