call sync after channel create
This commit is contained in:
parent
90e8c74006
commit
43900dd72f
6 changed files with 11 additions and 135 deletions
|
@ -129,7 +129,7 @@
|
||||||
"husky": "^0.14.3",
|
"husky": "^0.14.3",
|
||||||
"json-loader": "^0.5.4",
|
"json-loader": "^0.5.4",
|
||||||
"lbry-format": "https://github.com/lbryio/lbry-format.git",
|
"lbry-format": "https://github.com/lbryio/lbry-format.git",
|
||||||
"lbry-redux": "lbryio/lbry-redux#cd69946d4ca016c896639aa401d8f6b87d3e410e",
|
"lbry-redux": "lbryio/lbry-redux#6edcf747e10919605b05b905214fe1d3286898e3",
|
||||||
"lbryinc": "lbryio/lbryinc#b8e1708ee4491db342c81576265e1b58f542bedb",
|
"lbryinc": "lbryio/lbryinc#b8e1708ee4491db342c81576265e1b58f542bedb",
|
||||||
"lint-staged": "^7.0.2",
|
"lint-staged": "^7.0.2",
|
||||||
"localforage": "^1.7.1",
|
"localforage": "^1.7.1",
|
||||||
|
|
|
@ -1,7 +1,7 @@
|
||||||
import * as SETTINGS from 'constants/settings';
|
import * as SETTINGS from 'constants/settings';
|
||||||
import { hot } from 'react-hot-loader/root';
|
import { hot } from 'react-hot-loader/root';
|
||||||
import { connect } from 'react-redux';
|
import { connect } from 'react-redux';
|
||||||
import { selectUser, doRewardList, doFetchRewardedContent, doAuthenticate } from 'lbryinc';
|
import { selectUser, doRewardList, doFetchRewardedContent, doFetchAccessToken } from 'lbryinc';
|
||||||
import { doFetchTransactions, doFetchChannelListMine, selectBalance } from 'lbry-redux';
|
import { doFetchTransactions, doFetchChannelListMine, selectBalance } from 'lbry-redux';
|
||||||
import { makeSelectClientSetting, selectThemePath } from 'redux/selectors/settings';
|
import { makeSelectClientSetting, selectThemePath } from 'redux/selectors/settings';
|
||||||
import { selectIsUpgradeAvailable, selectAutoUpdateDownloaded } from 'redux/selectors/app';
|
import { selectIsUpgradeAvailable, selectAutoUpdateDownloaded } from 'redux/selectors/app';
|
||||||
|
@ -21,7 +21,7 @@ const perform = dispatch => ({
|
||||||
fetchRewards: () => dispatch(doRewardList()),
|
fetchRewards: () => dispatch(doRewardList()),
|
||||||
fetchRewardedContent: () => dispatch(doFetchRewardedContent()),
|
fetchRewardedContent: () => dispatch(doFetchRewardedContent()),
|
||||||
fetchTransactions: () => dispatch(doFetchTransactions()),
|
fetchTransactions: () => dispatch(doFetchTransactions()),
|
||||||
fetchAccessToken: () => dispatch(doAuthenticate()),
|
fetchAccessToken: () => dispatch(doFetchAccessToken()),
|
||||||
fetchChannelListMine: () => dispatch(doFetchChannelListMine()),
|
fetchChannelListMine: () => dispatch(doFetchChannelListMine()),
|
||||||
signIn: () => dispatch(doSignIn()),
|
signIn: () => dispatch(doSignIn()),
|
||||||
requestDownloadUpgrade: () => dispatch(doDownloadUpgradeRequested()),
|
requestDownloadUpgrade: () => dispatch(doDownloadUpgradeRequested()),
|
||||||
|
|
|
@ -588,7 +588,9 @@ class SettingsPage extends React.PureComponent<Props, State> {
|
||||||
/>
|
/>
|
||||||
|
|
||||||
{/* @if TARGET='app' */}
|
{/* @if TARGET='app' */}
|
||||||
{/* <FormField
|
{/*
|
||||||
|
Disabling below until we get downloads to work with shared subscriptions code
|
||||||
|
<FormField
|
||||||
type="checkbox"
|
type="checkbox"
|
||||||
name="auto_download"
|
name="auto_download"
|
||||||
onChange={() => setClientSetting(SETTINGS.AUTO_DOWNLOAD, !autoDownload)}
|
onChange={() => setClientSetting(SETTINGS.AUTO_DOWNLOAD, !autoDownload)}
|
||||||
|
|
|
@ -181,109 +181,6 @@ export const doRemoveUnreadSubscription = (channelUri: string, readUri: string)
|
||||||
dispatch(doRemoveUnreadSubscriptions(channelUri, [readUri]));
|
dispatch(doRemoveUnreadSubscriptions(channelUri, [readUri]));
|
||||||
};
|
};
|
||||||
|
|
||||||
<<<<<<< HEAD
|
|
||||||
export const doCheckSubscription = (subscriptionUri: string, shouldNotify?: boolean) => (
|
|
||||||
dispatch: Dispatch,
|
|
||||||
getState: GetState
|
|
||||||
) => {
|
|
||||||
// no dispatching FETCH_CHANNEL_CLAIMS_STARTED; causes loading issues on <SubscriptionsPage>
|
|
||||||
|
|
||||||
const state = getState();
|
|
||||||
const shouldAutoDownload = makeSelectClientSetting(SETTINGS.AUTO_DOWNLOAD)(state);
|
|
||||||
const savedSubscription = state.subscriptions.subscriptions.find(sub => sub.uri === subscriptionUri);
|
|
||||||
|
|
||||||
if (!savedSubscription) {
|
|
||||||
throw Error(`Trying to find new content for ${subscriptionUri} but it doesn't exist in your subscriptions`);
|
|
||||||
}
|
|
||||||
dispatch({
|
|
||||||
type: ACTIONS.FETCH_CHANNEL_CLAIMS_STARTED,
|
|
||||||
data: {
|
|
||||||
uri: subscriptionUri,
|
|
||||||
page: 1,
|
|
||||||
},
|
|
||||||
});
|
|
||||||
// We may be duplicating calls here. Can this logic be baked into doFetchClaimsByChannel?
|
|
||||||
Lbry.claim_search({
|
|
||||||
channel: subscriptionUri,
|
|
||||||
valid_channel_signature: true,
|
|
||||||
order_by: ['release_time'],
|
|
||||||
page: 1,
|
|
||||||
page_size: PAGE_SIZE,
|
|
||||||
}).then(claimListByChannel => {
|
|
||||||
const { items: claimsInChannel } = claimListByChannel;
|
|
||||||
|
|
||||||
// may happen if subscribed to an abandoned channel or an empty channel
|
|
||||||
if (!claimsInChannel || !claimsInChannel.length) {
|
|
||||||
return;
|
|
||||||
}
|
|
||||||
|
|
||||||
dispatch({
|
|
||||||
type: ACTIONS.FETCH_CHANNEL_CLAIMS_COMPLETED,
|
|
||||||
data: {
|
|
||||||
uri: subscriptionUri,
|
|
||||||
claims: claimsInChannel || [],
|
|
||||||
page: 1,
|
|
||||||
},
|
|
||||||
});
|
|
||||||
|
|
||||||
// Determine if the latest subscription currently saved is actually the latest subscription
|
|
||||||
const latestIndex = claimsInChannel.findIndex(claim => claim.permanent_url === savedSubscription.latest);
|
|
||||||
|
|
||||||
// If latest is -1, it is a newly subscribed channel or there have been 10+ claims published since last viewed
|
|
||||||
const latestIndexToNotify = latestIndex === -1 ? 10 : latestIndex;
|
|
||||||
|
|
||||||
// If latest is 0, nothing has changed
|
|
||||||
// Do not download/notify about new content, it would download/notify 10 claims per channel
|
|
||||||
if (latestIndex !== 0 && savedSubscription.latest) {
|
|
||||||
let downloadCount = 0;
|
|
||||||
|
|
||||||
const newUnread = [];
|
|
||||||
claimsInChannel.slice(0, latestIndexToNotify).forEach(claim => {
|
|
||||||
const uri = claim.canonical_url;
|
|
||||||
const shouldDownload =
|
|
||||||
shouldAutoDownload && Boolean(downloadCount < SUBSCRIPTION_DOWNLOAD_LIMIT && !claim.value.fee);
|
|
||||||
|
|
||||||
// Add the new content to the list of "un-read" subscriptions
|
|
||||||
if (shouldNotify) {
|
|
||||||
newUnread.push(uri);
|
|
||||||
}
|
|
||||||
|
|
||||||
if (shouldDownload) {
|
|
||||||
downloadCount += 1;
|
|
||||||
// this fails since something is not resolved/saved somewhere...
|
|
||||||
dispatch(doPlayUri(uri, true, true));
|
|
||||||
}
|
|
||||||
});
|
|
||||||
|
|
||||||
dispatch(
|
|
||||||
doUpdateUnreadSubscriptions(
|
|
||||||
subscriptionUri,
|
|
||||||
newUnread,
|
|
||||||
downloadCount > 0 ? NOTIFICATION_TYPES.DOWNLOADING : NOTIFICATION_TYPES.NOTIFY_ONLY
|
|
||||||
)
|
|
||||||
);
|
|
||||||
}
|
|
||||||
|
|
||||||
// Set the latest piece of content for a channel
|
|
||||||
// This allows the app to know if there has been new content since it was last set
|
|
||||||
const latest = claimsInChannel[0];
|
|
||||||
dispatch(
|
|
||||||
setSubscriptionLatest(
|
|
||||||
{
|
|
||||||
channelName: latest.signing_channel.name,
|
|
||||||
uri: latest.signing_channel.permanent_url,
|
|
||||||
},
|
|
||||||
latest.permanent_url
|
|
||||||
)
|
|
||||||
);
|
|
||||||
|
|
||||||
// calling FETCH_CHANNEL_CLAIMS_COMPLETED after not calling STARTED
|
|
||||||
// means it will delete a non-existent fetchingChannelClaims[uri]
|
|
||||||
});
|
|
||||||
};
|
|
||||||
|
|
||||||
=======
|
|
||||||
>>>>>>> use sdk preference endpoints
|
|
||||||
export const doChannelSubscribe = (subscription: Subscription) => (dispatch: Dispatch, getState: GetState) => {
|
export const doChannelSubscribe = (subscription: Subscription) => (dispatch: Dispatch, getState: GetState) => {
|
||||||
const {
|
const {
|
||||||
settings: { daemonSettings },
|
settings: { daemonSettings },
|
||||||
|
@ -334,30 +231,6 @@ export const doChannelUnsubscribe = (subscription: Subscription) => (dispatch: D
|
||||||
}
|
}
|
||||||
};
|
};
|
||||||
|
|
||||||
<<<<<<< HEAD
|
|
||||||
export const doCheckSubscriptions = () => (dispatch: Dispatch, getState: GetState) => {
|
|
||||||
const state = getState();
|
|
||||||
const subscriptions = selectSubscriptions(state);
|
|
||||||
|
|
||||||
subscriptions.forEach((sub: Subscription) => {
|
|
||||||
dispatch(doCheckSubscription(sub.uri, true));
|
|
||||||
});
|
|
||||||
};
|
|
||||||
|
|
||||||
export const doCheckSubscriptionsInit = () => (dispatch: Dispatch) => {
|
|
||||||
// doCheckSubscriptionsInit is called by doDaemonReady
|
|
||||||
// setTimeout below is a hack to ensure redux is hydrated when subscriptions are checked
|
|
||||||
// this will be replaced with <PersistGate> which requires a package upgrade
|
|
||||||
setTimeout(() => dispatch(doFetchMySubscriptions()), 5000);
|
|
||||||
const checkSubscriptionsTimer = setInterval(() => dispatch(doCheckSubscriptions()), CHECK_SUBSCRIPTIONS_INTERVAL);
|
|
||||||
dispatch({
|
|
||||||
type: ACTIONS.CHECK_SUBSCRIPTIONS_SUBSCRIBE,
|
|
||||||
data: { checkSubscriptionsTimer },
|
|
||||||
});
|
|
||||||
};
|
|
||||||
|
|
||||||
=======
|
|
||||||
>>>>>>> use sdk preference endpoints
|
|
||||||
export const doFetchRecommendedSubscriptions = () => (dispatch: Dispatch) => {
|
export const doFetchRecommendedSubscriptions = () => (dispatch: Dispatch) => {
|
||||||
dispatch({
|
dispatch({
|
||||||
type: ACTIONS.GET_SUGGESTED_SUBSCRIPTIONS_START,
|
type: ACTIONS.GET_SUGGESTED_SUBSCRIPTIONS_START,
|
||||||
|
|
|
@ -105,11 +105,12 @@ history = createHashHistory();
|
||||||
history = createBrowserHistory();
|
history = createBrowserHistory();
|
||||||
// @endif
|
// @endif
|
||||||
|
|
||||||
const sharedStateActions = [
|
const triggerSharedStateActions = [
|
||||||
ACTIONS.CHANNEL_SUBSCRIBE,
|
ACTIONS.CHANNEL_SUBSCRIBE,
|
||||||
ACTIONS.CHANNEL_UNSUBSCRIBE,
|
ACTIONS.CHANNEL_UNSUBSCRIBE,
|
||||||
LBRY_REDUX_ACTIONS.TOGGLE_TAG_FOLLOW,
|
LBRY_REDUX_ACTIONS.TOGGLE_TAG_FOLLOW,
|
||||||
LBRY_REDUX_ACTIONS.TOGGLE_BLOCK_CHANNEL,
|
LBRY_REDUX_ACTIONS.TOGGLE_BLOCK_CHANNEL,
|
||||||
|
LBRY_REDUX_ACTIONS.CREATE_CHANNEL_COMPLETED,
|
||||||
];
|
];
|
||||||
|
|
||||||
/**
|
/**
|
||||||
|
@ -140,7 +141,7 @@ const sharedStateCb = ({ dispatch, getState }) => {
|
||||||
}
|
}
|
||||||
};
|
};
|
||||||
|
|
||||||
const sharedStateMiddleware = buildSharedStateMiddleware(sharedStateActions, sharedStateFilters, sharedStateCb);
|
const sharedStateMiddleware = buildSharedStateMiddleware(triggerSharedStateActions, sharedStateFilters, sharedStateCb);
|
||||||
const rootReducer = createRootReducer(history);
|
const rootReducer = createRootReducer(history);
|
||||||
const persistedReducer = persistReducer(persistOptions, rootReducer);
|
const persistedReducer = persistReducer(persistOptions, rootReducer);
|
||||||
const bulkThunk = createBulkThunkMiddleware();
|
const bulkThunk = createBulkThunkMiddleware();
|
||||||
|
|
|
@ -6862,9 +6862,9 @@ lazy-val@^1.0.3, lazy-val@^1.0.4:
|
||||||
yargs "^13.2.2"
|
yargs "^13.2.2"
|
||||||
zstd-codec "^0.1.1"
|
zstd-codec "^0.1.1"
|
||||||
|
|
||||||
lbry-redux@lbryio/lbry-redux#cd69946d4ca016c896639aa401d8f6b87d3e410e:
|
lbry-redux@lbryio/lbry-redux#6edcf747e10919605b05b905214fe1d3286898e3:
|
||||||
version "0.0.1"
|
version "0.0.1"
|
||||||
resolved "https://codeload.github.com/lbryio/lbry-redux/tar.gz/cd69946d4ca016c896639aa401d8f6b87d3e410e"
|
resolved "https://codeload.github.com/lbryio/lbry-redux/tar.gz/6edcf747e10919605b05b905214fe1d3286898e3"
|
||||||
dependencies:
|
dependencies:
|
||||||
proxy-polyfill "0.1.6"
|
proxy-polyfill "0.1.6"
|
||||||
reselect "^3.0.0"
|
reselect "^3.0.0"
|
||||||
|
|
Loading…
Reference in a new issue