Add Upload All button to UploadConfirmDialog
Signed-off-by: Michael Telatynski <7t3chguy@gmail.com>
This commit is contained in:
parent
4ce72fdffa
commit
2fc2e32e60
3 changed files with 31 additions and 11 deletions
|
@ -425,19 +425,25 @@ export default class ContentMessages {
|
||||||
}
|
}
|
||||||
|
|
||||||
const UploadConfirmDialog = sdk.getComponent("dialogs.UploadConfirmDialog");
|
const UploadConfirmDialog = sdk.getComponent("dialogs.UploadConfirmDialog");
|
||||||
|
let uploadAll = false;
|
||||||
for (let i = 0; i < okFiles.length; ++i) {
|
for (let i = 0; i < okFiles.length; ++i) {
|
||||||
const file = okFiles[i];
|
const file = okFiles[i];
|
||||||
const shouldContinue = await new Promise((resolve) => {
|
if (!uploadAll) {
|
||||||
Modal.createTrackedDialog('Upload Files confirmation', '', UploadConfirmDialog, {
|
const shouldContinue = await new Promise((resolve) => {
|
||||||
file,
|
Modal.createTrackedDialog('Upload Files confirmation', '', UploadConfirmDialog, {
|
||||||
currentIndex: i,
|
file,
|
||||||
totalFiles: okFiles.length,
|
currentIndex: i,
|
||||||
onFinished: (shouldContinue) => {
|
totalFiles: okFiles.length,
|
||||||
resolve(shouldContinue);
|
onFinished: (shouldContinue, shouldUploadAll) => {
|
||||||
},
|
if (shouldUploadAll) {
|
||||||
|
uploadAll = true;
|
||||||
|
}
|
||||||
|
resolve(shouldContinue);
|
||||||
|
},
|
||||||
|
});
|
||||||
});
|
});
|
||||||
});
|
if (!shouldContinue) break;
|
||||||
if (!shouldContinue) break;
|
}
|
||||||
this._sendContentToRoom(file, roomId, matrixClient);
|
this._sendContentToRoom(file, roomId, matrixClient);
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
|
@ -49,6 +49,10 @@ export default class UploadConfirmDialog extends React.Component {
|
||||||
this.props.onFinished(true);
|
this.props.onFinished(true);
|
||||||
}
|
}
|
||||||
|
|
||||||
|
_onUploadAllClick = () => {
|
||||||
|
this.props.onFinished(true, true);
|
||||||
|
}
|
||||||
|
|
||||||
render() {
|
render() {
|
||||||
const BaseDialog = sdk.getComponent('views.dialogs.BaseDialog');
|
const BaseDialog = sdk.getComponent('views.dialogs.BaseDialog');
|
||||||
const DialogButtons = sdk.getComponent('views.elements.DialogButtons');
|
const DialogButtons = sdk.getComponent('views.elements.DialogButtons');
|
||||||
|
@ -85,6 +89,13 @@ export default class UploadConfirmDialog extends React.Component {
|
||||||
</div>;
|
</div>;
|
||||||
}
|
}
|
||||||
|
|
||||||
|
let uploadAllButton;
|
||||||
|
if (this.props.currentIndex + 1 < this.props.totalFiles) {
|
||||||
|
uploadAllButton = <button onClick={this._onUploadAllClick}>
|
||||||
|
{_t("Upload all")}
|
||||||
|
</button>;
|
||||||
|
}
|
||||||
|
|
||||||
return (
|
return (
|
||||||
<BaseDialog className='mx_UploadConfirmDialog'
|
<BaseDialog className='mx_UploadConfirmDialog'
|
||||||
fixedWidth={false}
|
fixedWidth={false}
|
||||||
|
@ -100,7 +111,9 @@ export default class UploadConfirmDialog extends React.Component {
|
||||||
hasCancel={false}
|
hasCancel={false}
|
||||||
onPrimaryButtonClick={this._onUploadClick}
|
onPrimaryButtonClick={this._onUploadClick}
|
||||||
focus={true}
|
focus={true}
|
||||||
/>
|
>
|
||||||
|
{uploadAllButton}
|
||||||
|
</DialogButtons>
|
||||||
</BaseDialog>
|
</BaseDialog>
|
||||||
);
|
);
|
||||||
}
|
}
|
||||||
|
|
|
@ -1249,6 +1249,7 @@
|
||||||
"Upload files (%(current)s of %(total)s)": "Upload files (%(current)s of %(total)s)",
|
"Upload files (%(current)s of %(total)s)": "Upload files (%(current)s of %(total)s)",
|
||||||
"Upload files": "Upload files",
|
"Upload files": "Upload files",
|
||||||
"Upload": "Upload",
|
"Upload": "Upload",
|
||||||
|
"Upload all": "Upload all",
|
||||||
"This file is <b>too large</b> to upload. The file size limit is %(limit)s but this file is %(sizeOfThisFile)s.": "This file is <b>too large</b> to upload. The file size limit is %(limit)s but this file is %(sizeOfThisFile)s.",
|
"This file is <b>too large</b> to upload. The file size limit is %(limit)s but this file is %(sizeOfThisFile)s.": "This file is <b>too large</b> to upload. The file size limit is %(limit)s but this file is %(sizeOfThisFile)s.",
|
||||||
"These files are <b>too large</b> to upload. The file size limit is %(limit)s.": "These files are <b>too large</b> to upload. The file size limit is %(limit)s.",
|
"These files are <b>too large</b> to upload. The file size limit is %(limit)s.": "These files are <b>too large</b> to upload. The file size limit is %(limit)s.",
|
||||||
"Some files are <b>too large</b> to be uploaded. The file size limit is %(limit)s.": "Some files are <b>too large</b> to be uploaded. The file size limit is %(limit)s.",
|
"Some files are <b>too large</b> to be uploaded. The file size limit is %(limit)s.": "Some files are <b>too large</b> to be uploaded. The file size limit is %(limit)s.",
|
||||||
|
|
Loading…
Add table
Add a link
Reference in a new issue