feat: implement epub service, navigation service, and global error boundary with updated reader UI layouts

This commit is contained in:
2026-04-25 16:16:36 +02:00
parent f3e94c4f42
commit 59074a05a0
23 changed files with 726 additions and 157 deletions
@@ -0,0 +1,15 @@
namespace NexusReader.UI.Shared.Services;
public interface IReaderNavigationService
{
int CurrentChapterIndex { get; }
int TotalChapters { get; }
string ChapterTitle { get; }
event Action OnNavigationChanged;
void GoToChapter(int index);
void GoToNextChapter();
void GoToPreviousChapter();
void UpdateMetadata(int currentIndex, int totalChapters, string title);
}
@@ -0,0 +1,47 @@
namespace NexusReader.UI.Shared.Services;
public class ReaderNavigationService : IReaderNavigationService
{
public int CurrentChapterIndex { get; private set; } = 0;
public int TotalChapters { get; private set; } = 1;
public string ChapterTitle { get; private set; } = "Loading...";
public event Action? OnNavigationChanged;
public void GoToChapter(int index)
{
if (index < 0 || index >= TotalChapters) return;
CurrentChapterIndex = index;
OnNavigationChanged?.Invoke();
}
public void GoToNextChapter()
{
if (CurrentChapterIndex < TotalChapters - 1)
{
GoToChapter(CurrentChapterIndex + 1);
}
}
public void GoToPreviousChapter()
{
if (CurrentChapterIndex > 0)
{
GoToChapter(CurrentChapterIndex - 1);
}
}
public void UpdateMetadata(int currentIndex, int totalChapters, string title)
{
bool changed = false;
if (CurrentChapterIndex != currentIndex) { CurrentChapterIndex = currentIndex; changed = true; }
if (TotalChapters != totalChapters) { TotalChapters = totalChapters; changed = true; }
if (ChapterTitle != title) { ChapterTitle = title; changed = true; }
if (changed)
{
OnNavigationChanged?.Invoke();
}
}
}