-
Notifications
You must be signed in to change notification settings - Fork 6
fix(mobile): width and swipe #80
New issue
Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.
By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.
Already on GitHub? Sign in to your account
Changes from all commits
File filter
Filter by extension
Conversations
Jump to
Diff view
Diff view
There are no files selected for viewing
| Original file line number | Diff line number | Diff line change |
|---|---|---|
| @@ -0,0 +1,12 @@ | ||
| namespace OpenIPC.Viewer.App.Services; | ||
|
|
||
| /// <summary> | ||
| /// A page view model or overlay dialog with levels of its own (a settings | ||
| /// section over its list, a remote folder over its parent). System Back asks | ||
| /// it first and only leaves the page or closes the sheet once it says no. | ||
| /// </summary> | ||
| public interface IBackNavigable | ||
| { | ||
| /// <summary>Steps one level up inside; false when already at the top.</summary> | ||
| bool TryGoBack(); | ||
| } |
| Original file line number | Diff line number | Diff line change |
|---|---|---|
|
|
@@ -21,7 +21,7 @@ namespace OpenIPC.Viewer.App.ViewModels; | |
| /// the OS file pickers (no local FS panel) so there are no desktop-only paths | ||
| /// or mobile sandbox issues. Root-level deletes are refused. | ||
| /// </summary> | ||
| public sealed partial class FileManagerViewModel : ViewModelBase, IAsyncDisposable | ||
| public sealed partial class FileManagerViewModel : ViewModelBase, IAsyncDisposable, IBackNavigable | ||
| { | ||
| private readonly Camera _camera; | ||
| private readonly CameraDirectoryService _directory; | ||
|
|
@@ -93,6 +93,15 @@ private Task NavigateUpAsync() | |
| return LoadEntriesAsync(); | ||
| } | ||
|
|
||
| // System Back climbs to the parent folder; at "/" it closes the manager. | ||
| public bool TryGoBack() | ||
| { | ||
| if ((RemotePath ?? "/").Trim('/').Length == 0) | ||
| return false; | ||
| _ = NavigateUpAsync(); | ||
| return true; | ||
|
Comment on lines
+99
to
+102
There was a problem hiding this comment. Choose a reason for hiding this commentThe reason will be displayed to describe this comment to others. Learn more. 2. Folder back can mix directory listings FileManagerViewModel.TryGoBack starts NavigateUpAsync without awaiting or serializing the resulting directory load. Repeated Back presses, or Back during an existing load, let asynchronous enumerations clear and append to the same Entries collection after RemotePath has changed. Agent Prompt
|
||
| } | ||
|
|
||
| [RelayCommand] | ||
| private async Task OpenEntryAsync(RemoteEntryViewModel? entry) | ||
| { | ||
|
|
||
| Original file line number | Diff line number | Diff line change |
|---|---|---|
|
|
@@ -32,6 +32,9 @@ public sealed partial class MainWindowViewModel : ViewModelBase, | |
| // Back returns there instead of always dropping to the library list. | ||
| private ViewModelBase? _singleCameraOrigin; | ||
|
|
||
| // Settings → Start page: the root the system Back gesture unwinds to. | ||
| private readonly ViewModelBase _startPage; | ||
|
|
||
| public GridPageViewModel Live { get; } | ||
| public CameraLibraryPageViewModel Library { get; } | ||
| public RecordingsPageViewModel Recordings { get; } | ||
|
|
@@ -96,7 +99,8 @@ public MainWindowViewModel( | |
| _playerFactory = playerFactory; | ||
| _logger = logger; | ||
| // Settings → Start page (#70): open straight into the live grid if asked. | ||
| _currentPage = userSettings.Current.StartupPage == "live" ? live : library; | ||
| _startPage = userSettings.Current.StartupPage == "live" ? live : library; | ||
| _currentPage = _startPage; | ||
|
|
||
| WeakReferenceMessenger.Default.Register<OpenCameraMessage>(this); | ||
| WeakReferenceMessenger.Default.Register<GoBackToLibraryMessage>(this); | ||
|
|
@@ -187,6 +191,52 @@ private void ExitKiosk() | |
| UpdateFullscreen(); | ||
| } | ||
|
|
||
| /// <summary> | ||
| /// System Back (Android button / edge swipe, mouse back button) walks up one | ||
| /// level: the topmost sheet, then fullscreen, then the page a camera or | ||
| /// recording was opened from, then the page's own levels (a settings section | ||
| /// back to its list), then the start page. False at the root, so the platform takes over | ||
| /// (Android sends the app to the background). | ||
| /// </summary> | ||
| public bool TryGoBack() | ||
| { | ||
| if (OverlayDialogPresenter.TryDismissTopmost()) | ||
| return true; | ||
|
|
||
| if (_playerFullscreen && CurrentPage is RecordingPlayerPageViewModel) | ||
| { | ||
| Receive(new SetPlayerFullscreenMessage(false)); | ||
| return true; | ||
| } | ||
|
|
||
| if (KioskMode) | ||
| { | ||
| KioskMode = false; | ||
| UpdateFullscreen(); | ||
| return true; | ||
| } | ||
|
|
||
| switch (CurrentPage) | ||
| { | ||
| case RecordingPlayerPageViewModel: | ||
| Receive(new GoBackToRecordingsMessage()); | ||
| return true; | ||
|
Comment on lines
+221
to
+223
There was a problem hiding this comment. Choose a reason for hiding this commentThe reason will be displayed to describe this comment to others. Learn more. 3. Back from an event opens the wrong page MainWindowViewModel.TryGoBack sends GoBackToRecordingsMessage for every recording player instead of using the page that opened it. A recording opened from Events therefore returns to Recordings on system Back, while recordings opened from the Recordings page take the same route. Agent Prompt
|
||
| case SingleCameraPageViewModel: | ||
| Receive(new GoBackToLibraryMessage()); | ||
| return true; | ||
| case IBackNavigable page when page.TryGoBack(): | ||
| return true; | ||
| } | ||
|
|
||
| if (!ReferenceEquals(CurrentPage, _startPage)) | ||
| { | ||
| CurrentPage = _startPage; | ||
| return true; | ||
| } | ||
|
|
||
| return false; | ||
| } | ||
|
|
||
| private static bool CanNavigate() => !OverlayDialogPresenter.IsAnyOpen; | ||
|
|
||
| [RelayCommand(CanExecute = nameof(CanNavigate))] | ||
|
|
||
| Original file line number | Diff line number | Diff line change |
|---|---|---|
|
|
@@ -11,7 +11,7 @@ | |
| FontSize="{StaticResource FontSizeBase}" | ||
| Foreground="{StaticResource TextPrimaryBrush}"> | ||
|
|
||
| <Grid RowDefinitions="Auto,Auto,*,Auto" Margin="24" MinWidth="420"> | ||
| <Grid RowDefinitions="Auto,Auto,*,Auto" Margin="24" MinWidth="300"> | ||
|
There was a problem hiding this comment. Choose a reason for hiding this commentThe reason will be displayed to describe this comment to others. Learn more. 4. Health center still overflows narrow phones HealthCenterContent replaces its grid’s 420-pixel minimum width with a fixed 300-pixel minimum while retaining a 24-pixel margin on each side. On a 320-pixel-wide viewport, the grid requires at least 348 pixels, so the sheet still cannot fit its content within the screen. Agent Prompt
|
||
|
|
||
| <!-- Header: title + refresh --> | ||
| <Grid Grid.Row="0" ColumnDefinitions="*,Auto"> | ||
|
|
||
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
1. Discovery continues after its sheet closes
🐞 Bug☼ ReliabilityAgent Prompt
ⓘ Copy this prompt and use it to remediate the issue with your preferred AI generation tools