Skip to content

Commit

Permalink
Users/rbrands/2024 12 14 (#151)
Browse files Browse the repository at this point in the history
* Compability with older iOS

* Error message and disabling features that could cause issues with older iOS versions
  • Loading branch information
rbrands authored Dec 14, 2024
1 parent 97857df commit 2e56cdc
Show file tree
Hide file tree
Showing 5 changed files with 61 additions and 11 deletions.
23 changes: 13 additions & 10 deletions MeetUpPlanner/Client/App.razor
Original file line number Diff line number Diff line change
@@ -1,10 +1,13 @@
<Router AppAssembly="@typeof(Program).Assembly">
<Found Context="routeData">
<RouteView RouteData="@routeData" DefaultLayout="@typeof(MainLayout)" />
</Found>
<NotFound>
<LayoutView Layout="@typeof(MainLayout)">
<p>Ups, aber der Link ist falsch.</p>
</LayoutView>
</NotFound>
</Router>
<ExceptionBoundary TError="Exception">
<Router AppAssembly="@typeof(Program).Assembly">
<Found Context="routeData">
<RouteView RouteData="@routeData" DefaultLayout="@typeof(MainLayout)" />
<FocusOnNavigate RouteData="@routeData" Selector="h1" />
</Found>
<NotFound>
<LayoutView Layout="@typeof(MainLayout)">
<p>Sorry, there's nothing at this address.</p>
</LayoutView>
</NotFound>
</Router>
</ExceptionBoundary>
33 changes: 33 additions & 0 deletions MeetUpPlanner/Client/ExceptionBoundary.razor
Original file line number Diff line number Diff line change
@@ -0,0 +1,33 @@
@typeparam TError

<div class="error-boundary">
@if (Error != null)
{
<div class="alert alert-danger">
<h4>Ein Fehler ist aufgetreten</h4>
<p>@Error.Message</p>
</div>
}
else
{
@ChildContent
}
</div>

@code {
[Parameter] public RenderFragment ChildContent { get; set; }
private Exception Error { get; set; }

protected override void OnParametersSet()
{
try
{
Error = null;
base.OnParametersSet();
}
catch (Exception ex)
{
Error = ex;
}
}
}
6 changes: 5 additions & 1 deletion MeetUpPlanner/Client/MeetUpPlanner.Client.csproj
Original file line number Diff line number Diff line change
@@ -1,7 +1,11 @@
<Project Sdk="Microsoft.NET.Sdk.BlazorWebAssembly">
<PropertyGroup>
<TargetFramework>net8.0</TargetFramework>
<ServiceWorkerAssetsManifest>service-worker-assets.js</ServiceWorkerAssetsManifest>
<RuntimeIdentifier>browser-wasm</RuntimeIdentifier>
<BlazorWebAssemblyEnableAOT>false</BlazorWebAssemblyEnableAOT>
<BlazorWebAssemblyEnableCompression>true</BlazorWebAssemblyEnableCompression>
<WasmEnableThreads>false</WasmEnableThreads>
<ServiceWorkerAssetsManifest>service-worker-assets.js</ServiceWorkerAssetsManifest>
</PropertyGroup>
<ItemGroup>
<PackageReference Include="Azure.Storage.Blobs" Version="12.23.0" />
Expand Down
8 changes: 8 additions & 0 deletions MeetUpPlanner/Client/wwwroot/css/app.css
Original file line number Diff line number Diff line change
Expand Up @@ -41,6 +41,14 @@ a, .btn-link {
width: 100%;
z-index: 1000;
}
.error-boundary .alert {
margin: 20px;
padding: 20px;
border: 1px solid red;
background-color: #f8d7da;
color: #721c24;
}


#blazor-error-ui .dismiss {
cursor: pointer;
Expand Down
2 changes: 2 additions & 0 deletions MeetUpPlanner/Client/wwwroot/index.html
Original file line number Diff line number Diff line change
Expand Up @@ -40,6 +40,8 @@
<script src="_content/Radzen.Blazor/Radzen.Blazor.js"></script>
<script src="pushNotifications.js"></script>
<script>navigator.serviceWorker.register('service-worker.js');</script>
<!-- rbrands: For older browsers -->
<script src="https://polyfill.io/v3/polyfill.min.js?features=es2015"></script>
</body>

</html>

0 comments on commit 2e56cdc

Please sign in to comment.