Merge release back into master #1973

Merged
neb-b merged 8 commits from release.0.25.1 into master 2018-09-19 01:07:37 +02:00
3 changed files with 17 additions and 8 deletions
Showing only changes of commit d0c2490202 - Show all commits

View file

@ -124,14 +124,14 @@ class FileViewer extends React.PureComponent<Props> {
}
handleAutoplay = (props: Props) => {
const { autoplay, playingUri, fileInfo, costInfo, isDownloading, uri, play, metadata } = props;
const { autoplay, playingUri, fileInfo, costInfo, isDownloading, uri, metadata } = props;
const playable = autoplay && playingUri !== uri && metadata && !metadata.nsfw;
if (playable && costInfo && costInfo.cost === 0 && !fileInfo && !isDownloading) {
play(uri);
this.playContent();
} else if (playable && fileInfo && fileInfo.blobs_completed > 0) {
play(uri);
this.playContent();
}
};

View file

@ -31,6 +31,7 @@ import {
import { makeSelectClientSetting, selectosNotificationsEnabled } from 'redux/selectors/settings';
import setBadge from 'util/setBadge';
import setProgressBar from 'util/setProgressBar';
import analytics from 'analytics';
const DOWNLOAD_POLL_INTERVAL = 250;
@ -265,7 +266,7 @@ function handleLoadVideoError(uri, errorType = '') {
};
}
export function doLoadVideo(uri) {
export function doLoadVideo(uri, shouldRecordViewEvent) {
return dispatch => {
dispatch({
type: ACTIONS.LOADING_VIDEO_STARTED,
@ -283,6 +284,14 @@ export function doLoadVideo(uri) {
dispatch(handleLoadVideoError(uri, 'timeout'));
} else {
dispatch(doDownloadFile(uri, streamInfo));
if (shouldRecordViewEvent) {
analytics.apiLogView(
`${streamInfo.claim_name}#${streamInfo.claim_id}`,
streamInfo.outpoint,
streamInfo.claim_id
);
}
}
})
.catch(() => {
@ -291,7 +300,7 @@ export function doLoadVideo(uri) {
};
}
export function doPurchaseUri(uri, specificCostInfo) {
export function doPurchaseUri(uri, specificCostInfo, shouldRecordViewEvent) {
return (dispatch, getState) => {
const state = getState();
const balance = selectBalance(state);
@ -303,7 +312,7 @@ export function doPurchaseUri(uri, specificCostInfo) {
if (cost > 0 && (!instantPurchaseMax || cost > instantPurchaseMax)) {
dispatch(doNotify({ id: MODALS.AFFIRM_PURCHASE }, { uri }));
} else {
dispatch(doLoadVideo(uri));
dispatch(doLoadVideo(uri, shouldRecordViewEvent));
}
}
@ -312,7 +321,7 @@ export function doPurchaseUri(uri, specificCostInfo) {
// If written_bytes is false that means the user has deleted/moved the
// file manually on their file system, so we need to dispatch a
// doLoadVideo action to reconstruct the file from the blobs
if (!fileInfo.written_bytes) dispatch(doLoadVideo(uri));
if (!fileInfo.written_bytes) dispatch(doLoadVideo(uri, shouldRecordViewEvent));
Promise.resolve();
return;

View file

@ -175,7 +175,7 @@ export const doCheckSubscription = (subscriptionUri: string, notify?: boolean) =
}
if (shouldDownload) {
downloadCount += 1;
dispatch(doPurchaseUri(uri, { cost: 0 }));
dispatch(doPurchaseUri(uri, { cost: 0 }, true));
}
});
}