Compare commits

...
Author SHA1 Message Date
Akinwale Ariwodola 9609f423df use coins icon instead of 'Bal:' text 2019-12-15 11:41:27 +01:00
Akinwale Ariwodola 3662834fba display balance when LBC input text is focused 2019-12-13 17:02:53 +01:00
Akinwale Ariwodola 8b4f1de951 Merge pull request #96 from lbryio/play-press-area
enable pressing the entire media container area to play or download content
2019-12-13 10:31:28 +01:00
Akinwale Ariwodola daa4f5c5dc enable pressing the entire media container area to play or download content 2019-12-13 10:29:07 +01:00
Akinwale Ariwodola 6ae9632fb9 fixes before release (#95)
* fixes before next release
* make channel sort by selection component-specific
2019-12-11 09:06:10 +01:00
Akinwale Ariwodola c33cf47397 add Arabic language setting 2019-12-06 19:33:26 +01:00
Akinwale Ariwodola e0fa80f640 i18n reward intro driver title 2019-12-06 19:21:06 +01:00
Akinwale Ariwodola 0e65d526d8 fix header sync progress value 2019-12-06 19:13:47 +01:00
Akinwale Ariwodola 86e5bcf7e0 app strings 2019-12-06 17:55:10 +01:00
Akinwale Ariwodola e9858f85e8 Merge pull request #94 from lbryio/i18n-strings
i18n more strings
2019-12-06 17:54:28 +01:00
Akinwale Ariwodola 0b43454adc i18n more strings 2019-12-06 17:51:15 +01:00
Akinwale Ariwodola d69c1931ac move file action buttons to large button row (#90)
* move file action buttons to large button row
* update button order
2019-12-06 17:22:42 +01:00
Akinwale Ariwodola 970b53ffdc Merge pull request #93 from lbryio/fix-password-flow
fix error for auto-login and remove password warning
2019-12-06 16:54:53 +01:00
Akinwale Ariwodola 372a572ee6 fix error for auto-login and remove password warning 2019-12-06 16:53:55 +01:00
Akinwale Ariwodola 01eb112888 Merge pull request #92 from lbryio/headers-sync
sdk 0.48 headers synchronization progress
2019-12-06 16:41:07 +01:00
Akinwale Ariwodola bb9e990f5a sdk 0.48 headers synchronization progress 2019-12-06 16:40:17 +01:00
Akinwale Ariwodola 3237652d35 update text for signed in users (#89)
* update text for signed in users
* i18n tweaks
2019-12-06 16:01:25 +01:00
Akinwale Ariwodola fd715886cd display sign in instructions for emails that exist (#84)
* display sign in instructions for emails that exist
* lbry.tv account
2019-12-05 19:30:23 +01:00
Akinwale Ariwodola fa2de8382a Merge pull request #91 from lbryio/sdk-0.48
pin lbry-redux commit
2019-12-05 13:41:07 +01:00
Akinwale Ariwodola f03a88ab2a pin lbry-redux commit 2019-12-05 13:24:22 +01:00
Akinwale Ariwodola 184d5d1ec3 i18n (#80)
* i18n all the strings
* assign file content
* download and save language files
* load language on startup
* load language setting correctly when app launches
* fix i18n calls in constants
* pin lbryinc commit
2019-12-05 13:16:43 +01:00
Akinwale Ariwodola 1a190fb0fe do not display notification bell button 2019-12-03 15:07:40 +01:00
Akinwale Ariwodola 5e67cbe9ce Password flow (#88)
* do not prompt new users for a password
* auto-login when no password is set
2019-12-03 15:02:34 +01:00
Akinwale Ariwodola bc04f7105b Merge pull request #86 from lbryio/trending
fix: trending global > group
2019-11-25 11:17:38 +01:00
Akinwale Ariwodola 13fd9002fa Merge pull request #87 from lbryio/auto-fetch-images
auto-fetch image and text types
2019-11-25 11:16:28 +01:00
Akinwale Ariwodola fe5462971e auto-fetch image and text types 2019-11-22 02:56:16 +01:00
Thomas Zarebczan 89dff3ace3 fix: trending global > group
Trending mixed already takes into account the global score. This improves results a bit and is now indexed on the wallet server. Desktop was updated to match also.
2019-11-21 09:50:48 -05:00
Akinwale Ariwodola 01c3bc489b Merge pull request #85 from lbryio/channel-page-newest-first
default sort content on channel view by newest first
2019-11-20 01:01:52 +01:00
Akinwale Ariwodola e208a9960f default sort content on channel view by newest first 2019-11-20 00:59:05 +01:00
Akinwale Ariwodola e5c6270d5c Merge pull request #83 from lbryio/first-run-navigation
always navigate to first run if not completed
2019-11-18 06:52:04 +01:00
Akinwale Ariwodola afbb9e1d79 add fullscreen mode to app state to better handle suspend / resume (#82)
* add fullscreen mode to app state to better handle suspend / resume
* rename argument mode -> isFullscreen
2019-11-18 06:50:55 +01:00
Akinwale Ariwodola 357be73947 refactor and batch-resolve for related content component (#81)
* refactor and batch-resolve for related content component
* code cleanup
2019-11-18 06:48:54 +01:00
Akinwale Ariwodola 2ddfc1eaf8 always navigate to first run if not completed 2019-11-14 23:07:28 +01:00
Akinwale Ariwodola e901e81074 fetching cost info fix 2019-11-12 21:10:23 +01:00
Akinwale Ariwodola 2e3e1a1250 Merge pull request #77 from lbryio/sync-after-signin
restore user preferences after in-app sign in  flow
2019-11-12 15:35:44 +01:00
Akinwale Ariwodola 190af405bb Merge pull request #79 from lbryio/faster-short-urls
avoid re-resolving a claim when navigation to a short / canonical URL
2019-11-12 15:35:28 +01:00
Akinwale Ariwodola 4467853d44 special URLs for all top-level navigation routes (#78)
* special URLs for all top-level navigation routes
* rename yourTags to discover
2019-11-11 15:49:27 +01:00
Akinwale Ariwodola a45f68d096 avoid re-resolving a claim when navigation to a short / canonical URL 2019-11-08 07:13:24 +01:00
Akinwale Ariwodola 79686ff6b9 restore user preferences after in-app sign in flow 2019-11-07 17:13:37 +01:00
Akinwale Ariwodola 76305a67be Tag search result (#71)
* show tag search result
* run claim search for tag result
2019-11-07 16:55:04 +01:00
95 changed files with 1700 additions and 1056 deletions

No files matched your search

+242
View File
@@ -0,0 +1,242 @@
{
"Waiting for name resolution": "Waiting for name resolution",
"Starting up": "Starting up",
"Connecting": "Connecting",
"Unlocking account": "Unlocking account",
"Decrypting wallet": "Decrypting wallet",
"Your Tags": "Your Tags",
"Customize": "Customize",
"Find content": "Find content",
"Your content": "Your content",
"Wallet": "Wallet",
"All tags you follow": "All tags you follow",
"FREE": "FREE",
"Delete": "Delete",
"Share": "Share",
"Tip": "Tip",
"Report": "Report",
"View": "View",
"Follow": "Follow",
"Fetching cost info...": "Fetching cost info...",
"Play": "Play",
"Channels you follow": "Channels you follow",
"Suggested": "Suggested",
"ALL": "ALL",
"No content to display at this time. Please check back later.": "No content to display at this time. Please check back later.",
"All Content": "All Content",
"Create a channel": "Create a channel",
"Title": "Title",
"Channel": "Channel",
"Deposit": "Deposit",
"This LBC remains yours. It is a deposit to reserve the name and can be undone at any time.": "This LBC remains yours. It is a deposit to reserve the name and can be undone at any time.",
"Show optional fields": "Show optional fields",
"Cancel": "Cancel",
"Create": "Create",
"Description": "Description",
"Website": "Website",
"Email": "Email",
"Tags": "Tags",
"Hide optional fields": "Hide optional fields",
"Mature tags": "Mature tags",
"Other": "Other",
"Publish something new": "Publish something new",
"Record": "Record",
"Take a photo": "Take a photo",
"Upload a file": "Upload a file",
"Please wait while we load your videos...": "Please wait while we load your videos...",
"Price": "Price",
"Your content will be free. Press the toggle to set a price.": "Your content will be free. Press the toggle to set a price.",
"Content address": "Content address",
"The address where people can find your content (ex. lbry://myvideo). ": "The address where people can find your content (ex. lbry://myvideo). ",
"This LBC remains yours and the deposit can be undone at any time.": "This LBC remains yours and the deposit can be undone at any time.",
"Show extra fields": "Show extra fields",
"Publish": "Publish",
"Additional Options": "Additional Options",
"Language": "Language",
"License": "License",
"None": "None",
"Public Domain": "Public Domain",
"Copyrighted...": "Copyrighted...",
"Other...": "Other...",
"Hide extra fields": "Hide extra fields",
"Balance": "Balance",
"You currently have": "You currently have",
"Receive Credits": "Receive Credits",
"Use this wallet address to receive credits sent by another user (or yourself).": "Use this wallet address to receive credits sent by another user (or yourself).",
"Get new address": "Get new address",
"You can generate a new address at any time, and any previous addresses will continue to work. Using multiple addresses can be helpful for keeping track of incoming payments from multiple sources.": "You can generate a new address at any time, and any previous addresses will continue to work. Using multiple addresses can be helpful for keeping track of incoming payments from multiple sources.",
"Send Credits": "Send Credits",
"Recipient address": "Recipient address",
"Amount": "Amount",
"View All": "View All",
"Looks like you don't have any recent transactions.": "Looks like you don't have any recent transactions.",
"Wallet Sync": "Wallet Sync",
"Sync status": "Sync status",
"On": "On",
"Connected email": "Connected email",
"Manual backup": "Manual backup",
"Fetching transactions...": "Fetching transactions...",
"Loading transactions...": "Loading transactions...",
"The transaction URL could not be opened": "The transaction URL could not be opened",
"LBRY credits allow you to purchase content, publish content, and influence the network.": "LBRY credits allow you to purchase content, publish content, and influence the network.",
"You get credits for free for providing an email address and taking other basic actions.": "You get credits for free for providing an email address and taking other basic actions.",
"Learn more": "Learn more",
"Not interested": "Not interested",
"Get started": "Get started",
"Fetching rewards...": "Fetching rewards...",
"Custom Code": "Custom Code",
"Are you a supermodel or rockstar that received a custom reward code? Claim it here.": "Are you a supermodel or rockstar that received a custom reward code? Claim it here.",
"Settings": "Settings",
"Content": "Content",
"Enable background media playback": "Enable background media playback",
"Enable this option to play audio or video in the background when the app is suspended.": "Enable this option to play audio or video in the background when the app is suspended.",
"Choose language": "Choose language",
"Show mature content": "Show mature content",
"Notifications": "Notifications",
"Choose the notifications you would like to receive.": "Choose the notifications you would like to receive.",
"Subscriptions": "Subscriptions",
"Rewards": "Rewards",
"Content Interests": "Content Interests",
"Search": "Search",
"Show URL suggestions": "Show URL suggestions",
"Keep the SDK background service running after closing the app": "Keep the SDK background service running after closing the app",
"Enable this option for quicker app launch and to keep the synchronisation with the blockchain up to date.": "Enable this option for quicker app launch and to keep the synchronisation with the blockchain up to date.",
"Loading...": "Loading...",
"LBRY is a free, open, and community-run digital marketplace. It is a decentralized peer-to-peer content distribution platform for creators to upload and share content, and earn LBRY credits for their effort. Users will be able to find a wide selection of videos, music, ebooks and other digital content they are interested in.": "LBRY is a free, open, and community-run digital marketplace. It is a decentralized peer-to-peer content distribution platform for creators to upload and share content, and earn LBRY credits for their effort. Users will be able to find a wide selection of videos, music, ebooks and other digital content they are interested in.",
"What is LBRY?": "What is LBRY?",
"Android App Basics": "Android App Basics",
"Frequently Asked Questions": "Frequently Asked Questions",
"You can interact with the LBRY team and members of the community on Discord, Facebook, Instagram, Twitter or Reddit.": "You can interact with the LBRY team and members of the community on Discord, Facebook, Instagram, Twitter or Reddit.",
"App info": "App info",
"Update mailing preferences": "Update mailing preferences",
"App version": "App version",
"LBRY SDK": "LBRY SDK",
"Platform": "Platform",
"Installation ID": "Installation ID",
"Logs": "Logs",
"Send log": "Send log",
"Testing network": "Testing network",
"Spanish": "Spanish",
"Portuguese": "Portuguese",
"Polish": "Polish",
"Malay": "Malay",
"Please wait while we get some things ready...": "Please wait while we get some things ready...",
"LBRY is a community-controlled content platform where you can find and publish videos, music, books, and more.": "LBRY is a community-controlled content platform where you can find and publish videos, music, books, and more.",
"Continue": "Continue",
"Setup account": "Setup account",
"An account will allow you to earn rewards and keep your account and settings synced.": "An account will allow you to earn rewards and keep your account and settings synced.",
"This information is disclosed only to LBRY, Inc. and not to the LBRY network.": "This information is disclosed only to LBRY, Inc. and not to the LBRY network.",
"No, thanks": "No, thanks",
"Use LBRY": "Use LBRY",
"Are you sure?": "Are you sure?",
"Without an account, you will not receive rewards, sync and backup services, or security updates.": "Without an account, you will not receive rewards, sync and backup services, or security updates.",
"I understand that by uninstalling LBRY I will lose any balances or published content with no recovery option if it is not backed up manually (see wallet page)": "I understand that by uninstalling LBRY I will lose any balances or published content with no recovery option if it is not backed up manually (see wallet page)",
"Change email": "Change email",
"Your email address was successfully verified.": "Your email address was successfully verified.",
"Retrieving your account information...": "Retrieving your account information...",
"Synchronizing": "Synchronizing",
"Validating password": "Validating password",
"Invalid password specified. Please enter the password for your previously synchronised wallet.": "Invalid password specified. Please enter the password for your previously synchronised wallet.",
"Please enter the password you used to secure your wallet.": "Please enter the password you used to secure your wallet.",
"If you did not provide a password, please press Use LBRY to continue.": "If you did not provide a password, please press Use LBRY to continue.",
"Note: for wallet security purposes, LBRY is unable to reset your password.": "Note: for wallet security purposes, LBRY is unable to reset your password.",
"More tags you follow": "More tags you follow",
"Blockchain Sync": "Blockchain Sync",
"Network Loading": "Network Loading",
"Initializing LBRY service": "Initializing LBRY service",
"Sign In": "Sign In",
"SIGN IN": "SIGN IN",
"You have not created a channel.\nStart now by creating a new channel!": "You have not created a channel.\nStart now by creating a new channel!",
"Send verification email": "Send verification email",
"You do not have any\ndownloaded content on this device.": "You do not have any\ndownloaded content on this device.",
"It looks like you have not\npublished any content to LBRY yet.": "It looks like you have not\npublished any content to LBRY yet.",
"An account with LBRY Inc. allows you to earn rewards, backup your wallet, and keep everything synced.": "An account with LBRY Inc. allows you to earn rewards, backup your wallet, and keep everything synced.",
"Without an account, you assume all responsibility for securing your wallet and LBRY data.": "Without an account, you assume all responsibility for securing your wallet and LBRY data.",
"Skip Account": "Skip Account",
"Sign Up": "Sign Up",
"Indonesian": "Indonesian",
"Hindi": "Hindi",
"Verify Email": "Verify Email",
"Resend": "Resend",
"Edit": "Edit",
"Please follow the instructions in the email sent to your address to continue.": "Please follow the instructions in the email sent to your address to continue.",
"Please enter a password to secure your account and wallet.": "Please enter a password to secure your account and wallet.",
"Anonymous": "Anonymous",
"Connecting...": "Connecting...",
"Gujarati": "Gujarati",
"Turkish": "Turkish",
"Italian": "Italian",
"English": "English",
"Use device language": "Use device language",
"Tags you follow": "Tags you follow",
"Everyone": "Everyone",
"Greek": "Greek",
"Romanian": "Romanian",
"Norwegian": "Norwegian",
"Korean": "Korean",
"Cambodian": "Cambodian",
"Croatian": "Croatian",
"Czech": "Czech",
"Arabic": "Arabic",
"Thai": "Thai",
"Vietnamese": "Vietnamese",
"Dutch": "Dutch",
"Russian": "Russian",
"Japanese": "Japanese",
"German": "German",
"Trending": "Trending",
"Channels": "Channels",
"Library": "Library",
"Publishes": "Publishes",
"New Publish": "New Publish",
"About": "About",
"Sort content by": "Sort content by",
"Trending content": "Trending content",
"New content": "New content",
"Top content": "Top content",
"Search movies, music, and more": "Search movies, music, and more",
"Please provide a valid email address to continue.": "Please provide a valid email address to continue.",
"A lbry.tv account allows you to earn rewards, backup your wallet, and keep everything in sync.": "A lbry.tv account allows you to earn rewards, backup your wallet, and keep everything in sync.",
"%num% blocks behind": "%num% blocks behind",
"Catching up with the blockchain ($%progress%%)": "Catching up with the blockchain ($%progress%%)",
"Catching up with the blockchain (%progress%%)": "Catching up with the blockchain (%progress%%)",
"Get %amount% free credits after creating an account.": "Get %amount% free credits after creating an account.",
"Off": "Off",
"Sync FAQ": "Sync FAQ",
"Please provide an email address.": "Please provide an email address.",
"An email has been sent to": "An email has been sent to",
"Please click the link in the message to complete signing in.": "Please click the link in the message to complete signing in.",
"%amount% free credits available in rewards.": "%amount% free credits available in rewards.",
"Tap to learn more.": "Tap to learn more.",
"password": "password",
"Enable sync": "Enable sync",
"Disable wallet sync": "Disable wallet sync",
"Are you sure you want to turn off wallet sync?": "Are you sure you want to turn off wallet sync?",
"No": "No",
"Yes": "Yes",
"Wallet sync was successfully disabled.": "Wallet sync was successfully disabled.",
"more": "more",
"Related Content": "Related Content",
"There are no results to display for \"%query%\". Please try a different search term.": "There are no results to display for \"%query%\". Please try a different search term.",
"Download": "Download",
"This content is Not Safe For Work. To view adult content, please change your Settings.": "This content is Not Safe For Work. To view adult content, please change your Settings.",
"Stop": "Stop",
"%progress%% complete": "%progress%% complete",
"Customize your tags": "Customize your tags",
"Done": "Done",
"Search for more tags": "Search for more tags",
"Send": "Send",
"Recent Transactions": "Recent Transactions",
"Nothing here. Publish something!": "Nothing here. Publish something!",
"CONTENT": "CONTENT",
"ABOUT": "ABOUT",
"New": "New",
"Content Freedom": "Content Freedom",
"Get Social": "Get Social",
"used": "used",
"Stats": "Stats",
"Welcome to LBRY.": "Welcome to LBRY.",
"Account Recommended": "Account Recommended",
"%amount% available credits": "%amount% available credits",
"%amount% available credit": "%amount% available credit"
}
+4 -4
View File
@@ -5640,8 +5640,8 @@
}
},
"lbry-redux": {
"version": "github:lbryio/lbry-redux#8ac92e3abfa0a9aacdb2fa4a144c3fadc4da6b11",
"from": "github:lbryio/lbry-redux#8ac92e3abfa0a9aacdb2fa4a144c3fadc4da6b11",
"version": "github:lbryio/lbry-redux#9b11cfed62af7f0f8eb6fa3c88a1f8d2cce46afc",
"from": "github:lbryio/lbry-redux#9b11cfed62af7f0f8eb6fa3c88a1f8d2cce46afc",
"requires": {
"proxy-polyfill": "0.1.6",
"reselect": "^3.0.0",
@@ -5649,8 +5649,8 @@
}
},
"lbryinc": {
"version": "github:lbryio/lbryinc#27b6fcb8391b54cc9ea4d0a52a6ee536e39aa166",
"from": "github:lbryio/lbryinc#27b6fcb8391b54cc9ea4d0a52a6ee536e39aa166",
"version": "github:lbryio/lbryinc#9ffb883cc11e36d55a729c65b70c405a4a56d35e",
"from": "github:lbryio/lbryinc#9ffb883cc11e36d55a729c65b70c405a4a56d35e",
"requires": {
"reselect": "^3.0.0"
}
+2 -2
View File
@@ -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#8ac92e3abfa0a9aacdb2fa4a144c3fadc4da6b11",
"lbryinc": "lbryio/lbryinc#27b6fcb8391b54cc9ea4d0a52a6ee536e39aa166",
"lbry-redux": "lbryio/lbry-redux#9b11cfed62af7f0f8eb6fa3c88a1f8d2cce46afc",
"lbryinc": "lbryio/lbryinc#9ffb883cc11e36d55a729c65b70c405a4a56d35e",
"lodash": ">=4.17.11",
"merge": ">=1.2.1",
"moment": "^2.22.1",
+26 -4
View File
@@ -33,6 +33,7 @@ import {
DeviceEventEmitter,
Linking,
NativeModules,
StatusBar,
TextInput,
ToastAndroid,
} from 'react-native';
@@ -50,7 +51,7 @@ import {
selectHashChanged,
selectUser,
} from 'lbryinc';
import { makeSelectClientSetting } from 'redux/selectors/settings';
import { makeSelectClientSetting, selectFullscreenMode } from 'redux/selectors/settings';
import { decode as atob } from 'base-64';
import { dispatchNavigateBack, dispatchNavigateToUri, transformUrl } from 'utils/helper';
import AsyncStorage from '@react-native-community/async-storage';
@@ -363,7 +364,7 @@ class AppWithNavigationState extends React.Component {
this.setState({ verifyPending: false });
NativeModules.Firebase.track('email_verified', { email: user.primary_email });
ToastAndroid.show('Your email address was successfully verified.', ToastAndroid.LONG);
ToastAndroid.show(__('Your email address was successfully verified.'), ToastAndroid.LONG);
// get user settings after email verification
this.getUserSettings();
@@ -400,7 +401,7 @@ class AppWithNavigationState extends React.Component {
this.setState({ emailVerifyDone: true });
const message = emailVerifyErrorMessage
? String(emailVerifyErrorMessage)
: 'Your email address was successfully verified.';
: __('Your email address was successfully verified.');
if (!emailVerifyErrorMessage) {
AsyncStorage.removeItem(Constants.KEY_FIRST_RUN_EMAIL);
}
@@ -435,6 +436,26 @@ class AppWithNavigationState extends React.Component {
if (backgroundPlayEnabled || NativeModules.BackgroundMedia) {
NativeModules.BackgroundMedia.hidePlaybackNotification();
}
// check fullscreen mode and show / hide navigation bar accordingly
this.checkFullscreenMode();
}
};
checkFullscreenMode = () => {
const { fullscreenMode } = this.props;
StatusBar.setHidden(fullscreenMode);
if (fullscreenMode) {
// fullscreen, so change orientation to landscape mode
NativeModules.ScreenOrientation.lockOrientationLandscape();
// hide the navigation bar (on devices that have the soft navigation bar)
NativeModules.UtilityModule.hideNavigationBar();
} else {
// Switch back to portrait mode when the media is not fullscreen
NativeModules.ScreenOrientation.lockOrientationPortrait();
// hide the navigation bar (on devices that have the soft navigation bar)
NativeModules.UtilityModule.showNavigationBar();
}
};
@@ -455,7 +476,7 @@ class AppWithNavigationState extends React.Component {
try {
dispatch(doUserEmailVerify(verification.token, verification.recaptcha));
} catch (error) {
const message = 'Invalid Verification Token';
const message = __('Invalid Verification Token');
dispatch(doUserEmailVerifyFailure(message));
dispatch(doToast({ message }));
}
@@ -489,6 +510,7 @@ const mapStateToProps = state => ({
emailVerifyErrorMessage: selectEmailVerifyErrorMessage(state),
showNsfw: makeSelectClientSetting(SETTINGS.SHOW_NSFW)(state),
user: selectUser(state),
fullscreenMode: selectFullscreenMode(state),
});
export default connect(mapStateToProps)(AppWithNavigationState);
+2 -2
View File
@@ -15,7 +15,7 @@ export default class Address extends React.PureComponent<Props> {
return (
<View style={[walletStyle.row, style]}>
<Text selectable={true} numberOfLines={1} style={walletStyle.address}>
<Text selectable numberOfLines={1} style={walletStyle.address}>
{address || ''}
</Text>
<Button
@@ -24,7 +24,7 @@ export default class Address extends React.PureComponent<Props> {
onPress={() => {
Clipboard.setString(address);
doToast({
message: 'Address copied',
message: __('Address copied'),
});
}}
/>
-4
View File
@@ -1,4 +0,0 @@
import { connect } from 'react-redux';
import CategoryList from './view';
export default connect()(CategoryList);
-39
View File
@@ -1,39 +0,0 @@
import React from 'react';
import NavigationActions from 'react-navigation';
import { FlatList, Text, View } from 'react-native';
import { normalizeURI } from 'lbry-redux';
import FileItem from '/component/fileItem';
import discoverStyle from 'styles/discover';
class CategoryList extends React.PureComponent {
render() {
const { category, categoryMap, navigation } = this.props;
return (
<FlatList
style={discoverStyle.horizontalScrollContainer}
contentContainerStyle={discoverStyle.horizontalScrollPadding}
initialNumToRender={3}
maxToRenderPerBatch={3}
removeClippedSubviews={true}
renderItem={({ item }) => (
<FileItem
style={discoverStyle.fileItem}
mediaStyle={discoverStyle.fileItemMedia}
key={item}
uri={normalizeURI(item)}
navigation={navigation}
showDetails={true}
compactView={false}
/>
)}
horizontal={true}
showsHorizontalScrollIndicator={false}
data={categoryMap[category]}
keyExtractor={(item, index) => item}
/>
);
}
}
export default CategoryList;
+1 -1
View File
@@ -63,7 +63,7 @@ export default class ChannelIconItem extends React.PureComponent {
>
{isPlaceholder && (
<View style={channelIconStyle.centered}>
<Text style={channelIconStyle.placeholderText}>ALL</Text>
<Text style={channelIconStyle.placeholderText}>{__('ALL')}</Text>
</View>
)}
{!isPlaceholder && thumbnail && (
+3 -1
View File
@@ -12,7 +12,9 @@ class ChannelRewardsDriver extends React.PureComponent<Props> {
<TouchableOpacity style={publishStyle.rewardDriverCard} onPress={() => navigation.navigate('Rewards')}>
<Icon name="award" size={16} style={publishStyle.rewardIcon} />
<Text style={publishStyle.rewardDriverText}>
Channel creation requires credits.{'\n'}Tap here to get some for free.
{__('Channel creation requires credits.')}
{'\n'}
{__('Tap here to get some for free.')}
</Text>
</TouchableOpacity>
);
+27 -14
View File
@@ -1,5 +1,5 @@
import React from 'react';
import { CLAIM_VALUES, isNameValid } from 'lbry-redux';
import { CLAIM_VALUES, formatCredits, isNameValid } from 'lbry-redux';
import { ActivityIndicator, NativeModules, Picker, Text, TextInput, TouchableOpacity, View } from 'react-native';
import { logPublish } from 'utils/helper';
import Button from 'component/button';
@@ -14,6 +14,7 @@ export default class ChannelSelector extends React.PureComponent {
super(props);
this.state = {
creditsInputFocused: false,
currentSelectedValue: Constants.ITEM_ANONYMOUS,
newChannelName: '',
newChannelBid: 0.1,
@@ -87,9 +88,9 @@ export default class ChannelSelector extends React.PureComponent {
}
if (newChannelName.trim().length > 0 && !isNameValid(newChannelName)) {
newChannelNameError = 'Your channel name contains invalid characters.';
newChannelNameError = __('Your channel name contains invalid characters.');
} else if (this.channelExists(newChannelName)) {
newChannelNameError = 'You have already created a channel with the same name.';
newChannelNameError = __('You have already created a channel with the same name.');
}
this.setState({
@@ -122,17 +123,17 @@ export default class ChannelSelector extends React.PureComponent {
const { newChannelBid, newChannelName } = this.state;
if (newChannelName.trim().length === 0 || !isNameValid(newChannelName.substr(1), false)) {
notify({ message: 'Your channel name contains invalid characters.' });
notify({ message: __('Your channel name contains invalid characters.') });
return;
}
if (this.channelExists(newChannelName)) {
notify({ message: 'You have already created a channel with the same name.' });
notify({ message: __('You have already created a channel with the same name.') });
return;
}
if (newChannelBid > balance) {
notify({ message: 'Deposit cannot be higher than your balance' });
notify({ message: __('Deposit cannot be higher than your balance') });
return;
}
@@ -161,7 +162,7 @@ export default class ChannelSelector extends React.PureComponent {
};
const failure = () => {
notify({ message: 'Unable to create channel due to an internal error.' });
notify({ message: __('Unable to create channel due to an internal error.') });
this.setState({
creatingChannel: false,
});
@@ -188,7 +189,7 @@ export default class ChannelSelector extends React.PureComponent {
render() {
const channel = this.state.addingChannel ? 'new' : this.props.channel;
const { enabled, fetchingChannels, channels = [] } = this.props;
const { balance, enabled, fetchingChannels, channels = [] } = this.props;
const pickerItems = [Constants.ITEM_ANONYMOUS, Constants.ITEM_CREATE_A_CHANNEL].concat(
channels ? channels.map(ch => ch.name) : []
);
@@ -214,7 +215,11 @@ export default class ChannelSelector extends React.PureComponent {
onValueChange={this.handlePickerValueChange}
>
{pickerItems.map(item => (
<Picker.Item label={item} value={item} key={item} />
<Picker.Item
label={[Constants.ITEM_ANONYMOUS, Constants.ITEM_CREATE_A_CHANNEL].includes(item) ? __(item) : item}
value={item}
key={item}
/>
))}
</Picker>
@@ -227,7 +232,7 @@ export default class ChannelSelector extends React.PureComponent {
style={channelSelectorStyle.channelNameInput}
value={this.state.newChannelName}
onChangeText={this.handleNewChannelNameChange}
placeholder={'Channel name'}
placeholder={__('Channel name')}
underlineColorAndroid={Colors.NextLbryGreen}
/>
</View>
@@ -235,30 +240,38 @@ export default class ChannelSelector extends React.PureComponent {
<Text style={channelSelectorStyle.inlineError}>{newChannelNameError}</Text>
)}
<View style={channelSelectorStyle.bidRow}>
<Text style={channelSelectorStyle.label}>Deposit</Text>
<Text style={channelSelectorStyle.label}>{__('Deposit')}</Text>
<TextInput
style={channelSelectorStyle.bidAmountInput}
value={String(newChannelBid)}
onChangeText={this.handleNewChannelBidChange}
onFocus={() => this.setState({ creditsInputFocused: true })}
onBlur={() => this.setState({ creditsInputFocused: false })}
placeholder={'0.00'}
keyboardType={'number-pad'}
underlineColorAndroid={Colors.NextLbryGreen}
/>
<Text style={channelSelectorStyle.currency}>LBC</Text>
<View style={channelSelectorStyle.balance}>
{this.state.creditsInputFocused && <Icon name="coins" size={12} />}
{this.state.creditsInputFocused && (
<Text style={channelSelectorStyle.balanceText}>{formatCredits(parseFloat(balance), 1, true)}</Text>
)}
</View>
</View>
<Text style={channelSelectorStyle.helpText}>
This LBC remains yours. It is a deposit to reserve the name and can be undone at any time.
{__('This LBC remains yours. It is a deposit to reserve the name and can be undone at any time.')}
</Text>
<View style={channelSelectorStyle.buttonContainer}>
{creatingChannel && <ActivityIndicator size={'small'} color={Colors.LbryGreen} />}
{!creatingChannel && (
<View style={channelSelectorStyle.buttons}>
<Link style={channelSelectorStyle.cancelLink} text="Cancel" onPress={this.handleCreateCancel} />
<Link style={channelSelectorStyle.cancelLink} text={__('Cancel')} onPress={this.handleCreateCancel} />
<Button
style={channelSelectorStyle.createButton}
disabled={!(newChannelName.trim().length > 0 && newChannelBid > 0)}
text="Create"
text={__('Create')}
onPress={this.handleCreateChannelClick}
/>
</View>
+4 -2
View File
@@ -147,7 +147,7 @@ class ClaimList extends React.PureComponent {
renderMorePlaceholder = () => {
return (
<TouchableOpacity style={discoverStyle.fileItemMore} onPress={this.onMorePressed}>
<Text style={discoverStyle.moreText}>more</Text>
<Text style={discoverStyle.moreText}>{__('more')}</Text>
<Icon style={discoverStyle.moreIcon} name={'angle-double-down'} color={Colors.White} size={16} />
</TouchableOpacity>
);
@@ -155,7 +155,9 @@ class ClaimList extends React.PureComponent {
verticalListEmptyComponent = () => {
return (
<Text style={claimListStyle.noContentText}>No content to display at this time. Please check back later.</Text>
<Text style={claimListStyle.noContentText}>
{__('No content to display at this time. Please check back later.')}
</Text>
);
};
+6 -6
View File
@@ -20,7 +20,7 @@ class CustomRewardCard extends React.PureComponent<Props> {
if (error && error.trim().length > 0) {
notify({ message: error });
} else {
notify({ message: 'Reward successfully claimed!' });
notify({ message: __('Reward successfully claimed!') });
this.setState({ rewardCode: '' });
}
this.setState({ claimStarted: false });
@@ -37,12 +37,12 @@ class CustomRewardCard extends React.PureComponent<Props> {
if (showVerification) {
showVerification();
}
notify({ message: 'Unfortunately, you are not eligible to claim this reward at this time.' });
notify({ message: __('Unfortunately, you are not eligible to claim this reward at this time.') });
return;
}
if (!rewardCode || rewardCode.trim().length === 0) {
notify({ message: 'Please enter a reward code to claim.' });
notify({ message: __('Please enter a reward code to claim.') });
return;
}
@@ -60,9 +60,9 @@ class CustomRewardCard extends React.PureComponent<Props> {
{rewardIsPending && <ActivityIndicator size="small" color={Colors.NextLbryGreen} />}
</View>
<View style={rewardStyle.midCol}>
<Text style={rewardStyle.rewardTitle}>Custom Code</Text>
<Text style={rewardStyle.rewardTitle}>{__('Custom Code')}</Text>
<Text style={rewardStyle.rewardDescription}>
Are you a supermodel or rockstar that received a custom reward code? Claim it here.
{__('Are you a supermodel or rockstar that received a custom reward code? Claim it here.')}
</Text>
<View>
@@ -74,7 +74,7 @@ class CustomRewardCard extends React.PureComponent<Props> {
/>
<Button
style={rewardStyle.redeemButton}
text={'Redeem'}
text={__('Redeem')}
disabled={!this.state.rewardCode || this.state.rewardCode.trim().length === 0 || rewardIsPending}
onPress={() => {
if (!rewardIsPending) {
+11 -7
View File
@@ -54,7 +54,11 @@ class DrawerContent extends React.PureComponent {
launchSignInFlow = () => {
// for now, sync flow (email, then password input) will be the default sign in flow
const { navigation } = this.props;
navigation.navigate({ routeName: 'Verification', key: 'verification', params: { syncFlow: true } });
navigation.navigate({
routeName: 'Verification',
key: 'verification',
params: { syncFlow: true, signInFlow: true },
});
};
render() {
@@ -73,7 +77,7 @@ class DrawerContent extends React.PureComponent {
<Button
style={discoverStyle.signInButton}
theme={'light'}
text={'Sign in'}
text={__('Sign in')}
onPress={this.launchSignInFlow}
/>
)}
@@ -109,12 +113,12 @@ class DrawerContent extends React.PureComponent {
{!signedIn && (
<TouchableOpacity
accessible
accessibilityLabel={'Sign In'}
accessibilityLabel={__('Sign In')}
onPress={this.launchSignInFlow}
delayPressIn={0}
style={[discoverStyle.signInMenuItem, discoverStyle.signInMenuItemButton]}
>
<Text style={discoverStyle.signInMenuItemButtonText}>SIGN IN</Text>
<Text style={discoverStyle.signInMenuItemButtonText}>{__('SIGN IN')}</Text>
</TouchableOpacity>
)}
@@ -133,7 +137,7 @@ class DrawerContent extends React.PureComponent {
<View key={groupName} style={discoverStyle.menuGroup}>
{groupNames[3] !== groupName && (
<Text key={`${groupName}-title`} style={discoverStyle.menuGroupName}>
{groupName}
{__(groupName)}
</Text>
)}
{menuItems.map(item => {
@@ -146,7 +150,7 @@ class DrawerContent extends React.PureComponent {
return (
<TouchableOpacity
accessible
accessibilityLabel={item.label}
accessibilityLabel={__(item.label)}
style={[
discoverStyle.menuItemTouchArea,
focused ? discoverStyle.menuItemTouchAreaFocused : null,
@@ -164,7 +168,7 @@ class DrawerContent extends React.PureComponent {
/>
</View>
<Text style={[discoverStyle.menuItem, focused ? discoverStyle.menuItemFocused : null]}>
{item.label}
{__(item.label)}
</Text>
</TouchableOpacity>
);
+8 -12
View File
@@ -12,8 +12,8 @@ class FileDownloadButton extends React.PureComponent {
}
componentWillReceiveProps(nextProps) {
//this.checkAvailability(nextProps.uri);
//this.restartDownload(nextProps);
// this.checkAvailability(nextProps.uri);
// this.restartDownload(nextProps);
}
restartDownload(props) {
@@ -50,13 +50,11 @@ class FileDownloadButton extends React.PureComponent {
if ((fileInfo && !fileInfo.stopped) || loading || downloading) {
const progress = fileInfo && fileInfo.written_bytes ? (fileInfo.written_bytes / fileInfo.total_bytes) * 100 : 0,
label = fileInfo ? progress.toFixed(0) + '% complete' : 'Connecting...';
label = fileInfo ? __('%progress%% complete', { progress: progress.toFixed(0) }) : __('Connecting...');
return (
<View style={[style, fileDownloadButtonStyle.container]}>
<View
style={{ width: `${progress}%`, backgroundColor: '#ff0000', position: 'absolute', left: 0, top: 0 }}
></View>
<View style={{ width: `${progress}%`, backgroundColor: '#ff0000', position: 'absolute', left: 0, top: 0 }} />
<Text style={fileDownloadButtonStyle.text}>{label}</Text>
</View>
);
@@ -64,20 +62,18 @@ class FileDownloadButton extends React.PureComponent {
if (!costInfo) {
return (
<View style={[style, fileDownloadButtonStyle.container]}>
<Text style={fileDownloadButtonStyle.text}>Fetching cost info...</Text>
<Text style={fileDownloadButtonStyle.text}>{__('Fetching cost info...')}</Text>
</View>
);
}
return (
<Button
icon={isPlayable ? 'play' : null}
text={isPlayable ? 'Play' : isViewable ? 'View' : 'Download'}
text={isPlayable ? __('Play') : isViewable ? __('View') : __('Download')}
onLayout={onButtonLayout}
style={[style, fileDownloadButtonStyle.container]}
onPress={() => {
if (NativeModules.Firebase) {
NativeModules.Firebase.track('purchase_uri', { uri: uri });
}
NativeModules.Firebase.track('purchase_uri', { uri: uri });
purchaseUri(uri, costInfo, !isPlayable);
if (NativeModules.UtilityModule) {
NativeModules.UtilityModule.checkDownloads();
@@ -98,7 +94,7 @@ class FileDownloadButton extends React.PureComponent {
style={[style, fileDownloadButtonStyle.container]}
onPress={openFile}
>
<Text style={fileDownloadButtonStyle.text}>{isViewable ? 'View' : 'Open'}</Text>
<Text style={fileDownloadButtonStyle.text}>{isViewable ? __('View') : __('Open')}</Text>
</TouchableOpacity>
);
}
+10 -4
View File
@@ -30,12 +30,12 @@ class FileItem extends React.PureComponent {
}
navigateToFileUri = () => {
const { navigation, uri, shortUrl } = this.props;
const { claim, navigation, uri, shortUrl } = this.props;
const normalizedUri = normalizeURI(uri);
if (NativeModules.Firebase) {
NativeModules.Firebase.track('explore_click', { uri: normalizedUri, short_url: shortUrl });
}
navigateToUri(navigation, shortUrl || uri);
navigateToUri(navigation, shortUrl || uri, null, false, claim ? claim.permanent_url : null);
};
render() {
@@ -124,11 +124,17 @@ class FileItem extends React.PureComponent {
style={discoverStyle.channelName}
text={channelName}
onPress={() => {
navigateToUri(navigation, normalizeURI(shortChannelUri || fullChannelUri));
navigateToUri(
navigation,
normalizeURI(shortChannelUri || fullChannelUri),
null,
false,
fullChannelUri
);
}}
/>
)}
{!channelName && !isResolvingUri && <Text style={discoverStyle.anonChannelName}>Anonymous</Text>}
{!channelName && !isResolvingUri && <Text style={discoverStyle.anonChannelName}>{__('Anonymous')}</Text>}
<DateTime style={discoverStyle.dateTime} textStyle={discoverStyle.dateTimeText} timeAgo uri={uri} />
</View>
)}
+1
View File
@@ -61,6 +61,7 @@ class FileItemMedia extends React.PureComponent {
let style = this.props.style;
const { duration, isResolvingUri, thumbnail, title, resizeMode } = this.props;
const atStyle = this.state.autoThumbStyle;
if (this.isThumbnailValid(thumbnail) && !this.state.imageLoadFailed) {
if (style == null) {
style = fileItemMediaStyle.thumbnail;
+11 -5
View File
@@ -40,8 +40,8 @@ class FileListItem extends React.PureComponent {
};
componentDidMount() {
const { claim, resolveUri, uri } = this.props;
if (!claim) {
const { claim, resolveUri, uri, batchResolve } = this.props;
if (!claim && !batchResolve) {
resolveUri(uri);
}
}
@@ -59,7 +59,7 @@ class FileListItem extends React.PureComponent {
if (featuredResult && !claim) {
navigation.navigate({ routeName: Constants.DRAWER_ROUTE_PUBLISH, params: { vanityUrl: uri.trim() } });
} else {
navigateToUri(navigation, shortUrl || uri, { autoplay });
navigateToUri(navigation, shortUrl || uri, { autoplay }, false, claim ? claim.permanent_url : null);
}
};
@@ -189,7 +189,7 @@ class FileListItem extends React.PureComponent {
{featuredResult && !isResolving && !claim && (
<View style={fileListStyle.titleContainer}>
<Text style={fileListStyle.featuredTitle}>Nothing here. Publish something!</Text>
<Text style={fileListStyle.featuredTitle}>{__('Nothing here. Publish something!')}</Text>
</View>
)}
@@ -198,7 +198,13 @@ class FileListItem extends React.PureComponent {
style={fileListStyle.publisher}
text={channel}
onPress={() => {
navigateToUri(navigation, normalizeURI(shortChannelUri || fullChannelUri));
navigateToUri(
navigation,
normalizeURI(shortChannelUri || fullChannelUri),
null,
false,
fullChannelUri
);
}}
/>
)}
+9 -4
View File
@@ -42,11 +42,16 @@ class CreditAmount extends React.PureComponent {
let amountText;
if (this.props.showFree && parseFloat(this.props.amount) === 0) {
amountText = 'FREE';
amountText = __('FREE');
} else {
if (this.props.label) {
const label =
typeof this.props.label === 'string' ? this.props.label : parseFloat(amount) == 1 ? 'credit' : 'credits';
typeof this.props.label === 'string'
? this.props.label
: parseFloat(amount) === 1
? __('credit')
: __('credits');
// TODO: handling singular / plural in other languages?
amountText = `${formattedAmount} ${label}`;
} else {
@@ -57,14 +62,14 @@ class CreditAmount extends React.PureComponent {
}
}
/*{this.props.isEstimate ? (
/* {this.props.isEstimate ? (
<span
className="credit-amount__estimate"
title={__('This is an estimate and does not include data fees')}
>
*
</span>
) : null}*/
) : null} */
return <Text style={style}>{amountText}</Text>;
}
}
+1 -1
View File
@@ -10,7 +10,7 @@ class FileRewardsDriver extends React.PureComponent<Props> {
return (
<TouchableOpacity style={filePageStyle.rewardDriverCard} onPress={() => navigation.navigate('Rewards')}>
<Icon name="award" size={16} style={filePageStyle.rewardDriverIcon} />
<Text style={filePageStyle.rewardDriverText}>Earn some credits to access this content.</Text>
<Text style={filePageStyle.rewardDriverText}>{__('Earn some credits to access this content.')}</Text>
</TouchableOpacity>
);
}
+1 -1
View File
@@ -46,7 +46,7 @@ export default class ModalPicker extends React.PureComponent {
onPress={() => onItemSelected(item)}
>
{item.icon && <Icon style={modalPickerStyle.itemIcon} name={item.icon} size={16} />}
<Text style={modalPickerStyle.itemLabel}>{item.label}</Text>
<Text style={modalPickerStyle.itemLabel}>{__(item.label)}</Text>
{selectedItem && selectedItem.name === item.name && (
<Icon style={modalPickerStyle.itemSelected} name={'check'} color={Colors.LbryGreen} size={16} />
)}
@@ -17,7 +17,7 @@ export default class ModalSuggestedSubcriptions extends React.PureComponent {
<TouchableOpacity style={[modalStyle.container, subscriptionsStyle.modalContainer]} activeOpacity={1}>
<SuggestedSubscriptions inModal navigation={navigation} />
<View style={modalStyle.buttons}>
<Button style={modalStyle.doneButton} text={'Done'} onPress={onDonePress} />
<Button style={modalStyle.doneButton} text={__('Done')} onPress={onDonePress} />
</View>
</TouchableOpacity>
</TouchableOpacity>
+2 -3
View File
@@ -8,7 +8,6 @@ import Icon from 'react-native-vector-icons/FontAwesome5';
import Tag from 'component/tag';
import TagSearch from 'component/tagSearch';
import modalTagSelectorStyle from 'styles/modalTagSelector';
import { __ } from 'utils/helper';
const minimumTags = 2;
@@ -57,7 +56,7 @@ export default class ModalTagSelector extends React.PureComponent {
<TouchableOpacity style={modalTagSelectorStyle.overlay} activeOpacity={1} onPress={onOverlayPress}>
<TouchableOpacity style={modalTagSelectorStyle.container} activeOpacity={1}>
<View style={modalTagSelectorStyle.titleRow}>
<Text style={modalTagSelectorStyle.title}>Customize your tags</Text>
<Text style={modalTagSelectorStyle.title}>{__('Customize your tags')}</Text>
</View>
<View style={modalTagSelectorStyle.tagList}>
{tags &&
@@ -73,7 +72,7 @@ export default class ModalTagSelector extends React.PureComponent {
</View>
<TagSearch handleAddTag={this.handleAddTag} selectedTags={tags} />
<View style={modalTagSelectorStyle.buttons}>
<Button style={modalTagSelectorStyle.doneButton} text={'Done'} onPress={onDonePress} />
<Button style={modalTagSelectorStyle.doneButton} text={__('Done')} onPress={onDonePress} />
</View>
</TouchableOpacity>
</TouchableOpacity>
+1 -1
View File
@@ -7,7 +7,7 @@ class NsfwOverlay extends React.PureComponent {
return (
<TouchableOpacity style={discoverStyle.overlay} activeOpacity={1} onPress={this.props.onPress}>
<Text style={discoverStyle.overlayText}>
This content is Not Safe For Work. To view adult content, please change your Settings.
{__('This content is Not Safe For Work. To view adult content, please change your Settings.')}
</Text>
</TouchableOpacity>
);
+3 -1
View File
@@ -12,7 +12,9 @@ class PublishRewardsDriver extends React.PureComponent<Props> {
<TouchableOpacity style={publishStyle.rewardDriverCard} onPress={() => navigation.navigate('Rewards')}>
<Icon name="award" size={16} style={publishStyle.rewardIcon} />
<Text style={publishStyle.rewardDriverText}>
Publishing requires credits.{'\n'}Tap here to get some for free.
{__('Publishing requires credits.')}
{'\n'}
{__('Tap here to get some for free.')}
</Text>
</TouchableOpacity>
);
+2 -2
View File
@@ -1,11 +1,11 @@
import { connect } from 'react-redux';
import {
doResolveUris,
makeSelectClaimForUri,
makeSelectRecommendedContentForUri,
makeSelectTitleForUri,
selectIsSearching,
} from 'lbry-redux';
import { doNativeSearch } from 'redux/actions/performance';
import RelatedContent from './view';
const select = (state, props) => ({
@@ -16,7 +16,7 @@ const select = (state, props) => ({
});
const perform = dispatch => ({
search: query => dispatch(doNativeSearch(query, 20, undefined, true)),
resolveUris: uris => dispatch(doResolveUris(uris)),
});
export default connect(
+12 -36
View File
@@ -8,49 +8,27 @@ import fileListStyle from 'styles/fileList';
import relatedContentStyle from 'styles/relatedContent';
export default class RelatedContent extends React.PureComponent {
constructor() {
super();
this.didSearch = undefined;
}
componentDidMount() {
this.getRecommendedContent();
}
state = {
urlsResolved: false,
};
componentDidUpdate(prevProps) {
const { claim, uri } = this.props;
const { resolveUris, recommendedContent } = this.props;
if (uri !== prevProps.uri) {
this.didSearch = false;
}
if (claim && !this.didSearch) {
this.getRecommendedContent();
if (recommendedContent && recommendedContent.length > 0 && !this.state.urisResolved) {
this.setState({ urisResolved: true }, () => {
// batch resolve the uris
resolveUris(recommendedContent);
});
}
}
getRecommendedContent() {
const { search, title } = this.props;
if (title) {
search(title);
this.didSearch = true;
}
}
didSearch;
render() {
const { recommendedContent, isSearching, navigation, uri, fullUri } = this.props;
if (!isSearching && (!recommendedContent || recommendedContent.length === 0)) {
return null;
}
const { recommendedContent, navigation, uri, fullUri } = this.props;
return (
<View style={relatedContentStyle.container}>
<Text style={relatedContentStyle.title}>Related Content</Text>
<Text style={relatedContentStyle.title}>{__('Related Content')}</Text>
{recommendedContent &&
recommendedContent
.filter(recommendedUri => recommendedUri !== normalizeURI(fullUri))
@@ -59,13 +37,11 @@ export default class RelatedContent extends React.PureComponent {
style={fileListStyle.item}
key={recommendedUri}
uri={recommendedUri}
batchResolve
navigation={navigation}
autoplay
/>
))}
{isSearching && (
<ActivityIndicator size="small" color={Colors.NextLbryGreen} style={relatedContentStyle.loading} />
)}
</View>
);
}
+3 -3
View File
@@ -34,7 +34,7 @@ class RewardCard extends React.PureComponent<Props> {
notify({ message: errorMessage });
clearError(reward);
} else {
notify({ message: 'Reward successfully claimed!' });
notify({ message: __('Reward successfully claimed!') });
}
this.setState({ claimStarted: false });
}
@@ -47,7 +47,7 @@ class RewardCard extends React.PureComponent<Props> {
if (showVerification) {
showVerification();
}
notify({ message: 'Unfortunately, you are not eligible to claim this reward at this time.' });
notify({ message: __('Unfortunately, you are not eligible to claim this reward at this time.') });
return;
}
@@ -112,7 +112,7 @@ class RewardCard extends React.PureComponent<Props> {
style={rewardStyle.link}
href={`https://explorer.lbry.com/tx/${reward.transaction_id}`}
text={reward.transaction_id.substring(0, 7)}
error={'The transaction URL could not be opened'}
error={__('The transaction URL could not be opened')}
/>
)}
</View>
+15 -6
View File
@@ -35,23 +35,32 @@ class RewardEnrolment extends React.Component {
<View style={rewardStyle.enrollContainer}>
<View style={rewardStyle.summaryRow}>
<Icon name="award" size={36} color={Colors.White} />
<Text style={rewardStyle.summaryText}>{unclaimedRewardAmount} available credits</Text>
<Text style={rewardStyle.summaryText}>
{unclaimedRewardAmount === 1 && __('%amount% available credit', { amount: unclaimedRewardAmount })}
{unclaimedRewardAmount !== 1 && __('%amount% available credits', { amount: unclaimedRewardAmount })}
</Text>
</View>
<View style={rewardStyle.onboarding}>
<Text style={rewardStyle.enrollDescText}>
LBRY credits allow you to purchase content, publish content, and influence the network.{'\n\n'}
You get credits for free for providing an email address and taking other basic actions.{'\n\n'}
<Link style={rewardStyle.learnMoreLink} text={'Learn more'} onPress={this.onLearnMorePressed} />.
{__('LBRY credits allow you to purchase content, publish content, and influence the network.')}
{'\n\n'}
{__('You get credits for free for providing an email address and taking other basic actions.')}
{'\n\n'}
<Link style={rewardStyle.learnMoreLink} text={__('Learn more')} onPress={this.onLearnMorePressed} />.
</Text>
</View>
<View style={rewardStyle.buttonRow}>
<Link style={rewardStyle.notInterestedLink} text={'Not interested'} onPress={this.onNotInterestedPressed} />
<Link
style={rewardStyle.notInterestedLink}
text={__('Not interested')}
onPress={this.onNotInterestedPressed}
/>
<Button
style={rewardStyle.enrollButton}
theme={'light'}
text={'Get started'}
text={__('Get started')}
onPress={this.onEnrollPressed}
/>
</View>
-20
View File
@@ -1,20 +0,0 @@
import { connect } from 'react-redux';
import { doToast } from 'lbry-redux';
import { doRewardList, selectUnclaimedRewardValue, selectFetchingRewards, selectUser } from 'lbryinc';
import RewardSummary from './view';
const select = state => ({
unclaimedRewardAmount: selectUnclaimedRewardValue(state),
fetching: selectFetchingRewards(state),
user: selectUser(state),
});
const perform = dispatch => ({
fetchRewards: () => dispatch(doRewardList()),
notify: data => dispatch(doToast(data)),
});
export default connect(
select,
perform
)(RewardSummary);
-82
View File
@@ -1,82 +0,0 @@
import React from 'react';
import { NativeModules, Text, TouchableOpacity, View } from 'react-native';
import AsyncStorage from '@react-native-community/async-storage';
import Button from 'component/button';
import Colors from 'styles/colors';
import Icon from 'react-native-vector-icons/FontAwesome5';
import rewardStyle from 'styles/reward';
class RewardSummary extends React.Component {
static itemKey = 'rewardSummaryDismissed';
state = {
actionsLeft: 0,
dismissed: false,
};
componentDidMount() {
this.props.fetchRewards();
AsyncStorage.getItem(RewardSummary.itemKey).then(isDismissed => {
if (isDismissed === 'true') {
this.setState({ dismissed: true });
}
const { user } = this.props;
let actionsLeft = 0;
if (!user || !user.has_verified_email) {
actionsLeft++;
}
if (!user || !user.is_identity_verified) {
actionsLeft++;
}
this.setState({ actionsLeft });
});
}
onDismissPressed = () => {
AsyncStorage.setItem(RewardSummary.itemKey, 'true');
this.setState({ dismissed: true });
this.props.notify({
message: 'You can always claim your rewards from the Rewards page.',
});
};
handleSummaryPressed = () => {
const { showVerification } = this.props;
if (showVerification) {
showVerification();
}
};
render() {
const { fetching, navigation, unclaimedRewardAmount, user } = this.props;
if (!user) {
return null;
}
if (
this.state.dismissed ||
(user && user.is_reward_approved) ||
this.state.actionsLeft === 0 ||
unclaimedRewardAmount === 0
) {
return null;
}
return (
<TouchableOpacity style={rewardStyle.summaryContainer} onPress={this.handleSummaryPressed}>
<View style={rewardStyle.summaryRow}>
<Icon name="award" size={36} color={Colors.White} />
<Text style={rewardStyle.summaryText}>{unclaimedRewardAmount} available credits</Text>
</View>
<Button style={rewardStyle.dismissButton} theme={'light'} text={'Dismiss'} onPress={this.onDismissPressed} />
</TouchableOpacity>
);
}
}
export default RewardSummary;
-19
View File
@@ -1,19 +0,0 @@
import { connect } from 'react-redux';
import { NativeModules } from 'react-native';
import { doSearch, doUpdateSearchQuery } from 'lbry-redux';
import SearchInput from './view';
const perform = dispatch => ({
search: search => {
if (NativeModules.Firebase) {
NativeModules.Firebase.track('search', { query: search });
}
return dispatch(doSearch(search));
},
updateSearchQuery: query => dispatch(doUpdateSearchQuery(query, false)),
});
export default connect(
null,
perform
)(SearchInput);
-41
View File
@@ -1,41 +0,0 @@
import React from 'react';
import { TextInput } from 'react-native';
class SearchInput extends React.PureComponent {
static INPUT_TIMEOUT = 500;
state = {
changeTextTimeout: -1,
};
handleChangeText = text => {
clearTimeout(this.state.changeTextTimeout);
if (!text || text.trim().length < 2) {
// only perform a search if 2 or more characters have been input
return;
}
const { search, updateSearchQuery } = this.props;
updateSearchQuery(text);
let timeout = setTimeout(() => {
search(text);
}, SearchInput.INPUT_TIMEOUT);
this.setState({ changeTextTimeout: timeout });
};
render() {
const { style, value } = this.props;
return (
<TextInput
style={style}
placeholder="Search"
underlineColorAndroid="transparent"
value={value}
onChangeText={text => this.handleChangeText(text)}
/>
);
}
}
export default SearchInput;
+9 -9
View File
@@ -1,9 +1,9 @@
import React from 'react';
import { normalizeURI, parseURI } from 'lbry-redux';
import { ActivityIndicator, Platform, Switch, Text, TouchableOpacity, View } from 'react-native';
import { formatBytes } from '../../utils/helper';
import Colors from '../../styles/colors';
import storageStatsStyle from '../../styles/storageStats';
import { formatBytes } from 'utils/helper';
import Colors from 'styles/colors';
import storageStatsStyle from 'styles/storageStats';
class StorageStatsCard extends React.PureComponent {
state = {
@@ -75,10 +75,10 @@ class StorageStatsCard extends React.PureComponent {
<View style={[storageStatsStyle.row, storageStatsStyle.totalSizeContainer]}>
<View style={storageStatsStyle.summary}>
<Text style={storageStatsStyle.totalSize}>{formatBytes(this.state.totalBytes, 2)}</Text>
<Text style={storageStatsStyle.annotation}>used</Text>
<Text style={storageStatsStyle.annotation}>{__('used')}</Text>
</View>
<View style={[storageStatsStyle.row, storageStatsStyle.toggleStatsContainer]}>
<Text style={storageStatsStyle.statsText}>Stats</Text>
<Text style={storageStatsStyle.statsText}>{__('Stats')}</Text>
<Switch
style={storageStatsStyle.statsToggle}
value={this.state.showStats}
@@ -98,28 +98,28 @@ class StorageStatsCard extends React.PureComponent {
{this.state.totalAudioBytes > 0 && (
<View style={[storageStatsStyle.row, storageStatsStyle.legendItem]}>
<View style={[storageStatsStyle.legendBox, storageStatsStyle.audioDistribution]} />
<Text style={storageStatsStyle.legendText}>Audio</Text>
<Text style={storageStatsStyle.legendText}>{__('Audio')}</Text>
<Text style={storageStatsStyle.legendSize}>{formatBytes(this.state.totalAudioBytes, 2)}</Text>
</View>
)}
{this.state.totalImageBytes > 0 && (
<View style={[storageStatsStyle.row, storageStatsStyle.legendItem]}>
<View style={[storageStatsStyle.legendBox, storageStatsStyle.imageDistribution]} />
<Text style={storageStatsStyle.legendText}>Images</Text>
<Text style={storageStatsStyle.legendText}>{__('Images')}</Text>
<Text style={storageStatsStyle.legendSize}>{formatBytes(this.state.totalImageBytes, 2)}</Text>
</View>
)}
{this.state.totalVideoBytes > 0 && (
<View style={[storageStatsStyle.row, storageStatsStyle.legendItem]}>
<View style={[storageStatsStyle.legendBox, storageStatsStyle.videoDistribution]} />
<Text style={storageStatsStyle.legendText}>Videos</Text>
<Text style={storageStatsStyle.legendText}>{__('Videos')}</Text>
<Text style={storageStatsStyle.legendSize}>{formatBytes(this.state.totalVideoBytes, 2)}</Text>
</View>
)}
{this.state.totalOtherBytes > 0 && (
<View style={[storageStatsStyle.row, storageStatsStyle.legendItem]}>
<View style={[storageStatsStyle.legendBox, storageStatsStyle.otherDistribution]} />
<Text style={storageStatsStyle.legendText}>Other</Text>
<Text style={storageStatsStyle.legendText}>{__('Other')}</Text>
<Text style={storageStatsStyle.legendSize}>{formatBytes(this.state.totalOtherBytes, 2)}</Text>
</View>
)}
@@ -57,7 +57,7 @@ class SuggestedSubscriptionItem extends React.PureComponent {
style={subscriptionsStyle.suggestedItemName}
numberOfLines={1}
text={claim.name}
onPress={() => navigateToUri(navigation, normalizeURI(shortUrl || uri))}
onPress={() => navigateToUri(navigation, normalizeURI(shortUrl || uri), null, false, claim.permanent_url)}
/>
)}
{tags && (
+1 -1
View File
@@ -1,7 +1,7 @@
import React from 'react';
import { ActivityIndicator, SectionList, Text, View } from 'react-native';
import { MATURE_TAGS, createNormalizedClaimSearchKey, normalizeURI } from 'lbry-redux';
import { __, navigateToUri } from 'utils/helper';
import { navigateToUri } from 'utils/helper';
import SubscribeButton from 'component/subscribeButton';
import SuggestedSubscriptionItem from 'component/suggestedSubscriptionItem';
import Colors from 'styles/colors';
+2 -2
View File
@@ -74,7 +74,7 @@ export default class TagSearch extends React.PureComponent {
<TextInput
editable={editable}
style={tagStyle.searchInput}
placeholder={'Search for more tags'}
placeholder={__('Search for more tags')}
underlineColorAndroid={Colors.NextLbryGreen}
value={this.state.tag}
numberOfLines={1}
@@ -89,7 +89,7 @@ export default class TagSearch extends React.PureComponent {
</KeyboardAvoidingView>
{showNsfwTags && (
<View style={tagStyle.nsfwTagsContainer}>
<Text style={tagStyle.nsfwTagsTitle}>Mature tags</Text>
<Text style={tagStyle.nsfwTagsTitle}>{__('Mature tags')}</Text>
<View style={tagStyle.tagResultsList}>
{MATURE_TAGS.map(tag => (
<Tag
@@ -2,10 +2,10 @@
import React from 'react';
import { Text, View, Linking } from 'react-native';
import { buildURI, formatCredits } from 'lbry-redux';
import { navigateToUri } from '../../../utils/helper';
import Link from '../../link';
import { navigateToUri } from 'utils/helper';
import Link from 'component/link';
import moment from 'moment';
import transactionListStyle from '../../../styles/transactionList';
import transactionListStyle from 'styles/transactionList';
class TransactionListItem extends React.PureComponent {
capitalize(string: string) {
@@ -43,14 +43,14 @@ class TransactionListItem extends React.PureComponent {
style={transactionListStyle.smallLink}
text={txid.substring(0, 8)}
href={`https://explorer.lbry.com/tx/${txid}`}
error={'The transaction URL could not be opened'}
error={__('The transaction URL could not be opened')}
/>
</View>
<View style={transactionListStyle.col}>
{date ? (
<Text style={transactionListStyle.smallText}>{moment(date).format('MMM D')}</Text>
) : (
<Text style={transactionListStyle.smallText}>Pending</Text>
<Text style={transactionListStyle.smallText}>{__('Pending')}</Text>
)}
</View>
</View>
+1 -1
View File
@@ -47,7 +47,7 @@ class TransactionList extends React.PureComponent {
return (
<View>
{!transactionList.length && (
<Text style={transactionListStyle.noTransactions}>{emptyMessage || 'No transactions to list.'}</Text>
<Text style={transactionListStyle.noTransactions}>{emptyMessage || __('No transactions to list.')}</Text>
)}
{!!transactionList.length && (
+9 -9
View File
@@ -2,11 +2,11 @@
import React from 'react';
// import BusyIndicator from 'component/common/busy-indicator';
import { Text, View } from 'react-native';
import Button from '../button';
import Link from '../link';
import TransactionList from '../transactionList';
import type { Transaction } from '../transactionList/view';
import walletStyle from '../../styles/wallet';
import Button from 'component/button';
import Link from 'component/link';
import TransactionList from 'component/transactionList';
import type { Transaction } from 'component/transactionList/view';
import walletStyle from 'styles/wallet';
type Props = {
fetchTransactions: () => void,
@@ -26,15 +26,15 @@ class TransactionListRecent extends React.PureComponent<Props> {
return (
<View style={walletStyle.transactionsCard}>
<View style={[walletStyle.row, walletStyle.transactionsHeader]}>
<Text style={walletStyle.transactionsTitle}>Recent Transactions</Text>
<Link style={walletStyle.link} navigation={navigation} text={'View All'} href={'#TransactionHistory'} />
<Text style={walletStyle.transactionsTitle}>{__('Recent Transactions')}</Text>
<Link style={walletStyle.link} navigation={navigation} text={__('View All')} href={'#TransactionHistory'} />
</View>
{fetchingTransactions && <Text style={walletStyle.infoText}>Fetching transactions...</Text>}
{fetchingTransactions && <Text style={walletStyle.infoText}>{__('Fetching transactions...')}</Text>}
{!fetchingTransactions && (
<TransactionList
navigation={navigation}
transactions={transactions.slice(0, 5)}
emptyMessage={"Looks like you don't have any recent transactions."}
emptyMessage={__("Looks like you don't have any recent transactions.")}
/>
)}
</View>
+1 -1
View File
@@ -256,7 +256,7 @@ class UriBar extends React.PureComponent {
this.setSelection();
}}
selectTextOnFocus
placeholder={'Search movies, music, and more'}
placeholder={__('Search movies, music, and more')}
underlineColorAndroid={'transparent'}
numberOfLines={1}
clearButtonMode={'while-editing'}
+6 -5
View File
@@ -27,21 +27,22 @@ class WalletAddress extends React.PureComponent<Props> {
return (
<View style={walletStyle.card}>
<Text style={walletStyle.title}>Receive Credits</Text>
<Text style={walletStyle.title}>{__('Receive Credits')}</Text>
<Text style={[walletStyle.text, walletStyle.bottomMarginMedium]}>
Use this wallet address to receive credits sent by another user (or yourself).
{__('Use this wallet address to receive credits sent by another user (or yourself).')}
</Text>
<Address address={receiveAddress} style={walletStyle.bottomMarginSmall} />
<Button
style={[walletStyle.button, walletStyle.bottomMarginLarge]}
icon={'sync'}
text={'Get new address'}
text={__('Get new address')}
onPress={getNewAddress}
disabled={gettingNewAddress}
/>
<Text style={walletStyle.smallText}>
You can generate a new address at any time, and any previous addresses will continue to work. Using multiple
addresses can be helpful for keeping track of incoming payments from multiple sources.
{__(
'You can generate a new address at any time, and any previous addresses will continue to work. Using multiple addresses can be helpful for keeping track of incoming payments from multiple sources.'
)}
</Text>
</View>
);
+2 -2
View File
@@ -16,8 +16,8 @@ class WalletBalance extends React.PureComponent<Props> {
return (
<View style={walletStyle.balanceCard}>
<Image style={walletStyle.balanceBackground} resizeMode={'cover'} source={require('../../assets/stripe.png')} />
<Text style={walletStyle.balanceTitle}>Balance</Text>
<Text style={walletStyle.balanceCaption}>You currently have</Text>
<Text style={walletStyle.balanceTitle}>{__('Balance')}</Text>
<Text style={walletStyle.balanceCaption}>{__('You currently have')}</Text>
<Text style={walletStyle.balance}>
{(balance || balance === 0) && formatCredits(parseFloat(balance), 2) + ' LBC'}
</Text>
+2 -1
View File
@@ -1,9 +1,10 @@
import { connect } from 'react-redux';
import { selectUnclaimedRewardValue } from 'lbryinc';
import { selectUnclaimedRewardValue, selectUser } from 'lbryinc';
import WalletRewardsDriver from './view';
const select = state => ({
unclaimedRewardAmount: selectUnclaimedRewardValue(state),
user: selectUser(state),
});
export default connect(select)(WalletRewardsDriver);
+21 -5
View File
@@ -5,15 +5,31 @@ import walletStyle from 'styles/wallet';
class WalletRewardsDriver extends React.PureComponent<Props> {
render() {
const { navigation, unclaimedRewardAmount } = this.props;
const { navigation, unclaimedRewardAmount, user } = this.props;
const signedIn = user && user.has_verified_email;
return (
<TouchableOpacity style={walletStyle.rewardDriverCard} onPress={() => navigation.navigate('Rewards')}>
<Icon name="award" size={16} style={walletStyle.rewardIcon} />
<Text style={walletStyle.rewardDriverText}>
Get {unclaimedRewardAmount > 0 ? unclaimedRewardAmount : ''} free credit
{unclaimedRewardAmount === 1 ? '' : 's'} after creating an account.
</Text>
{signedIn && (
<Text style={walletStyle.rewardDriverText}>
{unclaimedRewardAmount === 0 && __('Free credits available in rewards.')}
{unclaimedRewardAmount === 1 &&
__('%amount% free credit available in rewards.', { amount: unclaimedRewardAmount })}
{unclaimedRewardAmount > 1 &&
__('%amount% free credits available in rewards.', { amount: unclaimedRewardAmount })}{' '}
{__('Tap to learn more.')}
</Text>
)}
{!signedIn && (
<Text style={walletStyle.rewardDriverText}>
{unclaimedRewardAmount === 1 &&
__('Get %amount% free credit after creating an account.', { amount: unclaimedRewardAmount })}
{unclaimedRewardAmount !== 1 &&
__('Get %amount% free credits after creating an account.', { amount: unclaimedRewardAmount })}
</Text>
)}
</TouchableOpacity>
);
}
+21 -11
View File
@@ -1,9 +1,10 @@
// @flow
import React from 'react';
import { regexAddress } from 'lbry-redux';
import { formatCredits, regexAddress } from 'lbry-redux';
import { Alert, Clipboard, TextInput, Text, View } from 'react-native';
import Button from 'component/button';
import Colors from 'styles/colors';
import Icon from 'react-native-vector-icons/FontAwesome5';
import walletStyle from 'styles/wallet';
type DraftTransaction = {
@@ -24,6 +25,7 @@ class WalletSend extends React.PureComponent<Props> {
address: null,
addressChanged: false,
addressValid: false,
creditsInputFocused: false,
};
componentWillUpdate(nextProps) {
@@ -38,24 +40,24 @@ class WalletSend extends React.PureComponent<Props> {
const { address, amount } = this.state;
if (address && !regexAddress.test(address)) {
notify({
message: 'The recipient address is not a valid LBRY address.',
message: __('The recipient address is not a valid LBRY address.'),
});
return;
}
if (amount > balance) {
notify({
message: 'Insufficient credits',
message: __('Insufficient credits'),
});
return;
}
if (amount && address) {
// Show confirmation before send
Alert.alert('Send LBC', `Are you sure you want to send ${amount} LBC to ${address}?`, [
{ text: 'No' },
Alert.alert(__('Send LBC'), `Are you sure you want to send ${amount} LBC to ${address}?`, [
{ text: __('No') },
{
text: 'Yes',
text: __('Yes'),
onPress: () => {
sendToAddress(address, parseFloat(amount));
this.setState({ address: null, amount: null });
@@ -69,7 +71,7 @@ class WalletSend extends React.PureComponent<Props> {
if (this.state.addressChanged && !this.state.addressValid) {
const { notify } = this.props;
notify({
message: 'The recipient address is not a valid LBRY address.',
message: __('The recipient address is not a valid LBRY address.'),
});
}
};
@@ -87,8 +89,8 @@ class WalletSend extends React.PureComponent<Props> {
return (
<View style={walletStyle.card}>
<Text style={walletStyle.title}>Send Credits</Text>
<Text style={walletStyle.text}>Recipient address</Text>
<Text style={walletStyle.title}>{__('Send Credits')}</Text>
<Text style={walletStyle.text}>{__('Recipient address')}</Text>
<View style={[walletStyle.row, walletStyle.bottomMarginMedium]}>
<TextInput
onChangeText={value =>
@@ -112,12 +114,14 @@ class WalletSend extends React.PureComponent<Props> {
onPress={() => Clipboard.getString().then(value => this.setState({ address: value, addressChanged: true }))}
/>
</View>
<Text style={walletStyle.text}>Amount</Text>
<Text style={walletStyle.text}>{__('Amount')}</Text>
<View style={walletStyle.row}>
<View style={walletStyle.amountRow}>
<TextInput
ref={ref => (this.amountInput = ref)}
onChangeText={value => this.setState({ amount: value })}
onFocus={() => this.setState({ creditsInputFocused: true })}
onBlur={() => this.setState({ creditsInputFocused: false })}
keyboardType={'numeric'}
placeholder={'0'}
underlineColorAndroid={Colors.NextLbryGreen}
@@ -125,9 +129,15 @@ class WalletSend extends React.PureComponent<Props> {
style={[walletStyle.input, walletStyle.amountInput]}
/>
<Text style={[walletStyle.text, walletStyle.currency]}>LBC</Text>
<View style={walletStyle.balanceFocus}>
{this.state.creditsInputFocused && <Icon name="coins" size={12} />}
{this.state.creditsInputFocused && (
<Text style={walletStyle.balanceText}>{formatCredits(parseFloat(balance), 1, true)}</Text>
)}
</View>
</View>
<Button
text={'Send'}
text={__('Send')}
style={[walletStyle.button, walletStyle.sendButton]}
disabled={!canSend}
onPress={this.handleSend}
+15 -6
View File
@@ -16,7 +16,11 @@ class WalletSignIn extends React.Component {
onSignInPressed = () => {
const { navigation } = this.props;
navigation.navigate({ routeName: 'Verification', key: 'verification', params: { syncFlow: true } });
navigation.navigate({
routeName: 'Verification',
key: 'verification',
params: { syncFlow: true, signInFlow: true },
});
};
render() {
@@ -25,20 +29,25 @@ class WalletSignIn extends React.Component {
return (
<View style={walletStyle.signInContainer}>
<View style={walletStyle.signInSummaryRow}>
<Text style={walletStyle.signInTitle}>Account Recommended</Text>
<Text style={walletStyle.signInTitle}>{__('Account Recommended')}</Text>
</View>
<View style={walletStyle.onboarding}>
<Text style={walletStyle.onboardingText}>
An account with LBRY Inc. allows you to earn rewards, backup your wallet, and keep everything synced..
{__('A lbry.tv account allows you to earn rewards, backup your wallet, and keep everything in sync.')}
{'\n\n'}
Without an account, you assume all responsibility for securing your wallet and LBRY data.{'\n\n'}
{__('Without an account, you assume all responsibility for securing your wallet and LBRY data.')}
</Text>
</View>
<View style={walletStyle.buttonRow}>
<Link style={walletStyle.continueLink} text={'Skip Account'} onPress={this.onContinuePressed} />
<Button style={walletStyle.signInButton} theme={'light'} text={'Sign Up'} onPress={this.onSignInPressed} />
<Link style={walletStyle.continueLink} text={__('Skip Account')} onPress={this.onContinuePressed} />
<Button
style={walletStyle.signInButton}
theme={'light'}
text={__('Sign Up')}
onPress={this.onSignInPressed}
/>
</View>
</View>
);
+1 -1
View File
@@ -3,7 +3,7 @@ import { doSetClientSetting } from 'redux/actions/settings';
import { makeSelectClientSetting } from 'redux/selectors/settings';
import { doToast } from 'lbry-redux';
import { selectUserEmail } from 'lbryinc';
import Constants from 'constants';
import Constants from 'constants'; // eslint-disable-line node/no-deprecated-api
import WalletSyncDriver from './view';
const select = state => ({
+15 -15
View File
@@ -1,7 +1,7 @@
import React from 'react';
import { Alert, NativeModules, Switch, Text, View } from 'react-native';
import Button from 'component/button';
import Constants from 'constants';
import Constants from 'constants'; // eslint-disable-line node/no-deprecated-api
import Link from 'component/link';
import walletStyle from 'styles/wallet';
@@ -15,15 +15,15 @@ class WalletSyncDriver extends React.PureComponent<Props> {
// turning off
// set deviceWalletSynced to false (if confirmed)
Alert.alert(
'Disable wallet sync',
'Are you sure you want to turn off wallet sync?',
__('Disable wallet sync'),
__('Are you sure you want to turn off wallet sync?'),
[
{ text: 'No' },
{ text: __('No') },
{
text: 'Yes',
text: __('Yes'),
onPress: () => {
setClientSetting(Constants.SETTING_DEVICE_WALLET_SYNCED, false);
notify({ message: 'Wallet sync was successfully disabled.' });
notify({ message: __('Wallet sync was successfully disabled.') });
},
},
],
@@ -37,14 +37,14 @@ class WalletSyncDriver extends React.PureComponent<Props> {
return (
<View style={walletStyle.syncDriverCard}>
<Text style={walletStyle.syncDriverTitle}>Wallet Sync</Text>
<Text style={walletStyle.syncDriverTitle}>{__('Wallet Sync')}</Text>
<View style={walletStyle.switchRow}>
<View style={walletStyle.tableCol}>
<Text style={walletStyle.labelText}>Sync status</Text>
<Text style={walletStyle.labelText}>{__('Sync status')}</Text>
</View>
<View style={walletStyle.tableColRow}>
<Text selectable={true} style={walletStyle.valueText}>
{deviceWalletSynced ? 'On' : 'Off'}
<Text selectable style={walletStyle.valueText}>
{deviceWalletSynced ? __('On') : __('Off')}
</Text>
<Switch
style={walletStyle.syncSwitch}
@@ -56,11 +56,11 @@ class WalletSyncDriver extends React.PureComponent<Props> {
{deviceWalletSynced && (
<View style={walletStyle.tableRow}>
<View style={walletStyle.tableCol}>
<Text style={walletStyle.labelText}>Connected email</Text>
<Text style={walletStyle.labelText}>{__('Connected email')}</Text>
</View>
<View style={walletStyle.tableCol}>
<Text selectable={true} style={walletStyle.valueText}>
{userEmail ? userEmail : 'No connected email'}
<Text selectable style={walletStyle.valueText} numberOfLines={1}>
{userEmail || __('No connected email')}
</Text>
</View>
</View>
@@ -69,7 +69,7 @@ class WalletSyncDriver extends React.PureComponent<Props> {
<View style={walletStyle.linkRow}>
<View style={walletStyle.tableCol}>
<Link
text="Manual backup"
text={__('Manual backup')}
href="https://lbry.com/faq/how-to-backup-wallet#android"
style={walletStyle.syncDriverLink}
/>
@@ -77,7 +77,7 @@ class WalletSyncDriver extends React.PureComponent<Props> {
<View style={walletStyle.rightTableCol}>
{!deviceWalletSynced && (
<Link
text="Sync FAQ"
text={__('Sync FAQ')}
href="https://lbry.com/faq/how-to-backup-wallet#sync"
style={[walletStyle.syncDriverLink, walletStyle.rightLink]}
/>
+9 -2
View File
@@ -64,6 +64,8 @@ const Constants = {
ACTION_CLEAR_PUBLISH_FORM_STATE: 'CLEAR_PUBLISH_FORM_STATE',
ACTION_CLEAR_CHANNEL_FORM_STATE: 'CLEAR_CHANNEL_FORM_STATE',
ACTION_FULLSCREEN_MODE_TOGGLED: 'FULLSCREEN_MODE_TOGGLED',
ORIENTATION_HORIZONTAL: 'horizontal',
ORIENTATION_VERTICAL: 'vertical',
@@ -93,6 +95,7 @@ const Constants = {
FULL_ROUTE_NAME_WALLET: 'WalletStack',
ROUTE_FILE: 'File',
DRAWER_ROUTE_FILE_VIEW: 'FileView',
ITEM_CREATE_A_CHANNEL: 'Create a channel...',
ITEM_ANONYMOUS: 'Publish anonymously',
@@ -127,7 +130,7 @@ const Constants = {
{ name: TIME_ALL, label: 'All time' },
],
DEFAULT_ORDER_BY: ['trending_global', 'trending_mixed'],
DEFAULT_ORDER_BY: ['trending_group', 'trending_mixed'],
ORDER_BY_EFFECTIVE_AMOUNT: 'effective_amount',
@@ -165,4 +168,8 @@ export const DrawerRoutes = [
];
// sub-pages for main routes
export const InnerDrawerRoutes = [Constants.DRAWER_ROUTE_CHANNEL_CREATOR_FORM, Constants.DRAWER_ROUTE_PUBLISH_FORM];
export const InnerDrawerRoutes = [
Constants.DRAWER_ROUTE_CHANNEL_CREATOR_FORM,
Constants.DRAWER_ROUTE_PUBLISH_FORM,
Constants.DRAWER_ROUTE_FILE_VIEW,
];
+79
View File
@@ -0,0 +1,79 @@
import { NativeModules, Platform } from 'react-native';
import { SETTINGS } from 'lbry-redux';
import { doTransifexUpload } from 'lbryinc';
import AsyncStorage from '@react-native-community/async-storage';
import RNFS from 'react-native-fs';
const isProduction = !__DEV__; // eslint-disable-line no-undef
let knownMessages = null;
window.language = NativeModules.UtilityModule.language;
window.i18n_messages = window.i18n_messages || {};
function saveMessage(message) {
// file path that won't get wiped if app storage is cleared or the app is uninstalled
const messagesFilePath = RNFS.ExternalStorageDirectoryPath + '/lbry-app-strings.json';
if (knownMessages === null) {
RNFS.readFile(messagesFilePath, 'utf8')
.then(fileContents => {
knownMessages = JSON.parse(fileContents);
checkMessageAndSave(message, messagesFilePath);
})
.catch(err => {
knownMessages = {}; // no known messages, initialise the object
checkMessageAndSave(message, messagesFilePath);
});
} else {
checkMessageAndSave(message, messagesFilePath);
}
}
function checkMessageAndSave(message, messagesFilePath) {
if (!knownMessages[message]) {
knownMessages[message] = message;
const contents = JSON.stringify(knownMessages, null, 2);
RNFS.writeFile(messagesFilePath, contents, 'utf8')
.then(() => {
// successful write
// send to transifex (should we do this even if the file doesn't get saved?)
// TODO: load token from .env
/* doTransifexUpload(
contents,
'lbry-mobile',
'*token*',
() => {
// successful
},
err => {
// failed
}
); */
})
.catch(err => {
if (err) {
throw err;
}
});
}
}
export function __(message, tokens) {
const w = global.window ? global.window : window;
let language = w.language ? w.language : 'en';
if (!isProduction) {
saveMessage(message);
}
const translatedMessage = w.i18n_messages[language] ? w.i18n_messages[language][message] || message : message;
if (!tokens) {
return translatedMessage;
}
return translatedMessage.replace(/%([^%]+)%/g, function($1, $2) {
return tokens[$2] || $2;
});
}
+4 -3
View File
@@ -40,6 +40,7 @@ import AppWithNavigationState, {
reactNavigationMiddleware,
} from 'component/AppNavigator';
import { REHYDRATE, PURGE, persistCombineReducers, persistStore } from 'redux-persist';
import { __ } from 'i18n';
import Constants from 'constants'; // eslint-disable-line node/no-deprecated-api
import getStoredStateMigrateV4 from 'redux-persist/lib/integration/getStoredStateMigrateV4';
import FilesystemStorage from 'redux-persist-filesystem-storage';
@@ -51,8 +52,11 @@ import drawerReducer from 'redux/reducers/drawer';
import settingsReducer from 'redux/reducers/settings';
import thunk from 'redux-thunk';
window.__ = __;
const globalExceptionHandler = (error, isFatal) => {
if (error && NativeModules.Firebase) {
console.log(error);
NativeModules.Firebase.logException(isFatal, error.message ? error.message : 'No message', JSON.stringify(error));
}
};
@@ -201,9 +205,6 @@ const persistor = persistStore(store, persistOptions, err => {
});
window.persistor = persistor;
// TODO: Find i18n module that is compatible with react-native
global.__ = str => str;
class LBRYApp extends React.Component {
render() {
return (
+21 -21
View File
@@ -67,29 +67,29 @@ class AboutPage extends React.PureComponent {
render() {
const { accessToken, drawerStack, navigation, notify, popDrawerStack, userEmail } = this.props;
const loading = 'Loading...';
const loading = __('Loading...');
const ver = this.state.versionInfo ? this.state.versionInfo : null;
return (
<View style={aboutStyle.container}>
<PageHeader title={'About LBRY'} onBackPressed={() => navigateBack(navigation, drawerStack, popDrawerStack)} />
<ScrollView style={aboutStyle.scrollContainer}>
<Text style={aboutStyle.title}>Content Freedom</Text>
<Text style={aboutStyle.title}>{__('Content Freedom')}</Text>
<Text style={aboutStyle.paragraph}>
LBRY is a free, open, and community-run digital marketplace. It is a decentralized peer-to-peer content
distribution platform for creators to upload and share content, and earn LBRY credits for their effort.
Users will be able to find a wide selection of videos, music, ebooks and other digital content they are
interested in.
{__(
'LBRY is a free, open, and community-run digital marketplace. It is a decentralized peer-to-peer content distribution platform for creators to upload and share content, and earn LBRY credits for their effort. Users will be able to find a wide selection of videos, music, ebooks and other digital content they are interested in.'
)}
</Text>
<View style={aboutStyle.links}>
<Link style={aboutStyle.link} href="https://lbry.com/faq/what-is-lbry" text="What is LBRY?" />
<Link style={aboutStyle.link} href="https://lbry.com/faq/android-basics" text="Android App Basics" />
<Link style={aboutStyle.link} href="https://lbry.com/faq" text="Frequently Asked Questions" />
<Link style={aboutStyle.link} href="https://lbry.com/faq/what-is-lbry" text={__('What is LBRY?')} />
<Link style={aboutStyle.link} href="https://lbry.com/faq/android-basics" text={__('Android App Basics')} />
<Link style={aboutStyle.link} href="https://lbry.com/faq" text={__('Frequently Asked Questions')} />
</View>
<Text style={aboutStyle.socialTitle}>Get Social</Text>
<Text style={aboutStyle.socialTitle}>{__('Get Social')}</Text>
<Text style={aboutStyle.paragraph}>
You can interact with the LBRY team and members of the community on Discord, Facebook, Instagram, Twitter or
Reddit.
{__(
'You can interact with the LBRY team and members of the community on Discord, Facebook, Instagram, Twitter or Reddit.'
)}
</Text>
<View style={aboutStyle.links}>
<Link style={aboutStyle.link} href="https://discordapp.com/invite/Z3bERWA" text="Discord" />
@@ -99,12 +99,12 @@ class AboutPage extends React.PureComponent {
<Link style={aboutStyle.link} href="https://reddit.com/r/lbry" text="Reddit" />
<Link style={aboutStyle.link} href="https://t.me/lbryofficial" text="Telegram" />
</View>
<Text style={aboutStyle.releaseInfoTitle}>App info</Text>
<Text style={aboutStyle.releaseInfoTitle}>{__('App info')}</Text>
{userEmail && userEmail.trim().length > 0 && (
<View style={aboutStyle.verticalRow}>
<View style={aboutStyle.innerRow}>
<View style={aboutStyle.col}>
<Text style={aboutStyle.text}>Connected email</Text>
<Text style={aboutStyle.text}>{__('Connected email')}</Text>
</View>
<View style={aboutStyle.col}>
<Text selectable style={aboutStyle.valueText}>
@@ -116,7 +116,7 @@ class AboutPage extends React.PureComponent {
<Link
style={aboutStyle.listLink}
href={`http://lbry.com/list/edit/${accessToken}`}
text="Update mailing preferences"
text={__('Update mailing preferences')}
/>
</View>
</View>
@@ -124,7 +124,7 @@ class AboutPage extends React.PureComponent {
<View style={aboutStyle.row}>
<View style={aboutStyle.col}>
<Text style={aboutStyle.text}>App version</Text>
<Text style={aboutStyle.text}>{__('App version')}</Text>
</View>
<View style={aboutStyle.col}>
<Text selectable style={aboutStyle.valueText}>
@@ -135,7 +135,7 @@ class AboutPage extends React.PureComponent {
<View style={aboutStyle.row}>
<View style={aboutStyle.col}>
<Text style={aboutStyle.text}>LBRY SDK</Text>
<Text style={aboutStyle.text}>{__('LBRY SDK')}</Text>
</View>
<View style={aboutStyle.col}>
<Text selectable style={aboutStyle.valueText}>
@@ -146,7 +146,7 @@ class AboutPage extends React.PureComponent {
<View style={aboutStyle.row}>
<View style={aboutStyle.col}>
<Text style={aboutStyle.text}>Platform</Text>
<Text style={aboutStyle.text}>{__('Platform')}</Text>
</View>
<View style={aboutStyle.col}>
<Text selectable style={aboutStyle.valueText}>
@@ -157,7 +157,7 @@ class AboutPage extends React.PureComponent {
<View style={aboutStyle.row}>
<View style={aboutStyle.col}>
<Text style={aboutStyle.text}>Installation ID</Text>
<Text style={aboutStyle.text}>{__('Installation ID')}</Text>
<Text selectable style={aboutStyle.lineValueText}>
{this.state.lbryId ? this.state.lbryId : loading}
</Text>
@@ -166,12 +166,12 @@ class AboutPage extends React.PureComponent {
<View style={aboutStyle.row}>
<View style={aboutStyle.col}>
<Text style={aboutStyle.text}>Logs</Text>
<Text style={aboutStyle.text}>{__('Logs')}</Text>
</View>
<View style={aboutStyle.col}>
<Link
style={aboutStyle.listLink}
text="Send log"
text={__('Send log')}
onPress={() => {
if (NativeModules.UtilityModule) {
NativeModules.UtilityModule.shareLogFile(error => {
+21 -20
View File
@@ -36,8 +36,9 @@ class ChannelPage extends React.PureComponent {
autoStyle: null,
showSortPicker: false,
showTimePicker: false,
orderBy: Constants.DEFAULT_ORDER_BY,
orderBy: ['release_time'], // sort by new by default
activeTab: Constants.CONTENT_TAB,
currentSortByItem: Constants.CLAIM_SEARCH_SORT_BY_ITEMS[1], // should always default to sorting channel pages by new
};
componentWillMount() {
@@ -54,9 +55,8 @@ class ChannelPage extends React.PureComponent {
}
handleSortByItemSelected = item => {
const { setSortByItem } = this.props;
setSortByItem(item);
this.setState({ orderBy: getOrderBy(item), showSortPicker: false });
// sort by specific only to this component state
this.setState({ currentSortByItem: item, orderBy: getOrderBy(item), showSortPicker: false });
};
handleTimeItemSelected = item => {
@@ -66,19 +66,20 @@ class ChannelPage extends React.PureComponent {
};
listHeader = () => {
const { sortByItem, timeItem } = this.props;
const { timeItem } = this.props;
const { currentSortByItem } = this.state;
return (
<View style={channelPageStyle.listHeader}>
<View style={discoverStyle.pickerRow}>
<View style={discoverStyle.leftPickerRow}>
<TouchableOpacity style={discoverStyle.tagSortBy} onPress={() => this.setState({ showSortPicker: true })}>
<Text style={discoverStyle.tagSortText}>{sortByItem.label.split(' ')[0]}</Text>
<Text style={discoverStyle.tagSortText}>{__(currentSortByItem.label.split(' ')[0])}</Text>
<Icon style={discoverStyle.tagSortIcon} name={'sort-down'} size={14} />
</TouchableOpacity>
{Constants.SORT_BY_TOP === sortByItem.name && (
{Constants.SORT_BY_TOP === currentSortByItem.name && (
<TouchableOpacity style={discoverStyle.tagTime} onPress={() => this.setState({ showTimePicker: true })}>
<Text style={discoverStyle.tagSortText}>{timeItem.label}</Text>
<Text style={discoverStyle.tagSortText}>{__(timeItem.label)}</Text>
<Icon style={discoverStyle.tagSortIcon} name={'sort-down'} size={14} />
</TouchableOpacity>
)}
@@ -121,7 +122,7 @@ class ChannelPage extends React.PureComponent {
return (
<View style={channelPageStyle.aboutTab}>
<View style={channelPageStyle.busyContainer}>
<Text style={channelPageStyle.infoText}>No information to display.</Text>
<Text style={channelPageStyle.infoText}>{__('No information to display.')}</Text>
</View>
</View>
);
@@ -131,21 +132,21 @@ class ChannelPage extends React.PureComponent {
return (
<View style={channelPageStyle.aboutTab}>
{!websiteUrl && !email && !description && (
<EmptyStateView message={"There's nothing here yet.\nPlease check back later."} />
<EmptyStateView message={__("There's nothing here yet.\nPlease check back later.")} />
)}
{(websiteUrl || email || description) && (
<ScrollView style={channelPageStyle.aboutScroll} contentContainerStyle={channelPageStyle.aboutScrollContent}>
{websiteUrl && websiteUrl.trim().length > 0 && (
<View style={channelPageStyle.aboutItem}>
<Text style={channelPageStyle.aboutTitle}>Website</Text>
<Text style={channelPageStyle.aboutTitle}>{__('Website')}</Text>
<Link style={channelPageStyle.aboutText} text={websiteUrl} href={websiteUrl} />
</View>
)}
{email && email.trim().length > 0 && (
<View style={channelPageStyle.aboutItem}>
<Text style={channelPageStyle.aboutTitle}>Email</Text>
<Text style={channelPageStyle.aboutTitle}>{__('Email')}</Text>
<Link style={channelPageStyle.aboutText} text={email} href={`mailto:${email}`} />
</View>
)}
@@ -206,9 +207,9 @@ class ChannelPage extends React.PureComponent {
};
render() {
const { channels, claim, navigation, uri, drawerStack, popDrawerStack, sortByItem, timeItem } = this.props;
const { channels, claim, navigation, uri, drawerStack, popDrawerStack, timeItem } = this.props;
const { name, permanent_url: permanentUrl } = claim;
const { autoStyle, showSortPicker, showTimePicker } = this.state;
const { autoStyle, currentSortByItem, showSortPicker, showTimePicker } = this.state;
const ownedChannel = channels ? channels.map(channel => channel.permanent_url).includes(permanentUrl) : false;
let thumbnailUrl,
@@ -270,7 +271,7 @@ class ChannelPage extends React.PureComponent {
style={channelPageStyle.actionButton}
theme={'light'}
icon={'edit'}
text={'Edit'}
text={__('Edit')}
onPress={this.onEditPressed}
/>
)}
@@ -279,7 +280,7 @@ class ChannelPage extends React.PureComponent {
style={[channelPageStyle.actionButton, channelPageStyle.deleteButton]}
theme={'light'}
icon={'trash-alt'}
text={'Delete'}
text={__('Delete')}
onPress={this.onDeletePressed}
/>
)}
@@ -290,7 +291,7 @@ class ChannelPage extends React.PureComponent {
onPress={this.onSharePressed}
/>
{!ownedChannel && <SubscribeButton style={channelPageStyle.subscribeButton} uri={fullUri} name={name} />}
{!ownedChannel && (
{false && !ownedChannel && (
<SubscribeNotificationButton
style={[channelPageStyle.subscribeButton, channelPageStyle.bellButton]}
uri={fullUri}
@@ -305,14 +306,14 @@ class ChannelPage extends React.PureComponent {
style={channelPageStyle.tab}
onPress={() => this.setState({ activeTab: Constants.CONTENT_TAB })}
>
<Text style={channelPageStyle.tabTitle}>CONTENT</Text>
<Text style={channelPageStyle.tabTitle}>{__('CONTENT')}</Text>
{Constants.CONTENT_TAB === this.state.activeTab && <View style={channelPageStyle.activeTabHint} />}
</TouchableOpacity>
<TouchableOpacity
style={channelPageStyle.tab}
onPress={() => this.setState({ activeTab: Constants.ABOUT_TAB })}
>
<Text style={channelPageStyle.tabTitle}>ABOUT</Text>
<Text style={channelPageStyle.tabTitle}>{__('ABOUT')}</Text>
{Constants.ABOUT_TAB === this.state.activeTab && <View style={channelPageStyle.activeTabHint} />}
</TouchableOpacity>
</View>
@@ -326,7 +327,7 @@ class ChannelPage extends React.PureComponent {
title={__('Sort content by')}
onOverlayPress={() => this.setState({ showSortPicker: false })}
onItemSelected={this.handleSortByItemSelected}
selectedItem={sortByItem}
selectedItem={currentSortByItem}
items={Constants.CLAIM_SEARCH_SORT_BY_ITEMS}
/>
)}
+33 -22
View File
@@ -1,5 +1,5 @@
import React from 'react';
import { CLAIM_VALUES, isNameValid, regexInvalidURI } from 'lbry-redux';
import { CLAIM_VALUES, formatCredits, isNameValid, regexInvalidURI } from 'lbry-redux';
import {
ActivityIndicator,
Alert,
@@ -38,6 +38,7 @@ export default class ChannelCreator extends React.PureComponent {
autoStyle: null,
canSave: true,
claimId: null,
creditsInputFocused: false,
currentSelectedValue: Constants.ITEM_ANONYMOUS,
currentPhase: null,
displayName: null,
@@ -793,8 +794,8 @@ export default class ChannelCreator extends React.PureComponent {
{currentPhase === Constants.PHASE_LIST && !fetchingChannels && !hasChannels && (
<EmptyStateView
message={'You have not created a channel.\nStart now by creating a new channel!'}
buttonText={'Create a channel'}
message={__('You have not created a channel.\nStart now by creating a new channel!')}
buttonText={__('Create a channel')}
onButtonPress={this.handleNewChannelPress}
/>
)}
@@ -807,7 +808,7 @@ export default class ChannelCreator extends React.PureComponent {
<View style={channelCreatorStyle.listFooter}>
<Button
style={channelCreatorStyle.createChannelButton}
text={'Create a channel'}
text={__('Create a channel')}
onPress={this.handleNewChannelPress}
/>
</View>
@@ -879,7 +880,7 @@ export default class ChannelCreator extends React.PureComponent {
{this.state.uploadingImage && (
<View style={channelCreatorStyle.uploadProgress}>
<ActivityIndicator size={'small'} color={Colors.NextLbryGreen} />
<Text style={channelCreatorStyle.uploadText}>Uploading image...</Text>
<Text style={channelCreatorStyle.uploadText}>{__('Uploading image...')}</Text>
</View>
)}
</TouchableOpacity>
@@ -911,14 +912,14 @@ export default class ChannelCreator extends React.PureComponent {
<View style={channelCreatorStyle.textInputLayout}>
{(this.state.titleFocused ||
(this.state.newChannelTitle != null && this.state.newChannelTitle.trim().length > 0)) && (
<Text style={channelCreatorStyle.textInputTitle}>Title</Text>
<Text style={channelCreatorStyle.textInputTitle}>{__('Title')}</Text>
)}
<TextInput
editable={canSave && !creatingChannel && !updatingChannel}
style={channelCreatorStyle.inputText}
value={this.state.newChannelTitle}
onChangeText={this.handleNewChannelTitleChange}
placeholder={this.state.titleFocused ? '' : 'Title'}
placeholder={this.state.titleFocused ? '' : __('Title')}
underlineColorAndroid={Colors.NextLbryGreen}
onFocus={() => this.setState({ titleFocused: true })}
onBlur={() => this.setState({ titleFocused: false })}
@@ -928,7 +929,7 @@ export default class ChannelCreator extends React.PureComponent {
<View style={channelCreatorStyle.channelInputLayout}>
{(this.state.channelNameFocused ||
(this.state.newChannelName != null && this.state.newChannelName.trim().length > 0)) && (
<Text style={channelCreatorStyle.textInputTitle}>Channel</Text>
<Text style={channelCreatorStyle.textInputTitle}>{__('Channel')}</Text>
)}
<View>
<Text style={channelCreatorStyle.channelAt}>@</Text>
@@ -937,7 +938,7 @@ export default class ChannelCreator extends React.PureComponent {
style={channelCreatorStyle.channelNameInput}
value={this.state.newChannelName}
onChangeText={value => this.handleNewChannelNameChange(value, true)}
placeholder={this.state.channelNameFocused ? '' : 'Channel'}
placeholder={this.state.channelNameFocused ? '' : __('Channel')}
underlineColorAndroid={Colors.NextLbryGreen}
onFocus={() => this.setState({ channelNameFocused: true })}
onBlur={() => this.setState({ channelNameFocused: false })}
@@ -948,24 +949,34 @@ export default class ChannelCreator extends React.PureComponent {
<Text style={channelCreatorStyle.inlineError}>{newChannelNameError}</Text>
)}
{editMode && (
<Text style={channelCreatorStyle.helpText}>The channel name cannot be changed while editing.</Text>
<Text style={channelCreatorStyle.helpText}>
{__('The channel name cannot be changed while editing.')}
</Text>
)}
<View style={channelCreatorStyle.bidRow}>
<Text style={channelCreatorStyle.label}>Deposit</Text>
<Text style={channelCreatorStyle.label}>{__('Deposit')}</Text>
<TextInput
editable={canSave && !creatingChannel && !updatingChannel}
style={channelCreatorStyle.bidAmountInput}
value={String(newChannelBid)}
onChangeText={this.handleNewChannelBidChange}
onFocus={() => this.setState({ creditsInputFocused: true })}
onBlur={() => this.setState({ creditsInputFocused: false })}
placeholder={'0.00'}
keyboardType={'number-pad'}
underlineColorAndroid={Colors.NextLbryGreen}
/>
<Text style={channelCreatorStyle.currency}>LBC</Text>
<View style={channelCreatorStyle.balance}>
{this.state.creditsInputFocused && <Icon name="coins" size={12} />}
{this.state.creditsInputFocused && (
<Text style={channelCreatorStyle.balanceText}>{formatCredits(parseFloat(balance), 1, true)}</Text>
)}
</View>
</View>
<Text style={channelCreatorStyle.helpText}>
This LBC remains yours. It is a deposit to reserve the name and can be undone at any time.
{__('This LBC remains yours. It is a deposit to reserve the name and can be undone at any time.')}
</Text>
</View>
@@ -974,7 +985,7 @@ export default class ChannelCreator extends React.PureComponent {
<View style={channelCreatorStyle.textInputLayout}>
{(this.state.descriptionFocused ||
(this.state.description != null && this.state.description.trim().length > 0)) && (
<Text style={channelCreatorStyle.textInputTitle}>Description</Text>
<Text style={channelCreatorStyle.textInputTitle}>{__('Description')}</Text>
)}
<TextInput
editable={canSave && !creatingChannel && !updatingChannel}
@@ -982,7 +993,7 @@ export default class ChannelCreator extends React.PureComponent {
multiline
value={this.state.description}
onChangeText={this.handleDescriptionChange}
placeholder={this.state.descriptionFocused ? '' : 'Description'}
placeholder={this.state.descriptionFocused ? '' : __('Description')}
underlineColorAndroid={Colors.NextLbryGreen}
onFocus={() => this.setState({ descriptionFocused: true })}
onBlur={() => this.setState({ descriptionFocused: false })}
@@ -992,14 +1003,14 @@ export default class ChannelCreator extends React.PureComponent {
<View style={channelCreatorStyle.textInputLayout}>
{(this.state.websiteFocused ||
(this.state.website != null && this.state.website.trim().length > 0)) && (
<Text style={channelCreatorStyle.textInputTitle}>Website</Text>
<Text style={channelCreatorStyle.textInputTitle}>{__('Website')}</Text>
)}
<TextInput
editable={canSave && !creatingChannel && !updatingChannel}
style={channelCreatorStyle.inputText}
value={this.state.website}
onChangeText={this.handleWebsiteChange}
placeholder={this.state.websiteFocused ? '' : 'Website'}
placeholder={this.state.websiteFocused ? '' : __('Website')}
underlineColorAndroid={Colors.NextLbryGreen}
onFocus={() => this.setState({ websiteFocused: true })}
onBlur={() => this.setState({ websiteFocused: false })}
@@ -1008,14 +1019,14 @@ export default class ChannelCreator extends React.PureComponent {
<View style={channelCreatorStyle.textInputLayout}>
{(this.state.emailFocused || (this.state.email != null && this.state.email.trim().length > 0)) && (
<Text style={channelCreatorStyle.textInputTitle}>Email</Text>
<Text style={channelCreatorStyle.textInputTitle}>{__('Email')}</Text>
)}
<TextInput
editable={canSave && !creatingChannel && !updatingChannel}
style={channelCreatorStyle.inputText}
value={this.state.email}
onChangeText={this.handleEmailChange}
placeholder={this.state.emailFocused ? '' : 'Email'}
placeholder={this.state.emailFocused ? '' : __('Email')}
underlineColorAndroid={Colors.NextLbryGreen}
onFocus={() => this.setState({ emailFocused: true })}
onBlur={() => this.setState({ emailFocused: false })}
@@ -1026,7 +1037,7 @@ export default class ChannelCreator extends React.PureComponent {
{this.state.showOptionalFields && (
<View style={channelCreatorStyle.card}>
<Text style={channelCreatorStyle.cardTitle}>Tags</Text>
<Text style={channelCreatorStyle.cardTitle}>{__('Tags')}</Text>
<View style={channelCreatorStyle.tagList}>
{this.state.tags &&
this.state.tags.map(tag => (
@@ -1050,7 +1061,7 @@ export default class ChannelCreator extends React.PureComponent {
<View style={channelCreatorStyle.toggleContainer}>
<Link
text={this.state.showOptionalFields ? 'Hide optional fields' : 'Show optional fields'}
text={this.state.showOptionalFields ? __('Hide optional fields') : __('Show optional fields')}
onPress={this.handleModePressed}
style={channelCreatorStyle.modeLink}
/>
@@ -1062,11 +1073,11 @@ export default class ChannelCreator extends React.PureComponent {
)}
{!creatingChannel && !updatingChannel && (
<View style={channelCreatorStyle.buttons}>
<Link style={channelCreatorStyle.cancelLink} text="Cancel" onPress={this.handleCreateCancel} />
<Link style={channelCreatorStyle.cancelLink} text={__('Cancel')} onPress={this.handleCreateCancel} />
<Button
style={channelCreatorStyle.createButton}
disabled={!canSave || uploadingImage}
text={editMode ? 'Update' : 'Create'}
text={editMode ? __('Update') : __('Create')}
onPress={this.handleCreateChannelClick}
/>
</View>
+17 -58
View File
@@ -11,10 +11,9 @@ import {
View,
} from 'react-native';
import { DEFAULT_FOLLOWED_TAGS, Lbry, normalizeURI, parseURI } from 'lbry-redux';
import { __, formatTagTitle, getOrderBy } from 'utils/helper';
import { formatTagTitle, getOrderBy } from 'utils/helper';
import AsyncStorage from '@react-native-community/async-storage';
import moment from 'moment';
import CategoryList from 'component/categoryList';
import ClaimList from 'component/claimList';
import Constants from 'constants'; // eslint-disable-line node/no-deprecated-api
import Colors from 'styles/colors';
@@ -87,11 +86,9 @@ class DiscoverPage extends React.PureComponent {
}
onComponentFocused = () => {
const { fetchSubscriptions, pushDrawerStack } = this.props;
const { pushDrawerStack } = this.props;
// pushDrawerStack();
NativeModules.Firebase.setCurrentScreen('Your tags').then(result => {
fetchSubscriptions();
});
NativeModules.Firebase.setCurrentScreen('Your tags');
};
handleSortByItemSelected = item => {
@@ -124,46 +121,6 @@ class DiscoverPage extends React.PureComponent {
return null;
};
componentDidUpdate(prevProps, prevState) {
const { unreadSubscriptions, enabledChannelNotifications } = this.props;
const utility = NativeModules.UtilityModule;
const hasUnread =
prevProps.unreadSubscriptions &&
prevProps.unreadSubscriptions.length !== unreadSubscriptions.length &&
unreadSubscriptions.length > 0;
if (hasUnread) {
unreadSubscriptions.map(({ channel, uris }) => {
const { claimName: channelName } = parseURI(channel);
// check if notifications are enabled for the channel
if (enabledChannelNotifications.includes(channelName)) {
uris.forEach(uri => {
Lbry.resolve({ urls: uri }).then(result => {
const sub = result[uri];
if (sub && sub.value) {
const { source, title, thumbnail } = sub.value;
const isPlayable =
source && source.media_type && ['audio', 'video'].includes(source.media_type.substring(0, 5));
if (title) {
utility.showNotificationForContent(
uri,
title,
channelName,
thumbnail ? thumbnail.url : null,
isPlayable
);
}
}
});
});
}
});
}
}
showRatingReminder = () => {
const { ratingReminderDisabled, ratingReminderLastShown, setClientSetting } = this.props;
@@ -176,16 +133,18 @@ class DiscoverPage extends React.PureComponent {
if (!isNaN(lastShownTime) && !isNaN(lastShownCount)) {
if (now > lastShownTime + Constants.RATING_REMINDER_INTERVAL * lastShownCount) {
Alert.alert(
'Enjoying LBRY?',
'Are you enjoying your experience with the LBRY app? You can leave a review for us on the Play Store.',
__('Enjoying LBRY?'),
__(
'Are you enjoying your experience with the LBRY app? You can leave a review for us on the Play Store.'
),
[
{
text: 'Never ask again',
text: __('Never ask again'),
onPress: () => setClientSetting(Constants.SETTING_RATING_REMINDER_DISABLED, 'true'),
},
{ text: 'Maybe later', onPress: () => this.updateRatingReminderShown(lastShownCount) },
{ text: __('Maybe later'), onPress: () => this.updateRatingReminderShown(lastShownCount) },
{
text: 'Rate app',
text: __('Rate app'),
onPress: () => {
setClientSetting(Constants.SETTING_RATING_REMINDER_DISABLED, 'true');
Linking.openURL(Constants.PLAY_STORE_URL);
@@ -212,7 +171,7 @@ class DiscoverPage extends React.PureComponent {
buildSections = () => {
return this.state.tagCollection.map(tags => ({
title: tags.length === 1 ? tags[0] : 'All tags you follow',
title: tags.length === 1 ? tags[0] : __('All tags you follow'),
data: [tags],
}));
};
@@ -236,7 +195,7 @@ class DiscoverPage extends React.PureComponent {
handleTagPress = name => {
const { navigation, sortByItem } = this.props;
if (name.toLowerCase() !== 'all tags you follow') {
if (name.toLowerCase() !== __('all tags you follow')) {
navigation.navigate({
routeName: Constants.DRAWER_ROUTE_TAG,
key: `tagPage`,
@@ -255,18 +214,18 @@ class DiscoverPage extends React.PureComponent {
return (
<View style={discoverStyle.listHeader}>
<View style={discoverStyle.titleRow}>
<Text style={discoverStyle.pageTitle}>Your tags</Text>
<Text style={discoverStyle.pageTitle}>{__('Your Tags')}</Text>
</View>
<View style={discoverStyle.pickerRow}>
<View style={discoverStyle.leftPickerRow}>
<TouchableOpacity style={discoverStyle.tagSortBy} onPress={() => this.setState({ showSortPicker: true })}>
<Text style={discoverStyle.tagSortText}>{sortByItem.label.split(' ')[0]}</Text>
<Text style={discoverStyle.tagSortText}>{__(sortByItem.label.split(' ')[0])}</Text>
<Icon style={discoverStyle.tagSortIcon} name={'sort-down'} size={14} />
</TouchableOpacity>
{Constants.SORT_BY_TOP === sortByItem.name && (
<TouchableOpacity style={discoverStyle.tagTime} onPress={() => this.setState({ showTimePicker: true })}>
<Text style={discoverStyle.tagSortText}>{timeItem.label}</Text>
<Text style={discoverStyle.tagSortText}>{__(timeItem.label)}</Text>
<Icon style={discoverStyle.tagSortIcon} name={'sort-down'} size={14} />
</TouchableOpacity>
)}
@@ -274,7 +233,7 @@ class DiscoverPage extends React.PureComponent {
<Link
style={discoverStyle.customizeLink}
text={'Customize'}
text={__('Customize')}
onPress={() => this.setState({ showModalTagSelector: true })}
/>
</View>
@@ -290,7 +249,7 @@ class DiscoverPage extends React.PureComponent {
return (
<View style={discoverStyle.footer}>
<Text style={discoverStyle.footerTitle}>More tags you follow</Text>
<Text style={discoverStyle.footerTitle}>{__('More tags you follow')}</Text>
<View style={discoverStyle.footerTags}>
{remainingTags.map(tag => (
<Text
+2 -2
View File
@@ -11,7 +11,7 @@ import {
View,
ScrollView,
} from 'react-native';
import { __, navigateToUri, uriFromFileInfo } from 'utils/helper';
import { navigateToUri, uriFromFileInfo } from 'utils/helper';
import Colors from 'styles/colors';
import Constants from 'constants'; // eslint-disable-line node/no-deprecated-api
import PageHeader from 'component/pageHeader';
@@ -156,7 +156,7 @@ class DownloadsPage extends React.PureComponent {
/>
{!fetching && !hasDownloads && (
<EmptyStateView message={'You do not have any\ndownloaded content on this device.'} />
<EmptyStateView message={__('You do not have any\ndownloaded content on this device.')} />
)}
<View style={downloadsStyle.subContainer}>
+24 -15
View File
@@ -8,6 +8,7 @@ import {
doPurchaseUri,
doDeletePurchasedUri,
doResolveUri,
doSearch,
doSendTip,
doToast,
makeSelectIsUriResolving,
@@ -17,6 +18,7 @@ import {
makeSelectContentPositionForUri,
makeSelectContentTypeForUri,
makeSelectMetadataForUri,
makeSelectRecommendedContentForUri,
makeSelectStreamingUrlForUri,
makeSelectThumbnailForUri,
makeSelectTitleForUri,
@@ -26,6 +28,7 @@ import {
selectPurchasedUris,
selectFailedPurchaseUris,
selectPurchaseUriErrorMessage,
selectIsSearching,
} from 'lbry-redux';
import {
doClaimEligiblePurchaseRewards,
@@ -41,35 +44,38 @@ import {
doDeleteFile,
doStopDownloadingFile,
} from 'redux/actions/file';
import { doPopDrawerStack, doSetPlayerVisible } from 'redux/actions/drawer';
import { doPushDrawerStack, doPopDrawerStack, doSetPlayerVisible } from 'redux/actions/drawer';
import { doToggleFullscreenMode } from 'redux/actions/settings';
import { selectDrawerStack } from 'redux/selectors/drawer';
import FilePage from './view';
const select = (state, props) => {
const selectProps = { uri: props.navigation.state.params.uri };
const { uri, fullUri } = props.navigation.state.params;
const contentUri = fullUri || uri;
const selectProps = { uri: contentUri };
return {
balance: selectBalance(state),
blackListedOutpoints: selectBlackListedOutpoints(state),
channels: selectMyChannelClaims(state),
claim: makeSelectClaimForUri(selectProps.uri)(state),
claim: makeSelectClaimForUri(contentUri)(state),
drawerStack: selectDrawerStack(state),
isResolvingUri: makeSelectIsUriResolving(selectProps.uri)(state),
contentType: makeSelectContentTypeForUri(selectProps.uri)(state),
costInfo: makeSelectCostInfoForUri(selectProps.uri)(state),
metadata: makeSelectMetadataForUri(selectProps.uri)(state),
// obscureNsfw: !selectShowNsfw(state),
// tab: makeSelectCurrentParam('tab')(state),
fileInfo: makeSelectFileInfoForUri(selectProps.uri)(state),
isResolvingUri: makeSelectIsUriResolving(contentUri)(state),
contentType: makeSelectContentTypeForUri(contentUri)(state),
costInfo: makeSelectCostInfoForUri(contentUri)(state),
metadata: makeSelectMetadataForUri(contentUri)(state),
fileInfo: makeSelectFileInfoForUri(contentUri)(state),
rewardedContentClaimIds: selectRewardContentClaimIds(state, selectProps),
channelUri: makeSelectChannelForClaimUri(selectProps.uri, true)(state),
position: makeSelectContentPositionForUri(selectProps.uri)(state),
channelUri: makeSelectChannelForClaimUri(contentUri, true)(state),
position: makeSelectContentPositionForUri(contentUri)(state),
purchasedUris: selectPurchasedUris(state),
failedPurchaseUris: selectFailedPurchaseUris(state),
myClaimUris: selectMyClaimUrisWithoutChannels(state),
purchaseUriErrorMessage: selectPurchaseUriErrorMessage(state),
streamingUrl: makeSelectStreamingUrlForUri(selectProps.uri)(state),
thumbnail: makeSelectThumbnailForUri(selectProps.uri)(state),
title: makeSelectTitleForUri(selectProps.uri)(state),
streamingUrl: makeSelectStreamingUrlForUri(contentUri)(state),
thumbnail: makeSelectThumbnailForUri(contentUri)(state),
title: makeSelectTitleForUri(contentUri)(state),
recommendedContent: makeSelectRecommendedContentForUri(contentUri)(state),
isSearchingRecommendContent: selectIsSearching(state),
};
};
@@ -86,9 +92,11 @@ const perform = dispatch => ({
fileGet: (uri, saveFile) => dispatch(doFileGet(uri, saveFile)),
notify: data => dispatch(doToast(data)),
popDrawerStack: () => dispatch(doPopDrawerStack()),
pushDrawerStack: (routeName, params) => dispatch(doPushDrawerStack(routeName, params)),
purchaseUri: (uri, costInfo, saveFile) => dispatch(doPurchaseUri(uri, costInfo, saveFile)),
deletePurchasedUri: uri => dispatch(doDeletePurchasedUri(uri)),
resolveUri: uri => dispatch(doResolveUri(uri)),
searchRecommended: query => dispatch(doSearch(query, 20, undefined, true)),
sendTip: (amount, claimId, isSupport, successCallback, errorCallback) =>
dispatch(doSendTip(amount, claimId, isSupport, successCallback, errorCallback)),
setPlayerVisible: () => dispatch(doSetPlayerVisible(true)),
@@ -96,6 +104,7 @@ const perform = dispatch => ({
startDownload: (uri, outpoint, fileInfo) => dispatch(doStartDownload(uri, outpoint, fileInfo)),
updateDownload: (uri, outpoint, fileInfo, progress) => dispatch(doUpdateDownload(uri, outpoint, fileInfo, progress)),
completeDownload: (uri, outpoint, fileInfo) => dispatch(doCompleteDownload(uri, outpoint, fileInfo)),
toggleFullscreenMode: mode => dispatch(doToggleFullscreenMode(mode)),
});
export default connect(
+252 -125
View File
@@ -1,5 +1,5 @@
import React from 'react';
import { Lbry, normalizeURI, parseURI } from 'lbry-redux';
import { Lbry, formatCredits, normalizeURI, parseURI } from 'lbry-redux';
import { Lbryio } from 'lbryinc';
import {
ActivityIndicator,
@@ -44,6 +44,7 @@ import Video from 'react-native-video';
import FileRewardsDriver from 'component/fileRewardsDriver';
import filePageStyle from 'styles/filePage';
import uriBarStyle from 'styles/uriBar';
import _ from 'lodash';
class FilePage extends React.PureComponent {
static navigationOptions = {
@@ -61,8 +62,11 @@ class FilePage extends React.PureComponent {
constructor(props) {
super(props);
this.state = {
autoPlayMedia: false,
attemptAutoGet: false,
autoOpened: false,
autoDownloadStarted: false,
autoPlayMedia: false,
creditsInputFocused: false,
downloadButtonShown: false,
downloadPressed: false,
fileViewLogged: false,
@@ -85,6 +89,7 @@ class FilePage extends React.PureComponent {
uriVars: null,
stopDownloadConfirmed: false,
streamingMode: false,
didSearchRecommended: false,
};
}
@@ -125,6 +130,17 @@ class FilePage extends React.PureComponent {
this.onComponentFocused();
}
difference = (object, base) => {
function changes(object, base) {
return _.transform(object, function(result, value, key) {
if (!_.isEqual(value, base[key])) {
result[key] = _.isObject(value) && _.isObject(base[key]) ? changes(value, base[key]) : value;
}
});
}
return changes(object, base);
};
componentWillReceiveProps(nextProps) {
const {
claim,
@@ -134,6 +150,7 @@ class FilePage extends React.PureComponent {
navigation,
contentType,
notify,
drawerStack: prevDrawerStack,
} = this.props;
const { uri } = navigation.state.params;
const {
@@ -143,6 +160,7 @@ class FilePage extends React.PureComponent {
purchasedUris,
purchaseUriErrorMessage,
streamingUrl,
drawerStack,
} = nextProps;
if (Constants.ROUTE_FILE === currentRoute && currentRoute !== prevRoute) {
@@ -182,15 +200,41 @@ class FilePage extends React.PureComponent {
this.setState({ streamingMode: true, currentStreamUrl: fileInfo.streaming_url });
}
}
if (
prevDrawerStack[prevDrawerStack.length - 1].route === Constants.DRAWER_ROUTE_FILE_VIEW &&
prevDrawerStack.length !== drawerStack.length
) {
this.setState({
downloadPressed: false,
showImageViewer: false,
showWebView: false,
});
}
}
componentDidUpdate(prevProps) {
const { claim, contentType, fileInfo, isResolvingUri, resolveUri, navigation } = this.props;
const {
claim,
contentType,
costInfo,
fileInfo,
isResolvingUri,
resolveUri,
navigation,
purchaseUri,
searchRecommended,
title,
} = this.props;
const { uri } = this.state;
if (!isResolvingUri && claim === undefined && uri) {
resolveUri(uri);
}
if (title && !this.state.didSearchRecommended) {
this.setState({ didSearchRecommended: true }, () => searchRecommended(title));
}
// Returned to the page. If mediaLoaded, and currentMediaInfo is different, update
if (this.state.mediaLoaded && window.currentMediaInfo && window.currentMediaInfo.uri !== this.state.uri) {
const { metadata } = this.props;
@@ -200,6 +244,21 @@ class FilePage extends React.PureComponent {
uri: this.state.uri,
};
}
// attempt to retrieve images and html/text automatically once the claim is loaded, and it's free
const mediaType = Lbry.getMediaType(contentType);
const isViewable = mediaType === 'image' || mediaType === 'text';
if (claim && costInfo && costInfo.cost === 0 && !this.state.autoGetAttempted && isViewable) {
this.setState(
{
autoGetAttempted: true,
downloadPressed: true,
autoPlayMedia: true,
stopDownloadConfirmed: false,
},
() => purchaseUri(claim.permanent_url, costInfo, true)
);
}
}
fetchFileInfo(props) {
@@ -214,25 +273,25 @@ class FilePage extends React.PureComponent {
}
}
handleFullscreenToggle = mode => {
this.setState({ fullscreenMode: mode });
StatusBar.setHidden(mode);
if (NativeModules.ScreenOrientation) {
if (mode) {
// fullscreen, so change orientation to landscape mode
NativeModules.ScreenOrientation.lockOrientationLandscape();
if (NativeModules.UtilityModule) {
// hide the navigation bar (on devices that use have soft navigation bar)
NativeModules.UtilityModule.hideNavigationBar();
}
} else {
// Switch back to portrait mode when the media is not fullscreen
NativeModules.ScreenOrientation.lockOrientationPortrait();
if (NativeModules.UtilityModule) {
// hide the navigation bar (on devices that use have soft navigation bar)
NativeModules.UtilityModule.showNavigationBar();
}
}
handleFullscreenToggle = isFullscreen => {
const { toggleFullscreenMode } = this.props;
this.setState({ fullscreenMode: isFullscreen });
toggleFullscreenMode(isFullscreen);
StatusBar.setHidden(isFullscreen);
if (isFullscreen) {
// fullscreen, so change orientation to landscape mode
NativeModules.ScreenOrientation.lockOrientationLandscape();
// hide the navigation bar (on devices that have the soft navigation bar)
NativeModules.UtilityModule.hideNavigationBar();
} else {
// Switch back to portrait mode when the media is not fullscreen
NativeModules.ScreenOrientation.lockOrientationPortrait();
// hide the navigation bar (on devices that have the soft navigation bar)
NativeModules.UtilityModule.showNavigationBar();
}
};
@@ -565,6 +624,18 @@ class FilePage extends React.PureComponent {
setPlayerVisible();
};
onDownloadPressed = () => {
const { claim, costInfo, purchaseUri } = this.props;
this.setState(
{
downloadPressed: true,
autoPlayMedia: false,
stopDownloadConfirmed: false,
},
() => purchaseUri(claim.permanent_url, costInfo, true)
);
};
onBackButtonPressed = () => {
const { navigation, drawerStack, popDrawerStack } = this.props;
navigateBack(navigation, drawerStack, popDrawerStack);
@@ -589,6 +660,50 @@ class FilePage extends React.PureComponent {
}
};
openFile = (localFileUri, mediaType) => {
const { pushDrawerStack } = this.props;
const isWebViewable = mediaType === 'text';
if (mediaType === 'image') {
// use image viewer
if (!this.state.showImageViewer) {
this.setState(
{
imageUrls: [
{
url: localFileUri,
},
],
showImageViewer: true,
},
() => pushDrawerStack(Constants.DRAWER_ROUTE_FILE_VIEW)
);
}
}
if (isWebViewable) {
// show webview
if (!this.state.showWebView) {
this.setState(
{
showWebView: true,
},
() => pushDrawerStack(Constants.DRAWER_ROUTE_FILE_VIEW)
);
}
}
};
onMediaContainerPressed = () => {
const { costInfo, contentType, purchaseUri } = this.props;
const { uri } = this.state;
const mediaType = Lbry.getMediaType(contentType);
const isPlayable = mediaType === 'video' || mediaType === 'audio';
purchaseUri(uri, costInfo, isPlayable);
if (isPlayable) {
this.onFileDownloadButtonPlayed();
}
};
render() {
const {
balance,
@@ -607,6 +722,9 @@ class FilePage extends React.PureComponent {
navigation,
position,
purchaseUri,
pushDrawerStack,
isSearchingRecommendContent,
recommendedContent,
thumbnail,
title,
} = this.props;
@@ -624,7 +742,7 @@ class FilePage extends React.PureComponent {
{isResolvingUri && (
<View style={filePageStyle.busyContainer}>
<ActivityIndicator size="large" color={Colors.NextLbryGreen} />
<Text style={filePageStyle.infoText}>Loading decentralized data...</Text>
<Text style={filePageStyle.infoText}>{__('Loading decentralized data...')}</Text>
</View>
)}
{claim === null && !isResolvingUri && (
@@ -633,15 +751,15 @@ class FilePage extends React.PureComponent {
<EmptyStateView
message={
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.'
? __('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.')
}
/>
)}
{!ownedClaim && (
<EmptyStateView
message={"There's nothing at this location."}
buttonText={'Publish something here'}
message={__("There's nothing at this location.")}
buttonText={__('Publish something here')}
onButtonPress={() =>
navigation.navigate({
routeName: Constants.DRAWER_ROUTE_PUBLISH,
@@ -679,10 +797,11 @@ class FilePage extends React.PureComponent {
<View style={filePageStyle.pageContainer}>
<View style={filePageStyle.dmcaContainer}>
<Text style={filePageStyle.dmcaText}>
In response to a complaint we received under the US Digital Millennium Copyright Act, we have blocked
access to this content from our applications.
{__(
'In response to a complaint we received under the US Digital Millennium Copyright Act, we have blocked access to this content from our applications.'
)}
</Text>
<Link style={filePageStyle.dmcaLink} href="https://lbry.com/faq/dmca" text="Read More" />
<Link style={filePageStyle.dmcaLink} href="https://lbry.com/faq/dmca" text={__('Read More')} />
</View>
<UriBar value={uri} navigation={navigation} />
</View>
@@ -699,6 +818,7 @@ class FilePage extends React.PureComponent {
const description = metadata.description ? metadata.description : null;
const mediaType = Lbry.getMediaType(contentType);
const isPlayable = mediaType === 'video' || mediaType === 'audio';
const isWebViewable = mediaType === 'text';
const { height, signing_channel: signingChannel, value } = claim;
const channelName = signingChannel && signingChannel.name;
const channelClaimId = claim && claim.signing_channel && claim.signing_channel.claim_id;
@@ -737,35 +857,10 @@ class FilePage extends React.PureComponent {
(fileInfo && (fileInfo.written_bytes >= 2097152 || fileInfo.written_bytes === fileInfo.total_bytes)); // 2MB = 1024*1024*2
const duration = claim && claim.value && claim.value.video ? claim.value.video.duration : null;
const isViewable = mediaType === 'image' || mediaType === 'text';
const isWebViewable = mediaType === 'text';
const canOpen = isViewable && completed;
const localFileUri = this.localUriForFileInfo(fileInfo);
const unsupported = !isPlayable && !canOpen;
const openFile = () => {
if (mediaType === 'image') {
// use image viewer
if (!this.state.showImageViewer) {
this.setState({
imageUrls: [
{
url: localFileUri,
},
],
showImageViewer: true,
});
}
}
if (isWebViewable) {
// show webview
if (!this.state.showWebView) {
this.setState({
showWebView: true,
});
}
}
};
if (fileInfo && !this.state.autoDownloadStarted && this.state.uriVars && this.state.uriVars.download === 'true') {
this.setState({ autoDownloadStarted: true }, () => {
purchaseUri(uri, costInfo, !isPlayable);
@@ -775,16 +870,16 @@ class FilePage extends React.PureComponent {
});
}
if (this.state.downloadPressed && canOpen) {
if (this.state.downloadPressed && canOpen && !this.state.autoOpened) {
// automatically open a web viewable or image file after the download button is pressed
openFile();
this.setState({ autoOpened: true }, () => this.openFile(localFileUri, mediaType));
}
return (
<View style={filePageStyle.pageContainer}>
{!this.state.fullscreenMode && <UriBar value={uri} navigation={navigation} />}
{this.state.showWebView && isWebViewable && (
<WebView source={{ uri: localFileUri }} style={filePageStyle.viewer} />
<WebView allowFileAccess source={{ uri: localFileUri }} style={filePageStyle.viewer} />
)}
{this.state.showImageViewer && (
@@ -802,7 +897,11 @@ class FilePage extends React.PureComponent {
}
onLayout={this.checkOrientation}
>
<View style={filePageStyle.mediaContainer}>
<TouchableOpacity
activeOpacity={0.5}
style={filePageStyle.mediaContainer}
onPress={this.onMediaContainerPressed}
>
{(canOpen || (!fileInfo || (isPlayable && !canLoadMedia)) || (!canOpen && fileInfo)) && (
<FileItemMedia
duration={duration}
@@ -825,7 +924,7 @@ class FilePage extends React.PureComponent {
source={require('../../assets/gerbil-happy.png')}
/>
<View style={filePageStyle.unspportedContentTextContainer}>
<Text style={filePageStyle.unsupportedContentTitle}>Unsupported Content</Text>
<Text style={filePageStyle.unsupportedContentTitle}>{__('Unsupported Content')}</Text>
<Text style={filePageStyle.unsupportedContentText}>
Sorry, we are unable to display this content in the app. You can find the file named{' '}
<Text style={filePageStyle.unsupportedContentFilename}>{fileInfo.file_name}</Text> in your
@@ -840,9 +939,9 @@ class FilePage extends React.PureComponent {
(!completed && !this.state.streamingMode)) &&
!this.state.downloadPressed && (
<FileDownloadButton
uri={uri}
uri={claim && claim.permanent_url ? claim.permanent_url : uri}
style={filePageStyle.downloadButton}
openFile={openFile}
openFile={() => this.openFile(localFileUri, mediaType)}
isPlayable={isPlayable}
isViewable={isViewable}
onPlay={this.onFileDownloadButtonPlayed}
@@ -861,7 +960,7 @@ class FilePage extends React.PureComponent {
<TouchableOpacity style={filePageStyle.backButton} onPress={this.onBackButtonPressed}>
<Icon name={'arrow-left'} size={18} style={filePageStyle.backButtonIcon} />
</TouchableOpacity>
</View>
</TouchableOpacity>
{(this.state.streamingMode || (canLoadMedia && fileInfo && isPlayable)) && (
<View
style={playerBgStyle}
@@ -903,48 +1002,8 @@ class FilePage extends React.PureComponent {
/>
)}
{showActions && showFileActions && (
<View style={filePageStyle.actions}>
{showFileActions && (
<View style={filePageStyle.fileActions}>
{canEdit && (
<Button
style={[filePageStyle.actionButton, filePageStyle.editButton]}
theme={'light'}
icon={'edit'}
text={'Edit'}
onPress={this.onEditPressed}
/>
)}
{(completed || canEdit) && (
<Button
style={filePageStyle.actionButton}
theme={'light'}
icon={'trash-alt'}
text={'Delete'}
onPress={this.onDeletePressed}
/>
)}
{!completed &&
fileInfo &&
!fileInfo.stopped &&
fileInfo.written_bytes < fileInfo.total_bytes &&
!this.state.stopDownloadConfirmed && (
<Button
style={filePageStyle.actionButton}
icon={'stop'}
theme={'light'}
text={'Stop Download'}
onPress={this.onStopDownloadPressed}
/>
)}
</View>
)}
</View>
)}
<ScrollView
style={showActions ? filePageStyle.scrollContainerActions : filePageStyle.scrollContainer}
style={filePageStyle.scrollContainer}
contentContainerstyle={showActions ? null : filePageStyle.scrollContent}
keyboardShouldPersistTaps={'handled'}
ref={ref => {
@@ -968,25 +1027,72 @@ class FilePage extends React.PureComponent {
<View style={filePageStyle.largeButtonsRow}>
<TouchableOpacity style={filePageStyle.largeButton} onPress={this.handleSharePress}>
<Icon name={'share-alt'} size={20} style={filePageStyle.largeButtonIcon} />
<Text style={filePageStyle.largeButtonText}>Share</Text>
<Icon name={'share-alt'} size={16} style={filePageStyle.largeButtonIcon} />
<Text style={filePageStyle.largeButtonText}>{__('Share')}</Text>
</TouchableOpacity>
<TouchableOpacity
style={filePageStyle.largeButton}
onPress={() => this.setState({ showTipView: true })}
>
<Icon name={'gift'} size={20} style={filePageStyle.largeButtonIcon} />
<Text style={filePageStyle.largeButtonText}>Tip</Text>
<Icon name={'gift'} size={16} style={filePageStyle.largeButtonIcon} />
<Text style={filePageStyle.largeButtonText}>{__('Tip')}</Text>
</TouchableOpacity>
<TouchableOpacity
style={filePageStyle.largeButton}
onPress={() => Linking.openURL(`https://lbry.com/dmca/${claim.claim_id}`)}
>
<Icon name={'flag'} size={20} style={filePageStyle.largeButtonIcon} />
<Text style={filePageStyle.largeButtonText}>Report</Text>
</TouchableOpacity>
{!canEdit && !isPlayable && (
<View style={filePageStyle.sharedLargeButton}>
{!fileInfo ||
(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>
))}
{!completed &&
fileInfo &&
!fileInfo.stopped &&
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} />
<Text style={filePageStyle.largeButtonText}>{__('Stop')}</Text>
</TouchableOpacity>
)}
{completed && fileInfo && fileInfo.written_bytes >= fileInfo.total_bytes && (
<TouchableOpacity style={filePageStyle.innerLargeButton} onPress={this.onOpenFilePressed}>
<Icon name={'folder-open'} size={16} style={filePageStyle.largeButtonIcon} />
<Text style={filePageStyle.largeButtonText}>{__('Open')}</Text>
</TouchableOpacity>
)}
</View>
)}
{!canEdit && (
<TouchableOpacity
style={filePageStyle.largeButton}
onPress={() => Linking.openURL(`https://lbry.com/dmca/${claim.claim_id}`)}
>
<Icon name={'flag'} size={16} style={filePageStyle.largeButtonIcon} />
<Text style={filePageStyle.largeButtonText}>{__('Report')}</Text>
</TouchableOpacity>
)}
{canEdit && (
<TouchableOpacity style={filePageStyle.largeButton} onPress={this.onEditPressed}>
<Icon name={'edit'} size={16} style={filePageStyle.largeButtonIcon} />
<Text style={filePageStyle.largeButtonText}>{__('Edit')}</Text>
</TouchableOpacity>
)}
{(completed || canEdit) && (
<TouchableOpacity style={filePageStyle.largeButton} onPress={this.onDeletePressed}>
<Icon name={'trash-alt'} size={16} style={filePageStyle.largeButtonIcon} />
<Text style={filePageStyle.largeButtonText}>{__('Delete')}</Text>
</TouchableOpacity>
)}
</View>
<View style={filePageStyle.channelRow}>
@@ -999,13 +1105,19 @@ class FilePage extends React.PureComponent {
numberOfLines={1}
ellipsizeMode={'tail'}
onPress={() => {
navigateToUri(navigation, normalizeURI(shortChannelUri || fullChannelUri));
navigateToUri(
navigation,
normalizeURI(shortChannelUri || fullChannelUri),
null,
false,
fullChannelUri
);
}}
/>
)}
{!channelName && (
<Text style={filePageStyle.anonChannelName} selectable ellipsizeMode={'tail'}>
Anonymous
{__('Anonymous')}
</Text>
)}
<DateTime
@@ -1033,7 +1145,7 @@ class FilePage extends React.PureComponent {
hideText={false}
/>
)}
{channelName && (
{false && channelName && (
<SubscribeNotificationButton
style={[filePageStyle.actionButton, filePageStyle.bellButton]}
uri={fullChannelUri}
@@ -1052,6 +1164,8 @@ class FilePage extends React.PureComponent {
editable={!this.state.sendTipStarted}
ref={ref => (this.tipAmountInput = ref)}
onChangeText={value => this.setState({ tipAmount: value })}
onFocus={() => this.setState({ creditsInputFocused: true })}
onBlur={() => this.setState({ creditsInputFocused: false })}
underlineColorAndroid={Colors.NextLbryGreen}
keyboardType={'numeric'}
placeholder={'0'}
@@ -1060,15 +1174,21 @@ class FilePage extends React.PureComponent {
style={[filePageStyle.input, filePageStyle.tipAmountInput]}
/>
<Text style={[filePageStyle.text, filePageStyle.currency]}>LBC</Text>
<View style={filePageStyle.balance}>
{this.state.creditsInputFocused && <Icon name="coins" size={12} />}
{this.state.creditsInputFocused && (
<Text style={filePageStyle.balanceText}>{formatCredits(parseFloat(balance), 1, true)}</Text>
)}
</View>
</View>
{this.state.sendTipStarted && <ActivityIndicator size={'small'} color={Colors.NextLbryGreen} />}
<Link
style={[filePageStyle.link, filePageStyle.cancelTipLink]}
text={'Cancel'}
text={__('Cancel')}
onPress={() => this.setState({ showTipView: false })}
/>
<Button
text={'Send a tip'}
text={__('Send a tip')}
style={[filePageStyle.button, filePageStyle.sendButton]}
disabled={!canSendTip || this.state.sendTipStarted}
onPress={this.handleSendTip}
@@ -1087,7 +1207,7 @@ class FilePage extends React.PureComponent {
</Text>
{tags && tags.length > 0 && (
<View style={filePageStyle.tagContainer}>
<Text style={filePageStyle.tagTitle}>Tags</Text>
<Text style={filePageStyle.tagTitle}>{__('Tags')}</Text>
<View style={filePageStyle.tagList}>{this.renderTags(tags)}</View>
</View>
)}
@@ -1099,13 +1219,20 @@ class FilePage extends React.PureComponent {
)}
<View onLayout={this.setRelatedContentPosition} />
<RelatedContent navigation={navigation} uri={uri} fullUri={fullUri} />
{isSearchingRecommendContent && (
<ActivityIndicator size="small" color={Colors.NextLbryGreen} style={filePageStyle.relatedLoading} />
)}
{!isSearchingRecommendContent && recommendedContent && recommendedContent.length > 0 && (
<RelatedContent navigation={navigation} uri={uri} fullUri={fullUri} />
)}
</ScrollView>
</View>
)}
{!this.state.fullscreenMode && !this.state.showImageViewer && !this.state.showWebView && (
<FloatingWalletBalance navigation={navigation} />
)}
{!this.state.creditsInputFocused &&
!this.state.fullscreenMode &&
!this.state.showImageViewer &&
!this.state.showWebView && <FloatingWalletBalance navigation={navigation} />}
</View>
);
}
+5 -1
View File
@@ -1,5 +1,5 @@
import { connect } from 'react-redux';
import { doToast } from 'lbry-redux';
import { SETTINGS, doToast } from 'lbry-redux';
import {
doAuthenticate,
doCheckSync,
@@ -8,6 +8,7 @@ import {
doUserEmailNew,
doUserResendVerificationEmail,
selectAuthToken,
selectEmailAlreadyExists,
selectEmailNewErrorMessage,
selectEmailNewIsPending,
selectEmailToVerify,
@@ -21,16 +22,19 @@ import {
selectUser,
} from 'lbryinc';
import { doSetClientSetting } from 'redux/actions/settings';
import { makeSelectClientSetting } from 'redux/selectors/settings';
import FirstRun from './view';
const select = state => ({
authenticating: selectAuthenticationIsPending(state),
authToken: selectAuthToken(state),
emailToVerify: selectEmailToVerify(state),
emailAlreadyExists: selectEmailAlreadyExists(state),
emailNewErrorMessage: selectEmailNewErrorMessage(state),
emailNewPending: selectEmailNewIsPending(state),
hasSyncedWallet: selectHasSyncedWallet(state),
getSyncIsPending: selectGetSyncIsPending(state),
language: makeSelectClientSetting(SETTINGS.LANGUAGE)(state),
syncApplyErrorMessage: selectSyncApplyErrorMessage(state),
syncApplyIsPending: selectSyncApplyIsPending(state),
syncHash: selectSyncHash(state),
@@ -3,7 +3,7 @@ import { Lbry } from 'lbry-redux';
import { NativeModules, Platform, Text, TextInput, View } from 'react-native';
import AsyncStorage from '@react-native-community/async-storage';
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';
class EmailCollectPage extends React.PureComponent {
@@ -44,7 +44,7 @@ class EmailCollectPage extends React.PureComponent {
const content = (
<View onLayout={() => onEmailViewLayout('collect')}>
<Text style={firstRunStyle.title}>Setup account</Text>
<Text style={firstRunStyle.title}>{__('Setup account')}</Text>
<TextInput
style={firstRunStyle.emailInput}
placeholder={this.state.placeholder}
@@ -64,10 +64,10 @@ class EmailCollectPage extends React.PureComponent {
}}
/>
<Text style={firstRunStyle.paragraph}>
An account will allow you to earn rewards and keep your account and settings synced.
{__('A lbry.tv account allows you to earn rewards, backup your wallet, and keep everything in sync.')}
</Text>
<Text style={firstRunStyle.infoParagraph}>
This information is disclosed only to LBRY, Inc. and not to the LBRY network.
{__('This information is disclosed only to LBRY, Inc. and not to the LBRY network.')}
</Text>
</View>
);
+12 -10
View File
@@ -4,7 +4,7 @@ import { ActivityIndicator, Linking, NativeModules, Platform, Switch, Text, Text
import AsyncStorage from '@react-native-community/async-storage';
import Button from 'component/button';
import Colors from 'styles/colors';
import Constants from 'constants';
import Constants from 'constants'; // eslint-disable-line node/no-deprecated-api
import Icon from 'react-native-vector-icons/FontAwesome5';
import firstRunStyle from 'styles/firstRun';
@@ -13,28 +13,30 @@ class EmailVerifyPage extends React.PureComponent {
const { email, notify, resendVerificationEmail } = this.props;
resendVerificationEmail(email);
AsyncStorage.setItem(Constants.KEY_EMAIL_VERIFY_PENDING, 'true');
notify({ message: 'Please follow the instructions in the email sent to your address to continue.' });
notify({ message: __('Please follow the instructions in the email sent to your address to continue.') });
};
render() {
const { onEmailViewLayout, email } = this.props;
const { onEmailViewLayout, email, emailAlreadyExists } = this.props;
const content = (
<View onLayout={() => onEmailViewLayout('verify')}>
<Text style={firstRunStyle.title}>Verify Email</Text>
<Text style={firstRunStyle.title}>{emailAlreadyExists ? __('Sign In') : __('Verify Email')}</Text>
<Text style={firstRunStyle.paragraph}>
An email has been sent to{' '}
<Text style={firstRunStyle.nowrap} numberOfLines={1}>
{email}
</Text>
. Please follow the instructions in the message to verify your email address.
{__('An email has been sent to')}
{'\n\n'}
{email}
{'\n\n'}
{emailAlreadyExists && __('Please click the link in the message to complete signing in')}
{!emailAlreadyExists && __('Please click the link in the message to verify your email address')}.
</Text>
<View style={firstRunStyle.buttonContainer}>
<Button
style={firstRunStyle.verificationButton}
theme={'light'}
text={'Resend'}
text={__('Resend')}
onPress={this.onResendPressed}
/>
</View>
@@ -28,10 +28,10 @@ class SkipAccountPage extends React.PureComponent {
<View onLayout={onSkipAccountViewLayout}>
<View style={firstRunStyle.row}>
<Icon name="exclamation-triangle" style={firstRunStyle.titleIcon} size={32} color={Colors.White} />
<Text style={firstRunStyle.title}>Are you sure?</Text>
<Text style={firstRunStyle.title}>{__('Are you sure?')}</Text>
</View>
<Text style={firstRunStyle.paragraph}>
Without an account, you will not receive rewards, sync and backup services, or security updates.
{__('Without an account, you will not receive rewards, sync and backup services, or security updates.')}
</Text>
<View style={[firstRunStyle.row, firstRunStyle.confirmContainer]}>
@@ -45,8 +45,9 @@ class SkipAccountPage extends React.PureComponent {
/>
</View>
<Text style={firstRunStyle.rowParagraph}>
I understand that by uninstalling LBRY I will lose any balances or published content with no recovery option
if it is not backed up manually (see wallet page)
{__(
'I understand that by uninstalling LBRY I will lose any balances or published content with no recovery option if it is not backed up manually (see wallet page)'
)}
</Text>
</View>
</View>
+32 -17
View File
@@ -28,12 +28,32 @@ class WalletPage extends React.PureComponent {
walletReady: false,
hasCheckedSync: false,
revealPassword: false,
autoPassword: false,
autoLoginAttempted: false,
};
componentDidMount() {
this.checkWalletReady();
}
componentDidUpdate() {
const { hasSyncedWallet, getSyncIsPending, onPasswordChanged, autoLogin } = this.props;
if (this.state.walletReady && this.state.hasCheckedSync && !getSyncIsPending) {
if (!hasSyncedWallet && !this.state.autoPassword) {
// new account, in which case, don't ask for a password, and act as the final first run step
this.setState({ password: '', autoPassword: true });
if (onPasswordChanged) {
onPasswordChanged('', true);
}
}
if (hasSyncedWallet && !this.state.autoLoginAttempted && autoLogin) {
autoLogin();
this.setState({ autoLoginAttempted: true });
}
}
}
checkWalletReady = () => {
// make sure the sdk wallet component is ready
Lbry.status()
@@ -69,6 +89,7 @@ class WalletPage extends React.PureComponent {
hasSyncedWallet,
syncApplyIsPending,
syncApplyStarted,
syncApplyCompleted,
} = this.props;
let content;
@@ -76,24 +97,27 @@ class WalletPage extends React.PureComponent {
content = (
<View style={firstRunStyle.centered}>
<ActivityIndicator size="large" color={Colors.White} style={firstRunStyle.waiting} />
<Text style={firstRunStyle.paragraph}>Retrieving your account information...</Text>
<Text style={firstRunStyle.paragraph}>{__('Retrieving your account information...')}</Text>
</View>
);
} else if (syncApplyStarted || syncApplyIsPending) {
} else if (syncApplyStarted || syncApplyIsPending || syncApplyCompleted) {
content = (
<View style={firstRunStyle.centered}>
<ActivityIndicator size="large" color={Colors.White} style={firstRunStyle.waiting} />
<Text style={firstRunStyle.paragraph}>{syncApplyIsPending ? 'Validating password' : 'Synchronizing'}...</Text>
<Text style={firstRunStyle.paragraph}>
{syncApplyIsPending ? __('Validating password') : __('Synchronizing')}...
</Text>
</View>
);
} else {
} else if (hasSyncedWallet && this.state.autoLoginAttempted) {
// only display this view if it's not a new user (or auto-login has been attempted once)
content = (
<View onLayout={onWalletViewLayout}>
<Text style={firstRunStyle.title}>Password</Text>
<Text style={firstRunStyle.title}>{__('Password')}</Text>
<Text style={firstRunStyle.paragraph}>
{hasSyncedWallet
? 'Please enter the password you used to secure your wallet.'
: 'Please enter a password to secure your account and wallet.'}
? __('Please enter the password you used to secure your wallet.')
: __('Please enter a password to secure your account and wallet.')}
</Text>
<View style={firstRunStyle.passwordInputContainer}>
<TextInput
@@ -122,15 +146,6 @@ class WalletPage extends React.PureComponent {
<Icon name={this.state.revealPassword ? 'eye-slash' : 'eye'} size={16} style={firstRunStyle.revealIcon} />
</TouchableOpacity>
</View>
{(!this.state.password || this.state.password.trim().length === 0) && (
<View style={firstRunStyle.passwordWarning}>
<Text style={firstRunStyle.passwordWarningText}>
{hasSyncedWallet
? 'If you did not provide a password, please press Use LBRY to continue.'
: 'You can proceed without a password, but this is not recommended.'}
</Text>
</View>
)}
{(!hasSyncedWallet && this.state.password && this.state.password.trim().length) > 0 && (
<View style={firstRunStyle.passwordStrength}>
@@ -142,7 +157,7 @@ class WalletPage extends React.PureComponent {
</View>
)}
<Text style={firstRunStyle.infoParagraph}>
Note: for wallet security purposes, LBRY is unable to reset your password.
{__('Note: for wallet security purposes, LBRY is unable to reset your password.')}
</Text>
</View>
);
+8 -6
View File
@@ -87,8 +87,9 @@ class WelcomePage extends React.PureComponent {
content = (
<View>
<Text style={firstRunStyle.paragraph}>
The LBRY servers were unreachable at this time. Please check your Internet connection and then restart the
app to try again.
{__(
'The LBRY servers were unreachable at this time. Please check your Internet connection and then restart the app to try again.'
)}
</Text>
</View>
);
@@ -96,16 +97,17 @@ class WelcomePage extends React.PureComponent {
content = (
<View style={firstRunStyle.centered}>
<ActivityIndicator size="large" color={Colors.White} style={firstRunStyle.waiting} />
<Text style={firstRunStyle.paragraph}>Please wait while we get some things ready...</Text>
<Text style={firstRunStyle.paragraph}>{__('Please wait while we get some things ready...')}</Text>
</View>
);
} else {
content = (
<View onLayout={onWelcomePageLayout}>
<Text style={firstRunStyle.title}>Welcome to LBRY.</Text>
<Text style={firstRunStyle.title}>{__('Welcome to LBRY.')}</Text>
<Text style={firstRunStyle.paragraph}>
LBRY is a community-controlled content platform where you can find and publish videos, music, books, and
more.
{__(
'LBRY is a community-controlled content platform where you can find and publish videos, music, books, and more.'
)}
</Text>
<Text style={[firstRunStyle.infoParagraph, firstRunStyle.tosParagraph]}>
By continuing, I agree to the{' '}
+100 -30
View File
@@ -1,5 +1,5 @@
import React from 'react';
import { Lbry } from 'lbry-redux';
import { SETTINGS, Lbry } from 'lbry-redux';
import { ActivityIndicator, Linking, NativeModules, Text, TouchableOpacity, View } from 'react-native';
import { NavigationActions, StackActions } from 'react-navigation';
import AsyncStorage from '@react-native-community/async-storage';
@@ -11,6 +11,7 @@ import EmailCollectPage from './internal/email-collect-page';
import EmailVerifyPage from './internal/email-verify-page';
import SkipAccountPage from './internal/skip-account-page';
import firstRunStyle from 'styles/firstRun';
import RNFS from 'react-native-fs';
class FirstRunScreen extends React.PureComponent {
static pages = [
@@ -27,14 +28,17 @@ class FirstRunScreen extends React.PureComponent {
emailCollectTracked: false,
emailSubmitted: false,
enterPasswordTracked: false,
autoLoginTried: false,
isFirstRun: false,
launchUrl: null,
languageLoaded: false,
showSkip: false,
isEmailVerified: false,
skipAccountConfirmed: false,
showBottomContainer: false,
walletPassword: '',
syncApplyStarted: false,
syncApplyCompleted: false,
};
componentDidMount() {
@@ -44,26 +48,67 @@ class FirstRunScreen extends React.PureComponent {
}
});
if (NativeModules.FirstRun) {
NativeModules.FirstRun.isFirstRun().then(firstRun => {
AsyncStorage.removeItem(Constants.KEY_FIRST_RUN_EMAIL);
AsyncStorage.removeItem(Constants.KEY_EMAIL_VERIFY_PENDING);
this.setState({ isFirstRun: firstRun });
if (firstRun) {
NativeModules.Firebase.setCurrentScreen('First Run');
this.setState({ currentPage: FirstRunScreen.pages[0] });
} else {
// Not the first run. Navigate to the splash screen right away
this.launchSplashScreen();
}
});
} else {
// The first run module was not detected. Go straight to the splash screen.
this.launchSplashScreen();
}
NativeModules.UtilityModule.getNativeStringSetting(SETTINGS.LANGUAGE, 'en').then(language =>
this.loadLanguage(language)
);
}
loadLanguage = language => {
if (!language || language === 'en') {
this.checkFirstRun();
} else {
// Load the current language setting before doing anything
const languageFile = RNFS.ExternalDirectoryPath + '/' + language + '.json';
RNFS.readFile(languageFile, 'utf8')
.then(fileContents => {
const json = JSON.parse(fileContents);
window.language = language;
window.i18n_messages[language] = json;
// language exists, so download an update
this.downloadLanguageUpdate(language);
this.checkFirstRun();
})
.catch(err => {
// language file doesn't exist? maintain the default language
this.checkFirstRun();
});
}
};
downloadLanguageUpdate = language => {
fetch('https://lbry.com/i18n/get/lbry-mobile/app-strings/' + language + '.json')
.then(r => r.json())
.then(j => {
window.i18n_messages[language] = j;
// write the language file to the filesystem
const langFilePath = RNFS.ExternalDirectoryPath + '/' + language + '.json';
RNFS.writeFile(langFilePath, JSON.stringify(j), 'utf8');
// update state and client setting
window.language = language;
})
.catch(() => {
/* pass */
});
};
checkFirstRun = () => {
NativeModules.FirstRun.isFirstRun().then(firstRun => {
AsyncStorage.removeItem(Constants.KEY_FIRST_RUN_EMAIL);
AsyncStorage.removeItem(Constants.KEY_EMAIL_VERIFY_PENDING);
this.setState({ isFirstRun: firstRun });
if (firstRun) {
NativeModules.Firebase.setCurrentScreen('First Run');
this.setState({ currentPage: FirstRunScreen.pages[0] });
} else {
// Not the first run. Navigate to the splash screen right away
this.launchSplashScreen();
}
});
};
componentWillReceiveProps(nextProps) {
const { emailNewErrorMessage, emailNewPending, syncApplyErrorMessage, syncApplyIsPending, user } = nextProps;
const { notify, isApplyingSync, setClientSetting } = this.props;
@@ -81,9 +126,18 @@ class FirstRunScreen extends React.PureComponent {
if (this.state.syncApplyStarted && !syncApplyIsPending) {
if (syncApplyErrorMessage && syncApplyErrorMessage.trim().length > 0) {
notify({ message: syncApplyErrorMessage, isError: true });
this.setState({ showBottomContainer: true, syncApplyStarted: false });
if (this.state.autoLoginTried) {
// don't show the error message for auto-login if it fails
notify({ message: __(syncApplyErrorMessage), isError: true });
}
this.setState({
autoLoginTried: true,
showBottomContainer: true,
syncApplyStarted: false,
syncApplyCompleted: false,
});
} else {
this.setState({ syncApplyCompleted: true });
// password successfully verified
NativeModules.UtilityModule.setSecureValue(
Constants.KEY_WALLET_PASSWORD,
@@ -99,7 +153,7 @@ class FirstRunScreen extends React.PureComponent {
if (unlocked) {
this.closeFinalPage();
} else {
notify({ message: 'The wallet could not be unlocked at this time. Please restart the app.' });
notify({ message: __('The wallet could not be unlocked at this time. Please restart the app.') });
}
}
);
@@ -164,6 +218,13 @@ class FirstRunScreen extends React.PureComponent {
});
};
autoLogin = () => {
const { hasSyncedWallet } = this.props;
if (hasSyncedWallet && !this.state.syncApplyStarted) {
this.checkWalletPassword();
}
};
handleContinuePressed = () => {
const { notify, user, hasSyncedWallet } = this.props;
const pageIndex = FirstRunScreen.pages.indexOf(this.state.currentPage);
@@ -178,7 +239,7 @@ class FirstRunScreen extends React.PureComponent {
}
if (Constants.FIRST_RUN_PAGE_SKIP_ACCOUNT === this.state.currentPage && !this.state.skipAccountConfirmed) {
notify({ message: 'Please confirm that you want to use LBRY without creating an account.' });
notify({ message: __('Please confirm that you want to use LBRY without creating an account.') });
return;
}
@@ -204,7 +265,7 @@ class FirstRunScreen extends React.PureComponent {
// validate the email
if (!email || email.indexOf('@') === -1) {
return notify({
message: 'Please provide a valid email address to continue.',
message: __('Please provide a valid email address to continue.'),
});
}
@@ -269,8 +330,12 @@ class FirstRunScreen extends React.PureComponent {
this.setState({ showBottomContainer: true, showSkip: true });
};
onWalletPasswordChanged = password => {
onWalletPasswordChanged = (password, finalStep) => {
this.setState({ walletPassword: password !== null ? password : '' });
if (finalStep) {
// final step for a new user
this.setFreshPassword();
}
};
onWalletViewLayout = () => {
@@ -322,9 +387,11 @@ class FirstRunScreen extends React.PureComponent {
authenticating,
authToken,
checkSync,
emailAlreadyExists,
emailNewErrorMessage,
emailNewPending,
emailToVerify,
language,
notify,
hasSyncedWallet,
getSyncIsPending,
@@ -362,6 +429,7 @@ class FirstRunScreen extends React.PureComponent {
<EmailVerifyPage
onEmailViewLayout={this.onEmailViewLayout}
email={this.state.email}
emailAlreadyExists={emailAlreadyExists}
notify={notify}
resendVerificationEmail={resendVerificationEmail}
/>
@@ -376,8 +444,10 @@ class FirstRunScreen extends React.PureComponent {
getSyncIsPending={getSyncIsPending}
syncApplyIsPending={syncApplyIsPending}
syncApplyStarted={this.state.syncApplyStarted}
syncApplyCompleted={this.state.syncApplyCompleted}
onWalletViewLayout={this.onWalletViewLayout}
onPasswordChanged={this.onWalletPasswordChanged}
autoLogin={this.autoLogin}
/>
);
break;
@@ -410,27 +480,27 @@ class FirstRunScreen extends React.PureComponent {
<Text style={firstRunStyle.buttonText}>
«{' '}
{Constants.FIRST_RUN_PAGE_SKIP_ACCOUNT === this.state.currentPage
? 'Setup account'
: 'Change email'}
? __('Setup account')
: __('Change email')}
</Text>
</TouchableOpacity>
)}
{!emailNewPending && Constants.FIRST_RUN_PAGE_EMAIL_COLLECT === this.state.currentPage && (
<TouchableOpacity style={firstRunStyle.leftButton} onPress={this.handleLeftButtonPressed}>
<Text style={firstRunStyle.smallLeftButtonText}>No, thanks »</Text>
<Text style={firstRunStyle.smallLeftButtonText}>{__('No, thanks')} »</Text>
</TouchableOpacity>
)}
{!emailNewPending && (
<TouchableOpacity style={firstRunStyle.button} onPress={this.handleContinuePressed}>
{Constants.FIRST_RUN_PAGE_SKIP_ACCOUNT === this.state.currentPage && (
<Text style={firstRunStyle.smallButtonText}>Use LBRY »</Text>
<Text style={firstRunStyle.smallButtonText}>{__('Use LBRY')} »</Text>
)}
{Constants.FIRST_RUN_PAGE_SKIP_ACCOUNT !== this.state.currentPage &&
Constants.FIRST_RUN_PAGE_EMAIL_VERIFY !== this.state.currentPage && (
<Text style={firstRunStyle.buttonText}>
{Constants.FIRST_RUN_PAGE_WALLET === this.state.currentPage ? 'Use LBRY' : 'Continue'} »
{Constants.FIRST_RUN_PAGE_WALLET === this.state.currentPage ? __('Use LBRY') : __('Continue')} »
</Text>
)}
</TouchableOpacity>
+75 -48
View File
@@ -19,6 +19,7 @@ import {
isNameValid,
batchActions,
buildURI,
formatCredits,
normalizeURI,
parseURI,
regexInvalidURI,
@@ -45,7 +46,7 @@ import Tag from 'component/tag';
import TagSearch from 'component/tagSearch';
import UriBar from 'component/uriBar';
import publishStyle from 'styles/publish';
import { __, navigateToUri, logPublish, uploadImageAsset } from 'utils/helper';
import { navigateToUri, logPublish, uploadImageAsset } from 'utils/helper';
const languages = {
en: 'English',
@@ -83,6 +84,7 @@ class PublishPage extends React.PureComponent {
state = {
canPublish: true,
canUseCamera: false,
creditsInputFocused: false,
documentPickerOpen: false,
editMode: false,
titleFocused: false,
@@ -345,7 +347,7 @@ class PublishPage extends React.PureComponent {
if (balance < Constants.MINIMUM_TRANSACTION_BALANCE) {
notify({
message: 'Publishing content requires credits. Press the blue bar to get some for free.',
message: __('Publishing content requires credits. Press the blue bar to get some for free.'),
});
if (this.scrollView) {
this.scrollView.scrollTo({ x: 0, y: 0, animated: true });
@@ -354,18 +356,18 @@ class PublishPage extends React.PureComponent {
}
if (!title || title.trim().length === 0) {
notify({ message: 'Please provide a title' });
notify({ message: __('Please provide a title') });
return;
}
if (!name) {
notify({ message: 'Please specify an address where people can find your content.' });
notify({ message: __('Please specify an address where people can find your content.') });
return;
}
if (!currentMedia && !editMode) {
// sanity check. normally shouldn't happen
notify({ message: 'No file selected. Please select a video or take a photo before publishing.' });
notify({ message: __('No file selected. Please select a video or take a photo before publishing.') });
return;
}
@@ -403,7 +405,7 @@ class PublishPage extends React.PureComponent {
pendingPublishSuccess(pendingClaim);
notify({
message: `Your content was successfully published to ${this.state.uri}. It will be available in a few mintues.`,
message: __('Your content was successfully published. It will be available in a few mintues.'),
});
clearPublishFormState();
this.setState({ publishStarted: false });
@@ -553,7 +555,7 @@ class PublishPage extends React.PureComponent {
handleThumbnailUploadFailure = err => {
const { notify } = this.props;
this.setState({ uploadThumbnailStarted: false });
notify({ message: 'The thumbnail could not be uploaded. Please try again.' });
notify({ message: __('The thumbnail could not be uploaded. Please try again.') });
};
onFilePicked = evt => {
@@ -586,7 +588,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.') });
}
};
@@ -701,7 +703,7 @@ class PublishPage extends React.PureComponent {
}
if (!isNameValid(name, false)) {
notify({ message: 'Your content address contains invalid characters' });
notify({ message: __('Your content address contains invalid characters') });
return;
}
@@ -731,7 +733,7 @@ class PublishPage extends React.PureComponent {
updatePublishFormState({ tags: newTags });
this.setState({ tags: newTags });
} else {
notify({ message: __(`You already added the "${tag}" tag.`) });
notify({ message: __(`You already added the "${tag}" tag.`) }); // TODO: tokenize i18n
}
};
@@ -868,7 +870,7 @@ class PublishPage extends React.PureComponent {
const { notify } = this.props;
if (this.state.thumbnailImagePickerOpen || this.state.uploadThumbnailStarted) {
if (this.state.uploadThumbnailStarted) {
notify({ message: 'A thumbnail is already being uploaded. Please wait for the upload to finish.' });
notify({ message: __('A thumbnail is already being uploaded. Please wait for the upload to finish.') });
}
return;
}
@@ -913,7 +915,7 @@ class PublishPage extends React.PureComponent {
onPress={this.handleRecordVideoPressed}
>
<Icon name="video" size={48} color={Colors.White} />
<Text style={publishStyle.actionText}>Record</Text>
<Text style={publishStyle.actionText}>{__('Record')}</Text>
</TouchableOpacity>
<View style={publishStyle.subActions}>
<TouchableOpacity
@@ -924,11 +926,11 @@ class PublishPage extends React.PureComponent {
onPress={this.handleTakePhotoPressed}
>
<Icon name="camera" size={48} color={Colors.White} />
<Text style={publishStyle.actionText}>Take a photo</Text>
<Text style={publishStyle.actionText}>{__('Take a photo')}</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>
<Text style={publishStyle.actionText}>{__('Upload a file')}</Text>
</TouchableOpacity>
</View>
</View>
@@ -936,13 +938,13 @@ class PublishPage extends React.PureComponent {
{(loadingVideos || !allThumbnailsChecked) && (
<View style={publishStyle.loadingView}>
<ActivityIndicator size="small" color={Colors.NextLbryGreen} />
<Text style={publishStyle.loadingText}>Please wait while we load your videos...</Text>
<Text style={publishStyle.loadingText}>{__('Please wait while we load your videos...')}</Text>
</View>
)}
{!loadingVideos && (!videos || videos.length === 0) && (
<View style={publishStyle.relativeCentered}>
<Text style={publishStyle.noVideos}>
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.')}
</Text>
</View>
)}
@@ -994,7 +996,7 @@ class PublishPage extends React.PureComponent {
{this.state.uploadThumbnailStarted && (
<View style={publishStyle.thumbnailUploadContainer}>
<ActivityIndicator size={'small'} color={Colors.NextLbryGreen} />
<Text style={publishStyle.thumbnailUploadText}>Uploading thumbnail...</Text>
<Text style={publishStyle.thumbnailUploadText}>{__('Uploading thumbnail...')}</Text>
</View>
)}
</TouchableOpacity>
@@ -1003,11 +1005,11 @@ class PublishPage extends React.PureComponent {
<View style={publishStyle.card}>
<View style={publishStyle.textInputLayout}>
{(this.state.titleFocused || (this.state.title != null && this.state.title.trim().length > 0)) && (
<Text style={publishStyle.textInputTitle}>Title</Text>
<Text style={publishStyle.textInputTitle}>{__('Title')}</Text>
)}
<TextInput
editable={this.state.canPublish && !this.state.publishStarted}
placeholder={this.state.titleFocused ? '' : 'Title'}
placeholder={this.state.titleFocused ? '' : __('Title')}
style={publishStyle.inputText}
value={this.state.title}
numberOfLines={1}
@@ -1021,12 +1023,12 @@ class PublishPage extends React.PureComponent {
<View style={publishStyle.textInputLayout}>
{(this.state.descriptionFocused ||
(this.state.description != null && this.state.description.trim().length > 0)) && (
<Text style={publishStyle.textInputTitle}>Description</Text>
<Text style={publishStyle.textInputTitle}>{__('Description')}</Text>
)}
<TextInput
editable={this.state.canPublish && !this.state.publishStarted}
multiline
placeholder={this.state.descriptionFocused ? '' : 'Description'}
placeholder={this.state.descriptionFocused ? '' : __('Description')}
style={publishStyle.inputText}
value={this.state.description}
underlineColorAndroid={Colors.NextLbryGreen}
@@ -1038,7 +1040,7 @@ class PublishPage extends React.PureComponent {
</View>
<View style={publishStyle.card}>
<Text style={publishStyle.cardTitle}>Tags</Text>
<Text style={publishStyle.cardTitle}>{__('Tags')}</Text>
<View style={publishStyle.tagList}>
{this.state.tags &&
this.state.tags.map(tag => (
@@ -1055,7 +1057,7 @@ class PublishPage extends React.PureComponent {
</View>
<View style={publishStyle.card}>
<Text style={publishStyle.cardTitle}>Channel</Text>
<Text style={publishStyle.cardTitle}>{__('Channel')}</Text>
<ChannelSelector
enabled={this.state.canPublish && !this.state.publishStarted}
@@ -1066,14 +1068,16 @@ class PublishPage extends React.PureComponent {
<View style={publishStyle.card}>
<View style={publishStyle.titleRow}>
<Text style={publishStyle.cardTitle}>Price</Text>
<Text style={publishStyle.cardTitle}>{__('Price')}</Text>
<View style={publishStyle.switchTitleRow}>
<Switch value={this.state.priceSet} onValueChange={value => this.setState({ priceSet: value })} />
</View>
</View>
{!this.state.priceSet && (
<Text style={publishStyle.cardText}>Your content will be free. Press the toggle to set a price.</Text>
<Text style={publishStyle.cardText}>
{__('Your content will be free. Press the toggle to set a price.')}
</Text>
)}
{this.state.priceSet && (
@@ -1103,11 +1107,13 @@ class PublishPage extends React.PureComponent {
</View>
<View style={publishStyle.card}>
<Text style={publishStyle.cardTitle}>Content address</Text>
<Text style={publishStyle.cardTitle}>{__('Content address')}</Text>
<Text style={publishStyle.helpText}>
The address where people can find your content (ex. lbry://myvideo).
{__('The address where people can find your content (ex. lbry://myvideo). ')}
{this.state.editMode &&
' You cannot change this address while editing your content. If you wish to use a new address, please republish the content.'}
__(
'You cannot change this address while editing your content. If you wish to use a new address, please republish the content.'
)}
</Text>
<TextInput
@@ -1129,17 +1135,27 @@ class PublishPage extends React.PureComponent {
keyboardType={'numeric'}
value={String(this.state.bid)}
onChangeText={this.handleBidChange}
onFocus={() => this.setState({ creditsInputFocused: true })}
onBlur={() => this.setState({ creditsInputFocused: false })}
/>
<Text style={publishStyle.currency}>LBC</Text>
<View style={publishStyle.balance}>
{this.state.creditsInputFocused && <Icon name="coins" size={12} />}
{this.state.creditsInputFocused && (
<Text style={publishStyle.balanceText}>{formatCredits(parseFloat(balance), 1, true)}</Text>
)}
</View>
</View>
<Text style={publishStyle.helpText}>This LBC remains yours and the deposit can be undone at any time.</Text>
<Text style={publishStyle.helpText}>
{__('This LBC remains yours and the deposit can be undone at any time.')}
</Text>
</View>
{this.state.advancedMode && (
<View style={publishStyle.card}>
<Text style={publishStyle.cardTitle}>Additional Options</Text>
<Text style={publishStyle.cardTitle}>{__('Additional Options')}</Text>
<View>
<Text style={publishStyle.cardText}>Language</Text>
<Text style={publishStyle.cardText}>{__('Language')}</Text>
<Picker
enabled={this.state.canPublish && !this.state.publishStarted}
selectedValue={this.state.language}
@@ -1148,13 +1164,13 @@ class PublishPage extends React.PureComponent {
onValueChange={this.handleLanguageValueChange}
>
{Object.keys(languages).map(lang => (
<Picker.Item label={languages[lang]} value={lang} key={lang} />
<Picker.Item label={__(languages[lang])} value={lang} key={lang} />
))}
</Picker>
</View>
<View>
<Text style={publishStyle.cardText}>License</Text>
<Text style={publishStyle.cardText}>{__('License')}</Text>
<Picker
enabled={this.state.canPublish && !this.state.publishStarted}
selectedValue={this.state.license}
@@ -1162,18 +1178,22 @@ class PublishPage extends React.PureComponent {
itemStyle={publishStyle.pickerItem}
onValueChange={this.handleLicenseValueChange}
>
<Picker.Item label={'None'} value={LICENSES.NONE} key={LICENSES.NONE} />
<Picker.Item label={'Public Domain'} value={LICENSES.PUBLIC_DOMAIN} key={LICENSES.PUBLIC_DOMAIN} />
<Picker.Item label={__('None')} value={LICENSES.NONE} key={LICENSES.NONE} />
<Picker.Item
label={__('Public Domain')}
value={LICENSES.PUBLIC_DOMAIN}
key={LICENSES.PUBLIC_DOMAIN}
/>
{LICENSES.CC_LICENSES.map(({ value, url }) => (
<Picker.Item label={value} value={value} key={value} />
))}
<Picker.Item label={'Copyrighted...'} value={LICENSES.COPYRIGHT} key={LICENSES.COPYRIGHT} />
<Picker.Item label={'Other...'} value={LICENSES.OTHER} key={LICENSES.OTHER} />
<Picker.Item label={__('Copyrighted...')} value={LICENSES.COPYRIGHT} key={LICENSES.COPYRIGHT} />
<Picker.Item label={__('Other...')} value={LICENSES.OTHER} key={LICENSES.OTHER} />
</Picker>
{[LICENSES.COPYRIGHT, LICENSES.OTHER].includes(this.state.license) && (
<TextInput
editable={this.state.canPublish && !this.state.publishStarted}
placeholder={'License description'}
placeholder={__('License description')}
style={publishStyle.inputText}
underlineColorAndroid={Colors.NextLbryGreen}
numberOfLines={1}
@@ -1187,7 +1207,7 @@ class PublishPage extends React.PureComponent {
<View style={publishStyle.toggleContainer}>
<Link
text={this.state.advancedMode ? 'Hide extra fields' : 'Show extra fields'}
text={this.state.advancedMode ? __('Hide extra fields') : __('Show extra fields')}
onPress={this.handleModePressed}
style={publishStyle.modeLink}
/>
@@ -1201,7 +1221,7 @@ class PublishPage extends React.PureComponent {
)}
{!this.state.publishStarted && (
<Link style={publishStyle.cancelLink} text="Cancel" onPress={() => this.showSelector()} />
<Link style={publishStyle.cancelLink} text={__('Cancel')} onPress={() => this.showSelector()} />
)}
{!this.state.publishStarted && (
@@ -1209,7 +1229,7 @@ class PublishPage extends React.PureComponent {
<Button
style={publishStyle.publishButton}
disabled={this.state.uploadThumbnailStarted}
text={this.state.editMode ? 'Save changes' : 'Publish'}
text={this.state.editMode ? __('Save changes') : __('Publish')}
onPress={this.handlePublishPressed}
/>
</View>
@@ -1221,8 +1241,10 @@ class PublishPage extends React.PureComponent {
content = (
<ScrollView style={publishStyle.publishDetails}>
<View style={publishStyle.successContainer}>
<Text style={publishStyle.successTitle}>Success!</Text>
<Text style={publishStyle.successText}>Congratulations! Your content was successfully uploaded.</Text>
<Text style={publishStyle.successTitle}>{__('Success!')}</Text>
<Text style={publishStyle.successText}>
{__('Congratulations! Your content was successfully uploaded.')}
</Text>
<View style={publishStyle.successRow}>
<Link
style={publishStyle.successUrl}
@@ -1232,19 +1254,24 @@ class PublishPage extends React.PureComponent {
<TouchableOpacity
onPress={() => {
Clipboard.setString(this.state.uri);
notify({ message: 'Copied.' });
notify({ message: __('Copied.') });
}}
>
<Icon name="clipboard" size={24} color={Colors.LbryGreen} />
</TouchableOpacity>
</View>
<Text style={publishStyle.successText}>
Your content will be live in a few minutes. In the mean time, feel free to publish more content or explore
the app.
{__(
'Your content will be live in a few minutes. In the mean time, feel free to publish more content or explore the app.'
)}
</Text>
</View>
<View style={publishStyle.actionButtons}>
<Button style={publishStyle.publishButton} text="Publish again" onPress={this.handlePublishAgainPressed} />
<Button
style={publishStyle.publishButton}
text={__('Publish again')}
onPress={this.handlePublishAgainPressed}
/>
</View>
</ScrollView>
);
@@ -1282,7 +1309,7 @@ class PublishPage extends React.PureComponent {
}}
notAuthorizedView={
<View style={publishStyle.fullCentered}>
<Text style={publishStyle.cameraInfo}>Camera not authorized</Text>
<Text style={publishStyle.cameraInfo}>{__('Camera not authorized')}</Text>
</View>
}
/>
+1 -1
View File
@@ -8,7 +8,7 @@ import FileListItem from 'component/fileListItem';
import FloatingWalletBalance from 'component/floatingWalletBalance';
import UriBar from 'component/uriBar';
import publishStyle from 'styles/publish';
import { __, navigateToUri } from 'utils/helper';
import { navigateToUri } from 'utils/helper';
class PublishesPage extends React.PureComponent {
state = {
+7 -5
View File
@@ -8,7 +8,6 @@ import CustomRewardCard from 'component/customRewardCard';
import PageHeader from 'component/pageHeader';
import RewardCard from 'component/rewardCard';
import RewardEnrolment from 'component/rewardEnrolment';
import RewardSummary from 'component/rewardSummary';
import UriBar from 'component/uriBar';
import rewardStyle from 'styles/reward';
@@ -105,9 +104,10 @@ class RewardsPage extends React.PureComponent {
if (this.state.isEmailVerified && this.state.isIdentityVerified && !this.state.isRewardApproved) {
return (
<View style={[rewardStyle.card, rewardStyle.verification]}>
<Text style={rewardStyle.title}>Manual Reward Verification</Text>
<Text style={rewardStyle.title}>{__('Manual Reward Verification')}</Text>
<Text style={rewardStyle.text}>
You need to be manually verified before you can start claiming rewards. Please request to be verified on the{' '}
__('You need to be manually verified before you can start claiming rewards.') Please request to be verified
on the{' '}
<Link
style={rewardStyle.greenLink}
href="https://discordapp.com/invite/Z3bERWA"
@@ -130,13 +130,15 @@ class RewardsPage extends React.PureComponent {
return (
<View style={rewardStyle.busyContainer}>
<ActivityIndicator size="large" color={Colors.NextLbryGreen} />
<Text style={rewardStyle.infoText}>Fetching rewards...</Text>
<Text style={rewardStyle.infoText}>{__('Fetching rewards...')}</Text>
</View>
);
} else if (user === null) {
return (
<View style={rewardStyle.busyContainer}>
<Text style={rewardStyle.infoText}>This app is unable to earn rewards due to an authentication failure.</Text>
<Text style={rewardStyle.infoText}>
{__('This app is unable to earn rewards due to an authentication failure.')}
</Text>
</View>
);
}
+2 -3
View File
@@ -109,8 +109,7 @@ class SearchPage extends React.PureComponent {
return (
<View style={searchStyle.noResults}>
<Text style={searchStyle.noResultsText}>
There are no results to display for <Text style={searchStyle.boldText}>{query}</Text>. Please try a different
search term.
{__('There are no results to display for "%query%". Please try a different search term.', { query })}
</Text>
</View>
);
@@ -143,7 +142,7 @@ class SearchPage extends React.PureComponent {
{showTagResult && (
<TouchableOpacity style={searchStyle.tagResultItem} onPress={() => this.handleTagResultPressed(query)}>
<Text style={searchStyle.tagResultTitle}>#{query.toLowerCase()}</Text>
<Text style={searchStyle.tagResultDescription}>Explore content for this tag</Text>
<Text style={searchStyle.tagResultDescription}>{__('Explore content for this tag')}</Text>
</TouchableOpacity>
)}
</View>
+3 -1
View File
@@ -1,5 +1,5 @@
import { connect } from 'react-redux';
import { SETTINGS } from 'lbry-redux';
import { SETTINGS, doToast } from 'lbry-redux';
import { doPushDrawerStack, doPopDrawerStack, doSetPlayerVisible } from 'redux/actions/drawer';
import { doSetClientSetting } from 'redux/actions/settings';
import { selectCurrentRoute, selectDrawerStack } from 'redux/selectors/drawer';
@@ -12,6 +12,7 @@ const select = state => ({
currentRoute: selectCurrentRoute(state),
drawerStack: selectDrawerStack(state),
keepDaemonRunning: makeSelectClientSetting(SETTINGS.KEEP_DAEMON_RUNNING)(state),
language: makeSelectClientSetting(SETTINGS.LANGUAGE)(state),
showNsfw: makeSelectClientSetting(SETTINGS.SHOW_NSFW)(state),
showUriBarSuggestions: makeSelectClientSetting(SETTINGS.SHOW_URI_BAR_SUGGESTIONS)(state),
receiveSubscriptionNotifications: makeSelectClientSetting(SETTINGS.RECEIVE_SUBSCRIPTION_NOTIFICATIONS)(state),
@@ -21,6 +22,7 @@ const select = state => ({
});
const perform = dispatch => ({
notify: data => dispatch(doToast(data)),
pushDrawerStack: () => dispatch(doPushDrawerStack(Constants.DRAWER_ROUTE_SETTINGS)),
popDrawerStack: () => dispatch(doPopDrawerStack()),
setClientSetting: (key, value) => dispatch(doSetClientSetting(key, value)),
+122 -16
View File
@@ -1,12 +1,33 @@
import React from 'react';
import { SETTINGS } from 'lbry-redux';
import { Text, View, ScrollView, Switch, NativeModules } from 'react-native';
import { __, navigateBack } from 'utils/helper';
import { ActivityIndicator, Picker, Platform, Text, View, ScrollView, Switch, NativeModules } from 'react-native';
import { navigateBack } 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
import PageHeader from 'component/pageHeader';
import RNFS from 'react-native-fs';
import settingsStyle from 'styles/settings';
const languageOptions = [
{ code: 'default', name: 'Use device language' },
{ code: 'en', name: 'English' },
{ code: 'gu', name: 'Gujarati' },
{ code: 'hi', name: 'Hindi' },
{ code: 'id', name: 'Indonesian' },
{ code: 'it', name: 'Italian' },
{ code: 'ms', name: 'Malay' },
{ code: 'tr', name: 'Turkish' },
{ code: 'pl', name: 'Polish' },
{ code: 'pt', name: 'Portuguese' },
{ code: 'es', name: 'Spanish' },
];
class SettingsPage extends React.PureComponent {
state = {
downloadingLanguage: false,
};
static navigationOptions = {
title: 'Settings',
};
@@ -53,17 +74,78 @@ class SettingsPage extends React.PureComponent {
return value === null || value === undefined ? defaultValue : value;
};
handleLanguageValueChange = value => {
const { notify, setClientSetting } = this.props;
let language;
if (value === 'default') {
language =
Platform.OS === 'android'
? NativeModules.I18nManager.localeIdentifier
: NativeModules.SettingsManager.settings.AppleLocale;
language = language ? language.substring(0, 2) : 'en';
} else {
language = value;
}
// check the local filesystem for the language first? Or download remote strings first?
if (language === 'en') {
// don't attempt to download English
NativeModules.UtilityModule.setNativeStringSetting(SETTINGS.LANGUAGE, language);
// update state and client setting
window.language = language;
setClientSetting(SETTINGS.LANGUAGE, value);
} else {
// download and save the language file
this.setState({ downloadingLanguage: true }, () => {
fetch('https://lbry.com/i18n/get/lbry-mobile/app-strings/' + language + '.json')
.then(r => r.json())
.then(j => {
window.i18n_messages[language] = j;
// write the language file to the filesystem
const langFilePath = RNFS.ExternalDirectoryPath + '/' + language + '.json';
RNFS.writeFile(langFilePath, JSON.stringify(j), 'utf8');
// save the setting outside redux because when the first component mounts, the redux value isn't loaded yet
// so we have to load it from native settings
NativeModules.UtilityModule.setNativeStringSetting(SETTINGS.LANGUAGE, language);
// update state and client setting
window.language = language;
setClientSetting(SETTINGS.LANGUAGE, value);
this.setState({ downloadingLanguage: false });
})
.catch(e => {
notify({ message: __('Failed to load %language% translations.', { language: language }), isError: true });
this.setState({ downloadingLanguage: false });
});
});
}
};
handleBackPressed = () => {
const { navigation, notify, drawerStack, popDrawerStack } = this.props;
if (this.state.downloadingLanguage) {
notify({ message: 'Please wait for the language file to finish downloading' });
return;
}
navigateBack(navigation, drawerStack, popDrawerStack);
};
render() {
const {
backgroundPlayEnabled,
drawerStack,
keepDaemonRunning,
navigation,
popDrawerStack,
receiveSubscriptionNotifications,
receiveRewardNotifications,
receiveInterestsNotifications,
receiveCreatorNotifications,
language,
showNsfw,
showUriBarSuggestions,
setClientSetting,
@@ -78,14 +160,14 @@ class SettingsPage extends React.PureComponent {
return (
<View style={settingsStyle.container}>
<PageHeader title={'Settings'} onBackPressed={() => navigateBack(navigation, drawerStack, popDrawerStack)} />
<PageHeader title={__('Settings')} onBackPressed={this.handleBackPressed} />
<ScrollView style={settingsStyle.scrollContainer}>
<Text style={settingsStyle.sectionTitle}>Content</Text>
<Text style={settingsStyle.sectionTitle}>{__('Content')}</Text>
<View style={settingsStyle.row}>
<View style={settingsStyle.switchText}>
<Text style={settingsStyle.label}>Enable background media playback</Text>
<Text style={settingsStyle.label}>{__('Enable background media playback')}</Text>
<Text style={settingsStyle.description}>
Enable this option to play audio or video in the background when the app is suspended.
{__('Enable this option to play audio or video in the background when the app is suspended.')}
</Text>
</View>
<View style={settingsStyle.switchContainer}>
@@ -96,9 +178,30 @@ class SettingsPage extends React.PureComponent {
</View>
</View>
<Text style={settingsStyle.sectionTitle}>{__('Language')}</Text>
<View style={settingsStyle.pickerRow}>
<View style={settingsStyle.pickerText}>
<Text style={settingsStyle.label}>{__('Choose language')}</Text>
</View>
<View style={settingsStyle.pickerContainer}>
{this.state.downloadingLanguage && <ActivityIndicator size={'small'} color={Colors.NextLbryGreen} />}
<Picker
enabled={!this.state.downloadingLanguage}
selectedValue={language || 'default'}
style={settingsStyle.languagePicker}
itemStyle={settingsStyle.languagePickerItem}
onValueChange={this.handleLanguageValueChange}
>
{languageOptions.map(option => (
<Picker.Item label={__(option.name)} value={option.code} key={option.code} />
))}
</Picker>
</View>
</View>
<View style={settingsStyle.row}>
<View style={settingsStyle.switchText}>
<Text style={settingsStyle.label}>Show mature content</Text>
<Text style={settingsStyle.label}>{__('Show mature content')}</Text>
</View>
<View style={settingsStyle.switchContainer}>
<Switch value={showNsfw} onValueChange={value => setClientSetting(SETTINGS.SHOW_NSFW, value)} />
@@ -169,10 +272,10 @@ class SettingsPage extends React.PureComponent {
)}
<View style={settingsStyle.sectionDivider} />
<Text style={settingsStyle.sectionTitle}>Search</Text>
<Text style={settingsStyle.sectionTitle}>{__('Search')}</Text>
<View style={settingsStyle.row}>
<View style={settingsStyle.switchText}>
<Text style={settingsStyle.label}>Show URL suggestions</Text>
<Text style={settingsStyle.label}>{__('Show URL suggestions')}</Text>
</View>
<View style={settingsStyle.switchContainer}>
<Switch
@@ -183,13 +286,16 @@ class SettingsPage extends React.PureComponent {
</View>
<View style={settingsStyle.sectionDivider} />
<Text style={settingsStyle.sectionTitle}>Other</Text>
<Text style={settingsStyle.sectionTitle}>{__('Other')}</Text>
<View style={settingsStyle.row}>
<View style={settingsStyle.switchText}>
<Text style={settingsStyle.label}>Keep the daemon background service running after closing the app</Text>
<Text style={settingsStyle.label}>
{__('Keep the SDK background service running after closing the app')}
</Text>
<Text style={settingsStyle.description}>
Enable this option for quicker app launch and to keep the synchronisation with the blockchain up to
date.
{__(
'Enable this option for quicker app launch and to keep the synchronisation with the blockchain up to date.'
)}
</Text>
</View>
<View style={settingsStyle.switchContainer}>
+1 -1
View File
@@ -1,5 +1,5 @@
import { connect } from 'react-redux';
import { doBalanceSubscribe, doUpdateBlockHeight, doPopulateSharedUserState, doToast } from 'lbry-redux';
import { SETTINGS, doBalanceSubscribe, doUpdateBlockHeight, doPopulateSharedUserState, doToast } from 'lbry-redux';
import {
doAuthenticate,
doBlackListedOutpointsSubscribe,
+38 -36
View File
@@ -13,12 +13,10 @@ import PropTypes from 'prop-types';
import Colors from 'styles/colors';
import Constants from 'constants'; // eslint-disable-line node/no-deprecated-api
import splashStyle from 'styles/splash';
import RNFS from 'react-native-fs';
const BLOCK_HEIGHT_INTERVAL = 1000 * 60 * 2.5; // every 2.5 minutes
const testingNetwork = 'Testing network';
const waitingForResolution = 'Waiting for name resolution';
class SplashScreen extends React.PureComponent {
static navigationOptions = {
title: 'Splash',
@@ -27,8 +25,8 @@ class SplashScreen extends React.PureComponent {
state = {
accountUnlockFailed: false,
daemonReady: false,
details: 'Starting up',
message: 'Connecting',
details: __('Starting up'),
message: __('Connecting'),
isRunning: false,
isLagging: false,
launchUrl: null,
@@ -69,13 +67,13 @@ class SplashScreen extends React.PureComponent {
try {
verifyUserEmail(verification.token, verification.recaptcha);
} catch (error) {
const message = 'Invalid Verification Token';
const message = __('Invalid Verification Token');
verifyUserEmailFailure(message);
notify({ message });
}
} else {
notify({
message: 'Invalid Verification URI',
message: __('Invalid Verification URI'),
});
}
} else {
@@ -159,7 +157,6 @@ class SplashScreen extends React.PureComponent {
this.setState({ shouldAuthenticate: true });
NativeModules.Firebase.getMessagingToken()
.then(firebaseToken => {
console.log(firebaseToken);
authenticate(appVersion, Platform.OS, firebaseToken);
})
.catch(() => authenticate(appVersion, Platform.OS));
@@ -174,7 +171,6 @@ class SplashScreen extends React.PureComponent {
_updateStatusCallback(status) {
const { fetchSubscriptions, getSync, setClientSetting } = this.props;
const blockchainHeaders = status.blockchain_headers;
const startupStatus = status.startup_status;
const walletStatus = status.wallet;
@@ -196,16 +192,16 @@ class SplashScreen extends React.PureComponent {
NativeModules.UtilityModule.getSecureValue(Constants.KEY_WALLET_PASSWORD).then(password => {
if ((secureWalletStatus.is_encrypted && !secureWalletStatus.is_locked) || secureWalletStatus.is_locked) {
this.setState({
message: 'Unlocking account',
details: 'Decrypting wallet',
message: __('Unlocking account'),
details: __('Decrypting wallet'),
});
// unlock the wallet and then finish the splash screen
Lbry.wallet_unlock({ password: password || '' }).then(unlocked => {
if (unlocked) {
this.setState({
message: testingNetwork,
details: waitingForResolution,
message: __('Testing network'),
details: __('Waiting for name resolution'),
});
this.finishSplashScreen();
} else {
@@ -214,8 +210,8 @@ class SplashScreen extends React.PureComponent {
});
} else {
this.setState({
message: testingNetwork,
details: waitingForResolution,
message: __('Testing network'),
details: __('Waiting for name resolution'),
});
this.finishSplashScreen();
}
@@ -225,10 +221,11 @@ class SplashScreen extends React.PureComponent {
return;
}
if (blockchainHeaders) {
const headerSyncProgress = walletStatus ? walletStatus.headers_synchronization_progress : null;
if (headerSyncProgress && headerSyncProgress < 100) {
this.setState({
isDownloadingHeaders: blockchainHeaders.downloading_headers,
headersDownloadProgress: blockchainHeaders.download_progress,
isDownloadingHeaders: true,
headersDownloadProgress: headerSyncProgress,
});
} else {
// set downloading flag to false if blockchain_headers isn't in the status response
@@ -237,23 +234,24 @@ class SplashScreen extends React.PureComponent {
});
}
if (blockchainHeaders && blockchainHeaders.downloading_headers) {
const downloadProgress = blockchainHeaders.download_progress ? blockchainHeaders.download_progress : 0;
if (headerSyncProgress < 100) {
const downloadProgress = isNaN(parseInt(headerSyncProgress, 10)) ? '0' : headerSyncProgress || '0';
this.setState({
message: 'Blockchain Sync',
details: `Catching up with the blockchain (${downloadProgress}%)`,
message: __('Blockchain Sync'),
details: __('Catching up with the blockchain (%progress%%)', { progress: downloadProgress }),
});
} else if (walletStatus && walletStatus.blocks_behind > 0) {
const behind = walletStatus.blocks_behind;
const behindText = behind + ' block' + (behind === 1 ? '' : 's') + ' behind';
const behindText =
behind === 1 ? __('%num% block behind', { num: behind }) : __('%num% blocks behind', { num: behind });
this.setState({
message: 'Blockchain Sync',
message: __('Blockchain Sync'),
details: behindText,
});
} else {
this.setState({
message: 'Network Loading',
details: 'Initializing LBRY service',
message: __('Network Loading'),
details: __('Initializing LBRY service'),
});
}
@@ -293,9 +291,10 @@ class SplashScreen extends React.PureComponent {
.catch(e => {
this.setState({
isLagging: true,
message: 'Connection Failure',
details:
'We could not establish a connection to the daemon. Your data connection may be preventing LBRY from connecting. Contact hello@lbry.com if you think this is a software bug.',
message: __('Connection Failure'),
details: __(
'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.'
),
});
});
});
@@ -316,8 +315,8 @@ class SplashScreen extends React.PureComponent {
this.setState(
{
accountUnlockFailed: false,
message: testingNetwork,
details: waitingForResolution,
message: __('Testing network'),
details: __('Waiting for name resolution'),
},
() => this.finishSplashScreen()
);
@@ -329,19 +328,22 @@ class SplashScreen extends React.PureComponent {
if (accountUnlockFailed) {
return (
<View style={splashStyle.container}>
<Text style={splashStyle.errorTitle}>Oops! Something went wrong.</Text>
<Text style={splashStyle.errorTitle}>{__('Oops! Something went wrong.')}</Text>
<Text style={splashStyle.paragraph}>
Your wallet failed to unlock, which means you may not be able to play any videos or access your funds.
{__(
'Your wallet failed to unlock, which means you may not be able to play any videos or access your funds.'
)}
</Text>
<Text style={splashStyle.paragraph}>
You can try to fix this by tapping Stop on the LBRY service notification and starting the app again. If the
problem continues, you may have to reinstall the app and restore your account.
{__(
'You can try to fix this by tapping Stop on the LBRY service notification and starting the app again. If the problem continues, you may have to reinstall the app and restore your account.'
)}
</Text>
<Button
style={splashStyle.continueButton}
theme={'light'}
text={'Continue anyway'}
text={__('Continue anyway')}
onPress={this.handleContinueAnywayPressed}
/>
</View>
+10 -8
View File
@@ -11,7 +11,7 @@ import {
View,
} from 'react-native';
import { buildURI, parseURI } from 'lbry-redux';
import { __, getOrderBy } from 'utils/helper';
import { getOrderBy } from 'utils/helper';
import AsyncStorage from '@react-native-community/async-storage';
import moment from 'moment';
import Button from 'component/button';
@@ -149,7 +149,7 @@ class SubscriptionsPage extends React.PureComponent {
<View style={subscriptionsStyle.container}>
<UriBar navigation={navigation} belowOverlay={this.state.showSortPicker} />
<View style={subscriptionsStyle.titleRow}>
<Text style={subscriptionsStyle.pageTitle}>Channels you follow</Text>
<Text style={subscriptionsStyle.pageTitle}>{__('Channels you follow')}</Text>
</View>
{!this.state.showingSuggestedSubs && hasSubscriptions && (
<View style={subscriptionsStyle.pickerRow}>
@@ -158,7 +158,7 @@ class SubscriptionsPage extends React.PureComponent {
style={subscriptionsStyle.tagSortBy}
onPress={() => this.setState({ showSortPicker: true })}
>
<Text style={subscriptionsStyle.tagSortText}>{currentSortByItem.label.split(' ')[0]}</Text>
<Text style={subscriptionsStyle.tagSortText}>{__(currentSortByItem.label.split(' ')[0])}</Text>
<Icon style={subscriptionsStyle.tagSortIcon} name={'sort-down'} size={14} />
</TouchableOpacity>
@@ -167,7 +167,7 @@ class SubscriptionsPage extends React.PureComponent {
style={subscriptionsStyle.tagSortBy}
onPress={() => this.setState({ showTimePicker: true })}
>
<Text style={subscriptionsStyle.tagSortText}>{timeItem.label}</Text>
<Text style={subscriptionsStyle.tagSortText}>{__(timeItem.label)}</Text>
<Icon style={subscriptionsStyle.tagSortIcon} name={'sort-down'} size={14} />
</TouchableOpacity>
)}
@@ -175,7 +175,7 @@ class SubscriptionsPage extends React.PureComponent {
<Link
style={subscriptionsStyle.suggestedLink}
text={'Suggested'}
text={__('Suggested')}
onPress={() => this.setState({ showModalSuggestedSubs: true })}
/>
</View>
@@ -207,7 +207,9 @@ class SubscriptionsPage extends React.PureComponent {
<View style={subscriptionsStyle.suggestedSubsContainer}>
{!hasSubscriptions && (
<View style={subscriptionsStyle.infoArea}>
<Text style={subscriptionsStyle.infoText}>You are not subscribed to any channels at the moment.</Text>
<Text style={subscriptionsStyle.infoText}>
{__('You are not subscribed to any channels at the moment.')}
</Text>
</View>
)}
@@ -218,7 +220,7 @@ class SubscriptionsPage extends React.PureComponent {
</Text>
<Button
style={subscriptionsStyle.button}
text={'View my subscriptions'}
text={__('View my subscriptions')}
onPress={() => this.setState({ showingSuggestedSubs: false })}
/>
</View>
@@ -241,7 +243,7 @@ class SubscriptionsPage extends React.PureComponent {
title={__('Sort content by')}
onOverlayPress={() => this.setState({ showSortPicker: false })}
onItemSelected={this.handleSortByItemSelected}
selectedItem={this.state.currentSortByItem}
selectedItem={currentSortByItem}
items={Constants.CLAIM_SEARCH_SORT_BY_ITEMS}
/>
)}
+3 -3
View File
@@ -105,12 +105,12 @@ class TagPage extends React.PureComponent {
<View style={discoverStyle.pickerRow}>
<View style={discoverStyle.leftPickerRow}>
<TouchableOpacity style={discoverStyle.tagSortBy} onPress={() => this.setState({ showSortPicker: true })}>
<Text style={discoverStyle.tagSortText}>{sortByItem.label.split(' ')[0]}</Text>
<Text style={discoverStyle.tagSortText}>{__(sortByItem.label.split(' ')[0])}</Text>
<Icon style={discoverStyle.tagSortIcon} name={'sort-down'} size={14} />
</TouchableOpacity>
{Constants.SORT_BY_TOP === sortByItem.name && (
<TouchableOpacity style={discoverStyle.tagTime} onPress={() => this.setState({ showTimePicker: true })}>
<Text style={discoverStyle.tagSortText}>{timeItem.label}</Text>
<Text style={discoverStyle.tagSortText}>{__(timeItem.label)}</Text>
<Icon style={discoverStyle.tagSortIcon} name={'sort-down'} size={14} />
</TouchableOpacity>
)}
@@ -118,7 +118,7 @@ class TagPage extends React.PureComponent {
<Link
style={discoverStyle.customizeLink}
text={this.isFollowingTag(tag) ? 'Unfollow' : 'Follow'}
text={this.isFollowingTag(tag) ? __('Unfollow') : __('Follow')}
onPress={this.handleFollowTagToggle}
/>
</View>
+4 -2
View File
@@ -51,10 +51,12 @@ class TransactionHistoryPage extends React.PureComponent {
{fetchingTransactions && (
<View style={walletStyle.loadingContainer}>
<ActivityIndicator size={'small'} color={Colors.NextLbryGreen} />
<Text style={walletStyle.loadingText}>Loading transactions...</Text>
<Text style={walletStyle.loadingText}>{__('Loading transactions...')}</Text>
</View>
)}
{!fetchingTransactions && transactions.length === 0 && <EmptyStateView message={'No transactions to list.'} />}
{!fetchingTransactions && transactions.length === 0 && (
<EmptyStateView message={__('No transactions to list.')} />
)}
<ScrollView style={walletStyle.transactionHistoryScroll}>
<View style={walletStyle.historyList}>
{!fetchingTransactions && transactions && transactions.length > 0 && (
+8 -8
View File
@@ -92,7 +92,7 @@ class TrendingPage extends React.PureComponent {
return (
<View style={discoverStyle.listHeader}>
<View style={discoverStyle.titleRow}>
<Text style={discoverStyle.pageTitle}>All content</Text>
<Text style={discoverStyle.pageTitle}>{__('All Content')}</Text>
</View>
<View style={discoverStyle.pickerRow}>
<View style={discoverStyle.leftPickerRow}>
@@ -100,24 +100,24 @@ class TrendingPage extends React.PureComponent {
style={discoverStyle.allTagSortBy}
onPress={() => this.setState({ showSortPicker: true })}
>
<Text style={discoverStyle.tagSortText}>{sortByItem.label.split(' ')[0]}</Text>
<Text style={discoverStyle.tagSortText}>{__(sortByItem.label.split(' ')[0])}</Text>
<Icon style={discoverStyle.tagSortIcon} name={'sort-down'} size={14} />
</TouchableOpacity>
<Text style={discoverStyle.pickerLabel}>for</Text>
<Text style={discoverStyle.pickerLabel}>{__('for')}</Text>
<TouchableOpacity
style={discoverStyle.allTagSortBy}
onPress={() => this.setState({ showTrendingForPicker: true })}
>
<Text style={discoverStyle.tagSortText}>{currentTrendingForItem.label.split(' ')[0]}</Text>
<Text style={discoverStyle.tagSortText}>{__(currentTrendingForItem.label.split(' ')[0])}</Text>
<Icon style={discoverStyle.tagSortIcon} name={'sort-down'} size={14} />
</TouchableOpacity>
{sortByTop && <Text style={discoverStyle.pickerLabel}>from</Text>}
{sortByTop && <Text style={discoverStyle.pickerLabel}>{__('from')}</Text>}
{sortByTop && (
<TouchableOpacity style={discoverStyle.tagTime} onPress={() => this.setState({ showTimePicker: true })}>
<Text style={discoverStyle.tagSortText}>{timeItem.label}</Text>
<Text style={discoverStyle.tagSortText}>{__(timeItem.label)}</Text>
<Icon style={discoverStyle.tagSortIcon} name={'sort-down'} size={14} />
</TouchableOpacity>
)}
@@ -126,7 +126,7 @@ class TrendingPage extends React.PureComponent {
{TRENDING_FOR_ITEMS[1].name === currentTrendingForItem.name && (
<Link
style={discoverStyle.customizeLink}
text={'Customize'}
text={__('Customize')}
onPress={() => this.setState({ showModalTagSelector: true })}
/>
)}
@@ -170,7 +170,7 @@ class TrendingPage extends React.PureComponent {
)}
{showTrendingForPicker && (
<ModalPicker
title={'Filter for'}
title={__('Filter for')}
onOverlayPress={() => this.setState({ showTrendingForPicker: false })}
onItemSelected={this.handleTrendingForItemSelected}
selectedItem={currentTrendingForItem}
+4 -1
View File
@@ -1,5 +1,5 @@
import { connect } from 'react-redux';
import { doToast } from 'lbry-redux';
import { doToast, doPopulateSharedUserState } from 'lbry-redux';
import {
doCheckSync,
doGetSync,
@@ -14,6 +14,7 @@ import {
selectPhoneToVerify,
selectPhoneVerifyIsPending,
selectPhoneVerifyErrorMessage,
selectEmailAlreadyExists,
selectEmailNewErrorMessage,
selectEmailNewIsPending,
selectEmailToVerify,
@@ -32,6 +33,7 @@ import Constants from 'constants'; // eslint-disable-line node/no-deprecated-api
import Verification from './view';
const select = state => ({
emailAlreadyExists: selectEmailAlreadyExists(state),
emailToVerify: selectEmailToVerify(state),
emailNewErrorMessage: selectEmailNewErrorMessage(state),
emailNewPending: selectEmailNewIsPending(state),
@@ -58,6 +60,7 @@ const perform = dispatch => ({
checkSync: () => dispatch(doCheckSync()),
verifyPhone: verificationCode => dispatch(doUserPhoneVerify(verificationCode)),
notify: data => dispatch(doToast(data)),
populateSharedUserState: settings => dispatch(doPopulateSharedUserState(settings)),
setClientSetting: (key, value) => dispatch(doSetClientSetting(key, value)),
setEmailToVerify: email => dispatch(doUserEmailToVerify(email)),
syncApply: (hash, data, password) => dispatch(doSyncApply(hash, data, password)),
@@ -49,7 +49,7 @@ class EmailVerifyPage extends React.PureComponent {
if (setEmailVerificationPhase) {
setEmailVerificationPhase(true);
}
// notify({ message: 'Please follow the instructions in the email sent to your address to continue.' });
// notify({ message: __('Please follow the instructions in the email sent to your address to continue.') });
AsyncStorage.setItem(Constants.KEY_EMAIL_VERIFY_PENDING, 'true');
}
}
@@ -65,7 +65,7 @@ class EmailVerifyPage extends React.PureComponent {
const { email } = this.state;
if (!email || email.trim().length === 0 || email.indexOf('@') === -1) {
return notify({
message: 'Please provide a valid email address to continue.',
message: __('Please provide a valid email address to continue.'),
});
}
@@ -89,7 +89,7 @@ class EmailVerifyPage extends React.PureComponent {
// resend verification email if there was one previously set (and it wasn't changed)
resendVerificationEmail(this.state.email);
AsyncStorage.setItem(Constants.KEY_EMAIL_VERIFY_PENDING, 'true');
notify({ message: 'Please follow the instructions in the email sent to your address to continue.' });
notify({ message: __('Please follow the instructions in the email sent to your address to continue.') });
};
onEditPressed = () => {
@@ -105,16 +105,20 @@ class EmailVerifyPage extends React.PureComponent {
};
render() {
const { emailNewPending } = this.props;
const { emailAlreadyExists, emailNewPending } = this.props;
return (
<View style={firstRunStyle.container}>
<Text style={rewardStyle.verificationTitle}>
{Constants.PHASE_COLLECTION === this.state.phase ? 'Email' : 'Verify Email'}
{Constants.PHASE_COLLECTION === this.state.phase
? __('Email')
: emailAlreadyExists
? __('Sign In')
: __('Verify Email')}
</Text>
{Constants.PHASE_COLLECTION === this.state.phase && (
<View>
<Text style={firstRunStyle.paragraph}>Please provide an email address.</Text>
<Text style={firstRunStyle.paragraph}>{__('Please provide an email address.')}</Text>
<TextInput
style={firstRunStyle.emailInput}
placeholder={this.state.placeholder}
@@ -138,7 +142,7 @@ class EmailVerifyPage extends React.PureComponent {
<Button
style={rewardStyle.verificationButton}
theme={'light'}
text={'Send verification email'}
text={__('Continue')}
onPress={this.onSendVerificationPressed}
/>
)}
@@ -154,18 +158,22 @@ class EmailVerifyPage extends React.PureComponent {
{Constants.PHASE_VERIFICATION === this.state.phase && (
<View>
<Text style={firstRunStyle.paragraph}>
An email has been sent to <Text style={firstRunStyle.nowrap}>{this.state.email}</Text>. Please follow the
instructions in the message to verify your email address.
{__('An email has been sent to')}
{'\n\n'}
{this.state.email}
{'\n\n'}
{emailAlreadyExists && __('Please click the link in the message to complete signing in.')}
{!emailAlreadyExists && __('Please click the link in the message to verify your email address')}
</Text>
<View style={rewardStyle.buttonContainer}>
<Button
style={rewardStyle.verificationButton}
theme={'light'}
text={'Resend'}
text={__('Resend')}
onPress={this.onResendPressed}
/>
<Link style={rewardStyle.verificationLink} text={'Edit'} onPress={this.onEditPressed} />
<Link style={rewardStyle.verificationLink} text={__('Edit')} onPress={this.onEditPressed} />
</View>
</View>
)}
@@ -5,7 +5,7 @@ import AsyncStorage from '@react-native-community/async-storage';
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 rewardStyle from 'styles/reward';
@@ -20,21 +20,22 @@ class ManualVerifyPage extends React.PureComponent {
render() {
return (
<View style={firstRunStyle.container}>
<Text style={rewardStyle.verificationTitle}>Manual Reward Verification</Text>
<Text style={rewardStyle.verificationTitle}>{__('Manual Reward Verification')}</Text>
<Text style={firstRunStyle.spacedParagraph}>
This account must undergo review before you can participate in the rewards program. This can take anywhere
from several minutes to several days.
{__(
'This account must undergo review before you can participate in the rewards program. This can take anywhere from several minutes to several days.'
)}
</Text>
<Text style={firstRunStyle.spacedParagraph}>
If you continue to see this message, please request to be verified on the{' '}
{__('If you continue to see this message, please request to be verified on the')}{' '}
<Link
style={rewardStyle.underlinedTextLink}
href="https://discordapp.com/invite/Z3bERWA"
text="LBRY Discord server"
text={__('LBRY Discord server')}
/>
.
</Text>
<Text style={firstRunStyle.spacedParagraph}>Please enjoy free content in the meantime!</Text>
<Text style={firstRunStyle.spacedParagraph}>{__('Please enjoy free content in the meantime!')}</Text>
</View>
);
}
@@ -13,7 +13,7 @@ import {
import AsyncStorage from '@react-native-community/async-storage';
import Button from 'component/button';
import Colors from 'styles/colors';
import Constants from 'constants';
import Constants from 'constants'; // eslint-disable-line node/no-deprecated-api
import CountryPicker from 'react-native-country-picker-modal';
import Icon from 'react-native-vector-icons/FontAwesome5';
import Link from 'component/link';
@@ -75,7 +75,7 @@ class PhoneVerifyPage extends React.PureComponent {
notify({ message: String(phoneVerifyErrorMessage) });
this.setState({ codeVerifyStarted: false, phoneVerifyFailed: true });
} else {
notify({ message: 'Your phone number was successfully verified.' });
notify({ message: __('Your phone number was successfully verified.') });
this.setState({ codeVerifySuccessful: true, phoneVerifyFailed: false });
if (onPhoneVerifySuccessful) {
onPhoneVerifySuccessful();
@@ -103,7 +103,7 @@ class PhoneVerifyPage extends React.PureComponent {
if (!this.phoneInput.isValidNumber()) {
return notify({
message: 'Please provide a valid telephone number.',
message: __('Please provide a valid telephone number.'),
});
}
@@ -145,14 +145,14 @@ class PhoneVerifyPage extends React.PureComponent {
return (
<View style={firstRunStyle.container}>
<Text style={rewardStyle.verificationTitle}>
{this.state.phase === Constants.PHASE_VERIFICATION ? 'Verify ' : ''}Phone Number
{this.state.phase === Constants.PHASE_VERIFICATION ? __('Verify Phone Number') : __('Phone Number')}
</Text>
<View style={rewardStyle.phoneVerificationContainer}>
{this.state.phase == Constants.PHASE_COLLECTION && (
{this.state.phase === Constants.PHASE_COLLECTION && (
<View>
<Text style={[rewardStyle.bottomMarginMedium, firstRunStyle.paragraph]}>
Please provide a phone number to prevent fraud.
{__('Please provide a phone number to prevent fraud.')}
</Text>
<PhoneInput
ref={ref => {
@@ -169,7 +169,7 @@ class PhoneVerifyPage extends React.PureComponent {
<Button
style={[rewardStyle.verificationButton, rewardStyle.topMarginMedium]}
theme={'light'}
text={'Send verification text'}
text={__('Send verification text')}
onPress={this.onSendTextPressed}
/>
)}
@@ -187,7 +187,7 @@ class PhoneVerifyPage extends React.PureComponent {
{!phoneVerifyIsPending && !this.codeVerifyStarted && (
<View>
<Text style={[rewardStyle.bottomMarginSmall, firstRunStyle.paragraph]}>
Please enter the verification code sent to {phone}.
{__('Please enter the verification code sent to %phone%', { phone })}.
</Text>
<TextInput
style={rewardStyle.verificationCodeInput}
@@ -202,16 +202,16 @@ class PhoneVerifyPage extends React.PureComponent {
<Button
style={[rewardStyle.verificationButton, rewardStyle.topMarginSmall]}
theme={'light'}
text={'Verify'}
text={__('Verify')}
onPress={this.onVerifyPressed}
/>
<Link style={rewardStyle.verificationLink} text={'Edit'} onPress={this.onEditPressed} />
<Link style={rewardStyle.verificationLink} text={__('Edit')} onPress={this.onEditPressed} />
</View>
</View>
)}
{phoneVerifyIsPending && (
<View style={firstRunStyle.centered}>
<Text style={firstRunStyle.paragraph}>Verifying your phone number...</Text>
<Text style={firstRunStyle.paragraph}>{__('Verifying your phone number...')}</Text>
<ActivityIndicator
color={Colors.White}
size="small"
@@ -237,9 +237,9 @@ class PhoneVerifyPage extends React.PureComponent {
this.picker = picker;
}}
cca2={this.state.cca2}
filterable={true}
filterable
onChange={value => this.selectCountry(value)}
showCallingCode={true}
showCallingCode
translation="eng"
>
<View />
@@ -14,10 +14,15 @@ class SyncVerifyPage extends React.PureComponent {
state = {
checkSyncStarted: false,
password: null,
placeholder: 'password',
placeholder: __('password'),
syncApplyStarted: false,
syncApplyCompleted: false,
syncChecked: false,
revealPassword: false,
autoPassword: false,
autoLoginAttempted: false,
autoLoginTried: false,
autoLoginFlow: true,
};
componentDidMount() {
@@ -63,10 +68,14 @@ class SyncVerifyPage extends React.PureComponent {
if (this.state.syncApplyStarted && !syncApplyIsPending) {
if (syncApplyErrorMessage && syncApplyErrorMessage.trim().length > 0) {
notify({ message: syncApplyErrorMessage, isError: true });
this.setState({ syncApplyStarted: false });
if (this.state.autoLoginTried) {
notify({ message: __(syncApplyErrorMessage), isError: true });
}
this.setState({ autoLoginTried: true, syncApplyStarted: false, autoLoginFlow: false });
} else {
// password successfully verified
this.setState({ syncApplyCompleted: true });
if (NativeModules.UtilityModule) {
NativeModules.UtilityModule.setSecureValue(
Constants.KEY_WALLET_PASSWORD,
@@ -79,6 +88,19 @@ class SyncVerifyPage extends React.PureComponent {
}
}
componentDidUpdate() {
const { hasSyncedWallet } = this.props;
if (this.state.syncChecked && !this.state.autoPassword && !hasSyncedWallet) {
// new user sync, don't prompt for a password
this.setState({ password: '', autoPassword: true });
this.onEnableSyncPressed();
}
if (this.state.syncChecked && hasSyncedWallet && !this.state.autoLoginAttempted) {
this.setState({ autoLoginAttempted: true, password: '' }, () => this.onEnableSyncPressed());
}
}
finishSync = (notifyUnlockFailed = false) => {
const { navigation, notify, setClientSetting } = this.props;
@@ -92,7 +114,7 @@ class SyncVerifyPage extends React.PureComponent {
navigation.goBack();
} else {
if (notifyUnlockFailed) {
notify({ message: 'The wallet could not be unlocked at this time. Please restart the app.' });
notify({ message: __('The wallet could not be unlocked at this time. Please restart the app.') });
}
}
});
@@ -112,16 +134,16 @@ class SyncVerifyPage extends React.PureComponent {
};
render() {
const { hasSyncedWallet, syncApplyIsPending } = this.props;
const { hasSyncedWallet, syncApplyIsPending, signInFlow } = this.props;
let paragraph;
if (!hasSyncedWallet) {
paragraph = (
<Text style={firstRunStyle.paragraph}>Please enter a password to secure your account and wallet.</Text>
<Text style={firstRunStyle.paragraph}>{__('Please enter a password to secure your account and wallet.')}</Text>
);
} else {
paragraph = (
<Text style={firstRunStyle.paragraph}>Please enter the password you used to secure your wallet.</Text>
<Text style={firstRunStyle.paragraph}>{__('Please enter the password you used to secure your wallet.')}</Text>
);
}
@@ -130,13 +152,22 @@ class SyncVerifyPage extends React.PureComponent {
content = (
<View style={firstRunStyle.centered}>
<ActivityIndicator size="large" color={Colors.White} style={firstRunStyle.waiting} />
<Text style={firstRunStyle.paragraph}>Retrieving your account information...</Text>
<Text style={firstRunStyle.paragraph}>{__('Retrieving your account information...')}</Text>
</View>
);
} else {
} else if (this.state.autoLoginFlow && (syncApplyIsPending || this.state.syncApplyCompleted)) {
// first attempt at auto-login, only display activity indicator
content = (
<View>
<Text style={rewardStyle.verificationTitle}>Wallet Sync</Text>
<View style={firstRunStyle.centerInside}>
<ActivityIndicator size={'small'} color={Colors.White} />
</View>
</View>
);
} else if (hasSyncedWallet && this.state.autoLoginAttempted) {
content = (
<View>
<Text style={rewardStyle.verificationTitle}>{__('Wallet Sync')}</Text>
{paragraph}
<View style={firstRunStyle.passwordInputContainer}>
<TextInput
@@ -154,7 +185,7 @@ class SyncVerifyPage extends React.PureComponent {
}}
onBlur={() => {
if (!this.state.password || this.state.password.length === 0) {
this.setState({ placeholder: 'password' });
this.setState({ placeholder: __('password') });
}
}}
/>
@@ -166,16 +197,6 @@ class SyncVerifyPage extends React.PureComponent {
</TouchableOpacity>
</View>
{(!this.state.password || this.state.password.trim().length === 0) && (
<View style={firstRunStyle.passwordWarning}>
<Text style={firstRunStyle.passwordWarningText}>
{hasSyncedWallet
? 'If you did not provide a password, please press Use LBRY to continue.'
: 'You can proceed without a password, but this is not recommended.'}
</Text>
</View>
)}
{(!hasSyncedWallet && this.state.password && this.state.password.trim().length) > 0 && (
<View style={firstRunStyle.passwordStrength}>
<BarPasswordStrengthDisplay
@@ -186,7 +207,7 @@ class SyncVerifyPage extends React.PureComponent {
</View>
)}
<Text style={firstRunStyle.infoParagraph}>
Note: for wallet security purposes, LBRY is unable to reset your password.
{__('Note: for wallet security purposes, LBRY is unable to reset your password.')}
</Text>
<View style={rewardStyle.buttonContainer}>
@@ -194,11 +215,11 @@ class SyncVerifyPage extends React.PureComponent {
<Button
style={rewardStyle.verificationButton}
theme={'light'}
text={'Enable sync'}
text={signInFlow ? __('Use LBRY') : __('Enable sync')}
onPress={this.onEnableSyncPressed}
/>
)}
{syncApplyIsPending && (
{(syncApplyIsPending || this.state.syncApplyCompleted) && (
<View style={firstRunStyle.centerInside}>
<ActivityIndicator size={'small'} color={Colors.White} />
</View>
+32 -5
View File
@@ -1,10 +1,11 @@
import React from 'react';
import { Lbry } from 'lbry-redux';
import { Lbry, doPreferenceGet } from 'lbry-redux';
import { ActivityIndicator, Linking, NativeModules, Text, TouchableOpacity, View } from 'react-native';
import { NavigationActions, StackActions } from 'react-navigation';
import AsyncStorage from '@react-native-community/async-storage';
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 EmailVerifyPage from './internal/email-verify-page';
import ManualVerifyPage from './internal/manual-verify-page';
import PhoneVerifyPage from './internal/phone-verify-page';
@@ -19,6 +20,7 @@ class VerificationScreen extends React.PureComponent {
showSkip: false,
skipAccountConfirmed: false,
showBottomContainer: true,
signInFlow: false,
walletPassword: null,
isEmailVerificationPhase: false,
isEmailVerified: false,
@@ -27,7 +29,9 @@ class VerificationScreen extends React.PureComponent {
};
componentDidMount() {
const { user } = this.props;
const { user, navigation } = this.props;
const { signInFlow } = navigation.state.params;
this.setState({ signInFlow });
this.checkVerificationStatus(user);
NativeModules.Firebase.setCurrentScreen('Verification');
}
@@ -36,8 +40,22 @@ class VerificationScreen extends React.PureComponent {
this.setState({ isEmailVerificationPhase: value });
};
getUserSettings = () => {
const { populateSharedUserState } = this.props;
doPreferenceGet(
'shared',
preference => {
populateSharedUserState(preference);
},
error => {
/* failed */
}
);
};
checkVerificationStatus = user => {
const { deviceWalletSynced, navigation } = this.props;
const { deviceWalletSynced, getSync, navigation } = this.props;
const { syncFlow } = navigation.state.params;
this.setState(
@@ -57,7 +75,13 @@ class VerificationScreen extends React.PureComponent {
}
if (this.state.isEmailVerified && syncFlow && deviceWalletSynced) {
navigation.goBack();
// retrieve user settings
NativeModules.UtilityModule.getSecureValue(Constants.KEY_WALLET_PASSWORD).then(walletPassword => {
getSync(walletPassword, () => {
this.getUserSettings();
navigation.goBack();
});
});
}
} else {
if (this.state.isEmailVerified && !this.state.isIdentityVerified && !this.state.isRewardApproved) {
@@ -94,6 +118,7 @@ class VerificationScreen extends React.PureComponent {
addUserEmail,
checkSync,
emailNewErrorMessage,
emailAlreadyExists,
emailNewPending,
emailToVerify,
getSync,
@@ -124,6 +149,7 @@ class VerificationScreen extends React.PureComponent {
page = (
<EmailVerifyPage
addUserEmail={addUserEmail}
emailAlreadyExists={emailAlreadyExists}
emailNewErrorMessage={emailNewErrorMessage}
emailNewPending={emailNewPending}
emailToVerify={emailToVerify}
@@ -167,6 +193,7 @@ class VerificationScreen extends React.PureComponent {
syncApply={syncApply}
syncData={syncData}
syncHash={syncHash}
signInFlow={this.state.signInFlow}
/>
);
break;
@@ -182,7 +209,7 @@ class VerificationScreen extends React.PureComponent {
{!this.state.isEmailVerificationPhase && (
<TouchableOpacity style={firstRunStyle.closeButton} onPress={this.onCloseButtonPressed}>
<Text style={firstRunStyle.closeButtonText}>x</Text>
<Icon name={'times'} size={16} style={firstRunStyle.closeButtonIcon} />
</TouchableOpacity>
)}
</View>
-95
View File
@@ -1,95 +0,0 @@
// @flow
import { NativeModules } from 'react-native';
import {
ACTIONS,
batchActions,
buildURI,
doResolveUri,
doUpdateSearchQuery,
makeSelectSearchUris,
selectSuggestions,
makeSelectQueryWithOptions,
selectSearchValue,
} from 'lbry-redux';
let CONNECTION_STRING = 'https://lighthouse.lbry.com/';
const handleNativeFetchResponse = str => {
const json = JSON.parse(str);
if (json.error) {
return Promise.reject(new Error(json.error));
}
return Promise.resolve(json);
};
// Use a native asyncTask to call the lighthouse api
export const doNativeSearch = (
rawQuery: string, // pass in a query if you don't want to search for what's in the search bar
size: ?number, // only pass in if you don't want to use the users setting (ex: related content)
from: ?number,
isBackgroundSearch: boolean = false
) => (dispatch: Dispatch, getState: GetState) => {
const query = rawQuery.replace(/^lbry:\/\//i, '').replace(/\//, ' ');
if (!query) {
dispatch({
type: ACTIONS.SEARCH_FAIL,
});
return;
}
const state = getState();
const queryWithOptions = makeSelectQueryWithOptions(query, size, from, isBackgroundSearch)(state);
// If we have already searched for something, we don't need to do anything
const urisForQuery = makeSelectSearchUris(queryWithOptions)(state);
if (urisForQuery && !!urisForQuery.length) {
return;
}
dispatch({
type: ACTIONS.SEARCH_START,
});
// If the user is on the file page with a pre-populated uri and they select
// the search option without typing anything, searchQuery will be empty
// We need to populate it so the input is filled on the search page
// isBackgroundSearch means the search is happening in the background, don't update the search query
if (!state.search.searchQuery && !isBackgroundSearch) {
dispatch(doUpdateSearchQuery(query));
}
const url = `${CONNECTION_STRING}search?${queryWithOptions}`;
NativeModules.Requests.get(url)
.then(handleNativeFetchResponse)
.then((data: Array<{ name: String, claimId: string }>) => {
const uris = [];
const actions = [];
data.forEach(result => {
if (result.name) {
const uri = buildURI({
claimName: result.name,
claimId: result.claimId,
});
actions.push(doResolveUri(uri));
uris.push(uri);
}
});
actions.push({
type: ACTIONS.SEARCH_SUCCESS,
data: {
query: queryWithOptions,
uris,
},
});
dispatch(batchActions(...actions));
})
.catch(e => {
dispatch({
type: ACTIONS.SEARCH_FAIL,
});
});
};
+11
View File
@@ -38,3 +38,14 @@ export function doSetTimeItem(item) {
});
};
}
export function doToggleFullscreenMode(mode) {
return dispatch => {
dispatch({
type: Constants.ACTION_FULLSCREEN_MODE_TOGGLED,
data: {
mode,
},
});
};
}
+6
View File
@@ -6,6 +6,7 @@ const defaultState = {
clientSettings: {},
sortByItemName: Constants.SORT_BY_HOT,
timeItemName: Constants.TIME_WEEK,
fullscreenMode: false,
};
reducers[ACTIONS.CLIENT_SETTING_CHANGED] = (state, action) => {
@@ -29,6 +30,11 @@ reducers[Constants.ACTION_TIME_ITEM_CHANGED] = (state, action) =>
timeItemName: action.data.name,
});
reducers[Constants.ACTION_FULLSCREEN_MODE_TOGGLED] = (state, action) =>
Object.assign({}, state, {
fullscreenMode: action.data.mode,
});
export default function reducer(state = defaultState, action) {
const handler = reducers[action.type];
if (handler) return handler(state, action);
+5
View File
@@ -34,3 +34,8 @@ export const makeSelectClientSetting = setting =>
export const selectShowNsfw = makeSelectClientSetting(SETTINGS.SHOW_NSFW);
export const selectKeepDaemonRunning = makeSelectClientSetting(SETTINGS.KEEP_DAEMON_RUNNING);
export const selectFullscreenMode = createSelector(
selectState,
state => state.fullscreenMode
);
+10
View File
@@ -30,6 +30,16 @@ const channelCreatorStyle = StyleSheet.create({
fontFamily: 'Inter-UI-Regular',
fontSize: 16,
},
balance: {
alignItems: 'center',
flexDirection: 'row',
marginLeft: 24,
},
balanceText: {
fontFamily: 'Inter-UI-SemiBold',
fontSize: 14,
marginLeft: 4,
},
channelNameInput: {
fontFamily: 'Inter-UI-Regular',
fontSize: 16,
+14
View File
@@ -11,6 +11,10 @@ const channelSelectorStyle = StyleSheet.create({
height: 52,
width: '100%',
},
channelPickerItem: {
fontFamily: 'Inter-UI-Regular',
fontSize: 16,
},
bidRow: {
flex: 1,
flexDirection: 'row',
@@ -20,6 +24,16 @@ const channelSelectorStyle = StyleSheet.create({
fontFamily: 'Inter-UI-Regular',
fontSize: 16,
},
balance: {
alignItems: 'center',
flexDirection: 'row',
marginLeft: 24,
},
balanceText: {
fontFamily: 'Inter-UI-SemiBold',
fontSize: 14,
marginLeft: 4,
},
channelNameInput: {
fontFamily: 'Inter-UI-Regular',
fontSize: 16,
+26 -5
View File
@@ -277,6 +277,7 @@ const filePageStyle = StyleSheet.create({
amountRow: {
flexDirection: 'row',
flex: 0.75,
alignItems: 'center',
},
button: {
backgroundColor: Colors.LbryGreen,
@@ -299,9 +300,7 @@ const filePageStyle = StyleSheet.create({
letterSpacing: 1,
},
currency: {
alignSelf: 'flex-start',
fontSize: 12,
marginTop: 15,
marginLeft: 4,
},
descriptionToggle: {
@@ -381,10 +380,19 @@ const filePageStyle = StyleSheet.create({
backButtonIcon: {
color: Colors.White,
},
sharedLargeButton: {
alignItems: 'center',
justifyContent: 'center',
flex: 0.2,
},
innerLargeButton: {
alignItems: 'center',
justifyContent: 'center',
},
largeButton: {
alignItems: 'center',
justifyContent: 'center',
marginRight: 48,
flex: 0.2,
},
largeButtonIcon: {
color: Colors.DescriptionGrey,
@@ -397,8 +405,8 @@ const filePageStyle = StyleSheet.create({
largeButtonsRow: {
flexDirection: 'row',
alignItems: 'center',
marginLeft: 20,
marginRight: 20,
marginLeft: 16,
marginRight: 16,
marginTop: 12,
marginBottom: 12,
},
@@ -435,6 +443,19 @@ const filePageStyle = StyleSheet.create({
fontSize: 16,
marginTop: 4,
},
relatedLoading: {
marginTop: 16,
},
balance: {
alignItems: 'center',
flexDirection: 'row',
marginLeft: 24,
},
balanceText: {
fontFamily: 'Inter-UI-SemiBold',
fontSize: 14,
marginLeft: 4,
},
});
export default filePageStyle;
+4
View File
@@ -153,6 +153,10 @@ const firstRunStyle = StyleSheet.create({
color: Colors.White,
fontSize: 16,
},
closeButtonIcon: {
alignSelf: 'center',
color: Colors.White,
},
buttonContainer: {
flexDirection: 'row',
alignItems: 'center',
+10
View File
@@ -466,6 +466,16 @@ const publishStyle = StyleSheet.create({
fontFamily: 'Inter-UI-SemiBold',
fontSize: 12,
},
balance: {
alignItems: 'center',
flexDirection: 'row',
marginLeft: 24,
},
balanceText: {
fontFamily: 'Inter-UI-SemiBold',
fontSize: 14,
marginLeft: 4,
},
});
export default publishStyle;
+22
View File
@@ -28,6 +28,14 @@ const settingsStyle = StyleSheet.create({
width: '25%',
justifyContent: 'center',
},
pickerText: {
width: '40%',
},
pickerContainer: {
width: '60%',
flexDirection: 'row',
justifyContent: 'flex-end',
},
label: {
fontSize: 14,
fontFamily: 'Inter-UI-Regular',
@@ -54,6 +62,20 @@ const settingsStyle = StyleSheet.create({
sectionDivider: {
marginTop: 24,
},
languagePicker: {
width: '85%',
},
languagePickerItem: {
fontFamily: 'Inter-UI-Regular',
fontSize: 14,
},
pickerRow: {
marginBottom: 24,
flex: 1,
flexDirection: 'row',
justifyContent: 'space-between',
alignItems: 'center',
},
});
export default settingsStyle;
+10
View File
@@ -126,6 +126,16 @@ const walletStyle = StyleSheet.create({
marginLeft: 16,
marginBottom: 16,
},
balanceFocus: {
alignItems: 'center',
flexDirection: 'row',
marginLeft: 24,
},
balanceText: {
fontFamily: 'Inter-UI-SemiBold',
fontSize: 14,
marginLeft: 4,
},
infoText: {
color: '#aaaaaa',
fontFamily: 'Inter-UI-Regular',
+39 -20
View File
@@ -6,32 +6,37 @@ import Constants, { DrawerRoutes, InnerDrawerRoutes } from 'constants'; // eslin
const tagNameLength = 10;
const specialRouteMap = {
about: Constants.DRAWER_ROUTE_ABOUT,
allContent: Constants.DRAWER_ROUTE_TRENDING,
channels: Constants.DRAWER_ROUTE_CHANNEL_CREATOR,
library: Constants.DRAWER_ROUTE_MY_LBRY,
publish: Constants.DRAWER_ROUTE_PUBLISH,
publishes: Constants.DRAWER_ROUTE_PUBLISHES,
rewards: Constants.DRAWER_ROUTE_REWARDS,
settings: Constants.DRAWER_ROUTE_SETTINGS,
subscriptions: Constants.DRAWER_ROUTE_SUBSCRIPTIONS,
wallet: Constants.FULL_ROUTE_NAME_WALLET,
discover: Constants.FULL_ROUTE_NAME_DISCOVER,
};
function getRouteForSpecialUri(uri) {
let targetRoute;
const page = uri.substring(8).trim(); // 'lbry://?'.length == 8
switch (page) {
case Constants.PAGE_REWARDS:
targetRoute = Constants.DRAWER_ROUTE_REWARDS;
break;
case Constants.PAGE_SETTINGS:
targetRoute = Constants.DRAWER_ROUTE_SETTINGS;
break;
case Constants.PAGE_TRENDING:
targetRoute = Constants.DRAWER_ROUTE_TRENDING;
break;
case Constants.PAGE_WALLET:
targetRoute = Constants.FULL_ROUTE_NAME_WALLET;
break;
default:
targetRoute = Constants.FULL_ROUTE_NAME_DISCOVER;
break;
if (specialRouteMap[page]) {
targetRoute = specialRouteMap[page];
}
if (!targetRoute) {
// default to the home page if there is no match for the page
targetRoute = Constants.FULL_ROUTE_NAME_DISCOVER;
}
return targetRoute;
}
export function dispatchNavigateToUri(dispatch, nav, uri, isNavigatingBack) {
export function dispatchNavigateToUri(dispatch, nav, uri, isNavigatingBack, fullUri) {
if (uri.startsWith('lbry://?')) {
dispatch(NavigationActions.navigate({ routeName: getRouteForSpecialUri(uri) }));
return;
@@ -45,7 +50,7 @@ export function dispatchNavigateToUri(dispatch, nav, uri, isNavigatingBack) {
uriVars = parseUriVars(uriVarsStr);
}
const params = { uri, uriVars };
const params = { uri, uriVars, fullUri: fullUri };
if (!isNavigatingBack) {
dispatch(doPushDrawerStack(uri));
@@ -108,7 +113,7 @@ function parseUriVars(vars) {
return uriVars;
}
export function navigateToUri(navigation, uri, additionalParams, isNavigatingBack) {
export function navigateToUri(navigation, uri, additionalParams, isNavigatingBack, fullUri) {
if (!navigation) {
return;
}
@@ -131,7 +136,7 @@ export function navigateToUri(navigation, uri, additionalParams, isNavigatingBac
}
const { store } = window;
const params = Object.assign({ uri, uriVars }, additionalParams);
const params = Object.assign({ uri, uriVars, fullUri: fullUri }, additionalParams);
if (navigation.state.routeName === 'File') {
const stackAction = StackActions.replace({ routeName: 'File', newKey: uri, params });
navigation.dispatch(stackAction);
@@ -150,6 +155,14 @@ export function navigateToUri(navigation, uri, additionalParams, isNavigatingBac
}
export function navigateBack(navigation, drawerStack, popDrawerStack) {
if (drawerStack[drawerStack.length - 1].route === Constants.DRAWER_ROUTE_FILE_VIEW) {
// inner file_view (web / image view) is handled differently
if (popDrawerStack) {
popDrawerStack();
}
return;
}
if (popDrawerStack) {
popDrawerStack();
}
@@ -181,6 +194,12 @@ export function navigateBack(navigation, drawerStack, popDrawerStack) {
}
export function dispatchNavigateBack(dispatch, nav, drawerStack) {
if (drawerStack[drawerStack.length - 1].route === Constants.DRAWER_ROUTE_FILE_VIEW) {
// inner file_view (web / image view) is handled differently
dispatch(doPopDrawerStack());
return;
}
dispatch(doPopDrawerStack());
const target = drawerStack[drawerStack.length > 1 ? drawerStack.length - 2 : 0];