Hook up the android kotlin code to the send js code (#860)
This commit is contained in:
parent
5c7b4ace9a
commit
a80d007e0c
16 changed files with 317 additions and 222 deletions
|
@ -137,7 +137,12 @@ async function upload(
|
|||
const host = window.location.hostname;
|
||||
const port = window.location.port;
|
||||
const protocol = window.location.protocol === 'https:' ? 'wss:' : 'ws:';
|
||||
const ws = await asyncInitWebSocket(`${protocol}//${host}:${port}/api/ws`);
|
||||
const endpoint =
|
||||
window.location.protocol === 'file:'
|
||||
? 'wss://send2.dev.lcip.org/api/ws'
|
||||
: `${protocol}//${host}:${port}/api/ws`;
|
||||
|
||||
const ws = await asyncInitWebSocket(endpoint);
|
||||
|
||||
try {
|
||||
const metadataHeader = arrayToB64(new Uint8Array(metadata));
|
||||
|
|
|
@ -108,8 +108,10 @@ export default function(state, emitter) {
|
|||
if (cancelBtn) {
|
||||
cancelBtn.hidden = 'hidden';
|
||||
}
|
||||
await delay(1000);
|
||||
await fadeOut('.page');
|
||||
if (document.querySelector('.page')) {
|
||||
await delay(1000);
|
||||
await fadeOut('.page');
|
||||
}
|
||||
emitter.emit('pushState', `/share/${ownedFile.id}`);
|
||||
} catch (err) {
|
||||
if (err.message === '0') {
|
||||
|
@ -180,8 +182,10 @@ export default function(state, emitter) {
|
|||
await dl;
|
||||
const time = Date.now() - start;
|
||||
const speed = size / (time / 1000);
|
||||
await delay(1000);
|
||||
await fadeOut('.page');
|
||||
if (document.querySelector('.page')) {
|
||||
await delay(1000);
|
||||
await fadeOut('.page');
|
||||
}
|
||||
state.storage.totalDownloads += 1;
|
||||
state.transfer.reset();
|
||||
metrics.completedDownload({ size, time, speed });
|
||||
|
|
Loading…
Add table
Add a link
Reference in a new issue