1.3.6-4 Test Build - Add average upload for local upload.
This commit is contained in:
@@ -1,4 +1,5 @@
|
||||
import * as MediaLibrary from "expo-media-library";
|
||||
import { DateTime } from "luxon";
|
||||
import React, { useEffect, useState } from "react";
|
||||
import { useTranslation } from "react-i18next";
|
||||
import {
|
||||
@@ -71,11 +72,7 @@ export function UploadProgress({
|
||||
});
|
||||
|
||||
logImEXEvent("imexmobile_successful_upload");
|
||||
setProgress({
|
||||
speed: 0,
|
||||
percent: 1,
|
||||
uploadInProgress: false,
|
||||
});
|
||||
setProgress({ ...progress, speed: 0, percent: 1, uploadInProgress: false });
|
||||
}
|
||||
|
||||
function handleOnProgress({ percent, loaded }) {
|
||||
@@ -103,6 +100,8 @@ export function UploadProgress({
|
||||
percent: 0,
|
||||
loaded: 0,
|
||||
uploadInProgress: true,
|
||||
start: new Date(),
|
||||
average: 0,
|
||||
});
|
||||
|
||||
await handleLocalUpload({
|
||||
@@ -144,6 +143,7 @@ export function UploadProgress({
|
||||
forceRerender();
|
||||
};
|
||||
|
||||
console.log(progress);
|
||||
return (
|
||||
<Modal
|
||||
visible={progress.uploadInProgress}
|
||||
@@ -173,6 +173,18 @@ export function UploadProgress({
|
||||
<Text style={{ alignSelf: "center", marginTop: 16 }}>{`${formatBytes(
|
||||
progress.speed
|
||||
)}/sec`}</Text>
|
||||
<Text
|
||||
style={{ alignSelf: "center", marginTop: 16 }}
|
||||
>{`Avg. ${formatBytes(
|
||||
progress.loaded / ((new Date() - progress.start) / 1000)
|
||||
)}/sec`}</Text>
|
||||
<Text
|
||||
style={{ alignSelf: "center", marginTop: 16 }}
|
||||
>{`Total Uploaded ${formatBytes(progress.loaded)}/sec`}</Text>
|
||||
<Text style={{ alignSelf: "center", marginTop: 16 }}>{`Duration ${(
|
||||
(new Date() - progress.start) /
|
||||
1000
|
||||
).toFixed(1)} sec`}</Text>
|
||||
</View>
|
||||
</View>
|
||||
</Modal>
|
||||
|
||||
Reference in New Issue
Block a user