remove old import
This commit is contained in:
parent
f0c6887d37
commit
e00b98226c
1 changed files with 11 additions and 42 deletions
|
@ -1,21 +1,15 @@
|
||||||
// @flow
|
// @flow
|
||||||
import * as ACTIONS from 'constants/action_types';
|
import * as ACTIONS from 'constants/action_types';
|
||||||
import * as NOTIFICATION_TYPES from 'constants/subscriptions';
|
|
||||||
import * as MODALS from 'constants/modal_types';
|
import * as MODALS from 'constants/modal_types';
|
||||||
// @if TARGET='app'
|
// @if TARGET='app'
|
||||||
import { ipcRenderer } from 'electron';
|
import { ipcRenderer } from 'electron';
|
||||||
// @endif
|
// @endif
|
||||||
import { doOpenModal } from 'redux/actions/app';
|
import { doOpenModal } from 'redux/actions/app';
|
||||||
import { push } from 'connected-react-router';
|
|
||||||
import { doUpdateUnreadSubscriptions } from 'redux/actions/subscriptions';
|
|
||||||
import { makeSelectUnreadByChannel } from 'redux/selectors/subscriptions';
|
|
||||||
import {
|
import {
|
||||||
Lbry,
|
Lbry,
|
||||||
SETTINGS,
|
SETTINGS,
|
||||||
makeSelectFileInfoForUri,
|
makeSelectFileInfoForUri,
|
||||||
selectFileInfosByOutpoint,
|
selectFileInfosByOutpoint,
|
||||||
makeSelectChannelForClaimUri,
|
|
||||||
parseURI,
|
|
||||||
doPurchaseUri,
|
doPurchaseUri,
|
||||||
makeSelectUriIsStreamable,
|
makeSelectUriIsStreamable,
|
||||||
selectDownloadingByOutpoint,
|
selectDownloadingByOutpoint,
|
||||||
|
@ -25,7 +19,6 @@ import {
|
||||||
} from 'lbry-redux';
|
} from 'lbry-redux';
|
||||||
import { makeSelectCostInfoForUri, Lbryio } from 'lbryinc';
|
import { makeSelectCostInfoForUri, Lbryio } from 'lbryinc';
|
||||||
import { makeSelectClientSetting, selectosNotificationsEnabled, selectDaemonSettings } from 'redux/selectors/settings';
|
import { makeSelectClientSetting, selectosNotificationsEnabled, selectDaemonSettings } from 'redux/selectors/settings';
|
||||||
import { formatLbryUrlForWeb } from 'util/url';
|
|
||||||
|
|
||||||
const DOWNLOAD_POLL_INTERVAL = 1000;
|
const DOWNLOAD_POLL_INTERVAL = 1000;
|
||||||
|
|
||||||
|
@ -57,7 +50,6 @@ export function doUpdateLoadStatus(uri: string, outpoint: string) {
|
||||||
// download hasn't started yet
|
// download hasn't started yet
|
||||||
setNextStatusUpdate();
|
setNextStatusUpdate();
|
||||||
} else if (fileInfo.completed) {
|
} else if (fileInfo.completed) {
|
||||||
const state = getState();
|
|
||||||
// TODO this isn't going to get called if they reload the client before
|
// TODO this isn't going to get called if they reload the client before
|
||||||
// the download finished
|
// the download finished
|
||||||
dispatch({
|
dispatch({
|
||||||
|
@ -69,42 +61,19 @@ export function doUpdateLoadStatus(uri: string, outpoint: string) {
|
||||||
},
|
},
|
||||||
});
|
});
|
||||||
|
|
||||||
const channelUri = makeSelectChannelForClaimUri(uri, true)(state);
|
// If notifications are disabled(false) just return
|
||||||
const { channelName } = parseURI(channelUri);
|
if (!selectosNotificationsEnabled(getState()) || !fileInfo.written_bytes) return;
|
||||||
const claimName = '@' + channelName;
|
|
||||||
|
|
||||||
const unreadForChannel = makeSelectUnreadByChannel(channelUri)(state);
|
const notif = new window.Notification(__('LBRY Download Complete'), {
|
||||||
if (unreadForChannel && unreadForChannel.type === NOTIFICATION_TYPES.DOWNLOADING) {
|
body: fileInfo.metadata.title,
|
||||||
const count = unreadForChannel.uris.length;
|
silent: false,
|
||||||
|
});
|
||||||
|
|
||||||
if (selectosNotificationsEnabled(state)) {
|
// @if TARGET='app'
|
||||||
const notif = new window.Notification(claimName, {
|
notif.onclick = () => {
|
||||||
body: `Posted ${fileInfo.metadata.title}${
|
ipcRenderer.send('focusWindow', 'main');
|
||||||
count > 1 && count < 10 ? ` and ${count - 1} other new items` : ''
|
};
|
||||||
}${count > 9 ? ' and 9+ other new items' : ''}`,
|
// @ENDIF
|
||||||
silent: false,
|
|
||||||
});
|
|
||||||
notif.onclick = () => {
|
|
||||||
dispatch(push(formatLbryUrlForWeb(uri)));
|
|
||||||
};
|
|
||||||
}
|
|
||||||
|
|
||||||
dispatch(doUpdateUnreadSubscriptions(channelUri, null, NOTIFICATION_TYPES.DOWNLOADED));
|
|
||||||
} else {
|
|
||||||
// If notifications are disabled(false) just return
|
|
||||||
if (!selectosNotificationsEnabled(getState()) || !fileInfo.written_bytes) return;
|
|
||||||
|
|
||||||
const notif = new window.Notification(__('LBRY Download Complete'), {
|
|
||||||
body: fileInfo.metadata.title,
|
|
||||||
silent: false,
|
|
||||||
});
|
|
||||||
|
|
||||||
// @if TARGET='app'
|
|
||||||
notif.onclick = () => {
|
|
||||||
ipcRenderer.send('focusWindow', 'main');
|
|
||||||
};
|
|
||||||
// @ENDIF
|
|
||||||
}
|
|
||||||
} else {
|
} else {
|
||||||
// ready to play
|
// ready to play
|
||||||
const { total_bytes: totalBytes, written_bytes: writtenBytes } = fileInfo;
|
const { total_bytes: totalBytes, written_bytes: writtenBytes } = fileInfo;
|
||||||
|
|
Loading…
Reference in a new issue