Skip to content

Commit

Permalink
fix
Browse files Browse the repository at this point in the history
  • Loading branch information
AigioL committed May 30, 2022
1 parent 38bd825 commit 97e5748
Show file tree
Hide file tree
Showing 7 changed files with 24 additions and 15 deletions.
2 changes: 1 addition & 1 deletion src/Common.ClientLib.Droid/ServiceCollectionExtensions.cs
Original file line number Diff line number Diff line change
Expand Up @@ -33,7 +33,7 @@ public static IServiceCollection AddTelephonyService(this IServiceCollection ser
}

/// <summary>
/// 添加平台权限
/// 添加平台运行时权限
/// </summary>
/// <param name="services"></param>
/// <returns></returns>
Expand Down
2 changes: 2 additions & 0 deletions src/Common.Essentials.Xamarin/ServiceCollectionExtensions.cs
Original file line number Diff line number Diff line change
@@ -1,4 +1,5 @@
using Microsoft.Extensions.DependencyInjection.Extensions;
using System.Application;
using System.Application.Services;
using System.Application.Services.Implementation;
using System.Security;
Expand All @@ -16,6 +17,7 @@ public static class ServiceCollectionExtensions
/// <returns></returns>
public static IServiceCollection TryAddEssentials(this IServiceCollection services)
{
Essentials.IsSupported = true;
services.TryAddSingleton<IBrowserPlatformService, BrowserPlatformServiceImpl>();
services.TryAddSingleton<IClipboardPlatformService, ClipboardPlatformServiceImpl>();
services.TryAddSingleton<IConnectivityPlatformService, ConnectivityPlatformServiceImpl>();
Expand Down
Original file line number Diff line number Diff line change
@@ -0,0 +1,5 @@
using System.Runtime.CompilerServices;
using static System.Properties.ThisAssembly;

[assembly: InternalsVisibleTo("System.Common.EssentialsLib.Maui" + PublicKey)]
[assembly: InternalsVisibleTo("System.Common.EssentialsLib.Xamarin" + PublicKey)]
3 changes: 3 additions & 0 deletions src/ST.Client.Maui.App/ST.Client.Maui.App.csproj
Original file line number Diff line number Diff line change
Expand Up @@ -75,6 +75,9 @@
<Compile Include="..\Common.CoreLib\Properties\AssemblyInfo.Version.cs">
<Link>Properties\AssemblyInfo.Version.cs</Link>
</Compile>
<Compile Include="..\Common.Essentials.Maui\Properties\AssemblyInfo.OS.cs">
<Link>Properties\AssemblyInfo.OS.cs</Link>
</Compile>
</ItemGroup>

<ItemGroup>
Expand Down
3 changes: 3 additions & 0 deletions src/ST.Client.Maui/ST.Client.Maui.csproj
Original file line number Diff line number Diff line change
Expand Up @@ -44,6 +44,9 @@
<Compile Include="..\ST\Properties\InternalsVisibleTo.cs">
<Link>Properties\InternalsVisibleTo.cs</Link>
</Compile>
<Compile Include="..\Common.Essentials.Maui\Properties\AssemblyInfo.OS.cs">
<Link>Properties\AssemblyInfo.OS.cs</Link>
</Compile>
<Compile Include="..\ST.Client.Desktop.Avalonia\Application\Converters\StringFormatConverter.cs">
<LinkBase>Converters</LinkBase>
</Compile>
Expand Down
24 changes: 10 additions & 14 deletions src/Startup.cs
Original file line number Diff line number Diff line change
Expand Up @@ -226,29 +226,25 @@ static void ConfigureRequiredServices(IServiceCollection services, IApplication.

// 添加日志实现
services.AddGeneralLogging();
#if MAUI || __MOBILE__
#if MAUI || __MOBILE__ || ANDROID || IOS || __ANDROID__
services.TryAddEssentials();
#endif
#if __MOBILE__
#if __MOBILE__ || ANDROID || IOS || __ANDROID__
// 添加运行时权限
services.AddPlatformPermissions();
#endif
#if !CONSOLEAPP
// 添加 app 配置项
services.TryAddOptions(AppSettings);
if (Essentials.IsSupported)
{
#if ANDROID || IOS || __ANDROID__ || MAUI
// 键值对存储(由Essentials提供)
services.TryAddEssentialsSecureStorage();
#if MAUI || __MOBILE__ || ANDROID || IOS || __ANDROID__
// 键值对存储 - 由 Essentials 提供
services.TryAddEssentialsSecureStorage();
#else
// 键值对存储 - 由 Repository 提供
services.TryAddRepositorySecureStorage();
// 首选项(Preferences) - 由 Repository 提供
services.AddRepositoryPreferences();
#endif
}
else
{
// 键值对存储(由Repository提供)
services.TryAddRepositorySecureStorage();
services.AddRepositoryPreferences();
}

// 添加安全服务
services.AddSecurityService<EmbeddedAesDataProtectionProvider, LocalDataProtectionProvider>();
Expand Down

0 comments on commit 97e5748

Please sign in to comment.