_list calls accept resolve param

This commit is contained in:
jessop 2020-02-10 18:27:29 -05:00
parent a640c5cb0b
commit bc52d7af10
2 changed files with 9 additions and 11 deletions

11
dist/bundle.es.js vendored
View file

@ -865,7 +865,7 @@ const Lbry = {
// Returns a human readable media type based on the content type or extension of a file that is returned by the sdk
getMediaType: (contentType, fileName) => {
if (fileName) {
const formats = [[/\.(mp4|m4v|webm|flv|f4v|ogv)$/i, 'video'], [/\.(mp3|m4a|aac|wav|flac|ogg|opus)$/i, 'audio'], [/\.(jpeg|jpg|png|gif|svg)$/i, 'image'], [/\.(h|go|ja|java|js|jsx|c|cpp|cs|css|rb|scss|sh|php|py)$/i, 'script'], [/\.(json|csv|txt|log|md|markdown|docx|pdf|xml|yml|yaml)$/i, 'document'], [/\.(pdf|odf|doc|docx|epub|org|rtf)$/i, 'e-book'], [/\.(stl|obj|fbx|gcode)$/i, '3D-file'], [/\.(cbr|cbt|cbz)$/i, 'comic-book'], [/\.(lbry)$/i, 'application']];
const formats = [[/\.(mp4|m4v|webm|flv|f4v|ogv)$/i, 'video'], [/\.(mp3|m4a|aac|wav|flac|ogg|opus)$/i, 'audio'], [/\.(jpeg|jpg|png|gif|svg)$/i, 'image'], [/\.(h|go|ja|java|js|jsx|c|cpp|cs|css|rb|scss|sh|php|py)$/i, 'script'], [/\.(html|json|csv|txt|log|md|markdown|docx|pdf|xml|yml|yaml)$/i, 'document'], [/\.(pdf|odf|doc|docx|epub|org|rtf)$/i, 'e-book'], [/\.(stl|obj|fbx|gcode)$/i, '3D-file'], [/\.(cbr|cbt|cbz)$/i, 'comic-book'], [/\.(lbry)$/i, 'application']];
const res = formats.reduce((ret, testpair) => {
switch (testpair[0].test(ret)) {
@ -2797,7 +2797,6 @@ function batchActions(...actions) {
}
var _extends$5 = Object.assign || function (target) { for (var i = 1; i < arguments.length; i++) { var source = arguments[i]; for (var key in source) { if (Object.prototype.hasOwnProperty.call(source, key)) { target[key] = source[key]; } } } return target; };
function doResolveUris(uris, returnCachedClaims = false) {
return (dispatch, getState) => {
const normalizedUris = uris.map(normalizeURI);
@ -2868,13 +2867,13 @@ function doResolveUri(uri) {
return doResolveUris([uri]);
}
function doFetchClaimListMine(page = 1, pageSize = 99999) {
function doFetchClaimListMine(page = 1, pageSize = 99999, resolve) {
return dispatch => {
dispatch({
type: FETCH_CLAIM_LIST_MINE_STARTED
});
lbryProxy.stream_list({ page, page_size: pageSize }).then(result => {
lbryProxy.stream_list({ page, page_size: pageSize, resolve }).then(result => {
const claims = result.items;
dispatch({
@ -3129,7 +3128,7 @@ function doImportChannel(certificate) {
};
}
function doFetchChannelListMine(page = 1, pageSize = 99999) {
function doFetchChannelListMine(page = 1, pageSize = 99999, resolve) {
return dispatch => {
dispatch({
type: FETCH_CHANNEL_LIST_STARTED
@ -3142,7 +3141,7 @@ function doFetchChannelListMine(page = 1, pageSize = 99999) {
});
};
lbryProxy.channel_list({ page, page_size: pageSize }).then(callback);
lbryProxy.channel_list({ page, page_size: pageSize, resolve }).then(callback);
};
}

View file

@ -14,7 +14,6 @@ import { selectSupportsByOutpoint } from 'redux/selectors/wallet';
import { creditsToString } from 'util/format-credits';
import { batchActions } from 'util/batch-actions';
import { createNormalizedClaimSearchKey } from 'util/claim';
export function doResolveUris(uris: Array<string>, returnCachedClaims: boolean = false) {
return (dispatch: Dispatch, getState: GetState) => {
const normalizedUris = uris.map(normalizeURI);
@ -94,13 +93,13 @@ export function doResolveUri(uri: string) {
return doResolveUris([uri]);
}
export function doFetchClaimListMine(page: number = 1, pageSize: number = 99999) {
export function doFetchClaimListMine(page: number = 1, pageSize: number = 99999, resolve: true) {
return (dispatch: Dispatch) => {
dispatch({
type: ACTIONS.FETCH_CLAIM_LIST_MINE_STARTED,
});
Lbry.stream_list({ page, page_size: pageSize }).then((result: StreamListResponse) => {
Lbry.stream_list({ page, page_size: pageSize, resolve }).then((result: StreamListResponse) => {
const claims = result.items;
dispatch({
@ -383,7 +382,7 @@ export function doImportChannel(certificate: string) {
};
}
export function doFetchChannelListMine(page: number = 1, pageSize: number = 99999) {
export function doFetchChannelListMine(page: number = 1, pageSize: number = 99999, resolve: true) {
return (dispatch: Dispatch) => {
dispatch({
type: ACTIONS.FETCH_CHANNEL_LIST_STARTED,
@ -396,7 +395,7 @@ export function doFetchChannelListMine(page: number = 1, pageSize: number = 9999
});
};
Lbry.channel_list({ page, page_size: pageSize }).then(callback);
Lbry.channel_list({ page, page_size: pageSize, resolve }).then(callback);
};
}