38c13cf5ef
## Changes - doHandleSyncComplete: only call doGetAndPopulatePreferences when there is new data. - But for that to work, we'll need to populate preferences at least once. We'll do that in doSignIn. - We can also remove the "sync/prefs ready" mechanism that was mainly meant for Desktop. Then came another problem: while trying to spark changes between 2 tabs, `sync/get` was saying "no change" despite the local and server hash being different. I think it is because the both `sync_hash + sync/get` combo is operating on server data, so the hash is the same. I'm guessing this is why we ended up just running doGetAndPopulatePreferences every time before PR, since this flag wasn't correct in this scenario. - Updated `data.changed` to consider both API results and comparison with local hash.
68 lines
3.1 KiB
JavaScript
68 lines
3.1 KiB
JavaScript
import { hot } from 'react-hot-loader/root';
|
|
import { connect } from 'react-redux';
|
|
import { selectGetSyncErrorMessage, selectSyncFatalError } from 'redux/selectors/sync';
|
|
import { doFetchAccessToken, doUserSetReferrer } from 'redux/actions/user';
|
|
import { selectUser, selectAccessToken, selectUserVerifiedEmail } from 'redux/selectors/user';
|
|
import { selectUnclaimedRewards } from 'redux/selectors/rewards';
|
|
import { doFetchChannelListMine, doFetchCollectionListMine, doResolveUris } from 'redux/actions/claims';
|
|
import { selectMyChannelUrls } from 'redux/selectors/claims';
|
|
import * as SETTINGS from 'constants/settings';
|
|
import { selectSubscriptions } from 'redux/selectors/subscriptions';
|
|
import {
|
|
makeSelectClientSetting,
|
|
selectLanguage,
|
|
selectLoadedLanguages,
|
|
selectThemePath,
|
|
} from 'redux/selectors/settings';
|
|
import {
|
|
selectIsUpgradeAvailable,
|
|
selectAutoUpdateDownloaded,
|
|
selectModal,
|
|
selectActiveChannelClaim,
|
|
selectIsReloadRequired,
|
|
} from 'redux/selectors/app';
|
|
import { selectUploadCount } from 'redux/selectors/publish';
|
|
import { doSetLanguage } from 'redux/actions/settings';
|
|
import { doSyncLoop } from 'redux/actions/sync';
|
|
import { doDownloadUpgradeRequested, doSignIn, doSetActiveChannel, doSetIncognito } from 'redux/actions/app';
|
|
import { doFetchModBlockedList, doFetchCommentModAmIList } from 'redux/actions/comments';
|
|
import App from './view';
|
|
|
|
const select = (state) => ({
|
|
user: selectUser(state),
|
|
accessToken: selectAccessToken(state),
|
|
theme: selectThemePath(state),
|
|
language: selectLanguage(state),
|
|
syncEnabled: makeSelectClientSetting(SETTINGS.ENABLE_SYNC)(state),
|
|
languages: selectLoadedLanguages(state),
|
|
autoUpdateDownloaded: selectAutoUpdateDownloaded(state),
|
|
isUpgradeAvailable: selectIsUpgradeAvailable(state),
|
|
isReloadRequired: selectIsReloadRequired(state),
|
|
syncError: selectGetSyncErrorMessage(state),
|
|
uploadCount: selectUploadCount(state),
|
|
rewards: selectUnclaimedRewards(state),
|
|
isAuthenticated: selectUserVerifiedEmail(state),
|
|
currentModal: selectModal(state),
|
|
syncFatalError: selectSyncFatalError(state),
|
|
activeChannelClaim: selectActiveChannelClaim(state),
|
|
myChannelUrls: selectMyChannelUrls(state),
|
|
subscriptions: selectSubscriptions(state),
|
|
});
|
|
|
|
const perform = (dispatch) => ({
|
|
fetchAccessToken: () => dispatch(doFetchAccessToken()),
|
|
fetchChannelListMine: () => dispatch(doFetchChannelListMine()),
|
|
fetchCollectionListMine: () => dispatch(doFetchCollectionListMine()),
|
|
setLanguage: (language) => dispatch(doSetLanguage(language)),
|
|
signIn: () => dispatch(doSignIn()),
|
|
requestDownloadUpgrade: () => dispatch(doDownloadUpgradeRequested()),
|
|
syncLoop: (noInterval) => dispatch(doSyncLoop(noInterval)),
|
|
setReferrer: (referrer, doClaim) => dispatch(doUserSetReferrer(referrer, doClaim)),
|
|
setActiveChannelIfNotSet: () => dispatch(doSetActiveChannel()),
|
|
setIncognito: () => dispatch(doSetIncognito()),
|
|
fetchModBlockedList: () => dispatch(doFetchModBlockedList()),
|
|
resolveUris: (uris) => dispatch(doResolveUris(uris)),
|
|
fetchModAmIList: () => dispatch(doFetchCommentModAmIList()),
|
|
});
|
|
|
|
export default hot(connect(select, perform)(App));
|