Compare commits

..
Author SHA1 Message Date
Akinwale Ariwodola d7153ae700 optimise file page renders 2020-01-29 12:53:42 +01:00
Akinwale Ariwodola d9ada93ff3 Invites page (#114) 2020-01-29 12:25:23 +01:00
Akinwale Ariwodola 9bc5a2ecac fix thumbnailUrl check 2020-01-23 02:15:39 +01:00
Akinwale Ariwodola 4e6267d5a9 additional thumbnailUrl check 2020-01-23 00:55:45 +01:00
Akinwale Ariwodola dc0b06ce55 fix additional channel creator edit error 2020-01-22 21:21:01 +01:00
Akinwale Ariwodola 82d15f0c7f fix channel creator edit error 2020-01-22 18:39:47 +01:00
Akinwale Ariwodola 9f32363a09 fix existing publish name check for edit mode 2020-01-22 02:05:50 +01:00
Akinwale Ariwodola 467272d5c8 tweak file page style 2020-01-22 02:01:06 +01:00
Akinwale Ariwodola 3594b70113 update app strings 2020-01-21 06:47:49 +01:00
Akinwale Ariwodola 5f008b3ac9 download confirmation dialog 2020-01-20 23:36:10 +01:00
Akinwale Ariwodola 3f21c4e08c display circular download progress on file page 2020-01-20 23:11:14 +01:00
Akinwale Ariwodola 3717a8072b error on publish to existing content address 2020-01-20 21:52:59 +01:00
Akinwale Ariwodola 46bfbd242a Navigate to the last visited route (#112)
* navigate to the last visited route on app startup if there is no launch url
* update eslint no-console rule
2020-01-20 21:40:17 +01:00
Akinwale Ariwodola 0361b10575 add onDownloadAborted event handler 2020-01-20 21:33:17 +01:00
Akinwale Ariwodola b9dec86cae add 10-second seek controls to media player 2020-01-20 18:18:01 +01:00
Akinwale Ariwodola 2465b5514f remove download notification if file is deleted from Library page 2020-01-20 17:58:48 +01:00
Akinwale Ariwodola df3a9587c0 update fileGetStarted logic 2020-01-17 06:43:02 +01:00
Akinwale Ariwodola 5df8b8c4aa Playable downloads (#111)
* enable download button for video and audio content
* fix media player source and button display
* show notifications for video downloads. fix double playback.
* fix ongoing playback when back button pressed
* fix double-playback when navigating to related content links
* update url for stop download
2020-01-16 22:00:34 +01:00
32 changed files with 855 additions and 117 deletions

No files matched your search

+1
View File
@@ -10,6 +10,7 @@
"__": true
},
"rules": {
"no-console": 2,
"no-multi-spaces": 0,
"new-cap": 0,
"prefer-promise-reject-errors": 0,
+57 -1
View File
@@ -248,5 +248,61 @@
"Authenticating": "Authenticating",
"Waiting for authentication": "Waiting for authentication",
"Delete file": "Delete file",
"Are you sure you want to remove this file from your device?": "Are you sure you want to remove this file from your device?"
"Are you sure you want to remove this file from your device?": "Are you sure you want to remove this file from your device?",
"Following": "Following",
"Update mailing preferences": "Update mailing preferences",
"Please confirm you want to tip %amount% credits": "Please confirm you want to tip %amount% credits",
"Send Tip": "Send Tip",
"You do not have any\ndownloaded content on this device.": "You do not have any\ndownloaded content on this device.",
"%view% view": "%view% view",
"No channel name after @.": "No channel name after @.",
"Loading transactions...": "Loading transactions...",
"Pending": "Pending",
"Phone Number": "Phone Number",
"Please provide a phone number to prevent fraud.": "Please provide a phone number to prevent fraud.",
"Send verification text": "Send verification text",
"Open": "Open",
"for": "for",
"Everyone": "Everyone",
"Suggested channels": "Suggested channels",
"You might also like": "You might also like",
"Publish something new": "Publish something new",
"Filter for": "Filter for",
"Tags you follow": "Tags you follow",
"Sort content by": "Sort content by",
"Trending content": "Trending content",
"New content": "New content",
"Top content": "Top content",
"Top": "Top",
"Past week": "Past week",
"It looks like you have not\npublished any content to LBRY yet.": "It looks like you have not\npublished any content to LBRY yet.",
"Stop": "Stop",
"Unsupported Content": "Unsupported Content",
"all tags you follow": "all tags you follow",
"Send LBC": "Send LBC",
"from": "from",
"This file cannot be displayed in the LBRY app.": "This file cannot be displayed in the LBRY app.",
"Please press the Play button.": "Please press the Play button.",
"Stop download": "Stop download",
"Are you sure you want to stop downloading this file?": "Are you sure you want to stop downloading this file?",
"The download will stop momentarily. You do not need to wait to discover something else.": "The download will stop momentarily. You do not need to wait to discover something else.",
"Connection Failure": "Connection Failure",
"We could not establish a connection to the SDK. Your data connection may be preventing LBRY from connecting. Contact hello@lbry.com if you think this is a software bug.": "We could not establish a connection to the SDK. Your data connection may be preventing LBRY from connecting. Contact hello@lbry.com if you think this is a software bug.",
"%num% block behind": "%num% block behind",
"Delete files": "Delete files",
"Are you sure you want to delete the selected content?": "Are you sure you want to delete the selected content?",
"We could not find any videos on your device. Take a photo or record a video to get started.": "We could not find any videos on your device. Take a photo or record a video to get started.",
"You have already published to the specified content address. Please enter a new address.": "You have already published to the specified content address. Please enter a new address.",
"Camera": "Camera",
"Please grant access to make use of your camera": "Please grant access to make use of your camera",
"OK": "OK",
"Audio": "Audio",
"Please grant access to record audio": "Please grant access to record audio",
"Camera not authorized": "Camera not authorized",
"There's nothing at this location.": "There's nothing at this location.",
"Publish something here": "Publish something here",
"This content cannot be viewed at this time. Please try again in a bit.": "This content cannot be viewed at this time. Please try again in a bit.",
"Download file": "Download file",
"Save %title% (%size%) to your device": "Save %title% (%size%) to your device",
"Save \"%title%\" (%size%) to your device": "Save \"%title%\" (%size%) to your device"
}
+7 -2
View File
@@ -7076,8 +7076,8 @@
}
},
"lbryinc": {
"version": "github:lbryio/lbryinc#053ca52f4f7f9bf8eb62a3581b183671a475ad1c",
"from": "github:lbryio/lbryinc#053ca52f4f7f9bf8eb62a3581b183671a475ad1c",
"version": "github:lbryio/lbryinc#138a053754ec8e3da8e9bf153d32f527c962f25c",
"from": "github:lbryio/lbryinc#138a053754ec8e3da8e9bf153d32f527c962f25c",
"requires": {
"reselect": "^3.0.0"
}
@@ -9905,6 +9905,11 @@
"prop-types": "^15.5.10"
}
},
"react-native-progress-circle": {
"version": "2.1.0",
"resolved": "https://registry.npmjs.org/react-native-progress-circle/-/react-native-progress-circle-2.1.0.tgz",
"integrity": "sha512-VP0s92bgbTMQy4hQzPU4LlGyFj3z5u7i1HYFG8/yzXXfGkX1cxKS4xOlE+OTaObWC99w7Bodi3h8R7En2nQPYw=="
},
"react-native-reanimated": {
"version": "1.4.0",
"resolved": "https://registry.npmjs.org/react-native-reanimated/-/react-native-reanimated-1.4.0.tgz",
+2 -1
View File
@@ -13,7 +13,7 @@
"@expo/vector-icons": "^8.1.0",
"gfycat-style-urls": "^1.0.3",
"lbry-redux": "lbryio/lbry-redux#c910cd2b80b165843a81fdf6ce96094429b94ec8",
"lbryinc": "lbryio/lbryinc#053ca52f4f7f9bf8eb62a3581b183671a475ad1c",
"lbryinc": "lbryio/lbryinc#138a053754ec8e3da8e9bf153d32f527c962f25c",
"lodash": ">=4.17.11",
"merge": ">=1.2.1",
"moment": "^2.22.1",
@@ -30,6 +30,7 @@
"react-native-image-zoom-viewer": "^2.2.5",
"react-native-password-strength-meter": "^0.0.2",
"react-native-phone-input": "lbryio/react-native-phone-input",
"react-native-progress-circle": "2.1.0",
"react-native-reanimated": "1.4.0",
"react-native-safe-area-context": "^0.6.2",
"react-native-snackbar": "2.0.4",
+35 -2
View File
@@ -6,6 +6,7 @@ import DownloadsPage from 'page/downloads';
import DrawerContent from 'component/drawerContent';
import FilePage from 'page/file';
import FirstRunScreen from 'page/firstRun';
import InvitesPage from 'page/invites';
import PublishPage from 'page/publish';
import PublishesPage from 'page/publishes';
import RewardsPage from 'page/rewards';
@@ -38,7 +39,15 @@ import {
ToastAndroid,
} from 'react-native';
import { selectDrawerStack } from 'redux/selectors/drawer';
import { SETTINGS, doDismissToast, doPopulateSharedUserState, doPreferenceGet, doToast, selectToast } from 'lbry-redux';
import {
ACTIONS,
SETTINGS,
doDismissToast,
doPopulateSharedUserState,
doPreferenceGet,
doToast,
selectToast,
} from 'lbry-redux';
import {
Lbryio,
doGetSync,
@@ -202,6 +211,12 @@ const drawer = createDrawerNavigator(
drawerIcon: ({ tintColor }) => <Icon name="award" size={drawerIconSize} style={{ color: tintColor }} />,
},
},
Invites: {
screen: InvitesPage,
navigationOptions: {
drawerIcon: ({ tintColor }) => <Icon name="user-friends" size={drawerIconSize} style={{ color: tintColor }} />,
},
},
Downloads: {
screen: DownloadsPage,
navigationOptions: {
@@ -313,6 +328,7 @@ class AppWithNavigationState extends React.Component {
this.emailVerifyCheckInterval = setInterval(() => this.checkEmailVerification(), 5000);
Linking.addEventListener('url', this._handleUrl);
DeviceEventEmitter.addListener('onDownloadAborted', this.handleDownloadAborted);
DeviceEventEmitter.addListener('onDownloadStarted', this.handleDownloadStarted);
DeviceEventEmitter.addListener('onDownloadUpdated', this.handleDownloadUpdated);
DeviceEventEmitter.addListener('onDownloadCompleted', this.handleDownloadCompleted);
@@ -369,7 +385,24 @@ class AppWithNavigationState extends React.Component {
dispatch(doCompleteDownload(uri, outpoint, fileInfo));
};
handleDownloadAborted = evt => {
const { dispatch } = this.props;
const { uri, outpoint } = evt;
dispatch({
type: ACTIONS.DOWNLOADING_CANCELED,
data: { uri, outpoint },
});
dispatch({
type: ACTIONS.FILE_DELETE,
data: {
outpoint,
},
});
};
componentWillUnmount() {
DeviceEventEmitter.removeListener('onDownloadAborted', this.handleDownloadAborted);
DeviceEventEmitter.removeListener('onDownloadStarted', this.handleDownloadStarted);
DeviceEventEmitter.removeListener('onDownloadUpdated', this.handleDownloadUpdated);
DeviceEventEmitter.removeListener('onDownloadCompleted', this.handleDownloadCompleted);
@@ -504,7 +537,7 @@ class AppWithNavigationState extends React.Component {
try {
verification = JSON.parse(atob(evt.url.substring(15)));
} catch (error) {
console.log(error);
// console.log(error);
}
if (verification.token && verification.recaptcha) {
+11 -6
View File
@@ -36,10 +36,14 @@ export default class ChannelSelector extends React.PureComponent {
}
componentWillReceiveProps(nextProps) {
const { channels: prevChannels = [], channelName } = this.props;
const { channels = [] } = nextProps;
const { channels: prevChannels = [], channelName: prevChannelName } = this.props;
const { channels = [], channelName } = nextProps;
if (channels && channels.length !== prevChannels.length && channelName !== this.state.currentSelectedValue) {
this.setState({ currentSelectedValue: prevChannelName });
}
if (channelName !== prevChannelName) {
this.setState({ currentSelectedValue: channelName });
}
}
@@ -189,10 +193,11 @@ export default class ChannelSelector extends React.PureComponent {
render() {
const channel = this.state.addingChannel ? 'new' : this.props.channel;
const { balance, enabled, fetchingChannels, channels = [] } = this.props;
const pickerItems = [Constants.ITEM_ANONYMOUS, Constants.ITEM_CREATE_A_CHANNEL].concat(
channels ? channels.map(ch => ch.name) : [],
);
const { balance, enabled, fetchingChannels, channels = [], showAnonymous } = this.props;
const pickerItems = (showAnonymous
? [Constants.ITEM_ANONYMOUS, Constants.ITEM_CREATE_A_CHANNEL]
: [Constants.ITEM_CREATE_A_CHANNEL]
).concat(channels ? channels.map(ch => ch.name) : []);
const {
newChannelName,
+1
View File
@@ -22,6 +22,7 @@ const groupedMenuItems = {
Wallet: [
{ icon: 'wallet', label: 'Wallet', route: Constants.DRAWER_ROUTE_WALLET },
{ icon: 'award', label: 'Rewards', route: Constants.DRAWER_ROUTE_REWARDS },
{ icon: 'user-friends', label: 'Invites', route: Constants.DRAWER_ROUTE_INVITES },
],
Settings: [
{ icon: 'cog', label: 'Settings', route: Constants.DRAWER_ROUTE_SETTINGS },
+24 -6
View File
@@ -341,6 +341,12 @@ class MediaPlayer extends React.PureComponent {
this.setState({ paused: true }, this.updateBackgroundMediaNotification);
};
handleSeek = time => {
const { currentTime } = this.state;
const newTime = currentTime + time;
this.seekTo(newTime);
};
updateBackgroundMediaNotification = () => {
this.handlePausedState();
const { backgroundPlayEnabled } = this.props;
@@ -362,14 +368,26 @@ class MediaPlayer extends React.PureComponent {
<Icon name={'arrow-left'} size={18} style={mediaPlayerStyle.backButtonIcon} />
</TouchableOpacity>
<TouchableOpacity style={mediaPlayerStyle.playPauseButton} onPress={this.togglePlay}>
{this.state.paused && <Icon name="play" size={40} color="#ffffff" />}
{!this.state.paused && <Icon name="pause" size={40} color="#ffffff" />}
</TouchableOpacity>
<View style={mediaPlayerStyle.midControls}>
<TouchableOpacity style={mediaPlayerStyle.rewind10} onPress={() => this.handleSeek(-10)}>
<Icon name="undo" size={24} color={Colors.White} />
<Text style={[mediaPlayerStyle.midControlText, mediaPlayerStyle.leftMidControlText]}>10</Text>
</TouchableOpacity>
<TouchableOpacity style={mediaPlayerStyle.playPauseButton} onPress={this.togglePlay}>
{this.state.paused && <Icon name="play" size={40} color={Colors.White} />}
{!this.state.paused && <Icon name="pause" size={40} color={Colors.White} />}
</TouchableOpacity>
<TouchableOpacity style={mediaPlayerStyle.forward10} onPress={() => this.handleSeek(10)}>
<Icon name="redo" size={24} color={Colors.White} />
<Text style={[mediaPlayerStyle.midControlText, mediaPlayerStyle.rightMidControlText]}>10</Text>
</TouchableOpacity>
</View>
<TouchableOpacity style={mediaPlayerStyle.toggleFullscreenButton} onPress={this.toggleFullscreenMode}>
{this.state.fullscreenMode && <Icon name="compress" size={16} color="#ffffff" />}
{!this.state.fullscreenMode && <Icon name="expand" size={16} color="#ffffff" />}
{this.state.fullscreenMode && <Icon name="compress" size={16} color={Colors.White} />}
{!this.state.fullscreenMode && <Icon name="expand" size={16} color={Colors.White} />}
</TouchableOpacity>
<Text style={mediaPlayerStyle.elapsedDuration}>{this.formatTime(this.state.currentTime)}</Text>
+2
View File
@@ -90,6 +90,7 @@ const Constants = {
DRAWER_ROUTE_TAG: 'Tag',
DRAWER_ROUTE_CHANNEL_CREATOR: 'ChannelCreator',
DRAWER_ROUTE_CHANNEL_CREATOR_FORM: 'ChannnelCreatorForm',
DRAWER_ROUTE_INVITES: 'Invites',
FULL_ROUTE_NAME_DISCOVER: 'DiscoverStack',
FULL_ROUTE_NAME_WALLET: 'WalletStack',
@@ -165,6 +166,7 @@ export const DrawerRoutes = [
Constants.DRAWER_ROUTE_SEARCH,
Constants.DRAWER_ROUTE_TRANSACTION_HISTORY,
Constants.DRAWER_ROUTE_CHANNEL_CREATOR,
Constants.DRAWER_ROUTE_INVITES,
];
// sub-pages for main routes
+4 -2
View File
@@ -95,6 +95,7 @@ const compressor = createCompressor();
const authFilter = createFilter('auth', ['authToken']);
const blockedFilter = createFilter('blocked', ['blockedChannels']);
const contentFilter = createFilter('content', ['positions']);
const drawerFilter = createFilter('drawer', ['lastRouteInStack']);
const saveClaimsFilter = createFilter('claims', ['claimsByUri']);
const subscriptionsFilter = createFilter('subscriptions', ['enabledChannelNotifications', 'subscriptions', 'latest']);
const settingsFilter = createFilter('settings', ['clientSettings']);
@@ -102,12 +103,13 @@ const tagsFilter = createFilter('tags', ['followedTags']);
const walletFilter = createFilter('wallet', ['receiveAddress']);
const v4PersistOptions = {
whitelist: ['auth', 'blocked', 'claims', 'content', 'subscriptions', 'settings', 'tags', 'wallet'],
whitelist: ['auth', 'blocked', 'claims', 'drawer', 'content', 'subscriptions', 'settings', 'tags', 'wallet'],
// Order is important. Needs to be compressed last or other transforms can't
// read the data
transforms: [
authFilter,
blockedFilter,
drawerFilter,
saveClaimsFilter,
subscriptionsFilter,
settingsFilter,
@@ -202,7 +204,7 @@ window.store = store;
const persistor = persistStore(store, null, err => {
if (err) {
console.log('Unable to load saved SETTINGS');
// console.log('Unable to load saved SETTINGS');
}
});
window.persistor = persistor;
+4 -3
View File
@@ -905,7 +905,7 @@ export default class ChannelCreator extends React.PureComponent {
style={channelCreatorStyle.coverImage}
resizeMode={'cover'}
source={
coverImageUrl !== null && coverImageUrl.trim().length > 0
!!coverImageUrl && coverImageUrl.trim().length > 0
? { uri: coverImageUrl }
: require('../../assets/default_channel_cover.png')
}
@@ -924,14 +924,15 @@ export default class ChannelCreator extends React.PureComponent {
<View style={[channelCreatorStyle.avatarImageContainer, autoStyle]}>
<TouchableOpacity style={channelCreatorStyle.avatarTouchArea} onPress={this.onAvatarImagePress}>
{thumbnailUrl !== null && thumbnailUrl.trim().length > 0 && (
{!!thumbnailUrl && thumbnailUrl.trim().length > 0 && (
<Image
style={channelCreatorStyle.avatarImage}
resizeMode={'cover'}
source={{ uri: thumbnailUrl }}
/>
)}
{(thumbnailUrl === null || thumbnailUrl.trim().length === 0) && newChannelName.length > 0 && (
{(!!thumbnailUrl || (!!thumbnailUrl && thumbnailUrl.trim().length === 0)) &&
newChannelName.length > 0 && (
<Text style={channelIconStyle.autothumbCharacter}>
{newChannelName.substring(0, 1).toUpperCase()}
</Text>
+16 -14
View File
@@ -291,25 +291,27 @@ class DiscoverPage extends React.PureComponent {
);
render() {
const { navigation, sortByItem, timeItem } = this.props;
const { currentRoute, navigation, sortByItem, timeItem } = this.props;
const { orderBy, showModalTagSelector, showSortPicker, showTimePicker } = this.state;
return (
<View style={discoverStyle.container}>
<UriBar navigation={navigation} belowOverlay={showModalTagSelector} />
<SectionList
ListHeaderComponent={this.sectionListHeader}
ListFooterComponent={this.sectionListFooter}
style={discoverStyle.scrollContainer}
contentContainerStyle={discoverStyle.scrollPadding}
initialNumToRender={4}
maxToRenderPerBatch={4}
removeClippedSubviews
renderItem={this.renderSectionListItem}
renderSectionHeader={this.renderSectionHeader}
sections={this.buildSections()}
keyExtractor={(item, index) => item}
/>
{currentRoute !== Constants.ROUTE_FILE && currentRoute !== Constants.DRAWER_ROUTE_FILE_VIEW && (
<SectionList
ListHeaderComponent={this.sectionListHeader}
ListFooterComponent={this.sectionListFooter}
style={discoverStyle.scrollContainer}
contentContainerStyle={discoverStyle.scrollPadding}
initialNumToRender={4}
maxToRenderPerBatch={4}
removeClippedSubviews
renderItem={this.renderSectionListItem}
renderSectionHeader={this.renderSectionHeader}
sections={this.buildSections()}
keyExtractor={(item, index) => item}
/>
)}
{!showModalTagSelector && !showSortPicker && !showTimePicker && (
<FloatingWalletBalance navigation={navigation} />
)}
+5 -1
View File
@@ -125,7 +125,11 @@ class DownloadsPage extends React.PureComponent {
onPress: () => {
const uris = Object.keys(selectedClaimsMap);
uris.forEach(uri => {
const { txid, nout } = selectedClaimsMap[uri];
const { txid, nout, name, claim_id: claimId } = selectedClaimsMap[uri];
if (name && claimId) {
NativeModules.UtilityModule.deleteDownload(normalizeURI(`${name}#${claimId}`));
}
deleteFile(`${txid}:${nout}`, true);
});
this.onExitSelectionMode();
-2
View File
@@ -27,7 +27,6 @@ import {
selectPurchasedUris,
selectFailedPurchaseUris,
selectPurchaseUriErrorMessage,
selectIsSearching,
} from 'lbry-redux';
import {
doClaimEligiblePurchaseRewards,
@@ -70,7 +69,6 @@ const select = (state, props) => {
streamingUrl: makeSelectStreamingUrlForUri(contentUri)(state),
thumbnail: makeSelectThumbnailForUri(contentUri)(state),
title: makeSelectTitleForUri(contentUri)(state),
isSearchingRecommendContent: selectIsSearching(state),
viewCount: makeSelectViewCountForUri(contentUri)(state),
};
};
+105 -24
View File
@@ -21,7 +21,7 @@ import {
} from 'react-native';
import { WebView } from 'react-native-webview';
import { NavigationEvents } from 'react-navigation';
import { navigateBack, navigateToUri, formatLbryUrlForWeb } from 'utils/helper';
import { navigateBack, navigateToUri, formatBytes, formatLbryUrlForWeb } from 'utils/helper';
import Icon from 'react-native-vector-icons/FontAwesome5';
import ImageViewer from 'react-native-image-zoom-viewer';
import Button from 'component/button';
@@ -38,6 +38,7 @@ import FloatingWalletBalance from 'component/floatingWalletBalance';
import Link from 'component/link';
import MediaPlayer from 'component/mediaPlayer';
import ModalTipView from 'component/modalTipView';
import ProgressCircle from 'react-native-progress-circle';
import RelatedContent from 'component/relatedContent';
import SubscribeButton from 'component/subscribeButton';
import SubscribeNotificationButton from 'component/subscribeNotificationButton';
@@ -118,6 +119,7 @@ class FilePage extends React.PureComponent {
NativeModules.Firebase.setCurrentScreen('File').then(result => {
const { setPlayerVisible } = this.props;
DeviceEventEmitter.addListener('onDownloadAborted', this.handleDownloadAborted);
DeviceEventEmitter.addListener('onStoragePermissionGranted', this.handleStoragePermissionGranted);
DeviceEventEmitter.addListener('onStoragePermissionRefused', this.handleStoragePermissionRefused);
@@ -182,11 +184,7 @@ class FilePage extends React.PureComponent {
this.onComponentFocused();
}
if (
failedPurchaseUris.includes(uri) &&
!purchasedUris.includes(uri) &&
prevPurchaseUriErrorMessage !== purchaseUriErrorMessage
) {
if (failedPurchaseUris.includes(uri) && prevPurchaseUriErrorMessage !== purchaseUriErrorMessage) {
if (purchaseUriErrorMessage && purchaseUriErrorMessage.trim().length > 0) {
notify({ message: purchaseUriErrorMessage, isError: true });
}
@@ -196,16 +194,18 @@ class FilePage extends React.PureComponent {
const mediaType = Lbry.getMediaType(contentType);
const isPlayable = mediaType === 'video' || mediaType === 'audio';
if (this.state.fileGetStarted || prevPurchasedUris.length !== purchasedUris.length) {
const { permanent_url: permanentUrl } = claim;
if (purchasedUris.includes(uri) || purchasedUris.includes(permanentUrl)) {
const { nout, txid } = claim;
const outpoint = `${txid}:${nout}`;
const { permanent_url: permanentUrl, nout, txid } = claim;
const outpoint = `${txid}:${nout}`;
if (this.state.fileGetStarted) {
NativeModules.UtilityModule.queueDownload(outpoint);
this.setState({ fileGetStarted: false });
}
if (purchasedUris.includes(uri) || purchasedUris.includes(permanentUrl)) {
// If the media is playable, file/view will be done in onPlaybackStarted
if (!isPlayable && !this.state.fileViewLogged) {
this.logFileView(uri, claim);
}
this.setState({ fileGetStarted: false });
}
NativeModules.UtilityModule.checkDownloads();
}
@@ -238,10 +238,42 @@ class FilePage extends React.PureComponent {
const { fileInfo: prevFileInfo } = this.props;
const { fileInfo } = nextProps;
return (
Object.keys(this.difference(nextProps, this.props)).length > 0 ||
Object.keys(this.difference(nextState, this.state)).length > 0
);
const propKeyTriggers = ['balance', 'viewCount', 'isResolvingUri'];
const stateKeyTriggers = [
'downloadPressed',
'fullscreenMode',
'mediaLoaded',
'playerBgHeighht',
'playerHeight',
'relatedY',
'showTipView',
'showImageViewer',
'showWebView',
'showDescription',
'showRecommended',
'uri',
];
for (let i = 0; i < propKeyTriggers.length; i++) {
const key = propKeyTriggers[i];
if (this.props[key] !== nextProps[key]) {
return true;
}
}
for (let i = 0; i < stateKeyTriggers.length; i++) {
const key = stateKeyTriggers[i];
if (this.state[key] !== nextState[key]) {
return true;
}
}
if (!prevFileInfo && fileInfo) {
return true;
}
if (prevFileInfo && fileInfo && Object.keys(this.difference(fileInfo, prevFileInfo)).length > 0) {
return true;
}
return false;
}
componentDidUpdate(prevProps, prevState) {
@@ -343,11 +375,12 @@ class FilePage extends React.PureComponent {
text: __('Yes'),
onPress: () => {
const { uri } = navigation.state.params;
const purchaseUrl = this.getPurchaseUrl();
deleteFile(`${claim.txid}:${claim.nout}`, true);
deletePurchasedUri(uri);
NativeModules.UtilityModule.deleteDownload(uri);
NativeModules.UtilityModule.deleteDownload(normalizeURI(purchaseUrl));
this.setState({
downloadPressed: false,
fileViewLogged: false,
@@ -385,9 +418,8 @@ class FilePage extends React.PureComponent {
const uri = this.getPurchaseUrl();
stopDownload(uri, fileInfo);
deletePurchasedUri(uri);
if (NativeModules.UtilityModule) {
NativeModules.UtilityModule.deleteDownload(uri);
}
NativeModules.UtilityModule.deleteDownload(normalizeURI(uri));
this.setState({
downloadPressed: false,
fileViewLogged: false,
@@ -423,10 +455,29 @@ class FilePage extends React.PureComponent {
if (window.currentMediaInfo) {
window.currentMediaInfo = null;
}
DeviceEventEmitter.removeListener('onDownloadAborted', this.handleDownloadAborted);
DeviceEventEmitter.removeListener('onStoragePermissionGranted', this.handleStoragePermissionGranted);
DeviceEventEmitter.removeListener('onStoragePermissionRefused', this.handleStoragePermissionRefused);
}
handleDownloadAborted = evt => {
const { deletePurchasedUri, fileInfo, stopDownload } = this.props;
const { uri, outpoint } = evt;
const purchaseUrl = normalizeURI(this.getPurchaseUrl());
if (purchaseUrl === uri) {
stopDownload(uri, fileInfo);
deletePurchasedUri(uri);
NativeModules.UtilityModule.deleteDownload(normalizeURI(uri));
this.setState({
downloadPressed: false,
fileViewLogged: false,
mediaLoaded: false,
stopDownloadConfirmed: true,
});
}
};
handleStoragePermissionGranted = () => {
// permission was allowed. proceed to download
const { notify } = this.props;
@@ -629,6 +680,7 @@ class FilePage extends React.PureComponent {
const { notify, purchaseUri, title } = this.props;
if (!costInfo) {
notify({ message: __('This content cannot be viewed at this time. Please try again in a bit.'), isError: true });
this.setState({ downloadPressed: false });
this.fetchCostInfo(uri, this.props);
return;
}
@@ -667,7 +719,7 @@ class FilePage extends React.PureComponent {
NativeModules.Firebase.track('purchase_uri', { uri: purchaseUrl });
if (!isPlayable) {
this.checkStoragePermissionForDownload();
this.onDownloadPressed();
} else {
this.confirmPurchaseUri(purchaseUrl, costInfo, !isPlayable);
}
@@ -675,7 +727,6 @@ class FilePage extends React.PureComponent {
if (isPlayable) {
this.startTime = Date.now();
this.setState({ downloadPressed: true, autoPlayMedia: true, stopDownloadConfirmed: false });
// setPlayerVisible(purchaseUrl);
}
if (isViewable) {
this.setState({ downloadPressed: true });
@@ -699,7 +750,24 @@ class FilePage extends React.PureComponent {
};
onDownloadPressed = () => {
this.checkStoragePermissionForDownload();
const { claim, title } = this.props;
const fileSize = claim && claim.value && claim.value.source ? claim.value.source.size : 0;
Alert.alert(
__('Download file'),
fileSize > 0
? __('Save "%title%" (%size%) to your device', { title, size: formatBytes(fileSize, 0) })
: __('Save "%title%" to your device', { title }),
[
{ text: __('No') },
{
text: __('Yes'),
onPress: () => {
this.checkStoragePermissionForDownload();
},
},
],
{ cancelable: true },
);
};
checkStoragePermissionForDownload = () => {
@@ -1206,20 +1274,33 @@ class FilePage extends React.PureComponent {
{!canEdit && (
<View style={filePageStyle.sharedLargeButton}>
{(!fileInfo || (fileInfo.written_bytes <= 0 && !completed)) && (
{!this.state.downloadPressed &&
(!fileInfo || !fileInfo.download_path || (fileInfo.written_bytes <= 0 && !completed)) && (
<TouchableOpacity style={filePageStyle.innerLargeButton} onPress={this.onDownloadPressed}>
<Icon name={'download'} size={16} style={filePageStyle.largeButtonIcon} />
<Text style={filePageStyle.largeButtonText}>{__('Download')}</Text>
</TouchableOpacity>
)}
{this.state.downloadPressed && (!fileInfo || fileInfo.written_bytes === 0) && (
<ActivityIndicator size={'small'} color={Colors.NextLbryGreen} />
)}
{!completed &&
fileInfo &&
fileInfo.written_bytes > 0 &&
fileInfo.written_bytes < fileInfo.total_bytes &&
!this.state.stopDownloadConfirmed && (
<TouchableOpacity style={filePageStyle.innerLargeButton} onPress={this.onStopDownloadPressed}>
<Icon name={'stop'} size={16} style={filePageStyle.largeButtonIcon} />
<ProgressCircle
percent={(fileInfo.written_bytes / fileInfo.total_bytes) * 100}
radius={9}
borderWidth={2}
shadowColor={Colors.ActionGrey}
color={Colors.NextLbryGreen}
>
<Icon name={'stop'} size={6} style={filePageStyle.largeButtonIcon} />
</ProgressCircle>
<Text style={filePageStyle.largeButtonText}>{__('Stop')}</Text>
</TouchableOpacity>
)}
+46
View File
@@ -0,0 +1,46 @@
import { connect } from 'react-redux';
import { selectMyChannelClaims, selectFetchingMyChannels, doFetchChannelListMine, doToast } from 'lbry-redux';
import {
selectReferralReward,
selectUserInvitesRemaining,
selectUserInviteNewIsPending,
selectUserInviteNewErrorMessage,
selectUserInviteReferralLink,
selectUserInviteReferralCode,
selectUserInvitees,
selectUserInviteStatusIsPending,
doFetchInviteStatus,
doUserInviteNew,
} from 'lbryinc';
import { doPushDrawerStack, doPopDrawerStack, doSetPlayerVisible } from 'redux/actions/drawer';
import { doUpdateChannelFormState, doClearChannelFormState } from 'redux/actions/form';
import { selectDrawerStack } from 'redux/selectors/drawer';
import { selectChannelFormState, selectHasChannelFormState } from 'redux/selectors/form';
import Constants from 'constants'; // eslint-disable-line node/no-deprecated-api
import InvitesPage from './view';
const select = state => ({
channels: selectMyChannelClaims(state),
fetchingChannels: selectFetchingMyChannels(state),
fetchingInvitees: selectUserInviteStatusIsPending(state),
errorMessage: selectUserInviteNewErrorMessage(state),
invitesRemaining: selectUserInvitesRemaining(state),
referralCode: selectUserInviteReferralCode(state),
isPending: selectUserInviteNewIsPending(state),
invitees: selectUserInvitees(state),
referralReward: selectReferralReward(state),
});
const perform = dispatch => ({
fetchChannelListMine: () => dispatch(doFetchChannelListMine()),
fetchInviteStatus: () => dispatch(doFetchInviteStatus()),
inviteNew: email => dispatch(doUserInviteNew(email)),
pushDrawerStack: () => dispatch(doPushDrawerStack(Constants.DRAWER_ROUTE_INVITES)),
setPlayerVisible: () => dispatch(doSetPlayerVisible(false)),
notify: data => dispatch(doToast(data)),
});
export default connect(
select,
perform,
)(InvitesPage);
+228
View File
@@ -0,0 +1,228 @@
import React from 'react';
import { Lbry, parseURI } from 'lbry-redux';
import {
ActivityIndicator,
Clipboard,
NativeModules,
ScrollView,
Text,
TextInput,
TouchableOpacity,
View,
} from 'react-native';
import Colors from 'styles/colors';
import Constants from 'constants'; // eslint-disable-line node/no-deprecated-api
import Icon from 'react-native-vector-icons/FontAwesome5';
import Link from 'component/link';
import Button from 'component/button';
import ChannelSelector from 'component/channelSelector';
import PageHeader from 'component/pageHeader';
import RewardCard from 'component/rewardCard';
import RewardEnrolment from 'component/rewardEnrolment';
import UriBar from 'component/uriBar';
import invitesStyle from 'styles/invites';
class InvitesPage extends React.PureComponent {
state = {
channelName: null,
email: null,
inviteLink: null,
selectedChannel: null,
};
componentWillMount() {
const { navigation } = this.props;
// this.didFocusListener = navigation.addListener('didFocus', this.onComponentFocused);
}
componentWillUnmount() {
if (this.didFocusListener) {
this.didFocusListener.remove();
}
}
onComponentFocused = () => {
const { fetchChannelListMine, fetchInviteStatus, pushDrawerStack, navigation, setPlayerVisible, user } = this.props;
pushDrawerStack();
setPlayerVisible();
NativeModules.Firebase.setCurrentScreen('Invites').then(result => {
fetchChannelListMine();
fetchInviteStatus();
});
};
componentDidMount() {
this.onComponentFocused();
}
handleChannelChange = channelName => {
const { channels = [] } = this.props;
if (channels && channels.length > 0) {
const filtered = channels.filter(c => c.name === channelName);
if (filtered.length > 0) {
const channel = filtered[0];
this.setState({ channelName, inviteLink: this.getLinkForChannel(channel) });
}
}
};
getLinkForChannel = channel => {
const { claimId, claimName } = parseURI(channel.permanent_url);
return `https://lbry.tv/$/invite/${claimName}:${claimId}`;
};
handleInviteEmailChange = text => {
this.setState({ email: text });
};
handleInvitePress = () => {
const { inviteNew, notify } = this.props;
const { email } = this.state;
if (!email || email.indexOf('@') === -1) {
return notify({
message: __('Please enter a valid email address to send an invite to.'),
isError: true,
});
}
inviteNew(email);
};
componentWillReceiveProps(nextProps) {
const { isPending: prevPending, notify } = this.props;
const { channels = [], isPending, errorMessage } = nextProps;
const { email } = this.state;
if (!this.state.channelName && channels && channels.length > 0) {
const firstChannel = channels[0];
this.setState({ channelName: firstChannel.name, inviteLink: this.getLinkForChannel(firstChannel) });
}
if (prevPending && !isPending) {
if (errorMessage && errorMessage.trim().length > 0) {
notify({ message: errorMessage, isError: true });
} else {
notify({ message: __(`${email} was invited to the LBRY party!`) });
this.setState({ email: null });
}
}
}
handleInviteLinkPress = () => {
const { notify } = this.props;
Clipboard.setString(this.state.inviteLink);
notify({
message: __('Invite link copied'),
});
};
render() {
const { fetchingInvitees, user, navigation, notify, isPending, invitees } = this.props;
const { email, inviteLink } = this.state;
const hasInvitees = invitees && invitees.length > 0;
return (
<View style={invitesStyle.container}>
<UriBar navigation={navigation} />
<ScrollView style={invitesStyle.scrollContainer}>
<TouchableOpacity style={invitesStyle.rewardDriverCard} onPress={() => navigation.navigate('Rewards')}>
<Icon name="award" size={16} style={invitesStyle.rewardDriverIcon} />
<Text style={invitesStyle.rewardDriverText}>{__('Earn rewards for inviting your friends.')}</Text>
</TouchableOpacity>
<View style={invitesStyle.card}>
<Text style={invitesStyle.title}>{__('Invite Link')}</Text>
<Text style={invitesStyle.text}>
{__('Share this link with friends (or enemies) and get 20 LBC when they join lbry.tv')}
</Text>
<Text style={invitesStyle.subTitle}>{__('Your invite link')}</Text>
<View style={invitesStyle.row}>
<Text selectable numberOfLines={1} style={invitesStyle.inviteLink} onPress={this.handleInviteLinkPress}>
{this.state.inviteLink}
</Text>
<Button icon={'clipboard'} style={invitesStyle.button} onPress={this.handleInviteLinkPress} />
</View>
<Text style={invitesStyle.customizeTitle}>{__('Customize invite link')}</Text>
<ChannelSelector
showAnonymous={false}
channelName={this.state.channelName}
onChannelChange={this.handleChannelChange}
/>
</View>
<View style={invitesStyle.card}>
<Text style={invitesStyle.title}>{__('Invite by Email')}</Text>
<Text style={invitesStyle.text}>
{__('Invite someone you know by email and earn 20 LBC when they join lbry.tv.')}
</Text>
<TextInput
style={invitesStyle.emailInput}
editable={!isPending}
value={this.state.email}
onChangeText={this.handleInviteEmailChange}
placeholder={__('imaginary@friend.com')}
underlineColorAndroid={Colors.NextLbryGreen}
/>
<View style={invitesStyle.rightRow}>
{isPending && (
<ActivityIndicator size={'small'} color={Colors.NextLbryGreen} style={invitesStyle.loading} />
)}
<Button
disabled={!email || email.indexOf('@') === -1 || isPending}
style={invitesStyle.button}
text={__('Invite')}
onPress={this.handleInvitePress}
/>
</View>
</View>
<View style={[invitesStyle.card, invitesStyle.lastCard]}>
<View style={invitesStyle.titleRow}>
<Text style={invitesStyle.titleCol}>{__('Invite History')}</Text>
{fetchingInvitees && <ActivityIndicator size={'small'} color={Colors.NextLbryGreen} />}
</View>
<Text style={invitesStyle.text}>
{__(
'Earn 20 LBC for inviting a friend, an enemy, a frenemy, or an enefriend. Everyone needs content freedom.',
)}
</Text>
<View style={invitesStyle.invitees}>
{hasInvitees && (
<View style={invitesStyle.inviteesHeader}>
<Text style={invitesStyle.emailHeader} numberOfLines={1}>
{__('Email')}
</Text>
<Text style={invitesStyle.rewardHeader} numberOfLines={1}>
{__('Reward')}
</Text>
</View>
)}
{hasInvitees &&
invitees.map(invitee => (
<View key={invitee.email} style={invitesStyle.inviteeItem}>
<Text style={invitesStyle.inviteeEmail} numberOfLines={1}>
{invitee.email}
</Text>
<Text style={invitesStyle.rewardStatus} numberOfLines={1}>
{invitee.invite_reward_claimed && __('Claimed')}
{!invitee.invite_reward_claimed &&
(invitee.invite_reward_claimable ? __('Claimable') : __('Unclaimable'))}
</Text>
</View>
))}
</View>
</View>
</ScrollView>
</View>
);
}
}
export default InvitesPage;
+3 -1
View File
@@ -1,6 +1,7 @@
import { connect } from 'react-redux';
import {
doPublish,
doFetchClaimListMine,
doResolveUri,
doToast,
doUpdatePublishForm,
@@ -27,6 +28,7 @@ const select = state => ({
const perform = dispatch => ({
notify: data => dispatch(doToast(data)),
clearPublishFormState: () => dispatch(doClearPublishFormState()),
fetchMyClaims: () => dispatch(doFetchClaimListMine()),
pendingPublishSuccess: pendingClaim => dispatch(doPendingPublishSuccess(pendingClaim)),
updatePublishForm: value => dispatch(doUpdatePublishForm(value)),
updatePublishFormState: data => dispatch(doUpdatePublishFormState(data)),
@@ -39,5 +41,5 @@ const perform = dispatch => ({
export default connect(
select,
perform
perform,
)(PublishPage);
+12 -3
View File
@@ -209,7 +209,7 @@ class PublishPage extends React.PureComponent {
};
onComponentFocused = () => {
const { balance, hasFormState, pushDrawerStack, setPlayerVisible, navigation } = this.props;
const { balance, fetchMyClaims, hasFormState, pushDrawerStack, setPlayerVisible, navigation } = this.props;
NativeModules.Firebase.setCurrentScreen('Publish').then(result => {
pushDrawerStack(Constants.DRAWER_ROUTE_PUBLISH, navigation.state.params ? navigation.state.params : null);
setPlayerVisible();
@@ -219,6 +219,7 @@ class PublishPage extends React.PureComponent {
NativeModules.Gallery.canUseCamera().then(canUseCamera => this.setState({ canUseCamera }));
NativeModules.Gallery.getThumbnailPath().then(thumbnailPath => this.setState({ thumbnailPath }));
fetchMyClaims();
NativeModules.UtilityModule.canReadWriteStorage().then(canReadWrite => {
if (!canReadWrite) {
@@ -356,7 +357,7 @@ class PublishPage extends React.PureComponent {
};
handlePublishPressed = () => {
const { balance, notify, publish, updatePublishForm } = this.props;
const { balance, myClaims, notify, publish, updatePublishForm } = this.props;
const {
editMode,
bid,
@@ -400,6 +401,14 @@ class PublishPage extends React.PureComponent {
if (!isNameValid(name, false)) {
notify({ message: __('Your content address contains invalid characters.'), isError: true });
return;
} else if (!editMode && myClaims && myClaims.length > 0) {
if (myClaims.some(claim => claim.name.toLowerCase() === name.trim().toLowerCase())) {
notify({
message: __('You have already published to the specified content address. Please enter a new address.'),
isError: true,
});
return;
}
}
if (!currentMedia && !editMode) {
@@ -628,7 +637,7 @@ class PublishPage extends React.PureComponent {
}
} else {
// could not determine the file path
notify({ message: __('The path could not be determined. Please try a different file.') });
notify({ message: __('The path could not be determined. Please try a different file.'), isError: true });
}
};
+33 -2
View File
@@ -11,6 +11,10 @@ import RewardEnrolment from 'component/rewardEnrolment';
import UriBar from 'component/uriBar';
import rewardStyle from 'styles/reward';
const FILTER_ALL = 'all';
const FILTER_AVAILABLE = 'available';
const FILTER_CLAIMED = 'claimed';
class RewardsPage extends React.PureComponent {
state = {
isEmailVerified: false,
@@ -19,6 +23,7 @@ class RewardsPage extends React.PureComponent {
verifyRequestStarted: false,
revealVerification: true,
firstRewardClaimed: false,
currentFilter: FILTER_AVAILABLE,
};
scrollView = null;
@@ -182,8 +187,13 @@ class RewardsPage extends React.PureComponent {
});
};
setFilter = filter => {
this.setState({ currentFilter: filter });
};
render() {
const { user, navigation } = this.props;
const { currentFilter } = this.state;
return (
<View style={rewardStyle.container}>
@@ -197,8 +207,29 @@ class RewardsPage extends React.PureComponent {
style={rewardStyle.scrollContainer}
contentContainerStyle={rewardStyle.scrollContentContainer}
>
{this.renderUnclaimedRewards()}
{this.renderClaimedRewards()}
<View style={rewardStyle.filterHeader}>
<Link
style={[rewardStyle.filterLink, currentFilter === FILTER_ALL ? rewardStyle.activeFilterLink : null]}
text={__('All')}
onPress={() => this.setFilter(FILTER_ALL)}
/>
<Link
style={[
rewardStyle.filterLink,
currentFilter === FILTER_AVAILABLE ? rewardStyle.activeFilterLink : null,
]}
text={__('Available')}
onPress={() => this.setFilter(FILTER_AVAILABLE)}
/>
<Link
style={[rewardStyle.filterLink, currentFilter === FILTER_CLAIMED ? rewardStyle.activeFilterLink : null]}
text={__('Claimed')}
onPress={() => this.setFilter(FILTER_CLAIMED)}
/>
</View>
{(currentFilter === FILTER_AVAILABLE || currentFilter === FILTER_ALL) && this.renderUnclaimedRewards()}
{(currentFilter === FILTER_CLAIMED || currentFilter === FILTER_ALL) && this.renderClaimedRewards()}
</ScrollView>
)}
</View>
+2
View File
@@ -14,11 +14,13 @@ import {
selectEmailToVerify,
} from 'lbryinc';
import { doSetClientSetting } from 'redux/actions/settings';
import { selectLastRouteInStack } from 'redux/selectors/drawer';
import SplashScreen from './view';
const select = state => ({
user: selectUser(state),
emailToVerify: selectEmailToVerify(state),
lastRouteInStack: selectLastRouteInStack(state),
});
const perform = dispatch => ({
+12 -25
View File
@@ -1,5 +1,5 @@
import React from 'react';
import { Lbry, doPreferenceGet } from 'lbry-redux';
import { Lbry, doPreferenceGet, isURIValid } from 'lbry-redux';
import { Lbryio } from 'lbryinc';
import { ActivityIndicator, DeviceEventEmitter, Linking, NativeModules, Platform, Text, View } from 'react-native';
import { NavigationActions, StackActions } from 'react-navigation';
@@ -11,7 +11,7 @@ import Button from 'component/button';
import ProgressBar from 'component/progressBar';
import PropTypes from 'prop-types';
import Colors from 'styles/colors';
import Constants from 'constants'; // eslint-disable-line node/no-deprecated-api
import Constants, { DrawerRoutes, InnerDrawerRoutes } from 'constants'; // eslint-disable-line node/no-deprecated-api
import splashStyle from 'styles/splash';
import RNFS from 'react-native-fs';
@@ -43,7 +43,7 @@ class SplashScreen extends React.PureComponent {
}
navigateToMain = () => {
const { navigation, notify, verifyUserEmail, verifyUserEmailFailure } = this.props;
const { lastRouteInStack, navigation, notify, verifyUserEmail, verifyUserEmailFailure } = this.props;
const resetAction = StackActions.reset({
index: 0,
actions: [NavigationActions.navigate({ routeName: 'Main' })],
@@ -55,29 +55,16 @@ class SplashScreen extends React.PureComponent {
? navigation.state.params.launchUrl
: this.state.launchUrl;
if (launchUrl) {
if (launchUrl.startsWith('lbry://?verify=')) {
let verification = {};
try {
verification = JSON.parse(atob(launchUrl.substring(15)));
} catch (error) {
console.log(error);
navigateToUri(navigation, transformUrl(launchUrl));
} else if (lastRouteInStack) {
// no launch url, check if there's a last route in stack to navigate to.
const { route, params } = lastRouteInStack;
if (route) {
if (DrawerRoutes.includes(route)) {
navigation.navigate({ routeName: route, params });
} else if (!InnerDrawerRoutes.includes(route) && isURIValid(route)) {
navigateToUri(navigation, route);
}
if (verification.token && verification.recaptcha) {
AsyncStorage.setItem(Constants.KEY_SHOULD_VERIFY_EMAIL, 'true');
try {
verifyUserEmail(verification.token, verification.recaptcha);
} catch (error) {
const message = __('Invalid Verification Token');
verifyUserEmailFailure(message);
notify({ message });
}
} else {
notify({
message: __('Invalid Verification URI'),
});
}
} else {
navigateToUri(navigation, transformUrl(launchUrl));
}
}
};
+12 -2
View File
@@ -1,16 +1,26 @@
import Constants from 'constants'; // eslint-disable-line node/no-deprecated-api
export const doPushDrawerStack = (routeName, params) => dispatch =>
export const doPushDrawerStack = (routeName, params) => dispatch => {
dispatch({
type: Constants.ACTION_PUSH_DRAWER_STACK,
data: { routeName, params },
});
export const doPopDrawerStack = () => dispatch =>
if (window.persistor) {
window.persistor.flush();
}
};
export const doPopDrawerStack = () => dispatch => {
dispatch({
type: Constants.ACTION_POP_DRAWER_STACK,
});
if (window.persistor) {
window.persistor.flush();
}
};
export const doSetPlayerVisible = (visible, uri) => dispatch =>
dispatch({
type: Constants.ACTION_SET_PLAYER_VISIBLE,
+18 -16
View File
@@ -59,22 +59,24 @@ export function doCompleteDownload(uri, outpoint, fileInfo) {
export function doStopDownloadingFile(uri, fileInfo) {
return dispatch => {
let params = { status: 'stop' };
if (fileInfo.sd_hash) {
params.sd_hash = fileInfo.sd_hash;
}
if (fileInfo.stream_hash) {
params.stream_hash = fileInfo.stream_hash;
}
if (fileInfo) {
if (fileInfo.sd_hash) {
params.sd_hash = fileInfo.sd_hash;
}
if (fileInfo.stream_hash) {
params.stream_hash = fileInfo.stream_hash;
}
Lbry.file_set_status(params).then(() => {
dispatch({
type: ACTIONS.DOWNLOADING_CANCELED,
data: { uri, outpoint: fileInfo.outpoint },
Lbry.file_set_status(params).then(() => {
dispatch({
type: ACTIONS.DOWNLOADING_CANCELED,
data: { uri, outpoint: fileInfo.outpoint },
});
// Should also delete the file after the user stops downloading
dispatch(doDeleteFile(fileInfo.outpoint, uri));
});
// Should also delete the file after the user stops downloading
dispatch(doDeleteFile(fileInfo.outpoint, uri));
});
}
};
}
@@ -95,7 +97,7 @@ export function doDeleteFile(outpoint, deleteFromComputer, abandonClaim) {
});
// If the file is for a claim we published then also abandon the claim
/*const myClaimsOutpoints = selectMyClaimsOutpoints(state);
/* const myClaimsOutpoints = selectMyClaimsOutpoints(state);
if (abandonClaim && myClaimsOutpoints.indexOf(outpoint) !== -1) {
const byOutpoint = selectFileInfosByOutpoint(state);
const fileInfo = byOutpoint[outpoint];
@@ -106,7 +108,7 @@ export function doDeleteFile(outpoint, deleteFromComputer, abandonClaim) {
dispatch(doAbandonClaim(txid, nout));
}
}*/
} */
dispatch({
type: ACTIONS.FILE_DELETE,
+8
View File
@@ -3,6 +3,7 @@ import Constants from 'constants'; // eslint-disable-line node/no-deprecated-api
const reducers = {};
const defaultState = {
stack: [{ route: Constants.DRAWER_ROUTE_DISCOVER, params: {} }], // Discover is always the first drawer route
lastRouteInStack: {},
playerVisible: false,
playerVisibleByUri: {},
currentRoute: null,
@@ -42,23 +43,30 @@ reducers[Constants.ACTION_PUSH_DRAWER_STACK] = (state, action) => {
canPushStack = false;
}
let lastRouteInStack;
if (canPushStack) {
newStack.push({ route: routeName, params });
// save the route
lastRouteInStack = { route: routeName, params };
}
return {
...state,
stack: newStack,
lastRouteInStack,
};
};
reducers[Constants.ACTION_POP_DRAWER_STACK] = (state, action) => {
// We don't want to pop the Discover route, since it's always expected to be the first
const newStack = state.stack.length === 1 ? state.stack.slice() : state.stack.slice(0, state.stack.length - 1);
const lastRouteInStack = newStack && newStack.length > 0 ? newStack[newStack.length - 1] : null;
return {
...state,
stack: newStack,
lastRouteInStack,
};
};
+5
View File
@@ -34,6 +34,11 @@ export const selectLastDrawerRoute = createSelector(
},
);
export const selectLastRouteInStack = createSelector(
selectState,
state => state.lastRouteInStack,
);
export const selectCurrentRoute = createSelector(
selectState,
state => state.currentRoute,
+1
View File
@@ -12,6 +12,7 @@ const Colors = {
TagGreen: '#e3f6f1',
TagGrape: '#da77f255',
LightGrey: '#cccccc',
ActionGrey: '#aaaaaa',
LighterGrey: '#e5e5e5',
Orange: '#ffbb00',
Red: '#ff0000',
+3 -2
View File
@@ -113,6 +113,7 @@ const filePageStyle = StyleSheet.create({
marginTop: -8,
marginLeft: 12,
marginRight: 12,
marginBottom: 16,
},
thumbnail: {
width: screenWidth,
@@ -331,7 +332,6 @@ const filePageStyle = StyleSheet.create({
tagContainer: {
marginLeft: 12,
marginRight: 12,
marginTop: 16,
marginBottom: 16,
flexDirection: 'row',
},
@@ -399,9 +399,10 @@ const filePageStyle = StyleSheet.create({
flex: 0.2,
},
largeButtonIcon: {
color: Colors.DescriptionGrey,
color: Colors.ActionGrey,
},
largeButtonText: {
color: Colors.ActionGrey,
fontFamily: 'Inter-Regular',
fontSize: 12,
marginTop: 4,
+150
View File
@@ -0,0 +1,150 @@
import { StyleSheet } from 'react-native';
import Colors from './colors';
const walletStyle = StyleSheet.create({
container: {
flex: 1,
backgroundColor: Colors.PageBackground,
},
scrollContainer: {
marginTop: 60,
},
row: {
flexDirection: 'row',
justifyContent: 'space-between',
alignItems: 'center',
},
button: {
backgroundColor: Colors.LbryGreen,
alignSelf: 'flex-start',
},
card: {
backgroundColor: Colors.White,
marginTop: 16,
marginLeft: 16,
marginRight: 16,
padding: 16,
},
title: {
fontFamily: 'Inter-SemiBold',
fontSize: 20,
marginBottom: 8,
},
titleRow: {
alignItems: 'center',
flexDirection: 'row',
marginBottom: 8,
justifyContent: 'space-between',
},
titleCol: {
fontFamily: 'Inter-SemiBold',
fontSize: 20,
},
text: {
fontFamily: 'Inter-Regular',
fontSize: 14,
},
link: {
color: Colors.LbryGreen,
fontFamily: 'Inter-Regular',
fontSize: 14,
},
smallText: {
fontFamily: 'Inter-Regular',
fontSize: 12,
},
rewardDriverCard: {
alignItems: 'center',
backgroundColor: Colors.RewardDriverBlue,
flexDirection: 'row',
padding: 16,
marginLeft: 16,
marginTop: 16,
marginRight: 16,
},
rewardDriverIcon: {
color: Colors.White,
marginRight: 8,
},
rewardDriverText: {
fontFamily: 'Inter-Regular',
color: Colors.White,
fontSize: 14,
},
subTitle: {
fontFamily: 'Inter-Regular',
fontSize: 14,
marginTop: 12,
marginBottom: 4,
},
customizeTitle: {
fontFamily: 'Inter-Regular',
fontSize: 14,
marginTop: 12,
},
inviteLink: {
fontFamily: 'Inter-Regular',
borderWidth: 1,
borderRadius: 16,
borderStyle: 'dashed',
borderColor: '#e1e1e1',
backgroundColor: '#f9f9f9',
paddingTop: 8,
paddingLeft: 8,
paddingRight: 8,
paddingBottom: 6,
width: '88%',
},
emailInput: {
fontFamily: 'Inter-Regular',
fontSize: 14,
},
rightRow: {
flexDirection: 'row',
alignItems: 'center',
justifyContent: 'flex-end',
},
loading: {
marginRight: 8,
},
lastCard: {
marginBottom: 16,
},
invitees: {
marginTop: 8,
},
inviteesHeader: {
flex: 1,
flexDirection: 'row',
alignItems: 'center',
marginBottom: 8,
},
emailHeader: {
fontFamily: 'Inter-SemiBold',
fontSize: 14,
width: '65%',
},
rewardHeader: {
fontFamily: 'Inter-SemiBold',
fontSize: 14,
width: '35%',
},
inviteeItem: {
flex: 1,
flexDirection: 'row',
alignItems: 'center',
marginBottom: 8,
},
inviteeEmail: {
fontFamily: 'Inter-Regular',
fontSize: 12,
width: '65%',
},
rewardStatus: {
fontFamily: 'Inter-Regular',
fontSize: 12,
width: '35%',
},
});
export default walletStyle;
+30 -2
View File
@@ -56,13 +56,41 @@ const mediaPlayerStyle = StyleSheet.create({
height: '100%',
},
playerControlsContainer: {
backgroundColor: '#00000020',
backgroundColor: '#00000040',
flex: 1,
alignItems: 'center',
justifyContent: 'center',
},
playPauseButton: {
midControls: {
flex: 1,
flexDirection: 'row',
height: 64,
position: 'absolute',
alignItems: 'center',
justifyContent: 'center',
},
midControlText: {
fontFamily: 'Inter-Regular',
fontSize: 10,
position: 'absolute',
top: 10,
color: Colors.White,
},
leftMidControlText: {
left: -6,
},
rightMidControlText: {
right: -6,
},
rewind10: {
marginRight: 48,
alignItems: 'center',
},
forward10: {
marginLeft: 48,
alignItems: 'center',
},
playPauseButton: {
width: 64,
height: 64,
alignItems: 'center',
+17
View File
@@ -305,6 +305,23 @@ const rewardStyle = StyleSheet.create({
fontSize: 12,
lineHeight: 16,
},
filterHeader: {
flexDirection: 'row',
alignItems: 'center',
marginTop: 16,
marginLeft: 16,
marginRight: 16,
padding: 16,
backgroundColor: Colors.White,
},
filterLink: {
fontFamily: 'Inter-Regular',
fontSize: 14,
marginRight: 24,
},
activeFilterLink: {
fontFamily: 'Inter-SemiBold',
},
});
export default rewardStyle;
+1
View File
@@ -10,6 +10,7 @@ const specialRouteMap = {
about: Constants.DRAWER_ROUTE_ABOUT,
allContent: Constants.DRAWER_ROUTE_TRENDING,
channels: Constants.DRAWER_ROUTE_CHANNEL_CREATOR,
invites: Constants.DRAWER_ROUTE_INVITES,
library: Constants.DRAWER_ROUTE_MY_LBRY,
publish: Constants.DRAWER_ROUTE_PUBLISH,
publishes: Constants.DRAWER_ROUTE_PUBLISHES,