Test code climate #1058

Closed
IGassmann wants to merge 48 commits from testCodeClimate into master
2 changed files with 15 additions and 20 deletions
Showing only changes of commit 19a30cf938 - Show all commits

View file

@ -16,7 +16,7 @@ import {
doAutoUpdate,
} from 'redux/actions/app';
import { doNavigate } from 'redux/actions/navigation';
import { doDownloadLanguages } from 'redux/actions/settings';
import { doDownloadLanguages, doUpdateIsNightAsync } from 'redux/actions/settings';
import { doUserEmailVerify } from 'redux/actions/user';
import 'scss/all.scss';
import store from 'store';
@ -26,11 +26,6 @@ const { autoUpdater } = remote.require('electron-updater');
autoUpdater.logger = remote.require('electron-log');
// window.addEventListener('contextmenu', event => {
// contextMenu(remote.getCurrentWindow(), event.x, event.y, app.env === 'development');
// event.preventDefault();
// });
ipcRenderer.on('open-uri-requested', (event, uri, newSession) => {
if (uri && uri.startsWith('lbry://')) {
if (uri.startsWith('lbry://?verify=')) {

View file

@ -2,7 +2,6 @@ import * as ACTIONS from 'constants/action_types';
import * as SETTINGS from 'constants/settings';
import Fs from 'fs';
import Http from 'http';
import Lbry from 'lbry';
import moment from 'moment';
@ -54,6 +53,20 @@ export function doGetThemes() {
};
}
export function doUpdateIsNight() {
const momentNow = moment();
return {
type: ACTIONS.UPDATE_IS_NIGHT,
data: {
isNight: (() => {
const startNightMoment = moment('19:00', 'HH:mm');
const endNightMoment = moment('8:00', 'HH:mm');
return !(momentNow.isAfter(endNightMoment) && momentNow.isBefore(startNightMoment));
})(),
},
};
}
export function doUpdateIsNightAsync() {
return dispatch => {
dispatch(doUpdateIsNight());
@ -64,19 +77,6 @@ export function doUpdateIsNightAsync() {
};
}
export function doUpdateIsNight() {
const momentNow = moment();
return {
type: ACTIONS.UPDATE_IS_NIGHT,
data: { isNight: (() => {
const startNightMoment = moment('19:00', 'HH:mm');
const endNightMoment = moment('8:00', 'HH:mm');
return !(momentNow.isAfter(endNightMoment) && momentNow.isBefore(startNightMoment));
})()
},
};
}
export function doDownloadLanguage(langFile) {
return dispatch => {
const destinationPath = `${app.i18n.directory}/${langFile}`;