1
0
mirror of https://github.com/bitwarden/mobile synced 2025-12-12 06:13:21 +00:00

device user agent

This commit is contained in:
Kyle Spearrin
2019-09-04 11:52:32 -04:00
parent bdad5e4f0a
commit 2507f3301b
9 changed files with 53 additions and 17 deletions

View File

@@ -26,6 +26,7 @@ namespace Bit.iOS.Core.Services
private readonly IMessagingService _messagingService;
private Toast _toast;
private UIAlertController _progressAlert;
private string _userAgent;
public DeviceActionService(
IStorageService storageService,
@@ -35,6 +36,19 @@ namespace Bit.iOS.Core.Services
_messagingService = messagingService;
}
public string DeviceUserAgent
{
get
{
if(string.IsNullOrWhiteSpace(_userAgent))
{
_userAgent = $"Bitwarden_Mobile/{Xamarin.Essentials.AppInfo.VersionString} " +
$"(iOS {UIDevice.CurrentDevice.SystemVersion}; Model {UIDevice.CurrentDevice.Model})";
}
return _userAgent;
}
}
public DeviceType DeviceType => DeviceType.iOS;
public bool LaunchApp(string appName)
@@ -261,7 +275,7 @@ namespace Bit.iOS.Core.Services
public int SystemMajorVersion()
{
var versionParts = UIDevice.CurrentDevice.SystemVersion.Split('.');
if(versionParts.Length > 0 && int.TryParse(versionParts[0], out int version))
if(versionParts.Length > 0 && int.TryParse(versionParts[0], out var version))
{
return version;
}