2019-03-05 07:24:03 +01:00
|
|
|
import { hot } from 'react-hot-loader/root';
|
2017-12-21 22:08:54 +01:00
|
|
|
import { connect } from 'react-redux';
|
2020-10-02 17:03:25 +02:00
|
|
|
import { selectUploadCount } from 'lbryinc';
|
2020-11-12 18:38:28 +01:00
|
|
|
import { selectGetSyncErrorMessage, selectSyncFatalError } from 'redux/selectors/sync';
|
2020-06-15 22:33:03 +02:00
|
|
|
import { doFetchAccessToken, doUserSetReferrer } from 'redux/actions/user';
|
|
|
|
import { selectUser, selectAccessToken, selectUserVerifiedEmail } from 'redux/selectors/user';
|
|
|
|
import { selectUnclaimedRewards } from 'redux/selectors/rewards';
|
2021-02-09 17:05:56 +01:00
|
|
|
import { doFetchChannelListMine, selectMyChannelUrls, SETTINGS } from 'lbry-redux';
|
2020-11-20 14:21:31 +01:00
|
|
|
import {
|
|
|
|
makeSelectClientSetting,
|
|
|
|
selectLanguage,
|
|
|
|
selectLoadedLanguages,
|
|
|
|
selectThemePath,
|
|
|
|
} from 'redux/selectors/settings';
|
2021-02-09 17:05:56 +01:00
|
|
|
import {
|
|
|
|
selectIsUpgradeAvailable,
|
|
|
|
selectAutoUpdateDownloaded,
|
|
|
|
selectModal,
|
2021-02-11 06:12:41 +01:00
|
|
|
selectActiveChannelClaim,
|
2021-02-09 17:05:56 +01:00
|
|
|
} from 'redux/selectors/app';
|
2020-09-11 20:35:50 +02:00
|
|
|
import { doGetWalletSyncPreference, doSetLanguage } from 'redux/actions/settings';
|
2021-01-21 20:50:51 +01:00
|
|
|
import { doSyncLoop } from 'redux/actions/sync';
|
2021-02-09 17:05:56 +01:00
|
|
|
import {
|
|
|
|
doDownloadUpgradeRequested,
|
|
|
|
doSignIn,
|
|
|
|
doGetAndPopulatePreferences,
|
|
|
|
doSetActiveChannel,
|
|
|
|
doSetIncognito,
|
|
|
|
} from 'redux/actions/app';
|
2017-12-21 22:08:54 +01:00
|
|
|
import App from './view';
|
2017-04-07 07:15:22 +02:00
|
|
|
|
2018-03-26 23:32:43 +02:00
|
|
|
const select = state => ({
|
2017-07-28 03:13:12 +02:00
|
|
|
user: selectUser(state),
|
2020-01-14 21:44:07 +01:00
|
|
|
accessToken: selectAccessToken(state),
|
2018-10-19 17:27:14 +02:00
|
|
|
theme: selectThemePath(state),
|
2020-11-20 14:21:31 +01:00
|
|
|
language: selectLanguage(state),
|
2020-09-04 17:02:30 +02:00
|
|
|
syncEnabled: makeSelectClientSetting(SETTINGS.ENABLE_SYNC)(state),
|
2019-11-08 21:51:42 +01:00
|
|
|
languages: selectLoadedLanguages(state),
|
2019-09-23 03:56:43 +02:00
|
|
|
autoUpdateDownloaded: selectAutoUpdateDownloaded(state),
|
|
|
|
isUpgradeAvailable: selectIsUpgradeAvailable(state),
|
2019-10-22 19:57:32 +02:00
|
|
|
syncError: selectGetSyncErrorMessage(state),
|
2019-10-11 02:37:18 +02:00
|
|
|
uploadCount: selectUploadCount(state),
|
2020-01-14 21:44:07 +01:00
|
|
|
rewards: selectUnclaimedRewards(state),
|
2020-03-12 02:43:52 +01:00
|
|
|
isAuthenticated: selectUserVerifiedEmail(state),
|
2020-09-18 19:26:00 +02:00
|
|
|
currentModal: selectModal(state),
|
2020-11-12 18:38:28 +01:00
|
|
|
syncFatalError: selectSyncFatalError(state),
|
2021-02-11 06:12:41 +01:00
|
|
|
activeChannelClaim: selectActiveChannelClaim(state),
|
2021-02-09 17:05:56 +01:00
|
|
|
myChannelUrls: selectMyChannelUrls(state),
|
2017-07-28 03:13:12 +02:00
|
|
|
});
|
2017-04-07 07:15:22 +02:00
|
|
|
|
2017-06-06 06:21:55 +02:00
|
|
|
const perform = dispatch => ({
|
2019-08-06 18:53:59 +02:00
|
|
|
fetchAccessToken: () => dispatch(doFetchAccessToken()),
|
2019-09-26 18:28:08 +02:00
|
|
|
fetchChannelListMine: () => dispatch(doFetchChannelListMine()),
|
2019-11-08 21:51:42 +01:00
|
|
|
setLanguage: language => dispatch(doSetLanguage(language)),
|
2019-10-01 06:53:33 +02:00
|
|
|
signIn: () => dispatch(doSignIn()),
|
2019-09-23 03:56:43 +02:00
|
|
|
requestDownloadUpgrade: () => dispatch(doDownloadUpgradeRequested()),
|
2019-12-11 21:09:27 +01:00
|
|
|
updatePreferences: () => dispatch(doGetAndPopulatePreferences()),
|
2020-09-11 20:35:50 +02:00
|
|
|
getWalletSyncPref: () => dispatch(doGetWalletSyncPreference()),
|
2021-01-21 20:50:51 +01:00
|
|
|
syncLoop: noInterval => dispatch(doSyncLoop(noInterval)),
|
2020-01-14 21:44:07 +01:00
|
|
|
setReferrer: (referrer, doClaim) => dispatch(doUserSetReferrer(referrer, doClaim)),
|
2021-02-09 17:05:56 +01:00
|
|
|
setActiveChannelIfNotSet: () => dispatch(doSetActiveChannel()),
|
|
|
|
setIncognito: () => dispatch(doSetIncognito()),
|
2017-06-06 06:21:55 +02:00
|
|
|
});
|
2017-04-07 07:15:22 +02:00
|
|
|
|
2020-03-12 02:43:52 +01:00
|
|
|
export default hot(connect(select, perform)(App));
|