Compare commits

..

5 commits

Author SHA1 Message Date
zeppi
0f930c4a7b sync-language 2021-10-08 16:12:32 -04:00
zeppi
32b5787071 pass channel_id on list update 2021-09-13 12:05:57 -04:00
Thomas Zarebczan
129b0ea3fa
Merge pull request #431 from saltrafael/list-thumb
Changes for list thumbnail upload
2021-09-13 11:24:58 -04:00
saltrafael
e3bc848263
Add cb to thumbnail upload 2021-09-13 07:38:21 -03:00
zeppi
372e559cae use replace for list updates 2021-09-11 13:18:41 -04:00
4 changed files with 51 additions and 33 deletions

16
dist/bundle.es.js vendored
View file

@ -1040,7 +1040,7 @@ var daemon_settings = /*#__PURE__*/Object.freeze({
const SDK_SYNC_KEYS = [LBRYUM_SERVERS, SHARE_USAGE_DATA];
// CLIENT
const CLIENT_SYNC_KEYS = [SHOW_MATURE, HIDE_REPOSTS, SHOW_ANONYMOUS, INSTANT_PURCHASE_ENABLED, INSTANT_PURCHASE_MAX, THEME, AUTOPLAY_MEDIA, AUTOPLAY_NEXT, HIDE_BALANCE, HIDE_SPLASH_ANIMATION, FLOATING_PLAYER, DARK_MODE_TIMES, AUTOMATIC_DARK_MODE_ENABLED];
const CLIENT_SYNC_KEYS = [SHOW_MATURE, HIDE_REPOSTS, SHOW_ANONYMOUS, INSTANT_PURCHASE_ENABLED, INSTANT_PURCHASE_MAX, THEME, AUTOPLAY_MEDIA, AUTOPLAY_NEXT, HIDE_BALANCE, HIDE_SPLASH_ANIMATION, FLOATING_PLAYER, DARK_MODE_TIMES, AUTOMATIC_DARK_MODE_ENABLED, LANGUAGE];
var shared_preferences = /*#__PURE__*/Object.freeze({
SDK_SYNC_KEYS: SDK_SYNC_KEYS,
@ -4535,6 +4535,10 @@ function doCollectionPublishUpdate(options, isBackgroundUpdate) {
updateParams['tags'] = options.tags.map(tag => tag.name);
}
if (options.channel_id) {
updateParams['channel_id'] = options.channel_id;
}
return new Promise(resolve => {
dispatch({
type: COLLECTION_PUBLISH_UPDATE_STARTED
@ -5629,7 +5633,7 @@ const doUpdatePublishForm = publishFormValue => dispatch => dispatch({
data: _extends$7({}, publishFormValue)
});
const doUploadThumbnail = (filePath, thumbnailBlob, fsAdapter, fs, path) => dispatch => {
const doUploadThumbnail = (filePath, thumbnailBlob, fsAdapter, fs, path, cb) => dispatch => {
const downMessage = __('Thumbnail upload service may be down, try again later.');
let thumbnail, fileExt, fileName, fileType;
@ -5663,13 +5667,17 @@ const doUploadThumbnail = (filePath, thumbnailBlob, fsAdapter, fs, path) => disp
method: 'POST',
body: data
}).then(res => res.text()).then(text => text.length ? JSON.parse(text) : {}).then(json => {
return json.success ? dispatch({
if (!json.success) return uploadError(json.message || downMessage);
if (cb) {
cb(json.data.serveUrl);
}
return dispatch({
type: UPDATE_PUBLISH_FORM,
data: {
uploadThumbnailStatus: COMPLETE,
thumbnail: json.data.serveUrl
}
}) : uploadError(json.message || downMessage);
});
}).catch(err => {
let message = err.message;

View file

@ -28,4 +28,5 @@ export const CLIENT_SYNC_KEYS = [
SETTINGS.FLOATING_PLAYER,
SETTINGS.DARK_MODE_TIMES,
SETTINGS.AUTOMATIC_DARK_MODE_ENABLED,
SETTINGS.LANGUAGE,
];

View file

@ -79,7 +79,7 @@ export function doResolveUris(
const collectionIds: Array<string> = [];
return Lbry.resolve({ urls: urisToResolve, ...options }).then(
async (result: ResolveResponse) => {
async(result: ResolveResponse) => {
let repostedResults = {};
const repostsToResolve = [];
const fallbackResolveInfo = {
@ -651,7 +651,7 @@ export function doClaimSearch(
}
) {
const query = createNormalizedClaimSearchKey(options);
return async (dispatch: Dispatch) => {
return async(dispatch: Dispatch) => {
dispatch({
type: ACTIONS.CLAIM_SEARCH_STARTED,
data: { query: query },
@ -842,6 +842,7 @@ export function doCollectionPublishUpdate(
tags?: Array<Tag>,
languages?: Array<string>,
claims?: Array<string>,
channel_id?: string,
},
isBackgroundUpdate?: boolean
) {
@ -853,32 +854,33 @@ export function doCollectionPublishUpdate(
blocking?: true,
title?: string,
thumbnail_url?: string,
channel_id?: string,
description?: string,
claim_id: string,
tags?: Array<string>,
languages?: Array<string>,
claims?: Array<string>,
clear_claims: boolean,
replace: boolean,
replace?: boolean,
} = isBackgroundUpdate
? {
blocking: true,
claim_id: options.claim_id,
clear_claims: true,
}
blocking: true,
claim_id: options.claim_id,
clear_claims: true,
}
: {
bid: creditsToString(options.bid),
title: options.title,
thumbnail_url: options.thumbnail_url,
description: options.description,
tags: [],
languages: options.languages || [],
locations: [],
blocking: true,
claim_id: options.claim_id,
clear_claims: true,
replace: true,
};
bid: creditsToString(options.bid),
title: options.title,
thumbnail_url: options.thumbnail_url,
description: options.description,
tags: [],
languages: options.languages || [],
locations: [],
blocking: true,
claim_id: options.claim_id,
clear_claims: true,
replace: true,
};
if (isBackgroundUpdate && updateParams.claim_id) {
const state = getState();
@ -891,6 +893,10 @@ export function doCollectionPublishUpdate(
updateParams['tags'] = options.tags.map(tag => tag.name);
}
if (options.channel_id) {
updateParams['channel_id'] = options.channel_id;
}
return new Promise(resolve => {
dispatch({
type: ACTIONS.COLLECTION_PUBLISH_UPDATE_STARTED,

View file

@ -69,7 +69,8 @@ export const doUploadThumbnail = (
thumbnailBlob?: File,
fsAdapter?: any,
fs?: any,
path?: any
path?: any,
cb?: (string) => void
) => (dispatch: Dispatch) => {
const downMessage = __('Thumbnail upload service may be down, try again later.');
let thumbnail, fileExt, fileName, fileType;
@ -112,15 +113,17 @@ export const doUploadThumbnail = (
.then(res => res.text())
.then(text => (text.length ? JSON.parse(text) : {}))
.then(json => {
return json.success
? dispatch({
type: ACTIONS.UPDATE_PUBLISH_FORM,
data: {
uploadThumbnailStatus: THUMBNAIL_STATUSES.COMPLETE,
thumbnail: json.data.serveUrl,
},
})
: uploadError(json.message || downMessage);
if (!json.success) return uploadError(json.message || downMessage);
if (cb) {
cb(json.data.serveUrl);
}
return dispatch({
type: ACTIONS.UPDATE_PUBLISH_FORM,
data: {
uploadThumbnailStatus: THUMBNAIL_STATUSES.COMPLETE,
thumbnail: json.data.serveUrl,
},
});
})
.catch(err => {
let message = err.message;