2017-12-21 18:32:51 +01:00
|
|
|
import { createSelector } from 'reselect';
|
2017-04-07 07:15:22 +02:00
|
|
|
|
2017-12-21 18:32:51 +01:00
|
|
|
export const selectState = state => state.app || {};
|
2017-04-07 07:15:22 +02:00
|
|
|
|
2019-03-05 05:46:57 +01:00
|
|
|
export const selectPlatform = createSelector(
|
|
|
|
selectState,
|
|
|
|
state => state.platform
|
|
|
|
);
|
|
|
|
|
|
|
|
export const selectUpdateUrl = createSelector(
|
|
|
|
selectPlatform,
|
|
|
|
platform => {
|
|
|
|
switch (platform) {
|
|
|
|
case 'darwin':
|
2019-03-20 22:43:00 +01:00
|
|
|
return 'https://lbry.com/get/lbry.dmg';
|
2019-03-05 05:46:57 +01:00
|
|
|
case 'linux':
|
2019-03-20 22:43:00 +01:00
|
|
|
return 'https://lbry.com/get/lbry.deb';
|
2019-03-05 05:46:57 +01:00
|
|
|
case 'win32':
|
2019-03-20 22:43:00 +01:00
|
|
|
return 'https://lbry.com/get/lbry.exe';
|
2019-03-05 05:46:57 +01:00
|
|
|
default:
|
|
|
|
throw Error('Unknown platform');
|
|
|
|
}
|
2017-04-07 07:15:22 +02:00
|
|
|
}
|
2019-03-05 05:46:57 +01:00
|
|
|
);
|
2017-04-07 07:15:22 +02:00
|
|
|
|
2018-11-07 23:44:38 +01:00
|
|
|
export const selectHasClickedComment = createSelector(
|
|
|
|
selectState,
|
|
|
|
state => state.hasClickedComment
|
|
|
|
);
|
|
|
|
|
2019-03-05 05:46:57 +01:00
|
|
|
export const selectRemoteVersion = createSelector(
|
|
|
|
selectState,
|
|
|
|
state => state.remoteVersion
|
|
|
|
);
|
2017-11-15 02:50:21 +01:00
|
|
|
|
|
|
|
export const selectIsUpgradeAvailable = createSelector(
|
2017-12-21 18:32:51 +01:00
|
|
|
selectState,
|
2017-11-15 02:50:21 +01:00
|
|
|
state => state.isUpgradeAvailable
|
|
|
|
);
|
2017-04-07 07:15:22 +02:00
|
|
|
|
|
|
|
export const selectUpgradeFilename = createSelector(
|
|
|
|
selectPlatform,
|
2017-11-15 02:50:21 +01:00
|
|
|
selectRemoteVersion,
|
2017-04-07 07:15:22 +02:00
|
|
|
(platform, version) => {
|
|
|
|
switch (platform) {
|
2017-12-21 18:32:51 +01:00
|
|
|
case 'darwin':
|
2017-06-01 08:52:17 +02:00
|
|
|
return `LBRY_${version}.dmg`;
|
2017-12-21 18:32:51 +01:00
|
|
|
case 'linux':
|
2018-06-20 01:02:23 +02:00
|
|
|
return `LBRY_${version}.deb`;
|
2017-12-21 18:32:51 +01:00
|
|
|
case 'win32':
|
2017-06-01 08:52:17 +02:00
|
|
|
return `LBRY_${version}.exe`;
|
2017-04-07 07:15:22 +02:00
|
|
|
default:
|
2017-12-21 18:32:51 +01:00
|
|
|
throw Error('Unknown platform');
|
2017-04-07 07:15:22 +02:00
|
|
|
}
|
|
|
|
}
|
2017-06-06 06:21:55 +02:00
|
|
|
);
|
2017-04-07 07:15:22 +02:00
|
|
|
|
2019-03-05 05:46:57 +01:00
|
|
|
export const selectDownloadProgress = createSelector(
|
|
|
|
selectState,
|
|
|
|
state => state.downloadProgress
|
|
|
|
);
|
2017-04-07 07:15:22 +02:00
|
|
|
|
|
|
|
export const selectDownloadComplete = createSelector(
|
2017-12-21 18:32:51 +01:00
|
|
|
selectState,
|
2017-06-06 23:19:12 +02:00
|
|
|
state => state.upgradeDownloadCompleted
|
2017-06-06 06:21:55 +02:00
|
|
|
);
|
|
|
|
|
2019-03-05 05:46:57 +01:00
|
|
|
export const selectIsUpgradeSkipped = createSelector(
|
|
|
|
selectState,
|
|
|
|
state => state.isUpgradeSkipped
|
|
|
|
);
|
2017-04-07 07:15:22 +02:00
|
|
|
|
2019-03-05 05:46:57 +01:00
|
|
|
export const selectUpgradeDownloadPath = createSelector(
|
|
|
|
selectState,
|
|
|
|
state => state.downloadPath
|
|
|
|
);
|
2017-04-07 07:15:22 +02:00
|
|
|
|
2019-03-05 05:46:57 +01:00
|
|
|
export const selectUpgradeDownloadItem = createSelector(
|
|
|
|
selectState,
|
|
|
|
state => state.downloadItem
|
|
|
|
);
|
2017-04-07 07:15:22 +02:00
|
|
|
|
2018-02-24 01:24:00 +01:00
|
|
|
export const selectAutoUpdateDownloaded = createSelector(
|
|
|
|
selectState,
|
|
|
|
state => state.autoUpdateDownloaded
|
|
|
|
);
|
2018-01-16 06:38:23 +01:00
|
|
|
|
2018-02-24 01:24:00 +01:00
|
|
|
export const selectAutoUpdateDeclined = createSelector(
|
|
|
|
selectState,
|
|
|
|
state => state.autoUpdateDeclined
|
|
|
|
);
|
2018-01-17 11:50:02 +01:00
|
|
|
|
2017-07-19 23:05:08 +02:00
|
|
|
export const selectDaemonVersionMatched = createSelector(
|
2017-12-21 18:32:51 +01:00
|
|
|
selectState,
|
2017-07-19 23:05:08 +02:00
|
|
|
state => state.daemonVersionMatched
|
|
|
|
);
|
|
|
|
|
2019-03-05 05:46:57 +01:00
|
|
|
export const selectVolume = createSelector(
|
|
|
|
selectState,
|
|
|
|
state => state.volume
|
|
|
|
);
|
2018-08-06 19:25:30 +02:00
|
|
|
|
2019-08-02 08:28:14 +02:00
|
|
|
export const selectMute = createSelector(
|
2019-07-27 23:17:25 +02:00
|
|
|
selectState,
|
|
|
|
state => state.muted
|
|
|
|
);
|
|
|
|
|
2019-03-05 05:46:57 +01:00
|
|
|
export const selectUpgradeTimer = createSelector(
|
|
|
|
selectState,
|
|
|
|
state => state.checkUpgradeTimer
|
|
|
|
);
|
2018-09-04 19:23:18 +02:00
|
|
|
|
2019-03-05 05:46:57 +01:00
|
|
|
export const selectModal = createSelector(
|
|
|
|
selectState,
|
|
|
|
state => {
|
|
|
|
if (!state.modal) {
|
|
|
|
return null;
|
|
|
|
}
|
2018-10-29 18:23:53 +01:00
|
|
|
|
2019-03-05 05:46:57 +01:00
|
|
|
return {
|
|
|
|
id: state.modal,
|
|
|
|
modalProps: state.modalProps,
|
|
|
|
};
|
|
|
|
}
|
|
|
|
);
|
2019-01-23 16:38:40 +01:00
|
|
|
|
2019-02-21 23:45:17 +01:00
|
|
|
export const selectSearchOptionsExpanded = createSelector(
|
|
|
|
selectState,
|
|
|
|
state => state.searchOptionsExpanded
|
|
|
|
);
|
2019-07-23 01:43:30 +02:00
|
|
|
|
2020-02-19 07:31:40 +01:00
|
|
|
export const selectWelcomeVersion = createSelector(
|
|
|
|
selectState,
|
|
|
|
state => state.welcomeVersion
|
|
|
|
);
|
|
|
|
|
|
|
|
export const selectAllowAnalytics = createSelector(
|
|
|
|
selectState,
|
|
|
|
state => state.allowAnalytics
|
|
|
|
);
|
|
|
|
|
2019-07-23 01:43:30 +02:00
|
|
|
export const selectScrollStartingPosition = createSelector(
|
|
|
|
selectState,
|
|
|
|
state => state.currentScroll
|
|
|
|
);
|
2019-08-20 14:29:59 +02:00
|
|
|
|
|
|
|
export const selectIsPasswordSaved = createSelector(
|
|
|
|
selectState,
|
|
|
|
state => state.isPasswordSaved
|
|
|
|
);
|