Compare commits

..

2 Commits

Author SHA1 Message Date
Brent Perteet
36f583169c feat: complete UM Trace iOS and field UI integration 2026-08-23 20:54:03 -05:00
Brent Perteet
16c2ada09b Configure UM Trace iOS signing and deployment 2026-08-21 12:33:11 -05:00
43 changed files with 756 additions and 219 deletions

12
.gitignore vendored
View File

@@ -6,6 +6,18 @@
# dotenv files # dotenv files
.env .env
# Local iOS deployment target (contains a personal device UDID).
.ios-device
# Apple signing credentials and provisioning artifacts. Keep these in Keychain or
# an approved secret store; never commit them to the application repository.
*.cer
*.p12
*.p8
*.mobileprovision
*.provisionprofile
*.certSigningRequest
# User-specific files # User-specific files
*.rsuser *.rsuser
*.suo *.suo

View File

@@ -14,8 +14,12 @@ public partial class App : Application
_connectionManager = connectionManager; _connectionManager = connectionManager;
_syncService = syncService; _syncService = syncService;
Console.WriteLine("===== FIELD LOGGER APP STARTING ====="); Console.WriteLine("===== UM TRACE APP STARTING =====");
Console.WriteLine($"Console output is working! Time: {DateTime.Now:HH:mm:ss}"); Console.WriteLine($"Console output is working! Time: {DateTime.Now:HH:mm:ss}");
// Root navigation now opens on Jobs, so connection recovery must not depend on
// the former Home page appearing first.
_connectionManager.Start();
} }
protected override Window CreateWindow(IActivationState? activationState) protected override Window CreateWindow(IActivationState? activationState)

View File

@@ -4,7 +4,8 @@
xmlns="http://schemas.microsoft.com/dotnet/2021/maui" xmlns="http://schemas.microsoft.com/dotnet/2021/maui"
xmlns:x="http://schemas.microsoft.com/winfx/2009/xaml" xmlns:x="http://schemas.microsoft.com/winfx/2009/xaml"
xmlns:views="clr-namespace:FieldLogger.Views" xmlns:views="clr-namespace:FieldLogger.Views"
Title="Field Logger" Title="UM Trace"
FlyoutBehavior="Flyout"
BackgroundColor="{DynamicResource UlColorCanvas}" BackgroundColor="{DynamicResource UlColorCanvas}"
ForegroundColor="{DynamicResource UlColorText}" ForegroundColor="{DynamicResource UlColorText}"
TitleColor="{DynamicResource UlColorText}" TitleColor="{DynamicResource UlColorText}"
@@ -14,11 +15,26 @@
TabBarTitleColor="{DynamicResource UlColorPrimary}" TabBarTitleColor="{DynamicResource UlColorPrimary}"
TabBarUnselectedColor="{DynamicResource UlColorTextMuted}"> TabBarUnselectedColor="{DynamicResource UlColorTextMuted}">
<TabBar> <Shell.FlyoutHeader>
<ShellContent Title="Home" Route="home" ContentTemplate="{DataTemplate views:HomePage}" /> <Grid BackgroundColor="{DynamicResource UlColorSurfaceStrong}" Padding="20,28,20,20">
<ShellContent Title="Jobs" Route="jobs" ContentTemplate="{DataTemplate views:JobsPage}" /> <VerticalStackLayout Spacing="2">
<ShellContent Title="Map" Route="map" ContentTemplate="{DataTemplate views:MapPage}" /> <Label Text="UM TRACE" FontSize="20" FontAttributes="Bold"
<ShellContent Title="Settings" Route="settings" ContentTemplate="{DataTemplate views:SettingsPage}" /> CharacterSpacing="1.5" TextColor="{DynamicResource UlColorOnStrong}" />
</TabBar> <Label Text="Utility locating" FontSize="14"
TextColor="{DynamicResource UlColorBorder}" />
</VerticalStackLayout>
</Grid>
</Shell.FlyoutHeader>
<!-- Jobs is intentionally first: Shell selects the first flyout item at startup. -->
<FlyoutItem Title="Jobs" Route="jobs">
<ShellContent ContentTemplate="{DataTemplate views:JobsPage}" />
</FlyoutItem>
<FlyoutItem Title="Map" Route="map">
<ShellContent ContentTemplate="{DataTemplate views:MapPage}" />
</FlyoutItem>
<FlyoutItem Title="Settings" Route="settings">
<ShellContent ContentTemplate="{DataTemplate views:SettingsPage}" />
</FlyoutItem>
</Shell> </Shell>

View File

@@ -10,10 +10,10 @@ public partial class AppShell : Shell
Routing.RegisterRoute("devicescan", typeof(DeviceScanPage)); Routing.RegisterRoute("devicescan", typeof(DeviceScanPage));
Routing.RegisterRoute("jobdetail", typeof(JobDetailPage)); Routing.RegisterRoute("jobdetail", typeof(JobDetailPage));
Routing.RegisterRoute("debug", typeof(HomePage));
#if DEBUG #if DEBUG
// Keep diagnostics available to development builds without presenting Debug as // The raw device console is a development-only maintenance interface.
// a production primary tab. Routing.RegisterRoute("deviceconsole", typeof(DebugPage));
Routing.RegisterRoute("debug", typeof(DebugPage));
#endif #endif
} }
} }

View File

@@ -26,10 +26,10 @@
<NoWarn>$(NoWarn);MVVMTK0045</NoWarn> <NoWarn>$(NoWarn);MVVMTK0045</NoWarn>
<!-- Display name --> <!-- Display name -->
<ApplicationTitle>Field Logger</ApplicationTitle> <ApplicationTitle>UM Trace</ApplicationTitle>
<!-- App Identifier --> <!-- App Identifier -->
<ApplicationId>com.undergroundmagnetics.fieldlogger</ApplicationId> <ApplicationId>com.umagul.trace</ApplicationId>
<!-- Versions --> <!-- Versions -->
<ApplicationDisplayVersion>1.0</ApplicationDisplayVersion> <ApplicationDisplayVersion>1.0</ApplicationDisplayVersion>
@@ -46,6 +46,10 @@
<SupportedOSPlatformVersion Condition="$([MSBuild]::GetTargetPlatformIdentifier('$(TargetFramework)')) == 'tizen'">6.5</SupportedOSPlatformVersion> <SupportedOSPlatformVersion Condition="$([MSBuild]::GetTargetPlatformIdentifier('$(TargetFramework)')) == 'tizen'">6.5</SupportedOSPlatformVersion>
</PropertyGroup> </PropertyGroup>
<!-- Apple Developer team used for iOS distribution: W2N8APPQ2C.
Certificate/profile selection stays outside source control and is supplied by
Keychain plus the installed com.umagul.trace provisioning profile at publish time. -->
<!-- SEC-1: the Google Maps Android key is injected at build time, never committed. <!-- SEC-1: the Google Maps Android key is injected at build time, never committed.
Resolution order: (1) MapsApiKey MSBuild property (pass -p:MapsApiKey=... in CI from a Resolution order: (1) MapsApiKey MSBuild property (pass -p:MapsApiKey=... in CI from a
secret), else (2) the MAPS_API_KEY environment variable, else (3) a gitignored secret), else (2) the MAPS_API_KEY environment variable, else (3) a gitignored
@@ -60,10 +64,10 @@
<ItemGroup> <ItemGroup>
<!-- App Icon --> <!-- App Icon -->
<MauiIcon Include="Resources\AppIcon\appicon.svg" ForegroundFile="Resources\AppIcon\appiconfg.svg" Color="#512BD4" /> <MauiIcon Include="Resources\AppIcon\appicon.svg" ForegroundFile="Resources\AppIcon\appiconfg.png" Color="#FFFFFF" />
<!-- Splash Screen --> <!-- Splash Screen -->
<MauiSplashScreen Include="Resources\Splash\splash.svg" Color="#512BD4" BaseSize="128,128" /> <MauiSplashScreen Include="Resources\Splash\um_dual_receiver.png" Color="#EEF3F2" BaseSize="480,480" />
<!-- Images --> <!-- Images -->
<MauiImage Include="Resources\Images\*" /> <MauiImage Include="Resources\Images\*" />

View File

@@ -44,6 +44,7 @@ public static class MauiProgram
builder.Services.AddSingleton<MapViewModel>(); builder.Services.AddSingleton<MapViewModel>();
builder.Services.AddSingleton<DebugViewModel>(); builder.Services.AddSingleton<DebugViewModel>();
builder.Services.AddSingleton<SettingsViewModel>(); builder.Services.AddSingleton<SettingsViewModel>();
builder.Services.AddSingleton<AppStatusViewModel>();
builder.Services.AddTransient<DeviceScanViewModel>(); builder.Services.AddTransient<DeviceScanViewModel>();
builder.Services.AddTransient<JobDetailViewModel>(); builder.Services.AddTransient<JobDetailViewModel>();

View File

@@ -35,8 +35,8 @@
<key>XSAppIconAssets</key> <key>XSAppIconAssets</key>
<string>Assets.xcassets/appicon.appiconset</string> <string>Assets.xcassets/appicon.appiconset</string>
<key>NSBluetoothAlwaysUsageDescription</key> <key>NSBluetoothAlwaysUsageDescription</key>
<string>Field Logger uses Bluetooth to connect to your Underground Magnetics locating receiver and Maglink RTK GPS receiver.</string> <string>UM Trace uses Bluetooth to connect to your Underground Magnetics locating receiver and Maglink RTK GPS receiver.</string>
<key>NSLocationWhenInUseUsageDescription</key> <key>NSLocationWhenInUseUsageDescription</key>
<string>Field Logger uses your location to display logged points on the map.</string> <string>UM Trace uses your location to display logged points on the map.</string>
</dict> </dict>
</plist> </plist>

View File

@@ -29,8 +29,19 @@
<key>XSAppIconAssets</key> <key>XSAppIconAssets</key>
<string>Assets.xcassets/appicon.appiconset</string> <string>Assets.xcassets/appicon.appiconset</string>
<key>NSBluetoothAlwaysUsageDescription</key> <key>NSBluetoothAlwaysUsageDescription</key>
<string>Field Logger uses Bluetooth to connect to your Underground Magnetics locating receiver and Maglink RTK GPS receiver.</string> <string>UM Trace uses Bluetooth to connect to your Underground Magnetics locating receiver and MagLink RTK GNSS receiver.</string>
<key>NSLocationWhenInUseUsageDescription</key> <key>NSLocationWhenInUseUsageDescription</key>
<string>Field Logger uses your location to display logged points on the map.</string> <string>UM Trace uses your location to display and record georeferenced locate points during an active field session.</string>
<key>NSLocationAlwaysAndWhenInUseUsageDescription</key>
<string>UM Trace uses your location during an active locating session to keep georeferenced field records current while the app is in the background.</string>
<key>UIBackgroundModes</key>
<array>
<string>bluetooth-central</string>
<string>location</string>
</array>
<!-- The app uses standard, exempt TLS for HTTPS and MQTTS/WSS transport; it does
not implement proprietary or non-standard cryptography. -->
<key>ITSAppUsesNonExemptEncryption</key>
<false/>
</dict> </dict>
</plist> </plist>

View File

@@ -36,8 +36,6 @@ More information: https://aka.ms/maui-privacy-manifest
<string>E174.1</string> <string>E174.1</string>
</array> </array>
</dict> </dict>
<!--
The entry below is only needed when you're using the Preferences API in your app.
<dict> <dict>
<key>NSPrivacyAccessedAPIType</key> <key>NSPrivacyAccessedAPIType</key>
<string>NSPrivacyAccessedAPICategoryUserDefaults</string> <string>NSPrivacyAccessedAPICategoryUserDefaults</string>
@@ -45,7 +43,7 @@ More information: https://aka.ms/maui-privacy-manifest
<array> <array>
<string>CA92.1</string> <string>CA92.1</string>
</array> </array>
</dict> --> </dict>
</array> </array>
</dict> </dict>
</plist> </plist>

View File

@@ -1,4 +1,4 @@
<?xml version="1.0" encoding="UTF-8" standalone="no"?> <?xml version="1.0" encoding="UTF-8" standalone="no"?>
<svg width="456" height="456" viewBox="0 0 456 456" version="1.1" xmlns="http://www.w3.org/2000/svg"> <svg width="456" height="456" viewBox="0 0 456 456" version="1.1" xmlns="http://www.w3.org/2000/svg">
<rect x="0" y="0" width="456" height="456" fill="#512BD4" /> <rect x="0" y="0" width="456" height="456" fill="#FFFFFF" />
</svg> </svg>

Before

Width:  |  Height:  |  Size: 228 B

After

Width:  |  Height:  |  Size: 229 B

Binary file not shown.

After

Width:  |  Height:  |  Size: 4.9 KiB

View File

@@ -1,8 +0,0 @@
<?xml version="1.0" encoding="UTF-8" standalone="no"?>
<!DOCTYPE svg PUBLIC "-//W3C//DTD SVG 1.1//EN" "http://www.w3.org/Graphics/SVG/1.1/DTD/svg11.dtd">
<svg width="456" height="456" viewBox="0 0 456 456" version="1.1" xmlns="http://www.w3.org/2000/svg" xmlns:xlink="http://www.w3.org/1999/xlink" xml:space="preserve" xmlns:serif="http://www.serif.com/" style="fill-rule:evenodd;clip-rule:evenodd;stroke-linejoin:round;stroke-miterlimit:2;">
<path d="m 105.50037,281.60863 c -2.70293,0 -5.00091,-0.90042 -6.893127,-2.70209 -1.892214,-1.84778 -2.837901,-4.04181 -2.837901,-6.58209 0,-2.58722 0.945687,-4.80389 2.837901,-6.65167 1.892217,-1.84778 4.190197,-2.77167 6.893127,-2.77167 2.74819,0 5.06798,0.92389 6.96019,2.77167 1.93749,1.84778 2.90581,4.06445 2.90581,6.65167 0,2.54028 -0.96832,4.73431 -2.90581,6.58209 -1.89221,1.80167 -4.212,2.70209 -6.96019,2.70209 z" style="fill:#ffffff;fill-rule:nonzero;stroke-width:0.838376" />
<path d="M 213.56111,280.08446 H 195.99044 L 149.69953,207.0544 c -1.17121,-1.84778 -2.14037,-3.76515 -2.90581,-5.75126 h -0.40578 c 0.36051,2.12528 0.54076,6.67515 0.54076,13.6496 v 65.13172 h -15.54349 v -99.36009 h 18.71925 l 44.7374,71.29798 c 1.89222,2.95695 3.1087,4.98917 3.64945,6.09751 h 0.26996 c -0.45021,-2.6325 -0.67573,-7.09015 -0.67573,-13.37293 v -64.02256 h 15.47557 z" style="fill:#ffffff;fill-rule:nonzero;stroke-width:0.838376" />
<path d="m 289.25134,280.08446 h -54.40052 v -99.36009 h 52.23835 v 13.99669 h -36.15411 v 28.13085 h 33.31621 v 13.9271 h -33.31621 v 29.37835 h 38.31628 z" style="fill:#ffffff;fill-rule:nonzero;stroke-width:0.838376" />
<path d="M 366.56466,194.72106 H 338.7222 v 85.3634 h -16.08423 v -85.3634 h -27.77455 v -13.99669 h 71.70124 z" style="fill:#ffffff;fill-rule:nonzero;stroke-width:0.838376" />
</svg>

Before

Width:  |  Height:  |  Size: 1.8 KiB

View File

@@ -1,8 +0,0 @@
<?xml version="1.0" encoding="UTF-8" standalone="no"?>
<!DOCTYPE svg PUBLIC "-//W3C//DTD SVG 1.1//EN" "http://www.w3.org/Graphics/SVG/1.1/DTD/svg11.dtd">
<svg width="456" height="456" viewBox="0 0 456 456" version="1.1" xmlns="http://www.w3.org/2000/svg" xmlns:xlink="http://www.w3.org/1999/xlink" xml:space="preserve" xmlns:serif="http://www.serif.com/" style="fill-rule:evenodd;clip-rule:evenodd;stroke-linejoin:round;stroke-miterlimit:2;">
<path d="m 105.50037,281.60863 c -2.70293,0 -5.00091,-0.90042 -6.893127,-2.70209 -1.892214,-1.84778 -2.837901,-4.04181 -2.837901,-6.58209 0,-2.58722 0.945687,-4.80389 2.837901,-6.65167 1.892217,-1.84778 4.190197,-2.77167 6.893127,-2.77167 2.74819,0 5.06798,0.92389 6.96019,2.77167 1.93749,1.84778 2.90581,4.06445 2.90581,6.65167 0,2.54028 -0.96832,4.73431 -2.90581,6.58209 -1.89221,1.80167 -4.212,2.70209 -6.96019,2.70209 z" style="fill:#ffffff;fill-rule:nonzero;stroke-width:0.838376" />
<path d="M 213.56111,280.08446 H 195.99044 L 149.69953,207.0544 c -1.17121,-1.84778 -2.14037,-3.76515 -2.90581,-5.75126 h -0.40578 c 0.36051,2.12528 0.54076,6.67515 0.54076,13.6496 v 65.13172 h -15.54349 v -99.36009 h 18.71925 l 44.7374,71.29798 c 1.89222,2.95695 3.1087,4.98917 3.64945,6.09751 h 0.26996 c -0.45021,-2.6325 -0.67573,-7.09015 -0.67573,-13.37293 v -64.02256 h 15.47557 z" style="fill:#ffffff;fill-rule:nonzero;stroke-width:0.838376" />
<path d="m 289.25134,280.08446 h -54.40052 v -99.36009 h 52.23835 v 13.99669 h -36.15411 v 28.13085 h 33.31621 v 13.9271 h -33.31621 v 29.37835 h 38.31628 z" style="fill:#ffffff;fill-rule:nonzero;stroke-width:0.838376" />
<path d="M 366.56466,194.72106 H 338.7222 v 85.3634 h -16.08423 v -85.3634 h -27.77455 v -13.99669 h 71.70124 z" style="fill:#ffffff;fill-rule:nonzero;stroke-width:0.838376" />
</svg>

Before

Width:  |  Height:  |  Size: 1.8 KiB

Binary file not shown.

After

Width:  |  Height:  |  Size: 265 KiB

View File

@@ -109,7 +109,7 @@ public sealed class BleScanner
new InvalidOperationException("Bluetooth is turned off."), new InvalidOperationException("Bluetooth is turned off."),
BluetoothState.Unauthorized => BluetoothState.Unauthorized =>
new PermissionException( new PermissionException(
"Bluetooth access is denied. Enable Field Logger in System Settings > Privacy & Security > Bluetooth."), "Bluetooth access is denied. Enable UM Trace in System Settings > Privacy & Security > Bluetooth."),
BluetoothState.Unavailable => BluetoothState.Unavailable =>
new InvalidOperationException("Bluetooth is not available on this Mac."), new InvalidOperationException("Bluetooth is not available on this Mac."),
_ => new InvalidOperationException($"Bluetooth is not ready (state: {_bluetooth.State}).") _ => new InvalidOperationException($"Bluetooth is not ready (state: {_bluetooth.State}).")

View File

@@ -0,0 +1,105 @@
using System.ComponentModel;
using CommunityToolkit.Mvvm.ComponentModel;
using FieldLogger.Models;
using FieldLogger.Services;
namespace FieldLogger.ViewModels;
/// <summary>
/// Shared, glanceable hardware status shown above each primary workflow. The timer marks
/// position data stale even when the receiver stops sending without disconnecting.
/// </summary>
public sealed partial class AppStatusViewModel : ObservableObject
{
private static readonly TimeSpan StaleAfter = TimeSpan.FromSeconds(2);
private readonly DeviceConnectionManager _manager;
private readonly MaglinkService _gps;
[ObservableProperty]
private ConnectionState _locatorState;
[ObservableProperty]
private ConnectionState _gnssState;
[ObservableProperty]
private string _locatorStatus = "Locator disconnected";
[ObservableProperty]
private string _gnssStatus = "GNSS disconnected";
[ObservableProperty]
private string _positionSummary = "No GNSS fix · accuracy —";
public AppStatusViewModel(DeviceConnectionManager manager, MaglinkService gps)
{
_manager = manager;
_gps = gps;
_manager.PropertyChanged += OnConnectionPropertyChanged;
_gps.FixReceived += OnFixReceived;
Refresh();
}
private void OnConnectionPropertyChanged(object? sender, PropertyChangedEventArgs e)
{
if (e.PropertyName is nameof(DeviceConnectionManager.LocatorState)
or nameof(DeviceConnectionManager.GpsState)
or nameof(DeviceConnectionManager.LocatorName)
or nameof(DeviceConnectionManager.GpsName))
{
Refresh();
}
}
private void OnFixReceived(object? sender, GnssFix fix) => Refresh();
/// <summary>Refreshes status safely from device callbacks or a UI dispatcher timer.</summary>
public void Refresh()
{
var dispatcher = Application.Current?.Dispatcher;
if (dispatcher?.IsDispatchRequired == true)
{
dispatcher.Dispatch(RefreshCore);
return;
}
RefreshCore();
}
private void RefreshCore()
{
LocatorState = _manager.LocatorState;
GnssState = _manager.GpsState;
LocatorStatus = DeviceLabel("Locator", _manager.LocatorName, LocatorState);
GnssStatus = DeviceLabel("GNSS", _manager.GpsName, GnssState);
var fix = _gps.LatestFix;
if (fix is null)
{
PositionSummary = GnssState == ConnectionState.Connected
? "Waiting for fix · accuracy —"
: "No GNSS fix · accuracy —";
return;
}
var stale = DateTime.UtcNow - fix.ReceivedUtc > StaleAfter;
var staleLabel = stale ? " · STALE" : string.Empty;
PositionSummary = $"{fix.StatusLabel}{staleLabel} · H ±{fix.Hrms:F3} m · " +
$"V ±{fix.Vrms:F3} m · {fix.SatellitesUsed} sats · corr {fix.CorrectionAgeSeconds:F1} s";
}
private static string DeviceLabel(string kind, string? name, ConnectionState state)
{
var stateText = state switch
{
ConnectionState.Connected => "connected",
ConnectionState.Connecting => "connecting",
_ => "disconnected",
};
return state == ConnectionState.Disconnected || string.IsNullOrWhiteSpace(name)
? $"{kind} {stateText}"
: $"{kind} {stateText} · {name}";
}
}

View File

@@ -42,6 +42,13 @@ public sealed partial class HomeViewModel : ObservableObject
public bool HasNoActiveJob => !HasActiveJob; public bool HasNoActiveJob => !HasActiveJob;
public bool IsDeviceConsoleAvailable { get; } =
#if DEBUG
true;
#else
false;
#endif
public string ActiveJobPointSummary => PointCount == 1 public string ActiveJobPointSummary => PointCount == 1
? "1 point saved locally" ? "1 point saved locally"
: $"{PointCount} points saved locally"; : $"{PointCount} points saved locally";
@@ -73,13 +80,6 @@ public sealed partial class HomeViewModel : ObservableObject
/// <summary>Called from the page's OnAppearing.</summary> /// <summary>Called from the page's OnAppearing.</summary>
public async Task InitializeAsync() public async Task InitializeAsync()
{ {
// First launch: nothing saved yet, send the user to device selection.
if (!_manager.HasSavedDevice(DeviceKind.Locator) && !_manager.HasSavedDevice(DeviceKind.RtkGps))
{
await Shell.Current.GoToAsync($"devicescan?kind={DeviceKind.Locator}");
return;
}
_manager.Start(); _manager.Start();
await RefreshJobAsync(); await RefreshJobAsync();
} }
@@ -139,6 +139,9 @@ public sealed partial class HomeViewModel : ObservableObject
[RelayCommand] [RelayCommand]
private Task ViewMapAsync() => Shell.Current.GoToAsync("//map"); private Task ViewMapAsync() => Shell.Current.GoToAsync("//map");
[RelayCommand]
private Task OpenDeviceConsoleAsync() => Shell.Current.GoToAsync("deviceconsole");
private void OnFixReceived(object? sender, GnssFix fix) private void OnFixReceived(object? sender, GnssFix fix)
{ {
MainThread.BeginInvokeOnMainThread(() => MainThread.BeginInvokeOnMainThread(() =>

View File

@@ -40,41 +40,112 @@ public sealed partial class JobsViewModel : ObservableObject
{ {
private readonly AppDatabase _database; private readonly AppDatabase _database;
private readonly SettingsService _settings; private readonly SettingsService _settings;
private readonly SemaphoreSlim _refreshGate = new(1, 1);
public ObservableCollection<JobListItem> Jobs { get; } = new(); public ObservableCollection<JobListItem> Jobs { get; } = new();
[ObservableProperty] [ObservableProperty]
private bool _isBusy; private bool _isBusy;
[ObservableProperty]
private bool _isRefreshing;
public JobsViewModel(AppDatabase database, SettingsService settings) public JobsViewModel(AppDatabase database, SettingsService settings)
{ {
_database = database; _database = database;
_settings = settings; _settings = settings;
} }
public Task LoadAsync()
=> ReloadAsync(showRefreshIndicator: false, skipIfBusy: true);
[RelayCommand] [RelayCommand]
public async Task RefreshAsync() private Task RefreshAsync()
=> ReloadAsync(showRefreshIndicator: true, skipIfBusy: false);
private async Task ReloadAsync(bool showRefreshIndicator, bool skipIfBusy)
{ {
IsBusy = true; var entered = skipIfBusy
? await _refreshGate.WaitAsync(0)
: await WaitForRefreshGateAsync();
if (!entered)
return;
try try
{ {
IsBusy = true;
if (showRefreshIndicator)
IsRefreshing = true;
var jobs = await _database.GetJobsAsync(); var jobs = await _database.GetJobsAsync();
var activeId = _settings.ActiveJobId; var activeId = _settings.ActiveJobId;
Jobs.Clear(); // Build a snapshot off-screen, then reconcile it with the existing observable
// collection. Keeping the existing rows prevents CollectionView from repeatedly
// discarding its measured cells and jumping back to the top.
var items = new List<JobListItem>(jobs.Count);
foreach (var job in jobs) foreach (var job in jobs)
{ {
Jobs.Add(new JobListItem items.Add(new JobListItem
{ {
Job = job, Job = job,
PointCount = await _database.GetPointCountAsync(job.Id), PointCount = await _database.GetPointCountAsync(job.Id),
IsActive = job.Id == activeId, IsActive = job.Id == activeId,
}); });
} }
ApplySnapshot(items);
} }
finally finally
{ {
if (showRefreshIndicator)
IsRefreshing = false;
IsBusy = false; IsBusy = false;
_refreshGate.Release();
}
}
private async Task<bool> WaitForRefreshGateAsync()
{
await _refreshGate.WaitAsync();
return true;
}
private void ApplySnapshot(IReadOnlyList<JobListItem> incoming)
{
var incomingIds = incoming.Select(item => item.Job.Id).ToHashSet();
for (var index = Jobs.Count - 1; index >= 0; index--)
{
if (!incomingIds.Contains(Jobs[index].Job.Id))
Jobs.RemoveAt(index);
}
for (var targetIndex = 0; targetIndex < incoming.Count; targetIndex++)
{
var replacement = incoming[targetIndex];
var existingIndex = -1;
for (var index = targetIndex; index < Jobs.Count; index++)
{
if (Jobs[index].Job.Id == replacement.Job.Id)
{
existingIndex = index;
break;
}
}
if (existingIndex < 0)
{
Jobs.Insert(targetIndex, replacement);
continue;
}
var existing = Jobs[existingIndex];
existing.PointCount = replacement.PointCount;
existing.IsActive = replacement.IsActive;
if (existingIndex != targetIndex)
Jobs.Move(existingIndex, targetIndex);
} }
} }
@@ -101,7 +172,7 @@ public sealed partial class JobsViewModel : ObservableObject
_settings.ActiveJobId = job.Id; _settings.ActiveJobId = job.Id;
Console.WriteLine($"NewJobAsync: Set active job to {job.Id}"); Console.WriteLine($"NewJobAsync: Set active job to {job.Id}");
await RefreshAsync(); await ReloadAsync(showRefreshIndicator: false, skipIfBusy: false);
Console.WriteLine("NewJobAsync: Refresh complete"); Console.WriteLine("NewJobAsync: Refresh complete");
} }
catch (Exception ex) catch (Exception ex)
@@ -135,6 +206,6 @@ public sealed partial class JobsViewModel : ObservableObject
await _database.DeleteJobAsync(item.Job.Id); await _database.DeleteJobAsync(item.Job.Id);
if (_settings.ActiveJobId == item.Job.Id) if (_settings.ActiveJobId == item.Job.Id)
_settings.ActiveJobId = null; _settings.ActiveJobId = null;
await RefreshAsync(); await ReloadAsync(showRefreshIndicator: false, skipIfBusy: false);
} }
} }

View File

@@ -2,118 +2,31 @@ using CommunityToolkit.Mvvm.ComponentModel;
using CommunityToolkit.Mvvm.Input; using CommunityToolkit.Mvvm.Input;
using FieldLogger.Models; using FieldLogger.Models;
using FieldLogger.Services; using FieldLogger.Services;
using FieldLogger.Services.Sync;
namespace FieldLogger.ViewModels; namespace FieldLogger.ViewModels;
public sealed partial class SettingsViewModel : ObservableObject public sealed partial class SettingsViewModel : ObservableObject
{ {
private readonly DeviceConnectionManager _manager; private readonly DeviceConnectionManager _manager;
private readonly SettingsService _settings;
private readonly IMqttSyncService _sync;
public DeviceConnectionManager Manager => _manager; public DeviceConnectionManager Manager => _manager;
[ObservableProperty]
private string _mapsApiKey = "";
[ObservableProperty]
private bool _mqttEnabled;
[ObservableProperty]
private string _mqttHost = "";
[ObservableProperty]
private string _mqttPort = "443";
[ObservableProperty]
private string _mqttOrgId = "";
[ObservableProperty]
private string _mqttPassword = "";
[ObservableProperty]
private string _syncStatus = "";
[ObservableProperty]
private bool _isSavingSync;
public string MqttClientId => _settings.MqttClientId;
public string AppVersion => AppInfo.Current.VersionString; public string AppVersion => AppInfo.Current.VersionString;
public SettingsViewModel(DeviceConnectionManager manager, SettingsService settings, IMqttSyncService sync) public SettingsViewModel(DeviceConnectionManager manager)
{ {
_manager = manager; _manager = manager;
_settings = settings;
_sync = sync;
MapsApiKey = settings.GoogleMapsApiKey;
MqttEnabled = settings.MqttEnabled;
MqttHost = settings.MqttHost;
MqttPort = settings.MqttPort.ToString();
MqttOrgId = settings.MqttOrgId;
SyncStatus = sync.Status;
_sync.StatusChanged += OnSyncStatusChanged;
} }
partial void OnMapsApiKeyChanged(string value) => _settings.GoogleMapsApiKey = value.Trim();
[RelayCommand]
private async Task SaveSyncAsync()
{
if (!int.TryParse(MqttPort, out var port) || port is < 1 or > 65535)
{
await Shell.Current.DisplayAlert("Invalid MQTT Port", "Enter a port between 1 and 65535.", "OK");
return;
}
if (MqttEnabled && (string.IsNullOrWhiteSpace(MqttHost) || string.IsNullOrWhiteSpace(MqttOrgId)))
{
await Shell.Current.DisplayAlert("Incomplete Sync Settings", "Host and organization id are required.", "OK");
return;
}
IsSavingSync = true;
try
{
_settings.MqttHost = MqttHost;
_settings.MqttPort = port;
_settings.MqttOrgId = MqttOrgId;
_settings.MqttEnabled = MqttEnabled;
if (!string.IsNullOrWhiteSpace(MqttPassword))
{
await _settings.SetMqttPasswordAsync(MqttPassword);
MqttPassword = "";
}
if (MqttEnabled)
{
await _sync.ConnectAsync();
await Shell.Current.DisplayAlert("Sync Connected", "The durable MQTT queue is connected.", "OK");
}
else
{
await _sync.DisconnectAsync();
}
}
catch (Exception ex)
{
await Shell.Current.DisplayAlert("Sync Connection Failed", ex.Message, "OK");
}
finally
{
IsSavingSync = false;
}
}
private void OnSyncStatusChanged(object? sender, string status) =>
MainThread.BeginInvokeOnMainThread(() => SyncStatus = status);
[RelayCommand] [RelayCommand]
private Task ChangeLocatorAsync() => Shell.Current.GoToAsync($"devicescan?kind={DeviceKind.Locator}"); private Task ChangeLocatorAsync() => Shell.Current.GoToAsync($"devicescan?kind={DeviceKind.Locator}");
[RelayCommand] [RelayCommand]
private Task ChangeGpsAsync() => Shell.Current.GoToAsync($"devicescan?kind={DeviceKind.RtkGps}"); private Task ChangeGpsAsync() => Shell.Current.GoToAsync($"devicescan?kind={DeviceKind.RtkGps}");
[RelayCommand]
private Task OpenDebugAsync() => Shell.Current.GoToAsync("debug");
[RelayCommand] [RelayCommand]
private async Task ForgetLocatorAsync() private async Task ForgetLocatorAsync()
{ {

View File

@@ -0,0 +1,35 @@
<?xml version="1.0" encoding="utf-8" ?>
<ContentView xmlns="http://schemas.microsoft.com/dotnet/2021/maui"
xmlns:x="http://schemas.microsoft.com/winfx/2009/xaml"
xmlns:vm="clr-namespace:FieldLogger.ViewModels"
x:Class="FieldLogger.Views.Controls.AppStatusBar"
x:DataType="vm:AppStatusViewModel">
<Border BackgroundColor="{DynamicResource UlColorSurfaceStrong}"
StrokeThickness="0" Padding="12,8">
<Grid RowDefinitions="Auto,Auto" RowSpacing="4">
<Grid ColumnDefinitions="*,*" ColumnSpacing="12">
<HorizontalStackLayout Spacing="6">
<Label Text="●" FontSize="13"
TextColor="{Binding LocatorState, Converter={StaticResource StateColor}}"
VerticalTextAlignment="Center" />
<Label Text="{Binding LocatorStatus}" FontSize="12"
TextColor="{DynamicResource UlColorOnStrong}"
LineBreakMode="TailTruncation" />
</HorizontalStackLayout>
<HorizontalStackLayout Grid.Column="1" Spacing="6">
<Label Text="●" FontSize="13"
TextColor="{Binding GnssState, Converter={StaticResource StateColor}}"
VerticalTextAlignment="Center" />
<Label Text="{Binding GnssStatus}" FontSize="12"
TextColor="{DynamicResource UlColorOnStrong}"
LineBreakMode="TailTruncation" />
</HorizontalStackLayout>
</Grid>
<Label Grid.Row="1" Text="{Binding PositionSummary}" FontSize="12"
FontFamily="{StaticResource UlTypeFamilyMono}"
TextColor="{DynamicResource UlColorOnStrong}"
LineBreakMode="TailTruncation"
SemanticProperties.Description="Current GNSS fix type, estimated accuracy, satellites, and correction age" />
</Grid>
</Border>
</ContentView>

View File

@@ -0,0 +1,40 @@
using FieldLogger.ViewModels;
namespace FieldLogger.Views.Controls;
public partial class AppStatusBar : ContentView
{
private IDispatcherTimer? _staleTimer;
public AppStatusBar()
{
InitializeComponent();
}
protected override void OnHandlerChanged()
{
base.OnHandlerChanged();
if (Handler is null)
{
_staleTimer?.Stop();
_staleTimer = null;
return;
}
if (_staleTimer is not null)
return;
_staleTimer = Dispatcher.CreateTimer();
_staleTimer.Interval = TimeSpan.FromSeconds(1);
_staleTimer.Tick += (_, _) => (BindingContext as AppStatusViewModel)?.Refresh();
_staleTimer.Start();
(BindingContext as AppStatusViewModel)?.Refresh();
}
protected override void OnBindingContextChanged()
{
base.OnBindingContextChanged();
(BindingContext as AppStatusViewModel)?.Refresh();
}
}

View File

@@ -0,0 +1,15 @@
<?xml version="1.0" encoding="utf-8" ?>
<ContentView xmlns="http://schemas.microsoft.com/dotnet/2021/maui"
xmlns:x="http://schemas.microsoft.com/winfx/2009/xaml"
x:Class="FieldLogger.Views.Controls.FloatingMenuButton">
<Button Text="☰" FontSize="24" FontAttributes="Bold"
WidthRequest="56" HeightRequest="56" CornerRadius="28"
Padding="0" Margin="16"
BackgroundColor="{DynamicResource UlColorPrimary}"
TextColor="{DynamicResource UlColorOnPrimary}"
BorderColor="{DynamicResource UlColorSurfaceRaised}" BorderWidth="2"
Clicked="OnMenuClicked"
SemanticProperties.Description="Open UM Trace menu"
MinimumHeightRequest="{StaticResource UlTouchComfortable}"
MinimumWidthRequest="{StaticResource UlTouchComfortable}" />
</ContentView>

View File

@@ -0,0 +1,15 @@
namespace FieldLogger.Views.Controls;
public partial class FloatingMenuButton : ContentView
{
public FloatingMenuButton()
{
InitializeComponent();
}
private void OnMenuClicked(object? sender, EventArgs e)
{
if (Shell.Current is not null)
Shell.Current.FlyoutIsPresented = true;
}
}

View File

@@ -3,10 +3,13 @@
xmlns:x="http://schemas.microsoft.com/winfx/2009/xaml" xmlns:x="http://schemas.microsoft.com/winfx/2009/xaml"
xmlns:vm="clr-namespace:FieldLogger.ViewModels" xmlns:vm="clr-namespace:FieldLogger.ViewModels"
xmlns:models="clr-namespace:FieldLogger.Models" xmlns:models="clr-namespace:FieldLogger.Models"
xmlns:controls="clr-namespace:FieldLogger.Views.Controls"
x:Class="FieldLogger.Views.DebugPage" x:Class="FieldLogger.Views.DebugPage"
x:DataType="vm:DebugViewModel" x:DataType="vm:DebugViewModel"
Title="Debug"> Title="Device Console">
<ScrollView> <Grid RowDefinitions="Auto,*">
<controls:AppStatusBar x:Name="AppStatus" />
<ScrollView Grid.Row="1">
<VerticalStackLayout Padding="16" Spacing="12"> <VerticalStackLayout Padding="16" Spacing="12">
<Label Text="Connection Status" FontAttributes="Bold" FontSize="16" /> <Label Text="Connection Status" FontAttributes="Bold" FontSize="16" />
@@ -88,4 +91,5 @@
</VerticalStackLayout> </VerticalStackLayout>
</ScrollView> </ScrollView>
</Grid>
</ContentPage> </ContentPage>

View File

@@ -6,11 +6,12 @@ public partial class DebugPage : ContentPage
{ {
private readonly DebugViewModel _viewModel; private readonly DebugViewModel _viewModel;
public DebugPage(DebugViewModel viewModel) public DebugPage(DebugViewModel viewModel, AppStatusViewModel appStatusViewModel)
{ {
InitializeComponent(); InitializeComponent();
_viewModel = viewModel; _viewModel = viewModel;
BindingContext = viewModel; BindingContext = viewModel;
AppStatus.BindingContext = appStatusViewModel;
} }
protected override void OnAppearing() protected override void OnAppearing()

View File

@@ -3,16 +3,19 @@
xmlns:x="http://schemas.microsoft.com/winfx/2009/xaml" xmlns:x="http://schemas.microsoft.com/winfx/2009/xaml"
xmlns:vm="clr-namespace:FieldLogger.ViewModels" xmlns:vm="clr-namespace:FieldLogger.ViewModels"
xmlns:models="clr-namespace:FieldLogger.Models" xmlns:models="clr-namespace:FieldLogger.Models"
xmlns:controls="clr-namespace:FieldLogger.Views.Controls"
x:Class="FieldLogger.Views.HomePage" x:Class="FieldLogger.Views.HomePage"
x:DataType="vm:HomeViewModel" x:DataType="vm:HomeViewModel"
Title="Field Logger" Title="Debug"
BackgroundColor="{DynamicResource UlColorCanvas}"> BackgroundColor="{DynamicResource UlColorCanvas}">
<ScrollView> <Grid RowDefinitions="Auto,*">
<controls:AppStatusBar x:Name="AppStatus" />
<ScrollView Grid.Row="1">
<VerticalStackLayout Padding="16" Spacing="16"> <VerticalStackLayout Padding="16" Spacing="16">
<VerticalStackLayout Spacing="4"> <VerticalStackLayout Spacing="4">
<Label Text="FIELD LOGGER" FontSize="14" FontAttributes="Bold" CharacterSpacing="1.5" <Label Text="UM TRACE DEBUG" FontSize="14" FontAttributes="Bold" CharacterSpacing="1.5"
TextColor="{DynamicResource UlColorPrimary}" /> TextColor="{DynamicResource UlColorPrimary}" />
<Label Text="Live field capture" Style="{StaticResource UlPageTitle}" <Label Text="Capture diagnostics" Style="{StaticResource UlPageTitle}"
TextColor="{DynamicResource UlColorText}" TextColor="{DynamicResource UlColorText}"
SemanticProperties.HeadingLevel="Level1" /> SemanticProperties.HeadingLevel="Level1" />
</VerticalStackLayout> </VerticalStackLayout>
@@ -187,6 +190,13 @@
</DataTemplate> </DataTemplate>
</CollectionView.ItemTemplate> </CollectionView.ItemTemplate>
</CollectionView> </CollectionView>
<Button Style="{StaticResource UlButtonSecondary}"
Text="Open device console" Command="{Binding OpenDeviceConsoleCommand}"
IsVisible="{Binding IsDeviceConsoleAvailable}"
MinimumHeightRequest="{StaticResource UlTouchMinimum}"
SemanticProperties.Description="Open raw locator and GNSS device messages" />
</VerticalStackLayout> </VerticalStackLayout>
</ScrollView> </ScrollView>
</Grid>
</ContentPage> </ContentPage>

View File

@@ -7,10 +7,11 @@ public partial class HomePage : ContentPage
private readonly HomeViewModel _viewModel; private readonly HomeViewModel _viewModel;
private bool _initialized; private bool _initialized;
public HomePage(HomeViewModel viewModel) public HomePage(HomeViewModel viewModel, AppStatusViewModel appStatusViewModel)
{ {
InitializeComponent(); InitializeComponent();
BindingContext = _viewModel = viewModel; BindingContext = _viewModel = viewModel;
AppStatus.BindingContext = appStatusViewModel;
} }
protected override async void OnAppearing() protected override async void OnAppearing()

View File

@@ -3,11 +3,14 @@
xmlns:x="http://schemas.microsoft.com/winfx/2009/xaml" xmlns:x="http://schemas.microsoft.com/winfx/2009/xaml"
xmlns:vm="clr-namespace:FieldLogger.ViewModels" xmlns:vm="clr-namespace:FieldLogger.ViewModels"
xmlns:models="clr-namespace:FieldLogger.Models" xmlns:models="clr-namespace:FieldLogger.Models"
xmlns:controls="clr-namespace:FieldLogger.Views.Controls"
x:Class="FieldLogger.Views.JobDetailPage" x:Class="FieldLogger.Views.JobDetailPage"
x:DataType="vm:JobDetailViewModel" x:DataType="vm:JobDetailViewModel"
Title="{Binding JobName}" Title="{Binding JobName}"
BackgroundColor="{DynamicResource UlColorCanvas}"> BackgroundColor="{DynamicResource UlColorCanvas}">
<Grid RowDefinitions="Auto,*" Padding="16" RowSpacing="16"> <Grid RowDefinitions="Auto,*">
<controls:AppStatusBar x:Name="AppStatus" />
<Grid Grid.Row="1" RowDefinitions="Auto,*" Padding="16" RowSpacing="16">
<Border Style="{StaticResource UlCard}" BackgroundColor="{DynamicResource UlColorSurfaceRaised}" <Border Style="{StaticResource UlCard}" BackgroundColor="{DynamicResource UlColorSurfaceRaised}"
Stroke="{DynamicResource UlColorBorder}" StrokeShape="RoundRectangle 12" Padding="16"> Stroke="{DynamicResource UlColorBorder}" StrokeShape="RoundRectangle 12" Padding="16">
<Grid RowDefinitions="Auto,Auto" ColumnDefinitions="*,Auto" RowSpacing="6" ColumnSpacing="12"> <Grid RowDefinitions="Auto,Auto" ColumnDefinitions="*,Auto" RowSpacing="6" ColumnSpacing="12">
@@ -37,7 +40,7 @@
<VerticalStackLayout Spacing="8"> <VerticalStackLayout Spacing="8">
<Label Text="No captures for this job" Style="{StaticResource UlEmptyStateTitle}" <Label Text="No captures for this job" Style="{StaticResource UlEmptyStateTitle}"
HorizontalTextAlignment="Center" TextColor="{DynamicResource UlColorText}" /> HorizontalTextAlignment="Center" TextColor="{DynamicResource UlColorText}" />
<Label Text="Return Home and press LOG on the receiver when the job is active." <Label Text="Open Debug from Settings and press LOG on the receiver when the job is active."
Style="{StaticResource UlEmptyStateBody}" Style="{StaticResource UlEmptyStateBody}"
FontSize="16" HorizontalTextAlignment="Center" FontSize="16" HorizontalTextAlignment="Center"
TextColor="{DynamicResource UlColorTextMuted}" /> TextColor="{DynamicResource UlColorTextMuted}" />
@@ -103,4 +106,5 @@
</CollectionView.ItemTemplate> </CollectionView.ItemTemplate>
</CollectionView> </CollectionView>
</Grid> </Grid>
</Grid>
</ContentPage> </ContentPage>

View File

@@ -6,10 +6,11 @@ public partial class JobDetailPage : ContentPage
{ {
private readonly JobDetailViewModel _viewModel; private readonly JobDetailViewModel _viewModel;
public JobDetailPage(JobDetailViewModel viewModel) public JobDetailPage(JobDetailViewModel viewModel, AppStatusViewModel appStatusViewModel)
{ {
InitializeComponent(); InitializeComponent();
BindingContext = _viewModel = viewModel; BindingContext = _viewModel = viewModel;
AppStatus.BindingContext = appStatusViewModel;
} }
protected override async void OnAppearing() protected override async void OnAppearing()

View File

@@ -2,11 +2,18 @@
<ContentPage xmlns="http://schemas.microsoft.com/dotnet/2021/maui" <ContentPage xmlns="http://schemas.microsoft.com/dotnet/2021/maui"
xmlns:x="http://schemas.microsoft.com/winfx/2009/xaml" xmlns:x="http://schemas.microsoft.com/winfx/2009/xaml"
xmlns:vm="clr-namespace:FieldLogger.ViewModels" xmlns:vm="clr-namespace:FieldLogger.ViewModels"
xmlns:controls="clr-namespace:FieldLogger.Views.Controls"
x:Class="FieldLogger.Views.JobsPage" x:Class="FieldLogger.Views.JobsPage"
x:DataType="vm:JobsViewModel" x:DataType="vm:JobsViewModel"
Title="Jobs" Title="Jobs"
Shell.NavBarIsVisible="False"
BackgroundColor="{DynamicResource UlColorCanvas}"> BackgroundColor="{DynamicResource UlColorCanvas}">
<Grid RowDefinitions="Auto,Auto,*" Padding="16" RowSpacing="16"> <Grid RowDefinitions="Auto,*"
HorizontalOptions="Fill" VerticalOptions="Fill">
<controls:AppStatusBar x:Name="AppStatus" />
<Grid Grid.Row="1" RowDefinitions="Auto,Auto,*" Padding="16" RowSpacing="16"
HorizontalOptions="Fill" VerticalOptions="Fill">
<VerticalStackLayout Spacing="4"> <VerticalStackLayout Spacing="4">
<Label Text="FIELD WORK" FontSize="14" FontAttributes="Bold" CharacterSpacing="1.5" <Label Text="FIELD WORK" FontSize="14" FontAttributes="Bold" CharacterSpacing="1.5"
TextColor="{DynamicResource UlColorPrimary}" /> TextColor="{DynamicResource UlColorPrimary}" />
@@ -22,9 +29,15 @@
MinimumHeightRequest="{StaticResource UlTouchComfortable}" FontSize="16" FontAttributes="Bold" MinimumHeightRequest="{StaticResource UlTouchComfortable}" FontSize="16" FontAttributes="Bold"
SemanticProperties.Description="Create a new job and make it active" /> SemanticProperties.Description="Create a new job and make it active" />
<RefreshView Grid.Row="2" Command="{Binding RefreshCommand}" IsRefreshing="{Binding IsBusy}"> <RefreshView Grid.Row="2"
Command="{Binding RefreshCommand}"
IsRefreshing="{Binding IsRefreshing, Mode=OneWay}"
HorizontalOptions="Fill" VerticalOptions="Fill">
<CollectionView ItemsSource="{Binding Jobs}" <CollectionView ItemsSource="{Binding Jobs}"
SelectionMode="None" SelectionMode="None"
ItemSizingStrategy="MeasureFirstItem"
ItemsUpdatingScrollMode="KeepItemsInView"
HorizontalOptions="Fill" VerticalOptions="Fill"
SemanticProperties.Description="Jobs available on this device"> SemanticProperties.Description="Jobs available on this device">
<CollectionView.EmptyView> <CollectionView.EmptyView>
<Border Style="{StaticResource UlCard}" BackgroundColor="{DynamicResource UlColorSurfaceRaised}" <Border Style="{StaticResource UlCard}" BackgroundColor="{DynamicResource UlColorSurfaceRaised}"
@@ -88,7 +101,15 @@
</Border> </Border>
</DataTemplate> </DataTemplate>
</CollectionView.ItemTemplate> </CollectionView.ItemTemplate>
<CollectionView.Footer>
<!-- Keeps the final row scrollable above the overlaid menu without
reserving a permanent bottom band in the page layout. -->
<ContentView HeightRequest="72" />
</CollectionView.Footer>
</CollectionView> </CollectionView>
</RefreshView> </RefreshView>
</Grid> </Grid>
<controls:FloatingMenuButton Grid.RowSpan="2" HorizontalOptions="End" VerticalOptions="End" ZIndex="20" />
</Grid>
</ContentPage> </ContentPage>

View File

@@ -6,15 +6,16 @@ public partial class JobsPage : ContentPage
{ {
private readonly JobsViewModel _viewModel; private readonly JobsViewModel _viewModel;
public JobsPage(JobsViewModel viewModel) public JobsPage(JobsViewModel viewModel, AppStatusViewModel appStatusViewModel)
{ {
InitializeComponent(); InitializeComponent();
BindingContext = _viewModel = viewModel; BindingContext = _viewModel = viewModel;
AppStatus.BindingContext = appStatusViewModel;
} }
protected override async void OnAppearing() protected override async void OnAppearing()
{ {
base.OnAppearing(); base.OnAppearing();
await _viewModel.RefreshAsync(); await _viewModel.LoadAsync();
} }
} }

View File

@@ -2,34 +2,31 @@
<ContentPage xmlns="http://schemas.microsoft.com/dotnet/2021/maui" <ContentPage xmlns="http://schemas.microsoft.com/dotnet/2021/maui"
xmlns:x="http://schemas.microsoft.com/winfx/2009/xaml" xmlns:x="http://schemas.microsoft.com/winfx/2009/xaml"
xmlns:vm="clr-namespace:FieldLogger.ViewModels" xmlns:vm="clr-namespace:FieldLogger.ViewModels"
xmlns:controls="clr-namespace:FieldLogger.Views.Controls"
x:Class="FieldLogger.Views.MapPage" x:Class="FieldLogger.Views.MapPage"
x:DataType="vm:MapViewModel" x:DataType="vm:MapViewModel"
Title="Map" Title="Map"
Shell.NavBarIsVisible="False"
BackgroundColor="{DynamicResource UlColorMap}"> BackgroundColor="{DynamicResource UlColorMap}">
<Grid RowDefinitions="Auto,*"> <Grid>
<Border Style="{StaticResource UlCard}" Margin="12" Padding="16" BackgroundColor="{DynamicResource UlColorSurfaceRaised}"
Stroke="{DynamicResource UlColorBorder}" StrokeShape="RoundRectangle 12"
ZIndex="1">
<Grid RowDefinitions="Auto,Auto" ColumnDefinitions="*,Auto" RowSpacing="4" ColumnSpacing="12">
<VerticalStackLayout>
<Label Text="LIVE MAP" FontSize="14" FontAttributes="Bold" CharacterSpacing="1.5"
TextColor="{DynamicResource UlColorPrimary}" />
<Label Text="{Binding JobName, TargetNullValue='No active job'}"
Style="{StaticResource UlSectionTitle}" TextColor="{DynamicResource UlColorText}"
SemanticProperties.HeadingLevel="Level1" />
</VerticalStackLayout>
<Button Grid.Column="1" Style="{StaticResource UlButtonSecondary}"
Text="Refresh" Clicked="OnRefreshClicked"
MinimumHeightRequest="{StaticResource UlTouchMinimum}" MinimumWidthRequest="88"
SemanticProperties.Description="Refresh captured points on the map" />
<Label Grid.Row="1" Grid.ColumnSpan="2" Text="{Binding StatusText}" FontSize="14"
TextColor="{DynamicResource UlColorTextMuted}"
SemanticProperties.Description="Current map data status" />
</Grid>
</Border>
<!-- Populated in code-behind: native Map control on iOS/Android/macOS, Google Maps WebView on Windows. --> <!-- Populated in code-behind: native Map control on iOS/Android/macOS, Google Maps WebView on Windows. -->
<ContentView Grid.RowSpan="2" x:Name="MapHost" <ContentView x:Name="MapHost"
BackgroundColor="{DynamicResource UlColorMap}" BackgroundColor="{DynamicResource UlColorMap}"
SemanticProperties.Description="Map of locally captured points for the selected job" /> SemanticProperties.Description="Map of locally captured points for the selected job" />
<controls:AppStatusBar x:Name="AppStatus" VerticalOptions="Start" ZIndex="20" />
<Button Text="↻" FontSize="22" FontAttributes="Bold"
WidthRequest="48" HeightRequest="48" CornerRadius="24" Padding="0"
Margin="16,82,16,16" HorizontalOptions="End" VerticalOptions="Start"
BackgroundColor="{DynamicResource UlColorSurfaceRaised}"
TextColor="{DynamicResource UlColorPrimary}"
BorderColor="{DynamicResource UlColorBorder}" BorderWidth="1"
Clicked="OnRefreshClicked" ZIndex="20"
MinimumHeightRequest="{StaticResource UlTouchMinimum}"
MinimumWidthRequest="{StaticResource UlTouchMinimum}"
SemanticProperties.Description="Refresh captured points on the map" />
<controls:FloatingMenuButton HorizontalOptions="End" VerticalOptions="End" ZIndex="20" />
</Grid> </Grid>
</ContentPage> </ContentPage>

View File

@@ -23,10 +23,11 @@ public partial class MapPage : ContentPage
private Map? _map; private Map? _map;
#endif #endif
public MapPage(MapViewModel viewModel) public MapPage(MapViewModel viewModel, AppStatusViewModel appStatusViewModel)
{ {
InitializeComponent(); InitializeComponent();
BindingContext = _viewModel = viewModel; BindingContext = _viewModel = viewModel;
AppStatus.BindingContext = appStatusViewModel;
} }
protected override async void OnAppearing() protected override async void OnAppearing()

View File

@@ -2,11 +2,20 @@
<ContentPage xmlns="http://schemas.microsoft.com/dotnet/2021/maui" <ContentPage xmlns="http://schemas.microsoft.com/dotnet/2021/maui"
xmlns:x="http://schemas.microsoft.com/winfx/2009/xaml" xmlns:x="http://schemas.microsoft.com/winfx/2009/xaml"
xmlns:vm="clr-namespace:FieldLogger.ViewModels" xmlns:vm="clr-namespace:FieldLogger.ViewModels"
xmlns:controls="clr-namespace:FieldLogger.Views.Controls"
x:Class="FieldLogger.Views.SettingsPage" x:Class="FieldLogger.Views.SettingsPage"
x:DataType="vm:SettingsViewModel" x:DataType="vm:SettingsViewModel"
Title="Settings"> Title="Settings"
<ScrollView> Shell.NavBarIsVisible="False"
<VerticalStackLayout Padding="16" Spacing="12"> BackgroundColor="{DynamicResource UlColorCanvas}">
<Grid RowDefinitions="Auto,*">
<controls:AppStatusBar x:Name="AppStatus" />
<ScrollView Grid.Row="1">
<VerticalStackLayout Padding="16,16,16,88" Spacing="12">
<Label Text="Settings" Style="{StaticResource UlPageTitle}"
TextColor="{DynamicResource UlColorText}"
SemanticProperties.HeadingLevel="Level1" />
<Label Text="Devices" FontAttributes="Bold" FontSize="16" /> <Label Text="Devices" FontAttributes="Bold" FontSize="16" />
@@ -40,36 +49,33 @@
</VerticalStackLayout> </VerticalStackLayout>
</Border> </Border>
<Label Text="Map" FontAttributes="Bold" FontSize="16" Margin="0,12,0,0" /> <VerticalStackLayout Spacing="8" Margin="0,12,0,0">
<Border StrokeThickness="0" Background="{AppThemeBinding Light=#F2F2F7, Dark=#1C1C1E}" StrokeShape="RoundRectangle 12" Padding="12"> <Label Text="Diagnostics" FontAttributes="Bold" FontSize="16" />
<VerticalStackLayout Spacing="6"> <Border Style="{StaticResource UlCard}"
<Label Text="Google Maps API Key (Windows map view)" FontSize="12" TextColor="Gray" /> BackgroundColor="{DynamicResource UlColorSurfaceRaised}"
<Entry Text="{Binding MapsApiKey}" Placeholder="AIza…" IsPassword="False" /> Stroke="{DynamicResource UlColorBorder}" StrokeShape="RoundRectangle 12" Padding="12">
<Label FontSize="11" TextColor="Gray" <Grid ColumnDefinitions="*,Auto" ColumnSpacing="12">
Text="On Android the key is configured in AndroidManifest.xml; iOS and macOS use Apple Maps and need no key." /> <VerticalStackLayout Spacing="2" VerticalOptions="Center">
<Label Text="Debug" FontAttributes="Bold" FontSize="16"
TextColor="{DynamicResource UlColorText}" />
<Label Text="Capture readiness, device state, sync, recent points, and console tools"
FontSize="12" TextColor="{DynamicResource UlColorTextMuted}" />
</VerticalStackLayout> </VerticalStackLayout>
</Border> <Button Grid.Column="1" Text="Open" Command="{Binding OpenDebugCommand}"
Style="{StaticResource UlButtonSecondary}"
<Label Text="Sync" FontAttributes="Bold" FontSize="16" Margin="0,12,0,0" /> MinimumHeightRequest="{StaticResource UlTouchMinimum}"
<Border StrokeThickness="0" Background="{AppThemeBinding Light=#F2F2F7, Dark=#1C1C1E}" StrokeShape="RoundRectangle 12" Padding="12"> SemanticProperties.Description="Open UM Trace diagnostics" />
<VerticalStackLayout Spacing="8">
<Grid ColumnDefinitions="*,Auto">
<Label Text="Durable cloud sync" VerticalOptions="Center" />
<Switch Grid.Column="1" IsToggled="{Binding MqttEnabled}" />
</Grid> </Grid>
<Entry Text="{Binding MqttHost}" Placeholder="dev.hub.umagul.net" />
<Entry Text="{Binding MqttPort}" Placeholder="443 (WSS) or 8884 (MQTTS)" Keyboard="Numeric" />
<Entry Text="{Binding MqttOrgId}" Placeholder="Organization ID / MQTT username" />
<Entry Text="{Binding MqttPassword}" Placeholder="New MQTT password (stored securely)" IsPassword="True" />
<Label Text="{Binding MqttClientId, StringFormat='Client: {0}'}" FontSize="10" TextColor="Gray" />
<Label Text="{Binding SyncStatus}" FontSize="12" TextColor="DodgerBlue" />
<Button Text="Save &amp; Connect" Command="{Binding SaveSyncCommand}" />
</VerticalStackLayout>
</Border> </Border>
</VerticalStackLayout>
<Label Text="{Binding AppVersion, StringFormat='Field Logger v{0}'}" <Label Text="{Binding AppVersion, StringFormat='UM Trace v{0}'}"
FontSize="11" TextColor="Gray" HorizontalOptions="Center" Margin="0,20,0,0" /> FontSize="11" TextColor="{DynamicResource UlColorTextMuted}"
HorizontalOptions="Center" Margin="0,20,0,0" />
</VerticalStackLayout> </VerticalStackLayout>
</ScrollView> </ScrollView>
<controls:FloatingMenuButton Grid.RowSpan="2" HorizontalOptions="End" VerticalOptions="End" ZIndex="20" />
</Grid>
</ContentPage> </ContentPage>

View File

@@ -4,9 +4,10 @@ namespace FieldLogger.Views;
public partial class SettingsPage : ContentPage public partial class SettingsPage : ContentPage
{ {
public SettingsPage(SettingsViewModel viewModel) public SettingsPage(SettingsViewModel viewModel, AppStatusViewModel appStatusViewModel)
{ {
InitializeComponent(); InitializeComponent();
BindingContext = viewModel; BindingContext = viewModel;
AppStatus.BindingContext = appStatusViewModel;
} }
} }

View File

@@ -1,4 +1,4 @@
# Field Logger # UM Trace
Cross-platform .NET MAUI app (Windows, macOS, iOS, Android) for logging utility locate Cross-platform .NET MAUI app (Windows, macOS, iOS, Android) for logging utility locate
points from an **Underground Magnetics locating receiver** paired with RTK GPS positions points from an **Underground Magnetics locating receiver** paired with RTK GPS positions

77
doc/iOS_TestFlight.md Normal file
View File

@@ -0,0 +1,77 @@
# UM Trace TestFlight build
## Fixed application identity
- Display name: `UM Trace`
- Bundle ID: `com.umagul.trace`
- Apple team ID: `W2N8APPQ2C`
- App Store Connect SKU: `UM-TRACE-IOS`
- Distribution profile: `UM Trace App Store`
The provisioning profile and all Apple signing files are local-only and covered by
`.gitignore`. Never commit a certificate, private key, App Store Connect API key, `.p12`, or
provisioning profile.
## Required local toolchain
- Xcode 26 at `/Applications/Xcode.app`
- .NET SDK 10.0.100 as the build host
- Workload set 10.0.100 with `maui-ios` and its .NET 9/iOS 26 compatibility pack
- An `Apple Distribution` identity, including its private key, in the login Keychain
- The `UM Trace App Store` provisioning profile installed locally
This repository's local SDK is installed at `~/.dotnet`. Verify it with:
```sh
~/.dotnet/dotnet --info
~/.dotnet/dotnet workload list
```
## Create an archive
Run the release helper from a normal macOS Terminal session. The build number must increase for
every upload to App Store Connect:
```sh
cd /Users/brent/ul-platform/app
./scripts/publish-testflight.sh 1
```
The app remains on its existing .NET 9 target. The .NET 10 SDK host supplies the supported .NET 9
compatibility pack for Xcode 26, avoiding an unrelated Android/Mac Catalyst framework migration.
The script deliberately supplies Xcode through `DEVELOPER_DIR`; it does not change the machine's
global `xcode-select` setting. It restores only the iOS target, builds with the iOS 26 SDK, selects
the installed `UM Trace App Store` profile, and prints the generated `.ipa` path.
Before uploading, verify that this command lists a valid distribution identity:
```sh
security find-identity -v -p codesigning
```
If the identity is absent, import a `.p12` containing the matching private key or create a new
Apple Distribution certificate through Xcode and regenerate the provisioning profile against it.
## Deploy a development build to an iPhone
The local development profile is named `UM Trace Development`. It must include the target phone
and match an `Apple Development` identity for team `W2N8APPQ2C`. Keep the phone unlocked and
connected by USB for the first deployment, trust the Mac when prompted, and enable Developer Mode.
Save the phone UDID in the gitignored `.ios-device` file, then run from a normal macOS Terminal:
```sh
cd /Users/brent/ul-platform/app
./scripts/deploy-ios-device.sh
```
You can instead pass a UDID as the first argument or set `UM_TRACE_DEVICE_UDID`. The helper uses
Xcode 26, builds the `Debug` configuration for `ios-arm64`, signs with the development profile,
installs the app, and launches it on the selected phone.
## Background and privacy declarations
The iOS bundle declares `bluetooth-central` and `location` background modes, Bluetooth and
always/when-in-use location explanations, the MAUI `UserDefaults` required-reason API, and exempt
standard TLS use. Physical-device testing remains required to prove the SRS eight-hour background
BLE/location session; declaring a background mode does not itself guarantee continuous execution.

60
scripts/deploy-ios-device.sh Executable file
View File

@@ -0,0 +1,60 @@
#!/usr/bin/env bash
set -euo pipefail
repo_dir="$(cd "$(dirname "${BASH_SOURCE[0]}")/.." && pwd)"
dotnet_bin="${DOTNET_BIN:-${HOME}/.dotnet/dotnet}"
developer_dir="${DEVELOPER_DIR:-/Applications/Xcode.app/Contents/Developer}"
codesign_key="${UM_TRACE_DEVELOPMENT_KEY:-Apple Development: Brent Perteet (WZ56HVC6FD)}"
codesign_profile="${UM_TRACE_DEVELOPMENT_PROVISION:-UM Trace Development}"
device_udid="${1:-${UM_TRACE_DEVICE_UDID:-}}"
if [[ -z "${device_udid}" && -f "${repo_dir}/.ios-device" ]]; then
IFS= read -r device_udid < "${repo_dir}/.ios-device"
fi
if [[ -z "${device_udid}" ]]; then
echo "Usage: $0 <device-udid>" >&2
echo "Alternatively, set UM_TRACE_DEVICE_UDID or save the UDID in ${repo_dir}/.ios-device." >&2
exit 2
fi
if [[ ! -x "${dotnet_bin}" ]]; then
echo "Missing .NET SDK at ${dotnet_bin}. Set DOTNET_BIN or install the local SDK." >&2
exit 2
fi
if [[ ! -d "${developer_dir}" ]]; then
echo "Missing Xcode developer directory at ${developer_dir}. Set DEVELOPER_DIR." >&2
exit 2
fi
export DEVELOPER_DIR="${developer_dir}"
"${dotnet_bin}" restore "${repo_dir}/FieldLogger/FieldLogger.csproj" \
-p:TargetFrameworks=net9.0-ios \
-p:RuntimeIdentifier=ios-arm64
# Restoring the MAUI head with a narrowed TargetFrameworks property can rewrite the
# referenced headless library's assets file. Restore that library explicitly before building.
"${dotnet_bin}" restore "${repo_dir}/src/FieldLogger.Sync/FieldLogger.Sync.csproj"
# A partial MSBuild target (for example, a compile-only IDE validation) can leave a
# FieldLogger.dll whose generated XAML code is newer than its embedded MauiXaml resources.
# Always clear the narrowed iOS output before the real device build so App.xaml, page XAML,
# app icons, and splash assets are regenerated as one consistent build graph.
"${dotnet_bin}" clean "${repo_dir}/FieldLogger/FieldLogger.csproj" \
-f net9.0-ios \
-c Debug \
-p:TargetFrameworks=net9.0-ios \
-p:RuntimeIdentifier=ios-arm64
"${dotnet_bin}" build "${repo_dir}/FieldLogger/FieldLogger.csproj" \
-t:Run \
-p:TargetFrameworks=net9.0-ios \
-f net9.0-ios \
-c Debug \
-p:RuntimeIdentifier=ios-arm64 \
-p:_DeviceName="${device_udid}" \
-p:CodesignKey="${codesign_key}" \
-p:CodesignProvision="${codesign_profile}" \
--no-restore

49
scripts/publish-testflight.sh Executable file
View File

@@ -0,0 +1,49 @@
#!/usr/bin/env bash
set -euo pipefail
repo_dir="$(cd "$(dirname "${BASH_SOURCE[0]}")/.." && pwd)"
dotnet_bin="${DOTNET_BIN:-${HOME}/.dotnet/dotnet}"
developer_dir="${DEVELOPER_DIR:-/Applications/Xcode.app/Contents/Developer}"
build_number="${1:-}"
codesign_key="${UM_TRACE_CODESIGN_KEY:-Apple Distribution}"
codesign_profile="${UM_TRACE_CODESIGN_PROVISION:-UM Trace App Store}"
if [[ ! "${build_number}" =~ ^[0-9]+$ ]]; then
echo "Usage: $0 <numeric-build-number>" >&2
exit 2
fi
if [[ ! -x "${dotnet_bin}" ]]; then
echo "Missing .NET 10 SDK at ${dotnet_bin}. Set DOTNET_BIN or install .NET 10." >&2
exit 2
fi
if [[ ! -d "${developer_dir}" ]]; then
echo "Missing Xcode developer directory at ${developer_dir}. Set DEVELOPER_DIR." >&2
exit 2
fi
export DEVELOPER_DIR="${developer_dir}"
"${dotnet_bin}" restore "${repo_dir}/FieldLogger/FieldLogger.csproj" \
-p:TargetFrameworks=net9.0-ios \
-p:RuntimeIdentifier=ios-arm64
# Restoring the MAUI head with a narrowed TargetFrameworks property can rewrite the
# referenced headless library's assets file. Restore that library explicitly before publish.
"${dotnet_bin}" restore "${repo_dir}/src/FieldLogger.Sync/FieldLogger.Sync.csproj"
"${dotnet_bin}" publish "${repo_dir}/FieldLogger/FieldLogger.csproj" \
-p:TargetFrameworks=net9.0-ios \
-f net9.0-ios \
-c Release \
-p:RuntimeIdentifier=ios-arm64 \
-p:ArchiveOnBuild=true \
-p:BuildIpa=true \
-p:CodesignKey="${codesign_key}" \
-p:CodesignProvision="${codesign_profile}" \
-p:ApplicationVersion="${build_number}" \
--no-restore
find "${repo_dir}/FieldLogger/bin/Release/net9.0-ios/ios-arm64" \
-type f -name '*.ipa' -print

View File

@@ -1,7 +1,7 @@
<Project Sdk="Microsoft.NET.Sdk"> <Project Sdk="Microsoft.NET.Sdk">
<!-- <!--
Cloud-sync core for Field Logger: the durable outbound queue, the Point wire mapping, Cloud-sync core for UM Trace: the durable outbound queue, the Point wire mapping,
and the MQTTS publish/ack engine (SRS-SYN-2/5/7, §3.4.2, telemetry-schema.md). and the MQTTS publish/ack engine (SRS-SYN-2/5/7, §3.4.2, telemetry-schema.md).
Deliberately a plain net9.0 library (NO MAUI head) so the queue-durability, ack-release, Deliberately a plain net9.0 library (NO MAUI head) so the queue-durability, ack-release,
and exactly-once behaviour run headless in the QA gate without the Android/iOS workloads. and exactly-once behaviour run headless in the QA gate without the Android/iOS workloads.

View File

@@ -1,7 +1,7 @@
<Project Sdk="Microsoft.NET.Sdk"> <Project Sdk="Microsoft.NET.Sdk">
<!-- <!--
QA smoke/regression harness for the Field Logger app (S1-f, trace: SRS §6 gate / NFR-8). QA smoke/regression harness for the UM Trace app (S1-f, trace: SRS §6 gate / NFR-8).
Targets plain net9.0 (NOT the MAUI platform TFMs) so `dotnet test` runs on any dev/CI Targets plain net9.0 (NOT the MAUI platform TFMs) so `dotnet test` runs on any dev/CI
machine without the MAUI workload, keeping the QA gate fast. It deliberately does NOT machine without the MAUI workload, keeping the QA gate fast. It deliberately does NOT

View File

@@ -101,6 +101,11 @@ public sealed class Sprint3UiContractTests
var shell = File.ReadAllText(FromRoot("FieldLogger/AppShell.xaml")); var shell = File.ReadAllText(FromRoot("FieldLogger/AppShell.xaml"));
Assert.DoesNotContain("Title=\"Debug\"", shell, StringComparison.Ordinal); Assert.DoesNotContain("Title=\"Debug\"", shell, StringComparison.Ordinal);
Assert.DoesNotContain("views:DebugPage", shell, StringComparison.Ordinal); Assert.DoesNotContain("views:DebugPage", shell, StringComparison.Ordinal);
Assert.DoesNotContain("<TabBar", shell, StringComparison.Ordinal);
Assert.DoesNotContain("Title=\"Home\"", shell, StringComparison.Ordinal);
Assert.True(shell.IndexOf("Title=\"Jobs\"", StringComparison.Ordinal) <
shell.IndexOf("Title=\"Map\"", StringComparison.Ordinal),
"Jobs must be the first primary route so it is selected at startup.");
} }
[Fact] [Fact]
@@ -113,6 +118,77 @@ public sealed class Sprint3UiContractTests
Assert.DoesNotContain("CaptureCommand", home, StringComparison.Ordinal); Assert.DoesNotContain("CaptureCommand", home, StringComparison.Ordinal);
} }
[Fact]
public void Primary_pages_use_status_chrome_and_floating_menu()
{
foreach (var path in new[]
{
"FieldLogger/Views/JobsPage.xaml",
"FieldLogger/Views/MapPage.xaml",
"FieldLogger/Views/SettingsPage.xaml",
})
{
var page = File.ReadAllText(FromRoot(path));
Assert.Contains("controls:AppStatusBar", page, StringComparison.Ordinal);
Assert.Contains("controls:FloatingMenuButton", page, StringComparison.Ordinal);
Assert.Contains("Shell.NavBarIsVisible=\"False\"", page, StringComparison.Ordinal);
}
}
[Fact]
public void Settings_hides_manual_map_and_broker_configuration()
{
var settings = File.ReadAllText(FromRoot("FieldLogger/Views/SettingsPage.xaml"));
Assert.DoesNotContain("Google Maps API Key", settings, StringComparison.Ordinal);
Assert.DoesNotContain("Mqtt", settings, StringComparison.OrdinalIgnoreCase);
Assert.DoesNotContain("Durable cloud sync", settings, StringComparison.Ordinal);
Assert.Contains("OpenDebugCommand", settings, StringComparison.Ordinal);
}
[Fact]
public void Map_has_no_heading_panel_and_fills_its_root_grid()
{
var map = File.ReadAllText(FromRoot("FieldLogger/Views/MapPage.xaml"));
Assert.DoesNotContain("LIVE MAP", map, StringComparison.Ordinal);
Assert.Contains("<ContentView x:Name=\"MapHost\"", map, StringComparison.Ordinal);
}
[Fact]
public void User_facing_app_name_is_UM_Trace()
{
var shell = File.ReadAllText(FromRoot("FieldLogger/AppShell.xaml"));
var settings = File.ReadAllText(FromRoot("FieldLogger/Views/SettingsPage.xaml"));
Assert.Contains("Title=\"UM Trace\"", shell, StringComparison.Ordinal);
Assert.Contains("UM Trace v", settings, StringComparison.Ordinal);
}
[Fact]
public void Jobs_uses_a_stable_full_height_refresh_layout()
{
var page = File.ReadAllText(FromRoot("FieldLogger/Views/JobsPage.xaml"));
var viewModel = File.ReadAllText(FromRoot("FieldLogger/ViewModels/JobsViewModel.cs"));
Assert.Contains("IsRefreshing=\"{Binding IsRefreshing, Mode=OneWay}\"", page, StringComparison.Ordinal);
Assert.DoesNotContain("IsRefreshing=\"{Binding IsBusy}\"", page, StringComparison.Ordinal);
Assert.Contains("ItemsUpdatingScrollMode=\"KeepItemsInView\"", page, StringComparison.Ordinal);
Assert.Contains("HorizontalOptions=\"Fill\" VerticalOptions=\"Fill\"", page, StringComparison.Ordinal);
Assert.DoesNotContain("Padding=\"16,16,16,88\"", page, StringComparison.Ordinal);
Assert.Contains("ApplySnapshot(items)", viewModel, StringComparison.Ordinal);
Assert.DoesNotContain("Jobs.Clear()", viewModel, StringComparison.Ordinal);
}
[Fact]
public void Device_deploy_rebuilds_Xaml_and_brand_assets_from_a_clean_iOS_output()
{
var script = File.ReadAllText(FromRoot("scripts/deploy-ios-device.sh"));
var cleanIndex = script.IndexOf("\"${dotnet_bin}\" clean", StringComparison.Ordinal);
var runIndex = script.IndexOf("\"${dotnet_bin}\" build", StringComparison.Ordinal);
Assert.True(cleanIndex >= 0, "Device deployment must clean stale partial MAUI outputs.");
Assert.True(runIndex > cleanIndex, "The clean must run before the device build.");
Assert.Contains("-p:RuntimeIdentifier=ios-arm64", script, StringComparison.Ordinal);
}
private static string FromRoot(string relativePath) => Path.Combine(FindRepositoryRoot(), relativePath); private static string FromRoot(string relativePath) => Path.Combine(FindRepositoryRoot(), relativePath);
private static string FindRepositoryRoot() private static string FindRepositoryRoot()

View File

@@ -167,7 +167,7 @@ public class RoundTripTests
int triggersSeen = 0; int triggersSeen = 0;
// Stand-in App: consume telemetry, and on each trigger apply a simple accuracy gate // Stand-in App: consume telemetry, and on each trigger apply a simple accuracy gate
// and write back a capture-result. This is what Field Logger's Locator Driver does. // and write back a capture-result. This is what UM Trace's Locator Driver does.
link.ToApp += frame => link.ToApp += frame =>
{ {
switch (Frames.PeekType(frame)) switch (Frames.PeekType(frame))