using System.Application.Models;
namespace System.Application.Services
{
///
/// 应用程序更新服务
///
public interface IAppUpdateService
{
public static IAppUpdateService Instance => DI.Get();
public const float MaxProgressValue = 100f;
///
/// 当前进度值
///
float CurrentProgressValue { get; }
///
/// 总进度值
///
float TotalProgressValue { get; }
///
/// 是否支持服务端分发,如果返回 将不能使用 DownloadAsync 与 OverwriteUpgradeAsync
/// 对于 iOS 平台,必须使用 App Store 分发
///
bool IsSupportedServerDistribution { get; }
///
/// 是否有更新
///
bool IsExistUpdate { get; }
///
/// 新版本信息
///
AppVersionDTO? NewVersionInfo { get; }
///
/// 检查更新,返回新版本信息
///
///
void CheckUpdate();
}
#if DEBUG
[Obsolete("use IAppUpdateService.Instance", true)]
public class AutoUpdateService
{
[Obsolete("use IAppUpdateService.Instance.CheckAsync", true)]
public void CheckUpdate() => throw new NotImplementedException();
[Obsolete("use IAppUpdateService.Instance.DownloadAsync", true)]
public void DownloadUpdate() => throw new NotImplementedException();
[Obsolete("use IAppUpdateService.Instance.OverwriteUpgradeAsync", true)]
public void OverwriteUpgrade(string zipFile) => throw new NotImplementedException();
[Obsolete("use IAppUpdateService.Instance.NewVersionInfo", true)]
public object? UpdateInfo { get; set; }
}
#endif
}