remove ShowTipKnownIssues & fix StartOrStopForegroundService

This commit is contained in:
Aigio Liu
2022-02-27 16:21:36 +08:00
parent 9932606be2
commit c86f28161f
3 changed files with 3 additions and 30 deletions
@@ -18,20 +18,13 @@ namespace System
{
Intent intent = new(context, typeof(TService));
intent.SetAction(startOrStop ? NativeService.START : NativeService.STOP);
if (startOrStop)
if (Build.VERSION.SdkInt >= BuildVersionCodes.O)
{
if (Build.VERSION.SdkInt >= BuildVersionCodes.O)
{
context.StartForegroundService(intent);
}
else
{
context.StartService(intent);
}
context.StartForegroundService(intent);
}
else
{
context.StopService(intent);
context.StartService(intent);
}
}
}
@@ -178,10 +178,6 @@ namespace System.Application.UI.Activities
{
IsVpnMode.Value = !IsVpnMode.Value;
SetIsVpnMode();
if (IsVpnMode.Value)
{
CommunityFixFragment.ShowTipKnownIssues();
}
return;
}
@@ -145,15 +145,6 @@ namespace System.Application.UI.Fragments
}
}
public static void ShowTipKnownIssues()
{
MessageBox.Show(string.Join(Environment.NewLine, new[] {
"VPN 模式不能正常工作",
"需要在 Wifi 或 流量 上手动设置代理地址,关闭时手动清除设置",
"Android 7+ 不信任用户证书",
}), "已知问题");
}
void StartProxyButton_Click(bool start)
=> AndroidPlatformServiceImpl.StartOrStopForegroundService(
RequireActivity(), nameof(ProxyService), start);
@@ -163,13 +154,6 @@ namespace System.Application.UI.Fragments
if (view.Id == Resource.Id.btnStartProxyService)
{
StartProxyButton_Click(true);
const string KEY = "CommunityFixFragment_IsShowTip";
var isShowTip = Preferences2.Get(KEY, false);
if (!isShowTip)
{
ShowTipKnownIssues();
Preferences2.Set(KEY, true);
}
return true;
}
else if (view.Id == Resource.Id.btnStopProxyService)