Skip to content
Open
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
3 changes: 2 additions & 1 deletion docs/master-data.example.json
Original file line number Diff line number Diff line change
Expand Up @@ -30,5 +30,6 @@
"csaMaxDurationMinutes": 20,
"lpaMaxDurationMinutes": 60,
"returnPressureBar": 50
}
},
"einsatzgebiet": { "name": "Landkreis Musterstadt", "folderPath": "/regions/musterstadt" }
}
1 change: 1 addition & 0 deletions src/LageBuch.App.Android/MainActivity.cs
Original file line number Diff line number Diff line change
Expand Up @@ -73,6 +73,7 @@ protected override AppBuilder CustomizeAppBuilder(AppBuilder builder)
new NoopIncidentHostController(),
new LageBuch.App.Shared.Services.AvaloniaUiDispatcher(),
typeof(MainActivity).Assembly.GetName().Version?.ToString() ?? "0.0.0",
AndroidAppPaths.RegionsDir(this),
lastSaveFolder: null,
attachmentCacheRoot: AndroidAppPaths.AttachmentCacheDir(this));
return base.CustomizeAppBuilder(builder).WithInterFont();
Expand Down
3 changes: 3 additions & 0 deletions src/LageBuch.App.Android/Services/AndroidAppPaths.cs
Original file line number Diff line number Diff line change
Expand Up @@ -27,4 +27,7 @@ public static string RecentFilesJsonPath(Context context) =>

public static string AttachmentCacheDir(Context context) =>
System.IO.Path.Combine(CacheDir(context), "attachment-cache");

public static string RegionsDir(Context context) =>
System.IO.Path.Combine(context.FilesDir!.AbsolutePath, "regions");
}
18 changes: 16 additions & 2 deletions src/LageBuch.App.Shared/CompositionRoot.cs
Original file line number Diff line number Diff line change
@@ -1,3 +1,5 @@
using System.Diagnostics.CodeAnalysis;
using LageBuch.App.Shared.Services;
using LageBuch.AppLogic.Services;
using LageBuch.AppLogic.ViewModels;
using LageBuch.Domain.Time;
Expand All @@ -13,6 +15,14 @@ namespace LageBuch.App.Shared;
/// </summary>
public static class CompositionRoot
{
/// <summary>
/// Raw-served manifest of published Wasserförderung region packs (#150 follow-up) — see
/// tools/build-region-pack/README.md for how a pack is built and published here.
/// </summary>
public const string RegionPackManifestUrl =
"https://raw.githubusercontent.com/CodeForFire/lagebuch-regions/main/regions.json";

[SuppressMessage("Reliability", "CA2000", Justification = "The HttpClient is shared by the region-pack catalog/installer services for the app's whole lifetime, not disposed per-call.")]
public static MainWindowViewModel CreateMainWindowViewModel(
IIncidentStore store,
IMasterDataProvider masterData,
Expand All @@ -25,11 +35,15 @@ public static MainWindowViewModel CreateMainWindowViewModel(
IIncidentHostController hostController,
IUiDispatcher uiDispatcher,
string appVersion,
string regionsDir,
ILastSaveFolderStore? lastSaveFolder = null,
string? attachmentCacheRoot = null)
{
var home = new HomeViewModel(store, masterData, recent, dialogs, clock, ticker, alarm, hostController, appVersion, uiDispatcher, lastSaveFolder, attachmentCacheRoot);
var editor = new MasterDataEditorViewModel(masterData, dialogs, masterDataFileService);
var home = new HomeViewModel(store, masterData, recent, dialogs, clock, ticker, alarm, hostController, appVersion, uiDispatcher, lastSaveFolder, attachmentCacheRoot, new RouteOverviewRenderer());
var httpClient = new HttpClient();
var regionCatalog = new RegionPackCatalogService(httpClient, RegionPackManifestUrl);
var regionInstaller = new RegionPackInstaller(httpClient, regionsDir);
var editor = new MasterDataEditorViewModel(masterData, dialogs, masterDataFileService, regionCatalog, regionInstaller);
return new MainWindowViewModel(home, editor, dialogs, appVersion);
}
}
Loading