mirror of
https://github.com/BeyondDimension/SteamTools.git
synced 2026-10-25 11:39:56 +08:00
fix
This commit is contained in:
@@ -43,13 +43,8 @@ namespace System.Application.Services
|
||||
await InitializeAsync(auths, isSync);
|
||||
}
|
||||
|
||||
public async Task InitializeAsync(GameAccountPlatformAuthenticator[] auths, bool isSync = false, Action? emptyAction = null)
|
||||
public async Task InitializeAsync(GameAccountPlatformAuthenticator[] auths, bool isSync = false)
|
||||
{
|
||||
if (!auths.Any_Nullable())
|
||||
{
|
||||
emptyAction?.Invoke();
|
||||
return;
|
||||
}
|
||||
var hasPassword = repository.HasSecondaryPassword(auths);
|
||||
List<IGAPAuthenticatorDTO> list;
|
||||
if (hasPassword)
|
||||
|
||||
@@ -94,7 +94,10 @@ namespace System.Application.UI.ViewModels
|
||||
|
||||
public bool IsAuthenticatorsEmpty => !AuthService.Current.Authenticators.Items.Any_Nullable();
|
||||
|
||||
public bool IsAuthenticatorsEmptyAndHasPassword => SourceAuthCount > 0 && IsAuthenticatorsEmpty == true;
|
||||
[Obsolete("use IsAuthenticatorsEmptyButHasSourceAuths")] // AndHasPassword ???
|
||||
public bool IsAuthenticatorsEmptyAndHasPassword => SourceAuthCount > 0 && IsAuthenticatorsEmpty;
|
||||
|
||||
public bool IsAuthenticatorsEmptyButHasSourceAuths => SourceAuthCount > 0 && IsAuthenticatorsEmpty;
|
||||
|
||||
public int SourceAuthCount { get; set; }
|
||||
|
||||
@@ -135,20 +138,19 @@ namespace System.Application.UI.ViewModels
|
||||
var auths = await AuthService.Current.Repository.GetAllSourceAsync();
|
||||
SourceAuthCount = auths.Length;
|
||||
//if (IsFirstActivation)
|
||||
if (IsAuthenticatorsEmptyAndHasPassword)
|
||||
if (IsAuthenticatorsEmptyButHasSourceAuths)
|
||||
{
|
||||
await Task.Run(async () =>
|
||||
{
|
||||
await AuthService.Current.InitializeAsync(auths
|
||||
#if __MOBILE__
|
||||
, emptyAction: () =>
|
||||
{
|
||||
IsFirstLoadedAuthenticatorsEmpty = true;
|
||||
}
|
||||
#endif
|
||||
);
|
||||
await AuthService.Current.InitializeAsync(auths);
|
||||
});
|
||||
}
|
||||
#if __MOBILE__
|
||||
else
|
||||
{
|
||||
IsFirstLoadedAuthenticatorsEmpty = true;
|
||||
}
|
||||
#endif
|
||||
base.Activation();
|
||||
}
|
||||
|
||||
|
||||
@@ -1,7 +1,7 @@
|
||||
<?xml version="1.0" encoding="utf-8"?>
|
||||
<manifest xmlns:android="http://schemas.android.com/apk/res/android" android:versionCode="1" android:versionName="2.5.0" package="net.steampp.app" android:installLocation="auto">
|
||||
<uses-sdk android:minSdkVersion="21" android:targetSdkVersion="30" />
|
||||
<application android:label="@string/app_name" android:theme="@style/MainTheme" android:roundIcon="@mipmap/ic_launcher_round" android:fullBackupContent="@xml/auto_backup_rules">
|
||||
<application android:fullBackupContent="@xml/auto_backup_rules">
|
||||
<activity android:name="microsoft.identity.client.BrowserTabActivity" android:configChanges="orientation|screenSize">
|
||||
<intent-filter>
|
||||
<action android:name="android.intent.action.VIEW" />
|
||||
|
||||
+1
@@ -37,6 +37,7 @@
|
||||
style="@style/Widget.MaterialComponents.TextInputLayout.OutlinedBox"
|
||||
android:layout_width="match_parent"
|
||||
android:layout_height="wrap_content"
|
||||
android:layout_marginTop="@dimen/activity_vertical_margin"
|
||||
app:endIconMode="clear_text"
|
||||
tools:hint="Steam用户名"
|
||||
xamarin:managedType="Google.Android.Material.TextField.TextInputLayout">
|
||||
|
||||
@@ -1,3 +1,7 @@
|
||||
using System.Collections.Generic;
|
||||
using System.Linq;
|
||||
using Xamarin.Essentials;
|
||||
using ZXing;
|
||||
using ZXing.Mobile;
|
||||
using ZXingResult = ZXing.Result;
|
||||
|
||||
@@ -20,7 +24,31 @@ namespace System
|
||||
scanner.BottomText = "Wait for the barcode to automatically scan!";
|
||||
|
||||
//Start scanning
|
||||
var result = await scanner.Scan();
|
||||
var result = await scanner.Scan(new()
|
||||
{
|
||||
// https://github.com/Redth/ZXing.Net.Mobile/issues/808#issuecomment-835089415
|
||||
PossibleFormats = new List<BarcodeFormat>() { BarcodeFormat.QR_CODE },
|
||||
CameraResolutionSelector = new((List<CameraResolution> availableResolutions) =>
|
||||
{
|
||||
CameraResolution? result = null;
|
||||
|
||||
double aspectTolerance = 0.1;
|
||||
var displayOrientationHeight = DeviceDisplay.MainDisplayInfo.Orientation == DisplayOrientation.Portrait ? DeviceDisplay.MainDisplayInfo.Height : DeviceDisplay.MainDisplayInfo.Width;
|
||||
var displayOrientationWidth = DeviceDisplay.MainDisplayInfo.Orientation == DisplayOrientation.Portrait ? DeviceDisplay.MainDisplayInfo.Width : DeviceDisplay.MainDisplayInfo.Height;
|
||||
|
||||
var targetRatio = displayOrientationHeight / displayOrientationWidth;
|
||||
var targetHeight = displayOrientationHeight;
|
||||
var minDiff = double.MaxValue;
|
||||
|
||||
foreach (var r in availableResolutions.Where(r => Math.Abs(((double)r.Width / r.Height) - targetRatio) < aspectTolerance))
|
||||
{
|
||||
if (Math.Abs(r.Height - targetHeight) < minDiff)
|
||||
minDiff = Math.Abs(r.Height - targetHeight);
|
||||
result = r;
|
||||
}
|
||||
return result;
|
||||
})
|
||||
});
|
||||
if (result == null) return;
|
||||
|
||||
handleScanResult(result);
|
||||
|
||||
@@ -35,7 +35,7 @@ namespace System.Application.UI.Activities
|
||||
return;
|
||||
}
|
||||
|
||||
if (MainApplication.AllowScreenshots)
|
||||
if (!MainApplication.AllowScreenshots)
|
||||
{
|
||||
this.SetWindowSecure(true);
|
||||
}
|
||||
|
||||
@@ -58,6 +58,8 @@ namespace System.Application.UI.Activities
|
||||
binding.tvSteamTradeLoginTip.Text = LocalAuth_SteamTradeLoginTip;
|
||||
binding.tvLoading.Text = LocalAuth_AuthTrade_GetTip;
|
||||
//speedDialDict.ReplaceLabels(ToString2);
|
||||
binding.btnCancelTrade.Text = LocalAuth_AuthTrade_Cancel;
|
||||
binding.btnConfirmTrade.Text = LocalAuth_AuthTrade_Confirm;
|
||||
SetMenuTitle();
|
||||
}).AddTo(this);
|
||||
|
||||
@@ -68,6 +70,7 @@ namespace System.Application.UI.Activities
|
||||
var state_reverse = !value ? ViewStates.Gone : ViewStates.Visible;
|
||||
binding.layoutContentSteamLogin.Visibility = state;
|
||||
binding.layoutContentConfirmations.Visibility = state_reverse;
|
||||
binding.layoutActions.Visibility = state;
|
||||
//binding.speedDial.Visibility = state;
|
||||
}).AddTo(this);
|
||||
ViewModel!.WhenAnyValue(x => x.IsRequiresCaptcha).Subscribe(value =>
|
||||
|
||||
@@ -97,7 +97,7 @@ namespace System.Application.UI.Fragments
|
||||
.Subscribe(x =>
|
||||
{
|
||||
if (!x) return;
|
||||
OnAuthenticatorsChanged(ViewModel!.IsAuthenticatorsEmpty, x);
|
||||
OnAuthenticatorsChanged(ViewModel!.IsAuthenticatorsEmpty, false);
|
||||
})
|
||||
.AddTo(this);
|
||||
ViewModel!.WhenAnyValue(x => x.IsRefreshing)
|
||||
@@ -143,7 +143,7 @@ namespace System.Application.UI.Fragments
|
||||
public override void OnResume()
|
||||
{
|
||||
base.OnResume();
|
||||
if (MainApplication.AllowScreenshots)
|
||||
if (!MainApplication.AllowScreenshots)
|
||||
{
|
||||
Activity.SetWindowSecure(true);
|
||||
}
|
||||
|
||||
@@ -18,7 +18,12 @@ using Square.LeakCanary;
|
||||
namespace System.Application.UI
|
||||
{
|
||||
[Register(JavaPackageConstants.UI + nameof(MainApplication))]
|
||||
[Application(Debuggable = _ThisAssembly.Debuggable)]
|
||||
[Application(
|
||||
Debuggable = _ThisAssembly.Debuggable,
|
||||
Label = "@string/app_name",
|
||||
Theme = "@style/MainTheme",
|
||||
Icon = "@mipmap/ic_launcher",
|
||||
RoundIcon = "@mipmap/ic_launcher_round")]
|
||||
public sealed class MainApplication : AndroidApplication
|
||||
{
|
||||
public MainApplication(IntPtr javaReference, JniHandleOwnership transfer) : base(javaReference, transfer)
|
||||
|
||||
Reference in New Issue
Block a user