Skip to content
Merged
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
12 changes: 12 additions & 0 deletions backend/FwLite/FwLiteMaui/MainPage.xaml.Android.cs
Original file line number Diff line number Diff line change
@@ -1,5 +1,6 @@
#if ANDROID

using Android.Content;
using AndroidX.Activity;
using FwLiteMaui.Platforms.Android;
using Microsoft.AspNetCore.Components.WebView;
Expand Down Expand Up @@ -31,9 +32,20 @@
e.WebView.Settings.AllowFileAccess = true;
e.WebView.Settings.MediaPlaybackRequiresUserGesture = false;
e.WebView.Settings.SetGeolocationEnabled(true);
e.WebView.Settings.SetGeolocationDatabasePath(e.WebView.Context?.FilesDir?.Path);

Check warning on line 35 in backend/FwLite/FwLiteMaui/MainPage.xaml.Android.cs

View workflow job for this annotation

GitHub Actions / Publish FW Lite app for Android

This call site is reachable on: 'Android' 24.0 and later. 'WebSettings.SetGeolocationDatabasePath(string?)' is obsoleted on: 'Android' 24.0 and later. (https://learn.microsoft.com/dotnet/fundamentals/code-analysis/quality-rules/ca1422)
e.WebView.SetWebChromeClient(new PermissionManagingBlazorWebChromeClient(e.WebView.WebChromeClient!, activity));

Check warning on line 36 in backend/FwLite/FwLiteMaui/MainPage.xaml.Android.cs

View workflow job for this annotation

GitHub Actions / Publish FW Lite app for Android

This call site is reachable on: 'Android' 24.0 and later. 'WebView.WebChromeClient' is only supported on: 'android' 26.0 and later. (https://learn.microsoft.com/dotnet/fundamentals/code-analysis/quality-rules/ca1416)
}

private partial void BlazorWebViewOnUrlLoading(object? sender, UrlLoadingEventArgs e)
{
if ("mailto".Equals(e.Url?.Scheme, StringComparison.OrdinalIgnoreCase))
{
var intent = new Intent(action: Intent.ActionSendto, Android.Net.Uri.Parse(e.Url.ToString()));
intent.AddFlags(ActivityFlags.NewTask);
Platform.AppContext.StartActivity(intent);
e.UrlLoadingStrategy = UrlLoadingStrategy.CancelLoad;
}
}
}

#endif
13 changes: 13 additions & 0 deletions backend/FwLite/FwLiteMaui/MainPage.xaml.cs
Original file line number Diff line number Diff line change
Expand Up @@ -12,8 +12,11 @@ public MainPage()
InitializeComponent();
blazorWebView.BlazorWebViewInitializing += BlazorWebViewInitializing;
blazorWebView.BlazorWebViewInitialized += BlazorWebViewInitialized;
blazorWebView.UrlLoading += BlazorWebViewOnUrlLoading;
}



internal string StartPath
{
get => blazorWebView.StartPath;
Expand All @@ -32,4 +35,14 @@ private void BlazorWebViewInitialized(object? sender, BlazorWebViewInitializedEv
{
}
#endif

#if ANDROID
private partial void BlazorWebViewOnUrlLoading(object? sender, UrlLoadingEventArgs e);
#else

private void BlazorWebViewOnUrlLoading(object? sender, UrlLoadingEventArgs e)
{
}

#endif
}
3 changes: 2 additions & 1 deletion frontend/viewer/src/lib/about/FeedbackDialog.svelte
Original file line number Diff line number Diff line change
Expand Up @@ -35,7 +35,8 @@
</div>
</div>
</Button>
<Button variant="ghost" href={mailtoUrl} class="gap-4 p-4 h-auto text-base justify-start whitespace-normal">
<!-- need to use external because of how android handles links, if it's target _blank then the Blazor UrlLoading event will not fire-->
<Button variant="ghost" href={mailtoUrl} external class="gap-4 p-4 h-auto text-base justify-start whitespace-normal">
<Icon icon="i-mdi-email-outline" class="size-10"/>
<div>
<div class="font-semibold underline">
Expand Down
Loading