Add Support for Device Generator for Open Actions ...
This commit is contained in:
@@ -1,6 +1,7 @@
|
||||
using System;
|
||||
using System.Collections.Generic;
|
||||
using System.Linq;
|
||||
using System.Runtime.InteropServices;
|
||||
using System.Threading.Tasks;
|
||||
using MongoDB.Bson;
|
||||
using xCommons.Constants;
|
||||
@@ -15,6 +16,55 @@ namespace xIdentityService.Providers
|
||||
{
|
||||
public partial class XIdentityProvider
|
||||
{
|
||||
/// <summary>
|
||||
/// Prepare API Based Device to Open Actions ...
|
||||
/// </summary>
|
||||
/// <returns></returns>
|
||||
public async Task<XDeviceDto> GetDevice()
|
||||
{
|
||||
//
|
||||
var os = "XSaherElmOS";
|
||||
bool isOSX = RuntimeInformation.IsOSPlatform(OSPlatform.OSX);
|
||||
bool isLinux = RuntimeInformation.IsOSPlatform(OSPlatform.Linux);
|
||||
bool isWindows = RuntimeInformation.IsOSPlatform(OSPlatform.Windows);
|
||||
if (isOSX)
|
||||
{
|
||||
os = "MacOs";
|
||||
}
|
||||
else if (isLinux)
|
||||
{
|
||||
os = "Linux";
|
||||
}
|
||||
else if (isWindows)
|
||||
{
|
||||
os = "Windows";
|
||||
}
|
||||
var agent = RuntimeInformation.FrameworkDescription;
|
||||
if (agent.IsNullOrEmpty())
|
||||
{
|
||||
agent = "XSaherElmOSAgent";
|
||||
}
|
||||
var version = RuntimeInformation.OSArchitecture + ", " + RuntimeInformation.OSDescription;
|
||||
if (version.IsNullOrEmpty())
|
||||
{
|
||||
version = "XSaherElmOSVersion";
|
||||
}
|
||||
var browser = "XSaherElmBrowser_" + RevisionSecretKey.ToMd5String();
|
||||
|
||||
//
|
||||
var result = new XDeviceDto
|
||||
{
|
||||
Os = os,
|
||||
Browser = browser,
|
||||
UserAgent = agent,
|
||||
OsVersion = version,
|
||||
DeviceType = XDeviceType.Desktop,
|
||||
};
|
||||
|
||||
//
|
||||
return result;
|
||||
}
|
||||
|
||||
//
|
||||
#region OpenGet ...
|
||||
public async Task<XOpenActionInnerDto> OpenGet(
|
||||
|
||||
Reference in New Issue
Block a user