mirror of
https://github.com/bitwarden/mobile
synced 2025-12-21 10:43:22 +00:00
Add UWP support (#139)
* Add UWP project, and generate services boilerplate * SqliteService implementation and sqlite-net-pcl update (#bug https://stackoverflow.com/questions/45418669/xamarin-forms-pcl-assemly-issue) * Important services implementation * Create a shared project to host images for UWP (to keep code project clean) * Add extensions to image names referenced by the pcl project * Add DismissModalToolBarItem to modal pages * moving UWP folders inside src folder * Add DeviceInfoService implementation * Remove dependency on BouncyCastle, and calculate key derivation using native support * changes requested by project maintener * Fix HasCamera property * DeviceActionService implementation
This commit is contained in:
committed by
Kyle Spearrin
parent
5501ab9083
commit
d651606800
43
src/UWP/Services/DeviceInfoService.cs
Normal file
43
src/UWP/Services/DeviceInfoService.cs
Normal file
@@ -0,0 +1,43 @@
|
||||
using Bit.App.Abstractions;
|
||||
using Microsoft.Toolkit.Uwp.Helpers;
|
||||
using System;
|
||||
using System.Collections.Generic;
|
||||
using System.Linq;
|
||||
using System.Text;
|
||||
using System.Threading.Tasks;
|
||||
using Windows.Graphics.Display;
|
||||
using Windows.Devices.SmartCards;
|
||||
using Windows.Devices.Enumeration;
|
||||
|
||||
namespace Bit.UWP.Services
|
||||
{
|
||||
public class DeviceInfoService : IDeviceInfoService
|
||||
{
|
||||
public string Model => SystemInformation.DeviceModel;
|
||||
|
||||
public int Version => SystemInformation.OperatingSystemVersion.Build;
|
||||
|
||||
public float Scale => (float)DisplayInformation.GetForCurrentView().RawPixelsPerViewPixel;
|
||||
|
||||
public bool NfcEnabled
|
||||
{
|
||||
get
|
||||
{
|
||||
if (!Windows.Foundation.Metadata.ApiInformation.IsTypePresent("Windows.Devices.SmartCards.SmartCardEmulator"))
|
||||
return false;
|
||||
|
||||
return Task.Run(async () => await SmartCardEmulator.GetDefaultAsync()).Result != null;
|
||||
}
|
||||
}
|
||||
|
||||
public bool HasCamera
|
||||
{
|
||||
get
|
||||
{
|
||||
var cameraList = Task.Run(async () => await DeviceInformation.FindAllAsync(DeviceClass.VideoCapture)).Result;
|
||||
|
||||
return cameraList?.Any() ?? false;
|
||||
}
|
||||
}
|
||||
}
|
||||
}
|
||||
Reference in New Issue
Block a user