Merge branch 'master' into cleanup

This commit is contained in:
Igor Gassmann 2018-04-21 12:43:43 -04:00
commit 38b239ddb6
9 changed files with 361 additions and 327 deletions

122
dist/bundle.js vendored
View file

@ -79,8 +79,8 @@
Object.defineProperty(exports, "__esModule", {
value: true
});
exports.selectBlocks = exports.selectDraftTransactionError = exports.selectDraftTransactionAddress = exports.selectDraftTransactionAmount = exports.selectDraftTransaction = exports.selectGettingNewAddress = exports.selectReceiveAddress = exports.selectIsSendingSupport = exports.selectIsFetchingTransactions = exports.selectHasTransactions = exports.selectRecentTransactions = exports.selectTransactionItems = exports.selectTransactionsById = exports.selectBalance = exports.makeSelectBlockDate = exports.selectWunderBarAddress = exports.selectSearchUrisByQuery = exports.selectIsSearching = exports.selectSearchValue = exports.selectSearchQuery = exports.makeSelectSearchUris = exports.selectSearchState = exports.selectNavLinks = exports.selectActiveHistoryEntry = exports.selectHistoryStack = exports.selectHistoryIndex = exports.selectIsForwardDisabled = exports.selectIsBackDisabled = exports.selectPathAfterAuth = exports.selectPageTitle = exports.selectHeaderLinks = undefined;
exports.selectCurrentParams = exports.selectCurrentPage = exports.selectCurrentPath = exports.makeSelectCurrentParam = exports.computePageFromPath = exports.selectSearchDownloadUris = exports.selectTotalDownloadProgress = exports.selectDownloadingFileInfos = exports.selectFileInfosDownloaded = exports.selectUrisLoading = exports.selectDownloadingByOutpoint = exports.selectIsFetchingFileListDownloadedOrPublished = exports.selectIsFetchingFileList = exports.selectFileInfosByOutpoint = exports.makeSelectLoadingForUri = exports.makeSelectDownloadingForUri = exports.makeSelectFileInfoForUri = exports.selectFetchingCostInfo = exports.selectCostForCurrentPageUri = exports.selectAllCostInfoByUri = exports.makeSelectCostInfoForUri = exports.makeSelectFetchingCostInfoForUri = exports.selectRewardContentClaimIds = exports.selectChannelClaimCounts = exports.selectPlayingUri = exports.selectFetchingFeaturedUris = exports.selectFeaturedUris = exports.selectResolvingUris = exports.selectMyChannelClaims = exports.selectFetchingMyChannels = exports.selectMyClaimsOutpoints = exports.selectAllMyClaimsByOutpoint = exports.selectMyClaimsWithoutChannels = exports.selectMyClaims = exports.selectPendingClaims = exports.selectIsFetchingClaimListMine = exports.selectAllFetchingChannelClaims = exports.selectMyActiveClaims = exports.selectAbandoningIds = exports.selectMyClaimsRaw = exports.selectAllClaimsByChannel = exports.selectClaimsByUri = exports.selectClaimsById = exports.makeSelectTotalPagesForChannel = exports.makeSelectTotalItemsForChannel = exports.makeSelectIsUriResolving = exports.makeSelectContentTypeForUri = exports.makeSelectTitleForUri = exports.makeSelectMetadataForUri = exports.makeSelectClaimsInChannelForCurrentPage = exports.makeSelectFetchingChannelClaims = exports.makeSelectClaimIsMine = exports.makeSelectClaimForUri = exports.selectNotification = exports.walletReducer = exports.searchReducer = exports.notificationsReducer = exports.fileInfoReducer = exports.costInfoReducer = exports.claimsReducer = exports.formatFullPrice = exports.formatCredits = exports.toQueryString = exports.parseQueryParams = exports.batchActions = exports.doSendSupport = exports.doSetDraftTransactionAddress = exports.doSetDraftTransactionAmount = exports.doSendDraftTransaction = exports.doCheckAddressIsMine = exports.doGetNewAddress = exports.doFetchBlock = exports.doFetchTransactions = exports.doBalanceSubscribe = exports.doUpdateBalance = exports.doUpdateSearchQuery = exports.doSearch = exports.doFetchFileInfosAndPublishedClaims = exports.doFileList = exports.doFetchFileInfo = exports.doFetchCostInfoForUri = exports.doFetchRewardedContent = exports.doFetchFeaturedUris = exports.doResolveUri = exports.doResolveUris = exports.doAbandonClaim = exports.doFetchClaimListMine = exports.doNotify = exports.isURIClaimable = exports.isURIValid = exports.normalizeURI = exports.buildURI = exports.parseURI = exports.regexAddress = exports.regexInvalidURI = exports.Lbryapi = exports.Lbry = exports.SETTINGS = exports.ACTIONS = exports.Notification = undefined;
exports.selectBlocks = exports.selectDraftTransactionError = exports.selectDraftTransactionAddress = exports.selectDraftTransactionAmount = exports.selectDraftTransaction = exports.selectGettingNewAddress = exports.selectReceiveAddress = exports.selectIsSendingSupport = exports.selectIsFetchingTransactions = exports.selectHasTransactions = exports.selectRecentTransactions = exports.selectTransactionItems = exports.selectTransactionsById = exports.selectBalance = exports.makeSelectBlockDate = exports.selectWunderBarAddress = exports.selectSearchUrisByQuery = exports.selectIsSearching = exports.selectSearchValue = exports.selectSearchQuery = exports.makeSelectSearchUris = exports.selectSearchState = exports.selectNavLinks = exports.selectActiveHistoryEntry = exports.selectHistoryStack = exports.selectHistoryIndex = exports.selectIsForwardDisabled = exports.selectIsBackDisabled = exports.selectPathAfterAuth = exports.selectPageTitle = exports.selectHeaderLinks = exports.selectCurrentParams = exports.selectCurrentPage = exports.selectCurrentPath = undefined;
exports.makeSelectCurrentParam = exports.computePageFromPath = exports.selectSearchDownloadUris = exports.selectTotalDownloadProgress = exports.selectDownloadingFileInfos = exports.selectFileInfosDownloaded = exports.selectUrisLoading = exports.selectDownloadingByOutpoint = exports.selectIsFetchingFileListDownloadedOrPublished = exports.selectIsFetchingFileList = exports.selectFileInfosByOutpoint = exports.makeSelectLoadingForUri = exports.makeSelectDownloadingForUri = exports.makeSelectFileInfoForUri = exports.selectFetchingCostInfo = exports.selectCostForCurrentPageUri = exports.selectAllCostInfoByUri = exports.makeSelectCostInfoForUri = exports.makeSelectFetchingCostInfoForUri = exports.selectRewardContentClaimIds = exports.selectChannelClaimCounts = exports.selectPlayingUri = exports.selectFetchingFeaturedUris = exports.selectFeaturedUris = exports.selectResolvingUris = exports.selectMyChannelClaims = exports.selectFetchingMyChannels = exports.selectMyClaimsOutpoints = exports.selectAllMyClaimsByOutpoint = exports.selectMyClaimsWithoutChannels = exports.selectMyClaims = exports.selectPendingClaims = exports.selectIsFetchingClaimListMine = exports.selectAllFetchingChannelClaims = exports.selectMyActiveClaims = exports.selectAbandoningIds = exports.selectMyClaimsRaw = exports.selectAllClaimsByChannel = exports.selectClaimsByUri = exports.selectClaimsById = exports.makeSelectTotalPagesForChannel = exports.makeSelectTotalItemsForChannel = exports.makeSelectIsUriResolving = exports.makeSelectContentTypeForUri = exports.makeSelectTitleForUri = exports.makeSelectMetadataForUri = exports.makeSelectClaimsInChannelForCurrentPage = exports.makeSelectFetchingChannelClaims = exports.makeSelectClaimIsMine = exports.makeSelectClaimForUri = exports.selectSnack = exports.selectNotificationProps = exports.selectNotification = exports.walletReducer = exports.searchReducer = exports.notificationsReducer = exports.fileInfoReducer = exports.costInfoReducer = exports.claimsReducer = exports.formatFullPrice = exports.formatCredits = exports.toQueryString = exports.parseQueryParams = exports.batchActions = exports.doSendSupport = exports.doSetDraftTransactionAddress = exports.doSetDraftTransactionAmount = exports.doSendDraftTransaction = exports.doCheckAddressIsMine = exports.doGetNewAddress = exports.doFetchBlock = exports.doFetchTransactions = exports.doBalanceSubscribe = exports.doUpdateBalance = exports.doUpdateSearchQuery = exports.doSearch = exports.doFetchFileInfosAndPublishedClaims = exports.doFileList = exports.doFetchFileInfo = exports.doFetchCostInfoForUri = exports.doFetchRewardedContent = exports.doFetchFeaturedUris = exports.doResolveUri = exports.doResolveUris = exports.doAbandonClaim = exports.doFetchClaimListMine = exports.doHideNotification = exports.doNotify = exports.isURIClaimable = exports.isURIValid = exports.normalizeURI = exports.buildURI = exports.parseURI = exports.regexAddress = exports.regexInvalidURI = exports.Lbryapi = exports.Lbry = exports.SETTINGS = exports.ACTIONS = exports.Notification = undefined;
var _Notification = __webpack_require__(1);
@ -144,6 +144,12 @@ Object.defineProperty(exports, 'doNotify', {
return _notifications.doNotify;
}
});
Object.defineProperty(exports, 'doHideNotification', {
enumerable: true,
get: function get() {
return _notifications.doHideNotification;
}
});
var _claims = __webpack_require__(5);
@ -393,6 +399,18 @@ Object.defineProperty(exports, 'selectNotification', {
return _notifications3.selectNotification;
}
});
Object.defineProperty(exports, 'selectNotificationProps', {
enumerable: true,
get: function get() {
return _notifications3.selectNotificationProps;
}
});
Object.defineProperty(exports, 'selectSnack', {
enumerable: true,
get: function get() {
return _notifications3.selectSnack;
}
});
var _claims3 = __webpack_require__(15);
@ -948,17 +966,24 @@ exports.selectSearchState = _search3.selectState;
// @flow
// Used for retreiving data from redux store
/*:: export type Notification = {
id: ?string,
title: ?string,
message: string,
type: string,
errorCode: ?number,
error: ?string,
displayType: mixed,
// additional properties for SnackBar
linkText: ?string,
linkTarget: ?string,
};*/
/*:: export type NotificationProps = {
uri: ?string,
};*/
/***/ }),
/* 2 */
@ -1206,7 +1231,12 @@ function isURIClaimable(URI) {
Object.defineProperty(exports, "__esModule", {
value: true
});
var _extends = Object.assign || function (target) { for (var i = 1; i < arguments.length; i++) { var source = arguments[i]; for (var key in source) { if (Object.prototype.hasOwnProperty.call(source, key)) { target[key] = source[key]; } } } return target; }; // @flow
exports.doNotify = doNotify;
exports.doHideNotification = doHideNotification;
var _action_types = __webpack_require__(4);
@ -1220,11 +1250,20 @@ function _interopRequireDefault(obj) { return obj && obj.__esModule ? obj : { de
function _interopRequireWildcard(obj) { if (obj && obj.__esModule) { return obj; } else { var newObj = {}; if (obj != null) { for (var key in obj) { if (Object.prototype.hasOwnProperty.call(obj, key)) newObj[key] = obj[key]; } } newObj.default = obj; return newObj; } }
// @flow
function doNotify(data /*: Notification*/) {
function doNotify(notification /*: Notification*/, notificationProps /*: NotificationProps*/) {
return {
type: ACTIONS.CREATE_NOTIFICATION,
data: data
data: {
notification: notification,
// using this syntax to create an object if notificationProps is undefined
notificationProps: _extends({}, notificationProps)
}
};
}
function doHideNotification() {
return {
type: ACTIONS.DISMISS_NOTIFICATION
};
}
@ -1238,10 +1277,6 @@ function doNotify(data /*: Notification*/) {
Object.defineProperty(exports, "__esModule", {
value: true
});
var OPEN_MODAL = exports.OPEN_MODAL = 'OPEN_MODAL';
var CLOSE_MODAL = exports.CLOSE_MODAL = 'CLOSE_MODAL';
var SHOW_SNACKBAR = exports.SHOW_SNACKBAR = 'SHOW_SNACKBAR';
var REMOVE_SNACKBAR_SNACK = exports.REMOVE_SNACKBAR_SNACK = 'REMOVE_SNACKBAR_SNACK';
var WINDOW_FOCUSED = exports.WINDOW_FOCUSED = 'WINDOW_FOCUSED';
var DAEMON_READY = exports.DAEMON_READY = 'DAEMON_READY';
var DAEMON_VERSION_MATCH = exports.DAEMON_VERSION_MATCH = 'DAEMON_VERSION_MATCH';
@ -1430,6 +1465,10 @@ var CLEAR_PUBLISH_ERROR = exports.CLEAR_PUBLISH_ERROR = 'CLEAR_PUBLISH_ERROR';
var REMOVE_PENDING_PUBLISH = exports.REMOVE_PENDING_PUBLISH = 'REMOVE_PENDING_PUBLISH';
var DO_PREPARE_EDIT = exports.DO_PREPARE_EDIT = 'DO_PREPARE_EDIT';
// Notifications
var CREATE_NOTIFICATION = exports.CREATE_NOTIFICATION = 'CREATE_NOTIFICATION';
var DISMISS_NOTIFICATION = exports.DISMISS_NOTIFICATION = 'DISMISS_NOTIFICATION';
/***/ }),
/* 5 */
/***/ (function(module, exports, __webpack_require__) {
@ -3559,7 +3598,7 @@ var selectSearchDownloadUris = exports.selectSearchDownloadUris = function selec
if (channelName) {
var claim = claimsById[claimId];
if (claim.value) {
if (claim && claim.value) {
uriParams.claimId = claim.value.publisherSignature.certificateId;
} else {
uriParams.claimId = claimId;
@ -4856,21 +4895,36 @@ var defaultState = {
queue: []
};
reducers[ACTIONS.NOTIFICATION_CREATED] = function (state, action) {
reducers[ACTIONS.CREATE_NOTIFICATION] = function (state, action) {
var _action$data = action.data,
title = _action$data.title,
message = _action$data.message,
type = _action$data.type,
errorCode = _action$data.errorCode,
displayType = _action$data.displayType;
notification = _action$data.notification,
notificationProps = _action$data.notificationProps;
var title = notification.title,
message = notification.message,
type = notification.type,
error = notification.error,
displayType = notification.displayType,
id = notification.id;
var uri = notificationProps.uri,
nout = notificationProps.nout,
txid = notificationProps.txid;
var queue = Object.assign([], state.queue);
queue.push({
title: title,
message: message,
type: type,
errorCode: errorCode,
displayType: displayType
notification: {
id: id,
title: title,
message: message,
type: type,
error: error,
displayType: displayType
},
notificationProps: {
uri: uri,
txid: txid,
nout: nout
}
});
return Object.assign({}, state, {
@ -4878,7 +4932,7 @@ reducers[ACTIONS.NOTIFICATION_CREATED] = function (state, action) {
});
};
reducers[ACTIONS.NOTIFICATION_DISPLAYED] = function (state) {
reducers[ACTIONS.DISMISS_NOTIFICATION] = function (state) {
var queue = Object.assign([], state.queue);
queue.shift();
@ -5226,7 +5280,7 @@ function walletReducer() {
Object.defineProperty(exports, "__esModule", {
value: true
});
exports.selectNotification = exports.selectState = undefined;
exports.selectSnack = exports.selectNotificationProps = exports.selectNotification = exports.selectNotificationData = exports.selectState = undefined;
var _reselect = __webpack_require__(17);
@ -5234,10 +5288,28 @@ var selectState = exports.selectState = function selectState(state) {
return state.notifications || {};
};
var selectNotification = exports.selectNotification = (0, _reselect.createSelector)(selectState, function (state) {
var selectNotificationData = exports.selectNotificationData = (0, _reselect.createSelector)(selectState, function (state) {
return state.queue.length > 0 ? state.queue[0] : {};
});
var selectNotification = exports.selectNotification = (0, _reselect.createSelector)(selectNotificationData, function (notificationData) {
return notificationData.notification;
});
var selectNotificationProps = exports.selectNotificationProps = (0, _reselect.createSelector)(selectNotificationData, function (notificationData) {
return notificationData.notificationProps;
});
var selectSnack = exports.selectSnack = (0, _reselect.createSelector)(
// No props for snackbar
selectNotification, function (notification) {
if (notification && notification.displayType) {
return notification.displayType.indexOf('snackbar') > -1 ? notification : undefined;
}
return undefined;
});
/***/ }),
/* 38 */
/***/ (function(module, exports, __webpack_require__) {

View file

@ -1,7 +1,3 @@
export const OPEN_MODAL = 'OPEN_MODAL';
export const CLOSE_MODAL = 'CLOSE_MODAL';
export const SHOW_SNACKBAR = 'SHOW_SNACKBAR';
export const REMOVE_SNACKBAR_SNACK = 'REMOVE_SNACKBAR_SNACK';
export const WINDOW_FOCUSED = 'WINDOW_FOCUSED';
export const DAEMON_READY = 'DAEMON_READY';
export const DAEMON_VERSION_MATCH = 'DAEMON_VERSION_MATCH';
@ -189,3 +185,7 @@ export const PUBLISH_FAIL = 'PUBLISH_FAIL';
export const CLEAR_PUBLISH_ERROR = 'CLEAR_PUBLISH_ERROR';
export const REMOVE_PENDING_PUBLISH = 'REMOVE_PENDING_PUBLISH';
export const DO_PREPARE_EDIT = 'DO_PREPARE_EDIT';
// Notifications
export const CREATE_NOTIFICATION = 'CREATE_NOTIFICATION';
export const DISMISS_NOTIFICATION = 'DISMISS_NOTIFICATION';

View file

@ -23,7 +23,7 @@ export {
} from 'lbryURI';
// actions
export { doNotify } from 'redux/actions/notifications';
export { doNotify, doHideNotification } from 'redux/actions/notifications';
export {
doFetchClaimListMine,
@ -71,7 +71,11 @@ export { searchReducer } from 'redux/reducers/search';
export { walletReducer } from 'redux/reducers/wallet';
// selectors
export { selectNotification } from 'redux/selectors/notifications';
export {
selectNotification,
selectNotificationProps,
selectSnack,
} from 'redux/selectors/notifications';
export {
makeSelectClaimForUri,

View file

@ -2,9 +2,19 @@
import * as ACTIONS from 'constants/action_types';
import Notification from 'types/Notification';
export function doNotify(data: Notification) {
export function doNotify(notification: Notification, notificationProps: NotificationProps) {
return {
type: ACTIONS.CREATE_NOTIFICATION,
data,
data: {
notification,
// using this syntax to create an object if notificationProps is undefined
notificationProps: { ...notificationProps },
},
};
}
export function doHideNotification() {
return {
type: ACTIONS.DISMISS_NOTIFICATION,
};
}

View file

@ -7,15 +7,26 @@ const defaultState = {
queue: [],
};
reducers[ACTIONS.NOTIFICATION_CREATED] = (state, action) => {
const { title, message, type, errorCode, displayType } = action.data;
reducers[ACTIONS.CREATE_NOTIFICATION] = (state, action) => {
const { notification, notificationProps } = action.data;
const { title, message, type, error, displayType, id } = notification;
const { uri, nout, txid } = notificationProps;
const queue = Object.assign([], state.queue);
queue.push({
title,
message,
type,
errorCode,
displayType,
notification: {
id,
title,
message,
type,
error,
displayType,
},
notificationProps: {
uri,
txid,
nout,
},
});
return Object.assign({}, state, {
@ -23,7 +34,7 @@ reducers[ACTIONS.NOTIFICATION_CREATED] = (state, action) => {
});
};
reducers[ACTIONS.NOTIFICATION_DISPLAYED] = state => {
reducers[ACTIONS.DISMISS_NOTIFICATION] = state => {
const queue = Object.assign([], state.queue);
queue.shift();

View file

@ -178,7 +178,7 @@ export const selectSearchDownloadUris = query =>
if (channelName) {
const claim = claimsById[claimId];
if (claim.value) {
if (claim && claim.value) {
uriParams.claimId = claim.value.publisherSignature.certificateId;
} else {
uriParams.claimId = claimId;

View file

@ -2,7 +2,29 @@ import { createSelector } from 'reselect';
export const selectState = state => state.notifications || {};
export const selectNotification = createSelector(
export const selectNotificationData = createSelector(
selectState,
state => (state.queue.length > 0 ? state.queue[0] : {})
);
export const selectNotification = createSelector(
selectNotificationData,
notificationData => notificationData.notification
);
export const selectNotificationProps = createSelector(
selectNotificationData,
notificationData => notificationData.notificationProps
);
export const selectSnack = createSelector(
// No props for snackbar
selectNotification,
notification => {
if (notification && notification.displayType) {
return notification.displayType.indexOf('snackbar') > -1 ? notification : undefined;
}
return undefined;
}
);

View file

@ -1,12 +1,18 @@
// @flow
export type Notification = {
id: ?string,
title: ?string,
message: string,
type: string,
errorCode: ?number,
error: ?string,
displayType: mixed,
// additional properties for SnackBar
linkText: ?string,
linkTarget: ?string,
};
// Used for retreiving data from redux store
export type NotificationProps = {
uri: ?string,
};

475
yarn.lock

File diff suppressed because it is too large Load diff