From 7a26e77e27f57562528a554a30ced0dd259691ef Mon Sep 17 00:00:00 2001 From: Thomas Zarebczan Date: Sun, 15 Dec 2019 19:56:01 -0500 Subject: [PATCH 1/3] fix: hard error on space in URI The app would crash, and so would Android. Eventually users would need a way to abandon them - can do so via the CLI for now. Not many in this boat. --- dist/bundle.es.js | 20 ++++---------------- src/lbryURI.js | 8 ++++---- 2 files changed, 8 insertions(+), 20 deletions(-) diff --git a/dist/bundle.es.js b/dist/bundle.es.js index 8f827ba..9d5fc8a 100644 --- a/dist/bundle.es.js +++ b/dist/bundle.es.js @@ -15,7 +15,6 @@ const CHANNEL_NEW = 'new'; const PAGE_SIZE = 20; var claim = /*#__PURE__*/Object.freeze({ - __proto__: null, MINIMUM_PUBLISH_BID: MINIMUM_PUBLISH_BID, CHANNEL_ANONYMOUS: CHANNEL_ANONYMOUS, CHANNEL_NEW: CHANNEL_NEW, @@ -275,7 +274,6 @@ const TOGGLE_BLOCK_CHANNEL = 'TOGGLE_BLOCK_CHANNEL'; const USER_STATE_POPULATE = 'USER_STATE_POPULATE'; var action_types = /*#__PURE__*/Object.freeze({ - __proto__: null, WINDOW_FOCUSED: WINDOW_FOCUSED, DAEMON_READY: DAEMON_READY, DAEMON_VERSION_MATCH: DAEMON_VERSION_MATCH, @@ -518,7 +516,6 @@ const OTHER = 'other'; const COPYRIGHT = 'copyright'; var licenses = /*#__PURE__*/Object.freeze({ - __proto__: null, CC_LICENSES: CC_LICENSES, NONE: NONE, PUBLIC_DOMAIN: PUBLIC_DOMAIN, @@ -549,7 +546,6 @@ const HISTORY = 'user_history'; const WALLET = 'wallet'; var pages = /*#__PURE__*/Object.freeze({ - __proto__: null, AUTH: AUTH, BACKUP: BACKUP, CHANNEL: CHANNEL, @@ -599,7 +595,6 @@ const RECEIVE_INTERESTS_NOTIFICATIONS = 'receiveInterestsNotifications'; const RECEIVE_CREATOR_NOTIFICATIONS = 'receiveCreatorNotifications'; var settings = /*#__PURE__*/Object.freeze({ - __proto__: null, CREDIT_REQUIRED_ACKNOWLEDGED: CREDIT_REQUIRED_ACKNOWLEDGED, NEW_USER_ACKNOWLEDGED: NEW_USER_ACKNOWLEDGED, EMAIL_COLLECTION_ACKNOWLEDGED: EMAIL_COLLECTION_ACKNOWLEDGED, @@ -627,7 +622,6 @@ const TITLE = 'title'; const FILENAME = 'filename'; var sort_options = /*#__PURE__*/Object.freeze({ - __proto__: null, DATE_NEW: DATE_NEW, DATE_OLD: DATE_OLD, TITLE: TITLE, @@ -641,7 +635,6 @@ const COMPLETE = 'complete'; const MANUAL = 'manual'; var thumbnail_upload_statuses = /*#__PURE__*/Object.freeze({ - __proto__: null, API_DOWN: API_DOWN, READY: READY, IN_PROGRESS: IN_PROGRESS, @@ -661,7 +654,6 @@ const UPDATE = 'update'; const ABANDON = 'abandon'; var transaction_types = /*#__PURE__*/Object.freeze({ - __proto__: null, ALL: ALL, SPEND: SPEND, RECEIVE: RECEIVE, @@ -678,7 +670,6 @@ const PAGE_SIZE$1 = 50; const LATEST_PAGE_SIZE = 20; var transaction_list = /*#__PURE__*/Object.freeze({ - __proto__: null, PAGE_SIZE: PAGE_SIZE$1, LATEST_PAGE_SIZE: LATEST_PAGE_SIZE }); @@ -687,7 +678,6 @@ const SPEECH_STATUS = 'https://spee.ch/api/config/site/publishing'; const SPEECH_PUBLISH = 'https://spee.ch/api/claim/publish'; var speech_urls = /*#__PURE__*/Object.freeze({ - __proto__: null, SPEECH_STATUS: SPEECH_STATUS, SPEECH_PUBLISH: SPEECH_PUBLISH }); @@ -733,7 +723,6 @@ const WALLET_DIR = 'wallet_dir'; const WALLETS = 'wallets'; var daemon_settings = /*#__PURE__*/Object.freeze({ - __proto__: null, ANNOUNCE_HEAD_AND_SD_ONLY: ANNOUNCE_HEAD_AND_SD_ONLY, API: API, BLOB_DOWNLOAD_TIMEOUT: BLOB_DOWNLOAD_TIMEOUT, @@ -787,7 +776,6 @@ var daemon_settings = /*#__PURE__*/Object.freeze({ const WALLET_SERVERS = LBRYUM_SERVERS; var shared_preferences = /*#__PURE__*/Object.freeze({ - __proto__: null, WALLET_SERVERS: WALLET_SERVERS }); @@ -1182,7 +1170,7 @@ function parseURIModifier(modSeperator, modValue) { if (modSeperator) { if (!modValue) { - throw new Error(__(`No modifier provided after separator %modSeperator%.`, { modSeperator })); + console.error(__(`No modifier provided after separator %modSeperator%.`, { modSeperator })); } if (modSeperator === '#') { @@ -1195,15 +1183,15 @@ function parseURIModifier(modSeperator, modValue) { } if (claimId && (claimId.length > claimIdMaxLength || !claimId.match(/^[0-9a-f]+$/))) { - throw new Error(__(`Invalid claim ID %claimId%.`, { claimId })); + console.error(__(`Invalid claim ID %claimId%.`, { claimId })); } if (claimSequence && !claimSequence.match(/^-?[1-9][0-9]*$/)) { - throw new Error(__('Claim sequence must be a number.')); + console.error(__('Claim sequence must be a number.')); } if (bidPosition && !bidPosition.match(/^-?[1-9][0-9]*$/)) { - throw new Error(__('Bid position must be a number.')); + console.error(__('Bid position must be a number.')); } return [claimId, claimSequence, bidPosition]; diff --git a/src/lbryURI.js b/src/lbryURI.js index a019418..e6fce46 100644 --- a/src/lbryURI.js +++ b/src/lbryURI.js @@ -138,7 +138,7 @@ function parseURIModifier(modSeperator: ?string, modValue: ?string) { if (modSeperator) { if (!modValue) { - throw new Error(__(`No modifier provided after separator %modSeperator%.`, { modSeperator })); + console.error(__(`No modifier provided after separator %modSeperator%.`, { modSeperator })); } if (modSeperator === '#') { @@ -151,15 +151,15 @@ function parseURIModifier(modSeperator: ?string, modValue: ?string) { } if (claimId && (claimId.length > claimIdMaxLength || !claimId.match(/^[0-9a-f]+$/))) { - throw new Error(__(`Invalid claim ID %claimId%.`, { claimId })); + console.error(__(`Invalid claim ID %claimId%.`, { claimId })); } if (claimSequence && !claimSequence.match(/^-?[1-9][0-9]*$/)) { - throw new Error(__('Claim sequence must be a number.')); + console.error(__('Claim sequence must be a number.')); } if (bidPosition && !bidPosition.match(/^-?[1-9][0-9]*$/)) { - throw new Error(__('Bid position must be a number.')); + console.error(__('Bid position must be a number.')); } return [claimId, claimSequence, bidPosition]; -- 2.45.2 From 31c8ec5051420febdbee85379581e99e09d0a1b6 Mon Sep 17 00:00:00 2001 From: jessop Date: Mon, 16 Dec 2019 13:20:07 -0500 Subject: [PATCH 2/3] fixes blockedChannel sync --- dist/bundle.es.js | 12 ++++++------ src/redux/actions/sync.js | 10 +++++----- src/redux/reducers/blocked.js | 6 +++--- 3 files changed, 14 insertions(+), 14 deletions(-) diff --git a/dist/bundle.es.js b/dist/bundle.es.js index 9d5fc8a..08cf676 100644 --- a/dist/bundle.es.js +++ b/dist/bundle.es.js @@ -1517,9 +1517,9 @@ var _extends$2 = Object.assign || function (target) { for (var i = 1; i < argume function extractUserState(rawObj) { if (rawObj && rawObj.version === '0.1' && rawObj.value) { - const { subscriptions, tags, blockedChannels, settings } = rawObj.value; + const { subscriptions, tags, blocked, settings } = rawObj.value; - return _extends$2({}, subscriptions ? { subscriptions } : {}, tags ? { tags } : {}, blockedChannels ? { blockedChannels } : {}, settings ? { settings } : {}); + return _extends$2({}, subscriptions ? { subscriptions } : {}, tags ? { tags } : {}, blocked ? { blocked } : {}, settings ? { settings } : {}); } return {}; @@ -1527,8 +1527,8 @@ function extractUserState(rawObj) { function doPopulateSharedUserState(sharedSettings) { return dispatch => { - const { subscriptions, tags, blockedChannels, settings } = extractUserState(sharedSettings); - dispatch({ type: USER_STATE_POPULATE, data: { subscriptions, tags, blockedChannels, settings } }); + const { subscriptions, tags, blocked, settings } = extractUserState(sharedSettings); + dispatch({ type: USER_STATE_POPULATE, data: { subscriptions, tags, blocked, settings } }); }; } @@ -5122,9 +5122,9 @@ const blockedReducer = handleActions({ }; }, [USER_STATE_POPULATE]: (state, action) => { - const { blockedChannels } = action.data; + const { blocked } = action.data; return _extends$e({}, state, { - blockedChannels: blockedChannels && blockedChannels.length ? blockedChannels : state.blockedChannels + blockedChannels: blocked && blocked.length ? blocked : state.blockedChannels }); } }, defaultState$9); diff --git a/src/redux/actions/sync.js b/src/redux/actions/sync.js index 3957a33..41a25ea 100644 --- a/src/redux/actions/sync.js +++ b/src/redux/actions/sync.js @@ -7,19 +7,19 @@ type SharedData = { value: { subscriptions?: Array, tags?: Array, - blockedChannels?: Array, + blocked?: Array, settings?: any, }, }; function extractUserState(rawObj: SharedData) { if (rawObj && rawObj.version === '0.1' && rawObj.value) { - const { subscriptions, tags, blockedChannels, settings} = rawObj.value; + const { subscriptions, tags, blocked, settings} = rawObj.value; return { ...(subscriptions ? { subscriptions } : {}), ...(tags ? { tags } : {}), - ...(blockedChannels ? { blockedChannels } : {}), + ...(blocked ? { blocked } : {}), ...(settings ? { settings } : {}), }; } @@ -29,8 +29,8 @@ function extractUserState(rawObj: SharedData) { export function doPopulateSharedUserState(sharedSettings: any) { return (dispatch: Dispatch) => { - const { subscriptions, tags, blockedChannels, settings } = extractUserState(sharedSettings); - dispatch({ type: ACTIONS.USER_STATE_POPULATE, data: { subscriptions, tags, blockedChannels, settings } }); + const { subscriptions, tags, blocked, settings } = extractUserState(sharedSettings); + dispatch({ type: ACTIONS.USER_STATE_POPULATE, data: { subscriptions, tags, blocked, settings } }); }; } diff --git a/src/redux/reducers/blocked.js b/src/redux/reducers/blocked.js index 7a9fd85..b69d9c9 100644 --- a/src/redux/reducers/blocked.js +++ b/src/redux/reducers/blocked.js @@ -28,13 +28,13 @@ export const blockedReducer = handleActions( }, [ACTIONS.USER_STATE_POPULATE]: ( state: BlocklistState, - action: { data: { blockedChannels: ?Array } } + action: { data: { blocked: ?Array } } ) => { - const { blockedChannels } = action.data; + const { blocked } = action.data; return { ...state, blockedChannels: - blockedChannels && blockedChannels.length ? blockedChannels : state.blockedChannels, + blocked && blocked.length ? blocked : state.blockedChannels, }; }, }, -- 2.45.2 From 9081e377bd1283f182669ec77f077beaed5f65d2 Mon Sep 17 00:00:00 2001 From: Akinwale Ariwodola Date: Wed, 18 Dec 2019 15:14:24 +0100 Subject: [PATCH 3/3] doSendTip i18n fix --- dist/bundle.es.js | 16 ++-------------- src/redux/actions/wallet.js | 6 +++--- 2 files changed, 5 insertions(+), 17 deletions(-) diff --git a/dist/bundle.es.js b/dist/bundle.es.js index 8f827ba..36824ad 100644 --- a/dist/bundle.es.js +++ b/dist/bundle.es.js @@ -15,7 +15,6 @@ const CHANNEL_NEW = 'new'; const PAGE_SIZE = 20; var claim = /*#__PURE__*/Object.freeze({ - __proto__: null, MINIMUM_PUBLISH_BID: MINIMUM_PUBLISH_BID, CHANNEL_ANONYMOUS: CHANNEL_ANONYMOUS, CHANNEL_NEW: CHANNEL_NEW, @@ -275,7 +274,6 @@ const TOGGLE_BLOCK_CHANNEL = 'TOGGLE_BLOCK_CHANNEL'; const USER_STATE_POPULATE = 'USER_STATE_POPULATE'; var action_types = /*#__PURE__*/Object.freeze({ - __proto__: null, WINDOW_FOCUSED: WINDOW_FOCUSED, DAEMON_READY: DAEMON_READY, DAEMON_VERSION_MATCH: DAEMON_VERSION_MATCH, @@ -518,7 +516,6 @@ const OTHER = 'other'; const COPYRIGHT = 'copyright'; var licenses = /*#__PURE__*/Object.freeze({ - __proto__: null, CC_LICENSES: CC_LICENSES, NONE: NONE, PUBLIC_DOMAIN: PUBLIC_DOMAIN, @@ -549,7 +546,6 @@ const HISTORY = 'user_history'; const WALLET = 'wallet'; var pages = /*#__PURE__*/Object.freeze({ - __proto__: null, AUTH: AUTH, BACKUP: BACKUP, CHANNEL: CHANNEL, @@ -599,7 +595,6 @@ const RECEIVE_INTERESTS_NOTIFICATIONS = 'receiveInterestsNotifications'; const RECEIVE_CREATOR_NOTIFICATIONS = 'receiveCreatorNotifications'; var settings = /*#__PURE__*/Object.freeze({ - __proto__: null, CREDIT_REQUIRED_ACKNOWLEDGED: CREDIT_REQUIRED_ACKNOWLEDGED, NEW_USER_ACKNOWLEDGED: NEW_USER_ACKNOWLEDGED, EMAIL_COLLECTION_ACKNOWLEDGED: EMAIL_COLLECTION_ACKNOWLEDGED, @@ -627,7 +622,6 @@ const TITLE = 'title'; const FILENAME = 'filename'; var sort_options = /*#__PURE__*/Object.freeze({ - __proto__: null, DATE_NEW: DATE_NEW, DATE_OLD: DATE_OLD, TITLE: TITLE, @@ -641,7 +635,6 @@ const COMPLETE = 'complete'; const MANUAL = 'manual'; var thumbnail_upload_statuses = /*#__PURE__*/Object.freeze({ - __proto__: null, API_DOWN: API_DOWN, READY: READY, IN_PROGRESS: IN_PROGRESS, @@ -661,7 +654,6 @@ const UPDATE = 'update'; const ABANDON = 'abandon'; var transaction_types = /*#__PURE__*/Object.freeze({ - __proto__: null, ALL: ALL, SPEND: SPEND, RECEIVE: RECEIVE, @@ -678,7 +670,6 @@ const PAGE_SIZE$1 = 50; const LATEST_PAGE_SIZE = 20; var transaction_list = /*#__PURE__*/Object.freeze({ - __proto__: null, PAGE_SIZE: PAGE_SIZE$1, LATEST_PAGE_SIZE: LATEST_PAGE_SIZE }); @@ -687,7 +678,6 @@ const SPEECH_STATUS = 'https://spee.ch/api/config/site/publishing'; const SPEECH_PUBLISH = 'https://spee.ch/api/claim/publish'; var speech_urls = /*#__PURE__*/Object.freeze({ - __proto__: null, SPEECH_STATUS: SPEECH_STATUS, SPEECH_PUBLISH: SPEECH_PUBLISH }); @@ -733,7 +723,6 @@ const WALLET_DIR = 'wallet_dir'; const WALLETS = 'wallets'; var daemon_settings = /*#__PURE__*/Object.freeze({ - __proto__: null, ANNOUNCE_HEAD_AND_SD_ONLY: ANNOUNCE_HEAD_AND_SD_ONLY, API: API, BLOB_DOWNLOAD_TIMEOUT: BLOB_DOWNLOAD_TIMEOUT, @@ -787,7 +776,6 @@ var daemon_settings = /*#__PURE__*/Object.freeze({ const WALLET_SERVERS = LBRYUM_SERVERS; var shared_preferences = /*#__PURE__*/Object.freeze({ - __proto__: null, WALLET_SERVERS: WALLET_SERVERS }); @@ -2510,7 +2498,7 @@ function doSendTip(amount, claimId, isSupport, successCallback, errorCallback) { if (balance - amount <= 0) { dispatch(doToast({ - message: 'Insufficient credits', + message: __('Insufficient credits'), isError: true })); return; @@ -2518,7 +2506,7 @@ function doSendTip(amount, claimId, isSupport, successCallback, errorCallback) { const success = () => { dispatch(doToast({ - message: shouldSupport ? __(`You deposited ${amount} LBC as a support!`) : __(`You sent ${amount} LBC as a tip, Mahalo!`), + message: shouldSupport ? __('You deposited %amount% LBC as a support!', { amount }) : __('You sent %amount% LBC as a tip, Mahalo!', { amount }), linkText: __('History'), linkTarget: __('/wallet') })); diff --git a/src/redux/actions/wallet.js b/src/redux/actions/wallet.js index 4fdfb15..4ae4f02 100644 --- a/src/redux/actions/wallet.js +++ b/src/redux/actions/wallet.js @@ -206,7 +206,7 @@ export function doSendTip(amount, claimId, isSupport, successCallback, errorCall if (balance - amount <= 0) { dispatch( doToast({ - message: 'Insufficient credits', + message: __('Insufficient credits'), isError: true, }) ); @@ -217,8 +217,8 @@ export function doSendTip(amount, claimId, isSupport, successCallback, errorCall dispatch( doToast({ message: shouldSupport - ? __(`You deposited ${amount} LBC as a support!`) - : __(`You sent ${amount} LBC as a tip, Mahalo!`), + ? __('You deposited %amount% LBC as a support!', { amount }) + : __('You sent %amount% LBC as a tip, Mahalo!', { amount }), linkText: __('History'), linkTarget: __('/wallet'), }) -- 2.45.2