commit
24ec5cd667
2 changed files with 23 additions and 14 deletions
|
@ -82,12 +82,21 @@ class FileList extends React.PureComponent<Props, State> {
|
||||||
: fileInfos,
|
: fileInfos,
|
||||||
title: fileInfos =>
|
title: fileInfos =>
|
||||||
fileInfos.slice().sort((fileInfo1, fileInfo2) => {
|
fileInfos.slice().sort((fileInfo1, fileInfo2) => {
|
||||||
const title1 = fileInfo1.value
|
const getFileTitle = fileInfo => {
|
||||||
? fileInfo1.value.stream.metadata.title.toLowerCase()
|
const { value, metadata, name, claim_name: claimName } = fileInfo;
|
||||||
: fileInfo1.claim_name;
|
if (metadata) {
|
||||||
const title2 = fileInfo2.value
|
// downloaded claim
|
||||||
? fileInfo2.value.stream.metadata.title.toLowerCase()
|
return metadata.title || claimName;
|
||||||
: fileInfo2.claim_name;
|
} 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) {
|
if (title1 < title2) {
|
||||||
return -1;
|
return -1;
|
||||||
} else if (title1 > title2) {
|
} else if (title1 > title2) {
|
||||||
|
|
|
@ -66,6 +66,14 @@ Lbry.connect = () => {
|
||||||
|
|
||||||
Lbry.imagePath = file => `${staticResourcesPath}/img/${file}`;
|
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) => {
|
Lbry.getMediaType = (contentType, fileName) => {
|
||||||
if (contentType) {
|
if (contentType) {
|
||||||
return /^[^/]+/.exec(contentType)[0];
|
return /^[^/]+/.exec(contentType)[0];
|
||||||
|
@ -88,14 +96,6 @@ Lbry.getMediaType = (contentType, fileName) => {
|
||||||
return 'unknown';
|
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,
|
* 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.
|
* these are designed to be transparent wrappers around the corresponding API methods.
|
||||||
|
|
Loading…
Reference in a new issue