First run changes #103
8 changed files with 498 additions and 498 deletions
|
@ -51,6 +51,7 @@ import {
|
||||||
selectHashChanged,
|
selectHashChanged,
|
||||||
selectUser,
|
selectUser,
|
||||||
} from 'lbryinc';
|
} from 'lbryinc';
|
||||||
|
import { doStartDownload, doUpdateDownload, doCompleteDownload } from 'redux/actions/file';
|
||||||
import { makeSelectClientSetting, selectFullscreenMode } from 'redux/selectors/settings';
|
import { makeSelectClientSetting, selectFullscreenMode } from 'redux/selectors/settings';
|
||||||
import { decode as atob } from 'base-64';
|
import { decode as atob } from 'base-64';
|
||||||
import { dispatchNavigateBack, dispatchNavigateToUri, transformUrl } from 'utils/helper';
|
import { dispatchNavigateBack, dispatchNavigateToUri, transformUrl } from 'utils/helper';
|
||||||
|
@ -311,6 +312,10 @@ class AppWithNavigationState extends React.Component {
|
||||||
this.emailVerifyCheckInterval = setInterval(() => this.checkEmailVerification(), 5000);
|
this.emailVerifyCheckInterval = setInterval(() => this.checkEmailVerification(), 5000);
|
||||||
Linking.addEventListener('url', this._handleUrl);
|
Linking.addEventListener('url', this._handleUrl);
|
||||||
|
|
||||||
|
DeviceEventEmitter.addListener('onDownloadStarted', this.handleDownloadStarted);
|
||||||
|
DeviceEventEmitter.addListener('onDownloadUpdated', this.handleDownloadUpdated);
|
||||||
|
DeviceEventEmitter.addListener('onDownloadCompleted', this.handleDownloadCompleted);
|
||||||
|
|
||||||
// call /sync/get with interval
|
// call /sync/get with interval
|
||||||
this.syncGetInterval = setInterval(() => {
|
this.syncGetInterval = setInterval(() => {
|
||||||
this.setState({ syncHashChanged: false }); // reset local state
|
this.setState({ syncHashChanged: false }); // reset local state
|
||||||
|
@ -345,7 +350,29 @@ class AppWithNavigationState extends React.Component {
|
||||||
);
|
);
|
||||||
};
|
};
|
||||||
|
|
||||||
|
handleDownloadStarted = evt => {
|
||||||
|
const { dispatch } = this.props;
|
||||||
|
const { uri, outpoint, fileInfo } = evt;
|
||||||
|
dispatch(doStartDownload(uri, outpoint, fileInfo));
|
||||||
|
};
|
||||||
|
|
||||||
|
handleDownloadUpdated = evt => {
|
||||||
|
const { dispatch } = this.props;
|
||||||
|
const { uri, outpoint, fileInfo, progress } = evt;
|
||||||
|
dispatch(doUpdateDownload(uri, outpoint, fileInfo, progress));
|
||||||
|
};
|
||||||
|
|
||||||
|
handleDownloadCompleted = evt => {
|
||||||
|
const { dispatch } = this.props;
|
||||||
|
const { uri, outpoint, fileInfo } = evt;
|
||||||
|
dispatch(doCompleteDownload(uri, outpoint, fileInfo));
|
||||||
|
};
|
||||||
|
|
||||||
componentWillUnmount() {
|
componentWillUnmount() {
|
||||||
|
DeviceEventEmitter.removeListener('onDownloadStarted', this.handleDownloadStarted);
|
||||||
|
DeviceEventEmitter.removeListener('onDownloadUpdated', this.handleDownloadUpdated);
|
||||||
|
DeviceEventEmitter.removeListener('onDownloadCompleted', this.handleDownloadCompleted);
|
||||||
|
|
||||||
AppState.removeEventListener('change', this._handleAppStateChange);
|
AppState.removeEventListener('change', this._handleAppStateChange);
|
||||||
BackHandler.removeEventListener('hardwareBackPress');
|
BackHandler.removeEventListener('hardwareBackPress');
|
||||||
Linking.removeEventListener('url', this._handleUrl);
|
Linking.removeEventListener('url', this._handleUrl);
|
||||||
|
|
|
@ -11,11 +11,6 @@ class FileDownloadButton extends React.PureComponent {
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
componentWillReceiveProps(nextProps) {
|
|
||||||
// this.checkAvailability(nextProps.uri);
|
|
||||||
// this.restartDownload(nextProps);
|
|
||||||
}
|
|
||||||
|
|
||||||
restartDownload(props) {
|
restartDownload(props) {
|
||||||
const { downloading, fileInfo, uri, restartDownload } = props;
|
const { downloading, fileInfo, uri, restartDownload } = props;
|
||||||
|
|
||||||
|
@ -49,9 +44,6 @@ class FileDownloadButton extends React.PureComponent {
|
||||||
onButtonLayout,
|
onButtonLayout,
|
||||||
} = this.props;
|
} = this.props;
|
||||||
|
|
||||||
console.log('uri=' + uri);
|
|
||||||
console.log(fileInfo);
|
|
||||||
|
|
||||||
if ((fileInfo && !fileInfo.stopped) || loading || downloading) {
|
if ((fileInfo && !fileInfo.stopped) || loading || downloading) {
|
||||||
const progress = fileInfo && fileInfo.written_bytes ? (fileInfo.written_bytes / fileInfo.total_bytes) * 100 : 0,
|
const progress = fileInfo && fileInfo.written_bytes ? (fileInfo.written_bytes / fileInfo.total_bytes) * 100 : 0,
|
||||||
label = fileInfo ? __('%progress%% complete', { progress: progress.toFixed(0) }) : __('Connecting...');
|
label = fileInfo ? __('%progress%% complete', { progress: progress.toFixed(0) }) : __('Connecting...');
|
||||||
|
|
|
@ -158,7 +158,13 @@ class FileListItem extends React.PureComponent {
|
||||||
</View>
|
</View>
|
||||||
)}
|
)}
|
||||||
{fileInfo && fileInfo.completed && fileInfo.download_path && (
|
{fileInfo && fileInfo.completed && fileInfo.download_path && (
|
||||||
<Icon style={fileListStyle.downloadedIcon} solid color={Colors.NextLbryGreen} name={'folder'} size={16} />
|
<Icon
|
||||||
|
style={featuredResult ? fileListStyle.featuredDownloadedIcon : fileListStyle.downloadedIcon}
|
||||||
|
solid
|
||||||
|
color={Colors.NextLbryGreen}
|
||||||
|
name={'folder'}
|
||||||
|
size={16}
|
||||||
|
/>
|
||||||
)}
|
)}
|
||||||
<View style={fileListStyle.detailsContainer}>
|
<View style={fileListStyle.detailsContainer}>
|
||||||
{featuredResult && (
|
{featuredResult && (
|
||||||
|
|
|
@ -8,18 +8,11 @@ import fileListStyle from 'styles/fileList';
|
||||||
import relatedContentStyle from 'styles/relatedContent';
|
import relatedContentStyle from 'styles/relatedContent';
|
||||||
|
|
||||||
export default class RelatedContent extends React.PureComponent {
|
export default class RelatedContent extends React.PureComponent {
|
||||||
state = {
|
componentDidMount() {
|
||||||
urlsResolved: false,
|
|
||||||
};
|
|
||||||
|
|
||||||
componentDidUpdate(prevProps) {
|
|
||||||
const { resolveUris, recommendedContent } = this.props;
|
const { resolveUris, recommendedContent } = this.props;
|
||||||
|
if (recommendedContent && recommendedContent.length > 0) {
|
||||||
if (recommendedContent && recommendedContent.length > 0 && !this.state.urisResolved) {
|
// batch resolve the uris
|
||||||
this.setState({ urisResolved: true }, () => {
|
resolveUris(recommendedContent);
|
||||||
// batch resolve the uris
|
|
||||||
resolveUris(recommendedContent);
|
|
||||||
});
|
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|
|
@ -57,8 +57,7 @@ window.__ = __;
|
||||||
|
|
||||||
const globalExceptionHandler = (error, isFatal) => {
|
const globalExceptionHandler = (error, isFatal) => {
|
||||||
if (error && NativeModules.Firebase) {
|
if (error && NativeModules.Firebase) {
|
||||||
console.log(error);
|
NativeModules.Firebase.logException(!!isFatal, error.message ? error.message : 'No message', JSON.stringify(error));
|
||||||
NativeModules.Firebase.logException(isFatal, error.message ? error.message : 'No message', JSON.stringify(error));
|
|
||||||
}
|
}
|
||||||
};
|
};
|
||||||
setJSExceptionHandler(globalExceptionHandler, true);
|
setJSExceptionHandler(globalExceptionHandler, true);
|
||||||
|
|
|
@ -8,6 +8,7 @@ import {
|
||||||
doPurchaseUri,
|
doPurchaseUri,
|
||||||
doDeletePurchasedUri,
|
doDeletePurchasedUri,
|
||||||
doResolveUri,
|
doResolveUri,
|
||||||
|
doResolveUris,
|
||||||
doSearch,
|
doSearch,
|
||||||
doSendTip,
|
doSendTip,
|
||||||
doToast,
|
doToast,
|
||||||
|
@ -28,6 +29,7 @@ import {
|
||||||
selectPurchasedUris,
|
selectPurchasedUris,
|
||||||
selectFailedPurchaseUris,
|
selectFailedPurchaseUris,
|
||||||
selectPurchaseUriErrorMessage,
|
selectPurchaseUriErrorMessage,
|
||||||
|
selectResolvingUris,
|
||||||
selectIsSearching,
|
selectIsSearching,
|
||||||
} from 'lbry-redux';
|
} from 'lbry-redux';
|
||||||
import {
|
import {
|
||||||
|
@ -39,13 +41,7 @@ import {
|
||||||
selectRewardContentClaimIds,
|
selectRewardContentClaimIds,
|
||||||
selectBlackListedOutpoints,
|
selectBlackListedOutpoints,
|
||||||
} from 'lbryinc';
|
} from 'lbryinc';
|
||||||
import {
|
import { doDeleteFile, doStopDownloadingFile } from 'redux/actions/file';
|
||||||
doStartDownload,
|
|
||||||
doUpdateDownload,
|
|
||||||
doCompleteDownload,
|
|
||||||
doDeleteFile,
|
|
||||||
doStopDownloadingFile,
|
|
||||||
} from 'redux/actions/file';
|
|
||||||
import { doPushDrawerStack, doPopDrawerStack, doSetPlayerVisible } from 'redux/actions/drawer';
|
import { doPushDrawerStack, doPopDrawerStack, doSetPlayerVisible } from 'redux/actions/drawer';
|
||||||
import { doToggleFullscreenMode } from 'redux/actions/settings';
|
import { doToggleFullscreenMode } from 'redux/actions/settings';
|
||||||
import { selectDrawerStack } from 'redux/selectors/drawer';
|
import { selectDrawerStack } from 'redux/selectors/drawer';
|
||||||
|
@ -77,6 +73,7 @@ const select = (state, props) => {
|
||||||
thumbnail: makeSelectThumbnailForUri(contentUri)(state),
|
thumbnail: makeSelectThumbnailForUri(contentUri)(state),
|
||||||
title: makeSelectTitleForUri(contentUri)(state),
|
title: makeSelectTitleForUri(contentUri)(state),
|
||||||
recommendedContent: makeSelectRecommendedContentForUri(contentUri)(state),
|
recommendedContent: makeSelectRecommendedContentForUri(contentUri)(state),
|
||||||
|
resolvingUris: selectResolvingUris(state),
|
||||||
isSearchingRecommendContent: selectIsSearching(state),
|
isSearchingRecommendContent: selectIsSearching(state),
|
||||||
viewCount: makeSelectViewCountForUri(contentUri)(state),
|
viewCount: makeSelectViewCountForUri(contentUri)(state),
|
||||||
};
|
};
|
||||||
|
@ -100,14 +97,12 @@ const perform = dispatch => ({
|
||||||
purchaseUri: (uri, costInfo, saveFile) => dispatch(doPurchaseUri(uri, costInfo, saveFile)),
|
purchaseUri: (uri, costInfo, saveFile) => dispatch(doPurchaseUri(uri, costInfo, saveFile)),
|
||||||
deletePurchasedUri: uri => dispatch(doDeletePurchasedUri(uri)),
|
deletePurchasedUri: uri => dispatch(doDeletePurchasedUri(uri)),
|
||||||
resolveUri: uri => dispatch(doResolveUri(uri)),
|
resolveUri: uri => dispatch(doResolveUri(uri)),
|
||||||
|
resolveUris: uris => dispatch(doResolveUris(uris)),
|
||||||
searchRecommended: query => dispatch(doSearch(query, 20, undefined, true)),
|
searchRecommended: query => dispatch(doSearch(query, 20, undefined, true)),
|
||||||
sendTip: (amount, claimId, isSupport, successCallback, errorCallback) =>
|
sendTip: (amount, claimId, isSupport, successCallback, errorCallback) =>
|
||||||
dispatch(doSendTip(amount, claimId, isSupport, successCallback, errorCallback)),
|
dispatch(doSendTip(amount, claimId, isSupport, successCallback, errorCallback)),
|
||||||
setPlayerVisible: () => dispatch(doSetPlayerVisible(true)),
|
setPlayerVisible: () => dispatch(doSetPlayerVisible(true)),
|
||||||
stopDownload: (uri, fileInfo) => dispatch(doStopDownloadingFile(uri, fileInfo)),
|
stopDownload: (uri, fileInfo) => dispatch(doStopDownloadingFile(uri, fileInfo)),
|
||||||
startDownload: (uri, outpoint, fileInfo) => dispatch(doStartDownload(uri, outpoint, fileInfo)),
|
|
||||||
updateDownload: (uri, outpoint, fileInfo, progress) => dispatch(doUpdateDownload(uri, outpoint, fileInfo, progress)),
|
|
||||||
completeDownload: (uri, outpoint, fileInfo) => dispatch(doCompleteDownload(uri, outpoint, fileInfo)),
|
|
||||||
toggleFullscreenMode: mode => dispatch(doToggleFullscreenMode(mode)),
|
toggleFullscreenMode: mode => dispatch(doToggleFullscreenMode(mode)),
|
||||||
});
|
});
|
||||||
|
|
||||||
|
|
File diff suppressed because it is too large
Load diff
|
@ -94,6 +94,11 @@ const fileListStyle = StyleSheet.create({
|
||||||
top: 8,
|
top: 8,
|
||||||
left: 8,
|
left: 8,
|
||||||
},
|
},
|
||||||
|
featuredDownloadedIcon: {
|
||||||
|
position: 'absolute',
|
||||||
|
left: 16,
|
||||||
|
top: 16,
|
||||||
|
},
|
||||||
fileItem: {
|
fileItem: {
|
||||||
marginLeft: 24,
|
marginLeft: 24,
|
||||||
marginRight: 24,
|
marginRight: 24,
|
||||||
|
|
Loading…
Reference in a new issue