From ca9a329391a70cd92dfff0210ffb453885eacfab Mon Sep 17 00:00:00 2001 From: Saleh Yusefnejad Date: Fri, 8 Nov 2024 22:09:00 +0330 Subject: [PATCH 1/2] fix(templates): resolve diagnostic modal issues in Boilerplate #9150 (#9151) --- .../Components/Layout/DiagnosticModal.razor | 20 +++++++++++++++++-- .../Layout/DiagnosticModal.razor.cs | 6 ++++++ .../Layout/DiagnosticModal.razor.scss | 8 ++++++++ .../Components/Layout/RootLayout.razor.cs | 11 +++++++++- .../Components/Layout/SnackBar.razor | 8 +++++--- .../Components/Layout/SnackBar.razor.scss | 3 +++ .../Services/AppTelemetryContext.cs | 2 ++ .../Services/Contracts/ITelemetryContext.cs | 3 +++ .../Boilerplate.Client.Core/Styles/app.scss | 10 +++++----- 9 files changed, 60 insertions(+), 11 deletions(-) create mode 100644 src/Templates/Boilerplate/Bit.Boilerplate/src/Client/Boilerplate.Client.Core/Components/Layout/SnackBar.razor.scss diff --git a/src/Templates/Boilerplate/Bit.Boilerplate/src/Client/Boilerplate.Client.Core/Components/Layout/DiagnosticModal.razor b/src/Templates/Boilerplate/Bit.Boilerplate/src/Client/Boilerplate.Client.Core/Components/Layout/DiagnosticModal.razor index 9e5a944203..dd9d60454b 100644 --- a/src/Templates/Boilerplate/Bit.Boilerplate/src/Client/Boilerplate.Client.Core/Components/Layout/DiagnosticModal.razor +++ b/src/Templates/Boilerplate/Bit.Boilerplate/src/Client/Boilerplate.Client.Core/Components/Layout/DiagnosticModal.razor @@ -1,7 +1,7 @@ @inherits AppComponentBase
- + Diagnostic @@ -13,6 +13,22 @@ IconName="@BitIconName.ChromeClose" /> + + + + + @foreach (var (key, value) in telemetryContext.ToDictionary()) + { + @key: @value + } + + + + Nothing to show! - + @($"{logIndex.index + 1}. [{logIndex.item.CreatedOn.ToString("HH:mm:ss")}]") $"{c.Key}: {c.Value}"))); + } + private async Task CopyException(DiagnosticLog log) { var stateToCopy = string.Join(Environment.NewLine, log.State?.Select(i => $"{i.Key}: {i.Value}") ?? []); diff --git a/src/Templates/Boilerplate/Bit.Boilerplate/src/Client/Boilerplate.Client.Core/Components/Layout/DiagnosticModal.razor.scss b/src/Templates/Boilerplate/Bit.Boilerplate/src/Client/Boilerplate.Client.Core/Components/Layout/DiagnosticModal.razor.scss index f135d108e8..1d1a732cc7 100644 --- a/src/Templates/Boilerplate/Bit.Boilerplate/src/Client/Boilerplate.Client.Core/Components/Layout/DiagnosticModal.razor.scss +++ b/src/Templates/Boilerplate/Bit.Boilerplate/src/Client/Boilerplate.Client.Core/Components/Layout/DiagnosticModal.razor.scss @@ -6,6 +6,14 @@ section { } ::deep { + .modal { + width: unset; + top: var(--app-inset-top); + left: var(--app-inset-left); + right: var(--app-inset-right); + bottom: var(--app-inset-bottom); + } + .container { padding: 1rem; } diff --git a/src/Templates/Boilerplate/Bit.Boilerplate/src/Client/Boilerplate.Client.Core/Components/Layout/RootLayout.razor.cs b/src/Templates/Boilerplate/Bit.Boilerplate/src/Client/Boilerplate.Client.Core/Components/Layout/RootLayout.razor.cs index 2cdf2012ec..75d0e9c9d8 100644 --- a/src/Templates/Boilerplate/Bit.Boilerplate/src/Client/Boilerplate.Client.Core/Components/Layout/RootLayout.razor.cs +++ b/src/Templates/Boilerplate/Bit.Boilerplate/src/Client/Boilerplate.Client.Core/Components/Layout/RootLayout.razor.cs @@ -57,7 +57,6 @@ protected override async Task OnInitializedAsync() SetCurrentUrl(); currentTheme = await themeService.GetCurrentTheme(); - await keyboard.Add(ButilKeyCodes.KeyX, OpenDiagnosticModal, ButilModifiers.Ctrl | ButilModifiers.Shift); await base.OnInitializedAsync(); } catch (Exception exp) @@ -75,6 +74,16 @@ protected override void OnParametersSet() base.OnParametersSet(); } + protected override async Task OnAfterRenderAsync(bool firstRender) + { + if (firstRender) + { + await keyboard.Add(ButilKeyCodes.KeyX, OpenDiagnosticModal, ButilModifiers.Ctrl | ButilModifiers.Shift); + } + + await base.OnAfterRenderAsync(firstRender); + } + private async void AuthenticationStateChanged(Task task) { diff --git a/src/Templates/Boilerplate/Bit.Boilerplate/src/Client/Boilerplate.Client.Core/Components/Layout/SnackBar.razor b/src/Templates/Boilerplate/Bit.Boilerplate/src/Client/Boilerplate.Client.Core/Components/Layout/SnackBar.razor index 61040d15b8..8b06dcce83 100644 --- a/src/Templates/Boilerplate/Bit.Boilerplate/src/Client/Boilerplate.Client.Core/Components/Layout/SnackBar.razor +++ b/src/Templates/Boilerplate/Bit.Boilerplate/src/Client/Boilerplate.Client.Core/Components/Layout/SnackBar.razor @@ -1,5 +1,7 @@ @inherits AppComponentBase - \ No newline at end of file + \ No newline at end of file diff --git a/src/Templates/Boilerplate/Bit.Boilerplate/src/Client/Boilerplate.Client.Core/Components/Layout/SnackBar.razor.scss b/src/Templates/Boilerplate/Bit.Boilerplate/src/Client/Boilerplate.Client.Core/Components/Layout/SnackBar.razor.scss new file mode 100644 index 0000000000..2d6c5aa7f5 --- /dev/null +++ b/src/Templates/Boilerplate/Bit.Boilerplate/src/Client/Boilerplate.Client.Core/Components/Layout/SnackBar.razor.scss @@ -0,0 +1,3 @@ +.snackbar { + bottom: calc(var(--app-inset-bottom) + var(--bit-spa-scaling-factor)); +} diff --git a/src/Templates/Boilerplate/Bit.Boilerplate/src/Client/Boilerplate.Client.Core/Services/AppTelemetryContext.cs b/src/Templates/Boilerplate/Bit.Boilerplate/src/Client/Boilerplate.Client.Core/Services/AppTelemetryContext.cs index 2ed22276d9..24ed0c9ace 100644 --- a/src/Templates/Boilerplate/Bit.Boilerplate/src/Client/Boilerplate.Client.Core/Services/AppTelemetryContext.cs +++ b/src/Templates/Boilerplate/Bit.Boilerplate/src/Client/Boilerplate.Client.Core/Services/AppTelemetryContext.cs @@ -23,6 +23,8 @@ public class AppTelemetryContext : ITelemetryContext public string? Culture { get; set; } = CultureInfo.CurrentCulture.Name; + public string? Environment { get; set; } = AppEnvironment.Current; + //#if (signalr == true) public bool IsOnline { get; set; } //#endif diff --git a/src/Templates/Boilerplate/Bit.Boilerplate/src/Client/Boilerplate.Client.Core/Services/Contracts/ITelemetryContext.cs b/src/Templates/Boilerplate/Bit.Boilerplate/src/Client/Boilerplate.Client.Core/Services/Contracts/ITelemetryContext.cs index ebbfdc9da5..fc70c6c103 100644 --- a/src/Templates/Boilerplate/Bit.Boilerplate/src/Client/Boilerplate.Client.Core/Services/Contracts/ITelemetryContext.cs +++ b/src/Templates/Boilerplate/Bit.Boilerplate/src/Client/Boilerplate.Client.Core/Services/Contracts/ITelemetryContext.cs @@ -42,6 +42,8 @@ public static ITelemetryContext? Current public string? TimeZone { get; set; } public string? Culture { get; set; } + public string? Environment { get; set; } + //#if (signalr == true) public bool IsOnline { get; set; } //#endif @@ -58,6 +60,7 @@ public static ITelemetryContext? Current { nameof(UserAgent), UserAgent }, { nameof(TimeZone), TimeZone }, { nameof(Culture), Culture }, + { nameof(Environment), Environment }, //#if (signalr == true) { nameof(IsOnline), IsOnline } //#endif diff --git a/src/Templates/Boilerplate/Bit.Boilerplate/src/Client/Boilerplate.Client.Core/Styles/app.scss b/src/Templates/Boilerplate/Bit.Boilerplate/src/Client/Boilerplate.Client.Core/Styles/app.scss index 1430a522c7..b850fa2043 100644 --- a/src/Templates/Boilerplate/Bit.Boilerplate/src/Client/Boilerplate.Client.Core/Styles/app.scss +++ b/src/Templates/Boilerplate/Bit.Boilerplate/src/Client/Boilerplate.Client.Core/Styles/app.scss @@ -1,5 +1,10 @@ @import '../Styles/abstracts/_media-queries.scss'; +:root[bit-theme="dark"] { + //--bit-clr-bg-pri: #010409; + // In case you need to change the background color, make sure to also update ThemeColors.cs's PrimaryDarkBgColor accordingly. +} + :root { --app-inset-top: env(safe-area-inset-top); --app-inset-left: env(safe-area-inset-left); @@ -22,11 +27,6 @@ } } -:root[bit-theme="dark"] { - //--bit-clr-bg-pri: #010409; - // In case you need to change the background color, make sure to also update ThemeColors.cs's PrimaryDarkBgColor accordingly. -} - * { box-sizing: border-box; font-family: "Segoe UI"; From 9de018d78191dcdc5ec948e1d700736897fa9ad9 Mon Sep 17 00:00:00 2001 From: Yaser Moradi Date: Fri, 8 Nov 2024 20:10:24 +0100 Subject: [PATCH 2/2] fix(templates): resolve Boilerplate issue with signalr on android in prod env #9152 (#9153) --- .../Boilerplate.Client.Maui.csproj | 11 +++++++++-- 1 file changed, 9 insertions(+), 2 deletions(-) diff --git a/src/Templates/Boilerplate/Bit.Boilerplate/src/Client/Boilerplate.Client.Maui/Boilerplate.Client.Maui.csproj b/src/Templates/Boilerplate/Bit.Boilerplate/src/Client/Boilerplate.Client.Maui/Boilerplate.Client.Maui.csproj index b32ef5fb1c..4238d940e4 100644 --- a/src/Templates/Boilerplate/Bit.Boilerplate/src/Client/Boilerplate.Client.Maui/Boilerplate.Client.Maui.csproj +++ b/src/Templates/Boilerplate/Bit.Boilerplate/src/Client/Boilerplate.Client.Maui/Boilerplate.Client.Maui.csproj @@ -104,7 +104,7 @@ - + @@ -161,7 +161,7 @@ - + @@ -171,4 +171,11 @@ + + + + <_AndroidAotInputs Remove="$(IntermediateLinkDir)**\System.Net.Sockets.dll" /> + + +