Compare commits
1
Commits
| Author | SHA1 | Date | |
|---|---|---|---|
|
|
bb2ae392cc |
No files matched your search
File renamed without changes.
+14
-3
@@ -417,9 +417,9 @@ process.on('uncaughtException', error => {
|
||||
});
|
||||
|
||||
// Auto updater
|
||||
// autoUpdater.on('download-progress', (p) => {
|
||||
// rendererWindow.webContents.send('download-progress-update', p);
|
||||
// });
|
||||
autoUpdater.on('download-progress', () => {
|
||||
updateState = UPDATE_STATE_DOWNLOADING;
|
||||
});
|
||||
|
||||
autoUpdater.on('update-downloaded', () => {
|
||||
updateState = UPDATE_STATE_DOWNLOADED;
|
||||
@@ -434,6 +434,9 @@ autoUpdater.on('update-downloaded', () => {
|
||||
});
|
||||
|
||||
autoUpdater.on('update-available', () => {
|
||||
if (updateState === UPDATE_STATE_DOWNLOADING) {
|
||||
return;
|
||||
}
|
||||
updateState = UPDATE_STATE_UPDATES_FOUND;
|
||||
});
|
||||
|
||||
@@ -442,6 +445,10 @@ autoUpdater.on('update-not-available', () => {
|
||||
});
|
||||
|
||||
autoUpdater.on('error', () => {
|
||||
if (updateState === UPDATE_STATE_DOWNLOADING) {
|
||||
updateState = UPDATE_STATE_UPDATES_FOUND;
|
||||
return;
|
||||
}
|
||||
updateState = UPDATE_STATE_INIT;
|
||||
});
|
||||
|
||||
@@ -507,6 +514,10 @@ ipcMain.on('autoUpdateAccepted', () => {
|
||||
return;
|
||||
}
|
||||
|
||||
if (updateState !== UPDATE_STATE_UPDATES_FOUND) {
|
||||
return;
|
||||
}
|
||||
|
||||
// If the update hasn't been downloaded,
|
||||
// start downloading it. After it's done, the
|
||||
// event 'update-downloaded' will be triggered,
|
||||
|
||||
+1
-1
@@ -1,6 +1,6 @@
|
||||
{
|
||||
"name": "lbry",
|
||||
"version": "0.53.5-alpha.test7495a3",
|
||||
"version": "0.53.5-alpha.test7495b4",
|
||||
"description": "A browser for the LBRY network, a digital marketplace controlled by its users.",
|
||||
"keywords": [
|
||||
"lbry"
|
||||
|
||||
@@ -2312,5 +2312,8 @@
|
||||
"Free --[legend, unused disk space]--": "Free",
|
||||
"Top content in %language%": "Top content in %language%",
|
||||
"Apply": "Apply",
|
||||
"Disable background": "Disable background",
|
||||
"Installing, please wait...": "Installing, please wait...",
|
||||
"There was an error during installation. Please, try again.": "There was an error during installation. Please, try again.",
|
||||
"--end--": "--end--"
|
||||
}
|
||||
@@ -50,6 +50,7 @@ function ChannelThumbnail(props: Props) {
|
||||
setThumbUploadError,
|
||||
ThumbUploadError,
|
||||
} = props;
|
||||
const [retries, setRetries] = React.useState(3);
|
||||
const [thumbLoadError, setThumbLoadError] = React.useState(ThumbUploadError);
|
||||
const shouldResolve = !isResolving && claim === undefined;
|
||||
const thumbnail = rawThumbnail && rawThumbnail.trim().replace(/^http:\/\//i, 'https://');
|
||||
@@ -58,6 +59,15 @@ function ChannelThumbnail(props: Props) {
|
||||
const channelThumbnail = thumbnailPreview || thumbnail || defaultAvatar;
|
||||
const isGif = channelThumbnail && channelThumbnail.endsWith('gif');
|
||||
const showThumb = (!obscure && !!thumbnail) || thumbnailPreview;
|
||||
const avatarSrc = React.useMemo(() => {
|
||||
if (retries <= 0) {
|
||||
return defaultAvatar;
|
||||
}
|
||||
if (!thumbLoadError) {
|
||||
return channelThumbnail;
|
||||
}
|
||||
return defaultAvatar;
|
||||
}, [retries, thumbLoadError, channelThumbnail, defaultAvatar]);
|
||||
|
||||
// Generate a random color class based on the first letter of the channel name
|
||||
const { channelName } = parseURI(uri);
|
||||
@@ -100,9 +110,10 @@ function ChannelThumbnail(props: Props) {
|
||||
<OptimizedImage
|
||||
alt={__('Channel profile picture')}
|
||||
className={!channelThumbnail ? 'channel-thumbnail__default' : 'channel-thumbnail__custom'}
|
||||
src={(!thumbLoadError && channelThumbnail) || defaultAvatar}
|
||||
src={avatarSrc}
|
||||
loading={noLazyLoad ? undefined : 'lazy'}
|
||||
onError={() => {
|
||||
setRetries((retries) => retries - 1);
|
||||
if (setThumbUploadError) {
|
||||
setThumbUploadError(true);
|
||||
} else {
|
||||
|
||||
@@ -47,7 +47,24 @@ class FileSelector extends React.PureComponent<Props> {
|
||||
};
|
||||
|
||||
handleDirectoryInputSelection = () => {
|
||||
remote.dialog.showOpenDialog({ properties: ['openDirectory'] }).then((result) => {
|
||||
let defaultPath;
|
||||
let properties;
|
||||
let isWin = process.platform === 'win32';
|
||||
let type = this.props.type;
|
||||
|
||||
if (isWin === true) {
|
||||
defaultPath = process.env.HOME || process.env.HOMEPATH || process.env.USERPROFILE;
|
||||
}
|
||||
|
||||
if (type === 'openFile') {
|
||||
properties = ['openFile'];
|
||||
}
|
||||
|
||||
if (type === 'openDirectory') {
|
||||
properties = ['openDirectory'];
|
||||
}
|
||||
|
||||
remote.dialog.showOpenDialog({ properties, defaultPath }).then((result) => {
|
||||
const path = result && result.filePaths[0];
|
||||
if (path) {
|
||||
// $FlowFixMe
|
||||
@@ -82,7 +99,11 @@ class FileSelector extends React.PureComponent<Props> {
|
||||
autoFocus={autoFocus}
|
||||
button="primary"
|
||||
disabled={disabled}
|
||||
onClick={type === 'openDirectory' ? this.handleDirectoryInputSelection : this.fileInputButton}
|
||||
onClick={
|
||||
type === 'openDirectory' || type === 'openFile'
|
||||
? this.handleDirectoryInputSelection
|
||||
: this.fileInputButton
|
||||
}
|
||||
label={__('Browse')}
|
||||
/>
|
||||
}
|
||||
|
||||
@@ -325,6 +325,7 @@ function PublishFile(props: Props) {
|
||||
{showFileUpload && (
|
||||
<>
|
||||
<FileSelector
|
||||
type="openFile"
|
||||
label={__('File')}
|
||||
disabled={disabled}
|
||||
currentPath={currentFile}
|
||||
|
||||
@@ -5,6 +5,7 @@ import { makeSelectClientSetting } from 'redux/selectors/settings';
|
||||
import SettingAppearance from './view';
|
||||
|
||||
const select = (state) => ({
|
||||
disableBackground: makeSelectClientSetting(SETTINGS.DISABLE_BACKGROUND)(state),
|
||||
clock24h: makeSelectClientSetting(SETTINGS.CLOCK_24H)(state),
|
||||
searchInLanguage: makeSelectClientSetting(SETTINGS.SEARCH_IN_LANGUAGE)(state),
|
||||
hideBalance: makeSelectClientSetting(SETTINGS.HIDE_BALANCE)(state),
|
||||
|
||||
@@ -12,6 +12,7 @@ import ThemeSelector from 'component/themeSelector';
|
||||
import homepages from 'homepages';
|
||||
|
||||
type Props = {
|
||||
disableBackground: boolean,
|
||||
clock24h: boolean,
|
||||
searchInLanguage: boolean,
|
||||
hideBalance: boolean,
|
||||
@@ -20,7 +21,7 @@ type Props = {
|
||||
};
|
||||
|
||||
export default function SettingAppearance(props: Props) {
|
||||
const { clock24h, searchInLanguage, hideBalance, setClientSetting, setSearchInLanguage } = props;
|
||||
const { clock24h, disableBackground, searchInLanguage, hideBalance, setClientSetting, setSearchInLanguage } = props;
|
||||
|
||||
return (
|
||||
<>
|
||||
@@ -63,6 +64,14 @@ export default function SettingAppearance(props: Props) {
|
||||
checked={clock24h}
|
||||
/>
|
||||
</SettingsRow>
|
||||
<SettingsRow title={__('Disable background')}>
|
||||
<FormField
|
||||
type="checkbox"
|
||||
name="background"
|
||||
onChange={() => setClientSetting(SETTINGS.DISABLE_BACKGROUND, !disableBackground)}
|
||||
checked={disableBackground}
|
||||
/>
|
||||
</SettingsRow>
|
||||
<SettingsRow title={__('Hide wallet balance in header')}>
|
||||
<FormField
|
||||
type="checkbox"
|
||||
|
||||
@@ -1,16 +1,12 @@
|
||||
import { connect } from 'react-redux';
|
||||
// import { makeSelectCoverForUri, makeSelectAvatarForUri } from 'redux/selectors/claims';
|
||||
import Wallpaper from './view';
|
||||
import * as SETTINGS from 'constants/settings';
|
||||
import { makeSelectClientSetting } from 'redux/selectors/settings';
|
||||
|
||||
/*
|
||||
const select = (state, props) => {
|
||||
if (props.uri && (props.uri.indexOf('@') !== -1 || props.uri.indexOf('#') !== -1)) {
|
||||
return {
|
||||
cover: makeSelectCoverForUri(props.uri)(state),
|
||||
avatar: makeSelectAvatarForUri(props.uri)(state),
|
||||
};
|
||||
} else return {};
|
||||
};
|
||||
*/
|
||||
const select = (state) => ({
|
||||
disableBackground: makeSelectClientSetting(SETTINGS.DISABLE_BACKGROUND)(state),
|
||||
});
|
||||
|
||||
export default connect()(Wallpaper);
|
||||
const perform = {};
|
||||
|
||||
export default connect(select, perform)(Wallpaper);
|
||||
@@ -8,10 +8,11 @@ type Props = {
|
||||
// cover: ?string,
|
||||
// avatar: ?string,
|
||||
reset: ?boolean,
|
||||
disableBackground: ?boolean,
|
||||
};
|
||||
|
||||
const Wallpaper = (props: Props) => {
|
||||
// const { cover, avatar } = props;
|
||||
const { disableBackground } = props;
|
||||
|
||||
/*
|
||||
if (avatar) {
|
||||
@@ -227,12 +228,13 @@ const Wallpaper = (props: Props) => {
|
||||
}}
|
||||
/>
|
||||
*/
|
||||
|
||||
return (
|
||||
<>
|
||||
<div
|
||||
className={'background-image'}
|
||||
style={{
|
||||
backgroundImage: `url(${freeezepeach})`,
|
||||
backgroundImage: disableBackground ? `none` : `url(${freeezepeach})`,
|
||||
}}
|
||||
/>
|
||||
<div className={'theme'} />
|
||||
|
||||
@@ -60,6 +60,7 @@ export const AUTO_UPDATE_DECLINED = 'AUTO_UPDATE_DECLINED';
|
||||
export const AUTO_UPDATE_RESET = 'AUTO_UPDATE_RESET';
|
||||
export const AUTO_UPDATE_FAILED = 'AUTO_UPDATE_FAILED';
|
||||
export const AUTO_UPDATE_DOWNLOADED = 'AUTO_UPDATE_DOWNLOADED';
|
||||
export const AUTO_UPDATE_DOWNLOADING = 'AUTO_UPDATE_DOWNLOADING';
|
||||
export const CLEAR_UPGRADE_TIMER = 'CLEAR_UPGRADE_TIMER';
|
||||
|
||||
// Wallet
|
||||
|
||||
@@ -14,6 +14,7 @@ export const THEME = 'theme';
|
||||
export const THEMES = 'themes';
|
||||
export const AUTOMATIC_DARK_MODE_ENABLED = 'automatic_dark_mode_enabled';
|
||||
export const CLOCK_24H = 'clock_24h';
|
||||
export const DISABLE_BACKGROUND = 'disableBackground';
|
||||
export const AUTOPLAY_MEDIA = 'autoplay';
|
||||
export const AUTOPLAY_NEXT = 'autoplay_next';
|
||||
export const OS_NOTIFICATIONS_ENABLED = 'os_notifications_enabled';
|
||||
|
||||
+5
-1
@@ -22,6 +22,7 @@ import {
|
||||
doUpdateDownloadProgress,
|
||||
doNotifyUpdateAvailable,
|
||||
doShowUpgradeInstallationError,
|
||||
doAutoUpdateDownloading,
|
||||
doAutoUpdateReset,
|
||||
doAutoUpdateFail,
|
||||
} from 'redux/actions/app';
|
||||
@@ -131,12 +132,15 @@ ipcRenderer.on('open-uri-requested', (event, url, newSession) => {
|
||||
handleError();
|
||||
});
|
||||
|
||||
autoUpdater.on('download-progress', () => {
|
||||
app.store.dispatch(doAutoUpdateDownloading());
|
||||
});
|
||||
|
||||
autoUpdater.on('checking-for-update', () => {
|
||||
app.store.dispatch(doAutoUpdateReset());
|
||||
});
|
||||
|
||||
autoUpdater.on('update-available', (e) => {
|
||||
app.store.dispatch(doAutoUpdateReset());
|
||||
app.store.dispatch(doNotifyUpdateAvailable(e));
|
||||
});
|
||||
|
||||
|
||||
@@ -1,10 +1,12 @@
|
||||
import { connect } from 'react-redux';
|
||||
import { doAutoUpdateDeclined, doHideModal } from 'redux/actions/app';
|
||||
import { selectAutoUpdateFailed } from 'redux/selectors/app';
|
||||
import { selectAutoUpdateFailed, selectAutoUpdateDownloading, selectIsUpgradeAvailable } from 'redux/selectors/app';
|
||||
import ModalAutoUpdateDownloaded from './view';
|
||||
|
||||
const select = (state, props) => ({
|
||||
errorWhileUpdating: selectAutoUpdateFailed(state),
|
||||
isDownloading: selectAutoUpdateDownloading(state),
|
||||
isUpdateAvailable: selectIsUpgradeAvailable(state),
|
||||
});
|
||||
|
||||
const perform = (dispatch) => ({
|
||||
|
||||
@@ -1,5 +1,5 @@
|
||||
// @flow
|
||||
import React, { useState } from 'react';
|
||||
import React, { useState, useEffect } from 'react';
|
||||
// @if TARGET='app'
|
||||
import { ipcRenderer } from 'electron';
|
||||
// @endif
|
||||
@@ -10,15 +10,16 @@ type Props = {
|
||||
closeModal: (any) => any,
|
||||
declineAutoUpdate: () => any,
|
||||
errorWhileUpdating: boolean,
|
||||
isDownloading: boolean,
|
||||
isUpdateAvailable: boolean,
|
||||
};
|
||||
|
||||
const ModalAutoUpdateDownloaded = (props: Props) => {
|
||||
const { closeModal, declineAutoUpdate, errorWhileUpdating } = props;
|
||||
const [disabled, setDisabled] = useState(false);
|
||||
const isDownloading = disabled && !errorWhileUpdating;
|
||||
const { closeModal, declineAutoUpdate, errorWhileUpdating, isDownloading, isUpdateAvailable } = props;
|
||||
const [waitingForAutoUpdateResponse, setWaitingForAutoUpdateResponse] = useState(false);
|
||||
|
||||
const handleConfirm = () => {
|
||||
setDisabled(true);
|
||||
setWaitingForAutoUpdateResponse(true);
|
||||
ipcRenderer.send('autoUpdateAccepted');
|
||||
};
|
||||
|
||||
@@ -27,6 +28,10 @@ const ModalAutoUpdateDownloaded = (props: Props) => {
|
||||
closeModal();
|
||||
};
|
||||
|
||||
useEffect(() => {
|
||||
setWaitingForAutoUpdateResponse(false);
|
||||
}, [errorWhileUpdating, isDownloading, isUpdateAvailable]);
|
||||
|
||||
return (
|
||||
<Modal
|
||||
isOpen
|
||||
@@ -34,8 +39,8 @@ const ModalAutoUpdateDownloaded = (props: Props) => {
|
||||
contentLabel={__('Upgrade Downloaded')}
|
||||
title={__('LBRY leveled up')}
|
||||
confirmButtonLabel={isDownloading ? __('Downloading...') : __('Upgrade Now')}
|
||||
abortButtonLabel={__('Not Now')}
|
||||
confirmButtonDisabled={isDownloading}
|
||||
abortButtonLabel={isDownloading ? __('Keep browsing') : __('Not Now')}
|
||||
confirmButtonDisabled={!isUpdateAvailable || isDownloading || waitingForAutoUpdateResponse}
|
||||
onConfirmed={handleConfirm}
|
||||
onAborted={handleAbort}
|
||||
>
|
||||
|
||||
@@ -220,6 +220,12 @@ export function doNotifyUpdateAvailable(e) {
|
||||
};
|
||||
}
|
||||
|
||||
export function doAutoUpdateDownloading() {
|
||||
return {
|
||||
type: ACTIONS.AUTO_UPDATE_DOWNLOADING,
|
||||
};
|
||||
}
|
||||
|
||||
export function doAutoUpdateReset() {
|
||||
return {
|
||||
type: ACTIONS.AUTO_UPDATE_RESET,
|
||||
|
||||
@@ -26,6 +26,7 @@ export type AppState = {
|
||||
hasSignature: boolean,
|
||||
badgeNumber: number,
|
||||
volume: number,
|
||||
autoUpdateDownloading: boolean,
|
||||
autoUpdateDeclined: boolean,
|
||||
autoUpdateFailed: boolean,
|
||||
modalsAllowed: boolean,
|
||||
@@ -63,6 +64,7 @@ const defaultState: AppState = {
|
||||
upgradeSkipped: sessionStorage.getItem('upgradeSkipped') === 'true',
|
||||
// @endif
|
||||
muted: false,
|
||||
autoUpdateDownloading: false,
|
||||
autoUpdateDownloaded: false,
|
||||
autoUpdateDeclined: false,
|
||||
autoUpdateFailed: false,
|
||||
@@ -144,9 +146,18 @@ reducers[ACTIONS.UPGRADE_CANCELLED] = (state) =>
|
||||
modal: null,
|
||||
});
|
||||
|
||||
reducers[ACTIONS.AUTO_UPDATE_DOWNLOADING] = (state) =>
|
||||
Object.assign({}, state, {
|
||||
autoUpdateDownloading: true,
|
||||
autoUpdateDownloaded: false,
|
||||
autoUpdateFailed: false,
|
||||
});
|
||||
|
||||
reducers[ACTIONS.AUTO_UPDATE_DOWNLOADED] = (state) =>
|
||||
Object.assign({}, state, {
|
||||
autoUpdateDownloading: false,
|
||||
autoUpdateDownloaded: true,
|
||||
autoUpdateFailed: false,
|
||||
});
|
||||
|
||||
reducers[ACTIONS.AUTO_UPDATE_DECLINED] = (state) =>
|
||||
@@ -157,10 +168,14 @@ reducers[ACTIONS.AUTO_UPDATE_DECLINED] = (state) =>
|
||||
reducers[ACTIONS.AUTO_UPDATE_RESET] = (state) =>
|
||||
Object.assign({}, state, {
|
||||
autoUpdateFailed: false,
|
||||
autoUpdateDownloading: false,
|
||||
autoUpdateDownloaded: false,
|
||||
});
|
||||
|
||||
reducers[ACTIONS.AUTO_UPDATE_FAILED] = (state) =>
|
||||
Object.assign({}, state, {
|
||||
autoUpdateDownloading: false,
|
||||
autoUpdateDownloaded: false,
|
||||
autoUpdateFailed: true,
|
||||
});
|
||||
|
||||
|
||||
@@ -40,6 +40,7 @@ const defaultState = {
|
||||
[SETTINGS.OS_NOTIFICATIONS_ENABLED]: true,
|
||||
[SETTINGS.AUTOMATIC_DARK_MODE_ENABLED]: false,
|
||||
[SETTINGS.CLOCK_24H]: false,
|
||||
[SETTINGS.DISABLE_BACKGROUND]: false,
|
||||
[SETTINGS.TILE_LAYOUT]: true,
|
||||
[SETTINGS.VIDEO_THEATER_MODE]: false,
|
||||
[SETTINGS.VIDEO_PLAYBACK_RATE]: 1,
|
||||
|
||||
@@ -62,6 +62,8 @@ export const selectAutoUpdateDeclined = createSelector(selectState, (state) => s
|
||||
|
||||
export const selectAutoUpdateFailed = createSelector(selectState, (state) => state.autoUpdateFailed);
|
||||
|
||||
export const selectAutoUpdateDownloading = createSelector(selectState, (state) => state.autoUpdateDownloading);
|
||||
|
||||
export const selectIsUpdateModalDisplayed = createSelector(selectState, (state) => {
|
||||
return [MODALS.AUTO_UPDATE_DOWNLOADED, MODALS.UPGRADE, MODALS.DOWNLOADING].includes(state.modal);
|
||||
});
|
||||
|
||||
Reference in new issue
Block a user