mirror of
https://github.com/bitwarden/mobile
synced 2025-12-05 23:53:33 +00:00
PS-70 code format
This commit is contained in:
@@ -1,4 +1,4 @@
|
||||
using System;
|
||||
using System;
|
||||
using Bit.App.Pages;
|
||||
using Bit.App.Utilities;
|
||||
using Bit.Core.Models.View;
|
||||
|
||||
@@ -41,7 +41,7 @@ namespace Bit.App.Controls
|
||||
protected override void OnPropertyChanged([CallerMemberName] string propertyName = null)
|
||||
{
|
||||
base.OnPropertyChanged(propertyName);
|
||||
if(propertyName == nameof(Progress) && _progressDrawer == null)
|
||||
if (propertyName == nameof(Progress) && _progressDrawer == null)
|
||||
{
|
||||
var circle = new Circle(Radius * (float)DeviceDisplay.MainDisplayInfo.Density, (info) => new SKPoint((float)info.Width / 2, (float)info.Height / 2));
|
||||
_progressDrawer = new ProgressDrawer(SkCanvasView, circle, () => (float)Progress, StrokeWidth * (float)DeviceDisplay.MainDisplayInfo.Density, BackgroundProgressColor.ToSKColor(), ProgressColor.ToSKColor(), EndingProgressColor.ToSKColor());
|
||||
|
||||
@@ -1,4 +1,4 @@
|
||||
using System;
|
||||
using System;
|
||||
using System.Threading.Tasks;
|
||||
using Bit.App.Resources;
|
||||
using Bit.App.Utilities;
|
||||
@@ -61,7 +61,7 @@ namespace Bit.App.Pages
|
||||
nameof(TotpCodeFormattedEnd),
|
||||
});
|
||||
}
|
||||
|
||||
|
||||
public string TotpSec
|
||||
{
|
||||
get => _totpSec;
|
||||
@@ -99,7 +99,7 @@ namespace Bit.App.Pages
|
||||
}
|
||||
|
||||
public string TotpCodeFormattedStart => TotpCodeFormatted?.Split(' ')[0];
|
||||
|
||||
|
||||
public string TotpCodeFormattedEnd => TotpCodeFormatted?.Split(' ')[1];
|
||||
|
||||
public async Task CopyToClipboardAsync()
|
||||
|
||||
@@ -310,7 +310,7 @@ namespace Bit.App.Pages
|
||||
item.TotpTickAsync();
|
||||
}
|
||||
return TotpFilterEnable;
|
||||
});
|
||||
});
|
||||
}
|
||||
else
|
||||
{
|
||||
|
||||
@@ -25,7 +25,7 @@ namespace Bit.App.Pages
|
||||
private readonly Stopwatch _stopwatch;
|
||||
private bool _pageIsActive;
|
||||
private bool _qrcodeFound;
|
||||
private float _scale;
|
||||
private float _scale;
|
||||
|
||||
private readonly LazyResolve<ILogger> _logger = new LazyResolve<ILogger>("logger");
|
||||
|
||||
@@ -183,7 +183,7 @@ namespace Bit.App.Pages
|
||||
}
|
||||
_callback(null);
|
||||
}
|
||||
|
||||
|
||||
private void ToggleScanMode_OnTapped(object sender, EventArgs e)
|
||||
{
|
||||
ViewModel.ToggleScanModeCommand.Execute(null);
|
||||
@@ -192,14 +192,14 @@ namespace Bit.App.Pages
|
||||
_authenticationKeyEntry.Focus();
|
||||
}
|
||||
}
|
||||
|
||||
|
||||
private void OnCanvasViewPaintSurface(object sender, SKPaintSurfaceEventArgs args)
|
||||
{
|
||||
var info = args.Info;
|
||||
var surface = args.Surface;
|
||||
var canvas = surface.Canvas;
|
||||
var margins = 20;
|
||||
var maxSquareSize = (Math.Min(info.Height, info.Width)*0.9f - margins) * _scale;
|
||||
var maxSquareSize = (Math.Min(info.Height, info.Width) * 0.9f - margins) * _scale;
|
||||
var squareSize = maxSquareSize;
|
||||
var lineSize = squareSize * 0.15f;
|
||||
var startXPoint = (info.Width / 2) - (squareSize / 2);
|
||||
@@ -207,25 +207,25 @@ namespace Bit.App.Pages
|
||||
canvas.Clear(SKColors.Transparent);
|
||||
|
||||
using (var strokePaint = new SKPaint
|
||||
{
|
||||
Color = _qrcodeFound ? _greenSKColor : _blueSKColor,
|
||||
StrokeWidth = 9 * _scale,
|
||||
StrokeCap = SKStrokeCap.Round,
|
||||
})
|
||||
{
|
||||
canvas.Scale(1,1);
|
||||
Color = _qrcodeFound ? _greenSKColor : _blueSKColor,
|
||||
StrokeWidth = 9 * _scale,
|
||||
StrokeCap = SKStrokeCap.Round,
|
||||
})
|
||||
{
|
||||
canvas.Scale(1, 1);
|
||||
//top left
|
||||
canvas.DrawLine (startXPoint, startYPoint, startXPoint, startYPoint+lineSize, strokePaint);
|
||||
canvas.DrawLine (startXPoint, startYPoint, startXPoint+lineSize, startYPoint, strokePaint);
|
||||
canvas.DrawLine(startXPoint, startYPoint, startXPoint, startYPoint + lineSize, strokePaint);
|
||||
canvas.DrawLine(startXPoint, startYPoint, startXPoint + lineSize, startYPoint, strokePaint);
|
||||
//bot left
|
||||
canvas.DrawLine (startXPoint, startYPoint+squareSize, startXPoint, startYPoint+squareSize-lineSize, strokePaint);
|
||||
canvas.DrawLine (startXPoint, startYPoint+squareSize, startXPoint+lineSize, startYPoint+squareSize, strokePaint);
|
||||
canvas.DrawLine(startXPoint, startYPoint + squareSize, startXPoint, startYPoint + squareSize - lineSize, strokePaint);
|
||||
canvas.DrawLine(startXPoint, startYPoint + squareSize, startXPoint + lineSize, startYPoint + squareSize, strokePaint);
|
||||
//top right
|
||||
canvas.DrawLine (startXPoint+squareSize, startYPoint, startXPoint+squareSize-lineSize, startYPoint, strokePaint);
|
||||
canvas.DrawLine (startXPoint+squareSize, startYPoint, startXPoint+squareSize, startYPoint+lineSize, strokePaint);
|
||||
canvas.DrawLine(startXPoint + squareSize, startYPoint, startXPoint + squareSize - lineSize, startYPoint, strokePaint);
|
||||
canvas.DrawLine(startXPoint + squareSize, startYPoint, startXPoint + squareSize, startYPoint + lineSize, strokePaint);
|
||||
//bot right
|
||||
canvas.DrawLine (startXPoint+squareSize, startYPoint+squareSize, startXPoint+squareSize-lineSize, startYPoint+squareSize, strokePaint);
|
||||
canvas.DrawLine (startXPoint+squareSize, startYPoint+squareSize, startXPoint+squareSize, startYPoint+squareSize-lineSize, strokePaint);
|
||||
canvas.DrawLine(startXPoint + squareSize, startYPoint + squareSize, startXPoint + squareSize - lineSize, startYPoint + squareSize, strokePaint);
|
||||
canvas.DrawLine(startXPoint + squareSize, startYPoint + squareSize, startXPoint + squareSize, startYPoint + squareSize - lineSize, strokePaint);
|
||||
}
|
||||
}
|
||||
async Task AnimationLoopAsync()
|
||||
@@ -234,10 +234,10 @@ namespace Bit.App.Pages
|
||||
while (_pageIsActive)
|
||||
{
|
||||
var t = _stopwatch.Elapsed.TotalSeconds % 2 / 2;
|
||||
_scale = (20-(1-(float)Math.Sin(4*Math.PI*t))) / 20;
|
||||
_scale = (20 - (1 - (float)Math.Sin(4 * Math.PI * t))) / 20;
|
||||
SkCanvasView.InvalidateSurface();
|
||||
await Task.Delay(TimeSpan.FromSeconds(1.0 / 30));
|
||||
if(_qrcodeFound && _scale > 0.98f)
|
||||
if (_qrcodeFound && _scale > 0.98f)
|
||||
{
|
||||
_checkIcon.TextColor = _greenColor;
|
||||
SkCanvasView.InvalidateSurface();
|
||||
|
||||
@@ -5,7 +5,7 @@ using Xamarin.Forms;
|
||||
|
||||
namespace Bit.App.Pages
|
||||
{
|
||||
public class ScanPageViewModel: BaseViewModel
|
||||
public class ScanPageViewModel : BaseViewModel
|
||||
{
|
||||
private bool _showScanner;
|
||||
private string _totpAuthenticationKey;
|
||||
@@ -41,7 +41,7 @@ namespace Bit.App.Pages
|
||||
nameof(CameraInstructionBottom)
|
||||
});
|
||||
}
|
||||
|
||||
|
||||
public FormattedString ToggleScanModeLabel
|
||||
{
|
||||
get
|
||||
@@ -60,7 +60,7 @@ namespace Bit.App.Pages
|
||||
return fs;
|
||||
}
|
||||
}
|
||||
|
||||
|
||||
private void ToggleScanAsync()
|
||||
{
|
||||
ShowScanner = !ShowScanner;
|
||||
|
||||
@@ -222,7 +222,7 @@ namespace Bit.App.Pages
|
||||
return fs;
|
||||
}
|
||||
}
|
||||
|
||||
|
||||
public bool ShowUris => IsLogin && Cipher.Login.HasUris;
|
||||
public bool ShowIdentityAddress => IsIdentity && (
|
||||
!string.IsNullOrWhiteSpace(Cipher.Identity.Address1) ||
|
||||
|
||||
Reference in New Issue
Block a user