Browse Source

Merge branch 'dev' into pr/20952

pull/20952/head
maliming 1 year ago
parent
commit
f8974b09da
No known key found for this signature in database GPG Key ID: A646B9CB645ECEA4
  1. 3
      abp_io/AbpIoLocalization/AbpIoLocalization/Base/Localization/Resources/en.json
  2. 99
      docs/en/Community-Articles/2024-10-01-SignalR-9-New-Features/Post.md
  3. BIN
      docs/en/Community-Articles/2024-10-01-SignalR-9-New-Features/cover.png
  4. BIN
      docs/en/Community-Articles/2024-10-01-SignalR-9-New-Features/signalr-activity-dashboard.png
  5. 4
      docs/en/modules/docs.md
  6. 63
      docs/en/release-info/migration-guides/abp-8-2.md
  7. 6
      framework/src/Volo.Abp.Cli.Core/Volo/Abp/Cli/Utils/CmdHelper.cs
  8. 2
      framework/test/Volo.Abp.EntityFrameworkCore.Tests/Volo/Abp/EntityFrameworkCore/ValueConverters/EFCore_DateTimeKindTests.cs
  9. 20
      modules/cms-kit/test/Volo.CmsKit.Application.Tests/Comments/CommentPublicAppService_Tests.cs
  10. 25
      modules/docs/app/VoloDocs.Web/Program.cs
  11. 6
      modules/docs/app/VoloDocs.Web/Properties/launchSettings.json
  12. 22
      modules/docs/app/VoloDocs.Web/Startup.cs
  13. 2
      modules/docs/src/Volo.Docs.Domain/Volo/Docs/FileSystem/Documents/FileSystemDocumentSource.cs
  14. 37
      npm/ng-packs/packages/core/src/lib/services/config-state.service.ts
  15. 6
      npm/ng-packs/packages/core/src/lib/services/window.service.ts
  16. 49
      npm/ng-packs/packages/oauth/src/lib/strategies/auth-code-flow-strategy.ts
  17. 3
      npm/ng-packs/packages/oauth/src/lib/strategies/auth-flow-strategy.ts
  18. 4
      templates/maui/src/MyCompanyName.MyProjectName/MyCompanyName.MyProjectName.csproj

3
abp_io/AbpIoLocalization/AbpIoLocalization/Base/Localization/Resources/en.json

@ -251,6 +251,7 @@
"VideoCourses": "Essential Videos",
"DoYouAgreePrivacyPolicy": "By clicking <b>Subscribe</b> button you agree to the <a href=\"https://account.abp.io/Account/TermsConditions\">Terms & Conditions</a> and <a href=\"https://account.abp.io/Account/Privacy\">Privacy Policy</a>.",
"AbpConferenceDescription": "ABP Conference is a virtual event for .NET developers to learn and connect with the community.",
"Mobile": "Mobile"
"Mobile": "Mobile",
"MetaTwitterCard": "summary_large_image"
}
}

99
docs/en/Community-Articles/2024-10-01-SignalR-9-New-Features/Post.md

@ -0,0 +1,99 @@
### ASP.NET Core SignalR New Features — Summary
In this article, I’ll highlight the latest .**NET 9 SignalR updates** for ASP.NET Core 9.0.
![Cover](cover.png)
### SignalR Hub Accepts Base Classes
SignalR `Hub` class can now get a base class of a polymorphic class. As you see in the example below, I can send `Animal` to `Process` method. Before .NET 9, we could only pass the derived classes: `Cat` and `Dog`.
```csharp
/*** My Base Class is Animal ***/
[JsonPolymorphic]
[JsonDerivedType(typeof(Cat), nameof(Cat))]
[JsonDerivedType(typeof(Dog), nameof(Dog))]
private class Animal
{
public string Name { get; set; }
}
/*** CAT derived from Animal ***/
private class Cat : Animal
{
public CatTypes CatType { get; set; }
}
/*** DOG derived from Animal ***/
private class Dog : Animal
{
public DogTypes DogType { get; set; }
}
public class MyHub : Hub
{
/*** We can use the base type Animal here ***/
public void Process(Animal animal)
{
if (animal is Cat) { ... }
else if (animal is Dog) { ... }
}
}
```
### Better Diagnostics and Telemetry
Microsoft focuses mainly on .NET Aspire nowadays. That’s why SignalR now integrates more deeply with the .NET Activity API, which is commonly used for distributed tracing. The enhancement is implemented for better monitoring in [.NET Aspire Dashboard](https://learn.microsoft.com/en-us/dotnet/aspire/fundamentals/dashboard/overview?tabs=bash#using-the-dashboard-with-net-aspire-projects). To support this feature:
1- Add these packages to your`csproj`:
```xml
<PackageReference Include="OpenTelemetry.Exporter.OpenTelemetryProtocol" Version="1.9.0" />
<PackageReference Include="OpenTelemetry.Extensions.Hosting" Version="1.9.0" />
<PackageReference Include="OpenTelemetry.Instrumentation.AspNetCore" Version="1.9.0" />
```
2- Add the following startup code to your host project:
```csharp
builder.Services.AddSignalR();
/* After AddSignalR use AddOpenTelemetry() */
builder
.Services
.AddOpenTelemetry()
.WithTracing(tracing =>
{
if (builder.Environment.IsDevelopment())
{
tracing.SetSampler(new AlwaysOnSampler()); //for dev env monitor all traces
}
tracing.AddAspNetCoreInstrumentation();
tracing.AddSource("Microsoft.AspNetCore.SignalR.Server");
});
builder.Services.ConfigureOpenTelemetryTracerProvider(tracing => tracing.AddOtlpExporter());
```
Finally, you’ll see the **SignalR Hub** events on the [Aspire Dashboard](https://learn.microsoft.com/en-us/dotnet/aspire/fundamentals/dashboard/overview):
![.NET Aspire Activity Dashboard](signalr-activity-dashboard.png)
### Trimming and Native AOT Support
With .NET 9, **trimming** and **native** **Ahead Of Time** compilation are **supported**. This will improve our application performance. To support AOT, your SignalR object serialization needs to be JSON, and you must use the `System.Text.Json` s[ource generator](https://learn.microsoft.com/en-us/dotnet/standard/serialization/system-text-json/source-generation). Also on the server side, [you shouldn't use](https://github.com/dotnet/aspnetcore/issues/56179) `IAsyncEnumerable<T>` and `ChannelReader<T>` where `T` is a ValueType (`struct`) for Hub method arguments. One more limitation; [Strongly typed hubs](https://learn.microsoft.com/en-us/aspnet/core/signalr/hubs?view=aspnetcore-8.0#strongly-typed-hubs) aren't supported with Native AOT (`PublishAot`). And you should use only `Task`, `Task<T>`, `ValueTask`, `ValueTask<T>` for `async` return types.
---
That's all the new features coming to SignalR in .NET 9!
Happy coding 🧑🏽‍💻

BIN
docs/en/Community-Articles/2024-10-01-SignalR-9-New-Features/cover.png

Binary file not shown.

After

Width:  |  Height:  |  Size: 663 KiB

BIN
docs/en/Community-Articles/2024-10-01-SignalR-9-New-Features/signalr-activity-dashboard.png

Binary file not shown.

After

Width:  |  Height:  |  Size: 66 KiB

4
docs/en/modules/docs.md

@ -367,7 +367,7 @@ You can use [ABP](https://github.com/abpframework/abp/) GitHub documents to conf
For `SQL` databases, you can use the below `T-SQL` command to insert the specified sample into your `DocsProjects` table:
```mssql
INSERT [dbo].[DocsProjects] ([Id], [Name], [ShortName], [Format], [DefaultDocumentName], [NavigationDocumentName], [MinimumVersion], [DocumentStoreType], [ExtraProperties], [MainWebsiteUrl], [LatestVersionBranchName], [ParametersDocumentName], [ConcurrencyStamp]) VALUES (N'12f21123-e08e-4f15-bedb-ae0b2d939659', N'ABP (FileSystem)', N'abp', N'md', N'Index', N'docs-nav.json', NULL, N'FileSystem', N'{"Path":"C:\\Github\\abp\\docs"}', N'/', NULL, N'', N'12f21123e08e4f15bedbae0b2d939659')
INSERT [dbo].[DocsProjects] ([Id], [Name], [ShortName], [Format], [DefaultDocumentName], [NavigationDocumentName], [MinimumVersion], [DocumentStoreType], [ExtraProperties], [MainWebsiteUrl], [LatestVersionBranchName], [ParametersDocumentName], [ConcurrencyStamp]) VALUES (N'12f21123-e08e-4f15-bedb-ae0b2d939659', N'ABP (GitHub)', N'abp', N'md', N'Index', N'docs-nav.json', NULL, N'GitHub', N'{"GitHubRootUrl":"https://github.com/abpframework/abp/tree/{version}/docs","GitHubAccessToken":"","GitHubUserAgent":""}', N'/', N'dev', N'', N'12f21123e08e4f15bedbae0b2d939659')
```
Be aware that `GitHubAccessToken` is masked. It's a private token and you must get your own token and replace the `***` string.
@ -407,7 +407,7 @@ You can use [ABP](https://github.com/abpframework/abp/) GitHub documents to conf
For `SQL` databases, you can use the below `T-SQL` command to insert the specified sample into your `DocsProjects` table:
```mssql
INSERT [dbo].[DocsProjects] ([Id], [Name], [ShortName], [Format], [DefaultDocumentName], [NavigationDocumentName], [MinimumVersion], [DocumentStoreType], [ExtraProperties], [MainWebsiteUrl], [LatestVersionBranchName], [ParametersDocumentName]) VALUES (N'12f21123-e08e-4f15-bedb-ae0b2d939659', N'ABP (FileSystem)', N'abp', N'md', N'Index', N'docs-nav.json', NULL, N'FileSystem', N'{"Path":"C:\\Github\\abp\\docs"}', N'/', NULL, N'')
INSERT [dbo].[DocsProjects] ([Id], [Name], [ShortName], [Format], [DefaultDocumentName], [NavigationDocumentName], [MinimumVersion], [DocumentStoreType], [ExtraProperties], [MainWebsiteUrl], [LatestVersionBranchName], [ParametersDocumentName], [ConcurrencyStamp]) VALUES (N'12f21123-e08e-4f15-bedb-ae0b2d939659', N'ABP (FileSystem)', N'abp', N'md', N'Index', N'docs-nav.json', NULL, N'FileSystem', N'{"Path":"C:\\Github\\abp\\docs"}', N'/', NULL, N'', N'12f21123e08e4f15bedbae0b2d939659')
```
Add one of the sample projects above and run the application. In the menu you will see `Documents` link, click the menu link to open the documents page.

63
docs/en/release-info/migration-guides/abp-8-2.md

@ -16,9 +16,6 @@ This document is a guide for upgrading ABP v8.x solutions to ABP v8.2. There are
Before this version, all of the projects above were targeting multiple frameworks (**netstandard2.0**, **netstandard2.1** and **net8.0**), with this version, we started to only target **net8.0** for these template projects. Note that, all other shared libraries still target multiple frameworks.
> This change should not affect your pre-existing solutions and you don't need to make any changes in your application. See the PR for more info: https://github.com/abpframework/abp/pull/19565
## Upgraded AutoMapper to 13.0.1
In this version, **AutoMapper** library version upgraded to 13.0.1. See [the release notes of AutoMapper v13.0.1](https://github.com/AutoMapper/AutoMapper/releases/tag/v13.0.1) for more information.
## Added default padding to `.tab-content` class for Basic Theme
@ -60,4 +57,62 @@ In this version, the Angular UI has been updated to use the Angular version 17.3
The **Session Management** feature allows you to prevent concurrent login and manage user sessions.
In this version, a new entity called `IdentitySession` has been added to the framework and you should create a new migration and apply it to your database.
In this version, a new entity called `IdentitySession` has been added to the framework and you should create a new migration and apply it to your database.
## Upgraded NuGet Dependencies
You can see the following list of NuGet libraries that have been upgraded with this release, if you are using one of these packages explicitly, you may consider upgrading them in your solution:
| Package | Old Version | New Version |
| ---------------------------------------------------------- | ----------- | ----------- |
| AutoMapper | 12.0.1 | 13.0.1 |
| Blazorise | 1.4.1 | 1.5.2 |
| Blazorise.Bootstrap5 | 1.4.1 | 1.5.2 |
| Blazorise.Icons.FontAwesome | 1.4.1 | 1.5.2 |
| Blazorise.Components | 1.4.1 | 1.5.2 |
| Blazorise.DataGrid | 1.4.1 | 1.5.2 |
| Blazorise.Snackbar | 1.4.1 | 1.5.2 |
| Hangfire.AspNetCore | 1.8.6 | 1.8.14 |
| Hangfire.SqlServer | 1.8.6 | 1.8.14 |
| Microsoft.AspNetCore.Authentication.JwtBearer | 8.0.0 | 8.0.4 |
| Microsoft.AspNetCore.Authentication.OpenIdConnect | 8.0.0 | 8.0.4 |
| Microsoft.AspNetCore.Authorization | 8.0.0 | 8.0.4 |
| Microsoft.AspNetCore.Components | 8.0.0 | 8.0.4 |
| Microsoft.AspNetCore.Components.Authorization | 8.0.0 | 8.0.4 |
| Microsoft.AspNetCore.Components.Web | 8.0.0 | 8.0.4 |
| Microsoft.AspNetCore.Components.WebAssembly | 8.0.0 | 8.0.4 |
| Microsoft.AspNetCore.Components.WebAssembly.Server | 8.0.0 | 8.0.4 |
| Microsoft.AspNetCore.Components.WebAssembly.Authentication | 8.0.0 | 8.0.4 |
| Microsoft.AspNetCore.Components.WebAssembly.DevServer | 8.0.0 | 8.0.4 |
| Microsoft.AspNetCore.DataProtection.StackExchangeRedis | 8.0.0 | 8.0.4 |
| Microsoft.AspNetCore.Mvc.NewtonsoftJson | 8.0.0 | 8.0.4 |
| Microsoft.AspNetCore.Mvc.Razor.RuntimeCompilation | 8.0.0 | 8.0.4 |
| Microsoft.AspNetCore.Mvc.Testing | 8.0.0 | 8.0.4 |
| Microsoft.AspNetCore.TestHost | 8.0.0 | 8.0.4 |
| Microsoft.AspNetCore.WebUtilities | 8.0.0 | 8.0.4 |
| Microsoft.Data.SqlClient | 8.0.0 | 8.0.4 |
| Microsoft.EntityFrameworkCore | 8.0.0 | 8.0.4 |
| Microsoft.EntityFrameworkCore.Design | 8.0.0 | 8.0.4 |
| Microsoft.EntityFrameworkCore.InMemory | 8.0.0 | 8.0.4 |
| Microsoft.EntityFrameworkCore.Proxies | 8.0.0 | 8.0.4 |
| Microsoft.EntityFrameworkCore.Relational | 8.0.0 | 8.0.4 |
| Microsoft.EntityFrameworkCore.Sqlite | 8.0.0 | 8.0.4 |
| Microsoft.EntityFrameworkCore.SqlServer | 8.0.0 | 8.0.4 |
| Microsoft.EntityFrameworkCore.Tools | 8.0.0 | 8.0.4 |
| Microsoft.Extensions.DependencyInjection.Abstractions | 8.0.0 | 8.0.1 |
| Microsoft.Extensions.FileProviders.Embedded | 8.0.0 | 8.0.4 |
| Microsoft.Extensions.Logging.Abstractions | 8.0.0 | 8.0.1 |
| Microsoft.Extensions.Options | 8.0.0 | 8.0.2 |
| Microsoft.IdentityModel.Protocols.OpenIdConnect | - | 7.5.1 |
| Microsoft.IdentityModel.Tokens | - | 7.5.1 |
| Microsoft.IdentityModel.JsonWebTokens | - | 7.5.1 |
| System.IdentityModel.Tokens.Jwt | - | 7.5.1 |
| OpenIddict.Abstractions | 5.1.0 | 5.5.0 |
| OpenIddict.Core | 5.1.0 | 5.5.0 |
| OpenIddict.Server.AspNetCore | 5.1.0 | 5.5.0 |
| OpenIddict.Validation.AspNetCore | 5.1.0 | 5.5.0 |
| OpenIddict.Validation.ServerIntegration | 5.1.0 | 5.5.0 |
| Oracle.EntityFrameworkCore | 8.21.121 | 8.23.40 |
| Pomelo.EntityFrameworkCore.MySql | 8.0.0 | 8.0.2 |
| SixLabors.ImageSharp | 3.0.2 | 3.1.4 |

6
framework/src/Volo.Abp.Cli.Core/Volo/Abp/Cli/Utils/CmdHelper.cs

@ -20,10 +20,14 @@ public class CmdHelper : ICmdHelper, ITransientDependency
public void Open(string pathOrUrl)
{
//directory might contain 'space' character
pathOrUrl = pathOrUrl.EnsureStartsWith('"');
pathOrUrl = pathOrUrl.EnsureEndsWith('"');
if (RuntimeInformation.IsOSPlatform(OSPlatform.Windows))
{
pathOrUrl = pathOrUrl.Replace("&", "^&");
Process.Start(new ProcessStartInfo("cmd", $"/c start {pathOrUrl}") { CreateNoWindow = true });
Process.Start(new ProcessStartInfo("cmd", $"/c start \"\" {pathOrUrl}") { CreateNoWindow = true });
}
else if (RuntimeInformation.IsOSPlatform(OSPlatform.Linux))
{

2
framework/test/Volo.Abp.EntityFrameworkCore.Tests/Volo/Abp/EntityFrameworkCore/ValueConverters/EFCore_DateTimeKindTests.cs

@ -11,7 +11,7 @@ namespace Volo.Abp.EntityFrameworkCore.ValueConverters;
public abstract class EFCore_DateTimeKindTests : DateTimeKind_Tests<AbpEntityFrameworkCoreTestModule>
{
[Fact]
[Fact(Skip = "https://github.com/dotnet/efcore/issues/34760")]
public async Task DateTime_Kind_Should_Be_Normalized_In_View_Query_Test()
{
var personName = "bob lee";

20
modules/cms-kit/test/Volo.CmsKit.Application.Tests/Comments/CommentPublicAppService_Tests.cs

@ -64,7 +64,7 @@ public class CommentPublicAppService_Tests : CmsKitApplicationTestBase
.ShouldBeTrue();
});
}
[Theory]
[InlineData("https://abp.io/features")]
public async Task CreateAsync_ShouldCreateComment_If_Url_Allowed(string text)
@ -84,8 +84,8 @@ public class CommentPublicAppService_Tests : CmsKitApplicationTestBase
}
[Theory]
[InlineData("[ABP Community](https://abp.io/community/)")]
[InlineData("<a href='https://abp.io/docs/latest'>abp.io/docs</a>")]
[InlineData("[ABP Community](https://community.abp.io/)")]
[InlineData("<a href='https://docs.abp.io/en/abp/latest'>docs.abp.io</a>")]
public async Task CreateAsync_ShouldThrowUserFriendlyException_If_Url_UnAllowed(string text)
{
_currentUser.Id.Returns(_cmsKitTestData.User2Id);
@ -94,7 +94,7 @@ public class CommentPublicAppService_Tests : CmsKitApplicationTestBase
await _commentAppService.CreateAsync(
_cmsKitTestData.EntityType1,
_cmsKitTestData.EntityId1,
new CreateCommentInput
new CreateCommentInput
{
RepliedCommentId = null,
Text = text, //not allowed URL
@ -104,7 +104,7 @@ public class CommentPublicAppService_Tests : CmsKitApplicationTestBase
}
[Fact]
public async Task CreateAsync_ShouldThrowUserFriendlyException_If_IdempotencyToken_Not_Unique()
public async Task CreateAsync_ShouldThrowUserFriendlyException_If_IdempotencyToken_Not_Unique()
{
_currentUser.Id.Returns(_cmsKitTestData.User2Id);
@ -112,10 +112,10 @@ public class CommentPublicAppService_Tests : CmsKitApplicationTestBase
await _commentAppService.CreateAsync(
_cmsKitTestData.EntityType1,
_cmsKitTestData.EntityId1,
new CreateCommentInput
new CreateCommentInput
{
RepliedCommentId = null,
Text = "<text>",
Text = "<text>",
IdempotencyToken = _cmsKitTestData.IdempotencyToken_1
}
));
@ -139,7 +139,7 @@ public class CommentPublicAppService_Tests : CmsKitApplicationTestBase
comment.Text.ShouldBe("I'm Updated");
});
}
[Fact]
public async Task UpdateAsync_ShouldThrowUserFriendlyException_If_Url_UnAllowed()
{
@ -148,9 +148,9 @@ public class CommentPublicAppService_Tests : CmsKitApplicationTestBase
await Should.ThrowAsync<UserFriendlyException>(async () =>
await _commentAppService.UpdateAsync(
_cmsKitTestData.CommentWithChildId,
new UpdateCommentInput
new UpdateCommentInput
{
Text = "[ABP Community - Update](https://abp.io/community/)", //not allowed URL
Text = "[ABP Community - Update](https://community.abp.io/)", //not allowed URL
}
));
}

25
modules/docs/app/VoloDocs.Web/Program.cs

@ -1,6 +1,9 @@
using System;
using System.IO;
using System.Threading.Tasks;
using Microsoft.AspNetCore.Builder;
using Microsoft.AspNetCore.Hosting;
using Microsoft.Extensions.DependencyInjection;
using Microsoft.Extensions.Hosting;
using Serilog;
using Serilog.Events;
@ -9,7 +12,7 @@ namespace VoloDocs.Web
{
public class Program
{
public static int Main(string[] args)
public async static Task<int> Main(string[] args)
{
Log.Logger = new LoggerConfiguration()
.MinimumLevel.Debug() //TODO: Should be configurable!
@ -22,7 +25,14 @@ namespace VoloDocs.Web
try
{
Log.Information("Starting web host.");
CreateHostBuilder(args).Build().Run();
var builder = WebApplication.CreateBuilder(args);
builder.Host
.UseAutofac()
.UseSerilog();
await builder.AddApplicationAsync<VoloDocsWebModule>();
var app = builder.Build();
await app.InitializeApplicationAsync();
await app.RunAsync();
return 0;
}
catch (Exception ex)
@ -32,17 +42,8 @@ namespace VoloDocs.Web
}
finally
{
Log.CloseAndFlush();
await Log.CloseAndFlushAsync();
}
}
internal static IHostBuilder CreateHostBuilder(string[] args) =>
Host.CreateDefaultBuilder(args)
.ConfigureWebHostDefaults(webBuilder =>
{
webBuilder.UseStartup<Startup>();
})
.UseAutofac()
.UseSerilog();
}
}

6
modules/docs/app/VoloDocs.Web/Properties/launchSettings.json

@ -3,8 +3,8 @@
"windowsAuthentication": false,
"anonymousAuthentication": true,
"iisExpress": {
"applicationUrl": "https://localhost:44333/",
"sslPort": 0
"applicationUrl": "https://localhost:5001/",
"sslPort": 5001
}
},
"profiles": {
@ -21,7 +21,7 @@
"environmentVariables": {
"ASPNETCORE_ENVIRONMENT": "Development"
},
"applicationUrl": "https://localhost:44333/"
"applicationUrl": "https://localhost:5001/"
}
}
}

22
modules/docs/app/VoloDocs.Web/Startup.cs

@ -1,22 +0,0 @@
using System;
using Microsoft.AspNetCore.Builder;
using Microsoft.AspNetCore.Hosting;
using Microsoft.Extensions.DependencyInjection;
using Microsoft.Extensions.Logging;
using Volo.Abp;
namespace VoloDocs.Web
{
public class Startup
{
public void ConfigureServices(IServiceCollection services)
{
services.AddApplication<VoloDocsWebModule>();
}
public void Configure(IApplicationBuilder app, IWebHostEnvironment env, ILoggerFactory loggerFactory)
{
app.InitializeApplication();
}
}
}

2
modules/docs/src/Volo.Docs.Domain/Volo/Docs/FileSystem/Documents/FileSystemDocumentSource.cs

@ -32,6 +32,8 @@ namespace Volo.Docs.FileSystem.Documents
localDirectory = documentName.Substring(0, documentName.LastIndexOf('/'));
}
version = File.GetLastWriteTime(path).ToString("yyyyMMddHHmmss");
return new Document(GuidGenerator.Create(),
project.Id,
documentName,

37
npm/ng-packs/packages/core/src/lib/services/config-state.service.ts

@ -17,6 +17,8 @@ export class ConfigStateService {
private updateSubject = new Subject<void>();
private readonly store = new InternalStore({} as ApplicationConfigurationDto);
public uiCultureFromAuthCodeFlow: string;
setState(config: ApplicationConfigurationDto) {
this.store.set(config);
}
@ -53,8 +55,13 @@ export class ConfigStateService {
if (!appState.localization.currentCulture.cultureName) {
throw new Error('culture name should defined');
}
return this.getlocalizationResource(appState.localization.currentCulture.cultureName).pipe(
const cultureName =
this.uiCultureFromAuthCodeFlow ?? appState.localization.currentCulture.cultureName;
return this.getlocalizationResource(cultureName).pipe(
map(result => ({ ...appState, localization: { ...appState.localization, ...result } })),
tap(() => (this.uiCultureFromAuthCodeFlow = undefined)),
);
}
@ -71,10 +78,10 @@ export class ConfigStateService {
}
refreshLocalization(lang: string): Observable<null> {
if(this.includeLocalizationResources){
if (this.includeLocalizationResources) {
return this.refreshAppState().pipe(map(() => null));
}
return this.getlocalizationResource(lang)
.pipe(
tap(result =>
@ -145,7 +152,7 @@ export class ConfigStateService {
return keys.reduce((acc, key) => ({ ...acc, [key]: features.values[key] }), {});
}
getFeatures$(keys: string[]): Observable<{ [key: string]: string; } | undefined> {
getFeatures$(keys: string[]): Observable<{ [key: string]: string } | undefined> {
return this.store.sliceState(({ features }) => {
if (!features?.values) return;
@ -168,10 +175,13 @@ export class ConfigStateService {
const keysFound = Object.keys(settings).filter(key => key.indexOf(keyword) > -1);
return keysFound.reduce((acc, key) => {
acc[key] = settings[key];
return acc;
}, {} as Record<string, string>);
return keysFound.reduce(
(acc, key) => {
acc[key] = settings[key];
return acc;
},
{} as Record<string, string>,
);
}
getSettings$(keyword?: string) {
@ -183,10 +193,13 @@ export class ConfigStateService {
const keysFound = Object.keys(settings).filter(key => key.indexOf(keyword) > -1);
return keysFound.reduce((acc, key) => {
acc[key] = settings[key];
return acc;
}, {} as Record<string, string>);
return keysFound.reduce(
(acc, key) => {
acc[key] = settings[key];
return acc;
},
{} as Record<string, string>,
);
}),
);
}

6
npm/ng-packs/packages/core/src/lib/services/window.service.ts

@ -3,9 +3,9 @@ import { DOCUMENT } from '@angular/common';
@Injectable({ providedIn: 'root' })
export class AbpWindowService {
protected readonly document = inject(DOCUMENT);
protected readonly window = this.document.defaultView;
protected readonly navigator = this.window.navigator;
public readonly document = inject(DOCUMENT);
public readonly window = this.document.defaultView;
public readonly navigator = this.window.navigator;
copyToClipboard(text: string): Promise<void> {
return this.navigator.clipboard.writeText(text);

49
npm/ng-packs/packages/oauth/src/lib/strategies/auth-code-flow-strategy.ts

@ -1,6 +1,6 @@
import { noop } from '@abp/ng.core';
import { Params } from '@angular/router';
import { from, of } from 'rxjs';
import { filter, from, of, take, tap } from 'rxjs';
import { AuthFlowStrategy } from './auth-flow-strategy';
import { isTokenExpired } from '../utils';
@ -9,6 +9,7 @@ export class AuthCodeFlowStrategy extends AuthFlowStrategy {
async init() {
this.checkRememberMeOption();
this.listenToTokenReceived();
return super
.init()
@ -34,6 +35,46 @@ export class AuthCodeFlowStrategy extends AuthFlowStrategy {
}
}
private getCultureParams(queryParams?: Params) {
const lang = this.sessionState.getLanguage();
const culture = { culture: lang, 'ui-culture': lang };
return { ...(lang && culture), ...queryParams };
}
protected setUICulture() {
const urlParams = new URLSearchParams(window.location.search);
this.configState.uiCultureFromAuthCodeFlow = urlParams.get('ui-culture');
}
protected replaceURLParams() {
const location = this.windowService.window.location;
const history = this.windowService.window.history;
const href =
location.origin +
location.pathname +
location.search
.replace(/iss=[^&$]*/, '')
.replace(/culture=[^&$]*/, '')
.replace(/ui-culture=[^&$]*/, '') +
location.hash;
history.replaceState(null, '', href);
}
protected listenToTokenReceived() {
this.oAuthService.events
.pipe(
filter(event => event.type === 'token_received'),
tap(() => {
this.setUICulture();
this.replaceURLParams();
}),
take(1),
)
.subscribe();
}
navigateToLogin(queryParams?: Params) {
let additionalState = '';
if (queryParams?.returnUrl) {
@ -62,10 +103,4 @@ export class AuthCodeFlowStrategy extends AuthFlowStrategy {
this.oAuthService.initCodeFlow('', this.getCultureParams(queryParams));
return of(null);
}
private getCultureParams(queryParams?: Params) {
const lang = this.sessionState.getLanguage();
const culture = { culture: lang, 'ui-culture': lang };
return { ...(lang && culture), ...queryParams };
}
}

3
npm/ng-packs/packages/oauth/src/lib/strategies/auth-flow-strategy.ts

@ -13,6 +13,7 @@ import {
import {
AbpLocalStorageService,
AbpWindowService,
ConfigStateService,
EnvironmentService,
HttpErrorReporterService,
@ -38,6 +39,7 @@ export abstract class AuthFlowStrategy {
protected sessionState: SessionStateService;
protected localStorageService: AbpLocalStorageService;
protected rememberMeService: RememberMeService;
protected windowService: AbpWindowService;
protected tenantKey: string;
protected router: Router;
@ -65,6 +67,7 @@ export abstract class AuthFlowStrategy {
this.router = injector.get(Router);
this.oAuthErrorFilterService = injector.get(OAuthErrorFilterService);
this.rememberMeService = injector.get(RememberMeService);
this.windowService = injector.get(AbpWindowService);
this.listenToOauthErrors();
}

4
templates/maui/src/MyCompanyName.MyProjectName/MyCompanyName.MyProjectName.csproj

@ -25,8 +25,8 @@
<ApplicationDisplayVersion>1.0</ApplicationDisplayVersion>
<ApplicationVersion>1</ApplicationVersion>
<SupportedOSPlatformVersion Condition="$([MSBuild]::GetTargetPlatformIdentifier('$(TargetFramework)')) == 'ios'">14.2</SupportedOSPlatformVersion>
<SupportedOSPlatformVersion Condition="$([MSBuild]::GetTargetPlatformIdentifier('$(TargetFramework)')) == 'maccatalyst'">14.0</SupportedOSPlatformVersion>
<SupportedOSPlatformVersion Condition="$([MSBuild]::GetTargetPlatformIdentifier('$(TargetFramework)')) == 'ios'">15.0</SupportedOSPlatformVersion>
<SupportedOSPlatformVersion Condition="$([MSBuild]::GetTargetPlatformIdentifier('$(TargetFramework)')) == 'maccatalyst'">15.0</SupportedOSPlatformVersion>
<SupportedOSPlatformVersion Condition="$([MSBuild]::GetTargetPlatformIdentifier('$(TargetFramework)')) == 'android'">24.0</SupportedOSPlatformVersion>
<SupportedOSPlatformVersion Condition="$([MSBuild]::GetTargetPlatformIdentifier('$(TargetFramework)')) == 'windows'">10.0.17763.0</SupportedOSPlatformVersion>
<TargetPlatformMinVersion Condition="$([MSBuild]::GetTargetPlatformIdentifier('$(TargetFramework)')) == 'windows'">10.0.17763.0</TargetPlatformMinVersion>

Loading…
Cancel
Save