private async Task <DownloadVersion> CheckWebForNewVersionAsync(Uri updateWebpageUrl, string cultureName)
        {
            Version newVersion = DownloadVersion.VersionUnknown;

            try
            {
                ClientPlatformKind platform = ClientPlatformKind.WindowsDesktop;
                switch (OS.Current.Platform)
                {
                case Runtime.Platform.WindowsDesktop:
                    platform = ClientPlatformKind.WindowsDesktop;
                    break;

                case Runtime.Platform.MacOsx:
                    platform = ClientPlatformKind.Mac;
                    break;

                default:
                    throw new NotSupportedException($"App doesn't support updating on {OS.Current.Platform} platform");
                }

                AxCryptVersion axCryptVersion = await New <AxCryptApiClient>().AxCryptUpdateAsync(_currentVersion, cultureName, platform).Free();

                if (!axCryptVersion.IsEmpty)
                {
                    if (Resolve.Log.IsInfoEnabled)
                    {
                        Resolve.Log.LogInfo("Update check reports most recent version {0} at web page {1}".InvariantFormat(newVersion, updateWebpageUrl));
                    }
                }

                return(axCryptVersion.DownloadVersion);
            }
            catch (ApiException aex)
            {
                await aex.HandleApiExceptionAsync();
            }
            catch (Exception ex)
            {
                New <IReport>().Exception(ex);
                if (Resolve.Log.IsWarningEnabled)
                {
                    Resolve.Log.LogWarning("Failed call to check for new version with exception {0}.".InvariantFormat(ex));
                }
            }
            return(new DownloadVersion(updateWebpageUrl, DownloadVersion.VersionUnknown));
        }
        public async Task <AxCryptVersion> AxCryptUpdateAsync(Version currentVersion, string cultureName, ClientPlatformKind platform)
        {
            string platformParameter = string.Empty;

            switch (platform)
            {
            case ClientPlatformKind.WindowsDesktop:
                platformParameter = "windowsdesktop";
                break;

            case ClientPlatformKind.Mac:
                platformParameter = "mac";
                break;

            default:
                throw new NotSupportedException($"App doesn't support updating on {platform} platform");
            }

            Uri resource;

            if (Identity.IsEmpty)
            {
                resource = BaseUrl.PathCombine($"global/axcrypt/version/{platformParameter}?version={currentVersion?.ToString() ?? string.Empty}");
            }
            else
            {
                resource = BaseUrl.PathCombine($"users/axcrypt/version/{platformParameter}?version={currentVersion?.ToString() ?? string.Empty}&culture={cultureName}");
            }

            if (New <AxCryptOnlineState>().IsOffline)
            {
                return(AxCryptVersion.Empty);
            }

            RestResponse restResponse = await Caller.RestAsync(Identity, new RestRequest(resource, Timeout)).Free();

            ApiCaller.EnsureStatusOk(restResponse);
            AxCryptVersion axCryptVersion = Serializer.Deserialize <AxCryptVersion>(restResponse.Content);

            return(axCryptVersion);
        }