commit
24ec5cd667
2 changed files with 23 additions and 14 deletions
|
@ -82,12 +82,21 @@ class FileList extends React.PureComponent<Props, State> {
|
|||
: fileInfos,
|
||||
title: fileInfos =>
|
||||
fileInfos.slice().sort((fileInfo1, fileInfo2) => {
|
||||
const title1 = fileInfo1.value
|
||||
? fileInfo1.value.stream.metadata.title.toLowerCase()
|
||||
: fileInfo1.claim_name;
|
||||
const title2 = fileInfo2.value
|
||||
? fileInfo2.value.stream.metadata.title.toLowerCase()
|
||||
: fileInfo2.claim_name;
|
||||
const getFileTitle = fileInfo => {
|
||||
const { value, metadata, name, claim_name: claimName } = fileInfo;
|
||||
if (metadata) {
|
||||
// downloaded claim
|
||||
return metadata.title || claimName;
|
||||
} else if (value) {
|
||||
// published claim
|
||||
const { title } = value.stream.metadata;
|
||||
return title || name;
|
||||
}
|
||||
// Invalid claim
|
||||
return '';
|
||||
};
|
||||
const title1 = getFileTitle(fileInfo1).toLowerCase();
|
||||
const title2 = getFileTitle(fileInfo2).toLowerCase();
|
||||
if (title1 < title2) {
|
||||
return -1;
|
||||
} else if (title1 > title2) {
|
||||
|
|
|
@ -66,6 +66,14 @@ Lbry.connect = () => {
|
|||
|
||||
Lbry.imagePath = file => `${staticResourcesPath}/img/${file}`;
|
||||
|
||||
Lbry.getAppVersionInfo = () =>
|
||||
new Promise(resolve => {
|
||||
ipcRenderer.once('version-info-received', (event, versionInfo) => {
|
||||
resolve(versionInfo);
|
||||
});
|
||||
ipcRenderer.send('version-info-requested');
|
||||
});
|
||||
|
||||
Lbry.getMediaType = (contentType, fileName) => {
|
||||
if (contentType) {
|
||||
return /^[^/]+/.exec(contentType)[0];
|
||||
|
@ -88,14 +96,6 @@ Lbry.getMediaType = (contentType, fileName) => {
|
|||
return 'unknown';
|
||||
};
|
||||
|
||||
Lbry.getAppVersionInfo = () =>
|
||||
new Promise(resolve => {
|
||||
ipcRenderer.once('version-info-received', (event, versionInfo) => {
|
||||
resolve(versionInfo);
|
||||
});
|
||||
ipcRenderer.send('version-info-requested');
|
||||
});
|
||||
|
||||
/**
|
||||
* Wrappers for API methods to simulate missing or future behavior. Unlike the old-style stubs,
|
||||
* these are designed to be transparent wrappers around the corresponding API methods.
|
||||
|
|
Loading…
Reference in a new issue