Files
Backend-Api/ServiceHost/Pages/Apk/AndroidApk.cs

23 lines
920 B
C#

using CompanyManagment.App.Contracts.AndroidApkVersion;
using Microsoft.AspNetCore.Mvc;
namespace ServiceHost.Pages.Apk;
public class AndroidApk : Controller
{
private readonly IAndroidApkVersionApplication _androidApkVersionApplication;
public AndroidApk(IAndroidApkVersionApplication androidApkVersionApplication)
{
_androidApkVersionApplication = androidApkVersionApplication;
}
[Route("Apk/Android")]
public async Task<IActionResult> Index([FromQuery] string type = "WebView")
{
ApkType apkType = type.ToLower() == "facedetection" ? ApkType.FaceDetection : ApkType.WebView;
var path = await _androidApkVersionApplication.GetLatestActiveVersionPath(apkType);
var fileName = apkType == ApkType.WebView ? "Gozareshgir.apk" : "Gozareshgir-FaceDetection.apk";
return PhysicalFile(path,"application/vnd.android.package-archive", fileName);
}
}