Compare commits
21
Commits
| Author | SHA1 | Date | |
|---|---|---|---|
|
|
0115025b86 | ||
|
|
34fa24ffd0 | ||
|
|
9e8ba95fec | ||
|
|
d63253cc30 | ||
|
|
6ce143b145 | ||
|
|
c7ce7ea284 | ||
|
|
076122def4 | ||
|
|
625559528d | ||
|
|
c88961002f | ||
|
|
decf0623fb | ||
|
|
c7f2b78b92 | ||
|
|
47cf15741c | ||
|
|
e74a419ffd | ||
|
|
0c06f478c8 | ||
|
|
9391c1b78c | ||
|
|
e902420269 | ||
|
|
dc0d3ad9b6 | ||
|
|
1c70fc878a | ||
|
|
47cdf2698f | ||
|
|
cf5045cce3 | ||
|
|
e6139d59d9 |
No files matched your search
Generated
+320
-397
File diff suppressed because it is too large.
Load diff
+6
-6
@@ -12,8 +12,8 @@
|
||||
"base-64": "^0.1.0",
|
||||
"@expo/vector-icons": "^8.1.0",
|
||||
"gfycat-style-urls": "^1.0.3",
|
||||
"lbry-redux": "lbryio/lbry-redux#73f10d488d5fd5df7aa806b60c8df5c948ca3c9a",
|
||||
"lbryinc": "lbryio/lbryinc#17868d948a160af27a375956226f8dd23fa2c37d",
|
||||
"lbry-redux": "lbryio/lbry-redux#3133ea60b0302c162f7b6f67cc858997f1d2ab52",
|
||||
"lbryinc": "lbryio/lbryinc#b9f354ae50bd57691765a7d042c5054167878bf4",
|
||||
"lodash": ">=4.17.11",
|
||||
"merge": ">=1.2.1",
|
||||
"moment": "^2.22.1",
|
||||
@@ -22,15 +22,14 @@
|
||||
"@react-native-community/async-storage": "^1.5.1",
|
||||
"react-native-camera": "^2.11.1",
|
||||
"react-native-country-picker-modal": "^0.6.2",
|
||||
"react-native-document-picker": "^3.2.4",
|
||||
"react-native-exception-handler": "2.9.0",
|
||||
"react-native-fast-image": "^6.1.1",
|
||||
"react-native-fs": "^2.13.3",
|
||||
"react-native-gesture-handler": "^1.1.0",
|
||||
"react-native-gesture-handler": "1.1.0",
|
||||
"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-reanimated": "^1.2.0",
|
||||
"react-native-reanimated": "1.2.0",
|
||||
"react-native-super-grid": "^3.0.4",
|
||||
"react-native-vector-icons": "^6.6.0",
|
||||
"react-native-video": "lbryio/react-native-video#exoplayer-lbry-android",
|
||||
@@ -44,7 +43,8 @@
|
||||
"redux-persist-transform-compress": "^4.2.0",
|
||||
"redux-persist-transform-filter": "0.0.18",
|
||||
"redux-thunk": "^2.3.0",
|
||||
"rn-fetch-blob": "0.10.15"
|
||||
"rn-fetch-blob": "0.10.15",
|
||||
"seedrandom": "3.0.3"
|
||||
},
|
||||
"devDependencies": {
|
||||
"@babel/core": "^7.5.4",
|
||||
|
||||
@@ -1,5 +1,6 @@
|
||||
import React from 'react';
|
||||
import AboutPage from 'page/about';
|
||||
import ChannelCreatorPage from 'page/channelCreator';
|
||||
import DiscoverPage from 'page/discover';
|
||||
import DownloadsPage from 'page/downloads';
|
||||
import DrawerContent from 'component/drawerContent';
|
||||
@@ -40,7 +41,7 @@ import {
|
||||
} from 'lbryinc';
|
||||
import { makeSelectClientSetting } from 'redux/selectors/settings';
|
||||
import { decode as atob } from 'base-64';
|
||||
import { dispatchNavigateBack, dispatchNavigateToUri } from 'utils/helper';
|
||||
import { dispatchNavigateBack, dispatchNavigateToUri, transformUrl } from 'utils/helper';
|
||||
import AsyncStorage from '@react-native-community/async-storage';
|
||||
import Colors from 'styles/colors';
|
||||
import Constants from 'constants'; // eslint-disable-line node/no-deprecated-api
|
||||
@@ -159,6 +160,12 @@ const drawer = createDrawerNavigator(
|
||||
drawerIcon: ({ tintColor }) => <Icon name="wallet" size={drawerIconSize} style={{ color: tintColor }} />,
|
||||
},
|
||||
},
|
||||
ChannelCreator: {
|
||||
screen: ChannelCreatorPage,
|
||||
navigationOptions: {
|
||||
drawerIcon: ({ tintColor }) => <Icon name="at" size={drawerIconSize} style={{ color: tintColor }} />,
|
||||
},
|
||||
},
|
||||
Publish: {
|
||||
screen: PublishPage,
|
||||
navigationOptions: {
|
||||
@@ -413,7 +420,7 @@ class AppWithNavigationState extends React.Component {
|
||||
);
|
||||
}
|
||||
} else {
|
||||
dispatchNavigateToUri(dispatch, nav, evt.url);
|
||||
dispatchNavigateToUri(dispatch, nav, transformUrl(evt.url));
|
||||
}
|
||||
}
|
||||
};
|
||||
|
||||
@@ -13,10 +13,15 @@ export default class ChannelIconItem extends React.PureComponent {
|
||||
autothumbStyle.autothumbBlue,
|
||||
autothumbStyle.autothumbLightBlue,
|
||||
autothumbStyle.autothumbCyan,
|
||||
autothumbStyle.autothumbTeal,
|
||||
autothumbStyle.autothumbGreen,
|
||||
autothumbStyle.autothumbYellow,
|
||||
autothumbStyle.autothumbOrange,
|
||||
autothumbStyle.autothumbDeepPurple,
|
||||
autothumbStyle.autothumbAmber,
|
||||
autothumbStyle.autothumbLime,
|
||||
autothumbStyle.autothumbLightGreen,
|
||||
autothumbStyle.autothumbDeepOrange,
|
||||
autothumbStyle.autothumbBrown,
|
||||
];
|
||||
|
||||
state = {
|
||||
|
||||
@@ -11,14 +11,13 @@ import { selectShowNsfw } from 'redux/selectors/settings';
|
||||
import Constants from 'constants'; // eslint-disable-line node/no-deprecated-api
|
||||
import ClaimList from './view';
|
||||
|
||||
const select = (state, props) => {
|
||||
return {
|
||||
claimSearchByQuery: selectClaimSearchByQuery(state),
|
||||
lastPageReached: selectClaimSearchByQueryLastPageReached(state),
|
||||
loadingByQuery: selectFetchingClaimSearchByQuery(state),
|
||||
loading: selectFetchingClaimSearch(state),
|
||||
};
|
||||
};
|
||||
const select = state => ({
|
||||
showNsfwContent: selectShowNsfw(state),
|
||||
claimSearchByQuery: selectClaimSearchByQuery(state),
|
||||
lastPageReached: selectClaimSearchByQueryLastPageReached(state),
|
||||
loadingByQuery: selectFetchingClaimSearchByQuery(state),
|
||||
loading: selectFetchingClaimSearch(state),
|
||||
});
|
||||
|
||||
const perform = dispatch => ({
|
||||
claimSearch: options => dispatch(doClaimSearch(options)),
|
||||
|
||||
@@ -42,7 +42,6 @@ class ClaimList extends React.PureComponent {
|
||||
tags: prevTags,
|
||||
channelIds: prevChannelIds,
|
||||
time: prevTime,
|
||||
showNsfwContent,
|
||||
} = prevProps;
|
||||
const { claimSearchByQuery, orderBy, tags, channelIds, time } = this.props;
|
||||
|
||||
@@ -72,7 +71,7 @@ class ClaimList extends React.PureComponent {
|
||||
}
|
||||
|
||||
buildClaimSearchOptions() {
|
||||
const { orderBy = Constants.DEFAULT_ORDER_BY, channelIds, showNsfwContent, tags, time } = this.props;
|
||||
const { orderBy, channelIds, showNsfwContent, tags, time } = this.props;
|
||||
const { currentPage, subscriptionsView } = this.state;
|
||||
|
||||
const options = {
|
||||
@@ -205,7 +204,11 @@ class ClaimList extends React.PureComponent {
|
||||
|
||||
const options = this.buildClaimSearchOptions();
|
||||
const claimSearchKey = createNormalizedClaimSearchKey(options);
|
||||
const uris = claimSearchByQuery[claimSearchKey];
|
||||
let uris = claimSearchByQuery[claimSearchKey];
|
||||
|
||||
if (uris) {
|
||||
uris = uris.filter(uri => uri && uri.length > 0);
|
||||
}
|
||||
|
||||
if (Constants.ORIENTATION_VERTICAL === orientation) {
|
||||
return (
|
||||
|
||||
@@ -12,6 +12,7 @@ const groupedMenuItems = {
|
||||
{ icon: 'globe-americas', label: 'All content', route: Constants.DRAWER_ROUTE_TRENDING },
|
||||
],
|
||||
'Your content': [
|
||||
{ icon: 'at', label: 'Channels', route: Constants.DRAWER_ROUTE_CHANNEL_CREATOR },
|
||||
{ icon: 'download', label: 'Library', route: Constants.DRAWER_ROUTE_MY_LBRY },
|
||||
{ icon: 'cloud-upload-alt', label: 'Publishes', route: Constants.DRAWER_ROUTE_PUBLISHES },
|
||||
{ icon: 'upload', label: 'New publish', route: Constants.DRAWER_ROUTE_PUBLISH },
|
||||
|
||||
@@ -53,39 +53,39 @@ class FileList extends React.PureComponent<Props, State> {
|
||||
dateNew: fileInfos =>
|
||||
this.props.sortByHeight
|
||||
? fileInfos.slice().sort((fileInfo1, fileInfo2) => {
|
||||
if (fileInfo1.pending) {
|
||||
return -1;
|
||||
}
|
||||
const height1 = this.props.claimsById[fileInfo1.claim_id]
|
||||
? this.props.claimsById[fileInfo1.claim_id].height
|
||||
: 0;
|
||||
const height2 = this.props.claimsById[fileInfo2.claim_id]
|
||||
? this.props.claimsById[fileInfo2.claim_id].height
|
||||
: 0;
|
||||
if (height1 > height2) {
|
||||
return -1;
|
||||
} else if (height1 < height2) {
|
||||
return 1;
|
||||
}
|
||||
return 0;
|
||||
})
|
||||
if (fileInfo1.pending) {
|
||||
return -1;
|
||||
}
|
||||
const height1 = this.props.claimsById[fileInfo1.claim_id]
|
||||
? this.props.claimsById[fileInfo1.claim_id].height
|
||||
: 0;
|
||||
const height2 = this.props.claimsById[fileInfo2.claim_id]
|
||||
? this.props.claimsById[fileInfo2.claim_id].height
|
||||
: 0;
|
||||
if (height1 > height2) {
|
||||
return -1;
|
||||
} else if (height1 < height2) {
|
||||
return 1;
|
||||
}
|
||||
return 0;
|
||||
})
|
||||
: [...fileInfos].reverse(),
|
||||
dateOld: fileInfos =>
|
||||
this.props.sortByHeight
|
||||
? fileInfos.slice().sort((fileInfo1, fileInfo2) => {
|
||||
const height1 = this.props.claimsById[fileInfo1.claim_id]
|
||||
? this.props.claimsById[fileInfo1.claim_id].height
|
||||
: 999999;
|
||||
const height2 = this.props.claimsById[fileInfo2.claim_id]
|
||||
? this.props.claimsById[fileInfo2.claim_id].height
|
||||
: 999999;
|
||||
if (height1 < height2) {
|
||||
return -1;
|
||||
} else if (height1 > height2) {
|
||||
return 1;
|
||||
}
|
||||
return 0;
|
||||
})
|
||||
const height1 = this.props.claimsById[fileInfo1.claim_id]
|
||||
? this.props.claimsById[fileInfo1.claim_id].height
|
||||
: 999999;
|
||||
const height2 = this.props.claimsById[fileInfo2.claim_id]
|
||||
? this.props.claimsById[fileInfo2.claim_id].height
|
||||
: 999999;
|
||||
if (height1 < height2) {
|
||||
return -1;
|
||||
} else if (height1 > height2) {
|
||||
return 1;
|
||||
}
|
||||
return 0;
|
||||
})
|
||||
: fileInfos,
|
||||
title: fileInfos =>
|
||||
fileInfos.slice().sort((fileInfo1, fileInfo2) => {
|
||||
@@ -160,7 +160,7 @@ class FileList extends React.PureComponent<Props, State> {
|
||||
// This is unfortunate
|
||||
// https://github.com/lbryio/lbry/issues/1159
|
||||
const name = claimName || claimNameDownloaded;
|
||||
uriParams.contentName = name;
|
||||
uriParams.claimName = name;
|
||||
uriParams.claimId = claimId;
|
||||
const uri = buildURI(uriParams);
|
||||
|
||||
@@ -179,7 +179,7 @@ class FileList extends React.PureComponent<Props, State> {
|
||||
style={fileListStyle.fileItem}
|
||||
uri={item}
|
||||
navigation={navigation}
|
||||
showDetails={true}
|
||||
showDetails
|
||||
compactView={false}
|
||||
/>
|
||||
)}
|
||||
|
||||
@@ -3,6 +3,7 @@ import { normalizeURI, parseURI } from 'lbry-redux';
|
||||
import { ActivityIndicator, Platform, Text, TouchableOpacity, View } from 'react-native';
|
||||
import { navigateToUri, formatBytes } from 'utils/helper';
|
||||
import Colors from 'styles/colors';
|
||||
import Constants from 'constants'; // eslint-disable-line node/no-deprecated-api
|
||||
import DateTime from 'component/dateTime';
|
||||
import FileItemMedia from 'component/fileItemMedia';
|
||||
import Icon from 'react-native-vector-icons/FontAwesome5';
|
||||
@@ -12,6 +13,10 @@ import ProgressBar from 'component/progressBar';
|
||||
import fileListStyle from 'styles/fileList';
|
||||
|
||||
class FileListItem extends React.PureComponent {
|
||||
state = {
|
||||
url: null,
|
||||
};
|
||||
|
||||
getStorageForFileInfo = fileInfo => {
|
||||
if (!fileInfo.completed) {
|
||||
const written = formatBytes(fileInfo.written_bytes);
|
||||
@@ -41,9 +46,21 @@ class FileListItem extends React.PureComponent {
|
||||
}
|
||||
}
|
||||
|
||||
componentDidUpdate() {
|
||||
const { claim, resolveUri, uri } = this.props;
|
||||
if (!claim && uri !== this.state.url) {
|
||||
this.setState({ url: uri }, () => resolveUri(uri));
|
||||
}
|
||||
}
|
||||
|
||||
defaultOnPress = () => {
|
||||
const { autoplay, navigation, uri, shortUrl } = this.props;
|
||||
navigateToUri(navigation, shortUrl || uri, { autoplay });
|
||||
const { autoplay, claim, featuredResult, navigation, uri, shortUrl } = this.props;
|
||||
|
||||
if (featuredResult && !claim) {
|
||||
navigation.navigate({ routeName: Constants.DRAWER_ROUTE_PUBLISH, params: { vanityUrl: uri.trim() } });
|
||||
} else {
|
||||
navigateToUri(navigation, shortUrl || uri, { autoplay });
|
||||
}
|
||||
};
|
||||
|
||||
onPressHandler = () => {
|
||||
@@ -111,7 +128,7 @@ class FileListItem extends React.PureComponent {
|
||||
// shouldHide = 'channel' === claim.value_type;
|
||||
}
|
||||
|
||||
if (shouldHide || (!isResolvingUri && !claim) || (featuredResult && !isResolvingUri && !claim && !title && !name)) {
|
||||
if (shouldHide || (!isResolvingUri && !claim && !featuredResult)) {
|
||||
return null;
|
||||
}
|
||||
|
||||
@@ -130,7 +147,7 @@ class FileListItem extends React.PureComponent {
|
||||
style={fileListStyle.thumbnail}
|
||||
duration={duration}
|
||||
resizeMode="cover"
|
||||
title={title || name}
|
||||
title={title || name || normalizeURI(uri).substring(7)}
|
||||
thumbnail={thumbnail}
|
||||
/>
|
||||
{selected && (
|
||||
@@ -167,6 +184,13 @@ class FileListItem extends React.PureComponent {
|
||||
{isRewardContent && <Icon style={fileListStyle.rewardIcon} name="award" size={12} />}
|
||||
</View>
|
||||
)}
|
||||
|
||||
{featuredResult && !isResolving && !claim && (
|
||||
<View style={fileListStyle.titleContainer}>
|
||||
<Text style={fileListStyle.featuredTitle}>Nothing here. Publish something!</Text>
|
||||
</View>
|
||||
)}
|
||||
|
||||
{channel && !hideChannel && (
|
||||
<Link
|
||||
style={fileListStyle.publisher}
|
||||
|
||||
@@ -13,6 +13,7 @@ type Props = {
|
||||
id: string,
|
||||
reward_title: string,
|
||||
reward_amount: number,
|
||||
reward_range?: string,
|
||||
transaction_id: string,
|
||||
created_at: string,
|
||||
reward_description: string,
|
||||
@@ -55,6 +56,20 @@ class RewardCard extends React.PureComponent<Props> {
|
||||
});
|
||||
};
|
||||
|
||||
getDisplayAmount = () => {
|
||||
const { reward } = this.props;
|
||||
if (reward) {
|
||||
if (reward.reward_range && reward.reward_range.includes('-')) {
|
||||
return reward.reward_range.split('-')[0] + '+'; // ex: 5+
|
||||
} else if (reward.reward_amount > 0) {
|
||||
return reward.reward_amount;
|
||||
}
|
||||
}
|
||||
|
||||
// unknown amount which normally shouldn't happen
|
||||
return '?';
|
||||
};
|
||||
|
||||
render() {
|
||||
const { canClaim, isPending, onClaimPress, reward } = this.props;
|
||||
const claimed = !!reward.transaction_id;
|
||||
@@ -101,7 +116,7 @@ class RewardCard extends React.PureComponent<Props> {
|
||||
)}
|
||||
</View>
|
||||
<View style={rewardStyle.rightCol}>
|
||||
<Text style={rewardStyle.rewardAmount}>{reward.reward_amount}</Text>
|
||||
<Text style={rewardStyle.rewardAmount}>{this.getDisplayAmount()}</Text>
|
||||
<Text style={rewardStyle.rewardCurrency}>LBC</Text>
|
||||
</View>
|
||||
</TouchableOpacity>
|
||||
|
||||
@@ -67,11 +67,12 @@ export default class TagSearch extends React.PureComponent {
|
||||
};
|
||||
|
||||
render() {
|
||||
const { name, style, type, selectedTags = [], showNsfwTags } = this.props;
|
||||
const { editable, name, style, type, selectedTags = [], showNsfwTags } = this.props;
|
||||
|
||||
return (
|
||||
<View>
|
||||
<TextInput
|
||||
editable={editable}
|
||||
style={tagStyle.searchInput}
|
||||
placeholder={'Search for more tags'}
|
||||
underlineColorAndroid={Colors.NextLbryGreen}
|
||||
|
||||
@@ -19,11 +19,12 @@ class TransactionListItem extends React.PureComponent {
|
||||
return (
|
||||
<View style={transactionListStyle.listItem}>
|
||||
<View style={[transactionListStyle.row, transactionListStyle.topRow]}>
|
||||
<View style={transactionListStyle.col}>
|
||||
<View style={[transactionListStyle.col, transactionListStyle.leftCol]}>
|
||||
<Text style={transactionListStyle.text}>{this.capitalize(type)}</Text>
|
||||
{name && claimId && (
|
||||
<Link
|
||||
style={transactionListStyle.link}
|
||||
numberOfLines={1}
|
||||
onPress={() => navigateToUri(navigation, buildURI({ claimName: name, claimId }))}
|
||||
text={name}
|
||||
/>
|
||||
@@ -37,7 +38,7 @@ class TransactionListItem extends React.PureComponent {
|
||||
</View>
|
||||
</View>
|
||||
<View style={transactionListStyle.row}>
|
||||
<View style={transactionListStyle.col}>
|
||||
<View style={[transactionListStyle.col, transactionListStyle.leftCol]}>
|
||||
<Link
|
||||
style={transactionListStyle.smallLink}
|
||||
text={txid.substring(0, 8)}
|
||||
|
||||
@@ -2,7 +2,7 @@
|
||||
import React from 'react';
|
||||
import { SEARCH_TYPES, isNameValid, isURIValid, normalizeURI } from 'lbry-redux';
|
||||
import { FlatList, Keyboard, Text, TextInput, TouchableOpacity, View } from 'react-native';
|
||||
import { navigateToUri } from 'utils/helper';
|
||||
import { navigateToUri, transformUrl } from 'utils/helper';
|
||||
import Constants from 'constants'; // eslint-disable-line node/no-deprecated-api
|
||||
import UriBarItem from './internal/uri-bar-item';
|
||||
import Icon from 'react-native-vector-icons/FontAwesome5';
|
||||
@@ -109,12 +109,19 @@ class UriBar extends React.PureComponent {
|
||||
handleSubmitEditing = () => {
|
||||
const { navigation, onSearchSubmitted, updateSearchQuery } = this.props;
|
||||
if (this.state.inputText) {
|
||||
let inputText = this.state.inputText;
|
||||
if (inputText.startsWith('lbry://') && isURIValid(inputText)) {
|
||||
let inputText = this.state.inputText,
|
||||
inputTextIsUrl = false;
|
||||
if (inputText.startsWith('lbry://')) {
|
||||
const transformedUrl = transformUrl(inputText);
|
||||
// if it's a URI (lbry://...), open the file page
|
||||
const uri = normalizeURI(inputText);
|
||||
navigateToUri(navigation, uri);
|
||||
} else {
|
||||
if (transformedUrl && isURIValid(transformedUrl)) {
|
||||
inputTextIsUrl = true;
|
||||
navigateToUri(navigation, transformedUrl);
|
||||
}
|
||||
}
|
||||
|
||||
// couldn't parse the inputText as a URL for some reason, so do a search instead
|
||||
if (!inputTextIsUrl) {
|
||||
updateSearchQuery(inputText);
|
||||
// Not a URI, default to a search request
|
||||
if (onSearchSubmitted) {
|
||||
|
||||
@@ -25,6 +25,9 @@ const Constants = {
|
||||
PHASE_DETAILS: 'details',
|
||||
PHASE_PUBLISH: 'publish',
|
||||
|
||||
PHASE_LIST: 'list',
|
||||
PHASE_NEW: 'create',
|
||||
|
||||
CONTENT_TAB: 'content',
|
||||
ABOUT_TAB: 'about',
|
||||
|
||||
@@ -56,6 +59,11 @@ const Constants = {
|
||||
ACTION_SORT_BY_ITEM_CHANGED: 'SORT_BY_ITEM_CHANGED',
|
||||
ACTION_TIME_ITEM_CHANGED: 'TIME_ITEM_CHANGED',
|
||||
|
||||
ACTION_UPDATE_PUBLISH_FORM_STATE: 'UPDATE_PUBLISH_FORM_STATE',
|
||||
ACTION_UPDATE_CHANNEL_FORM_STATE: 'UPDATE_CHANNEL_FORM_STATE',
|
||||
ACTION_CLEAR_PUBLISH_FORM_STATE: 'CLEAR_PUBLISH_FORM_STATE',
|
||||
ACTION_CLEAR_CHANNEL_FORM_STATE: 'CLEAR_CHANNEL_FORM_STATE',
|
||||
|
||||
ORIENTATION_HORIZONTAL: 'horizontal',
|
||||
ORIENTATION_VERTICAL: 'vertical',
|
||||
|
||||
@@ -69,6 +77,7 @@ const Constants = {
|
||||
DRAWER_ROUTE_SUBSCRIPTIONS: 'Subscriptions',
|
||||
DRAWER_ROUTE_MY_LBRY: 'Downloads',
|
||||
DRAWER_ROUTE_PUBLISH: 'Publish',
|
||||
DRAWER_ROUTE_PUBLISH_FORM: 'PublishForm',
|
||||
DRAWER_ROUTE_PUBLISHES: 'Publishes',
|
||||
DRAWER_ROUTE_REWARDS: 'Rewards',
|
||||
DRAWER_ROUTE_WALLET: 'Wallet',
|
||||
@@ -77,6 +86,8 @@ const Constants = {
|
||||
DRAWER_ROUTE_SEARCH: 'Search',
|
||||
DRAWER_ROUTE_TRANSACTION_HISTORY: 'TransactionHistory',
|
||||
DRAWER_ROUTE_TAG: 'Tag',
|
||||
DRAWER_ROUTE_CHANNEL_CREATOR: 'ChannelCreator',
|
||||
DRAWER_ROUTE_CHANNEL_CREATOR_FORM: 'ChannnelCreatorForm',
|
||||
|
||||
FULL_ROUTE_NAME_DISCOVER: 'DiscoverStack',
|
||||
FULL_ROUTE_NAME_WALLET: 'WalletStack',
|
||||
@@ -146,4 +157,8 @@ export const DrawerRoutes = [
|
||||
Constants.DRAWER_ROUTE_ABOUT,
|
||||
Constants.DRAWER_ROUTE_SEARCH,
|
||||
Constants.DRAWER_ROUTE_TRANSACTION_HISTORY,
|
||||
Constants.DRAWER_ROUTE_CHANNEL_CREATOR,
|
||||
];
|
||||
|
||||
// sub-pages for main routes
|
||||
export const InnerDrawerRoutes = [Constants.DRAWER_ROUTE_CHANNEL_CREATOR_FORM, Constants.DRAWER_ROUTE_PUBLISH_FORM];
|
||||
@@ -37,6 +37,7 @@ import FilesystemStorage from 'redux-persist-filesystem-storage';
|
||||
import createCompressor from 'redux-persist-transform-compress';
|
||||
import createFilter from 'redux-persist-transform-filter';
|
||||
import moment from 'moment';
|
||||
import formReducer from 'redux/reducers/form';
|
||||
import drawerReducer from 'redux/reducers/drawer';
|
||||
import settingsReducer from 'redux/reducers/settings';
|
||||
import thunk from 'redux-thunk';
|
||||
@@ -109,6 +110,7 @@ const reducers = persistCombineReducers(persistOptions, {
|
||||
file: fileReducer,
|
||||
fileInfo: fileInfoReducer,
|
||||
filtered: filteredReducer,
|
||||
form: formReducer,
|
||||
homepage: homepageReducer,
|
||||
nav: navigatorReducer,
|
||||
notifications: notificationsReducer,
|
||||
|
||||
@@ -1,5 +1,5 @@
|
||||
import { connect } from 'react-redux';
|
||||
import { doFetchClaimsByChannel, makeSelectClaimForUri } from 'lbry-redux';
|
||||
import { makeSelectClaimForUri, selectMyChannelClaims } from 'lbry-redux';
|
||||
import { doPopDrawerStack } from 'redux/actions/drawer';
|
||||
import { doSetSortByItem, doSetTimeItem } from 'redux/actions/settings';
|
||||
import { selectDrawerStack } from 'redux/selectors/drawer';
|
||||
@@ -7,6 +7,7 @@ import { selectSortByItem, selectTimeItem } from 'redux/selectors/settings';
|
||||
import ChannelPage from './view';
|
||||
|
||||
const select = (state, props) => ({
|
||||
channels: selectMyChannelClaims(state),
|
||||
claim: makeSelectClaimForUri(props.uri)(state),
|
||||
drawerStack: selectDrawerStack(state),
|
||||
sortByItem: selectSortByItem(state),
|
||||
@@ -14,7 +15,6 @@ const select = (state, props) => ({
|
||||
});
|
||||
|
||||
const perform = dispatch => ({
|
||||
fetchClaims: (uri, page) => dispatch(doFetchClaimsByChannel(uri, page)),
|
||||
popDrawerStack: () => dispatch(doPopDrawerStack()),
|
||||
setSortByItem: item => dispatch(doSetSortByItem(item)),
|
||||
setTimeItem: item => dispatch(doSetTimeItem(item)),
|
||||
|
||||
@@ -2,6 +2,7 @@
|
||||
import React from 'react';
|
||||
import {
|
||||
ActivityIndicator,
|
||||
Alert,
|
||||
Dimensions,
|
||||
Image,
|
||||
NativeModules,
|
||||
@@ -159,10 +160,46 @@ class ChannelPage extends React.PureComponent {
|
||||
);
|
||||
};
|
||||
|
||||
onEditPressed = () => {
|
||||
const { claim, navigation } = this.props;
|
||||
if (claim) {
|
||||
const { permanent_url: permanentUrl } = claim;
|
||||
navigation.navigate({
|
||||
routeName: Constants.DRAWER_ROUTE_CHANNEL_CREATOR,
|
||||
params: { editChannelUrl: permanentUrl },
|
||||
});
|
||||
}
|
||||
};
|
||||
|
||||
onDeletePressed = () => {
|
||||
const { abandonClaim, claim, navigation } = this.props;
|
||||
if (claim) {
|
||||
const { txid, nout } = claim;
|
||||
|
||||
// show confirm alert
|
||||
Alert.alert(
|
||||
__('Delete channel'),
|
||||
__('Are you sure you want to delete this channel?'),
|
||||
[
|
||||
{ text: __('No') },
|
||||
{
|
||||
text: __('Yes'),
|
||||
onPress: () => {
|
||||
abandonClaim(txid, nout);
|
||||
navigation.navigate({ routeName: Constants.DRAWER_ROUTE_CHANNEL_CREATOR });
|
||||
},
|
||||
},
|
||||
],
|
||||
{ cancelable: true }
|
||||
);
|
||||
}
|
||||
};
|
||||
|
||||
render() {
|
||||
const { claim, navigation, uri, drawerStack, popDrawerStack, sortByItem, timeItem } = this.props;
|
||||
const { channels, claim, navigation, uri, drawerStack, popDrawerStack, sortByItem, timeItem } = this.props;
|
||||
const { name, permanent_url: permanentUrl } = claim;
|
||||
const { autoStyle, showSortPicker, showTimePicker } = this.state;
|
||||
const ownedChannel = channels ? channels.map(channel => channel.permanent_url).includes(permanentUrl) : false;
|
||||
|
||||
let thumbnailUrl,
|
||||
coverUrl,
|
||||
@@ -218,12 +255,32 @@ class ChannelPage extends React.PureComponent {
|
||||
</View>
|
||||
|
||||
<View style={channelPageStyle.subscribeButtonContainer}>
|
||||
<SubscribeButton style={channelPageStyle.subscribeButton} uri={fullUri} name={name} />
|
||||
<SubscribeNotificationButton
|
||||
style={[channelPageStyle.subscribeButton, channelPageStyle.bellButton]}
|
||||
uri={fullUri}
|
||||
name={name}
|
||||
/>
|
||||
{ownedChannel && (
|
||||
<Button
|
||||
style={channelPageStyle.actionButton}
|
||||
theme={'light'}
|
||||
icon={'edit'}
|
||||
text={'Edit'}
|
||||
onPress={this.onEditPressed}
|
||||
/>
|
||||
)}
|
||||
{ownedChannel && (
|
||||
<Button
|
||||
style={channelPageStyle.deleteButton}
|
||||
theme={'light'}
|
||||
icon={'trash-alt'}
|
||||
text={'Delete'}
|
||||
onPress={this.onDeletePressed}
|
||||
/>
|
||||
)}
|
||||
{!ownedChannel && <SubscribeButton style={channelPageStyle.subscribeButton} uri={fullUri} name={name} />}
|
||||
{!ownedChannel && (
|
||||
<SubscribeNotificationButton
|
||||
style={[channelPageStyle.subscribeButton, channelPageStyle.bellButton]}
|
||||
uri={fullUri}
|
||||
name={name}
|
||||
/>
|
||||
)}
|
||||
</View>
|
||||
</View>
|
||||
|
||||
|
||||
@@ -0,0 +1,49 @@
|
||||
import { connect } from 'react-redux';
|
||||
import {
|
||||
selectAbandoningIds,
|
||||
selectBalance,
|
||||
selectMyChannelClaims,
|
||||
selectFetchingMyChannels,
|
||||
selectUpdatingChannel,
|
||||
selectUpdateChannelError,
|
||||
doAbandonClaim,
|
||||
doFetchChannelListMine,
|
||||
doCreateChannel,
|
||||
doUpdateChannel,
|
||||
doToast,
|
||||
} from 'lbry-redux';
|
||||
import { doPushDrawerStack, doPopDrawerStack, doSetPlayerVisible } from 'redux/actions/drawer';
|
||||
import { doUpdateChannelFormState, doClearChannelFormState } from 'redux/actions/form';
|
||||
import { selectDrawerStack } from 'redux/selectors/drawer';
|
||||
import { selectChannelFormState } from 'redux/selectors/form';
|
||||
import Constants from 'constants'; // eslint-disable-line node/no-deprecated-api
|
||||
import ChannelCreator from './view';
|
||||
|
||||
const select = state => ({
|
||||
abandoningClaimIds: selectAbandoningIds(state),
|
||||
channels: selectMyChannelClaims(state),
|
||||
channelFormState: selectChannelFormState(state),
|
||||
drawerStack: selectDrawerStack(state),
|
||||
fetchingChannels: selectFetchingMyChannels(state),
|
||||
balance: selectBalance(state),
|
||||
updatingChannel: selectUpdatingChannel(state),
|
||||
updateChannelError: selectUpdateChannelError(state),
|
||||
});
|
||||
|
||||
const perform = dispatch => ({
|
||||
abandonClaim: (txid, nout) => dispatch(doAbandonClaim(txid, nout)),
|
||||
notify: data => dispatch(doToast(data)),
|
||||
clearChannelFormState: () => dispatch(doClearChannelFormState()),
|
||||
createChannel: (name, amount, optionalParams) => dispatch(doCreateChannel(name, amount, optionalParams)),
|
||||
fetchChannelListMine: () => dispatch(doFetchChannelListMine()),
|
||||
updateChannel: params => dispatch(doUpdateChannel(params)),
|
||||
updateChannelFormState: data => dispatch(doUpdateChannelFormState(data)),
|
||||
pushDrawerStack: (routeName, params) => dispatch(doPushDrawerStack(routeName, params)),
|
||||
popDrawerStack: () => dispatch(doPopDrawerStack()),
|
||||
setPlayerVisible: () => dispatch(doSetPlayerVisible(false)),
|
||||
});
|
||||
|
||||
export default connect(
|
||||
select,
|
||||
perform
|
||||
)(ChannelCreator);
|
||||
File diff suppressed because it is too large.
Load diff
@@ -1,6 +1,7 @@
|
||||
import { connect } from 'react-redux';
|
||||
import {
|
||||
doFetchFileInfo,
|
||||
doFetchChannelListMine,
|
||||
doFetchClaimListMine,
|
||||
doFileGet,
|
||||
doPurchaseUri,
|
||||
@@ -19,12 +20,14 @@ import {
|
||||
makeSelectThumbnailForUri,
|
||||
makeSelectTitleForUri,
|
||||
selectBalance,
|
||||
selectMyChannelClaims,
|
||||
selectMyClaimUrisWithoutChannels,
|
||||
selectPurchasedUris,
|
||||
selectFailedPurchaseUris,
|
||||
selectPurchaseUriErrorMessage,
|
||||
} from 'lbry-redux';
|
||||
import {
|
||||
doClaimEligiblePurchaseRewards,
|
||||
doFetchCostInfoForUri,
|
||||
makeSelectCostInfoForUri,
|
||||
selectRewardContentClaimIds,
|
||||
@@ -46,6 +49,7 @@ const select = (state, props) => {
|
||||
return {
|
||||
balance: selectBalance(state),
|
||||
blackListedOutpoints: selectBlackListedOutpoints(state),
|
||||
channels: selectMyChannelClaims(state),
|
||||
claim: makeSelectClaimForUri(selectProps.uri)(state),
|
||||
drawerStack: selectDrawerStack(state),
|
||||
isResolvingUri: makeSelectIsUriResolving(selectProps.uri)(state),
|
||||
@@ -69,12 +73,14 @@ const select = (state, props) => {
|
||||
};
|
||||
|
||||
const perform = dispatch => ({
|
||||
claimEligibleRewards: () => dispatch(doClaimEligiblePurchaseRewards()),
|
||||
deleteFile: (fileInfo, deleteFromDevice, abandonClaim) => {
|
||||
dispatch(doDeleteFile(fileInfo, deleteFromDevice, abandonClaim));
|
||||
},
|
||||
fetchFileInfo: uri => dispatch(doFetchFileInfo(uri)),
|
||||
fetchCostInfo: uri => dispatch(doFetchCostInfoForUri(uri)),
|
||||
fetchMyClaims: () => dispatch(doFetchClaimListMine()),
|
||||
fetchChannelListMine: () => dispatch(doFetchChannelListMine()),
|
||||
fileGet: (uri, saveFile) => dispatch(doFileGet(uri, saveFile)),
|
||||
notify: data => dispatch(doToast(data)),
|
||||
popDrawerStack: () => dispatch(doPopDrawerStack()),
|
||||
|
||||
+21
-5
@@ -1,5 +1,5 @@
|
||||
import React from 'react';
|
||||
import { Lbry, normalizeURI } from 'lbry-redux';
|
||||
import { Lbry, normalizeURI, parseURI } from 'lbry-redux';
|
||||
import { Lbryio } from 'lbryinc';
|
||||
import {
|
||||
ActivityIndicator,
|
||||
@@ -100,7 +100,7 @@ class FilePage extends React.PureComponent {
|
||||
DeviceEventEmitter.addListener('onDownloadUpdated', this.handleDownloadUpdated);
|
||||
DeviceEventEmitter.addListener('onDownloadCompleted', this.handleDownloadCompleted);
|
||||
|
||||
const { fileInfo, isResolvingUri, resolveUri, navigation } = this.props;
|
||||
const { fetchChannelListMine, fileInfo, isResolvingUri, resolveUri, navigation } = this.props;
|
||||
const { uri, uriVars } = navigation.state.params;
|
||||
this.setState({ uri, uriVars });
|
||||
|
||||
@@ -108,6 +108,7 @@ class FilePage extends React.PureComponent {
|
||||
|
||||
this.fetchFileInfo(this.props);
|
||||
this.fetchCostInfo(this.props);
|
||||
fetchChannelListMine();
|
||||
|
||||
if (NativeModules.Firebase) {
|
||||
NativeModules.Firebase.track('open_file_page', { uri: uri });
|
||||
@@ -477,6 +478,7 @@ class FilePage extends React.PureComponent {
|
||||
return;
|
||||
}
|
||||
|
||||
const { claimEligibleRewards } = this.props;
|
||||
const { nout, claim_id: claimId, txid } = claim;
|
||||
const outpoint = `${txid}:${nout}`;
|
||||
const params = {
|
||||
@@ -488,7 +490,9 @@ class FilePage extends React.PureComponent {
|
||||
params.time_to_start = timeToStart;
|
||||
}
|
||||
|
||||
Lbryio.call('file', 'view', params).catch(() => {});
|
||||
Lbryio.call('file', 'view', params)
|
||||
.then(() => claimEligibleRewards())
|
||||
.catch(() => {});
|
||||
this.setState({ fileViewLogged: true });
|
||||
};
|
||||
|
||||
@@ -567,6 +571,7 @@ class FilePage extends React.PureComponent {
|
||||
const {
|
||||
balance,
|
||||
claim,
|
||||
channels,
|
||||
channelUri,
|
||||
costInfo,
|
||||
fileInfo,
|
||||
@@ -585,6 +590,10 @@ class FilePage extends React.PureComponent {
|
||||
} = this.props;
|
||||
const { uri, autoplay } = navigation.state.params;
|
||||
|
||||
const myChannelUris = channels ? channels.map(channel => channel.permanent_url) : [];
|
||||
const ownedClaim = myClaimUris.includes(uri) || myChannelUris.includes(uri);
|
||||
const { isChannel } = parseURI(uri);
|
||||
|
||||
let innerContent = null;
|
||||
if ((isResolvingUri && !claim) || !claim) {
|
||||
return (
|
||||
@@ -597,7 +606,14 @@ class FilePage extends React.PureComponent {
|
||||
)}
|
||||
{claim === null && !isResolvingUri && (
|
||||
<View style={filePageStyle.container}>
|
||||
<Text style={filePageStyle.emptyClaimText}>There's nothing at this location.</Text>
|
||||
{ownedClaim && (
|
||||
<Text style={filePageStyle.emptyClaimText}>
|
||||
{isChannel
|
||||
? 'It looks like you just created this channel. It will appear in a few minutes.'
|
||||
: 'It looks you just published this content. It will appear in a few minutes.'}
|
||||
</Text>
|
||||
)}
|
||||
{!ownedClaim && <Text style={filePageStyle.emptyClaimText}>There's nothing at this location.</Text>}
|
||||
</View>
|
||||
)}
|
||||
<UriBar value={uri} navigation={navigation} />
|
||||
@@ -606,7 +622,7 @@ class FilePage extends React.PureComponent {
|
||||
}
|
||||
|
||||
if (claim) {
|
||||
if (claim && claim.name.length && claim.name[0] === '@') {
|
||||
if (isChannel) {
|
||||
return <ChannelPage uri={uri} navigation={navigation} />;
|
||||
}
|
||||
|
||||
|
||||
@@ -46,7 +46,7 @@ const perform = dispatch => ({
|
||||
syncApply: (hash, data, password) => dispatch(doSyncApply(hash, data, password)),
|
||||
getSync: password => dispatch(doGetSync(password)),
|
||||
checkSync: () => dispatch(doCheckSync()),
|
||||
setDefaultAccount: () => dispatch(doSetDefaultAccount()),
|
||||
setDefaultAccount: (success, failure) => dispatch(doSetDefaultAccount(success, failure)),
|
||||
notify: data => dispatch(doToast(data)),
|
||||
resendVerificationEmail: email => dispatch(doUserResendVerificationEmail(email)),
|
||||
});
|
||||
|
||||
@@ -33,7 +33,7 @@ class FirstRunScreen extends React.PureComponent {
|
||||
isEmailVerified: false,
|
||||
skipAccountConfirmed: false,
|
||||
showBottomContainer: false,
|
||||
walletPassword: null,
|
||||
walletPassword: '',
|
||||
syncApplyStarted: false,
|
||||
};
|
||||
|
||||
@@ -86,12 +86,25 @@ class FirstRunScreen extends React.PureComponent {
|
||||
this.setState({ showBottomContainer: true });
|
||||
} else {
|
||||
// password successfully verified
|
||||
if (NativeModules.UtilityModule) {
|
||||
NativeModules.UtilityModule.setSecureValue(Constants.KEY_FIRST_RUN_PASSWORD, this.state.walletPassword);
|
||||
}
|
||||
setDefaultAccount();
|
||||
setClientSetting(Constants.SETTING_DEVICE_WALLET_SYNCED, true);
|
||||
this.closeFinalPage();
|
||||
NativeModules.UtilityModule.setSecureValue(Constants.KEY_FIRST_RUN_PASSWORD, this.state.walletPassword);
|
||||
setDefaultAccount(
|
||||
() => {
|
||||
setClientSetting(Constants.SETTING_DEVICE_WALLET_SYNCED, true);
|
||||
|
||||
// unlock the wallet
|
||||
Lbry.account_unlock({ password: this.state.walletPassword ? this.state.walletPassword : '' })
|
||||
.then(() => this.closeFinalPage())
|
||||
.catch(err =>
|
||||
notify({ message: 'The wallet could not be unlocked at this time. Please restart the app.' })
|
||||
);
|
||||
},
|
||||
err => {
|
||||
notify({
|
||||
message:
|
||||
'The account restore operation could not be completed successfully. Please restart the app and try again.',
|
||||
});
|
||||
}
|
||||
);
|
||||
}
|
||||
}
|
||||
|
||||
@@ -253,7 +266,7 @@ class FirstRunScreen extends React.PureComponent {
|
||||
};
|
||||
|
||||
onWalletPasswordChanged = password => {
|
||||
this.setState({ walletPassword: password });
|
||||
this.setState({ walletPassword: password !== null ? password : '' });
|
||||
};
|
||||
|
||||
onWalletViewLayout = () => {
|
||||
|
||||
+74
-23
@@ -19,6 +19,7 @@ import {
|
||||
isNameValid,
|
||||
buildURI,
|
||||
normalizeURI,
|
||||
parseURI,
|
||||
regexInvalidURI,
|
||||
CLAIM_VALUES,
|
||||
LICENSES,
|
||||
@@ -27,7 +28,6 @@ import {
|
||||
} from 'lbry-redux';
|
||||
import { RNCamera } from 'react-native-camera';
|
||||
import { generateCombination } from 'gfycat-style-urls';
|
||||
import DocumentPicker from 'react-native-document-picker';
|
||||
import RNFS from 'react-native-fs';
|
||||
import Button from 'component/button';
|
||||
import ChannelSelector from 'component/channelSelector';
|
||||
@@ -79,6 +79,7 @@ class PublishPage extends React.PureComponent {
|
||||
state = {
|
||||
canPublish: false,
|
||||
canUseCamera: false,
|
||||
documentPickerOpen: false,
|
||||
editMode: false,
|
||||
titleFocused: false,
|
||||
descriptionFocused: false,
|
||||
@@ -120,10 +121,12 @@ class PublishPage extends React.PureComponent {
|
||||
otherLicenseDescription: '',
|
||||
name: null,
|
||||
price: 0,
|
||||
currency: 'LBC',
|
||||
uri: null,
|
||||
tags: [],
|
||||
selectedChannel: null,
|
||||
uploadedThumbnailUri: null,
|
||||
vanityUrlSet: false,
|
||||
|
||||
// other
|
||||
publishStarted: false,
|
||||
@@ -136,6 +139,8 @@ class PublishPage extends React.PureComponent {
|
||||
// this.didFocusListener = navigation.addListener('didFocus', this.onComponentFocused);
|
||||
DeviceEventEmitter.addListener('onGalleryThumbnailChecked', this.handleGalleryThumbnailChecked);
|
||||
DeviceEventEmitter.addListener('onAllGalleryThumbnailsChecked', this.handleAllGalleryThumbnailsChecked);
|
||||
DeviceEventEmitter.addListener('onDocumentPickerFilePicked', this.onFilePicked);
|
||||
DeviceEventEmitter.addListener('onDocumentPickerCanceled', this.onPickerCanceled);
|
||||
}
|
||||
|
||||
componentWillUnmount() {
|
||||
@@ -144,6 +149,8 @@ class PublishPage extends React.PureComponent {
|
||||
}
|
||||
DeviceEventEmitter.removeListener('onGalleryThumbnailChecked', this.handleGalleryThumbnailChecked);
|
||||
DeviceEventEmitter.removeListener('onAllGalleryThumbnailsChecked', this.handleAllGalleryThumbnailsChecked);
|
||||
DeviceEventEmitter.removeListener('onDocumentPickerFilePicked', this.onFilePicked);
|
||||
DeviceEventEmitter.removeListener('onDocumentPickerCanceled', this.onPickerCanceled);
|
||||
}
|
||||
|
||||
handleGalleryThumbnailChecked = evt => {
|
||||
@@ -180,9 +187,16 @@ class PublishPage extends React.PureComponent {
|
||||
|
||||
// Check if this is an edit action
|
||||
if (navigation.state.params) {
|
||||
const { editMode, claimToEdit } = navigation.state.params;
|
||||
const { editMode, claimToEdit, vanityUrl } = navigation.state.params;
|
||||
if (editMode) {
|
||||
this.prepareEdit(claimToEdit);
|
||||
} else if (vanityUrl) {
|
||||
const { claimName } = parseURI(vanityUrl);
|
||||
this.setState({
|
||||
name: claimName,
|
||||
hasEditedContentAddress: true,
|
||||
vanityUrlSet: true,
|
||||
});
|
||||
}
|
||||
}
|
||||
});
|
||||
@@ -228,12 +242,14 @@ class PublishPage extends React.PureComponent {
|
||||
licenseUrl,
|
||||
otherLicenseDescription,
|
||||
name,
|
||||
currency: fee && fee.currency ? fee.currency : 'LBC',
|
||||
price: fee && fee.amount ? fee.amount : 0,
|
||||
priceSet: fee && fee.amount > 0,
|
||||
tags: tags && tags.length > 0 ? tags : [],
|
||||
title,
|
||||
currentThumbnailUri: thumbnailUrl,
|
||||
uploadedThumbnailUri: thumbnailUrl,
|
||||
vanityUrlSet: false,
|
||||
},
|
||||
() => {
|
||||
this.handleNameChange(name);
|
||||
@@ -282,6 +298,7 @@ class PublishPage extends React.PureComponent {
|
||||
bid,
|
||||
channelName,
|
||||
currentMedia,
|
||||
currency,
|
||||
description,
|
||||
language,
|
||||
license,
|
||||
@@ -325,7 +342,7 @@ class PublishPage extends React.PureComponent {
|
||||
otherLicenseDescription,
|
||||
name: name || undefined,
|
||||
contentIsFree: !priceSet,
|
||||
fee: { currency: 'LBC', amount: price },
|
||||
fee: { currency, amount: price },
|
||||
uri: uri || undefined,
|
||||
channel: CLAIM_VALUES.CHANNEL_ANONYMOUS === channelName ? null : channelName,
|
||||
isStillEditing: false,
|
||||
@@ -380,7 +397,7 @@ class PublishPage extends React.PureComponent {
|
||||
{
|
||||
currentMedia: media,
|
||||
title: null, // no title autogeneration (user will fill this in)
|
||||
name: this.formatNameForTitle(name),
|
||||
name: this.state.hasEditedContentAddress ? this.state.name : this.formatNameForTitle(name),
|
||||
currentPhase: Constants.PHASE_DETAILS,
|
||||
},
|
||||
() => this.handleNameChange(this.state.name)
|
||||
@@ -397,6 +414,7 @@ class PublishPage extends React.PureComponent {
|
||||
this.setState(
|
||||
{
|
||||
publishStarted: false,
|
||||
documentPickerOpen: false,
|
||||
editMode: false,
|
||||
|
||||
currentMedia: null,
|
||||
@@ -426,6 +444,8 @@ class PublishPage extends React.PureComponent {
|
||||
tags: [],
|
||||
selectedChannel: null,
|
||||
uploadedThumbnailUri: null,
|
||||
|
||||
vanityUrlSet: false,
|
||||
},
|
||||
() => {
|
||||
// reset thumbnail
|
||||
@@ -446,6 +466,36 @@ class PublishPage extends React.PureComponent {
|
||||
}
|
||||
};
|
||||
|
||||
handleUploadPressed = () => {
|
||||
if (this.state.documentPickerOpen) {
|
||||
return;
|
||||
}
|
||||
|
||||
this.setState(
|
||||
{
|
||||
documentPickerOpen: true,
|
||||
},
|
||||
() => {
|
||||
NativeModules.UtilityModule.openDocumentPicker('*/*');
|
||||
}
|
||||
);
|
||||
};
|
||||
|
||||
onFilePicked = evt => {
|
||||
this.setState({ documentPickerOpen: false }, () => {
|
||||
const currentMedia = {
|
||||
id: -1,
|
||||
filePath: `file://${evt.path}`,
|
||||
duration: 0,
|
||||
};
|
||||
this.setCurrentMedia(currentMedia);
|
||||
});
|
||||
};
|
||||
|
||||
onPickerCanceled = () => {
|
||||
this.setState({ documentPickerOpen: false });
|
||||
};
|
||||
|
||||
handleCloseCameraPressed = () => {
|
||||
this.setState({ showCameraOverlay: false, videoRecordingMode: false });
|
||||
};
|
||||
@@ -512,18 +562,7 @@ class PublishPage extends React.PureComponent {
|
||||
});
|
||||
};
|
||||
|
||||
handleUploadPressed = () => {
|
||||
DocumentPicker.pick({ type: [DocumentPicker.types.allFiles] })
|
||||
.then(file => {
|
||||
// console.log(file);
|
||||
})
|
||||
.catch(error => {
|
||||
if (!DocumentPicker.isCancel(error)) {
|
||||
// notify the user
|
||||
// console.log(error);
|
||||
}
|
||||
});
|
||||
};
|
||||
handleUploadPressed = () => {};
|
||||
|
||||
getRandomFileId = () => {
|
||||
// generate a random id for a photo or recorded video between 1 and 20 (for creating thumbnails)
|
||||
@@ -655,6 +694,10 @@ class PublishPage extends React.PureComponent {
|
||||
}
|
||||
};
|
||||
|
||||
handleCurrencyValueChange = currency => {
|
||||
this.setState({ currency });
|
||||
};
|
||||
|
||||
handleDescriptionChange = description => {
|
||||
this.setState({ description });
|
||||
};
|
||||
@@ -727,12 +770,10 @@ class PublishPage extends React.PureComponent {
|
||||
<Icon name="camera" size={48} color={Colors.White} />
|
||||
<Text style={publishStyle.actionText}>Take a photo</Text>
|
||||
</TouchableOpacity>
|
||||
{false && (
|
||||
<TouchableOpacity style={publishStyle.upload} onPress={this.handleUploadPressed}>
|
||||
<Icon name="file-upload" size={48} color={Colors.White} />
|
||||
<Text style={publishStyle.actionText}>Upload a file</Text>
|
||||
</TouchableOpacity>
|
||||
)}
|
||||
<TouchableOpacity style={publishStyle.upload} onPress={this.handleUploadPressed}>
|
||||
<Icon name="file-upload" size={48} color={Colors.White} />
|
||||
<Text style={publishStyle.actionText}>Upload a file</Text>
|
||||
</TouchableOpacity>
|
||||
</View>
|
||||
</View>
|
||||
</View>
|
||||
@@ -826,6 +867,7 @@ class PublishPage extends React.PureComponent {
|
||||
)}
|
||||
<TextInput
|
||||
editable={this.state.canPublish && !this.state.publishStarted}
|
||||
multiline
|
||||
placeholder={this.state.descriptionFocused ? '' : 'Description'}
|
||||
style={publishStyle.inputText}
|
||||
value={this.state.description}
|
||||
@@ -888,7 +930,16 @@ class PublishPage extends React.PureComponent {
|
||||
value={String(this.state.price)}
|
||||
onChangeText={this.handlePriceChange}
|
||||
/>
|
||||
<Text style={publishStyle.currency}>LBC</Text>
|
||||
<Picker
|
||||
style={publishStyle.currencyPicker}
|
||||
enabled={this.state.canPublish && !this.state.publishStarted}
|
||||
selectedValue={this.state.currency}
|
||||
itemStyle={publishStyle.pickerItem}
|
||||
onValueChange={this.handleCurrencyValueChange}
|
||||
>
|
||||
<Picker.Item label={'LBC'} value={'LBC'} />
|
||||
<Picker.Item label={'USD'} value={'USD'} />
|
||||
</Picker>
|
||||
</View>
|
||||
)}
|
||||
</View>
|
||||
|
||||
@@ -33,6 +33,15 @@ class PublishesPage extends React.PureComponent {
|
||||
this.onComponentFocused();
|
||||
}
|
||||
|
||||
componentWillReceiveProps(nextProps) {
|
||||
const { currentRoute } = nextProps;
|
||||
const { currentRoute: prevRoute } = this.props;
|
||||
|
||||
if (Constants.DRAWER_ROUTE_PUBLISHES === currentRoute && currentRoute !== prevRoute) {
|
||||
this.onComponentFocused();
|
||||
}
|
||||
}
|
||||
|
||||
onComponentFocused = () => {
|
||||
const { checkPendingPublishes, fetchMyClaims, pushDrawerStack, setPlayerVisible } = this.props;
|
||||
pushDrawerStack();
|
||||
|
||||
@@ -101,13 +101,7 @@ class SearchPage extends React.PureComponent {
|
||||
const { currentUri } = this.state;
|
||||
|
||||
return (
|
||||
<FileListItem
|
||||
uri={currentUri}
|
||||
featuredResult
|
||||
style={searchStyle.featuredResultItem}
|
||||
navigation={navigation}
|
||||
onPress={() => navigateToUri(navigation, this.state.currentUri)}
|
||||
/>
|
||||
<FileListItem uri={currentUri} featuredResult style={searchStyle.featuredResultItem} navigation={navigation} />
|
||||
);
|
||||
};
|
||||
|
||||
|
||||
@@ -3,7 +3,7 @@ import { Lbry } from 'lbry-redux';
|
||||
import { ActivityIndicator, Linking, NativeModules, Platform, Text, View } from 'react-native';
|
||||
import { NavigationActions, StackActions } from 'react-navigation';
|
||||
import { decode as atob } from 'base-64';
|
||||
import { navigateToUri } from 'utils/helper';
|
||||
import { navigateToUri, transformUrl } from 'utils/helper';
|
||||
import moment from 'moment';
|
||||
import AsyncStorage from '@react-native-community/async-storage';
|
||||
import Button from 'component/button';
|
||||
@@ -81,7 +81,7 @@ class SplashScreen extends React.PureComponent {
|
||||
});
|
||||
}
|
||||
} else {
|
||||
navigateToUri(navigation, launchUrl);
|
||||
navigateToUri(navigation, transformUrl(launchUrl));
|
||||
}
|
||||
}
|
||||
};
|
||||
@@ -130,7 +130,7 @@ class SplashScreen extends React.PureComponent {
|
||||
if (user && user.id && user.has_verified_email) {
|
||||
// user already authenticated
|
||||
NativeModules.UtilityModule.getSecureValue(Constants.KEY_FIRST_RUN_PASSWORD).then(walletPassword => {
|
||||
if (walletPassword && walletPassword.trim().length > 0) {
|
||||
if (walletPassword) {
|
||||
getSync(walletPassword);
|
||||
}
|
||||
this.navigateToMain();
|
||||
@@ -166,14 +166,14 @@ class SplashScreen extends React.PureComponent {
|
||||
|
||||
// For now, automatically unlock the wallet if a password is set so that downloads work
|
||||
NativeModules.UtilityModule.getSecureValue(Constants.KEY_FIRST_RUN_PASSWORD).then(password => {
|
||||
if (password && password.trim().length > 0) {
|
||||
if (password) {
|
||||
this.setState({
|
||||
message: 'Unlocking account',
|
||||
details: 'Decrypting wallet',
|
||||
});
|
||||
|
||||
// unlock the wallet and then finish the splash screen
|
||||
Lbry.account_unlock({ password })
|
||||
Lbry.account_unlock({ password: password || '' })
|
||||
.then(() => {
|
||||
this.setState({
|
||||
message: testingNetwork,
|
||||
|
||||
@@ -1,5 +1,6 @@
|
||||
import React from 'react';
|
||||
import { NativeModules, View, ScrollView, Text } from 'react-native';
|
||||
import { ActivityIndicator, NativeModules, View, ScrollView, Text } from 'react-native';
|
||||
import Colors from 'styles/colors';
|
||||
import Constants from 'constants'; // eslint-disable-line node/no-deprecated-api
|
||||
import TransactionList from 'component/transactionList';
|
||||
import UriBar from 'component/uriBar';
|
||||
@@ -44,13 +45,16 @@ class TransactionHistoryPage extends React.PureComponent {
|
||||
const { fetchingTransactions, transactions, navigation } = this.props;
|
||||
|
||||
return (
|
||||
<View>
|
||||
<View style={walletStyle.container}>
|
||||
<UriBar navigation={navigation} />
|
||||
{fetchingTransactions && (
|
||||
<View style={walletStyle.loadingContainer}>
|
||||
<ActivityIndicator size={'small'} color={Colors.NextLbryGreen} />
|
||||
<Text style={walletStyle.loadingText}>Loading transactions...</Text>
|
||||
</View>
|
||||
)}
|
||||
<ScrollView style={walletStyle.transactionHistoryScroll}>
|
||||
<View style={walletStyle.historyList}>
|
||||
{fetchingTransactions && !transactions.length && (
|
||||
<Text style={walletStyle.infoText}>Loading transactions...</Text>
|
||||
)}
|
||||
{!fetchingTransactions && transactions.length === 0 && (
|
||||
<Text style={walletStyle.infoText}>No transactions to list.</Text>
|
||||
)}
|
||||
|
||||
@@ -45,9 +45,12 @@ class TrendingPage extends React.PureComponent {
|
||||
}
|
||||
|
||||
onComponentFocused = () => {
|
||||
const { pushDrawerStack, setPlayerVisible, navigation } = this.props;
|
||||
const { pushDrawerStack, setPlayerVisible, navigation, sortByItem } = this.props;
|
||||
const { filterForTags } = navigation.state.params ? navigation.state.params : { filterForTags: false };
|
||||
this.setState({ currentTrendingForItem: TRENDING_FOR_ITEMS[filterForTags ? 1 : 0] });
|
||||
this.setState({
|
||||
currentTrendingForItem: TRENDING_FOR_ITEMS[filterForTags ? 1 : 0],
|
||||
orderBy: getOrderBy(sortByItem),
|
||||
});
|
||||
pushDrawerStack(Constants.DRAWER_ROUTE_TRENDING, navigation.state.params);
|
||||
setPlayerVisible();
|
||||
NativeModules.Firebase.setCurrentScreen('All content');
|
||||
@@ -110,7 +113,7 @@ class TrendingPage extends React.PureComponent {
|
||||
<Icon style={discoverStyle.tagSortIcon} name={'sort-down'} size={14} />
|
||||
</TouchableOpacity>
|
||||
|
||||
{sortByTop && <Text style={discoverStyle.pickerLabel}>in the</Text>}
|
||||
{sortByTop && <Text style={discoverStyle.pickerLabel}>from</Text>}
|
||||
|
||||
{sortByTop && (
|
||||
<TouchableOpacity style={discoverStyle.tagTime} onPress={() => this.setState({ showTimePicker: true })}>
|
||||
|
||||
@@ -29,7 +29,7 @@ import {
|
||||
} from 'lbryinc';
|
||||
import { doSetClientSetting } from 'redux/actions/settings';
|
||||
import { makeSelectClientSetting } from 'redux/selectors/settings';
|
||||
import Constants from 'constants';
|
||||
import Constants from 'constants'; // eslint-disable-line node/no-deprecated-api
|
||||
import Verification from './view';
|
||||
|
||||
const select = state => ({
|
||||
@@ -54,13 +54,13 @@ const select = state => ({
|
||||
|
||||
const perform = dispatch => ({
|
||||
addUserEmail: email => dispatch(doUserEmailNew(email)),
|
||||
addUserPhone: (phone, country_code) => dispatch(doUserPhoneNew(phone, country_code)),
|
||||
addUserPhone: (phone, countryCode) => dispatch(doUserPhoneNew(phone, countryCode)),
|
||||
getSync: password => dispatch(doGetSync(password)),
|
||||
checkSync: () => dispatch(doCheckSync()),
|
||||
verifyPhone: verificationCode => dispatch(doUserPhoneVerify(verificationCode)),
|
||||
notify: data => dispatch(doToast(data)),
|
||||
setClientSetting: (key, value) => dispatch(doSetClientSetting(key, value)),
|
||||
setDefaultAccount: () => dispatch(doSetDefaultAccount()),
|
||||
setDefaultAccount: (success, failure) => dispatch(doSetDefaultAccount(success, failure)),
|
||||
setEmailToVerify: email => dispatch(doUserEmailToVerify(email)),
|
||||
syncApply: (hash, data, password) => dispatch(doSyncApply(hash, data, password)),
|
||||
resendVerificationEmail: email => dispatch(doUserResendVerificationEmail(email)),
|
||||
|
||||
@@ -5,7 +5,7 @@ import { BarPasswordStrengthDisplay } from 'react-native-password-strength-meter
|
||||
import Button from 'component/button';
|
||||
import Link from 'component/link';
|
||||
import Colors from 'styles/colors';
|
||||
import Constants from 'constants';
|
||||
import Constants from 'constants'; // eslint-disable-line node/no-deprecated-api
|
||||
import firstRunStyle from 'styles/firstRun';
|
||||
import Icon from 'react-native-vector-icons/FontAwesome5';
|
||||
import rewardStyle from 'styles/reward';
|
||||
@@ -62,11 +62,29 @@ class SyncVerifyPage extends React.PureComponent {
|
||||
} else {
|
||||
// password successfully verified
|
||||
if (NativeModules.UtilityModule) {
|
||||
NativeModules.UtilityModule.setSecureValue(Constants.KEY_FIRST_RUN_PASSWORD, this.state.password);
|
||||
NativeModules.UtilityModule.setSecureValue(
|
||||
Constants.KEY_FIRST_RUN_PASSWORD,
|
||||
this.state.password ? this.state.password : ''
|
||||
);
|
||||
}
|
||||
setDefaultAccount();
|
||||
setClientSetting(Constants.SETTING_DEVICE_WALLET_SYNCED, true);
|
||||
navigation.goBack();
|
||||
setDefaultAccount(
|
||||
() => {
|
||||
setClientSetting(Constants.SETTING_DEVICE_WALLET_SYNCED, true);
|
||||
|
||||
// unlock the wallet
|
||||
Lbry.account_unlock({ password: this.state.password ? this.state.password : '' })
|
||||
.then(() => navigation.goBack())
|
||||
.catch(err =>
|
||||
notify({ message: 'The wallet could not be unlocked at this time. Please restart the app.' })
|
||||
);
|
||||
},
|
||||
err => {
|
||||
notify({
|
||||
message:
|
||||
'The account restore operation could not be completed successfully. Please restart the app and try again.',
|
||||
});
|
||||
}
|
||||
);
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
@@ -47,7 +47,7 @@ class WalletPage extends React.PureComponent {
|
||||
const { deviceWalletSynced, getSync, user } = this.props;
|
||||
if (deviceWalletSynced && user && user.has_verified_email) {
|
||||
NativeModules.UtilityModule.getSecureValue(Constants.KEY_FIRST_RUN_PASSWORD).then(walletPassword => {
|
||||
if (walletPassword && walletPassword.trim().length > 0) {
|
||||
if (walletPassword) {
|
||||
getSync(walletPassword);
|
||||
}
|
||||
});
|
||||
|
||||
@@ -0,0 +1,23 @@
|
||||
import Constants from 'constants'; // eslint-disable-line node/no-deprecated-api
|
||||
|
||||
export const doUpdatePublishFormState = publishFormValue => dispatch =>
|
||||
dispatch({
|
||||
type: Constants.ACTION_UPDATE_PUBLISH_FORM_STATE,
|
||||
data: { ...publishFormValue },
|
||||
});
|
||||
|
||||
export const doUpdateChannelFormState = channelFormValue => dispatch =>
|
||||
dispatch({
|
||||
type: Constants.ACTION_UPDATE_CHANNEL_FORM_STATE,
|
||||
data: { ...channelFormValue },
|
||||
});
|
||||
|
||||
export const doClearPublishFormState = () => dispatch =>
|
||||
dispatch({
|
||||
type: Constants.ACTION_CLEAR_PUBLISH_FORM_STATE,
|
||||
});
|
||||
|
||||
export const doClearChannelFormState = () => dispatch =>
|
||||
dispatch({
|
||||
type: Constants.ACTION_CLEAR_CHANNEL_FORM_STATE,
|
||||
});
|
||||
@@ -16,7 +16,19 @@ reducers[Constants.ACTION_PUSH_DRAWER_STACK] = (state, action) => {
|
||||
const { routeName, params } = action.data;
|
||||
const newStack = state.stack.slice();
|
||||
|
||||
if (routeName !== newStack[newStack.length - 1].route) {
|
||||
const lastRoute = newStack[newStack.length - 1].route;
|
||||
let canPushStack = routeName !== lastRoute;
|
||||
if (
|
||||
lastRoute === Constants.DRAWER_ROUTE_CHANNEL_CREATOR_FORM &&
|
||||
routeName === Constants.DRAWER_ROUTE_CHANNEL_CREATOR
|
||||
) {
|
||||
canPushStack = false;
|
||||
}
|
||||
if (lastRoute === Constants.DRAWER_ROUTE_PUBLISH_FORM && routeName === Constants.DRAWER_ROUTE_PUBLISH) {
|
||||
canPushStack = false;
|
||||
}
|
||||
|
||||
if (canPushStack) {
|
||||
newStack.push({ route: routeName, params });
|
||||
}
|
||||
|
||||
|
||||
@@ -0,0 +1,49 @@
|
||||
import Constants from 'constants'; // eslint-disable-line node/no-deprecated-api
|
||||
|
||||
const reducers = {};
|
||||
const defaultState = {
|
||||
channelFormValues: {},
|
||||
publishFormValues: {},
|
||||
};
|
||||
|
||||
reducers[Constants.ACTION_UPDATE_PUBLISH_FORM_STATE] = (state, action) => {
|
||||
const { data } = action;
|
||||
const publishFormValues = Object.assign({}, state.publishFormValues);
|
||||
const newPublishFormValues = Object.assign(publishFormValues, data);
|
||||
|
||||
return {
|
||||
...state,
|
||||
publishFormValues: newPublishFormValues,
|
||||
};
|
||||
};
|
||||
|
||||
reducers[Constants.ACTION_UPDATE_CHANNEL_FORM_STATE] = (state, action) => {
|
||||
const { data } = action;
|
||||
const channelFormValues = Object.assign({}, state.channelFormValues);
|
||||
const newChannelFormValues = Object.assign(channelFormValues, data);
|
||||
|
||||
return {
|
||||
...state,
|
||||
channelFormValues: newChannelFormValues,
|
||||
};
|
||||
};
|
||||
|
||||
reducers[Constants.ACTION_CLEAR_PUBLISH_FORM_STATE] = state => {
|
||||
return {
|
||||
...state,
|
||||
publishFormValues: {},
|
||||
};
|
||||
};
|
||||
|
||||
reducers[Constants.ACTION_CLEAR_CHANNEL_FORM_STATE] = state => {
|
||||
return {
|
||||
...state,
|
||||
channelFormValues: {},
|
||||
};
|
||||
};
|
||||
|
||||
export default function reducer(state = defaultState, action) {
|
||||
const handler = reducers[action.type];
|
||||
if (handler) return handler(state, action);
|
||||
return state;
|
||||
}
|
||||
@@ -0,0 +1,13 @@
|
||||
import { createSelector } from 'reselect';
|
||||
|
||||
export const selectState = state => state.form || {};
|
||||
|
||||
export const selectPublishFormState = createSelector(
|
||||
selectState,
|
||||
state => state.publishFormValues || {}
|
||||
);
|
||||
|
||||
export const selectChannelFormState = createSelector(
|
||||
selectState,
|
||||
state => state.channelFormValues || {}
|
||||
);
|
||||
@@ -4,6 +4,9 @@ const autothumbStyle = StyleSheet.create({
|
||||
autothumbPurple: {
|
||||
backgroundColor: '#9c27b0',
|
||||
},
|
||||
autothumbDeepPurple: {
|
||||
backgroundColor: '#5e35b1',
|
||||
},
|
||||
autothumbRed: {
|
||||
backgroundColor: '#e53935',
|
||||
},
|
||||
@@ -34,6 +37,21 @@ const autothumbStyle = StyleSheet.create({
|
||||
autothumbOrange: {
|
||||
backgroundColor: '#ffa726',
|
||||
},
|
||||
autothumbAmber: {
|
||||
backgroundColor: '#ffb300',
|
||||
},
|
||||
autothumbLime: {
|
||||
backgroundColor: '#c0ca33',
|
||||
},
|
||||
autothumbLightGreen: {
|
||||
backgroundColor: '#7cb342',
|
||||
},
|
||||
autothumbDeepOrange: {
|
||||
backgroundColor: '#f4511e',
|
||||
},
|
||||
autothumbBrown: {
|
||||
backgroundColor: '#6d4c41',
|
||||
},
|
||||
});
|
||||
|
||||
export default autothumbStyle;
|
||||
@@ -0,0 +1,261 @@
|
||||
import { Dimensions, StyleSheet } from 'react-native';
|
||||
import Colors from './colors';
|
||||
|
||||
const screenDimension = Dimensions.get('window');
|
||||
const screenWidth = screenDimension.width;
|
||||
|
||||
const channelCreatorStyle = StyleSheet.create({
|
||||
card: {
|
||||
backgroundColor: Colors.White,
|
||||
marginTop: 16,
|
||||
marginLeft: 16,
|
||||
marginRight: 16,
|
||||
padding: 16,
|
||||
},
|
||||
container: {
|
||||
flex: 1,
|
||||
backgroundColor: Colors.PageBackground,
|
||||
},
|
||||
channelPicker: {
|
||||
fontFamily: 'Inter-UI-Regular',
|
||||
fontSize: 16,
|
||||
height: 52,
|
||||
width: '100%',
|
||||
},
|
||||
bidRow: {
|
||||
flexDirection: 'row',
|
||||
alignItems: 'center',
|
||||
},
|
||||
label: {
|
||||
fontFamily: 'Inter-UI-Regular',
|
||||
fontSize: 16,
|
||||
},
|
||||
channelNameInput: {
|
||||
fontFamily: 'Inter-UI-Regular',
|
||||
fontSize: 16,
|
||||
paddingLeft: 20,
|
||||
},
|
||||
bidAmountInput: {
|
||||
fontFamily: 'Inter-UI-Regular',
|
||||
fontSize: 16,
|
||||
marginLeft: 16,
|
||||
textAlign: 'right',
|
||||
width: 80,
|
||||
},
|
||||
helpText: {
|
||||
fontFamily: 'Inter-UI-Regular',
|
||||
fontSize: 12,
|
||||
},
|
||||
channelTitleInput: {
|
||||
marginBottom: 4,
|
||||
},
|
||||
createChannelContainer: {
|
||||
marginTop: 60,
|
||||
flex: 1,
|
||||
},
|
||||
channelAt: {
|
||||
position: 'absolute',
|
||||
left: 4,
|
||||
top: 13,
|
||||
fontFamily: 'Inter-UI-Regular',
|
||||
fontSize: 16,
|
||||
},
|
||||
buttonContainer: {
|
||||
marginTop: 24,
|
||||
marginBottom: 16,
|
||||
},
|
||||
buttons: {
|
||||
marginLeft: 16,
|
||||
marginRight: 16,
|
||||
flexDirection: 'row',
|
||||
alignItems: 'center',
|
||||
justifyContent: 'space-between',
|
||||
},
|
||||
cancelLink: {
|
||||
marginRight: 16,
|
||||
},
|
||||
createButton: {
|
||||
backgroundColor: Colors.LbryGreen,
|
||||
alignSelf: 'flex-end',
|
||||
},
|
||||
inlineError: {
|
||||
fontFamily: 'Inter-UI-Regular',
|
||||
fontSize: 12,
|
||||
color: Colors.Red,
|
||||
marginTop: 2,
|
||||
},
|
||||
imageSelectors: {
|
||||
width: '100%',
|
||||
height: 160,
|
||||
},
|
||||
coverImageTouchArea: {
|
||||
position: 'absolute',
|
||||
left: 0,
|
||||
right: 0,
|
||||
top: 0,
|
||||
bottom: 0,
|
||||
alignItems: 'center',
|
||||
justifyContent: 'center',
|
||||
},
|
||||
coverImage: {
|
||||
width: '100%',
|
||||
height: '100%',
|
||||
},
|
||||
avatarImageContainer: {
|
||||
position: 'absolute',
|
||||
left: screenWidth / 2 - 80 / 2,
|
||||
bottom: -16,
|
||||
width: 80,
|
||||
height: 80,
|
||||
borderRadius: 160,
|
||||
overflow: 'hidden',
|
||||
},
|
||||
avatarTouchArea: {
|
||||
width: 80,
|
||||
height: 80,
|
||||
alignItems: 'center',
|
||||
justifyContent: 'center',
|
||||
},
|
||||
avatarImage: {
|
||||
width: '100%',
|
||||
height: '100%',
|
||||
},
|
||||
listFooter: {
|
||||
marginTop: 24,
|
||||
},
|
||||
createChannelButton: {
|
||||
backgroundColor: Colors.LbryGreen,
|
||||
alignSelf: 'flex-start',
|
||||
},
|
||||
scrollContainer: {
|
||||
marginTop: 60,
|
||||
marginLeft: 16,
|
||||
marginRight: 16,
|
||||
},
|
||||
scrollPadding: {
|
||||
paddingTop: 16,
|
||||
},
|
||||
channelListItem: {
|
||||
flexDirection: 'row',
|
||||
marginBottom: 16,
|
||||
alignItems: 'center',
|
||||
},
|
||||
channelListTitle: {
|
||||
fontFamily: 'Inter-UI-Regular',
|
||||
fontSize: 18,
|
||||
marginBottom: 4,
|
||||
},
|
||||
channelListName: {
|
||||
fontFamily: 'Inter-UI-Regular',
|
||||
fontSize: 14,
|
||||
},
|
||||
channelListAvatar: {
|
||||
marginRight: 16,
|
||||
width: 80,
|
||||
height: 80,
|
||||
borderRadius: 160,
|
||||
overflow: 'hidden',
|
||||
alignItems: 'center',
|
||||
justifyContent: 'center',
|
||||
},
|
||||
selectedOverlay: {
|
||||
position: 'absolute',
|
||||
left: 0,
|
||||
top: 0,
|
||||
width: 80,
|
||||
height: 80,
|
||||
borderRadius: 160,
|
||||
overflow: 'hidden',
|
||||
alignItems: 'center',
|
||||
justifyContent: 'center',
|
||||
backgroundColor: '#000000aa',
|
||||
},
|
||||
listHeader: {
|
||||
alignItems: 'center',
|
||||
marginTop: 16,
|
||||
marginBottom: 16,
|
||||
},
|
||||
textInputLayout: {
|
||||
marginBottom: 4,
|
||||
},
|
||||
textInputTitle: {
|
||||
fontFamily: 'Inter-UI-Regular',
|
||||
fontSize: 12,
|
||||
marginBottom: -10,
|
||||
marginLeft: 4,
|
||||
},
|
||||
inputText: {
|
||||
fontFamily: 'Inter-UI-Regular',
|
||||
fontSize: 16,
|
||||
},
|
||||
toggleContainer: {
|
||||
marginTop: 24,
|
||||
alignItems: 'center',
|
||||
justifyContent: 'flex-end',
|
||||
},
|
||||
modeLink: {
|
||||
color: Colors.LbryGreen,
|
||||
alignSelf: 'flex-end',
|
||||
marginRight: 16,
|
||||
},
|
||||
cardTitle: {
|
||||
fontFamily: 'Inter-UI-Regular',
|
||||
fontSize: 20,
|
||||
marginBottom: 8,
|
||||
},
|
||||
tag: {
|
||||
marginRight: 4,
|
||||
marginBottom: 4,
|
||||
},
|
||||
tagList: {
|
||||
flexDirection: 'row',
|
||||
flexWrap: 'wrap',
|
||||
},
|
||||
editOverlay: {
|
||||
alignItems: 'center',
|
||||
justifyContent: 'center',
|
||||
borderRadius: 24,
|
||||
position: 'absolute',
|
||||
padding: 8,
|
||||
left: 4,
|
||||
bottom: 4,
|
||||
backgroundColor: '#00000077',
|
||||
},
|
||||
thumbnailEditOverlay: {
|
||||
alignItems: 'center',
|
||||
justifyContent: 'center',
|
||||
borderRadius: 24,
|
||||
position: 'absolute',
|
||||
padding: 8,
|
||||
left: 80 / 2 - 32 / 2,
|
||||
bottom: 4,
|
||||
backgroundColor: '#00000077',
|
||||
},
|
||||
editIcon: {
|
||||
color: Colors.White,
|
||||
fontFamily: 'Inter-UI-SemiBold',
|
||||
fontSize: 12,
|
||||
},
|
||||
uploadProgress: {
|
||||
alignItems: 'center',
|
||||
borderRadius: 16,
|
||||
flexDirection: 'row',
|
||||
position: 'absolute',
|
||||
top: 8,
|
||||
right: 8,
|
||||
backgroundColor: '#00000077',
|
||||
paddingLeft: 8,
|
||||
paddingRight: 8,
|
||||
paddingTop: 4,
|
||||
paddingBottom: 4,
|
||||
justifyContent: 'center',
|
||||
},
|
||||
uploadText: {
|
||||
color: Colors.White,
|
||||
fontFamily: 'Inter-UI-SemiBold',
|
||||
fontSize: 12,
|
||||
marginLeft: 4,
|
||||
},
|
||||
});
|
||||
|
||||
export default channelCreatorStyle;
|
||||
@@ -31,6 +31,7 @@ const channelPageStyle = StyleSheet.create({
|
||||
flex: 1,
|
||||
justifyContent: 'center',
|
||||
alignItems: 'center',
|
||||
padding: 24,
|
||||
},
|
||||
infoText: {
|
||||
fontFamily: 'Inter-UI-Regular',
|
||||
@@ -165,6 +166,9 @@ const channelPageStyle = StyleSheet.create({
|
||||
claimListContent: {
|
||||
paddingTop: 16,
|
||||
},
|
||||
actionButton: {
|
||||
backgroundColor: Colors.White,
|
||||
},
|
||||
});
|
||||
|
||||
export default channelPageStyle;
|
||||
@@ -41,8 +41,8 @@ const filePageStyle = StyleSheet.create({
|
||||
fontFamily: 'Inter-UI-Regular',
|
||||
textAlign: 'center',
|
||||
fontSize: 20,
|
||||
marginLeft: 16,
|
||||
marginRight: 16,
|
||||
marginLeft: 24,
|
||||
marginRight: 24,
|
||||
},
|
||||
scrollContainer: {
|
||||
flex: 1,
|
||||
|
||||
@@ -86,7 +86,7 @@ const publishStyle = StyleSheet.create({
|
||||
marginTop: 8,
|
||||
},
|
||||
photo: {
|
||||
height: 240,
|
||||
height: 120,
|
||||
justifyContent: 'center',
|
||||
alignItems: 'center',
|
||||
},
|
||||
@@ -156,6 +156,10 @@ const publishStyle = StyleSheet.create({
|
||||
fontSize: 16,
|
||||
marginLeft: 8,
|
||||
},
|
||||
listEmptyText: {
|
||||
fontFamily: 'Inter-UI-Regular',
|
||||
fontSize: 14,
|
||||
},
|
||||
titleRow: {
|
||||
flexDirection: 'row',
|
||||
justifyContent: 'space-between',
|
||||
@@ -362,6 +366,9 @@ const publishStyle = StyleSheet.create({
|
||||
alignItems: 'center',
|
||||
justifyContent: 'center',
|
||||
},
|
||||
currencyPicker: {
|
||||
width: 100,
|
||||
},
|
||||
fullCentered: {
|
||||
position: 'absolute',
|
||||
left: 0,
|
||||
|
||||
@@ -17,6 +17,9 @@ const transactionListStyle = StyleSheet.create({
|
||||
topRow: {
|
||||
marginBottom: 4,
|
||||
},
|
||||
leftCol: {
|
||||
flex: 0.7,
|
||||
},
|
||||
col: {
|
||||
alignSelf: 'stretch',
|
||||
},
|
||||
|
||||
@@ -3,6 +3,7 @@ import Colors from './colors';
|
||||
|
||||
const walletStyle = StyleSheet.create({
|
||||
container: {
|
||||
flex: 1,
|
||||
backgroundColor: Colors.PageBackground,
|
||||
},
|
||||
scrollContainer: {
|
||||
@@ -288,6 +289,22 @@ const walletStyle = StyleSheet.create({
|
||||
syncSwitch: {
|
||||
marginLeft: 8,
|
||||
},
|
||||
loadingContainer: {
|
||||
position: 'absolute',
|
||||
flexDirection: 'row',
|
||||
left: 0,
|
||||
right: 0,
|
||||
top: 60,
|
||||
bottom: 0,
|
||||
alignItems: 'center',
|
||||
justifyContent: 'center',
|
||||
},
|
||||
loadingText: {
|
||||
color: '#aaaaaa',
|
||||
fontFamily: 'Inter-UI-Regular',
|
||||
fontSize: 16,
|
||||
marginLeft: 8,
|
||||
},
|
||||
});
|
||||
|
||||
export default walletStyle;
|
||||
+86
-8
@@ -1,7 +1,7 @@
|
||||
import { NavigationActions, StackActions } from 'react-navigation';
|
||||
import { buildURI, isURIValid } from 'lbry-redux';
|
||||
import { buildURI, isURIValid, normalizeURI } from 'lbry-redux';
|
||||
import { doPopDrawerStack, doPushDrawerStack, doSetPlayerVisible } from 'redux/actions/drawer';
|
||||
import Constants, { DrawerRoutes } from 'constants'; // eslint-disable-line node/no-deprecated-api
|
||||
import Constants, { DrawerRoutes, InnerDrawerRoutes } from 'constants'; // eslint-disable-line node/no-deprecated-api
|
||||
|
||||
const tagNameLength = 10;
|
||||
|
||||
@@ -156,10 +156,26 @@ export function navigateBack(navigation, drawerStack, popDrawerStack) {
|
||||
const target = drawerStack[drawerStack.length > 1 ? drawerStack.length - 2 : 0];
|
||||
const { route, params } = target;
|
||||
navigation.goBack(navigation.state.key);
|
||||
if (DrawerRoutes.indexOf(route) === -1 && isURIValid(route)) {
|
||||
if (!DrawerRoutes.includes(route) && !InnerDrawerRoutes.includes(route) && isURIValid(route)) {
|
||||
navigateToUri(navigation, route, null, true);
|
||||
} else {
|
||||
navigation.navigate({ routeName: route, params });
|
||||
let targetRoute = route;
|
||||
let targetParams = params;
|
||||
if (InnerDrawerRoutes.includes(route)) {
|
||||
if (Constants.DRAWER_ROUTE_CHANNEL_CREATOR_FORM === route) {
|
||||
targetRoute = Constants.DRAWER_ROUTE_CHANNEL_CREATOR;
|
||||
} else if (Constants.DRAWER_ROUTE_PUBLISH_FORM === route) {
|
||||
targetRoute = Constants.DRAWER_ROUTE_PUBLISH_FORM;
|
||||
}
|
||||
|
||||
if (targetParams) {
|
||||
targetParams.displayForm = true;
|
||||
} else {
|
||||
targetParams = { displayForm: true };
|
||||
}
|
||||
}
|
||||
|
||||
navigation.navigate({ routeName: targetRoute, targetParams });
|
||||
}
|
||||
}
|
||||
|
||||
@@ -169,14 +185,31 @@ export function dispatchNavigateBack(dispatch, nav, drawerStack) {
|
||||
const target = drawerStack[drawerStack.length > 1 ? drawerStack.length - 2 : 0];
|
||||
const { route } = target;
|
||||
dispatch(NavigationActions.back());
|
||||
if (DrawerRoutes.indexOf(route) === -1 && isURIValid(route)) {
|
||||
if (!DrawerRoutes.includes(route) && !InnerDrawerRoutes.includes(route) && isURIValid(route)) {
|
||||
dispatchNavigateToUri(dispatch, nav, route, true);
|
||||
} else {
|
||||
const newTarget = drawerStack[drawerStack.length > 1 ? drawerStack.length - 2 : 0];
|
||||
let targetRoute = newTarget.route;
|
||||
let targetParams = newTarget.params;
|
||||
if (InnerDrawerRoutes.includes(targetRoute)) {
|
||||
if (Constants.DRAWER_ROUTE_CHANNEL_CREATOR_FORM === route) {
|
||||
targetRoute = Constants.DRAWER_ROUTE_CHANNEL_CREATOR;
|
||||
} else if (Constants.DRAWER_ROUTE_PUBLISH_FORM === route) {
|
||||
targetRoute = Constants.DRAWER_ROUTE_PUBLISH_FORM;
|
||||
}
|
||||
|
||||
if (targetParams) {
|
||||
targetParams.displayForm = true;
|
||||
} else {
|
||||
targetParams = { displayForm: true };
|
||||
}
|
||||
}
|
||||
|
||||
const navigateAction = NavigationActions.navigate({
|
||||
routeName: newTarget.route,
|
||||
params: newTarget.params,
|
||||
routeName: targetRoute,
|
||||
params: targetParams,
|
||||
});
|
||||
|
||||
dispatch(navigateAction);
|
||||
}
|
||||
}
|
||||
@@ -184,7 +217,7 @@ export function dispatchNavigateBack(dispatch, nav, drawerStack) {
|
||||
export function uriFromFileInfo(fileInfo) {
|
||||
const { name: claimName, claim_name: claimNameDownloaded, claim_id: claimId } = fileInfo;
|
||||
const uriParams = {};
|
||||
uriParams.contentName = claimName || claimNameDownloaded;
|
||||
uriParams.claimName = claimName || claimNameDownloaded;
|
||||
uriParams.claimId = claimId;
|
||||
return buildURI(uriParams);
|
||||
}
|
||||
@@ -246,7 +279,52 @@ export function getOrderBy(item) {
|
||||
return orderBy;
|
||||
}
|
||||
|
||||
// replace occurrences of ':' with '#' in a url (entered in the URI bar)
|
||||
export function transformUrl(url) {
|
||||
const start = 'lbry://'.length;
|
||||
return normalizeURI(url.substring(start).replace(/:/g, '#'));
|
||||
}
|
||||
|
||||
// i18n placeholder until we find a good react-native i18n module
|
||||
export function __(str) {
|
||||
return str;
|
||||
}
|
||||
|
||||
export function uploadImageAsset(filePath, success, failure) {
|
||||
const makeid = () => {
|
||||
let text = '';
|
||||
const possible = 'ABCDEFGHIJKLMNOPQRSTUVWXYZabcdefghijklmnopqrstuvwxyz0123456789';
|
||||
for (let i = 0; i < 24; i += 1) text += possible.charAt(Math.floor(Math.random() * 62));
|
||||
return text;
|
||||
};
|
||||
|
||||
const fileName = filePath.substring(filePath.lastIndexOf('/') + 1);
|
||||
let fileExt = fileName.indexOf('.') > -1 ? fileName.substring(fileName.lastIndexOf('.') + 1).trim() : 0;
|
||||
if (!fileExt) {
|
||||
fileExt = 'jpg'; // default to jpg
|
||||
}
|
||||
const fileType = `image/${fileExt}`;
|
||||
|
||||
const data = new FormData();
|
||||
const name = makeid();
|
||||
data.append('name', name);
|
||||
data.append('file', { uri: 'file://' + filePath, type: fileType, name: fileName });
|
||||
|
||||
return fetch('https://spee.ch/api/claim/publish', {
|
||||
method: 'POST',
|
||||
body: data,
|
||||
})
|
||||
.then(response => response.json())
|
||||
.then(json => {
|
||||
if (json.success) {
|
||||
if (success) {
|
||||
success({ url: `${json.data.url}.${fileExt}` });
|
||||
}
|
||||
}
|
||||
})
|
||||
.catch(err => {
|
||||
if (failure) {
|
||||
failure(err.message ? err.message : 'The image failed to upload.');
|
||||
}
|
||||
});
|
||||
}
|
||||
Reference in new issue
Block a user