Test code climate #1058

Closed
IGassmann wants to merge 48 commits from testCodeClimate into master
12 changed files with 1443 additions and 873 deletions

View file

@ -4,7 +4,7 @@
"airbnb", "airbnb",
"plugin:import/electron", "plugin:import/electron",
"plugin:flowtype/recommended", "plugin:flowtype/recommended",
"plugin:prettier/recommended" "prettier"
], ],
"settings": { "settings": {
"import/resolver": { "import/resolver": {
@ -28,6 +28,7 @@
"rules": { "rules": {
"import/no-commonjs": "warn", "import/no-commonjs": "warn",
"import/no-amd": "warn", "import/no-amd": "warn",
"func-names": ["warn", "as-needed"] "func-names": ["warn", "as-needed"],
"prettier/prettier": "error"
} }
} }

1
.gitignore vendored
View file

@ -1,6 +1,7 @@
/node_modules /node_modules
/dist /dist
/build/daemon.ver /build/daemon.ver
/build/daemon.zip
/build/venv /build/venv
*.pyc *.pyc
/static/daemon/lbrynet* /static/daemon/lbrynet*

View file

@ -1,28 +1,43 @@
env: matrix:
global: include:
- TRANSIFEX_USER: api - os: osx
- secure: u6gwnZlPGJLnvpoPPCpUZ+jBPajQuIW1+aq6UGW57z54AUjTAECxaYpqcGTGtDBjYark/yeiso887wP/EmJva7hMHeNMf6uLqwzP3YFsIv/Iv+9c1f4MXbJNgOrEKN834o/BdkD4ifi9CCiH9uPPVYGPx1bvfaxGpcHmQXdW4F4S0uj+jePB257mt+afGiNlz9wET6kWJKNNZf/4BNmefldVNq7h6oTSLsyO1TBhDcvSjatpKIwmXUNQfSUTFWvrtpWUB/m/IzitGuUtrt82vU2fPl7tuH6BHNrNp58MINjFzXXJLC+mMybb2UBDIAuc3+k7vj4J0U2rkcTloxDNCKNmYa1jBogOKBRgGp98Ct7E0V2vuLGAPniUbvBcCGK1wwed7uwDjsz3YNCGxUEcyyWc3OVDgN/up4+gXHxkh9FTpZy8Q3rSZx4Lwj700impBUQIVh/5p7Vgv+bSUdOeVRAMlcP9yT83jX50w9LkJMfICFPNv1tOZ3/SOnnB+JdW/ahpplFI4Z68/fBLttZTeaNcU4f28oJvPer8Wll+Elx5kxwLqLbwVUFNlxTxY1LYnPB7SPjGxrFNy3mVTRq5Pxp1hMiTZF4TlapkfHgR+gEzk2wpcJGmub70tW2baZaJF0jDBWIh7GXV+EGve53BKDhpX2Z6jTK0gkhrSUW1MT8= osx_image: xcode9.2
- secure: h1r9Qzv2xHRQl7nDHcscB4qDv7KlF/ncgHko1YuoY4oLZipBV8mzQXDmn3nlMKwaKOe1/Tty/bjoZexkWict4cwKBzU7/1HtJeMa6nxRICuS6DiVhLUNGZEddK6jQLxeEZFxkFPSCZyjybPWtasF8f8jd0lqqLIL4/FcIVV56aRCKAsUwCbedxi8Vnc19l74xjaQIK82xBFYOQPK078OBovk9DDOnicTjMulUo3/pKEZD1njSdcEhfSRv+MFE+31B/a6lpoLo7twPlyzLMfpo30NlEzIN0TeMAk44e4PV6DYg0wntC2GJ21p4BqMnDGocwnZwm7gpjflzUZdW6hF0esGLcqOdbyJLUb3rNX9AzQmn0p9KwDC3S80peZFxSiuLJGL8eivceVDUK/jwWinu3OHDJ/eO5iMDm9odm2ALemPtrDTSlRNT8HzNCY9PQTU9Dhdm4Q/dGDsRPWibFJSJ/qGKhVgadk2CUEAPua0hB1zZ556PkTGx4R1JDscgFDAkgemzgKl4Z/4qK3xGDoEtz1HmBlvQtn+B/PuhA2essADj0iTDiItxb7AYTA7EzsHEcRMmrbYarZ3Eh2onWy2GOpAGRN5Xl9cBIDbibcSC6BLI1m2PcLABpP7DhUX4bJbsVNSiGesHEU7o9Dgn8Ig09eHW/8F9i0VVoGUZXxKMJ8= language: node_js
node_js: "9"
os: linux env:
dist: xenial - ELECTRON_CACHE=$HOME/.cache/electron
- ELECTRON_BUILDER_CACHE=$HOME/.cache/electron-builder
branches: - os: linux
only: services: docker
- "/^v\\d+\\.\\d+\\.\\d+$/" language: generic
before_cache:
install: - rm -rf $HOME/.cache/electron-builder/wine
- rvm install 2.3.1 cache:
directories:
- node_modules
- $HOME/.cache/electron
- $HOME/.cache/electron-builder
before_install:
- |
if [ "$TRAVIS_OS_NAME" == "osx" ]; then
mkdir -p /tmp/git-lfs && curl -L https://github.com/github/git-lfs/releases/download/v2.3.1/git-lfs-$([ "$TRAVIS_OS_NAME" == "linux" ] && echo "linux" || echo "darwin")-amd64-2.3.1.tar.gz | tar -xz -C /tmp/git-lfs --strip-components 1
export PATH="/tmp/git-lfs:$PATH"
fi
before_script:
- git lfs pull
script: script:
- rvm use 2.3.1 && gem install danger --version '~> 4.0' && danger - |
- FULL_BUILD=true ./build.sh if [ "$TRAVIS_OS_NAME" == "linux" ]; then
docker run --rm \
sudo: required --env-file <(env | grep -iE 'DEBUG|NODE_|ELECTRON_|YARN_|NPM_|CI|CIRCLE|TRAVIS|APPVEYOR_|CSC_|GH_|GITHUB_|BT_|AWS_|STRIP|BUILD_') \
after_success: -v ${PWD}:/project \
- pip install virtualenv -v ~/.cache/electron:/root/.cache/electron \
- virtualenv ~/env -v ~/.cache/electron-builder:/root/.cache/electron-builder \
- source ~/env/bin/activate electronuserland/builder:wine \
- pip install transifex-client /bin/bash -c "yarn --link-duplicates --pure-lockfile && yarn build --linux --win"
- sudo echo $'[https://www.transifex.com]\nhostname = https://www.transifex.com\nusername= '"$TRANSIFEX_USER"$'\npassword = '"$TRANSIFEX_PASSWORD"$'\ntoken = '"$TRANSIFEX_API_TOKEN"$'\n' > ~/.transifexrc else
- tx push -s yarn build
fi
branches:
except:
- "/^v\\d+\\.\\d+\\.\\d+$/"

0
build/build.sh Executable file → Normal file
View file

42
build/downloadDaemon.js Normal file
View file

@ -0,0 +1,42 @@
/* eslint-disable */
const path = require('path');
const fs = require('fs');
const packageJSON = require('../package.json');
const axios = require('axios');
const decompress = require('decompress');
module.exports = function(context) {
const daemonURLTemplate = packageJSON.lbrySettings.lbrynetDaemonUrlTemplate;
const daemonVersion = packageJSON.lbrySettings.lbrynetDaemonVersion;
let currentPlatform = context.platform.toString();
if (currentPlatform === 'mac') currentPlatform = 'macos';
const daemonURL = daemonURLTemplate
.replace(/DAEMONVER/g, daemonVersion)
.replace(/OSNAME/g, currentPlatform);
const tmpZipPath = 'build/daemon.zip';
return new Promise(resolve => {
axios
.request({
responseType: 'arraybuffer',
url: daemonURL,
method: 'get',
headers: {
'Content-Type': 'application/zip',
},
})
.then(result => {
fs.writeFileSync(tmpZipPath, result.data);
return true;
})
.then(() => {
return decompress(tmpZipPath, 'static/daemon', {
filter: file => path.basename(file.path).replace(path.extname(file.path), '') === 'lbrynet-daemon',
});
})
.then(() => {
return resolve(true);
});
});
};

View file

@ -1,11 +1,8 @@
{ {
"appId": "io.lbry.LBRY", "appId": "io.lbry.LBRY",
"publish": { "productName": "LBRY",
"provider": "s3",
"bucket": "releases.lbry.io",
"path": "app/latest"
},
"mac": { "mac": {
"target": "dmg",
"category": "public.app-category.entertainment" "category": "public.app-category.entertainment"
}, },
"dmg": { "dmg": {
@ -32,32 +29,20 @@
}, },
"protocols": [ "protocols": [
{ {
"name": "lbry", "name": "LBRY URI",
"schemes": ["lbry"], "schemes": ["lbry"],
"role": "Viewer" "role": "Viewer"
} }
], ],
"linux": { "linux": {
"target": "deb", "category": "AudioVideo;Video",
"category": "Video",
"desktop": { "desktop": {
"MimeType": "x-scheme-handler/lbry", "MimeType": "x-scheme-handler/lbry;"
"Exec": "/opt/LBRY/lbry %U"
} }
}, },
"deb": {
"depends": [
"gconf2",
"gconf-service",
"libnotify4",
"libappindicator1",
"libxtst6",
"libnss3",
"libsecret-1-0"
]
},
"nsis": { "nsis": {
"perMachine": true "perMachine": true
}, },
"artifactName": "${productName}_${version}_${arch}.${ext}" "beforeBuild": "build/downloadDaemon.js",
"artifactName": "${productName}_${version}.${ext}"
} }

View file

@ -1,14 +1,14 @@
{ {
"name": "LBRY", "name": "lbry-app",
"version": "0.20.0", "version": "0.29.0",
"description": "A browser for the LBRY network, a digital marketplace controlled by its users.", "description": "A browser for the LBRY network, a digital marketplace controlled by its users.",
"homepage": "https://lbry.io/", "homepage": "https://lbry.io/",
"bugs": { "bugs": {
"url": "https://github.com/lbryio/lbry-app/issues" "url": "https://github.com/IGassmann/lbry-app/issues"
}, },
"repository": { "repository": {
"type": "git", "type": "git",
"url": "https://github.com/lbryio/lbry-app" "url": "https://github.com/IGassmann/lbry-app"
}, },
"author": { "author": {
"name": "LBRY Inc.", "name": "LBRY Inc.",
@ -21,6 +21,7 @@
"compile": "electron-webpack && yarn extract-langs", "compile": "electron-webpack && yarn extract-langs",
"build": "yarn compile && electron-builder build", "build": "yarn compile && electron-builder build",
"build:dir": "yarn build -- --dir -c.compression=store -c.mac.identity=null", "build:dir": "yarn build -- --dir -c.compression=store -c.mac.identity=null",
"release": "yarn compile && electron-builder build",
"postinstall": "electron-builder install-app-deps", "postinstall": "electron-builder install-app-deps",
"lint": "eslint 'src/**/*.{js,jsx}' --fix", "lint": "eslint 'src/**/*.{js,jsx}' --fix",
"format": "prettier 'src/**/*.{js,jsx,scss,json}' --write" "format": "prettier 'src/**/*.{js,jsx,scss,json}' --write"
@ -36,13 +37,13 @@
"electron-dl": "^1.6.0", "electron-dl": "^1.6.0",
"electron-log": "^2.2.12", "electron-log": "^2.2.12",
"electron-publisher-s3": "^19.47.0", "electron-publisher-s3": "^19.47.0",
"electron-updater": "^2.16.1", "electron-updater": "^2.18.2",
"formik": "^0.10.4", "formik": "^0.10.4",
"from2": "^2.3.0", "from2": "^2.3.0",
"install": "^0.10.2", "install": "^0.10.2",
"jayson": "^2.0.2", "jayson": "^2.0.2",
"jshashes": "^1.0.7", "jshashes": "^1.0.7",
"keytar-prebuild": "^4.0.4", "keytar-prebuild": "^4.1.1",
"localforage": "^1.5.0", "localforage": "^1.5.0",
"moment": "^2.20.1", "moment": "^2.20.1",
"npm": "^5.5.1", "npm": "^5.5.1",
@ -71,27 +72,29 @@
"y18n": "^4.0.0" "y18n": "^4.0.0"
}, },
"devDependencies": { "devDependencies": {
"babel-eslint": "^8.0.3", "axios": "^0.17.1",
"babel-plugin-module-resolver": "^3.0.0", "babel-eslint": "^8.2.2",
"babel-plugin-module-resolver": "^3.1.0",
"babel-plugin-react-require": "^3.0.0", "babel-plugin-react-require": "^3.0.0",
"babel-polyfill": "^6.20.0", "babel-polyfill": "^6.20.0",
"babel-preset-env": "^1.6.1", "babel-preset-env": "^1.6.1",
"babel-preset-react": "^6.24.1", "babel-preset-react": "^6.24.1",
"babel-preset-stage-2": "^6.18.0", "babel-preset-stage-2": "^6.18.0",
"decompress": "^4.2.0",
"devtron": "^1.4.0", "devtron": "^1.4.0",
"electron": "^1.7.11", "electron": "^1.7.11",
"electron-builder": "^19.49.0", "electron-builder": "^19.56.0",
"electron-devtools-installer": "^2.2.1", "electron-devtools-installer": "^2.2.1",
"electron-webpack": "^1.11.0", "electron-webpack": "^1.13.0",
"eslint": "^4.13.1", "eslint": "^4.18.1",
"eslint-config-airbnb": "^16.1.0", "eslint-config-airbnb": "^16.1.0",
"eslint-config-prettier": "^2.9.0", "eslint-config-prettier": "^2.9.0",
"eslint-import-resolver-webpack": "^0.8.3", "eslint-import-resolver-webpack": "^0.8.4",
"eslint-plugin-flowtype": "^2.40.1", "eslint-plugin-flowtype": "^2.46.1",
"eslint-plugin-import": "^2.8.0", "eslint-plugin-import": "^2.9.0",
"eslint-plugin-jsx-a11y": "^6.0.3", "eslint-plugin-jsx-a11y": "^6.0.3",
"eslint-plugin-prettier": "^2.4.0", "eslint-plugin-prettier": "^2.6.0",
"eslint-plugin-react": "^7.5.1", "eslint-plugin-react": "^7.7.0",
"flow-babel-webpack-plugin": "^1.1.0", "flow-babel-webpack-plugin": "^1.1.0",
"flow-bin": "^0.61.0", "flow-bin": "^0.61.0",
"flow-typed": "^2.2.3", "flow-typed": "^2.2.3",

View file

@ -31,7 +31,7 @@ let rendererWindow;
let tray; let tray;
let daemon; let daemon;
let isQuitting; let isQuitting
const updateRendererWindow = window => { const updateRendererWindow = window => {
rendererWindow = window; rendererWindow = window;
@ -41,7 +41,7 @@ const installExtensions = async () => {
// eslint-disable-next-line import/no-extraneous-dependencies,global-require // eslint-disable-next-line import/no-extraneous-dependencies,global-require
const installer = require('electron-devtools-installer'); const installer = require('electron-devtools-installer');
// eslint-disable-next-line import/no-extraneous-dependencies,global-require // eslint-disable-next-line import/no-extraneous-dependencies,global-require
const devtronExtension = require('devtron'); const devtronExtension = require("devtron");
const forceDownload = !!process.env.UPGRADE_EXTENSIONS; const forceDownload = !!process.env.UPGRADE_EXTENSIONS;
const extensions = ['REACT_DEVELOPER_TOOLS', 'REDUX_DEVTOOLS']; const extensions = ['REACT_DEVELOPER_TOOLS', 'REDUX_DEVTOOLS'];
@ -83,21 +83,30 @@ app.on('activate', () => {
if (!rendererWindow) rendererWindow = createWindow(); if (!rendererWindow) rendererWindow = createWindow();
}); });
app.on('will-quit', (event) => { app.on('will-quit', event => {
if (process.platform === 'win32' && autoUpdateDownloaded && !autoUpdateAccepted && !showingAutoUpdateCloseAlert) { if (
process.platform === 'win32' &&
autoUpdateDownloaded &&
!autoUpdateAccepted &&
!showingAutoUpdateCloseAlert
) {
// We're on Win and have an update downloaded, but the user declined it (or closed // We're on Win and have an update downloaded, but the user declined it (or closed
// the app without accepting it). Now the user is closing the app, so the new update // the app without accepting it). Now the user is closing the app, so the new update
// will install. On Mac this is silent, but on Windows they get a confusing permission // will install. On Mac this is silent, but on Windows they get a confusing permission
// escalation dialog, so we show Windows users a warning dialog first. // escalation dialog, so we show Windows users a warning dialog first.
showingAutoUpdateCloseAlert = true; showingAutoUpdateCloseAlert = true;
dialog.showMessageBox({ dialog.showMessageBox(
type: 'info', {
title: 'LBRY Will Upgrade', type: 'info',
message: 'LBRY has a pending upgrade. Please select "Yes" to install it on the prompt shown after this one.', title: 'LBRY Will Upgrade',
}, () => { message:
app.quit(); 'LBRY has a pending upgrade. Please select "Yes" to install it on the prompt shown after this one.',
}); },
() => {
app.quit();
}
);
event.preventDefault(); event.preventDefault();
return; return;
@ -144,7 +153,7 @@ ipcMain.on('upgrade', (event, installerPath) => {
autoUpdater.on('update-downloaded', () => { autoUpdater.on('update-downloaded', () => {
autoUpdateDownloaded = true; autoUpdateDownloaded = true;
}) });
ipcMain.on('autoUpdateAccepted', () => { ipcMain.on('autoUpdateAccepted', () => {
autoUpdateAccepted = true; autoUpdateAccepted = true;

View file

@ -9,10 +9,14 @@ import lbry from 'lbry';
import React from 'react'; import React from 'react';
import ReactDOM from 'react-dom'; import ReactDOM from 'react-dom';
import { Provider } from 'react-redux'; import { Provider } from 'react-redux';
import { doConditionalAuthNavigate, doDaemonReady, doShowSnackBar, doAutoUpdate } from 'redux/actions/app'; import {
import { doUpdateIsNightAsync } from 'redux/actions/settings'; doConditionalAuthNavigate,
doDaemonReady,
doShowSnackBar,
doAutoUpdate,
} from 'redux/actions/app';
import { doNavigate } from 'redux/actions/navigation'; 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 { doUserEmailVerify } from 'redux/actions/user';
import 'scss/all.scss'; import 'scss/all.scss';
import store from 'store'; import store from 'store';
@ -20,12 +24,7 @@ import app from './app';
const { autoUpdater } = remote.require('electron-updater'); const { autoUpdater } = remote.require('electron-updater');
autoUpdater.logger = remote.require("electron-log"); 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) => { ipcRenderer.on('open-uri-requested', (event, uri, newSession) => {
if (uri && uri.startsWith('lbry://')) { if (uri && uri.startsWith('lbry://')) {
@ -100,22 +99,21 @@ document.addEventListener('click', event => {
}); });
const init = () => { const init = () => {
autoUpdater.on("update-downloaded", () => { autoUpdater.on('update-downloaded', () => {
app.store.dispatch(doAutoUpdate());
});
autoUpdater.on('update-available', () => {
console.log('Update available');
});
autoUpdater.on('update-not-available', () => {
console.log('Update not available');
});
autoUpdater.on('update-downloaded', () => {
console.log('Update downloaded');
app.store.dispatch(doAutoUpdate()); app.store.dispatch(doAutoUpdate());
}); });
if (["win32", "darwin"].includes(process.platform)) {
autoUpdater.on("update-available", () => {
console.log("Update available");
});
autoUpdater.on("update-not-available", () => {
console.log("Update not available");
});
autoUpdater.on("update-downloaded", () => {
console.log("Update downloaded");
app.store.dispatch(doAutoUpdate());
});
}
app.store.dispatch(doUpdateIsNightAsync()); app.store.dispatch(doUpdateIsNightAsync());
app.store.dispatch(doDownloadLanguages()); app.store.dispatch(doDownloadLanguages());

View file

@ -10,12 +10,11 @@ import { doAuthNavigate } from 'redux/actions/navigation';
import { doFetchDaemonSettings } from 'redux/actions/settings'; import { doFetchDaemonSettings } from 'redux/actions/settings';
import { doAuthenticate } from 'redux/actions/user'; import { doAuthenticate } from 'redux/actions/user';
import { doBalanceSubscribe } from 'redux/actions/wallet'; import { doBalanceSubscribe } from 'redux/actions/wallet';
import { doPause } from "redux/actions/media"; import { doPause } from 'redux/actions/media';
import { import {
selectCurrentModal, selectCurrentModal,
selectIsUpgradeSkipped, selectIsUpgradeSkipped,
selectRemoteVersion,
selectUpdateUrl, selectUpdateUrl,
selectUpgradeDownloadItem, selectUpgradeDownloadItem,
selectUpgradeDownloadPath, selectUpgradeDownloadPath,
@ -84,23 +83,19 @@ export function doDownloadUpgradeRequested() {
const autoUpdateDeclined = selectAutoUpdateDeclined(state); const autoUpdateDeclined = selectAutoUpdateDeclined(state);
if (['win32', 'darwin'].includes(process.platform)) { // electron-updater behavior if (autoUpdateDeclined) {
if (autoUpdateDeclined) { // The user declined an update before, so show the "confirm" dialog
// The user declined an update before, so show the "confirm" dialog dispatch({
dispatch({ type: ACTIONS.OPEN_MODAL,
type: ACTIONS.OPEN_MODAL, data: { modal: MODALS.AUTO_UPDATE_CONFIRM },
data: { modal: MODALS.AUTO_UPDATE_CONFIRM }, });
}); } else {
} else { // The user was never shown the original update dialog (e.g. because they were
// The user was never shown the original update dialog (e.g. because they were // watching a video). So show the inital "update downloaded" dialog.
// watching a video). So show the inital "update downloaded" dialog. dispatch({
dispatch({ type: ACTIONS.OPEN_MODAL,
type: ACTIONS.OPEN_MODAL, data: { modal: MODALS.AUTO_UPDATE_DOWNLOADED },
data: { modal: MODALS.AUTO_UPDATE_DOWNLOADED }, });
});
}
} else { // Old behavior for Linux
dispatch(doDownloadUpgrade());
} }
}; };
} }
@ -145,8 +140,7 @@ export function doDownloadUpgrade() {
} }
export function doAutoUpdate() { export function doAutoUpdate() {
return function(dispatch, getState) { return function(dispatch) {
const state = getState();
dispatch({ dispatch({
type: ACTIONS.AUTO_UPDATE_DOWNLOADED, type: ACTIONS.AUTO_UPDATE_DOWNLOADED,
}); });
@ -159,12 +153,11 @@ export function doAutoUpdate() {
} }
export function doAutoUpdateDeclined() { export function doAutoUpdateDeclined() {
return function(dispatch, getState) { return function(dispatch) {
const state = getState();
dispatch({ dispatch({
type: ACTIONS.AUTO_UPDATE_DECLINED, type: ACTIONS.AUTO_UPDATE_DECLINED,
}); });
} };
} }
export function doCancelUpgrade() { export function doCancelUpgrade() {
@ -197,47 +190,13 @@ export function doCheckUpgradeAvailable() {
type: ACTIONS.CHECK_UPGRADE_START, type: ACTIONS.CHECK_UPGRADE_START,
}); });
if (["win32", "darwin"].includes(process.platform)) { // On Windows and Mac, updates happen silently through
// On Windows and Mac, updates happen silently through // electron-updater.
// electron-updater. const autoUpdateDeclined = selectAutoUpdateDeclined(state);
const autoUpdateDeclined = selectAutoUpdateDeclined(state);
if (!autoUpdateDeclined) { if (!autoUpdateDeclined) {
autoUpdater.checkForUpdates(); autoUpdater.checkForUpdates();
}
return;
} }
const success = ({ remoteVersion, upgradeAvailable }) => {
dispatch({
type: ACTIONS.CHECK_UPGRADE_SUCCESS,
data: {
upgradeAvailable,
remoteVersion,
},
});
if (
upgradeAvailable &&
!selectCurrentModal(state) &&
(!selectIsUpgradeSkipped(state) || remoteVersion !== selectRemoteVersion(state))
) {
dispatch({
type: ACTIONS.OPEN_MODAL,
data: {
modal: MODALS.UPGRADE,
},
});
}
};
const fail = () => {
dispatch({
type: ACTIONS.CHECK_UPGRADE_FAIL,
});
};
Lbry.getAppVersionInfo().then(success, fail);
}; };
} }

View file

@ -2,7 +2,6 @@ import * as ACTIONS from 'constants/action_types';
import * as SETTINGS from 'constants/settings'; import * as SETTINGS from 'constants/settings';
import Fs from 'fs'; import Fs from 'fs';
import Http from 'http'; import Http from 'http';
import Lbry from 'lbry'; import Lbry from 'lbry';
import moment from 'moment'; 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() { export function doUpdateIsNightAsync() {
return dispatch => { return dispatch => {
dispatch(doUpdateIsNight()); 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) { export function doDownloadLanguage(langFile) {
return dispatch => { return dispatch => {
const destinationPath = `${app.i18n.directory}/${langFile}`; const destinationPath = `${app.i18n.directory}/${langFile}`;

1945
yarn.lock

File diff suppressed because it is too large Load diff