Remove lbryinc methods and upgrade lbry{inc,-redux} #2319

Merged
neb-b merged 1 commit from lbryinc into master 2019-03-12 21:28:35 +01:00
18 changed files with 51 additions and 125 deletions

View file

@ -58,8 +58,8 @@
"hast-util-sanitize": "^1.1.2", "hast-util-sanitize": "^1.1.2",
"keytar": "^4.3.0", "keytar": "^4.3.0",
"lbry-format": "https://github.com/lbryio/lbry-format.git", "lbry-format": "https://github.com/lbryio/lbry-format.git",
"lbry-redux": "lbryio/lbry-redux#406e1970b9d5594faf0407100c9bbed45d904cdf", "lbry-redux": "lbryio/lbry-redux#71dda665759ead555fef0bccef3a0ae653cb4509",
"lbryinc": "lbryio/lbryinc#2334ad53e82c22d6291899785d5292347008f2a9", "lbryinc": "lbryio/lbryinc#b54e90f3d497f0d91b3bb94dab063f0696775169",
"localforage": "^1.7.1", "localforage": "^1.7.1",
"mammoth": "^1.4.6", "mammoth": "^1.4.6",
"mime": "^2.3.1", "mime": "^2.3.1",

View file

@ -4,16 +4,11 @@ import * as ICONS from 'constants/icons';
import React from 'react'; import React from 'react';
import Button from 'component/button'; import Button from 'component/button';
import parseData from 'util/parse-data'; import parseData from 'util/parse-data';
/* eslint-disable no-redeclare */
// @if TARGET='app'
// $FlowFixMe
import { remote } from 'electron'; import { remote } from 'electron';
import path from 'path';
// @if TARGET='app'
import fs from 'fs';
// @endif // @endif
// @if TARGET='web'
// $FlowFixMe
import { remote } from 'web/stubs';
// @endif
/* eslint-enable no-redeclare */
type Props = { type Props = {
data: Array<any>, data: Array<any>,
@ -34,8 +29,6 @@ class FileExporter extends React.PureComponent<Props> {
this.handleButtonClick = this.handleButtonClick.bind(this); this.handleButtonClick = this.handleButtonClick.bind(this);
} }
handleButtonClick: () => void;
handleFileCreation(filename: string, data: any) { handleFileCreation(filename: string, data: any) {
const { onFileCreated } = this.props; const { onFileCreated } = this.props;
// @if TARGET='app' // @if TARGET='app'

View file

@ -1,9 +1,6 @@
import { connect } from 'react-redux'; import { connect } from 'react-redux';
import { import { makeSelectFileInfoForUri, makeSelectClaimIsMine } from 'lbry-redux';
makeSelectCostInfoForUri, import { makeSelectCostInfoForUri } from 'lbryinc';
makeSelectFileInfoForUri,
makeSelectClaimIsMine,
} from 'lbry-redux';
import { doOpenModal } from 'redux/actions/app'; import { doOpenModal } from 'redux/actions/app';
import FileActions from './view'; import FileActions from './view';

View file

@ -8,11 +8,9 @@ import {
makeSelectClaimIsMine, makeSelectClaimIsMine,
makeSelectClaimIsPending, makeSelectClaimIsPending,
} from 'lbry-redux'; } from 'lbry-redux';
import { selectRewardContentClaimIds } from 'lbryinc';
import { doNavigate } from 'redux/actions/navigation'; import { doNavigate } from 'redux/actions/navigation';
import { import { makeSelectContentPositionForUri } from 'redux/selectors/content';
selectRewardContentClaimIds,
makeSelectContentPositionForUri,
} from 'redux/selectors/content';
import { selectShowNsfw } from 'redux/selectors/settings'; import { selectShowNsfw } from 'redux/selectors/settings';
import { makeSelectIsSubscribed, makeSelectIsNew } from 'redux/selectors/subscriptions'; import { makeSelectIsSubscribed, makeSelectIsNew } from 'redux/selectors/subscriptions';
import { doClearContentHistoryUri } from 'redux/actions/content'; import { doClearContentHistoryUri } from 'redux/actions/content';

View file

@ -3,9 +3,9 @@ import {
makeSelectFileInfoForUri, makeSelectFileInfoForUri,
makeSelectDownloadingForUri, makeSelectDownloadingForUri,
makeSelectLoadingForUri, makeSelectLoadingForUri,
makeSelectCostInfoForUri,
makeSelectClaimForUri, makeSelectClaimForUri,
} from 'lbry-redux'; } from 'lbry-redux';
import { makeSelectCostInfoForUri } from 'lbryinc';
import { doOpenFileInShell } from 'redux/actions/file'; import { doOpenFileInShell } from 'redux/actions/file';
import { doPurchaseUri, doStartDownload, doSetPlayingUri } from 'redux/actions/content'; import { doPurchaseUri, doStartDownload, doSetPlayingUri } from 'redux/actions/content';
import FileDownloadLink from './view'; import FileDownloadLink from './view';

View file

@ -1,10 +1,10 @@
import { connect } from 'react-redux'; import { connect } from 'react-redux';
import { makeSelectClaimForUri } from 'lbry-redux';
import { import {
doFetchCostInfoForUri,
makeSelectCostInfoForUri, makeSelectCostInfoForUri,
doFetchCostInfoForUri,
makeSelectFetchingCostInfoForUri, makeSelectFetchingCostInfoForUri,
makeSelectClaimForUri, } from 'lbryinc';
} from 'lbry-redux';
import FilePrice from './view'; import FilePrice from './view';
const select = (state, props) => ({ const select = (state, props) => ({

View file

@ -7,10 +7,10 @@ import {
makeSelectIsUriResolving, makeSelectIsUriResolving,
makeSelectClaimIsMine, makeSelectClaimIsMine,
} from 'lbry-redux'; } from 'lbry-redux';
import { selectRewardContentClaimIds } from 'lbryinc';
import { selectShowNsfw } from 'redux/selectors/settings'; import { selectShowNsfw } from 'redux/selectors/settings';
import { doNavigate } from 'redux/actions/navigation'; import { doNavigate } from 'redux/actions/navigation';
import { doClearPublish, doUpdatePublishForm } from 'redux/actions/publish'; import { doClearPublish, doUpdatePublishForm } from 'redux/actions/publish';
import { selectRewardContentClaimIds } from 'redux/selectors/content';
import { makeSelectIsSubscribed, makeSelectIsNew } from 'redux/selectors/subscriptions'; import { makeSelectIsSubscribed, makeSelectIsNew } from 'redux/selectors/subscriptions';
import FileTile from './view'; import FileTile from './view';

View file

@ -4,11 +4,10 @@ import { doChangeVolume } from 'redux/actions/app';
import { selectVolume } from 'redux/selectors/app'; import { selectVolume } from 'redux/selectors/app';
import { doPlayUri, doSetPlayingUri, savePosition } from 'redux/actions/content'; import { doPlayUri, doSetPlayingUri, savePosition } from 'redux/actions/content';
import { doNavigate } from 'redux/actions/navigation'; import { doNavigate } from 'redux/actions/navigation';
import { doClaimEligiblePurchaseRewards } from 'lbryinc'; import { doClaimEligiblePurchaseRewards, makeSelectCostInfoForUri } from 'lbryinc';
import { import {
makeSelectMetadataForUri, makeSelectMetadataForUri,
makeSelectContentTypeForUri, makeSelectContentTypeForUri,
makeSelectCostInfoForUri,
makeSelectClaimForUri, makeSelectClaimForUri,
makeSelectFileInfoForUri, makeSelectFileInfoForUri,
makeSelectLoadingForUri, makeSelectLoadingForUri,

View file

@ -18,16 +18,10 @@ import {
doOpenModal, doOpenModal,
doHideModal, doHideModal,
} from 'redux/actions/app'; } from 'redux/actions/app';
import { import { Lbry, doToast, isURIValid, setSearchApi } from 'lbry-redux';
Lbry,
doToast,
doBlackListedOutpointsSubscribe,
isURIValid,
setSearchApi,
} from 'lbry-redux';
import { doNavigate, doHistoryBack, doHistoryForward } from 'redux/actions/navigation'; import { doNavigate, doHistoryBack, doHistoryForward } from 'redux/actions/navigation';
import { doDownloadLanguages, doUpdateIsNightAsync } from 'redux/actions/settings'; import { doDownloadLanguages, doUpdateIsNightAsync } from 'redux/actions/settings';
import { doAuthenticate, Lbryio, rewards } from 'lbryinc'; import { doAuthenticate, Lbryio, rewards, doBlackListedOutpointsSubscribe } from 'lbryinc';
import 'scss/all.scss'; import 'scss/all.scss';
import store from 'store'; import store from 'store';
import pjson from 'package.json'; import pjson from 'package.json';

View file

@ -1,14 +1,12 @@
import { connect } from 'react-redux'; import { connect } from 'react-redux';
import * as settings from 'constants/settings'; import * as settings from 'constants/settings';
import { import { selectBalance, selectCurrentPage, selectError, doToast } from 'lbry-redux';
selectCostForCurrentPageUri,
selectBalance,
selectCurrentPage,
selectError,
doToast,
} from 'lbry-redux';
import { makeSelectClientSetting } from 'redux/selectors/settings'; import { makeSelectClientSetting } from 'redux/selectors/settings';
import { selectUser, selectUserIsVerificationCandidate } from 'lbryinc'; import {
selectUser,
selectUserIsVerificationCandidate,
selectCostForCurrentPageUri,
} from 'lbryinc';
import { selectModal } from 'redux/selectors/app'; import { selectModal } from 'redux/selectors/app';
import { doOpenModal } from 'redux/actions/app'; import { doOpenModal } from 'redux/actions/app';
import ModalRouter from './view'; import ModalRouter from './view';

View file

@ -1,6 +1,11 @@
import { connect } from 'react-redux'; import { connect } from 'react-redux';
import { selectFeaturedUris, selectFetchingFeaturedUris, doFetchFeaturedUris } from 'lbry-redux'; import {
import { doFetchRewardedContent, doRewardList } from 'lbryinc'; doFetchRewardedContent,
doRewardList,
selectFeaturedUris,
doFetchFeaturedUris,
selectFetchingFeaturedUris,
} from 'lbryinc';
import DiscoverPage from './view'; import DiscoverPage from './view';
const select = state => ({ const select = state => ({

View file

@ -7,15 +7,14 @@ import { doSetClientSetting } from 'redux/actions/settings';
import { doSetContentHistoryItem } from 'redux/actions/content'; import { doSetContentHistoryItem } from 'redux/actions/content';
import { import {
doFetchFileInfo, doFetchFileInfo,
doFetchCostInfoForUri,
makeSelectClaimIsMine, makeSelectClaimIsMine,
makeSelectCostInfoForUri,
makeSelectFileInfoForUri, makeSelectFileInfoForUri,
makeSelectClaimForUri, makeSelectClaimForUri,
makeSelectContentTypeForUri, makeSelectContentTypeForUri,
makeSelectMetadataForUri, makeSelectMetadataForUri,
makeSelectChannelForClaimUri, makeSelectChannelForClaimUri,
} from 'lbry-redux'; } from 'lbry-redux';
import { makeSelectCostInfoForUri, doFetchCostInfoForUri } from 'lbryinc';
import { selectShowNsfw, makeSelectClientSetting } from 'redux/selectors/settings'; import { selectShowNsfw, makeSelectClientSetting } from 'redux/selectors/settings';
import { makeSelectIsSubscribed } from 'redux/selectors/subscriptions'; import { makeSelectIsSubscribed } from 'redux/selectors/subscriptions';
import { doPrepareEdit } from 'redux/actions/publish'; import { doPrepareEdit } from 'redux/actions/publish';

View file

@ -5,8 +5,8 @@ import {
makeSelectClaimForUri, makeSelectClaimForUri,
makeSelectIsUriResolving, makeSelectIsUriResolving,
makeSelectTotalPagesForChannel, makeSelectTotalPagesForChannel,
selectBlackListedOutpoints,
} from 'lbry-redux'; } from 'lbry-redux';
import { selectBlackListedOutpoints } from 'lbryinc';
import ShowPage from './view'; import ShowPage from './view';
const select = (state, props) => ({ const select = (state, props) => ({

View file

@ -16,7 +16,6 @@ import {
Lbry, Lbry,
Lbryapi, Lbryapi,
buildURI, buildURI,
makeSelectCostInfoForUri,
makeSelectFileInfoForUri, makeSelectFileInfoForUri,
selectFileInfosByOutpoint, selectFileInfosByOutpoint,
selectDownloadingByOutpoint, selectDownloadingByOutpoint,
@ -26,6 +25,8 @@ import {
creditsToString, creditsToString,
doError, doError,
} from 'lbry-redux'; } from 'lbry-redux';
import { makeSelectCostInfoForUri } from 'lbryinc';
import { makeSelectClientSetting, selectosNotificationsEnabled } from 'redux/selectors/settings'; import { makeSelectClientSetting, selectosNotificationsEnabled } from 'redux/selectors/settings';
import setBadge from 'util/set-badge'; import setBadge from 'util/set-badge';
import analytics from 'analytics'; import analytics from 'analytics';

View file

@ -3,68 +3,11 @@ import * as ACTIONS from 'constants/action_types';
const reducers = {}; const reducers = {};
const defaultState = { const defaultState = {
playingUri: null, playingUri: null,
rewardedContentClaimIds: [],
channelClaimCounts: {}, channelClaimCounts: {},
positions: {}, positions: {},
history: [], history: [],
}; };
reducers[ACTIONS.FETCH_FEATURED_CONTENT_STARTED] = state =>
Object.assign({}, state, {
fetchingFeaturedContent: true,
});
reducers[ACTIONS.FETCH_FEATURED_CONTENT_COMPLETED] = (state, action) => {
const { uris, success } = action.data;
return Object.assign({}, state, {
fetchingFeaturedContent: false,
fetchingFeaturedContentFailed: !success,
featuredUris: uris,
});
};
reducers[ACTIONS.FETCH_REWARD_CONTENT_COMPLETED] = (state, action) => {
const { claimIds } = action.data;
return Object.assign({}, state, {
rewardedContentClaimIds: claimIds,
});
};
reducers[ACTIONS.RESOLVE_URIS_STARTED] = (state, action) => {
const { uris } = action.data;
const oldResolving = state.resolvingUris || [];
const newResolving = Object.assign([], oldResolving);
uris.forEach(uri => {
if (!newResolving.includes(uri)) {
newResolving.push(uri);
}
});
return Object.assign({}, state, {
resolvingUris: newResolving,
});
};
reducers[ACTIONS.RESOLVE_URIS_COMPLETED] = (state, action) => {
const { resolveInfo } = action.data;
const channelClaimCounts = Object.assign({}, state.channelClaimCounts);
Object.entries(resolveInfo).forEach(([uri, { certificate, claimsInChannel }]) => {
if (certificate && !Number.isNaN(claimsInChannel)) {
channelClaimCounts[uri] = claimsInChannel;
}
});
return Object.assign({}, state, {
channelClaimCounts,
resolvingUris: (state.resolvingUris || []).filter(uri => !resolveInfo[uri]),
});
};
reducers[ACTIONS.SET_PLAYING_URI] = (state, action) => reducers[ACTIONS.SET_PLAYING_URI] = (state, action) =>
Object.assign({}, state, { Object.assign({}, state, {
playingUri: action.data.uri, playingUri: action.data.uri,

View file

@ -3,16 +3,20 @@ import availabilityReducer from 'redux/reducers/availability';
import contentReducer from 'redux/reducers/content'; import contentReducer from 'redux/reducers/content';
import { import {
claimsReducer, claimsReducer,
costInfoReducer,
fileInfoReducer, fileInfoReducer,
searchReducer, searchReducer,
walletReducer, walletReducer,
notificationsReducer, notificationsReducer,
blacklistReducer,
} from 'lbry-redux'; } from 'lbry-redux';
import {
userReducer,
rewardsReducer,
costInfoReducer,
blacklistReducer,
homepageReducer,
} from 'lbryinc';
import navigationReducer from 'redux/reducers/navigation'; import navigationReducer from 'redux/reducers/navigation';
import settingsReducer from 'redux/reducers/settings'; import settingsReducer from 'redux/reducers/settings';
import { userReducer, rewardsReducer } from 'lbryinc';
import shapeShiftReducer from 'redux/reducers/shape_shift'; import shapeShiftReducer from 'redux/reducers/shape_shift';
import subscriptionsReducer from 'redux/reducers/subscriptions'; import subscriptionsReducer from 'redux/reducers/subscriptions';
import publishReducer from 'redux/reducers/publish'; import publishReducer from 'redux/reducers/publish';
@ -69,6 +73,7 @@ const reducers = combineReducers({
publish: publishReducer, publish: publishReducer,
notifications: notificationsReducer, notifications: notificationsReducer,
blacklist: blacklistReducer, blacklist: blacklistReducer,
homepage: homepageReducer,
}); });
const bulkThunk = createBulkThunkMiddleware(); const bulkThunk = createBulkThunkMiddleware();

View file

@ -3,7 +3,9 @@ const merge = require('webpack-merge');
const { DefinePlugin, ProvidePlugin } = require('webpack'); const { DefinePlugin, ProvidePlugin } = require('webpack');
const { getIfUtils, removeEmpty } = require('webpack-config-utils'); const { getIfUtils, removeEmpty } = require('webpack-config-utils');
const { ifProduction } = getIfUtils(process.env.NODE_ENV || 'development'); const NODE_ENV = process.env.NODE_ENV || 'development';
const { ifProduction } = getIfUtils(NODE_ENV);
const UI_ROOT = path.resolve(__dirname, 'src/ui/'); const UI_ROOT = path.resolve(__dirname, 'src/ui/');
const STATIC_ROOT = path.resolve(__dirname, 'static/'); const STATIC_ROOT = path.resolve(__dirname, 'static/');
@ -76,8 +78,9 @@ const baseConfig = {
}), }),
new DefinePlugin({ new DefinePlugin({
__static: `"${path.join(__dirname, 'static').replace(/\\/g, '\\\\')}"`, __static: `"${path.join(__dirname, 'static').replace(/\\/g, '\\\\')}"`,
'process.env.NODE_ENV': JSON.stringify(process.env.NODE_ENV), 'process.env.NODE_ENV': JSON.stringify(NODE_ENV),
'process.env.SDK_API_URL': JSON.stringify(process.env.SDK_API_URL), 'process.env.SDK_API_URL': JSON.stringify(process.env.SDK_API_URL),
'process.env.LBRY_API_URL': JSON.stringify(process.env.LBRY_API_URL),
}), }),
], ],
}; };

View file

@ -5962,28 +5962,19 @@ lazy-val@^1.0.3, lazy-val@^1.0.4:
tar-stream "^1.6.2" tar-stream "^1.6.2"
zstd-codec "^0.1.1" zstd-codec "^0.1.1"
lbry-redux@lbryio/lbry-redux#406e1970b9d5594faf0407100c9bbed45d904cdf: lbry-redux@lbryio/lbry-redux#71dda665759ead555fef0bccef3a0ae653cb4509:
version "0.0.1" version "0.0.1"
resolved "https://codeload.github.com/lbryio/lbry-redux/tar.gz/406e1970b9d5594faf0407100c9bbed45d904cdf" resolved "https://codeload.github.com/lbryio/lbry-redux/tar.gz/71dda665759ead555fef0bccef3a0ae653cb4509"
dependencies: dependencies:
proxy-polyfill "0.1.6" proxy-polyfill "0.1.6"
reselect "^3.0.0" reselect "^3.0.0"
uuid "^3.3.2" uuid "^3.3.2"
lbry-redux@lbryio/lbry-redux#76d8bbef9640bf8ea5c4f45550e55b77d3944ee3: lbryinc@lbryio/lbryinc#b54e90f3d497f0d91b3bb94dab063f0696775169:
version "0.0.1" version "0.0.1"
resolved "https://codeload.github.com/lbryio/lbry-redux/tar.gz/76d8bbef9640bf8ea5c4f45550e55b77d3944ee3" resolved "https://codeload.github.com/lbryio/lbryinc/tar.gz/b54e90f3d497f0d91b3bb94dab063f0696775169"
dependencies:
proxy-polyfill "0.1.6"
reselect "^3.0.0"
uuid "^3.3.2"
lbryinc@lbryio/lbryinc#2334ad53e82c22d6291899785d5292347008f2a9:
version "0.0.1"
resolved "https://codeload.github.com/lbryio/lbryinc/tar.gz/2334ad53e82c22d6291899785d5292347008f2a9"
dependencies: dependencies:
bluebird "^3.5.1" bluebird "^3.5.1"
lbry-redux lbryio/lbry-redux#76d8bbef9640bf8ea5c4f45550e55b77d3944ee3
reselect "^3.0.0" reselect "^3.0.0"
lcid@^1.0.0: lcid@^1.0.0: