Skip to content

Commit

Permalink
fix ASP.NET Core Dependent & ASF for Android & res Chinese and Englis…
Browse files Browse the repository at this point in the history
…h typesetting
  • Loading branch information
AigioL committed Dec 2, 2021
1 parent dcf4db3 commit 7a0a4c4
Show file tree
Hide file tree
Showing 16 changed files with 445 additions and 296 deletions.
280 changes: 188 additions & 92 deletions Directory.Packages.props

Large diffs are not rendered by default.

2 changes: 1 addition & 1 deletion references/ArchiSteamFarm
Binary file added resources/screenshot_asf_android.png
Loading
Sorry, something went wrong. Reload?
Sorry, we cannot display this file.
Sorry, this file is invalid so it cannot be displayed.
Binary file removed resources/screenshot_asf_plus_android.png
Binary file not shown.
Binary file added resources/screenshot_asf_ui_android.png
Loading
Sorry, something went wrong. Reload?
Sorry, we cannot display this file.
Sorry, this file is invalid so it cannot be displayed.
5 changes: 4 additions & 1 deletion src/Common.CoreLib/Common.CoreLib.csproj
Original file line number Diff line number Diff line change
@@ -1,4 +1,4 @@
<Project Sdk="Microsoft.NET.Sdk">
<Project Sdk="Microsoft.NET.Sdk">

<PropertyGroup>
<!--<TargetFrameworks>netstandard2.1;netcoreapp3.1;net5.0;net6.0</TargetFrameworks>-->
Expand All @@ -17,6 +17,9 @@
<PackageReference Include="gfoidl.Base64" />
<PackageReference Include="MessagePack" />
<PackageReference Include="Newtonsoft.Json" />
</ItemGroup>

<ItemGroup Condition=" $(TargetFramework.StartsWith('netstandard')) ">
<PackageReference Include="System.Text.Json" />
<PackageReference Include="System.Text.Encodings.Web" />
</ItemGroup>
Expand Down
6 changes: 3 additions & 3 deletions src/ST.Client.Android/GoToPlatformPages.cs
Original file line number Diff line number Diff line change
Expand Up @@ -139,7 +139,7 @@ public static void StartActivity<TActivity, TViewModel>(Fragment fragment, TView
StartActivity<TActivity, TViewModel>(activity, viewModel);
}

public static bool OpenFile(Context context, JFile apkFile, string mime)
public static bool OpenFile(Context context, JFile jFile, string mime)
{
try
{
Expand All @@ -148,12 +148,12 @@ public static bool OpenFile(Context context, JFile apkFile, string mime)
AndroidUri apkUri;
if (sdkInt >= (int)BuildVersionCodes.N) // 7.0 FileProvider
{
apkUri = FileProvider.GetUriForFile(context, GetAuthority(context), apkFile);
apkUri = FileProvider.GetUriForFile(context, GetAuthority(context), jFile);
intent.AddFlags(ActivityFlags.GrantReadUriPermission); // FLAG_GRANT_READ_URI_PERMISSION 添加这一句表示对目标应用临时授权该Uri所代表的文件
}
else
{
apkUri = AndroidUri.FromFile(apkFile)!;
apkUri = AndroidUri.FromFile(jFile)!;
}
intent.SetDataAndType(apkUri, mime);
intent.AddFlags(ActivityFlags.NewTask);
Expand Down
Original file line number Diff line number Diff line change
@@ -1,4 +1,3 @@
using System;
using System.Collections.Generic;
using System.Text;
using XEPlatform = Xamarin.Essentials.Platform;
Expand Down Expand Up @@ -29,11 +28,21 @@ public void SetLightOrDarkThemeFollowingSystem(bool enable)
void IPlatformService.OpenFileByTextReader(string filePath)
{
var activity = XEPlatform.CurrentActivity;
if (filePath.StartsWith(IOPath.AppDataDirectory) || filePath.StartsWith(IOPath.CacheDirectory))
{
OpenFileByTextReaderByTextBlockActivity();
return;
}
var result = GoToPlatformPages.OpenFile(
activity,
new(filePath),
MediaTypeNames.TXT);
if (!result)
{
OpenFileByTextReaderByTextBlockActivity();
}

void OpenFileByTextReaderByTextBlockActivity()
{
TextBlockActivity.StartActivity(activity, new() { FilePath = filePath });
}
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -44,12 +44,16 @@ public override void OnCreateView(View view)

ASFService.Current.WhenAnyValue(x => x.IsASFRuning).SubscribeInMainThread(value =>
{
if (menuBuilder == null) return;
var menu_start = menuBuilder.FindItem(Resource.Id.menu_start);
if (menu_start == null) return;
menu_start.SetIcon(value ?
Resource.Drawable.round_pause_circle_outline_black_24 :
Resource.Drawable.round_play_circle_outline_black_24);
if (menuBuilder != null) // toolbar menu 因主活动改为 XF Shell,已由 XF 托管
{
var menu_start = menuBuilder.FindItem(Resource.Id.menu_start);
if (menu_start != null)
{
menu_start.SetIcon(value ?
Resource.Drawable.round_pause_circle_outline_black_24 :
Resource.Drawable.round_play_circle_outline_black_24);
}
}
}).AddTo(this);
}

Expand Down Expand Up @@ -110,9 +114,9 @@ static ActionItem MenuIdResToEnum(int resId)

string ViewPagerWithTabLayoutAdapter.IHost.GetPageTitle(int position) => position switch
{
0 => "ASF控制台",
1 => "Bot配置",
2 => "ASF配置",
0 => ASF_Console,
1 => ASF_BotManage,
2 => ASF_GlobalConfig,
_ => throw new ArgumentOutOfRangeException(nameof(position), position.ToString()),
};
}
Expand Down
3 changes: 2 additions & 1 deletion src/ST.Client.Mobile.Droid.App/ST.Client.Android.App.csproj
Original file line number Diff line number Diff line change
@@ -1,4 +1,4 @@
<?xml version="1.0" encoding="utf-8"?>
<?xml version="1.0" encoding="utf-8"?>
<Project DefaultTargets="Build" ToolsVersion="4.0" xmlns="http://schemas.microsoft.com/developer/msbuild/2003">
<PropertyGroup>
<Configuration Condition=" '$(Configuration)' == '' ">Debug</Configuration>
Expand Down Expand Up @@ -41,6 +41,7 @@
<EnableLLVM>false</EnableLLVM>
<AndroidEnableProfiledAot>false</AndroidEnableProfiledAot>
<BundleAssemblies>false</BundleAssemblies>
<EmbedAssembliesIntoApk>true</EmbedAssembliesIntoApk>
</PropertyGroup>
<PropertyGroup Condition=" '$(Configuration)|$(Platform)' == 'Release|AnyCPU' ">
<DebugSymbols>false</DebugSymbols>
Expand Down
4 changes: 2 additions & 2 deletions src/ST.Client/Services/Implementation/CloudServiceClient.cs
Original file line number Diff line number Diff line change
@@ -1,4 +1,4 @@
using Microsoft.Extensions.Logging;
using Microsoft.Extensions.Logging;
using Microsoft.Extensions.Options;
using System.Application.Columns;
using System.Application.Models;
Expand All @@ -25,7 +25,7 @@ public CloudServiceClient(
httpPlatformHelper,
toast,
userManager,
options,
options.Value,
validator)
{
this.userManager = userManager;
Expand Down
Loading

0 comments on commit 7a0a4c4

Please sign in to comment.