Merge pull request #2124 from lbryio/lbryinc-modals

remove modals from lbryinc
This commit is contained in:
Sean Yesmunt 2018-11-28 18:29:34 -05:00 committed by GitHub
commit 43a5f7caad
No known key found for this signature in database
GPG key ID: 4AEE18F83AFDEB23
6 changed files with 39 additions and 23 deletions

View file

@ -50,7 +50,7 @@
"hast-util-sanitize": "^1.1.2",
"keytar": "^4.2.1",
"lbry-redux": "lbryio/lbry-redux#1ed2ea8b2de99bbcba652aa7b00478d02df4a290",
"lbryinc": "lbryio/lbryinc#e9508e259fa9bce3b69915b91534516cf5937075",
"lbryinc": "lbryio/lbryinc#50da4e2efd89d79fa6f4794d5dd933db08820ac6",
"localforage": "^1.7.1",
"mammoth": "^1.4.6",
"mime": "^2.3.1",

View file

@ -5,15 +5,21 @@ import SnackBar from 'component/snackBar';
import SplashScreen from 'component/splash';
import moment from 'moment';
import * as ACTIONS from 'constants/action_types';
import * as MODALS from 'constants/modal_types';
import { ipcRenderer, remote, shell } from 'electron';
import React from 'react';
import ReactDOM from 'react-dom';
import { Provider } from 'react-redux';
import { doConditionalAuthNavigate, doDaemonReady, doAutoUpdate } from 'redux/actions/app';
import {
doConditionalAuthNavigate,
doDaemonReady,
doAutoUpdate,
doOpenModal,
} from 'redux/actions/app';
import { doToast, doBlackListedOutpointsSubscribe, isURIValid } from 'lbry-redux';
import { doNavigate } from 'redux/actions/navigation';
import { doDownloadLanguages, doUpdateIsNightAsync } from 'redux/actions/settings';
import { doUserEmailVerify, doAuthenticate, Lbryio } from 'lbryinc';
import { doUserEmailVerify, doAuthenticate, Lbryio, rewards } from 'lbryinc';
import 'scss/all.scss';
import store from 'store';
import pjson from 'package.json';
@ -60,6 +66,14 @@ Lbryio.setOverride(
})
);
rewards.setCallback('claimFirstRewardSuccess', () => {
app.store.dispatch(doOpenModal(MODALS.FIRST_REWARD));
});
rewards.setCallback('rewardApprovalRequired', () => {
app.store.dispatch(doOpenModal(MODALS.REWARD_APPROVAL_REQUIRED));
});
ipcRenderer.on('open-uri-requested', (event, uri, newSession) => {
if (uri && uri.startsWith('lbry://')) {
if (uri.startsWith('lbry://?verify=')) {

View file

@ -5,12 +5,12 @@ import {
selectBalance,
selectCurrentPage,
selectError,
doToast
doToast,
} from 'lbry-redux';
import { makeSelectClientSetting } from 'redux/selectors/settings';
import { selectUser, selectUserIsVerificationCandidate } from 'lbryinc';
import { selectModal } from 'redux/selectors/app';
import { doOpenModal } from 'redux/actions/app';
import ModalRouter from './view';
const select = state => ({
@ -30,6 +30,7 @@ const select = state => ({
const perform = dispatch => ({
showToast: props => dispatch(doToast(props)),
openModal: props => dispatch(doOpenModal(props)),
});
export default connect(

View file

@ -364,9 +364,9 @@ export function doClickCommentButton() {
export function doConditionalAuthNavigate(newSession) {
return (dispatch, getState) => {
const state = getState();
const notification = selectModal(state);
const modal = selectModal(state);
if (newSession || (notification && notification.id !== 'email_collection')) {
if (newSession || (modal && modal.id !== MODALS.EMAIL_COLLECTION)) {
dispatch(doAuthNavigate());
}
};

View file

@ -1,7 +1,7 @@
// @flow
import * as ACTIONS from 'constants/action_types';
import * as MODALS from 'constants/modal_types';
import { remote } from 'electron';
const win = remote.BrowserWindow.getFocusedWindow();
@ -196,14 +196,22 @@ reducers[ACTIONS.ADD_COMMENT] = state =>
reducers[ACTIONS.SHOW_MODAL] = (state, action) =>
Object.assign({}, state, {
modal: action.data.id,
modalProps: action.data.modalProps
})
modalProps: action.data.modalProps,
});
reducers[ACTIONS.HIDE_MODAL] = (state, action) =>
reducers[ACTIONS.HIDE_MODAL] = state =>
Object.assign({}, state, {
modal: null,
modalProps: null,
})
});
// This is fired from the lbryinc module
// Instead of adding callbacks in that module, we can just listen for this event
// There will be no other modals at this time as this is a blocking action
reducers[ACTIONS.AUTHENTICATION_FAILURE] = state =>
Object.assign({}, state, {
modal: MODALS.AUTHENTICATION_FAILURE,
});
export default function reducer(state: AppState = defaultState, action: any) {
const handler = reducers[action.type];

View file

@ -5671,18 +5671,11 @@ lbry-redux@lbryio/lbry-redux#1ed2ea8b2de99bbcba652aa7b00478d02df4a290:
reselect "^3.0.0"
uuid "^3.3.2"
lbry-redux@lbryio/lbry-redux#2375860d6269d0369418879c2531b1d48c4e47f2:
lbryinc@lbryio/lbryinc#50da4e2efd89d79fa6f4794d5dd933db08820ac6:
version "0.0.1"
resolved "https://codeload.github.com/lbryio/lbry-redux/tar.gz/2375860d6269d0369418879c2531b1d48c4e47f2"
resolved "https://codeload.github.com/lbryio/lbryinc/tar.gz/50da4e2efd89d79fa6f4794d5dd933db08820ac6"
dependencies:
proxy-polyfill "0.1.6"
reselect "^3.0.0"
lbryinc@lbryio/lbryinc#e9508e259fa9bce3b69915b91534516cf5937075:
version "0.0.1"
resolved "https://codeload.github.com/lbryio/lbryinc/tar.gz/e9508e259fa9bce3b69915b91534516cf5937075"
dependencies:
lbry-redux lbryio/lbry-redux#2375860d6269d0369418879c2531b1d48c4e47f2
lbry-redux lbryio/lbry-redux#1ed2ea8b2de99bbcba652aa7b00478d02df4a290
reselect "^3.0.0"
lcid@^1.0.0:
@ -9920,7 +9913,7 @@ uuid@3.1.0:
version "3.1.0"
resolved "https://registry.yarnpkg.com/uuid/-/uuid-3.1.0.tgz#3dd3d3e790abc24d7b0d3a034ffababe28ebbc04"
uuid@^3.0.0, uuid@^3.0.1, uuid@^3.1.0, uuid@^3.3.2:
uuid@^3.0.0, uuid@^3.0.1, uuid@^3.1.0:
version "3.3.2"
resolved "https://registry.yarnpkg.com/uuid/-/uuid-3.3.2.tgz#1b4af4955eb3077c501c23872fc6513811587131"