commit
b483722ced
14 changed files with 187 additions and 76 deletions
58
dist/bundle.es.js
vendored
58
dist/bundle.es.js
vendored
|
@ -775,6 +775,7 @@ const Lbry = {
|
|||
stream_list: params => daemonCallWithResult('stream_list', params),
|
||||
channel_abandon: params => daemonCallWithResult('channel_abandon', params),
|
||||
support_create: params => daemonCallWithResult('support_create', params),
|
||||
support_list: params => daemonCallWithResult('support_list', params),
|
||||
|
||||
// File fetching and manipulation
|
||||
file_list: (params = {}) => daemonCallWithResult('file_list', params),
|
||||
|
@ -2193,7 +2194,7 @@ function doUpdateBalance() {
|
|||
} = getState();
|
||||
|
||||
if (walletBalancePromise === null) {
|
||||
walletBalancePromise = lbryProxy.wallet_balance({ reserved_subtotals: true }).then(response => {
|
||||
walletBalancePromise = lbryProxy.wallet_balance().then(response => {
|
||||
walletBalancePromise = null;
|
||||
|
||||
const { available, reserved, reserved_subtotals, total } = response;
|
||||
|
@ -2245,17 +2246,17 @@ function doFetchTransactions(page = 1, pageSize = 99999) {
|
|||
};
|
||||
}
|
||||
|
||||
function doFetchSupports() {
|
||||
function doFetchSupports(page = 1, pageSize = 99999) {
|
||||
return dispatch => {
|
||||
dispatch({
|
||||
type: FETCH_SUPPORTS_STARTED
|
||||
});
|
||||
|
||||
lbryProxy.support_list().then(results => {
|
||||
lbryProxy.support_list({ page, page_size: pageSize }).then(result => {
|
||||
dispatch({
|
||||
type: FETCH_SUPPORTS_COMPLETED,
|
||||
data: {
|
||||
supports: results
|
||||
supports: result.items
|
||||
}
|
||||
});
|
||||
});
|
||||
|
@ -2614,13 +2615,13 @@ function doResolveUri(uri) {
|
|||
return doResolveUris([uri]);
|
||||
}
|
||||
|
||||
function doFetchClaimListMine(page = 1, pageSize = 9999) {
|
||||
function doFetchClaimListMine(page = 1, pageSize = 99999) {
|
||||
return dispatch => {
|
||||
dispatch({
|
||||
type: FETCH_CLAIM_LIST_MINE_STARTED
|
||||
});
|
||||
|
||||
lbryProxy.claim_list({ page, page_size: pageSize }).then(result => {
|
||||
lbryProxy.stream_list({ page, page_size: pageSize }).then(result => {
|
||||
const claims = result.items;
|
||||
|
||||
dispatch({
|
||||
|
@ -2874,20 +2875,20 @@ function doImportChannel(certificate) {
|
|||
};
|
||||
}
|
||||
|
||||
function doFetchChannelListMine() {
|
||||
function doFetchChannelListMine(page = 1, pageSize = 99999) {
|
||||
return dispatch => {
|
||||
dispatch({
|
||||
type: FETCH_CHANNEL_LIST_STARTED
|
||||
});
|
||||
|
||||
const callback = channels => {
|
||||
const callback = response => {
|
||||
dispatch({
|
||||
type: FETCH_CHANNEL_LIST_COMPLETED,
|
||||
data: { claims: channels }
|
||||
data: { claims: response.items }
|
||||
});
|
||||
};
|
||||
|
||||
lbryProxy.channel_list().then(callback);
|
||||
lbryProxy.channel_list({ page, page_size: pageSize }).then(callback);
|
||||
};
|
||||
}
|
||||
|
||||
|
@ -3016,7 +3017,7 @@ const selectFileListDownloadedSort = reselect.createSelector(selectState$3, stat
|
|||
|
||||
const selectDownloadedUris = reselect.createSelector(selectFileInfosDownloaded,
|
||||
// We should use permament_url but it doesn't exist in file_list
|
||||
info => info.slice().reverse().map(claim => `lbry://${claim.claim_name}#${claim.claim_id}`));
|
||||
info => info.slice().map(claim => `lbry://${claim.claim_name}#${claim.claim_id}`));
|
||||
|
||||
const makeSelectMediaTypeForUri = uri => reselect.createSelector(makeSelectFileInfoForUri(uri), makeSelectContentTypeForUri(uri), (fileInfo, contentType) => {
|
||||
if (!fileInfo && !contentType) {
|
||||
|
@ -3067,7 +3068,11 @@ const makeSelectSearchDownloadUrlsForPage = (query, page = 1) => reselect.create
|
|||
const start = (Number(page) - 1) * Number(PAGE_SIZE);
|
||||
const end = Number(page) * Number(PAGE_SIZE);
|
||||
|
||||
return matchingFileInfos && matchingFileInfos.length ? matchingFileInfos.slice(start, end).map(fileInfo => buildURI({ streamName: fileInfo.claim_name, channelName: fileInfo.channel_name, channelClaimId: fileInfo.channel_claim_id })) : [];
|
||||
return matchingFileInfos && matchingFileInfos.length ? matchingFileInfos.slice(start, end).map(fileInfo => buildURI({
|
||||
streamName: fileInfo.claim_name,
|
||||
channelName: fileInfo.channel_name,
|
||||
channelClaimId: fileInfo.channel_claim_id
|
||||
})) : [];
|
||||
});
|
||||
|
||||
const makeSelectSearchDownloadUrlsCount = query => reselect.createSelector(selectFileInfosDownloaded, fileInfos => {
|
||||
|
@ -3210,12 +3215,15 @@ function doFetchFileInfo(uri) {
|
|||
}
|
||||
});
|
||||
|
||||
lbryProxy.file_list({ outpoint, full_status: true }).then(fileInfos => {
|
||||
lbryProxy.file_list({ outpoint, full_status: true, page: 1, page_size: 1 }).then(result => {
|
||||
const { items: fileInfos } = result;
|
||||
const fileInfo = fileInfos[0];
|
||||
|
||||
dispatch({
|
||||
type: FETCH_FILE_INFO_COMPLETED,
|
||||
data: {
|
||||
outpoint,
|
||||
fileInfo: fileInfos && fileInfos.length ? fileInfos[0] : null
|
||||
fileInfo: fileInfo || null
|
||||
}
|
||||
});
|
||||
});
|
||||
|
@ -3223,7 +3231,7 @@ function doFetchFileInfo(uri) {
|
|||
};
|
||||
}
|
||||
|
||||
function doFileList() {
|
||||
function doFileList(page = 1, pageSize = 99999) {
|
||||
return (dispatch, getState) => {
|
||||
const state = getState();
|
||||
const isFetching = selectIsFetchingFileList(state);
|
||||
|
@ -3233,11 +3241,12 @@ function doFileList() {
|
|||
type: FILE_LIST_STARTED
|
||||
});
|
||||
|
||||
lbryProxy.file_list().then(fileInfos => {
|
||||
lbryProxy.file_list({ page, page_size: pageSize }).then(result => {
|
||||
const { items: fileInfos } = result;
|
||||
dispatch({
|
||||
type: FILE_LIST_SUCCEEDED,
|
||||
data: {
|
||||
fileInfos
|
||||
fileInfos: fileInfos.reverse()
|
||||
}
|
||||
});
|
||||
});
|
||||
|
@ -3889,7 +3898,7 @@ const doDeleteTag = name => ({
|
|||
|
||||
//
|
||||
|
||||
function doCommentList(uri) {
|
||||
function doCommentList(uri, page = 1, pageSize = 99999) {
|
||||
return (dispatch, getState) => {
|
||||
const state = getState();
|
||||
const claim = selectClaimsByUri(state)[uri];
|
||||
|
@ -3899,12 +3908,15 @@ function doCommentList(uri) {
|
|||
type: COMMENT_LIST_STARTED
|
||||
});
|
||||
lbryProxy.comment_list({
|
||||
claim_id: claimId
|
||||
}).then(results => {
|
||||
claim_id: claimId,
|
||||
page,
|
||||
page_size: pageSize
|
||||
}).then(result => {
|
||||
const { items: comments } = result;
|
||||
dispatch({
|
||||
type: COMMENT_LIST_COMPLETED,
|
||||
data: {
|
||||
comments: results,
|
||||
comments,
|
||||
claimId: claimId,
|
||||
uri: uri
|
||||
}
|
||||
|
@ -4387,8 +4399,8 @@ const commentReducer = handleActions({
|
|||
const byId = Object.assign({}, state.byId);
|
||||
const commentsByUri = Object.assign({}, state.commentsByUri);
|
||||
|
||||
if (comments['items']) {
|
||||
byId[claimId] = comments['items'];
|
||||
if (comments) {
|
||||
byId[claimId] = comments;
|
||||
commentsByUri[uri] = claimId;
|
||||
}
|
||||
return _extends$7({}, state, {
|
||||
|
|
1
dist/flow-typed/File.js
vendored
1
dist/flow-typed/File.js
vendored
|
@ -2,6 +2,7 @@
|
|||
|
||||
declare type FileListItem = {
|
||||
metadata: StreamMetadata,
|
||||
added_on: number,
|
||||
blobs_completed: number,
|
||||
blobs_in_stream: number,
|
||||
blobs_remaining: number,
|
||||
|
|
61
dist/flow-typed/Lbry.js
vendored
61
dist/flow-typed/Lbry.js
vendored
|
@ -108,6 +108,10 @@ declare type ClaimSearchResponse = {
|
|||
|
||||
declare type ClaimListResponse = {
|
||||
items: Array<ChannelClaim | Claim>,
|
||||
page: number,
|
||||
page_size: number,
|
||||
total_items: number,
|
||||
total_pages: number,
|
||||
};
|
||||
|
||||
declare type ChannelCreateResponse = GenericTxResponse & {
|
||||
|
@ -119,15 +123,47 @@ declare type ChannelUpdateResponse = GenericTxResponse & {
|
|||
};
|
||||
|
||||
declare type CommentCreateResponse = Comment;
|
||||
declare type CommentListResponse = Array<Comment>;
|
||||
declare type CommentListResponse = {
|
||||
items: Array<Comment>,
|
||||
page: number,
|
||||
page_size: number,
|
||||
total_items: number,
|
||||
total_pages: number,
|
||||
};
|
||||
|
||||
declare type ChannelListResponse = Array<ChannelClaim>;
|
||||
declare type ChannelListResponse = {
|
||||
items: Array<ChannelClaim>,
|
||||
page: number,
|
||||
page_size: number,
|
||||
total_items: number,
|
||||
total_pages: number,
|
||||
};
|
||||
|
||||
declare type FileListResponse = Array<FileListItem>;
|
||||
declare type FileListResponse = {
|
||||
items: Array<FileListItem>,
|
||||
page: number,
|
||||
page_size: number,
|
||||
total_items: number,
|
||||
total_pages: number,
|
||||
};
|
||||
|
||||
declare type TxListResponse = { items: Array<Transaction> };
|
||||
declare type TxListResponse = {
|
||||
items: Array<Transaction>,
|
||||
page: number,
|
||||
page_size: number,
|
||||
total_items: number,
|
||||
total_pages: number,
|
||||
};
|
||||
|
||||
declare type BlobListResponse = Array<string>;
|
||||
declare type SupportListResponse = {
|
||||
items: Array<Support>,
|
||||
page: number,
|
||||
page_size: number,
|
||||
total_items: number,
|
||||
total_pages: number,
|
||||
};
|
||||
|
||||
declare type BlobListResponse = { items: Array<string> };
|
||||
|
||||
declare type WalletListResponse = Array<{
|
||||
id: string,
|
||||
|
@ -146,7 +182,13 @@ declare type SyncApplyResponse = {
|
|||
|
||||
declare type SupportAbandonResponse = GenericTxResponse;
|
||||
|
||||
declare type StreamListResponse = { items: Array<StreamClaim> };
|
||||
declare type StreamListResponse = {
|
||||
items: Array<StreamClaim>,
|
||||
page: number,
|
||||
page_size: number,
|
||||
total_items: number,
|
||||
total_pages: number,
|
||||
};
|
||||
|
||||
//
|
||||
// Types used in the generic Lbry object that is exported
|
||||
|
@ -173,15 +215,17 @@ declare type LbryTypes = {
|
|||
publish: (params: {}) => Promise<PublishResponse>,
|
||||
|
||||
claim_search: (params: {}) => Promise<ClaimSearchResponse>,
|
||||
claim_list: (params?: {}) => Promise<ClaimListResponse>,
|
||||
claim_list: (params: {}) => Promise<ClaimListResponse>,
|
||||
channel_create: (params: {}) => Promise<ChannelCreateResponse>,
|
||||
channel_update: (params: {}) => Promise<ChannelUpdateResponse>,
|
||||
channel_import: (params: {}) => Promise<string>,
|
||||
channel_list: () => Promise<ChannelListResponse>,
|
||||
channel_list: (params: {}) => Promise<ChannelListResponse>,
|
||||
stream_abandon: (params: {}) => Promise<GenericTxResponse>,
|
||||
stream_list: (params: {}) => Promise<StreamListResponse>,
|
||||
channel_abandon: (params: {}) => Promise<GenericTxResponse>,
|
||||
support_create: (params: {}) => Promise<GenericTxResponse>,
|
||||
support_list: (params: {}) => Promise<SupportListResponse>,
|
||||
support_abandon: (params: {}) => Promise<SupportAbandonResponse>,
|
||||
|
||||
// File fetching and manipulation
|
||||
file_list: (params: {}) => Promise<FileListResponse>,
|
||||
|
@ -208,7 +252,6 @@ declare type LbryTypes = {
|
|||
address_unused: (params: {}) => Promise<string>, // New address
|
||||
address_list: (params: {}) => Promise<string>,
|
||||
transaction_list: (params: {}) => Promise<TxListResponse>,
|
||||
support_abandon: (params: {}) => Promise<SupportAbandonResponse>,
|
||||
|
||||
// Sync
|
||||
sync_hash: (params: {}) => Promise<string>,
|
||||
|
|
1
dist/flow-typed/Transaction.js
vendored
1
dist/flow-typed/Transaction.js
vendored
|
@ -19,6 +19,7 @@ declare type Support = {
|
|||
is_change: string,
|
||||
is_mine: string,
|
||||
name: string,
|
||||
normalized_name: string,
|
||||
nout: string,
|
||||
permanent_url: string,
|
||||
timestamp: number,
|
||||
|
|
1
flow-typed/File.js
vendored
1
flow-typed/File.js
vendored
|
@ -2,6 +2,7 @@
|
|||
|
||||
declare type FileListItem = {
|
||||
metadata: StreamMetadata,
|
||||
added_on: number,
|
||||
blobs_completed: number,
|
||||
blobs_in_stream: number,
|
||||
blobs_remaining: number,
|
||||
|
|
61
flow-typed/Lbry.js
vendored
61
flow-typed/Lbry.js
vendored
|
@ -108,6 +108,10 @@ declare type ClaimSearchResponse = {
|
|||
|
||||
declare type ClaimListResponse = {
|
||||
items: Array<ChannelClaim | Claim>,
|
||||
page: number,
|
||||
page_size: number,
|
||||
total_items: number,
|
||||
total_pages: number,
|
||||
};
|
||||
|
||||
declare type ChannelCreateResponse = GenericTxResponse & {
|
||||
|
@ -119,15 +123,47 @@ declare type ChannelUpdateResponse = GenericTxResponse & {
|
|||
};
|
||||
|
||||
declare type CommentCreateResponse = Comment;
|
||||
declare type CommentListResponse = Array<Comment>;
|
||||
declare type CommentListResponse = {
|
||||
items: Array<Comment>,
|
||||
page: number,
|
||||
page_size: number,
|
||||
total_items: number,
|
||||
total_pages: number,
|
||||
};
|
||||
|
||||
declare type ChannelListResponse = Array<ChannelClaim>;
|
||||
declare type ChannelListResponse = {
|
||||
items: Array<ChannelClaim>,
|
||||
page: number,
|
||||
page_size: number,
|
||||
total_items: number,
|
||||
total_pages: number,
|
||||
};
|
||||
|
||||
declare type FileListResponse = Array<FileListItem>;
|
||||
declare type FileListResponse = {
|
||||
items: Array<FileListItem>,
|
||||
page: number,
|
||||
page_size: number,
|
||||
total_items: number,
|
||||
total_pages: number,
|
||||
};
|
||||
|
||||
declare type TxListResponse = { items: Array<Transaction> };
|
||||
declare type TxListResponse = {
|
||||
items: Array<Transaction>,
|
||||
page: number,
|
||||
page_size: number,
|
||||
total_items: number,
|
||||
total_pages: number,
|
||||
};
|
||||
|
||||
declare type BlobListResponse = Array<string>;
|
||||
declare type SupportListResponse = {
|
||||
items: Array<Support>,
|
||||
page: number,
|
||||
page_size: number,
|
||||
total_items: number,
|
||||
total_pages: number,
|
||||
};
|
||||
|
||||
declare type BlobListResponse = { items: Array<string> };
|
||||
|
||||
declare type WalletListResponse = Array<{
|
||||
id: string,
|
||||
|
@ -146,7 +182,13 @@ declare type SyncApplyResponse = {
|
|||
|
||||
declare type SupportAbandonResponse = GenericTxResponse;
|
||||
|
||||
declare type StreamListResponse = { items: Array<StreamClaim> };
|
||||
declare type StreamListResponse = {
|
||||
items: Array<StreamClaim>,
|
||||
page: number,
|
||||
page_size: number,
|
||||
total_items: number,
|
||||
total_pages: number,
|
||||
};
|
||||
|
||||
//
|
||||
// Types used in the generic Lbry object that is exported
|
||||
|
@ -173,15 +215,17 @@ declare type LbryTypes = {
|
|||
publish: (params: {}) => Promise<PublishResponse>,
|
||||
|
||||
claim_search: (params: {}) => Promise<ClaimSearchResponse>,
|
||||
claim_list: (params?: {}) => Promise<ClaimListResponse>,
|
||||
claim_list: (params: {}) => Promise<ClaimListResponse>,
|
||||
channel_create: (params: {}) => Promise<ChannelCreateResponse>,
|
||||
channel_update: (params: {}) => Promise<ChannelUpdateResponse>,
|
||||
channel_import: (params: {}) => Promise<string>,
|
||||
channel_list: () => Promise<ChannelListResponse>,
|
||||
channel_list: (params: {}) => Promise<ChannelListResponse>,
|
||||
stream_abandon: (params: {}) => Promise<GenericTxResponse>,
|
||||
stream_list: (params: {}) => Promise<StreamListResponse>,
|
||||
channel_abandon: (params: {}) => Promise<GenericTxResponse>,
|
||||
support_create: (params: {}) => Promise<GenericTxResponse>,
|
||||
support_list: (params: {}) => Promise<SupportListResponse>,
|
||||
support_abandon: (params: {}) => Promise<SupportAbandonResponse>,
|
||||
|
||||
// File fetching and manipulation
|
||||
file_list: (params: {}) => Promise<FileListResponse>,
|
||||
|
@ -208,7 +252,6 @@ declare type LbryTypes = {
|
|||
address_unused: (params: {}) => Promise<string>, // New address
|
||||
address_list: (params: {}) => Promise<string>,
|
||||
transaction_list: (params: {}) => Promise<TxListResponse>,
|
||||
support_abandon: (params: {}) => Promise<SupportAbandonResponse>,
|
||||
|
||||
// Sync
|
||||
sync_hash: (params: {}) => Promise<string>,
|
||||
|
|
1
flow-typed/Transaction.js
vendored
1
flow-typed/Transaction.js
vendored
|
@ -19,6 +19,7 @@ declare type Support = {
|
|||
is_change: string,
|
||||
is_mine: string,
|
||||
name: string,
|
||||
normalized_name: string,
|
||||
nout: string,
|
||||
permanent_url: string,
|
||||
timestamp: number,
|
||||
|
|
|
@ -85,6 +85,7 @@ const Lbry: LbryTypes = {
|
|||
stream_list: params => daemonCallWithResult('stream_list', params),
|
||||
channel_abandon: params => daemonCallWithResult('channel_abandon', params),
|
||||
support_create: params => daemonCallWithResult('support_create', params),
|
||||
support_list: params => daemonCallWithResult('support_list', params),
|
||||
|
||||
// File fetching and manipulation
|
||||
file_list: (params = {}) => daemonCallWithResult('file_list', params),
|
||||
|
|
|
@ -94,13 +94,13 @@ export function doResolveUri(uri: string) {
|
|||
return doResolveUris([uri]);
|
||||
}
|
||||
|
||||
export function doFetchClaimListMine(page: number = 1, pageSize: number = 9999) {
|
||||
export function doFetchClaimListMine(page: number = 1, pageSize: number = 99999) {
|
||||
return (dispatch: Dispatch) => {
|
||||
dispatch({
|
||||
type: ACTIONS.FETCH_CLAIM_LIST_MINE_STARTED,
|
||||
});
|
||||
|
||||
Lbry.claim_list({ page, page_size: pageSize }).then((result: ClaimListResponse) => {
|
||||
Lbry.stream_list({ page, page_size: pageSize }).then((result: StreamListResponse) => {
|
||||
const claims = result.items;
|
||||
|
||||
dispatch({
|
||||
|
@ -382,20 +382,20 @@ export function doImportChannel(certificate: string) {
|
|||
};
|
||||
}
|
||||
|
||||
export function doFetchChannelListMine() {
|
||||
export function doFetchChannelListMine(page: number = 1, pageSize: number = 99999) {
|
||||
return (dispatch: Dispatch) => {
|
||||
dispatch({
|
||||
type: ACTIONS.FETCH_CHANNEL_LIST_STARTED,
|
||||
});
|
||||
|
||||
const callback = (channels: Array<ChannelClaim>) => {
|
||||
const callback = (response: ChannelListResponse) => {
|
||||
dispatch({
|
||||
type: ACTIONS.FETCH_CHANNEL_LIST_COMPLETED,
|
||||
data: { claims: channels },
|
||||
data: { claims: response.items },
|
||||
});
|
||||
};
|
||||
|
||||
Lbry.channel_list().then(callback);
|
||||
Lbry.channel_list({ page, page_size: pageSize }).then(callback);
|
||||
};
|
||||
}
|
||||
|
||||
|
|
|
@ -4,7 +4,7 @@ import Lbry from 'lbry';
|
|||
import { selectClaimsByUri, selectMyChannelClaims } from 'redux/selectors/claims';
|
||||
import { doToast } from 'redux/actions/notifications';
|
||||
|
||||
export function doCommentList(uri: string) {
|
||||
export function doCommentList(uri: string, page: number = 1, pageSize: number = 99999) {
|
||||
return (dispatch: Dispatch, getState: GetState) => {
|
||||
const state = getState();
|
||||
const claim = selectClaimsByUri(state)[uri];
|
||||
|
@ -15,12 +15,15 @@ export function doCommentList(uri: string) {
|
|||
});
|
||||
Lbry.comment_list({
|
||||
claim_id: claimId,
|
||||
page,
|
||||
page_size: pageSize,
|
||||
})
|
||||
.then((results: CommentListResponse) => {
|
||||
.then((result: CommentListResponse) => {
|
||||
const { items: comments } = result;
|
||||
dispatch({
|
||||
type: ACTIONS.COMMENT_LIST_COMPLETED,
|
||||
data: {
|
||||
comments: results,
|
||||
comments,
|
||||
claimId: claimId,
|
||||
uri: uri,
|
||||
},
|
||||
|
|
|
@ -19,12 +19,15 @@ export function doFetchFileInfo(uri) {
|
|||
},
|
||||
});
|
||||
|
||||
Lbry.file_list({ outpoint, full_status: true }).then(fileInfos => {
|
||||
Lbry.file_list({ outpoint, full_status: true, page: 1, page_size: 1 }).then(result => {
|
||||
const { items: fileInfos } = result;
|
||||
const fileInfo = fileInfos[0];
|
||||
|
||||
dispatch({
|
||||
type: ACTIONS.FETCH_FILE_INFO_COMPLETED,
|
||||
data: {
|
||||
outpoint,
|
||||
fileInfo: fileInfos && fileInfos.length ? fileInfos[0] : null,
|
||||
fileInfo: fileInfo || null,
|
||||
},
|
||||
});
|
||||
});
|
||||
|
@ -32,7 +35,7 @@ export function doFetchFileInfo(uri) {
|
|||
};
|
||||
}
|
||||
|
||||
export function doFileList() {
|
||||
export function doFileList(page: number = 1, pageSize: number = 99999) {
|
||||
return (dispatch, getState) => {
|
||||
const state = getState();
|
||||
const isFetching = selectIsFetchingFileList(state);
|
||||
|
@ -42,11 +45,12 @@ export function doFileList() {
|
|||
type: ACTIONS.FILE_LIST_STARTED,
|
||||
});
|
||||
|
||||
Lbry.file_list().then(fileInfos => {
|
||||
Lbry.file_list({ page, page_size: pageSize }).then(result => {
|
||||
const { items: fileInfos } = result;
|
||||
dispatch({
|
||||
type: ACTIONS.FILE_LIST_SUCCEEDED,
|
||||
data: {
|
||||
fileInfos,
|
||||
fileInfos: fileInfos.reverse(),
|
||||
},
|
||||
});
|
||||
});
|
||||
|
|
|
@ -13,7 +13,7 @@ export function doUpdateBalance() {
|
|||
} = getState();
|
||||
|
||||
if (walletBalancePromise === null) {
|
||||
walletBalancePromise = Lbry.wallet_balance({ reserved_subtotals: true }).then(response => {
|
||||
walletBalancePromise = Lbry.wallet_balance().then(response => {
|
||||
walletBalancePromise = null;
|
||||
|
||||
const { available, reserved, reserved_subtotals, total } = response;
|
||||
|
@ -67,17 +67,17 @@ export function doFetchTransactions(page = 1, pageSize = 99999) {
|
|||
};
|
||||
}
|
||||
|
||||
export function doFetchSupports() {
|
||||
export function doFetchSupports(page = 1, pageSize = 99999) {
|
||||
return dispatch => {
|
||||
dispatch({
|
||||
type: ACTIONS.FETCH_SUPPORTS_STARTED,
|
||||
});
|
||||
|
||||
Lbry.support_list().then(results => {
|
||||
Lbry.support_list({ page, page_size: pageSize }).then(result => {
|
||||
dispatch({
|
||||
type: ACTIONS.FETCH_SUPPORTS_COMPLETED,
|
||||
data: {
|
||||
supports: results,
|
||||
supports: result.items,
|
||||
},
|
||||
});
|
||||
});
|
||||
|
|
|
@ -42,8 +42,8 @@ export const commentReducer = handleActions(
|
|||
const byId = Object.assign({}, state.byId);
|
||||
const commentsByUri = Object.assign({}, state.commentsByUri);
|
||||
|
||||
if (comments['items']) {
|
||||
byId[claimId] = comments['items'];
|
||||
if (comments) {
|
||||
byId[claimId] = comments;
|
||||
commentsByUri[uri] = claimId;
|
||||
}
|
||||
return {
|
||||
|
|
|
@ -146,11 +146,7 @@ export const selectFileListDownloadedSort = createSelector(
|
|||
export const selectDownloadedUris = createSelector(
|
||||
selectFileInfosDownloaded,
|
||||
// We should use permament_url but it doesn't exist in file_list
|
||||
info =>
|
||||
info
|
||||
.slice()
|
||||
.reverse()
|
||||
.map(claim => `lbry://${claim.claim_name}#${claim.claim_id}`)
|
||||
info => info.slice().map(claim => `lbry://${claim.claim_name}#${claim.claim_id}`)
|
||||
);
|
||||
|
||||
export const makeSelectMediaTypeForUri = uri =>
|
||||
|
@ -214,9 +210,11 @@ function filterFileInfos(fileInfos, query) {
|
|||
const queryMatchRegExp = new RegExp(query, 'i');
|
||||
return fileInfos.filter(fileInfo => {
|
||||
const { metadata } = fileInfo;
|
||||
return (metadata.title && metadata.title.match(queryMatchRegExp)) ||
|
||||
return (
|
||||
(metadata.title && metadata.title.match(queryMatchRegExp)) ||
|
||||
(fileInfo.channel_name && fileInfo.channel_name.match(queryMatchRegExp)) ||
|
||||
(fileInfo.claim_name && fileInfo.claim_name.match(queryMatchRegExp));
|
||||
(fileInfo.claim_name && fileInfo.claim_name.match(queryMatchRegExp))
|
||||
);
|
||||
});
|
||||
}
|
||||
|
||||
|
@ -228,22 +226,25 @@ export const makeSelectSearchDownloadUrlsForPage = (query, page = 1) =>
|
|||
selectFileInfosDownloaded,
|
||||
fileInfos => {
|
||||
const matchingFileInfos = filterFileInfos(fileInfos, query);
|
||||
const start = ((Number(page) - 1) * Number(PAGE_SIZE));
|
||||
const end = (Number(page) * Number(PAGE_SIZE));
|
||||
const start = (Number(page) - 1) * Number(PAGE_SIZE);
|
||||
const end = Number(page) * Number(PAGE_SIZE);
|
||||
|
||||
return (matchingFileInfos && matchingFileInfos.length)
|
||||
return matchingFileInfos && matchingFileInfos.length
|
||||
? matchingFileInfos.slice(start, end).map(fileInfo =>
|
||||
buildURI({ streamName: fileInfo.claim_name, channelName: fileInfo.channel_name, channelClaimId: fileInfo.channel_claim_id }))
|
||||
buildURI({
|
||||
streamName: fileInfo.claim_name,
|
||||
channelName: fileInfo.channel_name,
|
||||
channelClaimId: fileInfo.channel_claim_id,
|
||||
})
|
||||
)
|
||||
: [];
|
||||
}
|
||||
);
|
||||
|
||||
export const makeSelectSearchDownloadUrlsCount = (query) =>
|
||||
export const makeSelectSearchDownloadUrlsCount = query =>
|
||||
createSelector(
|
||||
selectFileInfosDownloaded,
|
||||
fileInfos => {
|
||||
return fileInfos && fileInfos.length
|
||||
? filterFileInfos(fileInfos, query).length
|
||||
: 0;
|
||||
return fileInfos && fileInfos.length ? filterFileInfos(fileInfos, query).length : 0;
|
||||
}
|
||||
);
|
||||
|
|
Loading…
Add table
Reference in a new issue