Skip to content

Commit

Permalink
Merge pull request #75 from aschuhardt/beta
Browse files Browse the repository at this point in the history
1.4.4 / 1.4.5 - Non-geminin links fixed
  • Loading branch information
aschuhardt committed Nov 28, 2023
2 parents 737140c + a5cb1bb commit b81b70f
Show file tree
Hide file tree
Showing 2 changed files with 18 additions and 2 deletions.
2 changes: 2 additions & 0 deletions Resources/Raw/whats-new.html
Original file line number Diff line number Diff line change
Expand Up @@ -10,6 +10,8 @@
}
</style>

<h4>Version 1.4.4 - November 27th, 2023</h4>
<p>Fixed an issue that prevented non-Gemini links from opening correctly</p>
<h4>Version 1.4.3 - November 27th, 2023</h4>
<ul>
<li>Visually annotate links with non-Gemini URLs when the link URL is not visible
Expand Down
18 changes: 16 additions & 2 deletions Views/BrowserView.xaml.cs
Original file line number Diff line number Diff line change
@@ -1,4 +1,5 @@
using System.ComponentModel;
using Android.Content;
using Android.Views;
using Android.Webkit;
using CommunityToolkit.Maui.Core;
Expand Down Expand Up @@ -583,15 +584,28 @@ private async void PageWebView_OnNavigating(object sender, WebNavigatingEventArg
e.Cancel = true;

var uri = e.Url.ToUri();

if (!uri.IsAbsoluteUri || uri.Scheme is Constants.GeminiScheme or Constants.TitanScheme or Constants.InternalScheme)
{
_tab.Location = uri;
else if (!await Launcher.Default.TryOpenAsync(uri))
return;
}

try
{
await Browser.Default.OpenAsync(uri, BrowserLaunchMode.SystemPreferred);
}
catch (ActivityNotFoundException)
{
await _tab.ParentPage.DisplayAlertOnMainThread(
Text.BrowserView_PageWebView_OnNavigating_Cannot_Open_URL,
Text.BrowserView_PageWebView_OnNavigating_Cannot_Open_URL,
string.Format(Text.BrowserView_PageWebView_OnNavigating_No_app_is_configured_to_open__0__links_, uri.Scheme),
Text.BrowserView_PageWebView_OnNavigating_OK);
}
catch (Exception ex)
{
_logger.LogError(ex, @"Failed to open non-Gemini URL {URL}", uri);
}
}

protected virtual void OnFindNext()
Expand Down

0 comments on commit b81b70f

Please sign in to comment.