forked from microsoft/react-native-code-push
-
Notifications
You must be signed in to change notification settings - Fork 0
Expand file tree
/
Copy pathCodePushDownloadHandler.h
More file actions
32 lines (26 loc) · 890 Bytes
/
CodePushDownloadHandler.h
File metadata and controls
32 lines (26 loc) · 890 Bytes
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
// Copyright (c) Microsoft Corporation.
// Licensed under the MIT License.
#pragma once
#include "winrt/Windows.Storage.h"
#include "winrt/Windows.Foundation.h"
#include "winrt/Windows.Data.Json.h"
#include <string_view>
#include <functional>
namespace Microsoft::CodePush::ReactNative
{
struct CodePushDownloadHandler
{
winrt::Windows::Storage::StorageFile downloadFile;
int64_t expectedContentLength;
int64_t receivedContentLength;
std::function<void(int64_t, int64_t)> progressCallback;
std::wstring_view downloadUrl;
CodePushDownloadHandler(
winrt::Windows::Storage::StorageFile downloadFile,
std::function<void(int64_t, int64_t)> progressCallback);
// Returns true if the downloaded file is a zip file
winrt::Windows::Foundation::IAsyncOperation<bool> Download(std::wstring_view url);
private:
static constexpr uint32_t BufferSize{ 256 * 1024 };
};
}