2019-09-26 12:07:11 -04:00
|
|
|
import * as SETTINGS from 'constants/settings';
|
2019-03-05 00:24:03 -06:00
|
|
|
import { hot } from 'react-hot-loader/root';
|
2017-12-21 18:08:54 -03:00
|
|
|
import { connect } from 'react-redux';
|
2020-01-14 15:44:07 -05:00
|
|
|
import {
|
|
|
|
selectUser,
|
|
|
|
selectAccessToken,
|
|
|
|
doFetchAccessToken,
|
|
|
|
selectGetSyncErrorMessage,
|
|
|
|
selectUploadCount,
|
|
|
|
selectUnclaimedRewards,
|
|
|
|
doUserSetReferrer,
|
|
|
|
} from 'lbryinc';
|
2019-10-24 11:48:58 -04:00
|
|
|
import { doFetchTransactions, doFetchChannelListMine } from 'lbry-redux';
|
2019-11-08 15:51:42 -05:00
|
|
|
import { makeSelectClientSetting, selectLoadedLanguages, selectThemePath } from 'redux/selectors/settings';
|
2019-09-22 21:56:43 -04:00
|
|
|
import { selectIsUpgradeAvailable, selectAutoUpdateDownloaded } from 'redux/selectors/app';
|
2019-11-08 15:51:42 -05:00
|
|
|
import { doSetLanguage } from 'redux/actions/settings';
|
2020-01-14 15:44:07 -05:00
|
|
|
import {
|
|
|
|
doDownloadUpgradeRequested,
|
|
|
|
doSignIn,
|
|
|
|
doSyncWithPreferences,
|
|
|
|
doGetAndPopulatePreferences,
|
2020-03-09 19:46:37 -04:00
|
|
|
doAnalyticsTagSync,
|
2020-01-14 15:44:07 -05:00
|
|
|
} from 'redux/actions/app';
|
2017-12-21 18:08:54 -03:00
|
|
|
import App from './view';
|
2017-04-07 12:15:22 +07:00
|
|
|
|
2018-03-26 14:32:43 -07:00
|
|
|
const select = state => ({
|
2017-07-27 21:13:12 -04:00
|
|
|
user: selectUser(state),
|
2020-01-14 15:44:07 -05:00
|
|
|
accessToken: selectAccessToken(state),
|
2018-10-19 11:27:14 -04:00
|
|
|
theme: selectThemePath(state),
|
2019-09-04 17:43:37 -04:00
|
|
|
language: makeSelectClientSetting(SETTINGS.LANGUAGE)(state),
|
2019-11-08 15:51:42 -05:00
|
|
|
languages: selectLoadedLanguages(state),
|
2019-09-22 21:56:43 -04:00
|
|
|
autoUpdateDownloaded: selectAutoUpdateDownloaded(state),
|
|
|
|
isUpgradeAvailable: selectIsUpgradeAvailable(state),
|
2019-10-15 17:23:51 -04:00
|
|
|
syncEnabled: makeSelectClientSetting(SETTINGS.ENABLE_SYNC)(state),
|
2019-10-22 13:57:32 -04:00
|
|
|
syncError: selectGetSyncErrorMessage(state),
|
2019-10-10 20:37:18 -04:00
|
|
|
uploadCount: selectUploadCount(state),
|
2020-01-14 15:44:07 -05:00
|
|
|
rewards: selectUnclaimedRewards(state),
|
2017-07-27 21:13:12 -04:00
|
|
|
});
|
2017-04-07 12:15:22 +07:00
|
|
|
|
2017-06-05 21:21:55 -07:00
|
|
|
const perform = dispatch => ({
|
2020-03-09 19:46:37 -04:00
|
|
|
analyticsTagSync: () => dispatch(doAnalyticsTagSync()),
|
2019-11-01 13:27:01 -04:00
|
|
|
fetchTransactions: (page, pageSize) => dispatch(doFetchTransactions(page, pageSize)),
|
2019-08-06 12:53:59 -04:00
|
|
|
fetchAccessToken: () => dispatch(doFetchAccessToken()),
|
2019-09-26 12:28:08 -04:00
|
|
|
fetchChannelListMine: () => dispatch(doFetchChannelListMine()),
|
2019-11-08 15:51:42 -05:00
|
|
|
setLanguage: language => dispatch(doSetLanguage(language)),
|
2019-10-01 00:53:33 -04:00
|
|
|
signIn: () => dispatch(doSignIn()),
|
2019-09-22 21:56:43 -04:00
|
|
|
requestDownloadUpgrade: () => dispatch(doDownloadUpgradeRequested()),
|
2019-10-15 17:23:51 -04:00
|
|
|
checkSync: () => dispatch(doSyncWithPreferences()),
|
2019-12-11 15:09:27 -05:00
|
|
|
updatePreferences: () => dispatch(doGetAndPopulatePreferences()),
|
2020-01-14 15:44:07 -05:00
|
|
|
setReferrer: (referrer, doClaim) => dispatch(doUserSetReferrer(referrer, doClaim)),
|
2017-06-05 21:21:55 -07:00
|
|
|
});
|
2017-04-07 12:15:22 +07:00
|
|
|
|
2019-03-05 00:24:03 -06:00
|
|
|
export default hot(
|
|
|
|
connect(
|
|
|
|
select,
|
|
|
|
perform
|
|
|
|
)(App)
|
|
|
|
);
|