feat: implement identity authentication, authorization policies, and MAUI platform support with Docker orchestration
This commit is contained in:
@@ -1,3 +1,5 @@
|
||||
using System.Linq;
|
||||
|
||||
namespace NexusReader.UI.Shared.Services;
|
||||
|
||||
public class ReaderNavigationService : IReaderNavigationService
|
||||
@@ -6,29 +8,29 @@ public class ReaderNavigationService : IReaderNavigationService
|
||||
public int TotalChapters { get; private set; } = 1;
|
||||
public string ChapterTitle { get; private set; } = "Loading...";
|
||||
|
||||
public event Action? OnNavigationChanged;
|
||||
public event Func<Task>? OnNavigationChanged;
|
||||
|
||||
public void GoToChapter(int index)
|
||||
public async Task GoToChapter(int index)
|
||||
{
|
||||
if (index < 0 || index >= TotalChapters) return;
|
||||
|
||||
CurrentChapterIndex = index;
|
||||
OnNavigationChanged?.Invoke();
|
||||
await NotifyNavigationChangedAsync();
|
||||
}
|
||||
|
||||
public void GoToNextChapter()
|
||||
public async Task GoToNextChapter()
|
||||
{
|
||||
if (CurrentChapterIndex < TotalChapters - 1)
|
||||
{
|
||||
GoToChapter(CurrentChapterIndex + 1);
|
||||
await GoToChapter(CurrentChapterIndex + 1);
|
||||
}
|
||||
}
|
||||
|
||||
public void GoToPreviousChapter()
|
||||
public async Task GoToPreviousChapter()
|
||||
{
|
||||
if (CurrentChapterIndex > 0)
|
||||
{
|
||||
GoToChapter(CurrentChapterIndex - 1);
|
||||
await GoToChapter(CurrentChapterIndex - 1);
|
||||
}
|
||||
}
|
||||
|
||||
@@ -41,7 +43,21 @@ public class ReaderNavigationService : IReaderNavigationService
|
||||
|
||||
if (changed)
|
||||
{
|
||||
OnNavigationChanged?.Invoke();
|
||||
// Note: UpdateMetadata remains void, so we trigger notification fire-and-forget here
|
||||
// but usually this is called during a render cycle where metadata is updated from a load.
|
||||
_ = NotifyNavigationChangedAsync();
|
||||
}
|
||||
}
|
||||
|
||||
private async Task NotifyNavigationChangedAsync()
|
||||
{
|
||||
var handlers = OnNavigationChanged?.GetInvocationList();
|
||||
if (handlers != null)
|
||||
{
|
||||
foreach (var handler in handlers.Cast<Func<Task>>())
|
||||
{
|
||||
await handler();
|
||||
}
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
Reference in New Issue
Block a user