2017-06-06 23:19:12 +02:00
|
|
|
import { createSelector } from "reselect";
|
2017-04-07 07:15:22 +02:00
|
|
|
|
2017-06-06 06:21:55 +02:00
|
|
|
export const _selectState = state => state.app || {};
|
2017-04-07 07:15:22 +02:00
|
|
|
|
|
|
|
export const selectPlatform = createSelector(
|
|
|
|
_selectState,
|
2017-06-06 23:19:12 +02:00
|
|
|
state => state.platform
|
2017-06-06 06:21:55 +02:00
|
|
|
);
|
|
|
|
|
|
|
|
export const selectUpdateUrl = createSelector(selectPlatform, platform => {
|
2017-06-06 23:19:12 +02:00
|
|
|
switch (platform) {
|
|
|
|
case "darwin":
|
|
|
|
return "https://lbry.io/get/lbry.dmg";
|
|
|
|
case "linux":
|
|
|
|
return "https://lbry.io/get/lbry.deb";
|
|
|
|
case "win32":
|
|
|
|
return "https://lbry.io/get/lbry.exe";
|
|
|
|
default:
|
|
|
|
throw "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
|
|
|
|
2017-06-06 06:21:55 +02:00
|
|
|
export const selectVersion = createSelector(_selectState, state => {
|
2017-06-06 23:19:12 +02:00
|
|
|
return state.version;
|
2017-06-06 06:21:55 +02:00
|
|
|
});
|
2017-04-07 07:15:22 +02:00
|
|
|
|
|
|
|
export const selectUpgradeFilename = createSelector(
|
|
|
|
selectPlatform,
|
|
|
|
selectVersion,
|
|
|
|
(platform, version) => {
|
|
|
|
switch (platform) {
|
2017-06-06 23:19:12 +02:00
|
|
|
case "darwin":
|
2017-06-01 08:52:17 +02:00
|
|
|
return `LBRY_${version}.dmg`;
|
2017-06-06 23:19:12 +02:00
|
|
|
case "linux":
|
2017-04-07 07:15:22 +02:00
|
|
|
return `LBRY_${version}_amd64.deb`;
|
2017-06-06 23:19:12 +02: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-06-06 23:19:12 +02:00
|
|
|
throw "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
|
|
|
|
|
|
|
export const selectCurrentModal = createSelector(
|
|
|
|
_selectState,
|
2017-06-06 23:19:12 +02:00
|
|
|
state => state.modal
|
2017-06-06 06:21:55 +02:00
|
|
|
);
|
2017-04-07 07:15:22 +02:00
|
|
|
|
|
|
|
export const selectDownloadProgress = createSelector(
|
|
|
|
_selectState,
|
2017-06-06 23:19:12 +02:00
|
|
|
state => state.downloadProgress
|
2017-06-06 06:21:55 +02:00
|
|
|
);
|
2017-04-07 07:15:22 +02:00
|
|
|
|
|
|
|
export const selectDownloadComplete = createSelector(
|
|
|
|
_selectState,
|
2017-06-06 23:19:12 +02:00
|
|
|
state => state.upgradeDownloadCompleted
|
2017-06-06 06:21:55 +02:00
|
|
|
);
|
|
|
|
|
2017-04-07 07:15:22 +02:00
|
|
|
export const selectUpgradeSkipped = createSelector(
|
|
|
|
_selectState,
|
2017-06-06 23:19:12 +02:00
|
|
|
state => state.upgradeSkipped
|
2017-06-06 06:21:55 +02:00
|
|
|
);
|
2017-04-07 07:15:22 +02:00
|
|
|
|
2017-06-01 08:51:16 +02:00
|
|
|
export const selectUpgradeDownloadPath = createSelector(
|
2017-04-07 07:15:22 +02:00
|
|
|
_selectState,
|
2017-06-06 23:19:12 +02:00
|
|
|
state => state.downloadPath
|
2017-06-06 06:21:55 +02:00
|
|
|
);
|
2017-04-07 07:15:22 +02:00
|
|
|
|
|
|
|
export const selectUpgradeDownloadItem = createSelector(
|
|
|
|
_selectState,
|
2017-06-06 23:19:12 +02:00
|
|
|
state => state.downloadItem
|
2017-06-06 06:21:55 +02:00
|
|
|
);
|
2017-04-07 07:15:22 +02:00
|
|
|
|
2017-05-24 23:53:03 +02:00
|
|
|
export const selectModalExtraContent = createSelector(
|
2017-04-07 07:15:22 +02:00
|
|
|
_selectState,
|
2017-06-06 23:19:12 +02:00
|
|
|
state => state.modalExtraContent
|
2017-06-06 06:21:55 +02:00
|
|
|
);
|
2017-04-22 15:17:01 +02:00
|
|
|
|
|
|
|
export const selectDaemonReady = createSelector(
|
|
|
|
_selectState,
|
2017-06-06 23:19:12 +02:00
|
|
|
state => state.daemonReady
|
2017-06-06 06:21:55 +02:00
|
|
|
);
|
2017-04-29 11:50:29 +02:00
|
|
|
|
2017-07-19 23:05:08 +02:00
|
|
|
export const selectDaemonVersionMatched = createSelector(
|
|
|
|
_selectState,
|
|
|
|
state => state.daemonVersionMatched
|
|
|
|
);
|
|
|
|
|
2017-05-23 09:21:21 +02:00
|
|
|
export const selectSnackBar = createSelector(
|
|
|
|
_selectState,
|
2017-06-06 23:19:12 +02:00
|
|
|
state => state.snackBar || {}
|
2017-06-06 06:21:55 +02:00
|
|
|
);
|
2017-05-23 09:21:21 +02:00
|
|
|
|
|
|
|
export const selectSnackBarSnacks = createSelector(
|
|
|
|
selectSnackBar,
|
2017-06-06 23:19:12 +02:00
|
|
|
snackBar => snackBar.snacks || []
|
2017-06-06 06:21:55 +02:00
|
|
|
);
|
2017-06-24 10:57:37 +02:00
|
|
|
|
|
|
|
export const selectBadgeNumber = createSelector(
|
|
|
|
_selectState,
|
|
|
|
state => state.badgeNumber
|
|
|
|
);
|
2017-07-07 15:15:45 +02:00
|
|
|
|
|
|
|
export const selectCurrentLanguage = createSelector(
|
|
|
|
_selectState,
|
2017-08-19 20:03:51 +02:00
|
|
|
() => app.i18n.getLocale() || "en"
|
2017-08-08 11:36:14 +02:00
|
|
|
);
|
|
|
|
|
2017-08-25 21:05:00 +02:00
|
|
|
export const selectVolume = createSelector(_selectState, state => state.volume);
|