Skip to content

Commit

Permalink
Merge branch 'bitfoundation:develop' into 7761-dotnet9-rc2
Browse files Browse the repository at this point in the history
  • Loading branch information
ysmoradi authored Oct 23, 2024
2 parents 43e9017 + a60d117 commit 9d30069
Show file tree
Hide file tree
Showing 16 changed files with 30 additions and 44 deletions.
Original file line number Diff line number Diff line change
Expand Up @@ -416,6 +416,12 @@ public async ValueTask DisposeAsync()
// The JS side may routinely be gone already if the reason we're disposing is that
// the client disconnected. This is not an error.
}
catch(JSException ex)
{
// it seems it's safe to just ignore this exception here.
// otherwise it will blow up the MAUI app in a page refresh for example.
Console.WriteLine(ex.Message);
}
}

private void CloseColumnOptions()
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -692,6 +692,12 @@ protected virtual async ValueTask DisposeAsync(bool disposing)
await _dropZoneRef.DisposeAsync();
}
catch (JSDisconnectedException) { } // we can ignore this exception here
catch (JSException ex)
{
// it seems it's safe to just ignore this exception here.
// otherwise it will blow up the MAUI app in a page refresh for example.
Console.WriteLine(ex.Message);
}
}

if (_dotnetObj is not null)
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -3,7 +3,7 @@

namespace Bit.BlazorUI.Demo.Client.Maui.Platforms.Android;

[Activity(Theme = "@style/Maui.SplashTheme", MainLauncher = true,
[Activity(Theme = "@style/Maui.SplashTheme", MainLauncher = true, LaunchMode = LaunchMode.SingleTask,
ConfigurationChanges = ConfigChanges.ScreenSize | ConfigChanges.Orientation | ConfigChanges.UiMode | ConfigChanges.ScreenLayout | ConfigChanges.SmallestScreenSize | ConfigChanges.Density)]
public class MainActivity : MauiAppCompatActivity
{
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -158,15 +158,17 @@ private async Task SetupBodyClasses()
await jsRuntime.ApplyBodyElementClasses(cssClasses, cssVariables);
}

//#if (signalr == true)
protected override async ValueTask DisposeAsync(bool disposing)
{
AuthenticationManager.AuthenticationStateChanged -= AuthenticationStateChanged;

//#if (signalr == true)
if (hubConnection is not null)
{
await hubConnection.DisposeAsync();
}
//#endif

await base.DisposeAsync(disposing);
}
//#endif
}
Original file line number Diff line number Diff line change
Expand Up @@ -66,7 +66,7 @@ private static string GetImageUrl(string? device)

var d = device.ToLowerInvariant();

if (d.Contains("windows") || d.Contains("win32")) return "windows.png";
if (d.Contains("win") /*Windows, WinUI, Win32*/) return "windows.png";

if (d.Contains("android")) return "android.png";

Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -16,6 +16,8 @@ class App {
const registration = await navigator.serviceWorker.ready;
if (!registration) return null;
const pushManager = registration.pushManager;
if (pushManager == null)
return;
let subscription = await pushManager.getSubscription();
if (subscription == null) {
subscription = await pushManager.subscribe({
Expand Down
Original file line number Diff line number Diff line change
@@ -1,7 +1,4 @@
//+:cnd:noEmit
using Maui.AppStores;
using System.Runtime.InteropServices;

[assembly: XamlCompilation(XamlCompilationOptions.Compile)]

namespace Boilerplate.Client.Maui;
Expand All @@ -11,7 +8,6 @@ public partial class App
private readonly Page mainPage;
private readonly IExceptionHandler exceptionHandler;
private readonly IBitDeviceCoordinator deviceCoordinator;
private readonly IStorageService storageService;

public App(MainPage mainPage,
IExceptionHandler exceptionHandler,
Expand All @@ -20,7 +16,6 @@ public App(MainPage mainPage,
{
this.exceptionHandler = exceptionHandler;
this.deviceCoordinator = deviceCoordinator;
this.storageService = storageService;
this.mainPage = new NavigationPage(mainPage);

InitializeComponent();
Expand All @@ -38,38 +33,10 @@ protected async override void OnStart()
base.OnStart();

await deviceCoordinator.ApplyTheme(AppInfo.Current.RequestedTheme is AppTheme.Dark);

await CheckForUpdates();
}
catch (Exception exp)
{
exceptionHandler.Handle(exp);
}
}

private async Task CheckForUpdates()
{
await Task.Delay(TimeSpan.FromSeconds(3)); // No rush to check for updates.

try
{
if (await AppStoreInfo.Current.IsUsingLatestVersionAsync() is false)
{
if (await storageService.GetItem($"{AppInfo.Version}_UpdateFromVersionIsRequested") is not "true")
{
await storageService.SetItem($"{AppInfo.Version}_UpdateFromVersionIsRequested", "true");

// It's an opportune moment to request an update. (:
// https://github.com/oscoreio/Maui.AppStoreInfo
if (await App.Current!.Windows.First().Page!.DisplayAlert(AppStrings.NewVersionIsAvailable, AppStrings.UpdateToNewVersion, AppStrings.Yes, AppStrings.No) is true)
{
await AppStoreInfo.Current.OpenApplicationInStoreAsync();
}
}
}
}
catch (InvalidOperationException) when ((AppPlatform.IsIOS || AppPlatform.IsMacOS) && AppEnvironment.IsDev()) { }
catch (FileNotFoundException) { }
catch (COMException) { }
}
}
Original file line number Diff line number Diff line change
Expand Up @@ -16,7 +16,6 @@

<!-- App Identifier -->
<ApplicationId>com.bitplatform.template</ApplicationId>
<ApplicationIdGuid>AC87AA5B-4B37-4E52-8468-2D5DF24AF256</ApplicationIdGuid>

<!-- Versions -->
<ApplicationDisplayVersion>1.0</ApplicationDisplayVersion>
Expand Down Expand Up @@ -108,7 +107,7 @@
</ItemGroup>

<ItemGroup>

<Using Include="Microsoft.AspNetCore.Components.WebView.Maui" />
<Using Include="Boilerplate.Client.Core.Components.Layout" />
<Using Include="Boilerplate.Client.Core.Components.Pages" />
Expand Down Expand Up @@ -142,7 +141,6 @@
<ItemGroup>
<Content Remove="compilerconfig.json" />
<None Include="compilerconfig.json" />
<Content Remove="Properties\launchSettings.json" />
</ItemGroup>

<ItemGroup>
Expand All @@ -153,7 +151,6 @@
<PackageReference Include="EmbedIO" />
<PackageReference Include="Microsoft.Maui.Controls" />
<PackageReference Include="Microsoft.AspNetCore.Components.WebView.Maui" />
<PackageReference Include="Oscore.Maui.AppStoreInfo" />
<PackageReference Include="Microsoft.Extensions.Logging.Debug" />
<PackageReference Include="Microsoft.Extensions.Logging.Console" />
<PackageReference Include="Microsoft.Extensions.Logging.EventLog" />
Expand Down
Original file line number Diff line number Diff line change
@@ -1,7 +1,6 @@
//-:cnd:noEmit
using Microsoft.Maui.Platform;
using Microsoft.Maui.LifecycleEvents;
using Maui.AppStores;
//+:cnd:noEmit
//#if (notification == true)
using Plugin.LocalNotification;
Expand Down Expand Up @@ -41,7 +40,6 @@ public static MauiApp CreateMauiApp()

builder
.UseMauiApp<App>()
.UseAppStoreInfo()
.Configuration.AddClientConfigurations();

//+:cnd:noEmit
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -419,6 +419,6 @@ private static void AddSwaggerGen(WebApplicationBuilder builder)
/// <summary>
/// For either Blazor Hybrid web view or localhost in dev environment.
/// </summary>
[GeneratedRegex(@"^(http|https|app):\/\/(localhost|0\.0\.0\.0|127\.0\.0\.1)(:\d+)?(\/.*)?$")]
[GeneratedRegex(@"^(http|https|app):\/\/(localhost|0\.0\.0\.0|0\.0\.0\.1|127\.0\.0\.1)(:\d+)?(\/.*)?$")]
private static partial Regex LocalhostOriginRegex();
}
Original file line number Diff line number Diff line change
@@ -1,5 +1,7 @@
@page "/templates"
@page "/templates/overview"
@page "/boilerplate"
@page "/boilerplate/overview"
@inherits AppComponentBase

<PageOutlet Url="templates/overview"
Expand Down
Original file line number Diff line number Diff line change
@@ -1,4 +1,5 @@
@page "/templates/samples"
@page "/boilerplate/samples"
@inherits AppComponentBase

<PageOutlet Url="templates/samples"
Expand Down
Original file line number Diff line number Diff line change
@@ -1,5 +1,7 @@
@page "/templates/getting-started"
@page "/templates/development-prerequisites"
@page "/boilerplate/getting-started"
@page "/boilerplate/development-prerequisites"
@inherits AppComponentBase

<PageOutlet Url="templates/getting-started"
Expand Down
Original file line number Diff line number Diff line change
@@ -1,4 +1,5 @@
@page "/templates/project-structure"
@page "/boilerplate/project-structure"
@inherits AppComponentBase

<PageOutlet Url="templates/project-structure"
Expand Down
Original file line number Diff line number Diff line change
@@ -1,4 +1,5 @@
@page "/templates/create-project"
@page "/boilerplate/create-project"
@inherits AppComponentBase

<PageOutlet Url="templates/create-project"
Expand Down
Original file line number Diff line number Diff line change
@@ -1,4 +1,5 @@
@page "/templates/run-project"
@page "/boilerplate/run-project"
@inherits AppComponentBase

<PageOutlet Url="templates/run-project"
Expand Down

0 comments on commit 9d30069

Please sign in to comment.