Compare commits
192
Commits
| Author | SHA1 | Date | |
|---|---|---|---|
|
|
1db0e9a09f | ||
|
|
63ba6ecf47 | ||
|
|
4e6267d5a9 | ||
|
|
dc0b06ce55 | ||
|
|
82d15f0c7f | ||
|
|
9f32363a09 | ||
|
|
467272d5c8 | ||
|
|
3594b70113 | ||
|
|
5f008b3ac9 | ||
|
|
3f21c4e08c | ||
|
|
3717a8072b | ||
|
|
46bfbd242a | ||
|
|
0361b10575 | ||
|
|
b9dec86cae | ||
|
|
2465b5514f | ||
|
|
df3a9587c0 | ||
|
|
5df8b8c4aa | ||
|
|
156e310368 | ||
|
|
683b1f4805 | ||
|
|
e263ad7569 | ||
|
|
24d580ea13 | ||
|
|
bfc3b11035 | ||
|
|
6bf2f9460d | ||
|
|
504baeefaf | ||
|
|
6c55633751 | ||
|
|
3395fa7aa2 | ||
|
|
7a3def7ea1 | ||
|
|
f1aafd6e34 | ||
|
|
1ce5fad8c0 | ||
|
|
4690451bfe | ||
|
|
b149c0039a | ||
|
|
e97bf7ce79 | ||
|
|
8c79115ce0 | ||
|
|
24fa80d92a | ||
|
|
624d95ab42 | ||
|
|
8519b561b3 | ||
|
|
00dfc205a5 | ||
|
|
b6ab92a700 | ||
|
|
561aa0db9c | ||
|
|
ad9056f91a | ||
|
|
bc62580aae | ||
|
|
f5cb8e44d1 | ||
|
|
c47c7cd925 | ||
|
|
b25f913921 | ||
|
|
673d6dc0f5 | ||
|
|
91eb18ec9b | ||
|
|
4ed3809ffd | ||
|
|
3f0ed7988a | ||
|
|
b3e20e78cb | ||
|
|
331f3d58ee | ||
|
|
3b0ea191fe | ||
|
|
20a984f259 | ||
|
|
2d91c83628 | ||
|
|
d7635dc7ee | ||
|
|
13136e606d | ||
|
|
5ae5144eda | ||
|
|
3e81d4ef8d | ||
|
|
8365fa3fa0 | ||
|
|
5681630e4c | ||
|
|
1eecae469d | ||
|
|
f7c8bf3949 | ||
|
|
d538838921 | ||
|
|
b5abddb69a | ||
|
|
15cbdcfaca | ||
|
|
30246a189c | ||
|
|
f77f0a7aa2 | ||
|
|
36d4bd7e99 | ||
|
|
b8f2a9e24f | ||
|
|
d7edbf55b5 | ||
|
|
d362d9e8dd | ||
|
|
f47693fb35 | ||
|
|
54b10c818e | ||
|
|
4b283e6606 | ||
|
|
67723813cc | ||
|
|
80b12a2cc8 | ||
|
|
48ce7e9d9e | ||
|
|
696ff616f7 | ||
|
|
94050e5e6d | ||
|
|
d52436e8d4 | ||
|
|
f231741789 | ||
|
|
dd7f1e82ba | ||
|
|
17b381de71 | ||
|
|
53f143f232 | ||
|
|
c58aecb35e | ||
|
|
8b4f1de951 | ||
|
|
daa4f5c5dc | ||
|
|
6ae9632fb9 | ||
|
|
c33cf47397 | ||
|
|
e0fa80f640 | ||
|
|
0e65d526d8 | ||
|
|
86e5bcf7e0 | ||
|
|
e9858f85e8 | ||
|
|
0b43454adc | ||
|
|
d69c1931ac | ||
|
|
970b53ffdc | ||
|
|
372a572ee6 | ||
|
|
01eb112888 | ||
|
|
bb9e990f5a | ||
|
|
3237652d35 | ||
|
|
fd715886cd | ||
|
|
fa2de8382a | ||
|
|
f03a88ab2a | ||
|
|
184d5d1ec3 | ||
|
|
1a190fb0fe | ||
|
|
5e67cbe9ce | ||
|
|
bc04f7105b | ||
|
|
13fd9002fa | ||
|
|
fe5462971e | ||
|
|
89dff3ace3 | ||
|
|
01c3bc489b | ||
|
|
e208a9960f | ||
|
|
e5c6270d5c | ||
|
|
afbb9e1d79 | ||
|
|
357be73947 | ||
|
|
2ddfc1eaf8 | ||
|
|
e901e81074 | ||
|
|
2e3e1a1250 | ||
|
|
190af405bb | ||
|
|
4467853d44 | ||
|
|
a45f68d096 | ||
|
|
79686ff6b9 | ||
|
|
76305a67be | ||
|
|
82345070fb | ||
|
|
56aa0a96a7 | ||
|
|
232cdb3d29 | ||
|
|
61189b817a | ||
|
|
a127e14a0f | ||
|
|
51e3dfcf6a | ||
|
|
5915919560 | ||
|
|
943c5654c1 | ||
|
|
117c23fe3f | ||
|
|
072ad25146 | ||
|
|
f714310681 | ||
|
|
9bc5a1538a | ||
|
|
1458e4f321 | ||
|
|
ed513bcfb5 | ||
|
|
518285355c | ||
|
|
030b94ce01 | ||
|
|
12ca56cb45 | ||
|
|
8eb661171d | ||
|
|
67349b0ef6 | ||
|
|
41fd14e18f | ||
|
|
ce36be2b7b | ||
|
|
b4fc61ada0 | ||
|
|
032b5c26b1 | ||
|
|
871c2c538b | ||
|
|
60f6645515 | ||
|
|
61f0aa5dac | ||
|
|
2c6445c61c | ||
|
|
3239174ddf | ||
|
|
9157b18f45 | ||
|
|
f09269d48a | ||
|
|
69a760f011 | ||
|
|
22cd556e13 | ||
|
|
68bee32dde | ||
|
|
cc2b3b845d | ||
|
|
b6df5ee97c | ||
|
|
ddd8d49a62 | ||
|
|
e6ee26f94c | ||
|
|
2bf67d31e8 | ||
|
|
9ec5ac5d60 | ||
|
|
9080913811 | ||
|
|
eca6af122b | ||
|
|
b258654d60 | ||
|
|
342e022594 | ||
|
|
d16e4b7f69 | ||
|
|
648206b6a5 | ||
|
|
14994d2a30 | ||
|
|
ab97be6a4d | ||
|
|
e39f5907a8 | ||
|
|
c203aa914c | ||
|
|
f0a3eec80b | ||
|
|
47bb996342 | ||
|
|
aba0b860e8 | ||
|
|
b135ca36a3 | ||
|
|
46b99e769f | ||
|
|
b5dad6b5fb | ||
|
|
31d4d46742 | ||
|
|
5d86b68a3e | ||
|
|
62ac844084 | ||
|
|
eebb25dba0 | ||
|
|
88e450eb08 | ||
|
|
ca8670e23c | ||
|
|
1b4c023c92 | ||
|
|
9aabad56a2 | ||
|
|
3051deb7c7 | ||
|
|
f2f5cd9ad5 | ||
|
|
f800f22277 | ||
|
|
2558f0c392 | ||
|
|
02d8107b50 | ||
|
|
5943a796e4 | ||
|
|
ffc4d828a7 |
No files matched your search
@@ -10,6 +10,7 @@
|
|||||||
"__": true
|
"__": true
|
||||||
},
|
},
|
||||||
"rules": {
|
"rules": {
|
||||||
|
"no-console": 2,
|
||||||
"no-multi-spaces": 0,
|
"no-multi-spaces": 0,
|
||||||
"new-cap": 0,
|
"new-cap": 0,
|
||||||
"prefer-promise-reject-errors": 0,
|
"prefer-promise-reject-errors": 0,
|
||||||
|
|||||||
@@ -1,6 +1,6 @@
|
|||||||
The MIT License (MIT)
|
The MIT License (MIT)
|
||||||
|
|
||||||
Copyright (c) 2017-2018 LBRY Inc
|
Copyright (c) 2017-2019 LBRY Inc
|
||||||
|
|
||||||
Permission is hereby granted, free of charge, to any person obtaining a copy of this software and associated documentation files (the "Software"), to deal in the Software without restriction, including without limitation the rights to use, copy, modify, merge, publish,distribute, sublicense, and/or sell copies of the Software, and to permit persons to whom the Software is furnished to do so, subject to the following conditions:
|
Permission is hereby granted, free of charge, to any person obtaining a copy of this software and associated documentation files (the "Software"), to deal in the Software without restriction, including without limitation the rights to use, copy, modify, merge, publish,distribute, sublicense, and/or sell copies of the Software, and to permit persons to whom the Software is furnished to do so, subject to the following conditions:
|
||||||
|
|
||||||
|
|||||||
@@ -1,3 +1,7 @@
|
|||||||
|
if (__DEV__) {
|
||||||
|
import('./reactotron').then(() => console.log('Reactotron Configured'));
|
||||||
|
}
|
||||||
|
|
||||||
import LBRYApp from './src/index';
|
import LBRYApp from './src/index';
|
||||||
|
|
||||||
export default LBRYApp;
|
export default LBRYApp;
|
||||||
@@ -0,0 +1,308 @@
|
|||||||
|
{
|
||||||
|
"Please wait while we get some things ready...": "Please wait while we get some things ready...",
|
||||||
|
"Welcome to LBRY.": "Welcome to LBRY.",
|
||||||
|
"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",
|
||||||
|
"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.",
|
||||||
|
"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)",
|
||||||
|
"Starting up": "Starting up",
|
||||||
|
"Connecting": "Connecting",
|
||||||
|
"Testing network": "Testing network",
|
||||||
|
"Waiting for name resolution": "Waiting for name resolution",
|
||||||
|
"Search movies, music, and more": "Search movies, music, and more",
|
||||||
|
"Your Tags": "Your Tags",
|
||||||
|
"Trending": "Trending",
|
||||||
|
"Customize": "Customize",
|
||||||
|
"Sign In": "Sign In",
|
||||||
|
"SIGN IN": "SIGN IN",
|
||||||
|
"Find content": "Find content",
|
||||||
|
"Subscriptions": "Subscriptions",
|
||||||
|
"All Content": "All Content",
|
||||||
|
"Your content": "Your content",
|
||||||
|
"Channels": "Channels",
|
||||||
|
"Library": "Library",
|
||||||
|
"Publishes": "Publishes",
|
||||||
|
"New Publish": "New Publish",
|
||||||
|
"Wallet": "Wallet",
|
||||||
|
"Rewards": "Rewards",
|
||||||
|
"Settings": "Settings",
|
||||||
|
"About": "About",
|
||||||
|
"All tags you follow": "All tags you follow",
|
||||||
|
"More tags you follow": "More tags you follow",
|
||||||
|
"FREE": "FREE",
|
||||||
|
"more": "more",
|
||||||
|
"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!",
|
||||||
|
"Create a channel": "Create a channel",
|
||||||
|
"CONTENT": "CONTENT",
|
||||||
|
"ABOUT": "ABOUT",
|
||||||
|
"Follow": "Follow",
|
||||||
|
"No content to display at this time. Please check back later.": "No content to display at this time. Please check back later.",
|
||||||
|
"New": "New",
|
||||||
|
"Share": "Share",
|
||||||
|
"Tip": "Tip",
|
||||||
|
"Report": "Report",
|
||||||
|
"Fetching cost info...": "Fetching cost info...",
|
||||||
|
"Play": "Play",
|
||||||
|
"Connecting...": "Connecting...",
|
||||||
|
"Related Content": "Related Content",
|
||||||
|
"Loading...": "Loading...",
|
||||||
|
"Content Freedom": "Content Freedom",
|
||||||
|
"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",
|
||||||
|
"Get Social": "Get Social",
|
||||||
|
"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",
|
||||||
|
"App version": "App version",
|
||||||
|
"LBRY SDK": "LBRY SDK",
|
||||||
|
"Platform": "Platform",
|
||||||
|
"Installation ID": "Installation ID",
|
||||||
|
"Logs": "Logs",
|
||||||
|
"Send log": "Send log",
|
||||||
|
"Account Recommended": "Account Recommended",
|
||||||
|
"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",
|
||||||
|
"Blockchain Sync": "Blockchain Sync",
|
||||||
|
"Catching up with the blockchain (%progress%%)": "Catching up with the blockchain (%progress%%)",
|
||||||
|
"Network Loading": "Network Loading",
|
||||||
|
"Initializing LBRY service": "Initializing LBRY service",
|
||||||
|
"%amount% available credits": "%amount% available credits",
|
||||||
|
"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",
|
||||||
|
"Get %amount% free credits after creating an account.": "Get %amount% free credits after creating an account.",
|
||||||
|
"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",
|
||||||
|
"Send": "Send",
|
||||||
|
"Recent Transactions": "Recent Transactions",
|
||||||
|
"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",
|
||||||
|
"Off": "Off",
|
||||||
|
"Manual backup": "Manual backup",
|
||||||
|
"Sync FAQ": "Sync FAQ",
|
||||||
|
"Fetching transactions...": "Fetching transactions...",
|
||||||
|
"Anonymous": "Anonymous",
|
||||||
|
"Delete": "Delete",
|
||||||
|
"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",
|
||||||
|
"Channel creation requires credits.": "Channel creation requires credits.",
|
||||||
|
"Tap here to get some for free.": "Tap here to get some for free.",
|
||||||
|
"%balance% available": "%balance% available",
|
||||||
|
"Bal: %balance%": "Bal: %balance%",
|
||||||
|
"Send a tip": "Send a tip",
|
||||||
|
"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...",
|
||||||
|
"Description": "Description",
|
||||||
|
"Tags": "Tags",
|
||||||
|
"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",
|
||||||
|
"Publishing requires credits.": "Publishing requires credits.",
|
||||||
|
"Search for more tags": "Search for more tags",
|
||||||
|
"Mature tags": "Mature tags",
|
||||||
|
"Publish anonymously": "Publish anonymously",
|
||||||
|
"Create a channel...": "Create a channel...",
|
||||||
|
"Uploading thumbnail...": "Uploading thumbnail...",
|
||||||
|
"Channel name": "Channel name",
|
||||||
|
"Deposit cannot be higher than your balance": "Deposit cannot be higher than your balance",
|
||||||
|
"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.",
|
||||||
|
"Nothing here. Publish something!": "Nothing here. Publish something!",
|
||||||
|
"Explore content for this tag": "Explore content for this tag",
|
||||||
|
"URL does not include name.": "URL does not include name.",
|
||||||
|
"Loading decentralized data...": "Loading decentralized data...",
|
||||||
|
"View": "View",
|
||||||
|
"Additional Options": "Additional Options",
|
||||||
|
"Language": "Language",
|
||||||
|
"English": "English",
|
||||||
|
"Chinese": "Chinese",
|
||||||
|
"French": "French",
|
||||||
|
"German": "German",
|
||||||
|
"Japanese": "Japanese",
|
||||||
|
"Russian": "Russian",
|
||||||
|
"Spanish": "Spanish",
|
||||||
|
"Indonesian": "Indonesian",
|
||||||
|
"Italian": "Italian",
|
||||||
|
"Dutch": "Dutch",
|
||||||
|
"Turkish": "Turkish",
|
||||||
|
"Polish": "Polish",
|
||||||
|
"Malay": "Malay",
|
||||||
|
"Portuguese": "Portuguese",
|
||||||
|
"Vietnamese": "Vietnamese",
|
||||||
|
"Thai": "Thai",
|
||||||
|
"Arabic": "Arabic",
|
||||||
|
"Czech": "Czech",
|
||||||
|
"Croatian": "Croatian",
|
||||||
|
"Cambodian": "Cambodian",
|
||||||
|
"Korean": "Korean",
|
||||||
|
"Norwegian": "Norwegian",
|
||||||
|
"Romanian": "Romanian",
|
||||||
|
"Hindi": "Hindi",
|
||||||
|
"Greek": "Greek",
|
||||||
|
"License": "License",
|
||||||
|
"None": "None",
|
||||||
|
"Public Domain": "Public Domain",
|
||||||
|
"Copyrighted...": "Copyrighted...",
|
||||||
|
"Other...": "Other...",
|
||||||
|
"Hide extra fields": "Hide extra fields",
|
||||||
|
"Download": "Download",
|
||||||
|
"%progress%% complete": "%progress%% complete",
|
||||||
|
"Email": "Email",
|
||||||
|
"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.",
|
||||||
|
"Resend": "Resend",
|
||||||
|
"Edit": "Edit",
|
||||||
|
"Your email address was successfully verified.": "Your email address was successfully verified.",
|
||||||
|
"password": "password",
|
||||||
|
"Please enter a password to secure your account and wallet.": "Please enter a password to secure your account and wallet.",
|
||||||
|
"Retrieving your account information...": "Retrieving your account information...",
|
||||||
|
"Please enter the password you used to secure your wallet.": "Please enter the password you used to secure your wallet.",
|
||||||
|
"Note: for wallet security purposes, LBRY is unable to reset your password.": "Note: for wallet security purposes, LBRY is unable to reset your password.",
|
||||||
|
"On": "On",
|
||||||
|
"Connected email": "Connected email",
|
||||||
|
"Address copied": "Address copied",
|
||||||
|
"Unlocking account": "Unlocking account",
|
||||||
|
"Decrypting wallet": "Decrypting wallet",
|
||||||
|
"used": "used",
|
||||||
|
"Stats": "Stats",
|
||||||
|
"Channels you follow": "Channels you follow",
|
||||||
|
"Suggested": "Suggested",
|
||||||
|
"ALL": "ALL",
|
||||||
|
"Customize your tags": "Customize your tags",
|
||||||
|
"Done": "Done",
|
||||||
|
"Unfollow": "Unfollow",
|
||||||
|
"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.",
|
||||||
|
"No views": "No views",
|
||||||
|
"%view% views": "%view% views",
|
||||||
|
"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",
|
||||||
|
"Use device language": "Use device language",
|
||||||
|
"Gujarati": "Gujarati",
|
||||||
|
"Show mature content": "Show mature content",
|
||||||
|
"Notifications": "Notifications",
|
||||||
|
"Choose the notifications you would like to receive.": "Choose the notifications you would like to receive.",
|
||||||
|
"Content Interests": "Content Interests",
|
||||||
|
"Search": "Search",
|
||||||
|
"Show URL suggestions": "Show URL suggestions",
|
||||||
|
"Other": "Other",
|
||||||
|
"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.",
|
||||||
|
"There's nothing here yet.\nPlease check back later.": "There's nothing here yet.\nPlease check back later.",
|
||||||
|
"%follower% followers": "%follower% followers",
|
||||||
|
"Are you sure you want to tip %amount% credits": "Are you sure you want to tip %amount% credits",
|
||||||
|
"Send tip": "Send tip",
|
||||||
|
"No": "No",
|
||||||
|
"Yes": "Yes",
|
||||||
|
"History": "History",
|
||||||
|
"/wallet": "/wallet",
|
||||||
|
"Are you sure you want to tip %amount% credit": "Are you sure you want to tip %amount% credit",
|
||||||
|
"Enjoying LBRY?": "Enjoying LBRY?",
|
||||||
|
"Are you enjoying your experience with the LBRY app? You can leave a review for us on the Play Store.": "Are you enjoying your experience with the LBRY app? You can leave a review for us on the Play Store.",
|
||||||
|
"Never ask again": "Never ask again",
|
||||||
|
"Maybe later": "Maybe later",
|
||||||
|
"Rate app": "Rate app",
|
||||||
|
"This will appear as a tip for %content%, which will boost its ability to be discovered while active.": "This will appear as a tip for %content%, which will boost its ability to be discovered while active.",
|
||||||
|
"Learn more.": "Learn more.",
|
||||||
|
"Send a tip to %channel%": "Send a tip to %channel%",
|
||||||
|
"The transaction URL could not be opened": "The transaction URL could not be opened",
|
||||||
|
"Show All": "Show All",
|
||||||
|
"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.",
|
||||||
|
"Redeem": "Redeem",
|
||||||
|
"Please confirm that you want to use LBRY without creating an account.": "Please confirm that you want to use LBRY without creating an account.",
|
||||||
|
"You sent %amount% LBC as a tip, Mahalo!": "You sent %amount% LBC as a tip, Mahalo!",
|
||||||
|
"%follower% follower": "%follower% follower",
|
||||||
|
"Authenticating": "Authenticating",
|
||||||
|
"Waiting for authentication": "Waiting for authentication",
|
||||||
|
"Delete file": "Delete file",
|
||||||
|
"Are you sure you want to remove this file from your device?": "Are you sure you want to remove this file from your device?",
|
||||||
|
"Following": "Following",
|
||||||
|
"Update mailing preferences": "Update mailing preferences",
|
||||||
|
"Please confirm you want to tip %amount% credits": "Please confirm you want to tip %amount% credits",
|
||||||
|
"Send Tip": "Send Tip",
|
||||||
|
"You do not have any\ndownloaded content on this device.": "You do not have any\ndownloaded content on this device.",
|
||||||
|
"%view% view": "%view% view",
|
||||||
|
"No channel name after @.": "No channel name after @.",
|
||||||
|
"Loading transactions...": "Loading transactions...",
|
||||||
|
"Pending": "Pending",
|
||||||
|
"Phone Number": "Phone Number",
|
||||||
|
"Please provide a phone number to prevent fraud.": "Please provide a phone number to prevent fraud.",
|
||||||
|
"Send verification text": "Send verification text",
|
||||||
|
"Open": "Open",
|
||||||
|
"for": "for",
|
||||||
|
"Everyone": "Everyone",
|
||||||
|
"Suggested channels": "Suggested channels",
|
||||||
|
"You might also like": "You might also like",
|
||||||
|
"Publish something new": "Publish something new",
|
||||||
|
"Filter for": "Filter for",
|
||||||
|
"Tags you follow": "Tags you follow",
|
||||||
|
"Sort content by": "Sort content by",
|
||||||
|
"Trending content": "Trending content",
|
||||||
|
"New content": "New content",
|
||||||
|
"Top content": "Top content",
|
||||||
|
"Top": "Top",
|
||||||
|
"Past week": "Past week",
|
||||||
|
"It looks like you have not\npublished any content to LBRY yet.": "It looks like you have not\npublished any content to LBRY yet.",
|
||||||
|
"Stop": "Stop",
|
||||||
|
"Unsupported Content": "Unsupported Content",
|
||||||
|
"all tags you follow": "all tags you follow",
|
||||||
|
"Send LBC": "Send LBC",
|
||||||
|
"from": "from",
|
||||||
|
"This file cannot be displayed in the LBRY app.": "This file cannot be displayed in the LBRY app.",
|
||||||
|
"Please press the Play button.": "Please press the Play button.",
|
||||||
|
"Stop download": "Stop download",
|
||||||
|
"Are you sure you want to stop downloading this file?": "Are you sure you want to stop downloading this file?",
|
||||||
|
"The download will stop momentarily. You do not need to wait to discover something else.": "The download will stop momentarily. You do not need to wait to discover something else.",
|
||||||
|
"Connection Failure": "Connection Failure",
|
||||||
|
"We could not establish a connection to the SDK. Your data connection may be preventing LBRY from connecting. Contact hello@lbry.com if you think this is a software bug.": "We could not establish a connection to the SDK. Your data connection may be preventing LBRY from connecting. Contact hello@lbry.com if you think this is a software bug.",
|
||||||
|
"%num% block behind": "%num% block behind",
|
||||||
|
"Delete files": "Delete files",
|
||||||
|
"Are you sure you want to delete the selected content?": "Are you sure you want to delete the selected content?",
|
||||||
|
"We could not find any videos on your device. Take a photo or record a video to get started.": "We could not find any videos on your device. Take a photo or record a video to get started.",
|
||||||
|
"You have already published to the specified content address. Please enter a new address.": "You have already published to the specified content address. Please enter a new address.",
|
||||||
|
"Camera": "Camera",
|
||||||
|
"Please grant access to make use of your camera": "Please grant access to make use of your camera",
|
||||||
|
"OK": "OK",
|
||||||
|
"Audio": "Audio",
|
||||||
|
"Please grant access to record audio": "Please grant access to record audio",
|
||||||
|
"Camera not authorized": "Camera not authorized",
|
||||||
|
"There's nothing at this location.": "There's nothing at this location.",
|
||||||
|
"Publish something here": "Publish something here",
|
||||||
|
"This content cannot be viewed at this time. Please try again in a bit.": "This content cannot be viewed at this time. Please try again in a bit.",
|
||||||
|
"Download file": "Download file",
|
||||||
|
"Save %title% (%size%) to your device": "Save %title% (%size%) to your device",
|
||||||
|
"Save \"%title%\" (%size%) to your device": "Save \"%title%\" (%size%) to your device"
|
||||||
|
}
|
||||||
Generated
+3620
-1872
File diff suppressed because it is too large.
Load diff
+32
-22
@@ -12,49 +12,56 @@
|
|||||||
"base-64": "^0.1.0",
|
"base-64": "^0.1.0",
|
||||||
"@expo/vector-icons": "^8.1.0",
|
"@expo/vector-icons": "^8.1.0",
|
||||||
"gfycat-style-urls": "^1.0.3",
|
"gfycat-style-urls": "^1.0.3",
|
||||||
"lbry-redux": "lbryio/lbry-redux#123efacf4d45289ebda9dc291976d475de227a55",
|
"lbry-redux": "lbryio/lbry-redux#c910cd2b80b165843a81fdf6ce96094429b94ec8",
|
||||||
"lbryinc": "lbryio/lbryinc#b9f354ae50bd57691765a7d042c5054167878bf4",
|
"lbryinc": "lbryio/lbryinc#138a053754ec8e3da8e9bf153d32f527c962f25c",
|
||||||
"lodash": ">=4.17.11",
|
"lodash": ">=4.17.11",
|
||||||
"merge": ">=1.2.1",
|
"merge": ">=1.2.1",
|
||||||
"moment": "^2.22.1",
|
"moment": "^2.22.1",
|
||||||
"react": "16.8.6",
|
"react": "16.9.0",
|
||||||
"react-native": "0.59.10",
|
"react-native": "0.61.5",
|
||||||
"@react-native-community/async-storage": "^1.5.1",
|
"@react-native-community/async-storage": "^1.5.1",
|
||||||
"react-native-camera": "^2.11.1",
|
"@react-native-community/masked-view": "^0.1.5",
|
||||||
"react-native-country-picker-modal": "^0.6.2",
|
"react-native-camera": "^3.15.0",
|
||||||
"react-native-exception-handler": "2.9.0",
|
"react-native-country-picker-modal": "^1.10.0",
|
||||||
"react-native-fast-image": "^6.1.1",
|
"react-native-exception-handler": "2.10.8",
|
||||||
|
"react-native-fast-image": "^7.0.2",
|
||||||
"react-native-fs": "^2.13.3",
|
"react-native-fs": "^2.13.3",
|
||||||
"react-native-gesture-handler": "1.3.0",
|
"react-native-gesture-handler": "1.5.2",
|
||||||
"react-native-image-zoom-viewer": "^2.2.5",
|
"react-native-image-zoom-viewer": "^2.2.5",
|
||||||
"react-native-password-strength-meter": "^0.0.2",
|
"react-native-password-strength-meter": "^0.0.2",
|
||||||
"react-native-phone-input": "lbryio/react-native-phone-input",
|
"react-native-phone-input": "lbryio/react-native-phone-input",
|
||||||
"react-native-reanimated": "1.2.0",
|
"react-native-progress-circle": "2.1.0",
|
||||||
|
"react-native-reanimated": "1.4.0",
|
||||||
|
"react-native-safe-area-context": "^0.6.2",
|
||||||
|
"react-native-snackbar": "2.0.4",
|
||||||
"react-native-super-grid": "^3.0.4",
|
"react-native-super-grid": "^3.0.4",
|
||||||
"react-native-vector-icons": "^6.6.0",
|
"react-native-vector-icons": "^6.6.0",
|
||||||
"react-native-video": "lbryio/react-native-video#exoplayer-lbry-android",
|
"react-native-video": "lbryio/react-native-video#7992ff945872f9bd00a3736d9ff1318f343abf47",
|
||||||
"react-navigation": "^3.11.0",
|
"react-native-webview": "^8.0.2",
|
||||||
"react-navigation-drawer": "^2.2.2",
|
"react-navigation": "^4.0.10",
|
||||||
|
"react-navigation-drawer": "^2.3.3",
|
||||||
"react-navigation-redux-helpers": "^3.0.2",
|
"react-navigation-redux-helpers": "^3.0.2",
|
||||||
"react-navigation-stack": "^1.8.1",
|
"react-navigation-tabs": "^2.7.0",
|
||||||
|
"react-navigation-stack": "^1.10.3",
|
||||||
"react-redux": "^5.0.3",
|
"react-redux": "^5.0.3",
|
||||||
"redux": "^4.0.4",
|
"redux": "^4.0.4",
|
||||||
"redux-persist": "^5.10.0",
|
"redux-persist": "^6.0.0",
|
||||||
"redux-persist-filesystem-storage": "^1.3.2",
|
"redux-persist-filesystem-storage": "^2.1.0",
|
||||||
"redux-persist-transform-compress": "^4.2.0",
|
"redux-persist-transform-compress": "^4.2.0",
|
||||||
"redux-persist-transform-filter": "0.0.18",
|
"redux-persist-transform-filter": "0.0.18",
|
||||||
"redux-thunk": "^2.3.0",
|
"redux-thunk": "^2.3.0",
|
||||||
"rn-fetch-blob": "0.10.15",
|
"rn-fetch-blob": "0.12.0",
|
||||||
"seedrandom": "3.0.3"
|
"seedrandom": "3.0.3",
|
||||||
|
"showdown": "1.9.1"
|
||||||
},
|
},
|
||||||
"devDependencies": {
|
"devDependencies": {
|
||||||
"@babel/core": "^7.5.4",
|
"@babel/core": "^7.6.2",
|
||||||
"babel-eslint": "10.0.2",
|
"babel-eslint": "10.0.2",
|
||||||
"@babel/plugin-proposal-object-rest-spread": "^7.5.4",
|
"@babel/plugin-proposal-object-rest-spread": "^7.5.4",
|
||||||
"babel-preset-env": "^1.6.1",
|
"babel-preset-env": "^1.6.1",
|
||||||
"babel-preset-stage-2": "^6.18.0",
|
"babel-preset-stage-2": "^6.18.0",
|
||||||
"babel-plugin-module-resolver": "^3.1.1",
|
"babel-plugin-module-resolver": "^3.1.1",
|
||||||
"eslint": "^5.16.0",
|
"eslint": "^6.5.1",
|
||||||
"eslint-config-standard": "^12.0.0",
|
"eslint-config-standard": "^12.0.0",
|
||||||
"eslint-config-standard-jsx": "^6.0.2",
|
"eslint-config-standard-jsx": "^6.0.2",
|
||||||
"eslint-plugin-flowtype": "^2.46.1",
|
"eslint-plugin-flowtype": "^2.46.1",
|
||||||
@@ -66,8 +73,11 @@
|
|||||||
"flow-babel-webpack-plugin": "^1.1.1",
|
"flow-babel-webpack-plugin": "^1.1.1",
|
||||||
"husky": "^0.14.3",
|
"husky": "^0.14.3",
|
||||||
"lint-staged": "^7.0.4",
|
"lint-staged": "^7.0.4",
|
||||||
"metro-react-native-babel-preset": "^0.55.0",
|
"metro-react-native-babel-preset": "^0.56.0",
|
||||||
"prettier": "^1.11.1",
|
"prettier": "^1.11.1",
|
||||||
"react-devtools": "^3.6.3"
|
"@react-native-community/eslint-config": "^0.0.5",
|
||||||
|
"react-devtools": "^3.6.3",
|
||||||
|
"reactotron-react-native": "4.0.2",
|
||||||
|
"reactotron-redux": "3.1.2"
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
@@ -0,0 +1,12 @@
|
|||||||
|
import AsyncStorage from '@react-native-community/async-storage';
|
||||||
|
import Reactotron from 'reactotron-react-native';
|
||||||
|
import { reactotronRedux } from 'reactotron-redux';
|
||||||
|
|
||||||
|
const reactotron = Reactotron
|
||||||
|
.setAsyncStorageHandler(AsyncStorage) // AsyncStorage would either come from `react-native` or `@react-native-community/async-storage` depending on where you get it from
|
||||||
|
.configure() // controls connection & communication settings
|
||||||
|
.useReactNative() // add all built-in react native plugins
|
||||||
|
.use(reactotronRedux())
|
||||||
|
.connect();
|
||||||
|
|
||||||
|
export default reactotron;
|
||||||
Binary file not shown.
|
After Width: | Height: | Size: 265 KiB |
Binary file not shown.
|
After Width: | Height: | Size: 278 KiB |
+161
-24
@@ -6,6 +6,7 @@ import DownloadsPage from 'page/downloads';
|
|||||||
import DrawerContent from 'component/drawerContent';
|
import DrawerContent from 'component/drawerContent';
|
||||||
import FilePage from 'page/file';
|
import FilePage from 'page/file';
|
||||||
import FirstRunScreen from 'page/firstRun';
|
import FirstRunScreen from 'page/firstRun';
|
||||||
|
import InvitesPage from 'page/invites';
|
||||||
import PublishPage from 'page/publish';
|
import PublishPage from 'page/publish';
|
||||||
import PublishesPage from 'page/publishes';
|
import PublishesPage from 'page/publishes';
|
||||||
import RewardsPage from 'page/rewards';
|
import RewardsPage from 'page/rewards';
|
||||||
@@ -27,10 +28,28 @@ import {
|
|||||||
createNavigationReducer,
|
createNavigationReducer,
|
||||||
} from 'react-navigation-redux-helpers';
|
} from 'react-navigation-redux-helpers';
|
||||||
import { connect } from 'react-redux';
|
import { connect } from 'react-redux';
|
||||||
import { AppState, BackHandler, Linking, NativeModules, TextInput, ToastAndroid } from 'react-native';
|
|
||||||
import { selectDrawerStack } from 'redux/selectors/drawer';
|
|
||||||
import { SETTINGS, doDismissToast, doToast, selectToast } from 'lbry-redux';
|
|
||||||
import {
|
import {
|
||||||
|
AppState,
|
||||||
|
BackHandler,
|
||||||
|
DeviceEventEmitter,
|
||||||
|
Linking,
|
||||||
|
NativeModules,
|
||||||
|
StatusBar,
|
||||||
|
TextInput,
|
||||||
|
ToastAndroid,
|
||||||
|
} from 'react-native';
|
||||||
|
import { selectDrawerStack } from 'redux/selectors/drawer';
|
||||||
|
import {
|
||||||
|
ACTIONS,
|
||||||
|
SETTINGS,
|
||||||
|
doDismissToast,
|
||||||
|
doPopulateSharedUserState,
|
||||||
|
doPreferenceGet,
|
||||||
|
doToast,
|
||||||
|
selectToast,
|
||||||
|
} from 'lbry-redux';
|
||||||
|
import {
|
||||||
|
Lbryio,
|
||||||
doGetSync,
|
doGetSync,
|
||||||
doUserCheckEmailVerified,
|
doUserCheckEmailVerified,
|
||||||
doUserEmailVerify,
|
doUserEmailVerify,
|
||||||
@@ -38,9 +57,11 @@ import {
|
|||||||
selectEmailToVerify,
|
selectEmailToVerify,
|
||||||
selectEmailVerifyIsPending,
|
selectEmailVerifyIsPending,
|
||||||
selectEmailVerifyErrorMessage,
|
selectEmailVerifyErrorMessage,
|
||||||
|
selectHashChanged,
|
||||||
selectUser,
|
selectUser,
|
||||||
} from 'lbryinc';
|
} from 'lbryinc';
|
||||||
import { makeSelectClientSetting } from 'redux/selectors/settings';
|
import { doStartDownload, doUpdateDownload, doCompleteDownload } from 'redux/actions/file';
|
||||||
|
import { makeSelectClientSetting, selectFullscreenMode } from 'redux/selectors/settings';
|
||||||
import { decode as atob } from 'base-64';
|
import { decode as atob } from 'base-64';
|
||||||
import { dispatchNavigateBack, dispatchNavigateToUri, transformUrl } from 'utils/helper';
|
import { dispatchNavigateBack, dispatchNavigateToUri, transformUrl } from 'utils/helper';
|
||||||
import AsyncStorage from '@react-native-community/async-storage';
|
import AsyncStorage from '@react-native-community/async-storage';
|
||||||
@@ -51,6 +72,9 @@ import NavigationButton from 'component/navigationButton';
|
|||||||
import discoverStyle from 'styles/discover';
|
import discoverStyle from 'styles/discover';
|
||||||
import searchStyle from 'styles/search';
|
import searchStyle from 'styles/search';
|
||||||
import SearchRightHeaderIcon from 'component/searchRightHeaderIcon';
|
import SearchRightHeaderIcon from 'component/searchRightHeaderIcon';
|
||||||
|
import Snackbar from 'react-native-snackbar';
|
||||||
|
|
||||||
|
const SYNC_GET_INTERVAL = 1000 * 60 * 5; // every 5 minutes
|
||||||
|
|
||||||
const menuNavigationButton = navigation => (
|
const menuNavigationButton = navigation => (
|
||||||
<NavigationButton
|
<NavigationButton
|
||||||
@@ -93,7 +117,7 @@ const discoverStack = createStackNavigator(
|
|||||||
{
|
{
|
||||||
headerMode: 'screen',
|
headerMode: 'screen',
|
||||||
transitionConfig: () => ({ screenInterpolator: () => null }),
|
transitionConfig: () => ({ screenInterpolator: () => null }),
|
||||||
}
|
},
|
||||||
);
|
);
|
||||||
|
|
||||||
discoverStack.navigationOptions = ({ navigation }) => {
|
discoverStack.navigationOptions = ({ navigation }) => {
|
||||||
@@ -127,7 +151,7 @@ const walletStack = createStackNavigator(
|
|||||||
{
|
{
|
||||||
headerMode: 'screen',
|
headerMode: 'screen',
|
||||||
transitionConfig: () => ({ screenInterpolator: () => null }),
|
transitionConfig: () => ({ screenInterpolator: () => null }),
|
||||||
}
|
},
|
||||||
);
|
);
|
||||||
|
|
||||||
const drawerIconSize = 18;
|
const drawerIconSize = 18;
|
||||||
@@ -187,6 +211,12 @@ const drawer = createDrawerNavigator(
|
|||||||
drawerIcon: ({ tintColor }) => <Icon name="award" size={drawerIconSize} style={{ color: tintColor }} />,
|
drawerIcon: ({ tintColor }) => <Icon name="award" size={drawerIconSize} style={{ color: tintColor }} />,
|
||||||
},
|
},
|
||||||
},
|
},
|
||||||
|
Invites: {
|
||||||
|
screen: InvitesPage,
|
||||||
|
navigationOptions: {
|
||||||
|
drawerIcon: ({ tintColor }) => <Icon name="user-friends" size={drawerIconSize} style={{ color: tintColor }} />,
|
||||||
|
},
|
||||||
|
},
|
||||||
Downloads: {
|
Downloads: {
|
||||||
screen: DownloadsPage,
|
screen: DownloadsPage,
|
||||||
navigationOptions: {
|
navigationOptions: {
|
||||||
@@ -210,17 +240,18 @@ const drawer = createDrawerNavigator(
|
|||||||
},
|
},
|
||||||
},
|
},
|
||||||
{
|
{
|
||||||
drawerWidth: 300,
|
drawerWidth: 299,
|
||||||
drawerBackgroundColor: 'transparent',
|
drawerBackgroundColor: 'transparent',
|
||||||
headerMode: 'none',
|
headerMode: 'none',
|
||||||
backBehavior: 'none',
|
backBehavior: 'none',
|
||||||
unmountInactiveRoutes: true,
|
unmountInactiveRoutes: true,
|
||||||
contentComponent: DrawerContent,
|
contentComponent: DrawerContent,
|
||||||
|
overlayColor: 'rgba(0, 0, 0, 0.7)',
|
||||||
contentOptions: {
|
contentOptions: {
|
||||||
activeTintColor: Colors.LbryGreen,
|
activeTintColor: Colors.LbryGreen,
|
||||||
labelStyle: discoverStyle.menuText,
|
labelStyle: discoverStyle.menuText,
|
||||||
},
|
},
|
||||||
}
|
},
|
||||||
);
|
);
|
||||||
|
|
||||||
const mainStackNavigator = new createStackNavigator(
|
const mainStackNavigator = new createStackNavigator(
|
||||||
@@ -249,7 +280,7 @@ const mainStackNavigator = new createStackNavigator(
|
|||||||
},
|
},
|
||||||
{
|
{
|
||||||
headerMode: 'none',
|
headerMode: 'none',
|
||||||
}
|
},
|
||||||
);
|
);
|
||||||
|
|
||||||
export const AppNavigator = mainStackNavigator;
|
export const AppNavigator = mainStackNavigator;
|
||||||
@@ -268,9 +299,11 @@ class AppWithNavigationState extends React.Component {
|
|||||||
constructor() {
|
constructor() {
|
||||||
super();
|
super();
|
||||||
this.emailVerifyCheckInterval = null;
|
this.emailVerifyCheckInterval = null;
|
||||||
|
this.syncGetInterval = null;
|
||||||
this.state = {
|
this.state = {
|
||||||
emailVerifyDone: false,
|
emailVerifyDone: false,
|
||||||
verifyPending: false,
|
verifyPending: false,
|
||||||
|
syncHashChanged: false,
|
||||||
};
|
};
|
||||||
}
|
}
|
||||||
|
|
||||||
@@ -286,13 +319,29 @@ class AppWithNavigationState extends React.Component {
|
|||||||
}
|
}
|
||||||
|
|
||||||
return false;
|
return false;
|
||||||
}.bind(this)
|
}.bind(this),
|
||||||
);
|
);
|
||||||
}
|
}
|
||||||
|
|
||||||
componentDidMount() {
|
componentDidMount() {
|
||||||
|
const { dispatch, user } = this.props;
|
||||||
this.emailVerifyCheckInterval = setInterval(() => this.checkEmailVerification(), 5000);
|
this.emailVerifyCheckInterval = setInterval(() => this.checkEmailVerification(), 5000);
|
||||||
Linking.addEventListener('url', this._handleUrl);
|
Linking.addEventListener('url', this._handleUrl);
|
||||||
|
|
||||||
|
DeviceEventEmitter.addListener('onDownloadAborted', this.handleDownloadAborted);
|
||||||
|
DeviceEventEmitter.addListener('onDownloadStarted', this.handleDownloadStarted);
|
||||||
|
DeviceEventEmitter.addListener('onDownloadUpdated', this.handleDownloadUpdated);
|
||||||
|
DeviceEventEmitter.addListener('onDownloadCompleted', this.handleDownloadCompleted);
|
||||||
|
|
||||||
|
// call /sync/get with interval
|
||||||
|
this.syncGetInterval = setInterval(() => {
|
||||||
|
this.setState({ syncHashChanged: false }); // reset local state
|
||||||
|
if (user && user.has_verified_email) {
|
||||||
|
NativeModules.UtilityModule.getSecureValue(Constants.KEY_WALLET_PASSWORD).then(walletPassword => {
|
||||||
|
dispatch(doGetSync(walletPassword, () => this.getUserSettings()));
|
||||||
|
});
|
||||||
|
}
|
||||||
|
}, SYNC_GET_INTERVAL);
|
||||||
}
|
}
|
||||||
|
|
||||||
checkEmailVerification = () => {
|
checkEmailVerification = () => {
|
||||||
@@ -305,28 +354,87 @@ class AppWithNavigationState extends React.Component {
|
|||||||
});
|
});
|
||||||
};
|
};
|
||||||
|
|
||||||
|
getUserSettings = () => {
|
||||||
|
const { dispatch } = this.props;
|
||||||
|
doPreferenceGet(
|
||||||
|
'shared',
|
||||||
|
preference => {
|
||||||
|
dispatch(doPopulateSharedUserState(preference));
|
||||||
|
},
|
||||||
|
error => {
|
||||||
|
/* failed */
|
||||||
|
},
|
||||||
|
);
|
||||||
|
};
|
||||||
|
|
||||||
|
handleDownloadStarted = evt => {
|
||||||
|
const { dispatch } = this.props;
|
||||||
|
const { uri, outpoint, fileInfo } = evt;
|
||||||
|
dispatch(doStartDownload(uri, outpoint, fileInfo));
|
||||||
|
};
|
||||||
|
|
||||||
|
handleDownloadUpdated = evt => {
|
||||||
|
const { dispatch } = this.props;
|
||||||
|
const { uri, outpoint, fileInfo, progress } = evt;
|
||||||
|
dispatch(doUpdateDownload(uri, outpoint, fileInfo, progress));
|
||||||
|
};
|
||||||
|
|
||||||
|
handleDownloadCompleted = evt => {
|
||||||
|
const { dispatch } = this.props;
|
||||||
|
const { uri, outpoint, fileInfo } = evt;
|
||||||
|
dispatch(doCompleteDownload(uri, outpoint, fileInfo));
|
||||||
|
};
|
||||||
|
|
||||||
|
handleDownloadAborted = evt => {
|
||||||
|
const { dispatch } = this.props;
|
||||||
|
const { uri, outpoint } = evt;
|
||||||
|
dispatch({
|
||||||
|
type: ACTIONS.DOWNLOADING_CANCELED,
|
||||||
|
data: { uri, outpoint },
|
||||||
|
});
|
||||||
|
|
||||||
|
dispatch({
|
||||||
|
type: ACTIONS.FILE_DELETE,
|
||||||
|
data: {
|
||||||
|
outpoint,
|
||||||
|
},
|
||||||
|
});
|
||||||
|
};
|
||||||
|
|
||||||
componentWillUnmount() {
|
componentWillUnmount() {
|
||||||
|
DeviceEventEmitter.removeListener('onDownloadAborted', this.handleDownloadAborted);
|
||||||
|
DeviceEventEmitter.removeListener('onDownloadStarted', this.handleDownloadStarted);
|
||||||
|
DeviceEventEmitter.removeListener('onDownloadUpdated', this.handleDownloadUpdated);
|
||||||
|
DeviceEventEmitter.removeListener('onDownloadCompleted', this.handleDownloadCompleted);
|
||||||
|
|
||||||
AppState.removeEventListener('change', this._handleAppStateChange);
|
AppState.removeEventListener('change', this._handleAppStateChange);
|
||||||
BackHandler.removeEventListener('hardwareBackPress');
|
BackHandler.removeEventListener('hardwareBackPress');
|
||||||
Linking.removeEventListener('url', this._handleUrl);
|
Linking.removeEventListener('url', this._handleUrl);
|
||||||
|
if (this.emailVerifyCheckInterval > -1) {
|
||||||
|
clearInterval(this.emailVerifyCheckInterval);
|
||||||
|
}
|
||||||
|
if (this.syncGetInterval > -1) {
|
||||||
|
clearInterval(this.syncGetInterval);
|
||||||
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
componentDidUpdate() {
|
componentDidUpdate() {
|
||||||
const { dispatch, user } = this.props;
|
const { dispatch, user, hashChanged } = this.props;
|
||||||
if (this.state.verifyPending && this.emailVerifyCheckInterval > 0 && user && user.has_verified_email) {
|
if (this.state.verifyPending && this.emailVerifyCheckInterval > 0 && user && user.has_verified_email) {
|
||||||
clearInterval(this.emailVerifyCheckInterval);
|
clearInterval(this.emailVerifyCheckInterval);
|
||||||
AsyncStorage.setItem(Constants.KEY_EMAIL_VERIFY_PENDING, 'false');
|
AsyncStorage.setItem(Constants.KEY_EMAIL_VERIFY_PENDING, 'false');
|
||||||
this.setState({ verifyPending: false });
|
this.setState({ verifyPending: false });
|
||||||
|
|
||||||
NativeModules.Firebase.track('email_verified', { email: user.primary_email });
|
NativeModules.Firebase.track('email_verified', { email: user.primary_email });
|
||||||
ToastAndroid.show('Your email address was successfully verified.', ToastAndroid.LONG);
|
Snackbar.show({ title: __('Your email address was successfully verified.'), duration: Snackbar.LENGTH_LONG });
|
||||||
|
|
||||||
// upon successful email verification, do wallet sync (if password has been set)
|
// get user settings after email verification
|
||||||
NativeModules.UtilityModule.getSecureValue(Constants.KEY_FIRST_RUN_PASSWORD).then(walletPassword => {
|
this.getUserSettings();
|
||||||
if (walletPassword && walletPassword.trim().length > 0) {
|
}
|
||||||
dispatch(doGetSync(walletPassword));
|
|
||||||
}
|
if (hashChanged && !this.state.syncHashChanged) {
|
||||||
});
|
this.setState({ syncHashChanged: true });
|
||||||
|
this.getUserSettings();
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
@@ -335,7 +443,7 @@ class AppWithNavigationState extends React.Component {
|
|||||||
const { toast, emailToVerify, emailVerifyPending, emailVerifyErrorMessage, user } = nextProps;
|
const { toast, emailToVerify, emailVerifyPending, emailVerifyErrorMessage, user } = nextProps;
|
||||||
|
|
||||||
if (toast) {
|
if (toast) {
|
||||||
const { message } = toast;
|
const { message, isError } = toast;
|
||||||
let currentDisplayType;
|
let currentDisplayType;
|
||||||
if (!currentDisplayType && message) {
|
if (!currentDisplayType && message) {
|
||||||
// default to toast if no display type set and there is a message specified
|
// default to toast if no display type set and there is a message specified
|
||||||
@@ -343,7 +451,14 @@ class AppWithNavigationState extends React.Component {
|
|||||||
}
|
}
|
||||||
|
|
||||||
if (currentDisplayType === 'toast') {
|
if (currentDisplayType === 'toast') {
|
||||||
ToastAndroid.show(message, ToastAndroid.LONG);
|
const props = {
|
||||||
|
title: message,
|
||||||
|
duration: Snackbar.LENGTH_LONG,
|
||||||
|
};
|
||||||
|
if (isError) {
|
||||||
|
props.backgroundColor = Colors.Red;
|
||||||
|
}
|
||||||
|
Snackbar.show(props);
|
||||||
}
|
}
|
||||||
|
|
||||||
dispatch(doDismissToast());
|
dispatch(doDismissToast());
|
||||||
@@ -355,7 +470,7 @@ class AppWithNavigationState extends React.Component {
|
|||||||
this.setState({ emailVerifyDone: true });
|
this.setState({ emailVerifyDone: true });
|
||||||
const message = emailVerifyErrorMessage
|
const message = emailVerifyErrorMessage
|
||||||
? String(emailVerifyErrorMessage)
|
? String(emailVerifyErrorMessage)
|
||||||
: 'Your email address was successfully verified.';
|
: __('Your email address was successfully verified.');
|
||||||
if (!emailVerifyErrorMessage) {
|
if (!emailVerifyErrorMessage) {
|
||||||
AsyncStorage.removeItem(Constants.KEY_FIRST_RUN_EMAIL);
|
AsyncStorage.removeItem(Constants.KEY_FIRST_RUN_EMAIL);
|
||||||
}
|
}
|
||||||
@@ -390,6 +505,26 @@ class AppWithNavigationState extends React.Component {
|
|||||||
if (backgroundPlayEnabled || NativeModules.BackgroundMedia) {
|
if (backgroundPlayEnabled || NativeModules.BackgroundMedia) {
|
||||||
NativeModules.BackgroundMedia.hidePlaybackNotification();
|
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();
|
||||||
}
|
}
|
||||||
};
|
};
|
||||||
|
|
||||||
@@ -402,7 +537,7 @@ class AppWithNavigationState extends React.Component {
|
|||||||
try {
|
try {
|
||||||
verification = JSON.parse(atob(evt.url.substring(15)));
|
verification = JSON.parse(atob(evt.url.substring(15)));
|
||||||
} catch (error) {
|
} catch (error) {
|
||||||
console.log(error);
|
// console.log(error);
|
||||||
}
|
}
|
||||||
|
|
||||||
if (verification.token && verification.recaptcha) {
|
if (verification.token && verification.recaptcha) {
|
||||||
@@ -410,7 +545,7 @@ class AppWithNavigationState extends React.Component {
|
|||||||
try {
|
try {
|
||||||
dispatch(doUserEmailVerify(verification.token, verification.recaptcha));
|
dispatch(doUserEmailVerify(verification.token, verification.recaptcha));
|
||||||
} catch (error) {
|
} catch (error) {
|
||||||
const message = 'Invalid Verification Token';
|
const message = __('Invalid Verification Token');
|
||||||
dispatch(doUserEmailVerifyFailure(message));
|
dispatch(doUserEmailVerifyFailure(message));
|
||||||
dispatch(doToast({ message }));
|
dispatch(doToast({ message }));
|
||||||
}
|
}
|
||||||
@@ -418,7 +553,7 @@ class AppWithNavigationState extends React.Component {
|
|||||||
dispatch(
|
dispatch(
|
||||||
doToast({
|
doToast({
|
||||||
message: 'Invalid Verification URI',
|
message: 'Invalid Verification URI',
|
||||||
})
|
}),
|
||||||
);
|
);
|
||||||
}
|
}
|
||||||
} else {
|
} else {
|
||||||
@@ -434,6 +569,7 @@ class AppWithNavigationState extends React.Component {
|
|||||||
|
|
||||||
const mapStateToProps = state => ({
|
const mapStateToProps = state => ({
|
||||||
backgroundPlayEnabled: makeSelectClientSetting(SETTINGS.BACKGROUND_PLAY_ENABLED)(state),
|
backgroundPlayEnabled: makeSelectClientSetting(SETTINGS.BACKGROUND_PLAY_ENABLED)(state),
|
||||||
|
hashChanged: selectHashChanged(state),
|
||||||
keepDaemonRunning: makeSelectClientSetting(SETTINGS.KEEP_DAEMON_RUNNING)(state),
|
keepDaemonRunning: makeSelectClientSetting(SETTINGS.KEEP_DAEMON_RUNNING)(state),
|
||||||
nav: state.nav,
|
nav: state.nav,
|
||||||
toast: selectToast(state),
|
toast: selectToast(state),
|
||||||
@@ -443,6 +579,7 @@ const mapStateToProps = state => ({
|
|||||||
emailVerifyErrorMessage: selectEmailVerifyErrorMessage(state),
|
emailVerifyErrorMessage: selectEmailVerifyErrorMessage(state),
|
||||||
showNsfw: makeSelectClientSetting(SETTINGS.SHOW_NSFW)(state),
|
showNsfw: makeSelectClientSetting(SETTINGS.SHOW_NSFW)(state),
|
||||||
user: selectUser(state),
|
user: selectUser(state),
|
||||||
|
fullscreenMode: selectFullscreenMode(state),
|
||||||
});
|
});
|
||||||
|
|
||||||
export default connect(mapStateToProps)(AppWithNavigationState);
|
export default connect(mapStateToProps)(AppWithNavigationState);
|
||||||
@@ -15,7 +15,7 @@ export default class Address extends React.PureComponent<Props> {
|
|||||||
|
|
||||||
return (
|
return (
|
||||||
<View style={[walletStyle.row, style]}>
|
<View style={[walletStyle.row, style]}>
|
||||||
<Text selectable={true} numberOfLines={1} style={walletStyle.address}>
|
<Text selectable numberOfLines={1} style={walletStyle.address}>
|
||||||
{address || ''}
|
{address || ''}
|
||||||
</Text>
|
</Text>
|
||||||
<Button
|
<Button
|
||||||
@@ -24,7 +24,7 @@ export default class Address extends React.PureComponent<Props> {
|
|||||||
onPress={() => {
|
onPress={() => {
|
||||||
Clipboard.setString(address);
|
Clipboard.setString(address);
|
||||||
doToast({
|
doToast({
|
||||||
message: 'Address copied',
|
message: __('Address copied'),
|
||||||
});
|
});
|
||||||
}}
|
}}
|
||||||
/>
|
/>
|
||||||
|
|||||||
@@ -1,4 +0,0 @@
|
|||||||
import { connect } from 'react-redux';
|
|
||||||
import CategoryList from './view';
|
|
||||||
|
|
||||||
export default connect()(CategoryList);
|
|
||||||
@@ -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;
|
|
||||||
@@ -51,7 +51,7 @@ export default class ChannelIconItem extends React.PureComponent {
|
|||||||
<TouchableOpacity style={channelIconStyle.container} onPress={onPress}>
|
<TouchableOpacity style={channelIconStyle.container} onPress={onPress}>
|
||||||
{isResolvingUri && (
|
{isResolvingUri && (
|
||||||
<View style={channelIconStyle.centered}>
|
<View style={channelIconStyle.centered}>
|
||||||
<ActivityIndicator size={'small'} color={Colors.LbryGreen} />
|
<ActivityIndicator size={'small'} color={Colors.NextLbryGreen} />
|
||||||
</View>
|
</View>
|
||||||
)}
|
)}
|
||||||
<View
|
<View
|
||||||
@@ -63,7 +63,7 @@ export default class ChannelIconItem extends React.PureComponent {
|
|||||||
>
|
>
|
||||||
{isPlaceholder && (
|
{isPlaceholder && (
|
||||||
<View style={channelIconStyle.centered}>
|
<View style={channelIconStyle.centered}>
|
||||||
<Text style={channelIconStyle.placeholderText}>ALL</Text>
|
<Text style={channelIconStyle.placeholderText}>{__('ALL')}</Text>
|
||||||
</View>
|
</View>
|
||||||
)}
|
)}
|
||||||
{!isPlaceholder && thumbnail && (
|
{!isPlaceholder && thumbnail && (
|
||||||
|
|||||||
@@ -0,0 +1,4 @@
|
|||||||
|
import { connect } from 'react-redux';
|
||||||
|
import ChannelRewardsDriver from './view';
|
||||||
|
|
||||||
|
export default connect()(ChannelRewardsDriver);
|
||||||
@@ -0,0 +1,24 @@
|
|||||||
|
import React from 'react';
|
||||||
|
import { Text, TouchableOpacity } from 'react-native';
|
||||||
|
import Colors from 'styles/colors';
|
||||||
|
import Icon from 'react-native-vector-icons/FontAwesome5';
|
||||||
|
import publishStyle from 'styles/publish';
|
||||||
|
|
||||||
|
class ChannelRewardsDriver extends React.PureComponent<Props> {
|
||||||
|
render() {
|
||||||
|
const { navigation } = this.props;
|
||||||
|
|
||||||
|
return (
|
||||||
|
<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.')}
|
||||||
|
</Text>
|
||||||
|
</TouchableOpacity>
|
||||||
|
);
|
||||||
|
}
|
||||||
|
}
|
||||||
|
|
||||||
|
export default ChannelRewardsDriver;
|
||||||
@@ -7,6 +7,7 @@ import {
|
|||||||
doCreateChannel,
|
doCreateChannel,
|
||||||
doToast,
|
doToast,
|
||||||
} from 'lbry-redux';
|
} from 'lbry-redux';
|
||||||
|
import { doGetSync } from 'lbryinc';
|
||||||
import ChannelSelector from './view';
|
import ChannelSelector from './view';
|
||||||
|
|
||||||
const select = state => ({
|
const select = state => ({
|
||||||
@@ -19,6 +20,7 @@ const perform = dispatch => ({
|
|||||||
notify: data => dispatch(doToast(data)),
|
notify: data => dispatch(doToast(data)),
|
||||||
createChannel: (name, amount) => dispatch(doCreateChannel(name, amount)),
|
createChannel: (name, amount) => dispatch(doCreateChannel(name, amount)),
|
||||||
fetchChannelListMine: () => dispatch(doFetchChannelListMine()),
|
fetchChannelListMine: () => dispatch(doFetchChannelListMine()),
|
||||||
|
getSync: (password, callback) => dispatch(doGetSync(password, callback)),
|
||||||
});
|
});
|
||||||
|
|
||||||
export default connect(
|
export default connect(
|
||||||
|
|||||||
@@ -1,6 +1,7 @@
|
|||||||
import React from 'react';
|
import React from 'react';
|
||||||
import { CLAIM_VALUES, isURIValid } from 'lbry-redux';
|
import { CLAIM_VALUES, formatCredits, isNameValid } from 'lbry-redux';
|
||||||
import { ActivityIndicator, Picker, Text, TextInput, TouchableOpacity, View } from 'react-native';
|
import { ActivityIndicator, NativeModules, Picker, Text, TextInput, TouchableOpacity, View } from 'react-native';
|
||||||
|
import { logPublish } from 'utils/helper';
|
||||||
import Button from 'component/button';
|
import Button from 'component/button';
|
||||||
import Colors from 'styles/colors';
|
import Colors from 'styles/colors';
|
||||||
import Constants from 'constants'; // eslint-disable-line node/no-deprecated-api
|
import Constants from 'constants'; // eslint-disable-line node/no-deprecated-api
|
||||||
@@ -13,6 +14,7 @@ export default class ChannelSelector extends React.PureComponent {
|
|||||||
super(props);
|
super(props);
|
||||||
|
|
||||||
this.state = {
|
this.state = {
|
||||||
|
creditsInputFocused: false,
|
||||||
currentSelectedValue: Constants.ITEM_ANONYMOUS,
|
currentSelectedValue: Constants.ITEM_ANONYMOUS,
|
||||||
newChannelName: '',
|
newChannelName: '',
|
||||||
newChannelBid: 0.1,
|
newChannelBid: 0.1,
|
||||||
@@ -26,18 +28,22 @@ export default class ChannelSelector extends React.PureComponent {
|
|||||||
}
|
}
|
||||||
|
|
||||||
componentDidMount() {
|
componentDidMount() {
|
||||||
const { channels, channelName, fetchChannelListMine, fetchingChannels } = this.props;
|
const { channels = [], channelName, fetchChannelListMine, fetchingChannels } = this.props;
|
||||||
if (!channels.length && !fetchingChannels) {
|
if ((!channels || channels.length === 0) && !fetchingChannels) {
|
||||||
fetchChannelListMine();
|
fetchChannelListMine();
|
||||||
}
|
}
|
||||||
this.setState({ currentSelectedValue: channelName });
|
this.setState({ currentSelectedValue: channelName });
|
||||||
}
|
}
|
||||||
|
|
||||||
componentWillReceiveProps(nextProps) {
|
componentWillReceiveProps(nextProps) {
|
||||||
const { channels: prevChannels = [], channelName } = this.props;
|
const { channels: prevChannels = [], channelName: prevChannelName } = this.props;
|
||||||
const { channels = [] } = nextProps;
|
const { channels = [], channelName } = nextProps;
|
||||||
|
|
||||||
if (channels.length !== prevChannels.length && channelName !== this.state.currentSelectedValue) {
|
if (channels && channels.length !== prevChannels.length && channelName !== this.state.currentSelectedValue) {
|
||||||
|
this.setState({ currentSelectedValue: prevChannelName });
|
||||||
|
}
|
||||||
|
|
||||||
|
if (channelName !== prevChannelName) {
|
||||||
this.setState({ currentSelectedValue: channelName });
|
this.setState({ currentSelectedValue: channelName });
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
@@ -85,10 +91,10 @@ export default class ChannelSelector extends React.PureComponent {
|
|||||||
newChannelName = newChannelName.slice(1);
|
newChannelName = newChannelName.slice(1);
|
||||||
}
|
}
|
||||||
|
|
||||||
if (newChannelName.trim().length > 0 && !isURIValid(newChannelName)) {
|
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)) {
|
} 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({
|
this.setState({
|
||||||
@@ -117,21 +123,21 @@ export default class ChannelSelector extends React.PureComponent {
|
|||||||
};
|
};
|
||||||
|
|
||||||
handleCreateChannelClick = () => {
|
handleCreateChannelClick = () => {
|
||||||
const { balance, createChannel, onChannelChange, notify } = this.props;
|
const { balance, createChannel, getSync, onChannelChange, notify } = this.props;
|
||||||
const { newChannelBid, newChannelName } = this.state;
|
const { newChannelBid, newChannelName } = this.state;
|
||||||
|
|
||||||
if (newChannelName.trim().length === 0 || !isURIValid(newChannelName.substr(1), false)) {
|
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;
|
return;
|
||||||
}
|
}
|
||||||
|
|
||||||
if (this.channelExists(newChannelName)) {
|
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;
|
return;
|
||||||
}
|
}
|
||||||
|
|
||||||
if (newChannelBid > balance) {
|
if (newChannelBid > balance) {
|
||||||
notify({ message: 'Deposit cannot be higher than your balance' });
|
notify({ message: __('Deposit cannot be higher than your balance') });
|
||||||
return;
|
return;
|
||||||
}
|
}
|
||||||
|
|
||||||
@@ -142,21 +148,25 @@ export default class ChannelSelector extends React.PureComponent {
|
|||||||
createChannelError: undefined,
|
createChannelError: undefined,
|
||||||
});
|
});
|
||||||
|
|
||||||
const success = () => {
|
const success = channelClaim => {
|
||||||
this.setState({
|
this.setState({
|
||||||
creatingChannel: false,
|
creatingChannel: false,
|
||||||
addingChannel: false,
|
addingChannel: false,
|
||||||
currentSelectedValue: channelName,
|
currentSelectedValue: channelName,
|
||||||
showCreateChannel: false,
|
showCreateChannel: false,
|
||||||
});
|
});
|
||||||
|
logPublish(channelClaim);
|
||||||
|
|
||||||
if (onChannelChange) {
|
if (onChannelChange) {
|
||||||
onChannelChange(channelName);
|
onChannelChange(channelName);
|
||||||
}
|
}
|
||||||
|
|
||||||
|
// sync wallet
|
||||||
|
NativeModules.UtilityModule.getSecureValue(Constants.KEY_WALLET_PASSWORD).then(password => getSync(password));
|
||||||
};
|
};
|
||||||
|
|
||||||
const failure = () => {
|
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({
|
this.setState({
|
||||||
creatingChannel: false,
|
creatingChannel: false,
|
||||||
});
|
});
|
||||||
@@ -167,12 +177,14 @@ export default class ChannelSelector extends React.PureComponent {
|
|||||||
|
|
||||||
channelExists = name => {
|
channelExists = name => {
|
||||||
const { channels = [] } = this.props;
|
const { channels = [] } = this.props;
|
||||||
for (let channel of channels) {
|
if (channels) {
|
||||||
if (
|
for (let channel of channels) {
|
||||||
name.toLowerCase() === channel.name.toLowerCase() ||
|
if (
|
||||||
`@${name}`.toLowerCase() === channel.name.toLowerCase()
|
name.toLowerCase() === channel.name.toLowerCase() ||
|
||||||
) {
|
`@${name}`.toLowerCase() === channel.name.toLowerCase()
|
||||||
return true;
|
) {
|
||||||
|
return true;
|
||||||
|
}
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
@@ -181,8 +193,11 @@ export default class ChannelSelector extends React.PureComponent {
|
|||||||
|
|
||||||
render() {
|
render() {
|
||||||
const channel = this.state.addingChannel ? 'new' : this.props.channel;
|
const channel = this.state.addingChannel ? 'new' : this.props.channel;
|
||||||
const { enabled, fetchingChannels, channels = [] } = this.props;
|
const { balance, enabled, fetchingChannels, channels = [], showAnonymous } = this.props;
|
||||||
const pickerItems = [Constants.ITEM_ANONYMOUS, Constants.ITEM_CREATE_A_CHANNEL].concat(channels.map(ch => ch.name));
|
const pickerItems = (showAnonymous
|
||||||
|
? [Constants.ITEM_ANONYMOUS, Constants.ITEM_CREATE_A_CHANNEL]
|
||||||
|
: [Constants.ITEM_CREATE_A_CHANNEL]
|
||||||
|
).concat(channels ? channels.map(ch => ch.name) : []);
|
||||||
|
|
||||||
const {
|
const {
|
||||||
newChannelName,
|
newChannelName,
|
||||||
@@ -205,7 +220,11 @@ export default class ChannelSelector extends React.PureComponent {
|
|||||||
onValueChange={this.handlePickerValueChange}
|
onValueChange={this.handlePickerValueChange}
|
||||||
>
|
>
|
||||||
{pickerItems.map(item => (
|
{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>
|
</Picker>
|
||||||
|
|
||||||
@@ -218,7 +237,7 @@ export default class ChannelSelector extends React.PureComponent {
|
|||||||
style={channelSelectorStyle.channelNameInput}
|
style={channelSelectorStyle.channelNameInput}
|
||||||
value={this.state.newChannelName}
|
value={this.state.newChannelName}
|
||||||
onChangeText={this.handleNewChannelNameChange}
|
onChangeText={this.handleNewChannelNameChange}
|
||||||
placeholder={'Channel name'}
|
placeholder={__('Channel name')}
|
||||||
underlineColorAndroid={Colors.NextLbryGreen}
|
underlineColorAndroid={Colors.NextLbryGreen}
|
||||||
/>
|
/>
|
||||||
</View>
|
</View>
|
||||||
@@ -226,30 +245,38 @@ export default class ChannelSelector extends React.PureComponent {
|
|||||||
<Text style={channelSelectorStyle.inlineError}>{newChannelNameError}</Text>
|
<Text style={channelSelectorStyle.inlineError}>{newChannelNameError}</Text>
|
||||||
)}
|
)}
|
||||||
<View style={channelSelectorStyle.bidRow}>
|
<View style={channelSelectorStyle.bidRow}>
|
||||||
<Text style={channelSelectorStyle.label}>Deposit</Text>
|
<Text style={channelSelectorStyle.label}>{__('Deposit')}</Text>
|
||||||
<TextInput
|
<TextInput
|
||||||
style={channelSelectorStyle.bidAmountInput}
|
style={channelSelectorStyle.bidAmountInput}
|
||||||
value={String(newChannelBid)}
|
value={String(newChannelBid)}
|
||||||
onChangeText={this.handleNewChannelBidChange}
|
onChangeText={this.handleNewChannelBidChange}
|
||||||
|
onFocus={() => this.setState({ creditsInputFocused: true })}
|
||||||
|
onBlur={() => this.setState({ creditsInputFocused: false })}
|
||||||
placeholder={'0.00'}
|
placeholder={'0.00'}
|
||||||
keyboardType={'number-pad'}
|
keyboardType={'number-pad'}
|
||||||
underlineColorAndroid={Colors.NextLbryGreen}
|
underlineColorAndroid={Colors.NextLbryGreen}
|
||||||
/>
|
/>
|
||||||
<Text style={channelSelectorStyle.currency}>LBC</Text>
|
<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>
|
</View>
|
||||||
<Text style={channelSelectorStyle.helpText}>
|
<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>
|
</Text>
|
||||||
|
|
||||||
<View style={channelSelectorStyle.buttonContainer}>
|
<View style={channelSelectorStyle.buttonContainer}>
|
||||||
{creatingChannel && <ActivityIndicator size={'small'} color={Colors.LbryGreen} />}
|
{creatingChannel && <ActivityIndicator size={'small'} color={Colors.NextLbryGreen} />}
|
||||||
{!creatingChannel && (
|
{!creatingChannel && (
|
||||||
<View style={channelSelectorStyle.buttons}>
|
<View style={channelSelectorStyle.buttons}>
|
||||||
<Link style={channelSelectorStyle.cancelLink} text="Cancel" onPress={this.handleCreateCancel} />
|
<Link style={channelSelectorStyle.cancelLink} text={__('Cancel')} onPress={this.handleCreateCancel} />
|
||||||
<Button
|
<Button
|
||||||
style={channelSelectorStyle.createButton}
|
style={channelSelectorStyle.createButton}
|
||||||
disabled={!(newChannelName.trim().length > 0 && newChannelBid > 0)}
|
disabled={!(newChannelName.trim().length > 0 && newChannelBid > 0)}
|
||||||
text="Create"
|
text={__('Create')}
|
||||||
onPress={this.handleCreateChannelClick}
|
onPress={this.handleCreateChannelClick}
|
||||||
/>
|
/>
|
||||||
</View>
|
</View>
|
||||||
|
|||||||
@@ -12,7 +12,7 @@ import claimListStyle from 'styles/claimList';
|
|||||||
import discoverStyle from 'styles/discover';
|
import discoverStyle from 'styles/discover';
|
||||||
import moment from 'moment';
|
import moment from 'moment';
|
||||||
|
|
||||||
const horizontalLimit = 7;
|
const horizontalLimit = 10;
|
||||||
const softLimit = 500;
|
const softLimit = 500;
|
||||||
|
|
||||||
class ClaimList extends React.PureComponent {
|
class ClaimList extends React.PureComponent {
|
||||||
@@ -147,7 +147,7 @@ class ClaimList extends React.PureComponent {
|
|||||||
renderMorePlaceholder = () => {
|
renderMorePlaceholder = () => {
|
||||||
return (
|
return (
|
||||||
<TouchableOpacity style={discoverStyle.fileItemMore} onPress={this.onMorePressed}>
|
<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} />
|
<Icon style={discoverStyle.moreIcon} name={'angle-double-down'} color={Colors.White} size={16} />
|
||||||
</TouchableOpacity>
|
</TouchableOpacity>
|
||||||
);
|
);
|
||||||
@@ -155,7 +155,9 @@ class ClaimList extends React.PureComponent {
|
|||||||
|
|
||||||
verticalListEmptyComponent = () => {
|
verticalListEmptyComponent = () => {
|
||||||
return (
|
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>
|
||||||
);
|
);
|
||||||
};
|
};
|
||||||
|
|
||||||
|
|||||||
@@ -0,0 +1,42 @@
|
|||||||
|
import { connect } from 'react-redux';
|
||||||
|
import {
|
||||||
|
doResolveUri,
|
||||||
|
makeSelectClaimForUri,
|
||||||
|
makeSelectMetadataForUri,
|
||||||
|
makeSelectFileInfoForUri,
|
||||||
|
makeSelectIsUriResolving,
|
||||||
|
makeSelectClaimIsNsfw,
|
||||||
|
makeSelectShortUrlForUri,
|
||||||
|
makeSelectTitleForUri,
|
||||||
|
makeSelectThumbnailForUri,
|
||||||
|
} from 'lbry-redux';
|
||||||
|
import { doSetPlayerVisible } from 'redux/actions/drawer';
|
||||||
|
import { selectBlackListedOutpoints, selectFilteredOutpoints, selectRewardContentClaimIds } from 'lbryinc';
|
||||||
|
import { selectShowNsfw } from 'redux/selectors/settings';
|
||||||
|
import ClaimResultItem from './view';
|
||||||
|
|
||||||
|
const select = (state, props) => ({
|
||||||
|
blackListedOutpoints: selectBlackListedOutpoints(state),
|
||||||
|
claim: makeSelectClaimForUri(props.uri)(state),
|
||||||
|
fileInfo: makeSelectFileInfoForUri(props.uri)(state),
|
||||||
|
filteredOutpoints: selectFilteredOutpoints(state),
|
||||||
|
isDownloaded: !!makeSelectFileInfoForUri(props.uri)(state),
|
||||||
|
metadata: makeSelectMetadataForUri(props.uri)(state),
|
||||||
|
nsfw: makeSelectClaimIsNsfw(props.uri)(state),
|
||||||
|
isResolvingUri: makeSelectIsUriResolving(props.uri)(state),
|
||||||
|
obscureNsfw: !selectShowNsfw(state),
|
||||||
|
rewardedContentClaimIds: selectRewardContentClaimIds(state),
|
||||||
|
shortUrl: makeSelectShortUrlForUri(props.uri)(state),
|
||||||
|
title: makeSelectTitleForUri(props.uri)(state),
|
||||||
|
thumbnail: makeSelectThumbnailForUri(props.uri)(state),
|
||||||
|
});
|
||||||
|
|
||||||
|
const perform = dispatch => ({
|
||||||
|
resolveUri: uri => dispatch(doResolveUri(uri)),
|
||||||
|
setPlayerVisible: (visible, uri) => dispatch(doSetPlayerVisible(visible, uri)),
|
||||||
|
});
|
||||||
|
|
||||||
|
export default connect(
|
||||||
|
select,
|
||||||
|
perform,
|
||||||
|
)(ClaimResultItem);
|
||||||
@@ -0,0 +1,176 @@
|
|||||||
|
import React from 'react';
|
||||||
|
import { normalizeURI, parseURI } from 'lbry-redux';
|
||||||
|
import { ActivityIndicator, Platform, Text, TouchableOpacity, View } from 'react-native';
|
||||||
|
import { navigateToUri, getDownloadProgress, getStorageForFileInfo } from 'utils/helper';
|
||||||
|
import Colors from 'styles/colors';
|
||||||
|
import ChannelIconItem from 'component/channelIconItem';
|
||||||
|
import channelIconStyle from 'styles/channelIcon';
|
||||||
|
import Constants from 'constants'; // eslint-disable-line node/no-deprecated-api
|
||||||
|
import DateTime from 'component/dateTime';
|
||||||
|
import FastImage from 'react-native-fast-image';
|
||||||
|
import FileItemMedia from 'component/fileItemMedia';
|
||||||
|
import FilePrice from 'component/filePrice';
|
||||||
|
import Icon from 'react-native-vector-icons/FontAwesome5';
|
||||||
|
import Link from 'component/link';
|
||||||
|
import NsfwOverlay from 'component/nsfwOverlay';
|
||||||
|
import ProgressBar from 'component/progressBar';
|
||||||
|
import fileListStyle from 'styles/fileList';
|
||||||
|
import seedrandom from 'seedrandom';
|
||||||
|
|
||||||
|
class ClaimResultItem extends React.PureComponent {
|
||||||
|
state = {
|
||||||
|
autoStyle: null,
|
||||||
|
};
|
||||||
|
|
||||||
|
componentDidMount() {
|
||||||
|
const { result } = this.props;
|
||||||
|
|
||||||
|
if (!result || !result.name || !result.claimId) {
|
||||||
|
this.setState({
|
||||||
|
autoStyle:
|
||||||
|
ChannelIconItem.AUTO_THUMB_STYLES[Math.floor(Math.random() * ChannelIconItem.AUTO_THUMB_STYLES.length)],
|
||||||
|
});
|
||||||
|
} else {
|
||||||
|
// result property set, use deterministic random style
|
||||||
|
const rng = seedrandom(normalizeURI(`${result.name}#${result.claimId}`));
|
||||||
|
const index = Math.floor(rng.quick() * ChannelIconItem.AUTO_THUMB_STYLES.length);
|
||||||
|
this.setState({ autoStyle: ChannelIconItem.AUTO_THUMB_STYLES[index] });
|
||||||
|
}
|
||||||
|
}
|
||||||
|
|
||||||
|
onPressHandler = () => {
|
||||||
|
const { autoplay, navigation, result, setPlayerVisible } = this.props;
|
||||||
|
const { claimId, name } = result;
|
||||||
|
const url = normalizeURI(`${name}#${claimId}`);
|
||||||
|
navigateToUri(navigation, url, { autoplay }, false, url, setPlayerVisible);
|
||||||
|
};
|
||||||
|
|
||||||
|
render() {
|
||||||
|
const { fileInfo, navigation, obscureNsfw, result, rewardedContentClaimIds, setPlayerVisible, style } = this.props;
|
||||||
|
const {
|
||||||
|
channel,
|
||||||
|
channel_claim_id: channelClaimId,
|
||||||
|
claimId,
|
||||||
|
duration,
|
||||||
|
fee,
|
||||||
|
name,
|
||||||
|
nsfw,
|
||||||
|
release_time: releaseTime,
|
||||||
|
thumbnail_url: thumbnailUrl,
|
||||||
|
title,
|
||||||
|
} = result;
|
||||||
|
|
||||||
|
const isChannel = name && name.startsWith('@');
|
||||||
|
const hasThumbnail = !!thumbnailUrl;
|
||||||
|
const obscure = obscureNsfw && nsfw;
|
||||||
|
const url = normalizeURI(`${name}#${claimId}`);
|
||||||
|
const hasChannel = !!channel;
|
||||||
|
const channelUrl = hasChannel ? normalizeURI(`${channel}#${channelClaimId}`) : null;
|
||||||
|
const isRewardContent = rewardedContentClaimIds.includes(claimId);
|
||||||
|
|
||||||
|
return (
|
||||||
|
<View style={style}>
|
||||||
|
<TouchableOpacity
|
||||||
|
style={[style, isChannel ? fileListStyle.channelContainer : null]}
|
||||||
|
onPress={this.onPressHandler}
|
||||||
|
>
|
||||||
|
{!isChannel && (
|
||||||
|
<FileItemMedia
|
||||||
|
style={fileListStyle.thumbnail}
|
||||||
|
duration={duration}
|
||||||
|
resizeMode="cover"
|
||||||
|
title={title || name || normalizeURI(url).substring(7)}
|
||||||
|
thumbnail={thumbnailUrl}
|
||||||
|
/>
|
||||||
|
)}
|
||||||
|
|
||||||
|
{isChannel && (
|
||||||
|
<View style={fileListStyle.channelThumbnailView}>
|
||||||
|
<View style={[fileListStyle.channelThumbnailContainer, this.state.autoStyle]}>
|
||||||
|
{hasThumbnail && (
|
||||||
|
<FastImage
|
||||||
|
style={fileListStyle.channelThumbnail}
|
||||||
|
resizeMode={FastImage.resizeMode.cover}
|
||||||
|
source={{ uri: thumbnailUrl }}
|
||||||
|
/>
|
||||||
|
)}
|
||||||
|
{!hasThumbnail && (
|
||||||
|
<Text style={channelIconStyle.autothumbCharacter}>
|
||||||
|
{title ? title.substring(0, 1).toUpperCase() : name.substring(1, 2).toUpperCase()}
|
||||||
|
</Text>
|
||||||
|
)}
|
||||||
|
</View>
|
||||||
|
</View>
|
||||||
|
)}
|
||||||
|
|
||||||
|
{fileInfo && fileInfo.completed && fileInfo.download_path && (
|
||||||
|
<Icon style={fileListStyle.downloadedIcon} solid color={Colors.NextLbryGreen} name={'folder'} size={16} />
|
||||||
|
)}
|
||||||
|
<FilePrice
|
||||||
|
cost={fee ? parseFloat(fee) / 100000000 : 0}
|
||||||
|
uri={url}
|
||||||
|
style={fileListStyle.filePriceContainer}
|
||||||
|
iconStyle={fileListStyle.filePriceIcon}
|
||||||
|
textStyle={fileListStyle.filePriceText}
|
||||||
|
/>
|
||||||
|
<View style={fileListStyle.detailsContainer}>
|
||||||
|
{(title || name) && (
|
||||||
|
<View style={fileListStyle.titleContainer}>
|
||||||
|
<Text style={fileListStyle.title} numberOfLines={3}>
|
||||||
|
{title || name}
|
||||||
|
</Text>
|
||||||
|
{isRewardContent && <Icon style={fileListStyle.rewardIcon} name="award" size={12} />}
|
||||||
|
</View>
|
||||||
|
)}
|
||||||
|
|
||||||
|
{(hasChannel || isChannel) && (
|
||||||
|
<Link
|
||||||
|
style={fileListStyle.publisher}
|
||||||
|
text={isChannel ? name : channel}
|
||||||
|
onPress={() => {
|
||||||
|
navigateToUri(
|
||||||
|
navigation,
|
||||||
|
normalizeURI(isChannel ? url : channelUrl),
|
||||||
|
null,
|
||||||
|
false,
|
||||||
|
isChannel ? url : channelUrl,
|
||||||
|
setPlayerVisible,
|
||||||
|
);
|
||||||
|
}}
|
||||||
|
/>
|
||||||
|
)}
|
||||||
|
|
||||||
|
<View style={fileListStyle.info}>
|
||||||
|
{fileInfo && !isNaN(fileInfo.written_bytes) && fileInfo.written_bytes > 0 && (
|
||||||
|
<Text style={fileListStyle.infoText}>{getStorageForFileInfo(fileInfo)}</Text>
|
||||||
|
)}
|
||||||
|
<DateTime
|
||||||
|
style={fileListStyle.publishInfo}
|
||||||
|
textStyle={fileListStyle.infoText}
|
||||||
|
timeAgo
|
||||||
|
date={releaseTime}
|
||||||
|
/>
|
||||||
|
</View>
|
||||||
|
|
||||||
|
{fileInfo && fileInfo.download_path && (
|
||||||
|
<View style={fileListStyle.downloadInfo}>
|
||||||
|
{!fileInfo.completed && (
|
||||||
|
<ProgressBar
|
||||||
|
borderRadius={3}
|
||||||
|
color={Colors.NextLbryGreen}
|
||||||
|
height={3}
|
||||||
|
style={fileListStyle.progress}
|
||||||
|
progress={getDownloadProgress(fileInfo)}
|
||||||
|
/>
|
||||||
|
)}
|
||||||
|
</View>
|
||||||
|
)}
|
||||||
|
</View>
|
||||||
|
</TouchableOpacity>
|
||||||
|
{obscure && <NsfwOverlay onPress={() => navigation.navigate({ routeName: 'Settings', key: 'settingsPage' })} />}
|
||||||
|
</View>
|
||||||
|
);
|
||||||
|
}
|
||||||
|
}
|
||||||
|
|
||||||
|
export default ClaimResultItem;
|
||||||
@@ -20,7 +20,7 @@ class CustomRewardCard extends React.PureComponent<Props> {
|
|||||||
if (error && error.trim().length > 0) {
|
if (error && error.trim().length > 0) {
|
||||||
notify({ message: error });
|
notify({ message: error });
|
||||||
} else {
|
} else {
|
||||||
notify({ message: 'Reward successfully claimed!' });
|
notify({ message: __('Reward successfully claimed!') });
|
||||||
this.setState({ rewardCode: '' });
|
this.setState({ rewardCode: '' });
|
||||||
}
|
}
|
||||||
this.setState({ claimStarted: false });
|
this.setState({ claimStarted: false });
|
||||||
@@ -37,12 +37,12 @@ class CustomRewardCard extends React.PureComponent<Props> {
|
|||||||
if (showVerification) {
|
if (showVerification) {
|
||||||
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;
|
return;
|
||||||
}
|
}
|
||||||
|
|
||||||
if (!rewardCode || rewardCode.trim().length === 0) {
|
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;
|
return;
|
||||||
}
|
}
|
||||||
|
|
||||||
@@ -60,9 +60,9 @@ class CustomRewardCard extends React.PureComponent<Props> {
|
|||||||
{rewardIsPending && <ActivityIndicator size="small" color={Colors.NextLbryGreen} />}
|
{rewardIsPending && <ActivityIndicator size="small" color={Colors.NextLbryGreen} />}
|
||||||
</View>
|
</View>
|
||||||
<View style={rewardStyle.midCol}>
|
<View style={rewardStyle.midCol}>
|
||||||
<Text style={rewardStyle.rewardTitle}>Custom Code</Text>
|
<Text style={rewardStyle.rewardTitle}>{__('Custom Code')}</Text>
|
||||||
<Text style={rewardStyle.rewardDescription}>
|
<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>
|
</Text>
|
||||||
|
|
||||||
<View>
|
<View>
|
||||||
@@ -74,7 +74,7 @@ class CustomRewardCard extends React.PureComponent<Props> {
|
|||||||
/>
|
/>
|
||||||
<Button
|
<Button
|
||||||
style={rewardStyle.redeemButton}
|
style={rewardStyle.redeemButton}
|
||||||
text={'Redeem'}
|
text={__('Redeem')}
|
||||||
disabled={!this.state.rewardCode || this.state.rewardCode.trim().length === 0 || rewardIsPending}
|
disabled={!this.state.rewardCode || this.state.rewardCode.trim().length === 0 || rewardIsPending}
|
||||||
onPress={() => {
|
onPress={() => {
|
||||||
if (!rewardIsPending) {
|
if (!rewardIsPending) {
|
||||||
|
|||||||
@@ -1,4 +1,18 @@
|
|||||||
import { connect } from 'react-redux';
|
import { connect } from 'react-redux';
|
||||||
|
import { doFetchChannelListMine, selectMyChannelClaims } from 'lbry-redux';
|
||||||
|
import { selectUser } from 'lbryinc';
|
||||||
import DrawerContent from './view';
|
import DrawerContent from './view';
|
||||||
|
|
||||||
export default connect()(DrawerContent);
|
const select = state => ({
|
||||||
|
channels: selectMyChannelClaims(state),
|
||||||
|
user: selectUser(state),
|
||||||
|
});
|
||||||
|
|
||||||
|
const perform = dispatch => ({
|
||||||
|
fetchChannelListMine: () => dispatch(doFetchChannelListMine()),
|
||||||
|
});
|
||||||
|
|
||||||
|
export default connect(
|
||||||
|
select,
|
||||||
|
perform
|
||||||
|
)(DrawerContent);
|
||||||
@@ -1,25 +1,28 @@
|
|||||||
import React from 'react';
|
import React from 'react';
|
||||||
import { DrawerItems, SafeAreaView } from 'react-navigation';
|
import { DrawerItems, SafeAreaView } from 'react-navigation';
|
||||||
import { ScrollView, Text, TouchableOpacity, View } from 'react-native';
|
import { Image, ScrollView, Text, TouchableOpacity, View } from 'react-native';
|
||||||
|
import Button from 'component/button';
|
||||||
import Constants from 'constants'; // eslint-disable-line node/no-deprecated-api
|
import Constants from 'constants'; // eslint-disable-line node/no-deprecated-api
|
||||||
import Icon from 'react-native-vector-icons/FontAwesome5';
|
import Icon from 'react-native-vector-icons/FontAwesome5';
|
||||||
|
import channelIconStyle from 'styles/channelIcon';
|
||||||
import discoverStyle from 'styles/discover';
|
import discoverStyle from 'styles/discover';
|
||||||
|
|
||||||
const groupedMenuItems = {
|
const groupedMenuItems = {
|
||||||
'Find content': [
|
'Find content': [
|
||||||
{ icon: 'hashtag', label: 'Your tags', route: Constants.DRAWER_ROUTE_DISCOVER },
|
{ icon: 'hashtag', label: 'Your Tags', route: Constants.DRAWER_ROUTE_DISCOVER },
|
||||||
{ icon: 'heart', solid: true, label: 'Subscriptions', route: Constants.DRAWER_ROUTE_SUBSCRIPTIONS },
|
{ icon: 'heart', solid: true, label: 'Following', route: Constants.DRAWER_ROUTE_SUBSCRIPTIONS },
|
||||||
{ icon: 'globe-americas', label: 'All content', route: Constants.DRAWER_ROUTE_TRENDING },
|
{ icon: 'globe-americas', label: 'All Content', route: Constants.DRAWER_ROUTE_TRENDING },
|
||||||
],
|
],
|
||||||
'Your content': [
|
'Your content': [
|
||||||
{ icon: 'at', label: 'Channels', route: Constants.DRAWER_ROUTE_CHANNEL_CREATOR },
|
{ icon: 'at', label: 'Channels', route: Constants.DRAWER_ROUTE_CHANNEL_CREATOR },
|
||||||
{ icon: 'download', label: 'Library', route: Constants.DRAWER_ROUTE_MY_LBRY },
|
{ icon: 'download', label: 'Library', route: Constants.DRAWER_ROUTE_MY_LBRY },
|
||||||
{ icon: 'cloud-upload-alt', label: 'Publishes', route: Constants.DRAWER_ROUTE_PUBLISHES },
|
{ icon: 'cloud-upload-alt', label: 'Publishes', route: Constants.DRAWER_ROUTE_PUBLISHES },
|
||||||
{ icon: 'upload', label: 'New publish', route: Constants.DRAWER_ROUTE_PUBLISH },
|
{ icon: 'upload', label: 'New Publish', route: Constants.DRAWER_ROUTE_PUBLISH },
|
||||||
],
|
],
|
||||||
Wallet: [
|
Wallet: [
|
||||||
{ icon: 'wallet', label: 'Wallet', route: Constants.DRAWER_ROUTE_WALLET },
|
{ icon: 'wallet', label: 'Wallet', route: Constants.DRAWER_ROUTE_WALLET },
|
||||||
{ icon: 'award', label: 'Rewards', route: Constants.DRAWER_ROUTE_REWARDS },
|
{ icon: 'award', label: 'Rewards', route: Constants.DRAWER_ROUTE_REWARDS },
|
||||||
|
{ icon: 'user-friends', label: 'Invites', route: Constants.DRAWER_ROUTE_INVITES },
|
||||||
],
|
],
|
||||||
Settings: [
|
Settings: [
|
||||||
{ icon: 'cog', label: 'Settings', route: Constants.DRAWER_ROUTE_SETTINGS },
|
{ icon: 'cog', label: 'Settings', route: Constants.DRAWER_ROUTE_SETTINGS },
|
||||||
@@ -30,19 +33,104 @@ const groupedMenuItems = {
|
|||||||
const groupNames = Object.keys(groupedMenuItems);
|
const groupNames = Object.keys(groupedMenuItems);
|
||||||
|
|
||||||
class DrawerContent extends React.PureComponent {
|
class DrawerContent extends React.PureComponent {
|
||||||
|
componentDidMount() {
|
||||||
|
const { fetchChannelListMine } = this.props;
|
||||||
|
fetchChannelListMine();
|
||||||
|
}
|
||||||
|
|
||||||
|
getAvatarImageUrl = () => {
|
||||||
|
const { channels = [] } = this.props;
|
||||||
|
if (channels) {
|
||||||
|
// get the first channel thumbnail found. In the future, allow the user to select a default channel thumbnail?
|
||||||
|
for (let i = 0; i < channels.length; i++) {
|
||||||
|
if (channels[i].value && channels[i].value.thumbnail) {
|
||||||
|
return channels[i].value.thumbnail.url;
|
||||||
|
}
|
||||||
|
}
|
||||||
|
}
|
||||||
|
|
||||||
|
return null;
|
||||||
|
};
|
||||||
|
|
||||||
|
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, signInFlow: true },
|
||||||
|
});
|
||||||
|
};
|
||||||
|
|
||||||
render() {
|
render() {
|
||||||
const { activeTintColor, navigation, onItemPress } = this.props;
|
const { activeTintColor, navigation, user, onItemPress } = this.props;
|
||||||
const { state } = navigation;
|
const { state } = navigation;
|
||||||
|
|
||||||
const activeItemKey = state.routes[state.index] ? state.routes[state.index].key : null;
|
const activeItemKey = state.routes[state.index] ? state.routes[state.index].key : null;
|
||||||
|
const signedIn = user && user.has_verified_email;
|
||||||
|
const avatarImageUrl = this.getAvatarImageUrl();
|
||||||
|
|
||||||
return (
|
return (
|
||||||
<View style={discoverStyle.drawerContentArea}>
|
<View style={discoverStyle.drawerContentArea}>
|
||||||
|
{false && (
|
||||||
|
<View style={discoverStyle.signInContainer}>
|
||||||
|
{!signedIn && (
|
||||||
|
<Button
|
||||||
|
style={discoverStyle.signInButton}
|
||||||
|
theme={'light'}
|
||||||
|
text={__('Sign in')}
|
||||||
|
onPress={this.launchSignInFlow}
|
||||||
|
/>
|
||||||
|
)}
|
||||||
|
{signedIn && (
|
||||||
|
<View style={discoverStyle.signedIn}>
|
||||||
|
<View style={discoverStyle.signedInAvatar}>
|
||||||
|
{avatarImageUrl && (
|
||||||
|
<Image
|
||||||
|
style={discoverStyle.signedInAvatarImage}
|
||||||
|
resizeMode={'cover'}
|
||||||
|
source={{ uri: avatarImageUrl }}
|
||||||
|
/>
|
||||||
|
)}
|
||||||
|
{!avatarImageUrl && (
|
||||||
|
<Text style={channelIconStyle.autothumbCharacter}>
|
||||||
|
{user.primary_email.substring(0, 1).toUpperCase()}
|
||||||
|
</Text>
|
||||||
|
)}
|
||||||
|
</View>
|
||||||
|
<Text style={discoverStyle.signedInEmail} numberOfLines={1}>
|
||||||
|
{user.primary_email}
|
||||||
|
</Text>
|
||||||
|
</View>
|
||||||
|
)}
|
||||||
|
</View>
|
||||||
|
)}
|
||||||
|
|
||||||
<ScrollView contentContainerStyle={discoverStyle.menuScrollContent}>
|
<ScrollView contentContainerStyle={discoverStyle.menuScrollContent}>
|
||||||
<SafeAreaView
|
<SafeAreaView
|
||||||
style={discoverStyle.drawerContentContainer}
|
style={discoverStyle.drawerContentContainer}
|
||||||
forceInset={{ top: 'always', horizontal: 'never' }}
|
forceInset={{ top: 'always', horizontal: 'never' }}
|
||||||
>
|
>
|
||||||
|
{!signedIn && (
|
||||||
|
<TouchableOpacity
|
||||||
|
accessible
|
||||||
|
accessibilityLabel={__('Sign In')}
|
||||||
|
onPress={this.launchSignInFlow}
|
||||||
|
delayPressIn={0}
|
||||||
|
style={[discoverStyle.signInMenuItem, discoverStyle.signInMenuItemButton]}
|
||||||
|
>
|
||||||
|
<Text style={discoverStyle.signInMenuItemButtonText}>{__('SIGN IN')}</Text>
|
||||||
|
</TouchableOpacity>
|
||||||
|
)}
|
||||||
|
|
||||||
|
{signedIn && (
|
||||||
|
<View style={[discoverStyle.signInMenuItem, discoverStyle.signInMenuItemBorder]}>
|
||||||
|
<Text style={discoverStyle.signInMenuItemText} numberOfLines={1}>
|
||||||
|
{user.primary_email.toUpperCase()}
|
||||||
|
</Text>
|
||||||
|
</View>
|
||||||
|
)}
|
||||||
|
|
||||||
{groupNames.map(groupName => {
|
{groupNames.map(groupName => {
|
||||||
const menuItems = groupedMenuItems[groupName];
|
const menuItems = groupedMenuItems[groupName];
|
||||||
|
|
||||||
@@ -50,7 +138,7 @@ class DrawerContent extends React.PureComponent {
|
|||||||
<View key={groupName} style={discoverStyle.menuGroup}>
|
<View key={groupName} style={discoverStyle.menuGroup}>
|
||||||
{groupNames[3] !== groupName && (
|
{groupNames[3] !== groupName && (
|
||||||
<Text key={`${groupName}-title`} style={discoverStyle.menuGroupName}>
|
<Text key={`${groupName}-title`} style={discoverStyle.menuGroupName}>
|
||||||
{groupName}
|
{__(groupName)}
|
||||||
</Text>
|
</Text>
|
||||||
)}
|
)}
|
||||||
{menuItems.map(item => {
|
{menuItems.map(item => {
|
||||||
@@ -63,7 +151,7 @@ class DrawerContent extends React.PureComponent {
|
|||||||
return (
|
return (
|
||||||
<TouchableOpacity
|
<TouchableOpacity
|
||||||
accessible
|
accessible
|
||||||
accessibilityLabel={item.label}
|
accessibilityLabel={__(item.label)}
|
||||||
style={[
|
style={[
|
||||||
discoverStyle.menuItemTouchArea,
|
discoverStyle.menuItemTouchArea,
|
||||||
focused ? discoverStyle.menuItemTouchAreaFocused : null,
|
focused ? discoverStyle.menuItemTouchAreaFocused : null,
|
||||||
@@ -81,7 +169,7 @@ class DrawerContent extends React.PureComponent {
|
|||||||
/>
|
/>
|
||||||
</View>
|
</View>
|
||||||
<Text style={[discoverStyle.menuItem, focused ? discoverStyle.menuItemFocused : null]}>
|
<Text style={[discoverStyle.menuItem, focused ? discoverStyle.menuItemFocused : null]}>
|
||||||
{item.label}
|
{__(item.label)}
|
||||||
</Text>
|
</Text>
|
||||||
</TouchableOpacity>
|
</TouchableOpacity>
|
||||||
);
|
);
|
||||||
|
|||||||
@@ -0,0 +1,4 @@
|
|||||||
|
import { connect } from 'react-redux';
|
||||||
|
import EmptyStateView from './view';
|
||||||
|
|
||||||
|
export default connect()(EmptyStateView);
|
||||||
@@ -0,0 +1,26 @@
|
|||||||
|
import React from 'react';
|
||||||
|
import { NativeModules, Text, View, Image, TouchableOpacity } from 'react-native';
|
||||||
|
import Button from '../button';
|
||||||
|
import emptyStateStyle from 'styles/emptyState';
|
||||||
|
|
||||||
|
class EmptyStateView extends React.PureComponent {
|
||||||
|
render() {
|
||||||
|
const { message, buttonText, inner, onButtonPress } = this.props;
|
||||||
|
|
||||||
|
return (
|
||||||
|
<View
|
||||||
|
style={[emptyStateStyle.container, inner ? emptyStateStyle.innerContainer : emptyStateStyle.outerContainer]}
|
||||||
|
>
|
||||||
|
<Image style={emptyStateStyle.image} resizeMode={'stretch'} source={require('../../assets/gerbil-happy.png')} />
|
||||||
|
<Text style={emptyStateStyle.message}>{message}</Text>
|
||||||
|
{buttonText && (
|
||||||
|
<View style={emptyStateStyle.buttonContainer}>
|
||||||
|
<Button style={emptyStateStyle.button} text={buttonText} onPress={onButtonPress} />
|
||||||
|
</View>
|
||||||
|
)}
|
||||||
|
</View>
|
||||||
|
);
|
||||||
|
}
|
||||||
|
}
|
||||||
|
|
||||||
|
export default EmptyStateView;
|
||||||
@@ -11,11 +11,6 @@ class FileDownloadButton extends React.PureComponent {
|
|||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
componentWillReceiveProps(nextProps) {
|
|
||||||
//this.checkAvailability(nextProps.uri);
|
|
||||||
//this.restartDownload(nextProps);
|
|
||||||
}
|
|
||||||
|
|
||||||
restartDownload(props) {
|
restartDownload(props) {
|
||||||
const { downloading, fileInfo, uri, restartDownload } = props;
|
const { downloading, fileInfo, uri, restartDownload } = props;
|
||||||
|
|
||||||
@@ -35,7 +30,6 @@ class FileDownloadButton extends React.PureComponent {
|
|||||||
fileInfo,
|
fileInfo,
|
||||||
downloading,
|
downloading,
|
||||||
uri,
|
uri,
|
||||||
purchaseUri,
|
|
||||||
costInfo,
|
costInfo,
|
||||||
isPlayable,
|
isPlayable,
|
||||||
isViewable,
|
isViewable,
|
||||||
@@ -45,18 +39,27 @@ class FileDownloadButton extends React.PureComponent {
|
|||||||
doPause,
|
doPause,
|
||||||
style,
|
style,
|
||||||
openFile,
|
openFile,
|
||||||
|
onFileActionPress,
|
||||||
onButtonLayout,
|
onButtonLayout,
|
||||||
} = this.props;
|
} = this.props;
|
||||||
|
|
||||||
if ((fileInfo && !fileInfo.stopped) || loading || downloading) {
|
if (fileInfo && fileInfo.download_path && fileInfo.completed) {
|
||||||
|
return (
|
||||||
|
<TouchableOpacity
|
||||||
|
onLayout={onButtonLayout}
|
||||||
|
style={[style, fileDownloadButtonStyle.container]}
|
||||||
|
onPress={openFile}
|
||||||
|
>
|
||||||
|
<Text style={fileDownloadButtonStyle.text}>{isViewable ? __('View') : __('Open')}</Text>
|
||||||
|
</TouchableOpacity>
|
||||||
|
);
|
||||||
|
} else if ((fileInfo && !fileInfo.stopped) || loading || downloading) {
|
||||||
const progress = fileInfo && fileInfo.written_bytes ? (fileInfo.written_bytes / fileInfo.total_bytes) * 100 : 0,
|
const progress = fileInfo && fileInfo.written_bytes ? (fileInfo.written_bytes / fileInfo.total_bytes) * 100 : 0,
|
||||||
label = fileInfo ? progress.toFixed(0) + '% complete' : 'Connecting...';
|
label = fileInfo ? __('%progress%% complete', { progress: progress.toFixed(0) }) : __('Connecting...');
|
||||||
|
|
||||||
return (
|
return (
|
||||||
<View style={[style, fileDownloadButtonStyle.container]}>
|
<View style={[style, fileDownloadButtonStyle.container]}>
|
||||||
<View
|
<View style={{ width: `${progress}%`, backgroundColor: '#ff0000', position: 'absolute', left: 0, top: 0 }} />
|
||||||
style={{ width: `${progress}%`, backgroundColor: '#ff0000', position: 'absolute', left: 0, top: 0 }}
|
|
||||||
></View>
|
|
||||||
<Text style={fileDownloadButtonStyle.text}>{label}</Text>
|
<Text style={fileDownloadButtonStyle.text}>{label}</Text>
|
||||||
</View>
|
</View>
|
||||||
);
|
);
|
||||||
@@ -64,43 +67,19 @@ class FileDownloadButton extends React.PureComponent {
|
|||||||
if (!costInfo) {
|
if (!costInfo) {
|
||||||
return (
|
return (
|
||||||
<View style={[style, fileDownloadButtonStyle.container]}>
|
<View style={[style, fileDownloadButtonStyle.container]}>
|
||||||
<Text style={fileDownloadButtonStyle.text}>Fetching cost info...</Text>
|
<Text style={fileDownloadButtonStyle.text}>{__('Fetching cost info...')}</Text>
|
||||||
</View>
|
</View>
|
||||||
);
|
);
|
||||||
}
|
}
|
||||||
return (
|
return (
|
||||||
<Button
|
<Button
|
||||||
icon={isPlayable ? 'play' : null}
|
icon={isPlayable ? 'play' : null}
|
||||||
text={isPlayable ? 'Play' : isViewable ? 'View' : 'Download'}
|
text={isPlayable ? __('Play') : isViewable ? __('View') : __('Download')}
|
||||||
onLayout={onButtonLayout}
|
onLayout={onButtonLayout}
|
||||||
style={[style, fileDownloadButtonStyle.container]}
|
style={[style, fileDownloadButtonStyle.container]}
|
||||||
onPress={() => {
|
onPress={onFileActionPress}
|
||||||
if (NativeModules.Firebase) {
|
|
||||||
NativeModules.Firebase.track('purchase_uri', { uri: uri });
|
|
||||||
}
|
|
||||||
purchaseUri(uri, costInfo, !isPlayable);
|
|
||||||
if (NativeModules.UtilityModule) {
|
|
||||||
NativeModules.UtilityModule.checkDownloads();
|
|
||||||
}
|
|
||||||
if (isPlayable && onPlay) {
|
|
||||||
this.props.onPlay();
|
|
||||||
}
|
|
||||||
if (isViewable && onView) {
|
|
||||||
this.props.onView();
|
|
||||||
}
|
|
||||||
}}
|
|
||||||
/>
|
/>
|
||||||
);
|
);
|
||||||
} else if (fileInfo && fileInfo.download_path) {
|
|
||||||
return (
|
|
||||||
<TouchableOpacity
|
|
||||||
onLayout={onButtonLayout}
|
|
||||||
style={[style, fileDownloadButtonStyle.container]}
|
|
||||||
onPress={openFile}
|
|
||||||
>
|
|
||||||
<Text style={fileDownloadButtonStyle.text}>{isViewable ? 'View' : 'Open'}</Text>
|
|
||||||
</TouchableOpacity>
|
|
||||||
);
|
|
||||||
}
|
}
|
||||||
|
|
||||||
return null;
|
return null;
|
||||||
|
|||||||
@@ -10,13 +10,16 @@ import {
|
|||||||
makeSelectClaimIsNsfw,
|
makeSelectClaimIsNsfw,
|
||||||
makeSelectShortUrlForUri,
|
makeSelectShortUrlForUri,
|
||||||
} from 'lbry-redux';
|
} from 'lbry-redux';
|
||||||
import { selectRewardContentClaimIds } from 'lbryinc';
|
import { doSetPlayerVisible } from 'redux/actions/drawer';
|
||||||
|
import { selectBlackListedOutpoints, selectFilteredOutpoints, selectRewardContentClaimIds } from 'lbryinc';
|
||||||
import { selectShowNsfw } from 'redux/selectors/settings';
|
import { selectShowNsfw } from 'redux/selectors/settings';
|
||||||
import FileItem from './view';
|
import FileItem from './view';
|
||||||
|
|
||||||
const select = (state, props) => ({
|
const select = (state, props) => ({
|
||||||
|
blackListedOutpoints: selectBlackListedOutpoints(state),
|
||||||
claim: makeSelectClaimForUri(props.uri)(state),
|
claim: makeSelectClaimForUri(props.uri)(state),
|
||||||
fileInfo: makeSelectFileInfoForUri(props.uri)(state),
|
fileInfo: makeSelectFileInfoForUri(props.uri)(state),
|
||||||
|
filteredOutpoints: selectFilteredOutpoints(state),
|
||||||
metadata: makeSelectMetadataForUri(props.uri)(state),
|
metadata: makeSelectMetadataForUri(props.uri)(state),
|
||||||
rewardedContentClaimIds: selectRewardContentClaimIds(state),
|
rewardedContentClaimIds: selectRewardContentClaimIds(state),
|
||||||
isResolvingUri: makeSelectIsUriResolving(props.uri)(state),
|
isResolvingUri: makeSelectIsUriResolving(props.uri)(state),
|
||||||
@@ -29,9 +32,10 @@ const select = (state, props) => ({
|
|||||||
|
|
||||||
const perform = dispatch => ({
|
const perform = dispatch => ({
|
||||||
resolveUri: uri => dispatch(doResolveUri(uri)),
|
resolveUri: uri => dispatch(doResolveUri(uri)),
|
||||||
|
setPlayerVisible: (visible, uri) => dispatch(doSetPlayerVisible(visible, uri)),
|
||||||
});
|
});
|
||||||
|
|
||||||
export default connect(
|
export default connect(
|
||||||
select,
|
select,
|
||||||
perform
|
perform,
|
||||||
)(FileItem);
|
)(FileItem);
|
||||||
@@ -30,20 +30,22 @@ class FileItem extends React.PureComponent {
|
|||||||
}
|
}
|
||||||
|
|
||||||
navigateToFileUri = () => {
|
navigateToFileUri = () => {
|
||||||
const { navigation, uri, shortUrl } = this.props;
|
const { claim, navigation, uri, shortUrl } = this.props;
|
||||||
const normalizedUri = normalizeURI(uri);
|
const normalizedUri = normalizeURI(uri);
|
||||||
if (NativeModules.Firebase) {
|
if (NativeModules.Firebase) {
|
||||||
NativeModules.Firebase.track('explore_click', { uri: normalizedUri, short_url: shortUrl });
|
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() {
|
render() {
|
||||||
const {
|
const {
|
||||||
|
blackListedOutpoints,
|
||||||
claim,
|
claim,
|
||||||
title,
|
title,
|
||||||
thumbnail,
|
thumbnail,
|
||||||
fileInfo,
|
fileInfo,
|
||||||
|
filteredOutpoints,
|
||||||
metadata,
|
metadata,
|
||||||
isResolvingUri,
|
isResolvingUri,
|
||||||
rewardedContentClaimIds,
|
rewardedContentClaimIds,
|
||||||
@@ -54,11 +56,24 @@ class FileItem extends React.PureComponent {
|
|||||||
obscureNsfw,
|
obscureNsfw,
|
||||||
showDetails,
|
showDetails,
|
||||||
compactView,
|
compactView,
|
||||||
|
setPlayerVisible,
|
||||||
titleBeforeThumbnail,
|
titleBeforeThumbnail,
|
||||||
} = this.props;
|
} = this.props;
|
||||||
|
|
||||||
if (claim && claim.value_type === 'channel') {
|
if (claim && claim.value_type === 'channel') {
|
||||||
// don't display channels in the lists on the Explore page
|
// don't display channels in the lists on the Your tags page
|
||||||
|
return null;
|
||||||
|
}
|
||||||
|
|
||||||
|
let shouldHide = false;
|
||||||
|
if (blackListedOutpoints || filteredOutpoints) {
|
||||||
|
const outpointsToHide = !blackListedOutpoints
|
||||||
|
? filteredOutpoints
|
||||||
|
: blackListedOutpoints.concat(filteredOutpoints);
|
||||||
|
shouldHide = outpointsToHide.some(outpoint => outpoint.txid === claim.txid && outpoint.nout === claim.nout);
|
||||||
|
}
|
||||||
|
if (shouldHide) {
|
||||||
|
// don't display blacklisted or filtered outpoints on the Your tags page
|
||||||
return null;
|
return null;
|
||||||
}
|
}
|
||||||
|
|
||||||
@@ -93,7 +108,12 @@ class FileItem extends React.PureComponent {
|
|||||||
<Icon style={discoverStyle.downloadedIcon} solid color={Colors.NextLbryGreen} name={'folder'} size={16} />
|
<Icon style={discoverStyle.downloadedIcon} solid color={Colors.NextLbryGreen} name={'folder'} size={16} />
|
||||||
)}
|
)}
|
||||||
{!compactView && (!fileInfo || !fileInfo.completed || !fileInfo.download_path) && (
|
{!compactView && (!fileInfo || !fileInfo.completed || !fileInfo.download_path) && (
|
||||||
<FilePrice uri={uri} style={discoverStyle.filePriceContainer} textStyle={discoverStyle.filePriceText} />
|
<FilePrice
|
||||||
|
uri={uri}
|
||||||
|
style={discoverStyle.filePriceContainer}
|
||||||
|
iconStyle={discoverStyle.filePriceIcon}
|
||||||
|
textStyle={discoverStyle.filePriceText}
|
||||||
|
/>
|
||||||
)}
|
)}
|
||||||
{!compactView && (
|
{!compactView && (
|
||||||
<View style={isRewardContent ? discoverStyle.rewardTitleContainer : null}>
|
<View style={isRewardContent ? discoverStyle.rewardTitleContainer : null}>
|
||||||
@@ -110,11 +130,18 @@ class FileItem extends React.PureComponent {
|
|||||||
style={discoverStyle.channelName}
|
style={discoverStyle.channelName}
|
||||||
text={channelName}
|
text={channelName}
|
||||||
onPress={() => {
|
onPress={() => {
|
||||||
navigateToUri(navigation, normalizeURI(shortChannelUri || fullChannelUri));
|
navigateToUri(
|
||||||
|
navigation,
|
||||||
|
normalizeURI(shortChannelUri || fullChannelUri),
|
||||||
|
null,
|
||||||
|
false,
|
||||||
|
fullChannelUri,
|
||||||
|
setPlayerVisible,
|
||||||
|
);
|
||||||
}}
|
}}
|
||||||
/>
|
/>
|
||||||
)}
|
)}
|
||||||
{!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} />
|
<DateTime style={discoverStyle.dateTime} textStyle={discoverStyle.dateTimeText} timeAgo uri={uri} />
|
||||||
</View>
|
</View>
|
||||||
)}
|
)}
|
||||||
|
|||||||
@@ -61,6 +61,8 @@ class FileItemMedia extends React.PureComponent {
|
|||||||
let style = this.props.style;
|
let style = this.props.style;
|
||||||
const { duration, isResolvingUri, thumbnail, title, resizeMode } = this.props;
|
const { duration, isResolvingUri, thumbnail, title, resizeMode } = this.props;
|
||||||
const atStyle = this.state.autoThumbStyle;
|
const atStyle = this.state.autoThumbStyle;
|
||||||
|
const hasDuration = !!duration;
|
||||||
|
|
||||||
if (this.isThumbnailValid(thumbnail) && !this.state.imageLoadFailed) {
|
if (this.isThumbnailValid(thumbnail) && !this.state.imageLoadFailed) {
|
||||||
if (style == null) {
|
if (style == null) {
|
||||||
style = fileItemMediaStyle.thumbnail;
|
style = fileItemMediaStyle.thumbnail;
|
||||||
@@ -74,7 +76,7 @@ class FileItemMedia extends React.PureComponent {
|
|||||||
resizeMode={this.getFastImageResizeMode(resizeMode)}
|
resizeMode={this.getFastImageResizeMode(resizeMode)}
|
||||||
style={fileItemMediaStyle.image}
|
style={fileItemMediaStyle.image}
|
||||||
/>
|
/>
|
||||||
{duration && (
|
{duration > 0 && (
|
||||||
<VideoDuration
|
<VideoDuration
|
||||||
duration={duration}
|
duration={duration}
|
||||||
style={fileItemMediaStyle.duration}
|
style={fileItemMediaStyle.duration}
|
||||||
@@ -103,7 +105,7 @@ class FileItemMedia extends React.PureComponent {
|
|||||||
.toUpperCase()}
|
.toUpperCase()}
|
||||||
</Text>
|
</Text>
|
||||||
)}
|
)}
|
||||||
{duration && (
|
{duration > 0 && (
|
||||||
<VideoDuration
|
<VideoDuration
|
||||||
duration={duration}
|
duration={duration}
|
||||||
style={fileItemMediaStyle.duration}
|
style={fileItemMediaStyle.duration}
|
||||||
|
|||||||
@@ -10,6 +10,7 @@ import {
|
|||||||
makeSelectTitleForUri,
|
makeSelectTitleForUri,
|
||||||
makeSelectThumbnailForUri,
|
makeSelectThumbnailForUri,
|
||||||
} from 'lbry-redux';
|
} from 'lbry-redux';
|
||||||
|
import { doSetPlayerVisible } from 'redux/actions/drawer';
|
||||||
import { selectBlackListedOutpoints, selectFilteredOutpoints, selectRewardContentClaimIds } from 'lbryinc';
|
import { selectBlackListedOutpoints, selectFilteredOutpoints, selectRewardContentClaimIds } from 'lbryinc';
|
||||||
import { selectShowNsfw } from 'redux/selectors/settings';
|
import { selectShowNsfw } from 'redux/selectors/settings';
|
||||||
import FileListItem from './view';
|
import FileListItem from './view';
|
||||||
@@ -32,9 +33,10 @@ const select = (state, props) => ({
|
|||||||
|
|
||||||
const perform = dispatch => ({
|
const perform = dispatch => ({
|
||||||
resolveUri: uri => dispatch(doResolveUri(uri)),
|
resolveUri: uri => dispatch(doResolveUri(uri)),
|
||||||
|
setPlayerVisible: (visible, uri) => dispatch(doSetPlayerVisible(visible, uri)),
|
||||||
});
|
});
|
||||||
|
|
||||||
export default connect(
|
export default connect(
|
||||||
select,
|
select,
|
||||||
perform
|
perform,
|
||||||
)(FileListItem);
|
)(FileListItem);
|
||||||
@@ -1,11 +1,15 @@
|
|||||||
import React from 'react';
|
import React from 'react';
|
||||||
import { normalizeURI, parseURI } from 'lbry-redux';
|
import { normalizeURI, parseURI } from 'lbry-redux';
|
||||||
import { ActivityIndicator, Platform, Text, TouchableOpacity, View } from 'react-native';
|
import { ActivityIndicator, Platform, Text, TouchableOpacity, View } from 'react-native';
|
||||||
import { navigateToUri, formatBytes } from 'utils/helper';
|
import { navigateToUri, getDownloadProgress, getStorageForFileInfo } from 'utils/helper';
|
||||||
import Colors from 'styles/colors';
|
import Colors from 'styles/colors';
|
||||||
|
import ChannelIconItem from 'component/channelIconItem';
|
||||||
|
import channelIconStyle from 'styles/channelIcon';
|
||||||
import Constants from 'constants'; // eslint-disable-line node/no-deprecated-api
|
import Constants from 'constants'; // eslint-disable-line node/no-deprecated-api
|
||||||
import DateTime from 'component/dateTime';
|
import DateTime from 'component/dateTime';
|
||||||
|
import FastImage from 'react-native-fast-image';
|
||||||
import FileItemMedia from 'component/fileItemMedia';
|
import FileItemMedia from 'component/fileItemMedia';
|
||||||
|
import FilePrice from 'component/filePrice';
|
||||||
import Icon from 'react-native-vector-icons/FontAwesome5';
|
import Icon from 'react-native-vector-icons/FontAwesome5';
|
||||||
import Link from 'component/link';
|
import Link from 'component/link';
|
||||||
import NsfwOverlay from 'component/nsfwOverlay';
|
import NsfwOverlay from 'component/nsfwOverlay';
|
||||||
@@ -14,41 +18,29 @@ import fileListStyle from 'styles/fileList';
|
|||||||
|
|
||||||
class FileListItem extends React.PureComponent {
|
class FileListItem extends React.PureComponent {
|
||||||
state = {
|
state = {
|
||||||
|
autoStyle: null,
|
||||||
url: null,
|
url: null,
|
||||||
};
|
};
|
||||||
|
|
||||||
getStorageForFileInfo = fileInfo => {
|
|
||||||
if (!fileInfo.completed) {
|
|
||||||
const written = formatBytes(fileInfo.written_bytes);
|
|
||||||
const total = formatBytes(fileInfo.total_bytes);
|
|
||||||
return `(${written} / ${total})`;
|
|
||||||
}
|
|
||||||
|
|
||||||
return formatBytes(fileInfo.written_bytes);
|
|
||||||
};
|
|
||||||
|
|
||||||
formatTitle = title => {
|
|
||||||
if (!title) {
|
|
||||||
return title;
|
|
||||||
}
|
|
||||||
|
|
||||||
return title.length > 80 ? title.substring(0, 77).trim() + '...' : title;
|
|
||||||
};
|
|
||||||
|
|
||||||
getDownloadProgress = fileInfo => {
|
getDownloadProgress = fileInfo => {
|
||||||
return Math.ceil((fileInfo.written_bytes / fileInfo.total_bytes) * 100);
|
return Math.ceil((fileInfo.written_bytes / fileInfo.total_bytes) * 100);
|
||||||
};
|
};
|
||||||
|
|
||||||
componentDidMount() {
|
componentDidMount() {
|
||||||
const { claim, resolveUri, uri } = this.props;
|
const { claim, resolveUri, uri, batchResolve } = this.props;
|
||||||
if (!claim) {
|
if (!claim && !batchResolve) {
|
||||||
resolveUri(uri);
|
resolveUri(uri);
|
||||||
}
|
}
|
||||||
|
|
||||||
|
this.setState({
|
||||||
|
autoStyle:
|
||||||
|
ChannelIconItem.AUTO_THUMB_STYLES[Math.floor(Math.random() * ChannelIconItem.AUTO_THUMB_STYLES.length)],
|
||||||
|
});
|
||||||
}
|
}
|
||||||
|
|
||||||
componentDidUpdate() {
|
componentDidUpdate() {
|
||||||
const { claim, resolveUri, uri } = this.props;
|
const { claim, resolveUri, uri, batchResolve } = this.props;
|
||||||
if (!claim && uri !== this.state.url) {
|
if (!claim && uri !== this.state.url && !batchResolve) {
|
||||||
this.setState({ url: uri }, () => resolveUri(uri));
|
this.setState({ url: uri }, () => resolveUri(uri));
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
@@ -59,7 +51,7 @@ class FileListItem extends React.PureComponent {
|
|||||||
if (featuredResult && !claim) {
|
if (featuredResult && !claim) {
|
||||||
navigation.navigate({ routeName: Constants.DRAWER_ROUTE_PUBLISH, params: { vanityUrl: uri.trim() } });
|
navigation.navigate({ routeName: Constants.DRAWER_ROUTE_PUBLISH, params: { vanityUrl: uri.trim() } });
|
||||||
} else {
|
} else {
|
||||||
navigateToUri(navigation, shortUrl || uri, { autoplay });
|
navigateToUri(navigation, shortUrl || uri, { autoplay }, false, claim ? claim.permanent_url : null);
|
||||||
}
|
}
|
||||||
};
|
};
|
||||||
|
|
||||||
@@ -88,6 +80,7 @@ class FileListItem extends React.PureComponent {
|
|||||||
onPress,
|
onPress,
|
||||||
navigation,
|
navigation,
|
||||||
rewardedContentClaimIds,
|
rewardedContentClaimIds,
|
||||||
|
setPlayerVisible,
|
||||||
thumbnail,
|
thumbnail,
|
||||||
hideChannel,
|
hideChannel,
|
||||||
onLongPress,
|
onLongPress,
|
||||||
@@ -120,7 +113,9 @@ class FileListItem extends React.PureComponent {
|
|||||||
shortChannelUri = signingChannel ? signingChannel.short_url : null;
|
shortChannelUri = signingChannel ? signingChannel.short_url : null;
|
||||||
|
|
||||||
if (blackListedOutpoints || filteredOutpoints) {
|
if (blackListedOutpoints || filteredOutpoints) {
|
||||||
const outpointsToHide = blackListedOutpoints.concat(filteredOutpoints);
|
const outpointsToHide = !blackListedOutpoints
|
||||||
|
? filteredOutpoints
|
||||||
|
: blackListedOutpoints.concat(filteredOutpoints);
|
||||||
shouldHide = outpointsToHide.some(outpoint => outpoint.txid === claim.txid && outpoint.nout === claim.nout);
|
shouldHide = outpointsToHide.some(outpoint => outpoint.txid === claim.txid && outpoint.nout === claim.nout);
|
||||||
}
|
}
|
||||||
|
|
||||||
@@ -132,10 +127,13 @@ class FileListItem extends React.PureComponent {
|
|||||||
return null;
|
return null;
|
||||||
}
|
}
|
||||||
|
|
||||||
|
const isChannel = name && name.startsWith('@');
|
||||||
|
const hasThumbnail = !!thumbnail;
|
||||||
|
|
||||||
return (
|
return (
|
||||||
<View style={style}>
|
<View style={style}>
|
||||||
<TouchableOpacity
|
<TouchableOpacity
|
||||||
style={style}
|
style={[style, isChannel ? fileListStyle.channelContainer : null]}
|
||||||
onPress={this.onPressHandler}
|
onPress={this.onPressHandler}
|
||||||
onLongPress={() => {
|
onLongPress={() => {
|
||||||
if (onLongPress) {
|
if (onLongPress) {
|
||||||
@@ -143,21 +141,55 @@ class FileListItem extends React.PureComponent {
|
|||||||
}
|
}
|
||||||
}}
|
}}
|
||||||
>
|
>
|
||||||
<FileItemMedia
|
{!isChannel && (
|
||||||
style={fileListStyle.thumbnail}
|
<FileItemMedia
|
||||||
duration={duration}
|
style={fileListStyle.thumbnail}
|
||||||
resizeMode="cover"
|
duration={duration}
|
||||||
title={title || name || normalizeURI(uri).substring(7)}
|
resizeMode="cover"
|
||||||
thumbnail={thumbnail}
|
title={title || name || normalizeURI(uri).substring(7)}
|
||||||
/>
|
thumbnail={thumbnail}
|
||||||
|
/>
|
||||||
|
)}
|
||||||
|
|
||||||
|
{isChannel && (
|
||||||
|
<View style={fileListStyle.channelThumbnailView}>
|
||||||
|
<View style={[fileListStyle.channelThumbnailContainer, this.state.autoStyle]}>
|
||||||
|
{hasThumbnail && (
|
||||||
|
<FastImage
|
||||||
|
style={fileListStyle.channelThumbnail}
|
||||||
|
resizeMode={FastImage.resizeMode.cover}
|
||||||
|
source={{ uri: thumbnail }}
|
||||||
|
/>
|
||||||
|
)}
|
||||||
|
{!hasThumbnail && (
|
||||||
|
<Text style={channelIconStyle.autothumbCharacter}>
|
||||||
|
{title ? title.substring(0, 1).toUpperCase() : claim.name.substring(1, 2).toUpperCase()}
|
||||||
|
</Text>
|
||||||
|
)}
|
||||||
|
</View>
|
||||||
|
</View>
|
||||||
|
)}
|
||||||
|
|
||||||
{selected && (
|
{selected && (
|
||||||
<View style={fileListStyle.selectedOverlay}>
|
<View style={fileListStyle.selectedOverlay}>
|
||||||
<Icon name={'check-circle'} solid color={Colors.NextLbryGreen} size={32} />
|
<Icon name={'check-circle'} solid color={Colors.NextLbryGreen} size={32} />
|
||||||
</View>
|
</View>
|
||||||
)}
|
)}
|
||||||
{fileInfo && fileInfo.completed && fileInfo.download_path && (
|
{fileInfo && fileInfo.completed && fileInfo.download_path && (
|
||||||
<Icon style={fileListStyle.downloadedIcon} solid color={Colors.NextLbryGreen} name={'folder'} size={16} />
|
<Icon
|
||||||
|
style={featuredResult ? fileListStyle.featuredDownloadedIcon : fileListStyle.downloadedIcon}
|
||||||
|
solid
|
||||||
|
color={Colors.NextLbryGreen}
|
||||||
|
name={'folder'}
|
||||||
|
size={16}
|
||||||
|
/>
|
||||||
)}
|
)}
|
||||||
|
<FilePrice
|
||||||
|
uri={uri}
|
||||||
|
style={fileListStyle.filePriceContainer}
|
||||||
|
iconStyle={fileListStyle.filePriceIcon}
|
||||||
|
textStyle={fileListStyle.filePriceText}
|
||||||
|
/>
|
||||||
<View style={fileListStyle.detailsContainer}>
|
<View style={fileListStyle.detailsContainer}>
|
||||||
{featuredResult && (
|
{featuredResult && (
|
||||||
<Text style={fileListStyle.featuredUri} numberOfLines={1}>
|
<Text style={fileListStyle.featuredUri} numberOfLines={1}>
|
||||||
@@ -170,7 +202,7 @@ class FileListItem extends React.PureComponent {
|
|||||||
{!title && !name && <Text style={fileListStyle.uri}>{uri}</Text>}
|
{!title && !name && <Text style={fileListStyle.uri}>{uri}</Text>}
|
||||||
{!title && !name && (
|
{!title && !name && (
|
||||||
<View style={fileListStyle.row}>
|
<View style={fileListStyle.row}>
|
||||||
<ActivityIndicator size={'small'} color={featuredResult ? Colors.White : Colors.LbryGreen} />
|
<ActivityIndicator size={'small'} color={featuredResult ? Colors.White : Colors.NextLbryGreen} />
|
||||||
</View>
|
</View>
|
||||||
)}
|
)}
|
||||||
</View>
|
</View>
|
||||||
@@ -178,8 +210,11 @@ class FileListItem extends React.PureComponent {
|
|||||||
|
|
||||||
{(title || name) && (
|
{(title || name) && (
|
||||||
<View style={fileListStyle.titleContainer}>
|
<View style={fileListStyle.titleContainer}>
|
||||||
<Text style={featuredResult ? fileListStyle.featuredTitle : fileListStyle.title}>
|
<Text
|
||||||
{this.formatTitle(title) || this.formatTitle(name)}
|
style={featuredResult ? fileListStyle.featuredTitle : fileListStyle.title}
|
||||||
|
numberOfLines={hideChannel ? 4 : 3}
|
||||||
|
>
|
||||||
|
{title || name}
|
||||||
</Text>
|
</Text>
|
||||||
{isRewardContent && <Icon style={fileListStyle.rewardIcon} name="award" size={12} />}
|
{isRewardContent && <Icon style={fileListStyle.rewardIcon} name="award" size={12} />}
|
||||||
</View>
|
</View>
|
||||||
@@ -187,23 +222,30 @@ class FileListItem extends React.PureComponent {
|
|||||||
|
|
||||||
{featuredResult && !isResolving && !claim && (
|
{featuredResult && !isResolving && !claim && (
|
||||||
<View style={fileListStyle.titleContainer}>
|
<View style={fileListStyle.titleContainer}>
|
||||||
<Text style={fileListStyle.featuredTitle}>Nothing here. Publish something!</Text>
|
<Text style={fileListStyle.featuredTitle}>{__('Nothing here. Publish something!')}</Text>
|
||||||
</View>
|
</View>
|
||||||
)}
|
)}
|
||||||
|
|
||||||
{channel && !hideChannel && (
|
{(channel || isChannel) && !hideChannel && (
|
||||||
<Link
|
<Link
|
||||||
style={fileListStyle.publisher}
|
style={fileListStyle.publisher}
|
||||||
text={channel}
|
text={isChannel ? name : channel}
|
||||||
onPress={() => {
|
onPress={() => {
|
||||||
navigateToUri(navigation, normalizeURI(shortChannelUri || fullChannelUri));
|
navigateToUri(
|
||||||
|
navigation,
|
||||||
|
normalizeURI(isChannel ? uri : shortChannelUri || fullChannelUri),
|
||||||
|
null,
|
||||||
|
false,
|
||||||
|
isChannel ? claim && claim.permanent_url : fullChannelUri,
|
||||||
|
setPlayerVisible,
|
||||||
|
);
|
||||||
}}
|
}}
|
||||||
/>
|
/>
|
||||||
)}
|
)}
|
||||||
|
|
||||||
<View style={fileListStyle.info}>
|
<View style={fileListStyle.info}>
|
||||||
{fileInfo && !isNaN(fileInfo.written_bytes) && fileInfo.written_bytes > 0 && (
|
{fileInfo && !isNaN(fileInfo.written_bytes) && fileInfo.written_bytes > 0 && (
|
||||||
<Text style={fileListStyle.infoText}>{this.getStorageForFileInfo(fileInfo)}</Text>
|
<Text style={fileListStyle.infoText}>{getStorageForFileInfo(fileInfo)}</Text>
|
||||||
)}
|
)}
|
||||||
<DateTime style={fileListStyle.publishInfo} textStyle={fileListStyle.infoText} timeAgo uri={uri} />
|
<DateTime style={fileListStyle.publishInfo} textStyle={fileListStyle.infoText} timeAgo uri={uri} />
|
||||||
</View>
|
</View>
|
||||||
@@ -216,7 +258,7 @@ class FileListItem extends React.PureComponent {
|
|||||||
color={Colors.NextLbryGreen}
|
color={Colors.NextLbryGreen}
|
||||||
height={3}
|
height={3}
|
||||||
style={fileListStyle.progress}
|
style={fileListStyle.progress}
|
||||||
progress={this.getDownloadProgress(fileInfo)}
|
progress={getDownloadProgress(fileInfo)}
|
||||||
/>
|
/>
|
||||||
)}
|
)}
|
||||||
</View>
|
</View>
|
||||||
|
|||||||
@@ -2,6 +2,7 @@ import React from 'react';
|
|||||||
import PropTypes from 'prop-types';
|
import PropTypes from 'prop-types';
|
||||||
import { Text, View } from 'react-native';
|
import { Text, View } from 'react-native';
|
||||||
import { formatCredits, formatFullPrice } from 'lbry-redux';
|
import { formatCredits, formatFullPrice } from 'lbry-redux';
|
||||||
|
import Icon from 'react-native-vector-icons/FontAwesome5';
|
||||||
|
|
||||||
class CreditAmount extends React.PureComponent {
|
class CreditAmount extends React.PureComponent {
|
||||||
static propTypes = {
|
static propTypes = {
|
||||||
@@ -42,11 +43,16 @@ class CreditAmount extends React.PureComponent {
|
|||||||
|
|
||||||
let amountText;
|
let amountText;
|
||||||
if (this.props.showFree && parseFloat(this.props.amount) === 0) {
|
if (this.props.showFree && parseFloat(this.props.amount) === 0) {
|
||||||
amountText = 'FREE';
|
amountText = __('FREE');
|
||||||
} else {
|
} else {
|
||||||
if (this.props.label) {
|
if (this.props.label) {
|
||||||
const 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}`;
|
amountText = `${formattedAmount} ${label}`;
|
||||||
} else {
|
} else {
|
||||||
@@ -57,25 +63,27 @@ class CreditAmount extends React.PureComponent {
|
|||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
/*{this.props.isEstimate ? (
|
return (
|
||||||
<span
|
<Text style={style} numberOfLines={1}>
|
||||||
className="credit-amount__estimate"
|
{amountText}
|
||||||
title={__('This is an estimate and does not include data fees')}
|
</Text>
|
||||||
>
|
);
|
||||||
*
|
|
||||||
</span>
|
|
||||||
) : null}*/
|
|
||||||
return <Text style={style}>{amountText}</Text>;
|
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
class FilePrice extends React.PureComponent {
|
class FilePrice extends React.PureComponent {
|
||||||
componentWillMount() {
|
componentWillMount() {
|
||||||
this.fetchCost(this.props);
|
const { cost } = this.props;
|
||||||
|
if (isNaN(parseFloat(cost))) {
|
||||||
|
this.fetchCost(this.props);
|
||||||
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
componentWillReceiveProps(nextProps) {
|
componentWillReceiveProps(nextProps) {
|
||||||
this.fetchCost(nextProps);
|
const { cost } = this.props;
|
||||||
|
if (isNaN(parseFloat(cost))) {
|
||||||
|
this.fetchCost(nextProps);
|
||||||
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
fetchCost(props) {
|
fetchCost(props) {
|
||||||
@@ -87,30 +95,25 @@ class FilePrice extends React.PureComponent {
|
|||||||
}
|
}
|
||||||
|
|
||||||
render() {
|
render() {
|
||||||
const { costInfo, look = 'indicator', showFullPrice = false, style, textStyle } = this.props;
|
const { cost, costInfo, look = 'indicator', showFullPrice = false, style, iconStyle, textStyle } = this.props;
|
||||||
|
|
||||||
const isEstimate = costInfo ? !costInfo.includesData : null;
|
const isEstimate = costInfo ? !costInfo.includesData : null;
|
||||||
|
const amount = cost ? parseFloat(cost) : costInfo ? parseFloat(costInfo.cost) : 0;
|
||||||
if (!costInfo) {
|
if (isNaN(amount) || amount === 0) {
|
||||||
return (
|
return null;
|
||||||
<View style={style}>
|
|
||||||
<Text style={textStyle}>???</Text>
|
|
||||||
</View>
|
|
||||||
);
|
|
||||||
}
|
}
|
||||||
|
|
||||||
return (
|
return (
|
||||||
<View style={style}>
|
<View style={style}>
|
||||||
|
<Icon name="coins" size={9} style={iconStyle} />
|
||||||
<CreditAmount
|
<CreditAmount
|
||||||
style={textStyle}
|
style={textStyle}
|
||||||
label={false}
|
label={false}
|
||||||
amount={parseFloat(costInfo.cost)}
|
amount={amount}
|
||||||
isEstimate={isEstimate}
|
isEstimate={isEstimate}
|
||||||
showFree
|
showFree
|
||||||
showFullPrice={showFullPrice}
|
showFullPrice={showFullPrice}
|
||||||
>
|
/>
|
||||||
???
|
|
||||||
</CreditAmount>
|
|
||||||
</View>
|
</View>
|
||||||
);
|
);
|
||||||
}
|
}
|
||||||
|
|||||||
@@ -9,8 +9,8 @@ class FileRewardsDriver extends React.PureComponent<Props> {
|
|||||||
|
|
||||||
return (
|
return (
|
||||||
<TouchableOpacity style={filePageStyle.rewardDriverCard} onPress={() => navigation.navigate('Rewards')}>
|
<TouchableOpacity style={filePageStyle.rewardDriverCard} onPress={() => navigation.navigate('Rewards')}>
|
||||||
<Icon name="award" size={16} style={filePageStyle.rewardIcon} />
|
<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>
|
</TouchableOpacity>
|
||||||
);
|
);
|
||||||
}
|
}
|
||||||
|
|||||||
@@ -34,7 +34,7 @@ class FloatingWalletBalance extends React.PureComponent<Props> {
|
|||||||
<Icon name="coins" size={12} style={floatingButtonStyle.balanceIcon} />
|
<Icon name="coins" size={12} style={floatingButtonStyle.balanceIcon} />
|
||||||
{isNaN(balance) && <ActivityIndicator size="small" color={Colors.White} />}
|
{isNaN(balance) && <ActivityIndicator size="small" color={Colors.White} />}
|
||||||
{(!isNaN(balance) || balance === 0) && (
|
{(!isNaN(balance) || balance === 0) && (
|
||||||
<Text style={floatingButtonStyle.text}>{formatCredits(parseFloat(balance), 0, true)}</Text>
|
<Text style={floatingButtonStyle.text}>{formatCredits(parseFloat(balance), 1, true)}</Text>
|
||||||
)}
|
)}
|
||||||
</TouchableOpacity>
|
</TouchableOpacity>
|
||||||
</View>
|
</View>
|
||||||
|
|||||||
@@ -341,6 +341,12 @@ class MediaPlayer extends React.PureComponent {
|
|||||||
this.setState({ paused: true }, this.updateBackgroundMediaNotification);
|
this.setState({ paused: true }, this.updateBackgroundMediaNotification);
|
||||||
};
|
};
|
||||||
|
|
||||||
|
handleSeek = time => {
|
||||||
|
const { currentTime } = this.state;
|
||||||
|
const newTime = currentTime + time;
|
||||||
|
this.seekTo(newTime);
|
||||||
|
};
|
||||||
|
|
||||||
updateBackgroundMediaNotification = () => {
|
updateBackgroundMediaNotification = () => {
|
||||||
this.handlePausedState();
|
this.handlePausedState();
|
||||||
const { backgroundPlayEnabled } = this.props;
|
const { backgroundPlayEnabled } = this.props;
|
||||||
@@ -362,14 +368,26 @@ class MediaPlayer extends React.PureComponent {
|
|||||||
<Icon name={'arrow-left'} size={18} style={mediaPlayerStyle.backButtonIcon} />
|
<Icon name={'arrow-left'} size={18} style={mediaPlayerStyle.backButtonIcon} />
|
||||||
</TouchableOpacity>
|
</TouchableOpacity>
|
||||||
|
|
||||||
<TouchableOpacity style={mediaPlayerStyle.playPauseButton} onPress={this.togglePlay}>
|
<View style={mediaPlayerStyle.midControls}>
|
||||||
{this.state.paused && <Icon name="play" size={40} color="#ffffff" />}
|
<TouchableOpacity style={mediaPlayerStyle.rewind10} onPress={() => this.handleSeek(-10)}>
|
||||||
{!this.state.paused && <Icon name="pause" size={40} color="#ffffff" />}
|
<Icon name="undo" size={24} color={Colors.White} />
|
||||||
</TouchableOpacity>
|
<Text style={[mediaPlayerStyle.midControlText, mediaPlayerStyle.leftMidControlText]}>10</Text>
|
||||||
|
</TouchableOpacity>
|
||||||
|
|
||||||
|
<TouchableOpacity style={mediaPlayerStyle.playPauseButton} onPress={this.togglePlay}>
|
||||||
|
{this.state.paused && <Icon name="play" size={40} color={Colors.White} />}
|
||||||
|
{!this.state.paused && <Icon name="pause" size={40} color={Colors.White} />}
|
||||||
|
</TouchableOpacity>
|
||||||
|
|
||||||
|
<TouchableOpacity style={mediaPlayerStyle.forward10} onPress={() => this.handleSeek(10)}>
|
||||||
|
<Icon name="redo" size={24} color={Colors.White} />
|
||||||
|
<Text style={[mediaPlayerStyle.midControlText, mediaPlayerStyle.rightMidControlText]}>10</Text>
|
||||||
|
</TouchableOpacity>
|
||||||
|
</View>
|
||||||
|
|
||||||
<TouchableOpacity style={mediaPlayerStyle.toggleFullscreenButton} onPress={this.toggleFullscreenMode}>
|
<TouchableOpacity style={mediaPlayerStyle.toggleFullscreenButton} onPress={this.toggleFullscreenMode}>
|
||||||
{this.state.fullscreenMode && <Icon name="compress" size={16} color="#ffffff" />}
|
{this.state.fullscreenMode && <Icon name="compress" size={16} color={Colors.White} />}
|
||||||
{!this.state.fullscreenMode && <Icon name="expand" size={16} color="#ffffff" />}
|
{!this.state.fullscreenMode && <Icon name="expand" size={16} color={Colors.White} />}
|
||||||
</TouchableOpacity>
|
</TouchableOpacity>
|
||||||
|
|
||||||
<Text style={mediaPlayerStyle.elapsedDuration}>{this.formatTime(this.state.currentTime)}</Text>
|
<Text style={mediaPlayerStyle.elapsedDuration}>{this.formatTime(this.state.currentTime)}</Text>
|
||||||
@@ -421,7 +439,7 @@ class MediaPlayer extends React.PureComponent {
|
|||||||
const seekerCircleStyle = [this.state.seeking ? mediaPlayerStyle.bigSeekerCircle : mediaPlayerStyle.seekerCircle];
|
const seekerCircleStyle = [this.state.seeking ? mediaPlayerStyle.bigSeekerCircle : mediaPlayerStyle.seekerCircle];
|
||||||
if (!this.state.seeking) {
|
if (!this.state.seeking) {
|
||||||
seekerCircleStyle.push(
|
seekerCircleStyle.push(
|
||||||
this.state.fullscreenMode ? mediaPlayerStyle.seekerCircleTopFs : mediaPlayerStyle.seekerCircleTop
|
this.state.fullscreenMode ? mediaPlayerStyle.seekerCircleTopFs : mediaPlayerStyle.seekerCircleTop,
|
||||||
);
|
);
|
||||||
}
|
}
|
||||||
|
|
||||||
@@ -440,6 +458,7 @@ class MediaPlayer extends React.PureComponent {
|
|||||||
}}
|
}}
|
||||||
resizeMode={this.state.resizeMode}
|
resizeMode={this.state.resizeMode}
|
||||||
playInBackground={this.state.backgroundPlayEnabled}
|
playInBackground={this.state.backgroundPlayEnabled}
|
||||||
|
playWhenInactive={this.state.backgroundPlayEnabled}
|
||||||
style={mediaPlayerStyle.player}
|
style={mediaPlayerStyle.player}
|
||||||
rate={this.state.rate}
|
rate={this.state.rate}
|
||||||
volume={this.state.volume}
|
volume={this.state.volume}
|
||||||
|
|||||||
@@ -46,7 +46,7 @@ export default class ModalPicker extends React.PureComponent {
|
|||||||
onPress={() => onItemSelected(item)}
|
onPress={() => onItemSelected(item)}
|
||||||
>
|
>
|
||||||
{item.icon && <Icon style={modalPickerStyle.itemIcon} name={item.icon} size={16} />}
|
{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 && (
|
{selectedItem && selectedItem.name === item.name && (
|
||||||
<Icon style={modalPickerStyle.itemSelected} name={'check'} color={Colors.LbryGreen} size={16} />
|
<Icon style={modalPickerStyle.itemSelected} name={'check'} color={Colors.LbryGreen} size={16} />
|
||||||
)}
|
)}
|
||||||
|
|||||||
@@ -0,0 +1,4 @@
|
|||||||
|
import { connect } from 'react-redux';
|
||||||
|
import ModalSuggestedSubscriptions from './view';
|
||||||
|
|
||||||
|
export default connect()(ModalSuggestedSubscriptions);
|
||||||
@@ -0,0 +1,26 @@
|
|||||||
|
import React from 'react';
|
||||||
|
import { ScrollView, Text, TouchableOpacity, View } from 'react-native';
|
||||||
|
import modalStyle from 'styles/modal';
|
||||||
|
import subscriptionsStyle from 'styles/subscriptions';
|
||||||
|
import Button from 'component/button';
|
||||||
|
import Colors from 'styles/colors';
|
||||||
|
import SuggestedSubscriptions from 'component/suggestedSubscriptions';
|
||||||
|
import Constants from 'constants'; // eslint-disable-line node/no-deprecated-api
|
||||||
|
import Icon from 'react-native-vector-icons/FontAwesome5';
|
||||||
|
|
||||||
|
export default class ModalSuggestedSubcriptions extends React.PureComponent {
|
||||||
|
render() {
|
||||||
|
const { navigation, onDonePress, onOverlayPress } = this.props;
|
||||||
|
|
||||||
|
return (
|
||||||
|
<TouchableOpacity style={modalStyle.overlay} activeOpacity={1} onPress={onOverlayPress}>
|
||||||
|
<TouchableOpacity style={[modalStyle.container, subscriptionsStyle.modalContainer]} activeOpacity={1}>
|
||||||
|
<SuggestedSubscriptions inModal navigation={navigation} />
|
||||||
|
<View style={modalStyle.buttons}>
|
||||||
|
<Button style={modalStyle.doneButton} text={__('Done')} onPress={onDonePress} />
|
||||||
|
</View>
|
||||||
|
</TouchableOpacity>
|
||||||
|
</TouchableOpacity>
|
||||||
|
);
|
||||||
|
}
|
||||||
|
}
|
||||||
@@ -8,7 +8,6 @@ import Icon from 'react-native-vector-icons/FontAwesome5';
|
|||||||
import Tag from 'component/tag';
|
import Tag from 'component/tag';
|
||||||
import TagSearch from 'component/tagSearch';
|
import TagSearch from 'component/tagSearch';
|
||||||
import modalTagSelectorStyle from 'styles/modalTagSelector';
|
import modalTagSelectorStyle from 'styles/modalTagSelector';
|
||||||
import { __ } from 'utils/helper';
|
|
||||||
|
|
||||||
const minimumTags = 2;
|
const minimumTags = 2;
|
||||||
|
|
||||||
@@ -55,9 +54,9 @@ export default class ModalTagSelector extends React.PureComponent {
|
|||||||
|
|
||||||
return (
|
return (
|
||||||
<TouchableOpacity style={modalTagSelectorStyle.overlay} activeOpacity={1} onPress={onOverlayPress}>
|
<TouchableOpacity style={modalTagSelectorStyle.overlay} activeOpacity={1} onPress={onOverlayPress}>
|
||||||
<View style={modalTagSelectorStyle.container}>
|
<TouchableOpacity style={modalTagSelectorStyle.container} activeOpacity={1}>
|
||||||
<View style={modalTagSelectorStyle.titleRow}>
|
<View style={modalTagSelectorStyle.titleRow}>
|
||||||
<Text style={modalTagSelectorStyle.title}>Customize your tags</Text>
|
<Text style={modalTagSelectorStyle.title}>{__('Customize your tags')}</Text>
|
||||||
</View>
|
</View>
|
||||||
<View style={modalTagSelectorStyle.tagList}>
|
<View style={modalTagSelectorStyle.tagList}>
|
||||||
{tags &&
|
{tags &&
|
||||||
@@ -73,9 +72,9 @@ export default class ModalTagSelector extends React.PureComponent {
|
|||||||
</View>
|
</View>
|
||||||
<TagSearch handleAddTag={this.handleAddTag} selectedTags={tags} />
|
<TagSearch handleAddTag={this.handleAddTag} selectedTags={tags} />
|
||||||
<View style={modalTagSelectorStyle.buttons}>
|
<View style={modalTagSelectorStyle.buttons}>
|
||||||
<Button style={modalTagSelectorStyle.doneButton} text={'Done'} onPress={onDonePress} />
|
<Button style={modalTagSelectorStyle.doneButton} text={__('Done')} onPress={onDonePress} />
|
||||||
</View>
|
</View>
|
||||||
</View>
|
</TouchableOpacity>
|
||||||
</TouchableOpacity>
|
</TouchableOpacity>
|
||||||
);
|
);
|
||||||
}
|
}
|
||||||
|
|||||||
@@ -0,0 +1,18 @@
|
|||||||
|
import { connect } from 'react-redux';
|
||||||
|
import { doSendTip, doToast, selectBalance } from 'lbry-redux';
|
||||||
|
import ModalTipView from './view';
|
||||||
|
|
||||||
|
const select = state => ({
|
||||||
|
balance: selectBalance(state),
|
||||||
|
});
|
||||||
|
|
||||||
|
const perform = dispatch => ({
|
||||||
|
notify: data => dispatch(doToast(data)),
|
||||||
|
sendTip: (amount, claimId, isSupport, successCallback, errorCallback) =>
|
||||||
|
dispatch(doSendTip(amount, claimId, isSupport, successCallback, errorCallback)),
|
||||||
|
});
|
||||||
|
|
||||||
|
export default connect(
|
||||||
|
select,
|
||||||
|
perform
|
||||||
|
)(ModalTipView);
|
||||||
@@ -0,0 +1,148 @@
|
|||||||
|
import React from 'react';
|
||||||
|
import { ActivityIndicator, Alert, Text, TextInput, TouchableOpacity, View } from 'react-native';
|
||||||
|
import { formatCredits } from 'lbry-redux';
|
||||||
|
import modalStyle from 'styles/modal';
|
||||||
|
import modalTipStyle from 'styles/modalTip';
|
||||||
|
import Button from 'component/button';
|
||||||
|
import Colors from 'styles/colors';
|
||||||
|
import Constants from 'constants'; // eslint-disable-line node/no-deprecated-api
|
||||||
|
import Icon from 'react-native-vector-icons/FontAwesome5';
|
||||||
|
import Link from 'component/link';
|
||||||
|
|
||||||
|
export default class ModalTipView extends React.PureComponent {
|
||||||
|
tipAmountInput = null;
|
||||||
|
|
||||||
|
state = {
|
||||||
|
creditsInputFocused: false,
|
||||||
|
sendTipStarted: false,
|
||||||
|
tipAmount: null,
|
||||||
|
};
|
||||||
|
|
||||||
|
handleSendTip = () => {
|
||||||
|
const { claim, balance, notify, onSendTipFailed, onSendTipSuccessful, sendTip } = this.props;
|
||||||
|
const { tipAmount } = this.state;
|
||||||
|
|
||||||
|
if (tipAmount > balance) {
|
||||||
|
notify({
|
||||||
|
message: 'Insufficient credits',
|
||||||
|
});
|
||||||
|
return;
|
||||||
|
}
|
||||||
|
|
||||||
|
const amount = parseInt(tipAmount, 10);
|
||||||
|
const message =
|
||||||
|
amount === 1
|
||||||
|
? __('Please confirm you want to tip %amount% credit', { amount })
|
||||||
|
: __('Please confirm you want to tip %amount% credits', { amount });
|
||||||
|
|
||||||
|
Alert.alert(
|
||||||
|
__('Send Tip'),
|
||||||
|
message,
|
||||||
|
[
|
||||||
|
{ text: __('No') },
|
||||||
|
{
|
||||||
|
text: __('Yes'),
|
||||||
|
onPress: () => {
|
||||||
|
this.setState({ sendTipStarted: true }, () =>
|
||||||
|
sendTip(
|
||||||
|
tipAmount,
|
||||||
|
claim.claim_id,
|
||||||
|
false,
|
||||||
|
() => {
|
||||||
|
// success
|
||||||
|
this.setState({ tipAmount: null, sendTipStarted: false });
|
||||||
|
if (onSendTipSuccessful) onSendTipSuccessful();
|
||||||
|
},
|
||||||
|
() => {
|
||||||
|
// error
|
||||||
|
if (onSendTipFailed) onSendTipFailed();
|
||||||
|
}
|
||||||
|
)
|
||||||
|
);
|
||||||
|
},
|
||||||
|
},
|
||||||
|
],
|
||||||
|
{ cancelable: true }
|
||||||
|
);
|
||||||
|
};
|
||||||
|
|
||||||
|
render() {
|
||||||
|
const { balance, channelName, contentName, onCancelPress, onOverlayPress } = this.props;
|
||||||
|
const canSendTip = this.state.tipAmount > 0;
|
||||||
|
|
||||||
|
return (
|
||||||
|
<TouchableOpacity style={modalStyle.overlay} activeOpacity={1} onPress={onOverlayPress}>
|
||||||
|
<TouchableOpacity style={modalStyle.container} activeOpacity={1}>
|
||||||
|
<View
|
||||||
|
style={modalTipStyle.container}
|
||||||
|
onLayout={() => {
|
||||||
|
if (this.tipAmountInput) {
|
||||||
|
this.tipAmountInput.focus();
|
||||||
|
}
|
||||||
|
}}
|
||||||
|
>
|
||||||
|
<Text style={modalTipStyle.title} numberOfLines={1}>
|
||||||
|
{channelName ? __('Send a tip to %channel%', { channel: channelName }) : __('Send a tip')}
|
||||||
|
</Text>
|
||||||
|
|
||||||
|
<View style={modalTipStyle.row}>
|
||||||
|
<View style={modalTipStyle.amountRow}>
|
||||||
|
<TextInput
|
||||||
|
editable={!this.state.sendTipStarted}
|
||||||
|
ref={ref => (this.tipAmountInput = ref)}
|
||||||
|
onChangeText={value => this.setState({ tipAmount: value })}
|
||||||
|
underlineColorAndroid={Colors.NextLbryGreen}
|
||||||
|
keyboardType={'numeric'}
|
||||||
|
onFocus={() => this.setState({ creditsInputFocused: true })}
|
||||||
|
onBlur={() => this.setState({ creditsInputFocused: false })}
|
||||||
|
placeholder={'0'}
|
||||||
|
value={this.state.tipAmount}
|
||||||
|
selectTextOnFocus
|
||||||
|
style={modalTipStyle.tipAmountInput}
|
||||||
|
/>
|
||||||
|
<Text style={modalTipStyle.currency}>LBC</Text>
|
||||||
|
<View style={modalTipStyle.balance}>
|
||||||
|
{this.state.creditsInputFocused && <Icon name="coins" size={12} />}
|
||||||
|
{this.state.creditsInputFocused && (
|
||||||
|
<Text style={modalTipStyle.balanceText}>{formatCredits(parseFloat(balance), 1, true)}</Text>
|
||||||
|
)}
|
||||||
|
</View>
|
||||||
|
</View>
|
||||||
|
{this.state.sendTipStarted && <ActivityIndicator size={'small'} color={Colors.NextLbryGreen} />}
|
||||||
|
</View>
|
||||||
|
|
||||||
|
<View style={modalTipStyle.info}>
|
||||||
|
<Text style={modalTipStyle.infoText}>
|
||||||
|
{__(
|
||||||
|
'This will appear as a tip for %content%, which will boost its ability to be discovered while active.',
|
||||||
|
{ content: contentName }
|
||||||
|
)}{' '}
|
||||||
|
<Link
|
||||||
|
style={modalTipStyle.learnMoreLink}
|
||||||
|
text={__('Learn more.')}
|
||||||
|
href={'https://lbry.com/faq/tipping'}
|
||||||
|
/>
|
||||||
|
</Text>
|
||||||
|
</View>
|
||||||
|
|
||||||
|
<View style={modalTipStyle.buttonRow}>
|
||||||
|
<Link
|
||||||
|
style={modalTipStyle.cancelTipLink}
|
||||||
|
text={__('Cancel')}
|
||||||
|
onPress={() => {
|
||||||
|
if (onCancelPress) onCancelPress();
|
||||||
|
}}
|
||||||
|
/>
|
||||||
|
<Button
|
||||||
|
text={__('Send')}
|
||||||
|
style={modalTipStyle.button}
|
||||||
|
disabled={!canSendTip || this.state.sendTipStarted}
|
||||||
|
onPress={this.handleSendTip}
|
||||||
|
/>
|
||||||
|
</View>
|
||||||
|
</View>
|
||||||
|
</TouchableOpacity>
|
||||||
|
</TouchableOpacity>
|
||||||
|
);
|
||||||
|
}
|
||||||
|
}
|
||||||
@@ -7,7 +7,7 @@ class NsfwOverlay extends React.PureComponent {
|
|||||||
return (
|
return (
|
||||||
<TouchableOpacity style={discoverStyle.overlay} activeOpacity={1} onPress={this.props.onPress}>
|
<TouchableOpacity style={discoverStyle.overlay} activeOpacity={1} onPress={this.props.onPress}>
|
||||||
<Text style={discoverStyle.overlayText}>
|
<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>
|
</Text>
|
||||||
</TouchableOpacity>
|
</TouchableOpacity>
|
||||||
);
|
);
|
||||||
|
|||||||
@@ -4,17 +4,21 @@ import Colors from 'styles/colors';
|
|||||||
import Icon from 'react-native-vector-icons/FontAwesome5';
|
import Icon from 'react-native-vector-icons/FontAwesome5';
|
||||||
import publishStyle from 'styles/publish';
|
import publishStyle from 'styles/publish';
|
||||||
|
|
||||||
class PublishRewadsDriver extends React.PureComponent<Props> {
|
class PublishRewardsDriver extends React.PureComponent<Props> {
|
||||||
render() {
|
render() {
|
||||||
const { navigation } = this.props;
|
const { navigation } = this.props;
|
||||||
|
|
||||||
return (
|
return (
|
||||||
<TouchableOpacity style={publishStyle.rewardDriverCard} onPress={() => navigation.navigate('Rewards')}>
|
<TouchableOpacity style={publishStyle.rewardDriverCard} onPress={() => navigation.navigate('Rewards')}>
|
||||||
<Icon name="award" size={16} style={publishStyle.rewardIcon} />
|
<Icon name="award" size={16} style={publishStyle.rewardIcon} />
|
||||||
<Text style={publishStyle.rewardDriverText}>Earn some credits to be able to publish your content.</Text>
|
<Text style={publishStyle.rewardDriverText}>
|
||||||
|
{__('Publishing requires credits.')}
|
||||||
|
{'\n'}
|
||||||
|
{__('Tap here to get some for free.')}
|
||||||
|
</Text>
|
||||||
</TouchableOpacity>
|
</TouchableOpacity>
|
||||||
);
|
);
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
export default PublishRewadsDriver;
|
export default PublishRewardsDriver;
|
||||||
@@ -1,25 +1,30 @@
|
|||||||
import { connect } from 'react-redux';
|
import { connect } from 'react-redux';
|
||||||
import {
|
import {
|
||||||
|
doResolveUris,
|
||||||
|
doResolvedSearch,
|
||||||
makeSelectClaimForUri,
|
makeSelectClaimForUri,
|
||||||
makeSelectRecommendedContentForUri,
|
makeSelectResolvedRecommendedContentForUri,
|
||||||
makeSelectTitleForUri,
|
selectResolvingUris,
|
||||||
selectIsSearching,
|
selectIsSearching,
|
||||||
} from 'lbry-redux';
|
} from 'lbry-redux';
|
||||||
import { doNativeSearch } from 'redux/actions/performance';
|
|
||||||
import RelatedContent from './view';
|
import RelatedContent from './view';
|
||||||
|
|
||||||
|
const RESULT_SIZE = 16;
|
||||||
|
|
||||||
const select = (state, props) => ({
|
const select = (state, props) => ({
|
||||||
claim: makeSelectClaimForUri(props.uri)(state),
|
claim: makeSelectClaimForUri(props.uri)(state),
|
||||||
recommendedContent: makeSelectRecommendedContentForUri(props.uri)(state),
|
|
||||||
title: makeSelectTitleForUri(props.uri)(state),
|
|
||||||
isSearching: selectIsSearching(state),
|
isSearching: selectIsSearching(state),
|
||||||
|
recommendedContent: makeSelectResolvedRecommendedContentForUri(props.uri, RESULT_SIZE)(state),
|
||||||
|
resolvingUris: selectResolvingUris(state),
|
||||||
});
|
});
|
||||||
|
|
||||||
const perform = dispatch => ({
|
const perform = dispatch => ({
|
||||||
search: query => dispatch(doNativeSearch(query, 20, undefined, true)),
|
resolveUris: uris => dispatch(doResolveUris(uris)),
|
||||||
|
searchRecommended: (query, claimId) =>
|
||||||
|
dispatch(doResolvedSearch(query, RESULT_SIZE, undefined, true, { related_to: claimId }, false)),
|
||||||
});
|
});
|
||||||
|
|
||||||
export default connect(
|
export default connect(
|
||||||
select,
|
select,
|
||||||
perform
|
perform,
|
||||||
)(RelatedContent);
|
)(RelatedContent);
|
||||||
@@ -4,68 +4,41 @@ import { normalizeURI } from 'lbry-redux';
|
|||||||
import { navigateToUri } from 'utils/helper';
|
import { navigateToUri } from 'utils/helper';
|
||||||
import Colors from 'styles/colors';
|
import Colors from 'styles/colors';
|
||||||
import FileListItem from 'component/fileListItem';
|
import FileListItem from 'component/fileListItem';
|
||||||
|
import ClaimResultItem from 'component/claimResultItem';
|
||||||
import fileListStyle from 'styles/fileList';
|
import fileListStyle from 'styles/fileList';
|
||||||
import relatedContentStyle from 'styles/relatedContent';
|
import relatedContentStyle from 'styles/relatedContent';
|
||||||
|
|
||||||
export default class RelatedContent extends React.PureComponent {
|
export default class RelatedContent extends React.PureComponent {
|
||||||
constructor() {
|
|
||||||
super();
|
|
||||||
|
|
||||||
this.didSearch = undefined;
|
|
||||||
}
|
|
||||||
|
|
||||||
componentDidMount() {
|
componentDidMount() {
|
||||||
this.getRecommendedContent();
|
const { title, claimId, searchRecommended } = this.props;
|
||||||
}
|
if (title && claimId) {
|
||||||
|
searchRecommended(title, claimId);
|
||||||
componentDidUpdate(prevProps) {
|
|
||||||
const { claim, uri } = this.props;
|
|
||||||
|
|
||||||
if (uri !== prevProps.uri) {
|
|
||||||
this.didSearch = false;
|
|
||||||
}
|
|
||||||
|
|
||||||
if (claim && !this.didSearch) {
|
|
||||||
this.getRecommendedContent();
|
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
getRecommendedContent() {
|
shouldComponentUpdate(nextProps, nextState) {
|
||||||
const { search, title } = this.props;
|
const { isSearching, recommendedContent } = nextProps;
|
||||||
|
return isSearching || (!isSearching && recommendedContent && recommendedContent.length > 0);
|
||||||
if (title) {
|
|
||||||
search(title);
|
|
||||||
this.didSearch = true;
|
|
||||||
}
|
|
||||||
}
|
}
|
||||||
|
|
||||||
didSearch;
|
|
||||||
|
|
||||||
render() {
|
render() {
|
||||||
const { recommendedContent, isSearching, navigation, uri, fullUri } = this.props;
|
const { isSearching, recommendedContent, navigation, uri, fullUri } = this.props;
|
||||||
|
|
||||||
if (!isSearching && (!recommendedContent || recommendedContent.length === 0)) {
|
|
||||||
return null;
|
|
||||||
}
|
|
||||||
|
|
||||||
return (
|
return (
|
||||||
<View style={relatedContentStyle.container}>
|
<View style={relatedContentStyle.container}>
|
||||||
<Text style={relatedContentStyle.title}>Related Content</Text>
|
<Text style={relatedContentStyle.title}>{__('Related Content')}</Text>
|
||||||
|
{isSearching && <ActivityIndicator size={'small'} color={Colors.NextLbryGreen} />}
|
||||||
{recommendedContent &&
|
{recommendedContent &&
|
||||||
recommendedContent
|
recommendedContent.map(result => (
|
||||||
.filter(recommendedUri => recommendedUri !== normalizeURI(fullUri))
|
<ClaimResultItem
|
||||||
.map(recommendedUri => (
|
style={fileListStyle.item}
|
||||||
<FileListItem
|
uri={result ? normalizeURI(`${result.name}#${result.claimId}`) : null}
|
||||||
style={fileListStyle.item}
|
key={result.claimId}
|
||||||
key={recommendedUri}
|
result={result}
|
||||||
uri={recommendedUri}
|
navigation={navigation}
|
||||||
navigation={navigation}
|
autoplay
|
||||||
autoplay
|
/>
|
||||||
/>
|
))}
|
||||||
))}
|
|
||||||
{isSearching && (
|
|
||||||
<ActivityIndicator size="small" color={Colors.NextLbryGreen} style={relatedContentStyle.loading} />
|
|
||||||
)}
|
|
||||||
</View>
|
</View>
|
||||||
);
|
);
|
||||||
}
|
}
|
||||||
|
|||||||
@@ -34,7 +34,7 @@ class RewardCard extends React.PureComponent<Props> {
|
|||||||
notify({ message: errorMessage });
|
notify({ message: errorMessage });
|
||||||
clearError(reward);
|
clearError(reward);
|
||||||
} else {
|
} else {
|
||||||
notify({ message: 'Reward successfully claimed!' });
|
notify({ message: __('Reward successfully claimed!') });
|
||||||
}
|
}
|
||||||
this.setState({ claimStarted: false });
|
this.setState({ claimStarted: false });
|
||||||
}
|
}
|
||||||
@@ -47,7 +47,7 @@ class RewardCard extends React.PureComponent<Props> {
|
|||||||
if (showVerification) {
|
if (showVerification) {
|
||||||
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;
|
return;
|
||||||
}
|
}
|
||||||
|
|
||||||
@@ -59,7 +59,8 @@ class RewardCard extends React.PureComponent<Props> {
|
|||||||
getDisplayAmount = () => {
|
getDisplayAmount = () => {
|
||||||
const { reward } = this.props;
|
const { reward } = this.props;
|
||||||
if (reward) {
|
if (reward) {
|
||||||
if (reward.reward_range && reward.reward_range.includes('-')) {
|
const claimed = !!reward.transaction_id;
|
||||||
|
if (!claimed && reward.reward_range && reward.reward_range.includes('-')) {
|
||||||
return reward.reward_range.split('-')[0] + '+'; // ex: 5+
|
return reward.reward_range.split('-')[0] + '+'; // ex: 5+
|
||||||
} else if (reward.reward_amount > 0) {
|
} else if (reward.reward_amount > 0) {
|
||||||
return reward.reward_amount;
|
return reward.reward_amount;
|
||||||
@@ -111,7 +112,7 @@ class RewardCard extends React.PureComponent<Props> {
|
|||||||
style={rewardStyle.link}
|
style={rewardStyle.link}
|
||||||
href={`https://explorer.lbry.com/tx/${reward.transaction_id}`}
|
href={`https://explorer.lbry.com/tx/${reward.transaction_id}`}
|
||||||
text={reward.transaction_id.substring(0, 7)}
|
text={reward.transaction_id.substring(0, 7)}
|
||||||
error={'The transaction URL could not be opened'}
|
error={__('The transaction URL could not be opened')}
|
||||||
/>
|
/>
|
||||||
)}
|
)}
|
||||||
</View>
|
</View>
|
||||||
|
|||||||
@@ -1,8 +1,8 @@
|
|||||||
import React from 'react';
|
import React from 'react';
|
||||||
import { NativeModules, Text, TouchableOpacity, View } from 'react-native';
|
import { Linking, NativeModules, Text, TouchableOpacity, View } from 'react-native';
|
||||||
import AsyncStorage from '@react-native-community/async-storage';
|
import AsyncStorage from '@react-native-community/async-storage';
|
||||||
import Button from 'component/button';
|
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 Link from 'component/link';
|
||||||
import Colors from 'styles/colors';
|
import Colors from 'styles/colors';
|
||||||
import Icon from 'react-native-vector-icons/FontAwesome5';
|
import Icon from 'react-native-vector-icons/FontAwesome5';
|
||||||
@@ -24,26 +24,45 @@ class RewardEnrolment extends React.Component {
|
|||||||
navigation.navigate({ routeName: 'Verification', key: 'verification', params: { syncFlow: false } });
|
navigation.navigate({ routeName: 'Verification', key: 'verification', params: { syncFlow: false } });
|
||||||
};
|
};
|
||||||
|
|
||||||
|
onLearnMorePressed = () => {
|
||||||
|
Linking.openURL('https://lbry.com/faq/earn-credits');
|
||||||
|
};
|
||||||
|
|
||||||
render() {
|
render() {
|
||||||
const { fetching, navigation, unclaimedRewardAmount, user } = this.props;
|
const { fetching, navigation, unclaimedRewardAmount, user } = this.props;
|
||||||
|
|
||||||
return (
|
return (
|
||||||
<View style={rewardStyle.enrollContainer} onPress>
|
<View style={rewardStyle.enrollContainer}>
|
||||||
<View style={rewardStyle.summaryRow}>
|
<View style={rewardStyle.summaryRow}>
|
||||||
<Icon name="award" size={36} color={Colors.White} />
|
<Icon name="award" size={36} color={Colors.White} />
|
||||||
<Text style={rewardStyle.summaryText}>{unclaimedRewardAmount} unclaimed credits</Text>
|
<Text style={rewardStyle.summaryText}>
|
||||||
|
{unclaimedRewardAmount === 1 && __('%amount% available credit', { amount: unclaimedRewardAmount })}
|
||||||
|
{unclaimedRewardAmount !== 1 && __('%amount% available credits', { amount: unclaimedRewardAmount })}
|
||||||
|
</Text>
|
||||||
</View>
|
</View>
|
||||||
|
|
||||||
<View style={rewardStyle.onboarding}>
|
<View style={rewardStyle.onboarding}>
|
||||||
<Text style={rewardStyle.enrollDescText}>
|
<Text style={rewardStyle.enrollDescText}>
|
||||||
LBRY credits allow you to purchase content, publish content, and influence the network. You can start
|
{__('LBRY credits allow you to purchase content, publish content, and influence the network.')}
|
||||||
earning credits by watching videos on LBRY.
|
{'\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>
|
</Text>
|
||||||
</View>
|
</View>
|
||||||
|
|
||||||
<View style={rewardStyle.buttonRow}>
|
<View style={rewardStyle.buttonRow}>
|
||||||
<Link style={rewardStyle.notInterestedLink} text={'Not interested'} onPress={this.onNotInterestedPressed} />
|
<Link
|
||||||
<Button style={rewardStyle.enrollButton} theme={'light'} text={'Enroll'} onPress={this.onEnrollPressed} />
|
style={rewardStyle.notInterestedLink}
|
||||||
|
text={__('Not interested')}
|
||||||
|
onPress={this.onNotInterestedPressed}
|
||||||
|
/>
|
||||||
|
<Button
|
||||||
|
style={rewardStyle.enrollButton}
|
||||||
|
theme={'light'}
|
||||||
|
text={__('Get started')}
|
||||||
|
onPress={this.onEnrollPressed}
|
||||||
|
/>
|
||||||
</View>
|
</View>
|
||||||
</View>
|
</View>
|
||||||
);
|
);
|
||||||
|
|||||||
@@ -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);
|
|
||||||
@@ -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 ('true' === isDismissed) {
|
|
||||||
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} unclaimed credits</Text>
|
|
||||||
</View>
|
|
||||||
<Button style={rewardStyle.dismissButton} theme={'light'} text={'Dismiss'} onPress={this.onDismissPressed} />
|
|
||||||
</TouchableOpacity>
|
|
||||||
);
|
|
||||||
}
|
|
||||||
}
|
|
||||||
|
|
||||||
export default RewardSummary;
|
|
||||||
@@ -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);
|
|
||||||
@@ -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;
|
|
||||||
@@ -1,9 +1,9 @@
|
|||||||
import React from 'react';
|
import React from 'react';
|
||||||
import { normalizeURI, parseURI } from 'lbry-redux';
|
import { normalizeURI, parseURI } from 'lbry-redux';
|
||||||
import { ActivityIndicator, Platform, Switch, Text, TouchableOpacity, View } from 'react-native';
|
import { ActivityIndicator, Platform, Switch, Text, TouchableOpacity, View } from 'react-native';
|
||||||
import { formatBytes } from '../../utils/helper';
|
import { formatBytes } from 'utils/helper';
|
||||||
import Colors from '../../styles/colors';
|
import Colors from 'styles/colors';
|
||||||
import storageStatsStyle from '../../styles/storageStats';
|
import storageStatsStyle from 'styles/storageStats';
|
||||||
|
|
||||||
class StorageStatsCard extends React.PureComponent {
|
class StorageStatsCard extends React.PureComponent {
|
||||||
state = {
|
state = {
|
||||||
@@ -75,10 +75,10 @@ class StorageStatsCard extends React.PureComponent {
|
|||||||
<View style={[storageStatsStyle.row, storageStatsStyle.totalSizeContainer]}>
|
<View style={[storageStatsStyle.row, storageStatsStyle.totalSizeContainer]}>
|
||||||
<View style={storageStatsStyle.summary}>
|
<View style={storageStatsStyle.summary}>
|
||||||
<Text style={storageStatsStyle.totalSize}>{formatBytes(this.state.totalBytes, 2)}</Text>
|
<Text style={storageStatsStyle.totalSize}>{formatBytes(this.state.totalBytes, 2)}</Text>
|
||||||
<Text style={storageStatsStyle.annotation}>used</Text>
|
<Text style={storageStatsStyle.annotation}>{__('used')}</Text>
|
||||||
</View>
|
</View>
|
||||||
<View style={[storageStatsStyle.row, storageStatsStyle.toggleStatsContainer]}>
|
<View style={[storageStatsStyle.row, storageStatsStyle.toggleStatsContainer]}>
|
||||||
<Text style={storageStatsStyle.statsText}>Stats</Text>
|
<Text style={storageStatsStyle.statsText}>{__('Stats')}</Text>
|
||||||
<Switch
|
<Switch
|
||||||
style={storageStatsStyle.statsToggle}
|
style={storageStatsStyle.statsToggle}
|
||||||
value={this.state.showStats}
|
value={this.state.showStats}
|
||||||
@@ -98,28 +98,28 @@ class StorageStatsCard extends React.PureComponent {
|
|||||||
{this.state.totalAudioBytes > 0 && (
|
{this.state.totalAudioBytes > 0 && (
|
||||||
<View style={[storageStatsStyle.row, storageStatsStyle.legendItem]}>
|
<View style={[storageStatsStyle.row, storageStatsStyle.legendItem]}>
|
||||||
<View style={[storageStatsStyle.legendBox, storageStatsStyle.audioDistribution]} />
|
<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>
|
<Text style={storageStatsStyle.legendSize}>{formatBytes(this.state.totalAudioBytes, 2)}</Text>
|
||||||
</View>
|
</View>
|
||||||
)}
|
)}
|
||||||
{this.state.totalImageBytes > 0 && (
|
{this.state.totalImageBytes > 0 && (
|
||||||
<View style={[storageStatsStyle.row, storageStatsStyle.legendItem]}>
|
<View style={[storageStatsStyle.row, storageStatsStyle.legendItem]}>
|
||||||
<View style={[storageStatsStyle.legendBox, storageStatsStyle.imageDistribution]} />
|
<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>
|
<Text style={storageStatsStyle.legendSize}>{formatBytes(this.state.totalImageBytes, 2)}</Text>
|
||||||
</View>
|
</View>
|
||||||
)}
|
)}
|
||||||
{this.state.totalVideoBytes > 0 && (
|
{this.state.totalVideoBytes > 0 && (
|
||||||
<View style={[storageStatsStyle.row, storageStatsStyle.legendItem]}>
|
<View style={[storageStatsStyle.row, storageStatsStyle.legendItem]}>
|
||||||
<View style={[storageStatsStyle.legendBox, storageStatsStyle.videoDistribution]} />
|
<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>
|
<Text style={storageStatsStyle.legendSize}>{formatBytes(this.state.totalVideoBytes, 2)}</Text>
|
||||||
</View>
|
</View>
|
||||||
)}
|
)}
|
||||||
{this.state.totalOtherBytes > 0 && (
|
{this.state.totalOtherBytes > 0 && (
|
||||||
<View style={[storageStatsStyle.row, storageStatsStyle.legendItem]}>
|
<View style={[storageStatsStyle.row, storageStatsStyle.legendItem]}>
|
||||||
<View style={[storageStatsStyle.legendBox, storageStatsStyle.otherDistribution]} />
|
<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>
|
<Text style={storageStatsStyle.legendSize}>{formatBytes(this.state.totalOtherBytes, 2)}</Text>
|
||||||
</View>
|
</View>
|
||||||
)}
|
)}
|
||||||
|
|||||||
@@ -3,6 +3,8 @@ import { buildURI, normalizeURI } from 'lbry-redux';
|
|||||||
import { ActivityIndicator, FlatList, Image, Text, View } from 'react-native';
|
import { ActivityIndicator, FlatList, Image, Text, View } from 'react-native';
|
||||||
import { navigateToUri } from 'utils/helper';
|
import { navigateToUri } from 'utils/helper';
|
||||||
import Colors from 'styles/colors';
|
import Colors from 'styles/colors';
|
||||||
|
import ChannelIconItem from 'component/channelIconItem';
|
||||||
|
import channelIconStyle from 'styles/channelIcon';
|
||||||
import discoverStyle from 'styles/discover';
|
import discoverStyle from 'styles/discover';
|
||||||
import FileItem from 'component/fileItem';
|
import FileItem from 'component/fileItem';
|
||||||
import SubscribeButton from 'component/subscribeButton';
|
import SubscribeButton from 'component/subscribeButton';
|
||||||
@@ -11,11 +13,20 @@ import Link from 'component/link';
|
|||||||
import Tag from 'component/tag';
|
import Tag from 'component/tag';
|
||||||
|
|
||||||
class SuggestedSubscriptionItem extends React.PureComponent {
|
class SuggestedSubscriptionItem extends React.PureComponent {
|
||||||
|
state = {
|
||||||
|
autoStyle: null,
|
||||||
|
};
|
||||||
|
|
||||||
componentDidMount() {
|
componentDidMount() {
|
||||||
const { claim, uri, resolveUri } = this.props;
|
const { claim, uri, resolveUri } = this.props;
|
||||||
if (!claim) {
|
if (!claim) {
|
||||||
resolveUri(uri);
|
resolveUri(uri);
|
||||||
}
|
}
|
||||||
|
|
||||||
|
this.setState({
|
||||||
|
autoStyle:
|
||||||
|
ChannelIconItem.AUTO_THUMB_STYLES[Math.floor(Math.random() * ChannelIconItem.AUTO_THUMB_STYLES.length)],
|
||||||
|
});
|
||||||
}
|
}
|
||||||
|
|
||||||
render() {
|
render() {
|
||||||
@@ -28,22 +39,26 @@ class SuggestedSubscriptionItem extends React.PureComponent {
|
|||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
|
const hasThumbnail = !!thumbnail;
|
||||||
if (isResolvingUri) {
|
if (isResolvingUri) {
|
||||||
return (
|
return (
|
||||||
<View style={subscriptionsStyle.itemLoadingContainer}>
|
<View style={subscriptionsStyle.itemLoadingContainer}>
|
||||||
<ActivityIndicator size={'small'} color={Colors.LbryGreen} />
|
<ActivityIndicator size={'small'} color={Colors.NextLbryGreen} />
|
||||||
</View>
|
</View>
|
||||||
);
|
);
|
||||||
}
|
}
|
||||||
|
|
||||||
return (
|
return (
|
||||||
<View style={subscriptionsStyle.suggestedItem}>
|
<View style={subscriptionsStyle.suggestedItem}>
|
||||||
<View style={subscriptionsStyle.suggestedItemThumbnailContainer}>
|
<View style={[subscriptionsStyle.suggestedItemThumbnailContainer, this.state.autoStyle]}>
|
||||||
<Image
|
{hasThumbnail && (
|
||||||
style={subscriptionsStyle.suggestedItemThumbnail}
|
<Image style={subscriptionsStyle.suggestedItemThumbnail} resizeMode={'cover'} source={{ uri: thumbnail }} />
|
||||||
resizeMode={'cover'}
|
)}
|
||||||
source={thumbnail ? { uri: thumbnail } : require('../../assets/default_avatar.jpg')}
|
{!hasThumbnail && (
|
||||||
/>
|
<Text style={channelIconStyle.autothumbCharacter}>
|
||||||
|
{title ? title.substring(0, 1).toUpperCase() : claim ? claim.name.substring(1, 2).toUpperCase() : ''}
|
||||||
|
</Text>
|
||||||
|
)}
|
||||||
</View>
|
</View>
|
||||||
|
|
||||||
<View style={subscriptionsStyle.suggestedItemDetails}>
|
<View style={subscriptionsStyle.suggestedItemDetails}>
|
||||||
@@ -57,7 +72,7 @@ class SuggestedSubscriptionItem extends React.PureComponent {
|
|||||||
style={subscriptionsStyle.suggestedItemName}
|
style={subscriptionsStyle.suggestedItemName}
|
||||||
numberOfLines={1}
|
numberOfLines={1}
|
||||||
text={claim.name}
|
text={claim.name}
|
||||||
onPress={() => navigateToUri(navigation, normalizeURI(shortUrl || uri))}
|
onPress={() => navigateToUri(navigation, normalizeURI(shortUrl || uri), null, false, claim.permanent_url)}
|
||||||
/>
|
/>
|
||||||
)}
|
)}
|
||||||
{tags && (
|
{tags && (
|
||||||
@@ -72,7 +87,9 @@ class SuggestedSubscriptionItem extends React.PureComponent {
|
|||||||
)}
|
)}
|
||||||
</View>
|
</View>
|
||||||
|
|
||||||
<SubscribeButton style={subscriptionsStyle.suggestedItemSubscribe} uri={normalizeURI(uri)} />
|
{claim && (
|
||||||
|
<SubscribeButton style={subscriptionsStyle.suggestedItemSubscribe} uri={normalizeURI(claim.permanent_url)} />
|
||||||
|
)}
|
||||||
</View>
|
</View>
|
||||||
);
|
);
|
||||||
}
|
}
|
||||||
|
|||||||
@@ -1,6 +1,7 @@
|
|||||||
import { connect } from 'react-redux';
|
import { connect } from 'react-redux';
|
||||||
import { doClaimSearch, selectFetchingClaimSearch, selectClaimSearchByQuery, selectFollowedTags } from 'lbry-redux';
|
import { doClaimSearch, selectFetchingClaimSearch, selectClaimSearchByQuery, selectFollowedTags } from 'lbry-redux';
|
||||||
import { selectSuggestedChannels, selectIsFetchingSuggested } from 'lbryinc';
|
import { selectSuggestedChannels, selectIsFetchingSuggested } from 'lbryinc';
|
||||||
|
import { selectShowNsfw } from 'redux/selectors/settings';
|
||||||
import SuggestedSubscriptions from './view';
|
import SuggestedSubscriptions from './view';
|
||||||
|
|
||||||
const select = state => ({
|
const select = state => ({
|
||||||
@@ -8,6 +9,7 @@ const select = state => ({
|
|||||||
suggested: selectSuggestedChannels(state),
|
suggested: selectSuggestedChannels(state),
|
||||||
loading: selectIsFetchingSuggested(state) || selectFetchingClaimSearch(state),
|
loading: selectIsFetchingSuggested(state) || selectFetchingClaimSearch(state),
|
||||||
claimSearchByQuery: selectClaimSearchByQuery(state),
|
claimSearchByQuery: selectClaimSearchByQuery(state),
|
||||||
|
showNsfwContent: selectShowNsfw(state),
|
||||||
});
|
});
|
||||||
|
|
||||||
const perform = dispatch => ({
|
const perform = dispatch => ({
|
||||||
|
|||||||
@@ -1,7 +1,7 @@
|
|||||||
import React from 'react';
|
import React from 'react';
|
||||||
import { ActivityIndicator, FlatList, SectionList, Text, View } from 'react-native';
|
import { ActivityIndicator, SectionList, Text, View } from 'react-native';
|
||||||
import { createNormalizedClaimSearchKey, normalizeURI } from 'lbry-redux';
|
import { MATURE_TAGS, createNormalizedClaimSearchKey, normalizeURI } from 'lbry-redux';
|
||||||
import { __, navigateToUri } from 'utils/helper';
|
import { navigateToUri } from 'utils/helper';
|
||||||
import SubscribeButton from 'component/subscribeButton';
|
import SubscribeButton from 'component/subscribeButton';
|
||||||
import SuggestedSubscriptionItem from 'component/suggestedSubscriptionItem';
|
import SuggestedSubscriptionItem from 'component/suggestedSubscriptionItem';
|
||||||
import Colors from 'styles/colors';
|
import Colors from 'styles/colors';
|
||||||
@@ -16,13 +16,16 @@ class SuggestedSubscriptions extends React.PureComponent {
|
|||||||
};
|
};
|
||||||
|
|
||||||
componentDidMount() {
|
componentDidMount() {
|
||||||
const { claimSearch, followedTags } = this.props;
|
const { claimSearch, followedTags, showNsfwContent } = this.props;
|
||||||
const options = {
|
const options = {
|
||||||
any_tags: _.shuffle(followedTags.map(tag => tag.name)).slice(0, 3),
|
any_tags: _.shuffle(followedTags.map(tag => tag.name)).slice(0, 3),
|
||||||
page: 1,
|
page: 1,
|
||||||
no_totals: true,
|
no_totals: true,
|
||||||
claim_type: 'channel',
|
claim_type: 'channel',
|
||||||
};
|
};
|
||||||
|
if (!showNsfwContent) {
|
||||||
|
options.not_tags = MATURE_TAGS;
|
||||||
|
}
|
||||||
this.setState({ options });
|
this.setState({ options });
|
||||||
claimSearch(options);
|
claimSearch(options);
|
||||||
}
|
}
|
||||||
@@ -35,7 +38,7 @@ class SuggestedSubscriptions extends React.PureComponent {
|
|||||||
const suggestedUris = suggested ? suggested.map(suggested => suggested.uri) : [];
|
const suggestedUris = suggested ? suggested.map(suggested => suggested.uri) : [];
|
||||||
return [
|
return [
|
||||||
{
|
{
|
||||||
title: __('Tags you follow'),
|
title: __('Suggested channels'),
|
||||||
data: claimSearchUris ? claimSearchUris.filter(uri => !suggestedUris.includes(uri)) : [],
|
data: claimSearchUris ? claimSearchUris.filter(uri => !suggestedUris.includes(uri)) : [],
|
||||||
},
|
},
|
||||||
{
|
{
|
||||||
@@ -46,7 +49,7 @@ class SuggestedSubscriptions extends React.PureComponent {
|
|||||||
};
|
};
|
||||||
|
|
||||||
render() {
|
render() {
|
||||||
const { suggested, loading, navigation } = this.props;
|
const { suggested, inModal, loading, navigation } = this.props;
|
||||||
|
|
||||||
if (loading) {
|
if (loading) {
|
||||||
return (
|
return (
|
||||||
@@ -58,8 +61,10 @@ class SuggestedSubscriptions extends React.PureComponent {
|
|||||||
|
|
||||||
return (
|
return (
|
||||||
<SectionList
|
<SectionList
|
||||||
style={subscriptionsStyle.scrollContainer}
|
style={inModal ? subscriptionsStyle.modalScrollContainer : subscriptionsStyle.scrollContainer}
|
||||||
contentContainerStyle={subscriptionsStyle.suggestedScrollPadding}
|
contentContainerStyle={
|
||||||
|
inModal ? subscriptionsStyle.modalSuggestedScrollContent : subscriptionsStyle.suggestedScrollContent
|
||||||
|
}
|
||||||
renderItem={({ item, index, section }) => (
|
renderItem={({ item, index, section }) => (
|
||||||
<SuggestedSubscriptionItem key={item} uri={normalizeURI(item)} navigation={navigation} />
|
<SuggestedSubscriptionItem key={item} uri={normalizeURI(item)} navigation={navigation} />
|
||||||
)}
|
)}
|
||||||
|
|||||||
@@ -74,7 +74,7 @@ export default class TagSearch extends React.PureComponent {
|
|||||||
<TextInput
|
<TextInput
|
||||||
editable={editable}
|
editable={editable}
|
||||||
style={tagStyle.searchInput}
|
style={tagStyle.searchInput}
|
||||||
placeholder={'Search for more tags'}
|
placeholder={__('Search for more tags')}
|
||||||
underlineColorAndroid={Colors.NextLbryGreen}
|
underlineColorAndroid={Colors.NextLbryGreen}
|
||||||
value={this.state.tag}
|
value={this.state.tag}
|
||||||
numberOfLines={1}
|
numberOfLines={1}
|
||||||
@@ -89,7 +89,7 @@ export default class TagSearch extends React.PureComponent {
|
|||||||
</KeyboardAvoidingView>
|
</KeyboardAvoidingView>
|
||||||
{showNsfwTags && (
|
{showNsfwTags && (
|
||||||
<View style={tagStyle.nsfwTagsContainer}>
|
<View style={tagStyle.nsfwTagsContainer}>
|
||||||
<Text style={tagStyle.nsfwTagsTitle}>Mature tags</Text>
|
<Text style={tagStyle.nsfwTagsTitle}>{__('Mature tags')}</Text>
|
||||||
<View style={tagStyle.tagResultsList}>
|
<View style={tagStyle.tagResultsList}>
|
||||||
{MATURE_TAGS.map(tag => (
|
{MATURE_TAGS.map(tag => (
|
||||||
<Tag
|
<Tag
|
||||||
|
|||||||
@@ -2,10 +2,10 @@
|
|||||||
import React from 'react';
|
import React from 'react';
|
||||||
import { Text, View, Linking } from 'react-native';
|
import { Text, View, Linking } from 'react-native';
|
||||||
import { buildURI, formatCredits } from 'lbry-redux';
|
import { buildURI, formatCredits } from 'lbry-redux';
|
||||||
import { navigateToUri } from '../../../utils/helper';
|
import { navigateToUri } from 'utils/helper';
|
||||||
import Link from '../../link';
|
import Link from 'component/link';
|
||||||
import moment from 'moment';
|
import moment from 'moment';
|
||||||
import transactionListStyle from '../../../styles/transactionList';
|
import transactionListStyle from 'styles/transactionList';
|
||||||
|
|
||||||
class TransactionListItem extends React.PureComponent {
|
class TransactionListItem extends React.PureComponent {
|
||||||
capitalize(string: string) {
|
capitalize(string: string) {
|
||||||
@@ -43,14 +43,14 @@ class TransactionListItem extends React.PureComponent {
|
|||||||
style={transactionListStyle.smallLink}
|
style={transactionListStyle.smallLink}
|
||||||
text={txid.substring(0, 8)}
|
text={txid.substring(0, 8)}
|
||||||
href={`https://explorer.lbry.com/tx/${txid}`}
|
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>
|
||||||
<View style={transactionListStyle.col}>
|
<View style={transactionListStyle.col}>
|
||||||
{date ? (
|
{date ? (
|
||||||
<Text style={transactionListStyle.smallText}>{moment(date).format('MMM D')}</Text>
|
<Text style={transactionListStyle.smallText}>{moment(date).format('MMM D')}</Text>
|
||||||
) : (
|
) : (
|
||||||
<Text style={transactionListStyle.smallText}>Pending</Text>
|
<Text style={transactionListStyle.smallText}>{__('Pending')}</Text>
|
||||||
)}
|
)}
|
||||||
</View>
|
</View>
|
||||||
</View>
|
</View>
|
||||||
|
|||||||
@@ -47,7 +47,7 @@ class TransactionList extends React.PureComponent {
|
|||||||
return (
|
return (
|
||||||
<View>
|
<View>
|
||||||
{!transactionList.length && (
|
{!transactionList.length && (
|
||||||
<Text style={transactionListStyle.noTransactions}>{emptyMessage || 'No transactions to list.'}</Text>
|
<Text style={transactionListStyle.noTransactions}>{emptyMessage || __('No transactions to list.')}</Text>
|
||||||
)}
|
)}
|
||||||
|
|
||||||
{!!transactionList.length && (
|
{!!transactionList.length && (
|
||||||
|
|||||||
@@ -2,11 +2,11 @@
|
|||||||
import React from 'react';
|
import React from 'react';
|
||||||
// import BusyIndicator from 'component/common/busy-indicator';
|
// import BusyIndicator from 'component/common/busy-indicator';
|
||||||
import { Text, View } from 'react-native';
|
import { Text, View } from 'react-native';
|
||||||
import Button from '../button';
|
import Button from 'component/button';
|
||||||
import Link from '../link';
|
import Link from 'component/link';
|
||||||
import TransactionList from '../transactionList';
|
import TransactionList from 'component/transactionList';
|
||||||
import type { Transaction } from '../transactionList/view';
|
import type { Transaction } from 'component/transactionList/view';
|
||||||
import walletStyle from '../../styles/wallet';
|
import walletStyle from 'styles/wallet';
|
||||||
|
|
||||||
type Props = {
|
type Props = {
|
||||||
fetchTransactions: () => void,
|
fetchTransactions: () => void,
|
||||||
@@ -26,15 +26,15 @@ class TransactionListRecent extends React.PureComponent<Props> {
|
|||||||
return (
|
return (
|
||||||
<View style={walletStyle.transactionsCard}>
|
<View style={walletStyle.transactionsCard}>
|
||||||
<View style={[walletStyle.row, walletStyle.transactionsHeader]}>
|
<View style={[walletStyle.row, walletStyle.transactionsHeader]}>
|
||||||
<Text style={walletStyle.transactionsTitle}>Recent Transactions</Text>
|
<Text style={walletStyle.transactionsTitle}>{__('Recent Transactions')}</Text>
|
||||||
<Link style={walletStyle.link} navigation={navigation} text={'View All'} href={'#TransactionHistory'} />
|
<Link style={walletStyle.link} navigation={navigation} text={__('View All')} href={'#TransactionHistory'} />
|
||||||
</View>
|
</View>
|
||||||
{fetchingTransactions && <Text style={walletStyle.infoText}>Fetching transactions...</Text>}
|
{fetchingTransactions && <Text style={walletStyle.infoText}>{__('Fetching transactions...')}</Text>}
|
||||||
{!fetchingTransactions && (
|
{!fetchingTransactions && (
|
||||||
<TransactionList
|
<TransactionList
|
||||||
navigation={navigation}
|
navigation={navigation}
|
||||||
transactions={transactions.slice(0, 5)}
|
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>
|
</View>
|
||||||
|
|||||||
@@ -4,8 +4,11 @@ import {
|
|||||||
selectSearchState as selectSearch,
|
selectSearchState as selectSearch,
|
||||||
selectSearchValue,
|
selectSearchValue,
|
||||||
selectSearchSuggestions,
|
selectSearchSuggestions,
|
||||||
|
SETTINGS,
|
||||||
} from 'lbry-redux';
|
} from 'lbry-redux';
|
||||||
|
import { doSetPlayerVisible } from 'redux/actions/drawer';
|
||||||
import { selectCurrentRoute } from 'redux/selectors/drawer';
|
import { selectCurrentRoute } from 'redux/selectors/drawer';
|
||||||
|
import { makeSelectClientSetting } from 'redux/selectors/settings';
|
||||||
import UriBar from './view';
|
import UriBar from './view';
|
||||||
|
|
||||||
const select = state => {
|
const select = state => {
|
||||||
@@ -16,14 +19,16 @@ const select = state => {
|
|||||||
query: selectSearchValue(state),
|
query: selectSearchValue(state),
|
||||||
currentRoute: selectCurrentRoute(state),
|
currentRoute: selectCurrentRoute(state),
|
||||||
suggestions: selectSearchSuggestions(state),
|
suggestions: selectSearchSuggestions(state),
|
||||||
|
showUriBarSuggestions: makeSelectClientSetting(SETTINGS.SHOW_URI_BAR_SUGGESTIONS)(state),
|
||||||
};
|
};
|
||||||
};
|
};
|
||||||
|
|
||||||
const perform = dispatch => ({
|
const perform = dispatch => ({
|
||||||
updateSearchQuery: query => dispatch(doUpdateSearchQuery(query)),
|
updateSearchQuery: query => dispatch(doUpdateSearchQuery(query)),
|
||||||
|
setPlayerVisible: (visible, uri) => dispatch(doSetPlayerVisible(visible, uri)),
|
||||||
});
|
});
|
||||||
|
|
||||||
export default connect(
|
export default connect(
|
||||||
select,
|
select,
|
||||||
perform
|
perform,
|
||||||
)(UriBar);
|
)(UriBar);
|
||||||
@@ -20,6 +20,10 @@ class UriBarItem extends React.PureComponent {
|
|||||||
icon = <Icon name="search" size={18} />;
|
icon = <Icon name="search" size={18} />;
|
||||||
break;
|
break;
|
||||||
|
|
||||||
|
case SEARCH_TYPES.TAG:
|
||||||
|
icon = <Icon name="hashtag" size={18} />;
|
||||||
|
break;
|
||||||
|
|
||||||
case SEARCH_TYPES.FILE:
|
case SEARCH_TYPES.FILE:
|
||||||
default:
|
default:
|
||||||
icon = <Icon name="file" size={18} />;
|
icon = <Icon name="file" size={18} />;
|
||||||
@@ -37,6 +41,7 @@ class UriBarItem extends React.PureComponent {
|
|||||||
{type === SEARCH_TYPES.SEARCH && `Search for '${value}'`}
|
{type === SEARCH_TYPES.SEARCH && `Search for '${value}'`}
|
||||||
{type === SEARCH_TYPES.CHANNEL && `View the @${shorthand} channel`}
|
{type === SEARCH_TYPES.CHANNEL && `View the @${shorthand} channel`}
|
||||||
{type === SEARCH_TYPES.FILE && `View content at ${value}`}
|
{type === SEARCH_TYPES.FILE && `View content at ${value}`}
|
||||||
|
{type === SEARCH_TYPES.TAG && `Explore the '${value}' tag`}
|
||||||
</Text>
|
</Text>
|
||||||
</View>
|
</View>
|
||||||
</TouchableOpacity>
|
</TouchableOpacity>
|
||||||
|
|||||||
+108
-67
@@ -1,7 +1,7 @@
|
|||||||
// @flow
|
// @flow
|
||||||
import React from 'react';
|
import React from 'react';
|
||||||
import { SEARCH_TYPES, isNameValid, isURIValid, normalizeURI } from 'lbry-redux';
|
import { SEARCH_TYPES, isNameValid, isURIValid, normalizeURI } from 'lbry-redux';
|
||||||
import { FlatList, Keyboard, Text, TextInput, TouchableOpacity, View } from 'react-native';
|
import { Dimensions, FlatList, Keyboard, Text, TextInput, TouchableOpacity, View } from 'react-native';
|
||||||
import { navigateToUri, transformUrl } from 'utils/helper';
|
import { navigateToUri, transformUrl } from 'utils/helper';
|
||||||
import Constants from 'constants'; // eslint-disable-line node/no-deprecated-api
|
import Constants from 'constants'; // eslint-disable-line node/no-deprecated-api
|
||||||
import UriBarItem from './internal/uri-bar-item';
|
import UriBarItem from './internal/uri-bar-item';
|
||||||
@@ -14,24 +14,30 @@ class UriBar extends React.PureComponent {
|
|||||||
|
|
||||||
textInput = null;
|
textInput = null;
|
||||||
|
|
||||||
|
keyboardDidShowListener = null;
|
||||||
|
|
||||||
keyboardDidHideListener = null;
|
keyboardDidHideListener = null;
|
||||||
|
|
||||||
|
changeTextTimeout = -1;
|
||||||
|
|
||||||
state = {
|
state = {
|
||||||
changeTextTimeout: null,
|
|
||||||
currentValue: null,
|
currentValue: null,
|
||||||
inputText: null,
|
inputText: null,
|
||||||
focused: false,
|
focused: false,
|
||||||
|
keyboardHeight: 0,
|
||||||
// TODO: Add a setting to enable / disable direct search?
|
selection: undefined,
|
||||||
directSearch: true,
|
|
||||||
};
|
};
|
||||||
|
|
||||||
componentDidMount() {
|
componentDidMount() {
|
||||||
|
this.keyboardDidShowListener = Keyboard.addListener('keyboardDidShow', this._keyboardDidShow);
|
||||||
this.keyboardDidHideListener = Keyboard.addListener('keyboardDidHide', this._keyboardDidHide);
|
this.keyboardDidHideListener = Keyboard.addListener('keyboardDidHide', this._keyboardDidHide);
|
||||||
this.setSelection();
|
this.setState({ selection: { start: 0, end: 0 } });
|
||||||
}
|
}
|
||||||
|
|
||||||
componentWillUnmount() {
|
componentWillUnmount() {
|
||||||
|
if (this.keyboardDidShowListener) {
|
||||||
|
this.keyboardDidShowListener.remove();
|
||||||
|
}
|
||||||
if (this.keyboardDidHideListener) {
|
if (this.keyboardDidHideListener) {
|
||||||
this.keyboardDidHideListener.remove();
|
this.keyboardDidHideListener.remove();
|
||||||
}
|
}
|
||||||
@@ -47,32 +53,37 @@ class UriBar extends React.PureComponent {
|
|||||||
}
|
}
|
||||||
|
|
||||||
handleChangeText = text => {
|
handleChangeText = text => {
|
||||||
|
this.setState({ selection: undefined });
|
||||||
const newValue = text || '';
|
const newValue = text || '';
|
||||||
clearTimeout(this.state.changeTextTimeout);
|
clearTimeout(this.changeTextTimeout);
|
||||||
const { updateSearchQuery, onSearchSubmitted, navigation } = this.props;
|
const { updateSearchQuery, onSearchSubmitted, showUriBarSuggestions, navigation } = this.props;
|
||||||
|
|
||||||
let timeout = setTimeout(() => {
|
this.changeTextTimeout = -1;
|
||||||
if (text.trim().length === 0) {
|
if (!showUriBarSuggestions) {
|
||||||
// don't do anything if the text is empty
|
this.changeTextTimeout = setTimeout(() => {
|
||||||
return;
|
if (text.trim().length === 0) {
|
||||||
}
|
// don't do anything if the text is empty
|
||||||
|
return;
|
||||||
updateSearchQuery(text);
|
|
||||||
|
|
||||||
if (!text.startsWith('lbry://')) {
|
|
||||||
// not a URI input, so this is a search, perform a direct search
|
|
||||||
if (onSearchSubmitted) {
|
|
||||||
onSearchSubmitted(text);
|
|
||||||
} else {
|
|
||||||
navigation.navigate({ routeName: 'Search', key: 'searchPage', params: { searchQuery: text } });
|
|
||||||
}
|
}
|
||||||
}
|
|
||||||
}, UriBar.INPUT_TIMEOUT);
|
if (!text.startsWith('lbry://')) {
|
||||||
this.setState({ inputText: newValue, currentValue: newValue, changeTextTimeout: timeout });
|
// not a URI input, so this is a search, perform a direct search
|
||||||
|
updateSearchQuery(text);
|
||||||
|
if (onSearchSubmitted) {
|
||||||
|
onSearchSubmitted(text);
|
||||||
|
} else {
|
||||||
|
navigation.navigate({ routeName: 'Search', key: 'searchPage', params: { searchQuery: text } });
|
||||||
|
}
|
||||||
|
}
|
||||||
|
}, UriBar.INPUT_TIMEOUT);
|
||||||
|
} else {
|
||||||
|
updateSearchQuery(text);
|
||||||
|
}
|
||||||
|
this.setState({ inputText: newValue, currentValue: newValue });
|
||||||
};
|
};
|
||||||
|
|
||||||
handleItemPress = item => {
|
handleItemPress = item => {
|
||||||
const { navigation, onSearchSubmitted, updateSearchQuery } = this.props;
|
const { navigation, onSearchSubmitted, setPlayerVisible, updateSearchQuery } = this.props;
|
||||||
const { type, value } = item;
|
const { type, value } = item;
|
||||||
|
|
||||||
Keyboard.dismiss();
|
Keyboard.dismiss();
|
||||||
@@ -86,28 +97,38 @@ class UriBar extends React.PureComponent {
|
|||||||
return;
|
return;
|
||||||
}
|
}
|
||||||
|
|
||||||
navigation.navigate({ routeName: 'Search', key: 'searchPage', params: { searchQuery: value } });
|
navigation.navigate({
|
||||||
|
routeName: Constants.DRAWER_ROUTE_SEARCH,
|
||||||
|
key: 'searchPage',
|
||||||
|
params: { searchQuery: value },
|
||||||
|
});
|
||||||
|
} else if (SEARCH_TYPES.TAG === type) {
|
||||||
|
navigation.navigate({
|
||||||
|
routeName: Constants.DRAWER_ROUTE_TAG,
|
||||||
|
key: 'tagPage',
|
||||||
|
params: {
|
||||||
|
tag: value.toLowerCase(),
|
||||||
|
},
|
||||||
|
});
|
||||||
} else {
|
} else {
|
||||||
const uri = normalizeURI(value);
|
const uri = normalizeURI(value);
|
||||||
navigateToUri(navigation, uri);
|
navigateToUri(navigation, uri, null, false, null, setPlayerVisible);
|
||||||
}
|
}
|
||||||
};
|
};
|
||||||
|
|
||||||
|
_keyboardDidShow = evt => {
|
||||||
|
this.setState({ keyboardHeight: evt.endCoordinates.height });
|
||||||
|
};
|
||||||
|
|
||||||
_keyboardDidHide = () => {
|
_keyboardDidHide = () => {
|
||||||
if (this.textInput) {
|
if (this.textInput) {
|
||||||
this.textInput.blur();
|
this.textInput.blur();
|
||||||
}
|
}
|
||||||
this.setState({ focused: false });
|
this.setState({ focused: false, keyboardHeight: 0 });
|
||||||
};
|
};
|
||||||
|
|
||||||
setSelection() {
|
|
||||||
if (this.textInput) {
|
|
||||||
this.textInput.setNativeProps({ selection: { start: 0, end: 0 } });
|
|
||||||
}
|
|
||||||
}
|
|
||||||
|
|
||||||
handleSubmitEditing = () => {
|
handleSubmitEditing = () => {
|
||||||
const { navigation, onSearchSubmitted, updateSearchQuery } = this.props;
|
const { navigation, onSearchSubmitted, setPlayerVisible, updateSearchQuery } = this.props;
|
||||||
if (this.state.inputText) {
|
if (this.state.inputText) {
|
||||||
let inputText = this.state.inputText,
|
let inputText = this.state.inputText,
|
||||||
inputTextIsUrl = false;
|
inputTextIsUrl = false;
|
||||||
@@ -116,7 +137,7 @@ class UriBar extends React.PureComponent {
|
|||||||
// if it's a URI (lbry://...), open the file page
|
// if it's a URI (lbry://...), open the file page
|
||||||
if (transformedUrl && isURIValid(transformedUrl)) {
|
if (transformedUrl && isURIValid(transformedUrl)) {
|
||||||
inputTextIsUrl = true;
|
inputTextIsUrl = true;
|
||||||
navigateToUri(navigation, transformedUrl);
|
navigateToUri(navigation, transformedUrl, null, false, null, setPlayerVisible);
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
@@ -136,9 +157,31 @@ class UriBar extends React.PureComponent {
|
|||||||
}
|
}
|
||||||
};
|
};
|
||||||
|
|
||||||
onSearchPageBlurred() {
|
handleFocus = () => {
|
||||||
this.setState({ currenValueSet: false });
|
this.setState(
|
||||||
}
|
{
|
||||||
|
focused: true,
|
||||||
|
},
|
||||||
|
() => {
|
||||||
|
this.setState({
|
||||||
|
selection: { start: 0, end: this.state.currentValue ? this.state.currentValue.length : 0 },
|
||||||
|
});
|
||||||
|
},
|
||||||
|
);
|
||||||
|
};
|
||||||
|
|
||||||
|
handleTouchStart = () => {
|
||||||
|
if (this.state.focused) {
|
||||||
|
this.setState({ selection: null });
|
||||||
|
}
|
||||||
|
};
|
||||||
|
|
||||||
|
handleBlur = () => {
|
||||||
|
this.setState({
|
||||||
|
focused: false,
|
||||||
|
selection: { start: 0, end: 0 },
|
||||||
|
});
|
||||||
|
};
|
||||||
|
|
||||||
render() {
|
render() {
|
||||||
const {
|
const {
|
||||||
@@ -152,16 +195,18 @@ class UriBar extends React.PureComponent {
|
|||||||
selectedItemCount,
|
selectedItemCount,
|
||||||
selectionMode,
|
selectionMode,
|
||||||
suggestions,
|
suggestions,
|
||||||
|
showUriBarSuggestions,
|
||||||
value,
|
value,
|
||||||
} = this.props;
|
} = this.props;
|
||||||
if (this.state.currentValue === null) {
|
if (this.state.currentValue === null) {
|
||||||
this.setState({ currentValue: value });
|
this.setState({ currentValue: value });
|
||||||
}
|
}
|
||||||
|
|
||||||
let style = [uriBarStyle.overlay, belowOverlay ? null : uriBarStyle.overlayElevated];
|
let style = [
|
||||||
|
uriBarStyle.overlay,
|
||||||
// TODO: Add optional setting to enable URI / search bar suggestions
|
belowOverlay ? null : uriBarStyle.overlayElevated,
|
||||||
/* if (this.state.focused) { style.push(uriBarStyle.inFocus); } */
|
this.state.focused && showUriBarSuggestions ? uriBarStyle.inFocus : null,
|
||||||
|
];
|
||||||
|
|
||||||
// TODO: selectionModeActions should be dynamically created / specified
|
// TODO: selectionModeActions should be dynamically created / specified
|
||||||
return (
|
return (
|
||||||
@@ -225,13 +270,11 @@ class UriBar extends React.PureComponent {
|
|||||||
ref={ref => {
|
ref={ref => {
|
||||||
this.textInput = ref;
|
this.textInput = ref;
|
||||||
}}
|
}}
|
||||||
|
onTouchStart={this.handleTouchStart}
|
||||||
autoCorrect={false}
|
autoCorrect={false}
|
||||||
style={uriBarStyle.uriText}
|
style={uriBarStyle.uriText}
|
||||||
onLayout={() => {
|
selection={this.state.selection}
|
||||||
this.setSelection();
|
placeholder={__('Search movies, music, and more')}
|
||||||
}}
|
|
||||||
selectTextOnFocus
|
|
||||||
placeholder={'Search movies, music, and more'}
|
|
||||||
underlineColorAndroid={'transparent'}
|
underlineColorAndroid={'transparent'}
|
||||||
numberOfLines={1}
|
numberOfLines={1}
|
||||||
clearButtonMode={'while-editing'}
|
clearButtonMode={'while-editing'}
|
||||||
@@ -239,29 +282,27 @@ class UriBar extends React.PureComponent {
|
|||||||
returnKeyType={'go'}
|
returnKeyType={'go'}
|
||||||
inlineImageLeft={'baseline_search_black_24'}
|
inlineImageLeft={'baseline_search_black_24'}
|
||||||
inlineImagePadding={16}
|
inlineImagePadding={16}
|
||||||
onFocus={() => this.setState({ focused: true })}
|
onFocus={this.handleFocus}
|
||||||
onBlur={() => {
|
onBlur={this.handleBlur}
|
||||||
this.setState({ focused: false });
|
|
||||||
this.setSelection();
|
|
||||||
}}
|
|
||||||
onChangeText={this.handleChangeText}
|
onChangeText={this.handleChangeText}
|
||||||
onSubmitEditing={this.handleSubmitEditing}
|
onSubmitEditing={this.handleSubmitEditing}
|
||||||
/>
|
/>
|
||||||
)}
|
)}
|
||||||
{this.state.focused && !this.state.directSearch && (
|
|
||||||
<View style={uriBarStyle.suggestions}>
|
|
||||||
<FlatList
|
|
||||||
style={uriBarStyle.suggestionList}
|
|
||||||
data={suggestions}
|
|
||||||
keyboardShouldPersistTaps={'handled'}
|
|
||||||
keyExtractor={(item, value) => item.value}
|
|
||||||
renderItem={({ item }) => (
|
|
||||||
<UriBarItem item={item} navigation={navigation} onPress={() => this.handleItemPress(item)} />
|
|
||||||
)}
|
|
||||||
/>
|
|
||||||
</View>
|
|
||||||
)}
|
|
||||||
</View>
|
</View>
|
||||||
|
{this.state.focused && showUriBarSuggestions && (
|
||||||
|
<FlatList
|
||||||
|
style={[
|
||||||
|
uriBarStyle.suggestions,
|
||||||
|
{ height: Dimensions.get('window').height - this.state.keyboardHeight - 60 },
|
||||||
|
]}
|
||||||
|
data={suggestions}
|
||||||
|
keyboardShouldPersistTaps={'handled'}
|
||||||
|
keyExtractor={(item, value) => `${item.value}-${item.type}`}
|
||||||
|
renderItem={({ item }) => (
|
||||||
|
<UriBarItem item={item} navigation={navigation} onPress={() => this.handleItemPress(item)} />
|
||||||
|
)}
|
||||||
|
/>
|
||||||
|
)}
|
||||||
</View>
|
</View>
|
||||||
);
|
);
|
||||||
}
|
}
|
||||||
|
|||||||
@@ -27,21 +27,22 @@ class WalletAddress extends React.PureComponent<Props> {
|
|||||||
|
|
||||||
return (
|
return (
|
||||||
<View style={walletStyle.card}>
|
<View style={walletStyle.card}>
|
||||||
<Text style={walletStyle.title}>Receive Credits</Text>
|
<Text style={walletStyle.title}>{__('Receive Credits')}</Text>
|
||||||
<Text style={[walletStyle.text, walletStyle.bottomMarginMedium]}>
|
<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>
|
</Text>
|
||||||
<Address address={receiveAddress} style={walletStyle.bottomMarginSmall} />
|
<Address address={receiveAddress} style={walletStyle.bottomMarginSmall} />
|
||||||
<Button
|
<Button
|
||||||
style={[walletStyle.button, walletStyle.bottomMarginLarge]}
|
style={[walletStyle.button, walletStyle.bottomMarginLarge]}
|
||||||
icon={'sync'}
|
icon={'sync'}
|
||||||
text={'Get new address'}
|
text={__('Get new address')}
|
||||||
onPress={getNewAddress}
|
onPress={getNewAddress}
|
||||||
disabled={gettingNewAddress}
|
disabled={gettingNewAddress}
|
||||||
/>
|
/>
|
||||||
<Text style={walletStyle.smallText}>
|
<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>
|
</Text>
|
||||||
</View>
|
</View>
|
||||||
);
|
);
|
||||||
|
|||||||
@@ -16,8 +16,8 @@ class WalletBalance extends React.PureComponent<Props> {
|
|||||||
return (
|
return (
|
||||||
<View style={walletStyle.balanceCard}>
|
<View style={walletStyle.balanceCard}>
|
||||||
<Image style={walletStyle.balanceBackground} resizeMode={'cover'} source={require('../../assets/stripe.png')} />
|
<Image style={walletStyle.balanceBackground} resizeMode={'cover'} source={require('../../assets/stripe.png')} />
|
||||||
<Text style={walletStyle.balanceTitle}>Balance</Text>
|
<Text style={walletStyle.balanceTitle}>{__('Balance')}</Text>
|
||||||
<Text style={walletStyle.balanceCaption}>You currently have</Text>
|
<Text style={walletStyle.balanceCaption}>{__('You currently have')}</Text>
|
||||||
<Text style={walletStyle.balance}>
|
<Text style={walletStyle.balance}>
|
||||||
{(balance || balance === 0) && formatCredits(parseFloat(balance), 2) + ' LBC'}
|
{(balance || balance === 0) && formatCredits(parseFloat(balance), 2) + ' LBC'}
|
||||||
</Text>
|
</Text>
|
||||||
|
|||||||
@@ -1,4 +1,10 @@
|
|||||||
import { connect } from 'react-redux';
|
import { connect } from 'react-redux';
|
||||||
|
import { selectUnclaimedRewardValue, selectUser } from 'lbryinc';
|
||||||
import WalletRewardsDriver from './view';
|
import WalletRewardsDriver from './view';
|
||||||
|
|
||||||
export default connect()(WalletRewardsDriver);
|
const select = state => ({
|
||||||
|
unclaimedRewardAmount: selectUnclaimedRewardValue(state),
|
||||||
|
user: selectUser(state),
|
||||||
|
});
|
||||||
|
|
||||||
|
export default connect(select)(WalletRewardsDriver);
|
||||||
@@ -5,12 +5,31 @@ import walletStyle from 'styles/wallet';
|
|||||||
|
|
||||||
class WalletRewardsDriver extends React.PureComponent<Props> {
|
class WalletRewardsDriver extends React.PureComponent<Props> {
|
||||||
render() {
|
render() {
|
||||||
const { navigation } = this.props;
|
const { navigation, unclaimedRewardAmount, user } = this.props;
|
||||||
|
const signedIn = user && user.has_verified_email;
|
||||||
|
|
||||||
return (
|
return (
|
||||||
<TouchableOpacity style={walletStyle.rewardDriverCard} onPress={() => navigation.navigate('Rewards')}>
|
<TouchableOpacity style={walletStyle.rewardDriverCard} onPress={() => navigation.navigate('Rewards')}>
|
||||||
<Icon name="award" size={16} style={walletStyle.rewardIcon} />
|
<Icon name="award" size={16} style={walletStyle.rewardIcon} />
|
||||||
<Text style={walletStyle.rewardDriverText}>Earn credits while using the LBRY app.</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>
|
</TouchableOpacity>
|
||||||
);
|
);
|
||||||
}
|
}
|
||||||
|
|||||||
@@ -1,9 +1,10 @@
|
|||||||
// @flow
|
// @flow
|
||||||
import React from 'react';
|
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 { Alert, Clipboard, TextInput, Text, View } from 'react-native';
|
||||||
import Button from 'component/button';
|
import Button from 'component/button';
|
||||||
import Colors from 'styles/colors';
|
import Colors from 'styles/colors';
|
||||||
|
import Icon from 'react-native-vector-icons/FontAwesome5';
|
||||||
import walletStyle from 'styles/wallet';
|
import walletStyle from 'styles/wallet';
|
||||||
|
|
||||||
type DraftTransaction = {
|
type DraftTransaction = {
|
||||||
@@ -24,6 +25,7 @@ class WalletSend extends React.PureComponent<Props> {
|
|||||||
address: null,
|
address: null,
|
||||||
addressChanged: false,
|
addressChanged: false,
|
||||||
addressValid: false,
|
addressValid: false,
|
||||||
|
creditsInputFocused: false,
|
||||||
};
|
};
|
||||||
|
|
||||||
componentWillUpdate(nextProps) {
|
componentWillUpdate(nextProps) {
|
||||||
@@ -36,26 +38,28 @@ class WalletSend extends React.PureComponent<Props> {
|
|||||||
handleSend = () => {
|
handleSend = () => {
|
||||||
const { balance, sendToAddress, notify } = this.props;
|
const { balance, sendToAddress, notify } = this.props;
|
||||||
const { address, amount } = this.state;
|
const { address, amount } = this.state;
|
||||||
if (address && !regexAddress.test(address)) {
|
if (address && (!regexAddress.test(address) || address.substring(0, 1) === 'r')) {
|
||||||
notify({
|
notify({
|
||||||
message: 'The recipient address is not a valid LBRY address.',
|
message: __('The recipient address is not a valid LBRY address.'),
|
||||||
|
isError: true,
|
||||||
});
|
});
|
||||||
return;
|
return;
|
||||||
}
|
}
|
||||||
|
|
||||||
if (amount > balance) {
|
if (amount > balance) {
|
||||||
notify({
|
notify({
|
||||||
message: 'Insufficient credits',
|
message: __('Insufficient credits'),
|
||||||
|
isError: true,
|
||||||
});
|
});
|
||||||
return;
|
return;
|
||||||
}
|
}
|
||||||
|
|
||||||
if (amount && address) {
|
if (amount && address) {
|
||||||
// Show confirmation before send
|
// Show confirmation before send
|
||||||
Alert.alert('Send LBC', `Are you sure you want to send ${amount} LBC to ${address}?`, [
|
Alert.alert(__('Send LBC'), `Are you sure you want to send ${amount} LBC to ${address}?`, [
|
||||||
{ text: 'No' },
|
{ text: __('No') },
|
||||||
{
|
{
|
||||||
text: 'Yes',
|
text: __('Yes'),
|
||||||
onPress: () => {
|
onPress: () => {
|
||||||
sendToAddress(address, parseFloat(amount));
|
sendToAddress(address, parseFloat(amount));
|
||||||
this.setState({ address: null, amount: null });
|
this.setState({ address: null, amount: null });
|
||||||
@@ -69,7 +73,8 @@ class WalletSend extends React.PureComponent<Props> {
|
|||||||
if (this.state.addressChanged && !this.state.addressValid) {
|
if (this.state.addressChanged && !this.state.addressValid) {
|
||||||
const { notify } = this.props;
|
const { notify } = this.props;
|
||||||
notify({
|
notify({
|
||||||
message: 'The recipient address is not a valid LBRY address.',
|
message: __('The recipient address is not a valid LBRY address.'),
|
||||||
|
isError: true,
|
||||||
});
|
});
|
||||||
}
|
}
|
||||||
};
|
};
|
||||||
@@ -82,21 +87,23 @@ class WalletSend extends React.PureComponent<Props> {
|
|||||||
|
|
||||||
render() {
|
render() {
|
||||||
const { balance } = this.props;
|
const { balance } = this.props;
|
||||||
const canSend = this.state.address && this.state.amount > 0 && this.state.address.trim().length > 0;
|
const canSend =
|
||||||
|
this.state.address && this.state.amount > 0 && this.state.address.trim().length > 0 && this.state.addressValid;
|
||||||
|
|
||||||
return (
|
return (
|
||||||
<View style={walletStyle.card}>
|
<View style={walletStyle.card}>
|
||||||
<Text style={walletStyle.title}>Send Credits</Text>
|
<Text style={walletStyle.title}>{__('Send Credits')}</Text>
|
||||||
<Text style={walletStyle.text}>Recipient address</Text>
|
<Text style={walletStyle.text}>{__('Recipient address')}</Text>
|
||||||
<View style={[walletStyle.row, walletStyle.bottomMarginMedium]}>
|
<View style={[walletStyle.row, walletStyle.bottomMarginMedium]}>
|
||||||
<TextInput
|
<TextInput
|
||||||
onChangeText={value =>
|
onChangeText={value =>
|
||||||
this.setState({
|
this.setState({
|
||||||
address: value,
|
address: value,
|
||||||
addressChanged: true,
|
addressChanged: true,
|
||||||
addressValid: value.trim().length == 0 || regexAddress.test(value),
|
addressValid: value.trim().length === 0 || (regexAddress.test(value) && !value.startsWith('r')),
|
||||||
})
|
})
|
||||||
}
|
}
|
||||||
|
numberOfLines={1}
|
||||||
onBlur={this.handleAddressInputBlur}
|
onBlur={this.handleAddressInputBlur}
|
||||||
onSubmitEditing={this.handleAddressInputSubmit}
|
onSubmitEditing={this.handleAddressInputSubmit}
|
||||||
placeholder={'bbFxRyXXXXXXXXXXXZD8nE7XTLUxYnddTs'}
|
placeholder={'bbFxRyXXXXXXXXXXXZD8nE7XTLUxYnddTs'}
|
||||||
@@ -111,12 +118,14 @@ class WalletSend extends React.PureComponent<Props> {
|
|||||||
onPress={() => Clipboard.getString().then(value => this.setState({ address: value, addressChanged: true }))}
|
onPress={() => Clipboard.getString().then(value => this.setState({ address: value, addressChanged: true }))}
|
||||||
/>
|
/>
|
||||||
</View>
|
</View>
|
||||||
<Text style={walletStyle.text}>Amount</Text>
|
<Text style={walletStyle.text}>{__('Amount')}</Text>
|
||||||
<View style={walletStyle.row}>
|
<View style={walletStyle.row}>
|
||||||
<View style={walletStyle.amountRow}>
|
<View style={walletStyle.amountRow}>
|
||||||
<TextInput
|
<TextInput
|
||||||
ref={ref => (this.amountInput = ref)}
|
ref={ref => (this.amountInput = ref)}
|
||||||
onChangeText={value => this.setState({ amount: value })}
|
onChangeText={value => this.setState({ amount: value })}
|
||||||
|
onFocus={() => this.setState({ creditsInputFocused: true })}
|
||||||
|
onBlur={() => this.setState({ creditsInputFocused: false })}
|
||||||
keyboardType={'numeric'}
|
keyboardType={'numeric'}
|
||||||
placeholder={'0'}
|
placeholder={'0'}
|
||||||
underlineColorAndroid={Colors.NextLbryGreen}
|
underlineColorAndroid={Colors.NextLbryGreen}
|
||||||
@@ -124,9 +133,15 @@ class WalletSend extends React.PureComponent<Props> {
|
|||||||
style={[walletStyle.input, walletStyle.amountInput]}
|
style={[walletStyle.input, walletStyle.amountInput]}
|
||||||
/>
|
/>
|
||||||
<Text style={[walletStyle.text, walletStyle.currency]}>LBC</Text>
|
<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>
|
</View>
|
||||||
<Button
|
<Button
|
||||||
text={'Send'}
|
text={__('Send')}
|
||||||
style={[walletStyle.button, walletStyle.sendButton]}
|
style={[walletStyle.button, walletStyle.sendButton]}
|
||||||
disabled={!canSend}
|
disabled={!canSend}
|
||||||
onPress={this.handleSend}
|
onPress={this.handleSend}
|
||||||
|
|||||||
@@ -0,0 +1,19 @@
|
|||||||
|
import { connect } from 'react-redux';
|
||||||
|
import { doToast } from 'lbry-redux';
|
||||||
|
import { doSetClientSetting } from 'redux/actions/settings';
|
||||||
|
import { selectUser } from 'lbryinc';
|
||||||
|
import WalletSignIn from './view';
|
||||||
|
|
||||||
|
const select = state => ({
|
||||||
|
user: selectUser(state),
|
||||||
|
});
|
||||||
|
|
||||||
|
const perform = dispatch => ({
|
||||||
|
notify: data => dispatch(doToast(data)),
|
||||||
|
setClientSetting: (key, value) => dispatch(doSetClientSetting(key, value)),
|
||||||
|
});
|
||||||
|
|
||||||
|
export default connect(
|
||||||
|
select,
|
||||||
|
perform
|
||||||
|
)(WalletSignIn);
|
||||||
@@ -0,0 +1,57 @@
|
|||||||
|
import React from 'react';
|
||||||
|
import { Linking, NativeModules, Text, TouchableOpacity, View } from 'react-native';
|
||||||
|
import AsyncStorage from '@react-native-community/async-storage';
|
||||||
|
import Button from 'component/button';
|
||||||
|
import Constants from 'constants'; // eslint-disable-line node/no-deprecated-api
|
||||||
|
import Link from 'component/link';
|
||||||
|
import Colors from 'styles/colors';
|
||||||
|
import Icon from 'react-native-vector-icons/FontAwesome5';
|
||||||
|
import walletStyle from 'styles/wallet';
|
||||||
|
|
||||||
|
class WalletSignIn extends React.Component {
|
||||||
|
onContinuePressed = () => {
|
||||||
|
const { navigation, setClientSetting } = this.props;
|
||||||
|
setClientSetting(Constants.SETTING_ALPHA_UNDERSTANDS_RISKS, true);
|
||||||
|
};
|
||||||
|
|
||||||
|
onSignInPressed = () => {
|
||||||
|
const { navigation } = this.props;
|
||||||
|
navigation.navigate({
|
||||||
|
routeName: 'Verification',
|
||||||
|
key: 'verification',
|
||||||
|
params: { syncFlow: true, signInFlow: true },
|
||||||
|
});
|
||||||
|
};
|
||||||
|
|
||||||
|
render() {
|
||||||
|
const { navigation, user } = this.props;
|
||||||
|
|
||||||
|
return (
|
||||||
|
<View style={walletStyle.signInContainer}>
|
||||||
|
<View style={walletStyle.signInSummaryRow}>
|
||||||
|
<Text style={walletStyle.signInTitle}>{__('Account Recommended')}</Text>
|
||||||
|
</View>
|
||||||
|
|
||||||
|
<View style={walletStyle.onboarding}>
|
||||||
|
<Text style={walletStyle.onboardingText}>
|
||||||
|
{__('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.')}
|
||||||
|
</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}
|
||||||
|
/>
|
||||||
|
</View>
|
||||||
|
</View>
|
||||||
|
);
|
||||||
|
}
|
||||||
|
}
|
||||||
|
|
||||||
|
export default WalletSignIn;
|
||||||
@@ -3,7 +3,7 @@ import { doSetClientSetting } from 'redux/actions/settings';
|
|||||||
import { makeSelectClientSetting } from 'redux/selectors/settings';
|
import { makeSelectClientSetting } from 'redux/selectors/settings';
|
||||||
import { doToast } from 'lbry-redux';
|
import { doToast } from 'lbry-redux';
|
||||||
import { selectUserEmail } from 'lbryinc';
|
import { selectUserEmail } from 'lbryinc';
|
||||||
import Constants from 'constants';
|
import Constants from 'constants'; // eslint-disable-line node/no-deprecated-api
|
||||||
import WalletSyncDriver from './view';
|
import WalletSyncDriver from './view';
|
||||||
|
|
||||||
const select = state => ({
|
const select = state => ({
|
||||||
|
|||||||
@@ -1,7 +1,7 @@
|
|||||||
import React from 'react';
|
import React from 'react';
|
||||||
import { Alert, NativeModules, Switch, Text, View } from 'react-native';
|
import { Alert, NativeModules, Switch, Text, View } from 'react-native';
|
||||||
import Button from 'component/button';
|
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 Link from 'component/link';
|
||||||
import walletStyle from 'styles/wallet';
|
import walletStyle from 'styles/wallet';
|
||||||
|
|
||||||
@@ -15,15 +15,15 @@ class WalletSyncDriver extends React.PureComponent<Props> {
|
|||||||
// turning off
|
// turning off
|
||||||
// set deviceWalletSynced to false (if confirmed)
|
// set deviceWalletSynced to false (if confirmed)
|
||||||
Alert.alert(
|
Alert.alert(
|
||||||
'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?'),
|
||||||
[
|
[
|
||||||
{ text: 'No' },
|
{ text: __('No') },
|
||||||
{
|
{
|
||||||
text: 'Yes',
|
text: __('Yes'),
|
||||||
onPress: () => {
|
onPress: () => {
|
||||||
setClientSetting(Constants.SETTING_DEVICE_WALLET_SYNCED, false);
|
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 (
|
return (
|
||||||
<View style={walletStyle.syncDriverCard}>
|
<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.switchRow}>
|
||||||
<View style={walletStyle.tableCol}>
|
<View style={walletStyle.tableCol}>
|
||||||
<Text style={walletStyle.labelText}>Sync status</Text>
|
<Text style={walletStyle.labelText}>{__('Sync status')}</Text>
|
||||||
</View>
|
</View>
|
||||||
<View style={walletStyle.tableColRow}>
|
<View style={walletStyle.tableColRow}>
|
||||||
<Text selectable={true} style={walletStyle.valueText}>
|
<Text selectable style={walletStyle.valueText}>
|
||||||
{deviceWalletSynced ? 'On' : 'Off'}
|
{deviceWalletSynced ? __('On') : __('Off')}
|
||||||
</Text>
|
</Text>
|
||||||
<Switch
|
<Switch
|
||||||
style={walletStyle.syncSwitch}
|
style={walletStyle.syncSwitch}
|
||||||
@@ -56,11 +56,11 @@ class WalletSyncDriver extends React.PureComponent<Props> {
|
|||||||
{deviceWalletSynced && (
|
{deviceWalletSynced && (
|
||||||
<View style={walletStyle.tableRow}>
|
<View style={walletStyle.tableRow}>
|
||||||
<View style={walletStyle.tableCol}>
|
<View style={walletStyle.tableCol}>
|
||||||
<Text style={walletStyle.labelText}>Connected email</Text>
|
<Text style={walletStyle.labelText}>{__('Connected email')}</Text>
|
||||||
</View>
|
</View>
|
||||||
<View style={walletStyle.tableCol}>
|
<View style={walletStyle.tableCol}>
|
||||||
<Text selectable={true} style={walletStyle.valueText}>
|
<Text selectable style={walletStyle.valueText} numberOfLines={1}>
|
||||||
{userEmail ? userEmail : 'No connected email'}
|
{userEmail || __('No connected email')}
|
||||||
</Text>
|
</Text>
|
||||||
</View>
|
</View>
|
||||||
</View>
|
</View>
|
||||||
@@ -69,7 +69,7 @@ class WalletSyncDriver extends React.PureComponent<Props> {
|
|||||||
<View style={walletStyle.linkRow}>
|
<View style={walletStyle.linkRow}>
|
||||||
<View style={walletStyle.tableCol}>
|
<View style={walletStyle.tableCol}>
|
||||||
<Link
|
<Link
|
||||||
text="Manual backup"
|
text={__('Manual backup')}
|
||||||
href="https://lbry.com/faq/how-to-backup-wallet#android"
|
href="https://lbry.com/faq/how-to-backup-wallet#android"
|
||||||
style={walletStyle.syncDriverLink}
|
style={walletStyle.syncDriverLink}
|
||||||
/>
|
/>
|
||||||
@@ -77,7 +77,7 @@ class WalletSyncDriver extends React.PureComponent<Props> {
|
|||||||
<View style={walletStyle.rightTableCol}>
|
<View style={walletStyle.rightTableCol}>
|
||||||
{!deviceWalletSynced && (
|
{!deviceWalletSynced && (
|
||||||
<Link
|
<Link
|
||||||
text="Sync FAQ"
|
text={__('Sync FAQ')}
|
||||||
href="https://lbry.com/faq/how-to-backup-wallet#sync"
|
href="https://lbry.com/faq/how-to-backup-wallet#sync"
|
||||||
style={[walletStyle.syncDriverLink, walletStyle.rightLink]}
|
style={[walletStyle.syncDriverLink, walletStyle.rightLink]}
|
||||||
/>
|
/>
|
||||||
|
|||||||
+17
-4
@@ -32,7 +32,7 @@ const Constants = {
|
|||||||
ABOUT_TAB: 'about',
|
ABOUT_TAB: 'about',
|
||||||
|
|
||||||
KEY_FIRST_RUN_EMAIL: 'firstRunEmail',
|
KEY_FIRST_RUN_EMAIL: 'firstRunEmail',
|
||||||
KEY_FIRST_RUN_PASSWORD: 'firstRunPassword',
|
KEY_WALLET_PASSWORD: 'firstRunPassword',
|
||||||
KEY_FIRST_USER_AUTH: 'firstUserAuth',
|
KEY_FIRST_USER_AUTH: 'firstUserAuth',
|
||||||
KEY_SHOULD_VERIFY_EMAIL: 'shouldVerifyEmail',
|
KEY_SHOULD_VERIFY_EMAIL: 'shouldVerifyEmail',
|
||||||
KEY_EMAIL_VERIFY_PENDING: 'emailVerifyPending',
|
KEY_EMAIL_VERIFY_PENDING: 'emailVerifyPending',
|
||||||
@@ -64,6 +64,8 @@ const Constants = {
|
|||||||
ACTION_CLEAR_PUBLISH_FORM_STATE: 'CLEAR_PUBLISH_FORM_STATE',
|
ACTION_CLEAR_PUBLISH_FORM_STATE: 'CLEAR_PUBLISH_FORM_STATE',
|
||||||
ACTION_CLEAR_CHANNEL_FORM_STATE: 'CLEAR_CHANNEL_FORM_STATE',
|
ACTION_CLEAR_CHANNEL_FORM_STATE: 'CLEAR_CHANNEL_FORM_STATE',
|
||||||
|
|
||||||
|
ACTION_FULLSCREEN_MODE_TOGGLED: 'FULLSCREEN_MODE_TOGGLED',
|
||||||
|
|
||||||
ORIENTATION_HORIZONTAL: 'horizontal',
|
ORIENTATION_HORIZONTAL: 'horizontal',
|
||||||
ORIENTATION_VERTICAL: 'vertical',
|
ORIENTATION_VERTICAL: 'vertical',
|
||||||
|
|
||||||
@@ -88,11 +90,13 @@ const Constants = {
|
|||||||
DRAWER_ROUTE_TAG: 'Tag',
|
DRAWER_ROUTE_TAG: 'Tag',
|
||||||
DRAWER_ROUTE_CHANNEL_CREATOR: 'ChannelCreator',
|
DRAWER_ROUTE_CHANNEL_CREATOR: 'ChannelCreator',
|
||||||
DRAWER_ROUTE_CHANNEL_CREATOR_FORM: 'ChannnelCreatorForm',
|
DRAWER_ROUTE_CHANNEL_CREATOR_FORM: 'ChannnelCreatorForm',
|
||||||
|
DRAWER_ROUTE_INVITES: 'Invites',
|
||||||
|
|
||||||
FULL_ROUTE_NAME_DISCOVER: 'DiscoverStack',
|
FULL_ROUTE_NAME_DISCOVER: 'DiscoverStack',
|
||||||
FULL_ROUTE_NAME_WALLET: 'WalletStack',
|
FULL_ROUTE_NAME_WALLET: 'WalletStack',
|
||||||
|
|
||||||
ROUTE_FILE: 'File',
|
ROUTE_FILE: 'File',
|
||||||
|
DRAWER_ROUTE_FILE_VIEW: 'FileView',
|
||||||
|
|
||||||
ITEM_CREATE_A_CHANNEL: 'Create a channel...',
|
ITEM_CREATE_A_CHANNEL: 'Create a channel...',
|
||||||
ITEM_ANONYMOUS: 'Publish anonymously',
|
ITEM_ANONYMOUS: 'Publish anonymously',
|
||||||
@@ -127,17 +131,21 @@ const Constants = {
|
|||||||
{ name: TIME_ALL, label: 'All time' },
|
{ 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',
|
ORDER_BY_EFFECTIVE_AMOUNT: 'effective_amount',
|
||||||
|
|
||||||
DEFAULT_PAGE_SIZE: 10,
|
DEFAULT_PAGE_SIZE: 20,
|
||||||
|
|
||||||
ALL_PLACEHOLDER: '_all',
|
ALL_PLACEHOLDER: '_all',
|
||||||
|
|
||||||
MORE_PLACEHOLDER: '_more',
|
MORE_PLACEHOLDER: '_more',
|
||||||
|
|
||||||
TRUE_STRING: 'true',
|
TRUE_STRING: 'true',
|
||||||
|
|
||||||
|
MINIMUM_TRANSACTION_BALANCE: 0.1,
|
||||||
|
|
||||||
|
SHARE_BASE_URL: 'https://open.lbry.com',
|
||||||
};
|
};
|
||||||
|
|
||||||
export default Constants;
|
export default Constants;
|
||||||
@@ -158,7 +166,12 @@ export const DrawerRoutes = [
|
|||||||
Constants.DRAWER_ROUTE_SEARCH,
|
Constants.DRAWER_ROUTE_SEARCH,
|
||||||
Constants.DRAWER_ROUTE_TRANSACTION_HISTORY,
|
Constants.DRAWER_ROUTE_TRANSACTION_HISTORY,
|
||||||
Constants.DRAWER_ROUTE_CHANNEL_CREATOR,
|
Constants.DRAWER_ROUTE_CHANNEL_CREATOR,
|
||||||
|
Constants.DRAWER_ROUTE_INVITES,
|
||||||
];
|
];
|
||||||
|
|
||||||
// sub-pages for main routes
|
// 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,
|
||||||
|
];
|
||||||
+80
@@ -0,0 +1,80 @@
|
|||||||
|
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 && !isProduction) {
|
||||||
|
// only do this when not in production
|
||||||
|
console.error(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.hasOwnProperty($2) ? tokens[$2] : $2;
|
||||||
|
});
|
||||||
|
}
|
||||||
+72
-28
@@ -4,6 +4,8 @@ import { Provider, connect } from 'react-redux';
|
|||||||
import { AppRegistry, Text, View, NativeModules } from 'react-native';
|
import { AppRegistry, Text, View, NativeModules } from 'react-native';
|
||||||
import {
|
import {
|
||||||
Lbry,
|
Lbry,
|
||||||
|
buildSharedStateMiddleware,
|
||||||
|
blockedReducer,
|
||||||
claimsReducer,
|
claimsReducer,
|
||||||
contentReducer,
|
contentReducer,
|
||||||
fileReducer,
|
fileReducer,
|
||||||
@@ -13,18 +15,25 @@ import {
|
|||||||
searchReducer,
|
searchReducer,
|
||||||
tagsReducer,
|
tagsReducer,
|
||||||
walletReducer,
|
walletReducer,
|
||||||
|
ACTIONS as LBRY_REDUX_ACTIONS,
|
||||||
} from 'lbry-redux';
|
} from 'lbry-redux';
|
||||||
import {
|
import {
|
||||||
|
Lbryio,
|
||||||
authReducer,
|
authReducer,
|
||||||
blacklistReducer,
|
blacklistReducer,
|
||||||
costInfoReducer,
|
costInfoReducer,
|
||||||
|
doGetSync,
|
||||||
filteredReducer,
|
filteredReducer,
|
||||||
homepageReducer,
|
homepageReducer,
|
||||||
rewardsReducer,
|
rewardsReducer,
|
||||||
|
selectUserVerifiedEmail,
|
||||||
|
statsReducer,
|
||||||
subscriptionsReducer,
|
subscriptionsReducer,
|
||||||
syncReducer,
|
syncReducer,
|
||||||
userReducer,
|
userReducer,
|
||||||
|
LBRYINC_ACTIONS,
|
||||||
} from 'lbryinc';
|
} from 'lbryinc';
|
||||||
|
import { makeSelectClientSetting } from 'redux/selectors/settings';
|
||||||
import { createStore, applyMiddleware, compose } from 'redux';
|
import { createStore, applyMiddleware, compose } from 'redux';
|
||||||
import AppWithNavigationState, {
|
import AppWithNavigationState, {
|
||||||
AppNavigator,
|
AppNavigator,
|
||||||
@@ -32,6 +41,9 @@ import AppWithNavigationState, {
|
|||||||
reactNavigationMiddleware,
|
reactNavigationMiddleware,
|
||||||
} from 'component/AppNavigator';
|
} from 'component/AppNavigator';
|
||||||
import { REHYDRATE, PURGE, persistCombineReducers, persistStore } from 'redux-persist';
|
import { REHYDRATE, PURGE, persistCombineReducers, persistStore } from 'redux-persist';
|
||||||
|
import { __ } from 'i18n';
|
||||||
|
import reactotron from '../reactotron';
|
||||||
|
import Constants from 'constants'; // eslint-disable-line node/no-deprecated-api
|
||||||
import getStoredStateMigrateV4 from 'redux-persist/lib/integration/getStoredStateMigrateV4';
|
import getStoredStateMigrateV4 from 'redux-persist/lib/integration/getStoredStateMigrateV4';
|
||||||
import FilesystemStorage from 'redux-persist-filesystem-storage';
|
import FilesystemStorage from 'redux-persist-filesystem-storage';
|
||||||
import createCompressor from 'redux-persist-transform-compress';
|
import createCompressor from 'redux-persist-transform-compress';
|
||||||
@@ -42,9 +54,11 @@ import drawerReducer from 'redux/reducers/drawer';
|
|||||||
import settingsReducer from 'redux/reducers/settings';
|
import settingsReducer from 'redux/reducers/settings';
|
||||||
import thunk from 'redux-thunk';
|
import thunk from 'redux-thunk';
|
||||||
|
|
||||||
|
window.__ = __;
|
||||||
|
|
||||||
const globalExceptionHandler = (error, isFatal) => {
|
const globalExceptionHandler = (error, isFatal) => {
|
||||||
if (error && NativeModules.Firebase) {
|
if (error && NativeModules.Firebase) {
|
||||||
NativeModules.Firebase.logException(isFatal, error.message ? error.message : 'No message', JSON.stringify(error));
|
NativeModules.Firebase.logException(!!isFatal, error.message ? error.message : 'No message', JSON.stringify(error));
|
||||||
}
|
}
|
||||||
};
|
};
|
||||||
setJSExceptionHandler(globalExceptionHandler, true);
|
setJSExceptionHandler(globalExceptionHandler, true);
|
||||||
@@ -79,18 +93,29 @@ function enableBatching(reducer) {
|
|||||||
|
|
||||||
const compressor = createCompressor();
|
const compressor = createCompressor();
|
||||||
const authFilter = createFilter('auth', ['authToken']);
|
const authFilter = createFilter('auth', ['authToken']);
|
||||||
|
const blockedFilter = createFilter('blocked', ['blockedChannels']);
|
||||||
const contentFilter = createFilter('content', ['positions']);
|
const contentFilter = createFilter('content', ['positions']);
|
||||||
|
const drawerFilter = createFilter('drawer', ['lastRouteInStack']);
|
||||||
const saveClaimsFilter = createFilter('claims', ['claimsByUri']);
|
const saveClaimsFilter = createFilter('claims', ['claimsByUri']);
|
||||||
const subscriptionsFilter = createFilter('subscriptions', ['enabledChannelNotifications', 'subscriptions']);
|
const subscriptionsFilter = createFilter('subscriptions', ['enabledChannelNotifications', 'subscriptions', 'latest']);
|
||||||
const settingsFilter = createFilter('settings', ['clientSettings']);
|
const settingsFilter = createFilter('settings', ['clientSettings']);
|
||||||
const tagsFilter = createFilter('tags', ['followedTags']);
|
const tagsFilter = createFilter('tags', ['followedTags']);
|
||||||
const walletFilter = createFilter('wallet', ['receiveAddress']);
|
const walletFilter = createFilter('wallet', ['receiveAddress']);
|
||||||
|
|
||||||
const v4PersistOptions = {
|
const v4PersistOptions = {
|
||||||
whitelist: ['auth', 'claims', 'content', 'subscriptions', 'settings', 'tags', 'wallet'],
|
whitelist: ['auth', 'blocked', 'claims', 'drawer', 'content', 'subscriptions', 'settings', 'tags', 'wallet'],
|
||||||
// Order is important. Needs to be compressed last or other transforms can't
|
// Order is important. Needs to be compressed last or other transforms can't
|
||||||
// read the data
|
// read the data
|
||||||
transforms: [authFilter, saveClaimsFilter, subscriptionsFilter, settingsFilter, walletFilter, compressor],
|
transforms: [
|
||||||
|
authFilter,
|
||||||
|
blockedFilter,
|
||||||
|
drawerFilter,
|
||||||
|
saveClaimsFilter,
|
||||||
|
subscriptionsFilter,
|
||||||
|
settingsFilter,
|
||||||
|
walletFilter,
|
||||||
|
compressor,
|
||||||
|
],
|
||||||
debounce: 10000,
|
debounce: 10000,
|
||||||
storage: FilesystemStorage,
|
storage: FilesystemStorage,
|
||||||
};
|
};
|
||||||
@@ -103,6 +128,7 @@ const persistOptions = Object.assign({}, v4PersistOptions, {
|
|||||||
const reducers = persistCombineReducers(persistOptions, {
|
const reducers = persistCombineReducers(persistOptions, {
|
||||||
auth: authReducer,
|
auth: authReducer,
|
||||||
blacklist: blacklistReducer,
|
blacklist: blacklistReducer,
|
||||||
|
blocked: blockedReducer,
|
||||||
claims: claimsReducer,
|
claims: claimsReducer,
|
||||||
content: contentReducer,
|
content: contentReducer,
|
||||||
costInfo: costInfoReducer,
|
costInfo: costInfoReducer,
|
||||||
@@ -118,6 +144,7 @@ const reducers = persistCombineReducers(persistOptions, {
|
|||||||
rewards: rewardsReducer,
|
rewards: rewardsReducer,
|
||||||
settings: settingsReducer,
|
settings: settingsReducer,
|
||||||
search: searchReducer,
|
search: searchReducer,
|
||||||
|
stats: statsReducer,
|
||||||
subscriptions: subscriptionsReducer,
|
subscriptions: subscriptionsReducer,
|
||||||
sync: syncReducer,
|
sync: syncReducer,
|
||||||
tags: tagsReducer,
|
tags: tagsReducer,
|
||||||
@@ -125,8 +152,45 @@ const reducers = persistCombineReducers(persistOptions, {
|
|||||||
wallet: walletReducer,
|
wallet: walletReducer,
|
||||||
});
|
});
|
||||||
|
|
||||||
|
/**
|
||||||
|
* source: the reducer name
|
||||||
|
* property: the property in the reducer-specific state
|
||||||
|
* transform: optional method to modify the value to be stored
|
||||||
|
*/
|
||||||
|
const sharedStateActions = [
|
||||||
|
LBRYINC_ACTIONS.CHANNEL_SUBSCRIBE,
|
||||||
|
LBRYINC_ACTIONS.CHANNEL_UNSUBSCRIBE,
|
||||||
|
LBRY_REDUX_ACTIONS.CREATE_CHANNEL_COMPLETED,
|
||||||
|
LBRY_REDUX_ACTIONS.TOGGLE_TAG_FOLLOW,
|
||||||
|
LBRY_REDUX_ACTIONS.TOGGLE_BLOCK_CHANNEL,
|
||||||
|
];
|
||||||
|
const sharedStateFilters = {
|
||||||
|
tags: { source: 'tags', property: 'followedTags' },
|
||||||
|
subscriptions: {
|
||||||
|
source: 'subscriptions',
|
||||||
|
property: 'subscriptions',
|
||||||
|
transform: function(value) {
|
||||||
|
return value.map(({ uri }) => uri);
|
||||||
|
},
|
||||||
|
},
|
||||||
|
blocked: { source: 'blocked', property: 'blockedChannels' },
|
||||||
|
};
|
||||||
|
|
||||||
|
const sharedStateCallback = ({ dispatch, getState }) => {
|
||||||
|
const state = getState();
|
||||||
|
const syncEnabled = makeSelectClientSetting(Constants.SETTING_DEVICE_WALLET_SYNCED)(state);
|
||||||
|
const emailVerified = selectUserVerifiedEmail(state);
|
||||||
|
if (syncEnabled && emailVerified) {
|
||||||
|
NativeModules.UtilityModule.getSecureValue(Constants.KEY_WALLET_PASSWORD).then(password =>
|
||||||
|
dispatch(doGetSync(password)),
|
||||||
|
);
|
||||||
|
}
|
||||||
|
};
|
||||||
|
|
||||||
|
const sharedStateMiddleware = buildSharedStateMiddleware(sharedStateActions, sharedStateFilters, sharedStateCallback);
|
||||||
|
|
||||||
const bulkThunk = createBulkThunkMiddleware();
|
const bulkThunk = createBulkThunkMiddleware();
|
||||||
const middleware = [thunk, bulkThunk, reactNavigationMiddleware];
|
const middleware = [sharedStateMiddleware, thunk, bulkThunk, reactNavigationMiddleware];
|
||||||
|
|
||||||
// eslint-disable-next-line no-underscore-dangle
|
// eslint-disable-next-line no-underscore-dangle
|
||||||
const composeEnhancers = compose;
|
const composeEnhancers = compose;
|
||||||
@@ -134,37 +198,17 @@ const composeEnhancers = compose;
|
|||||||
const store = createStore(
|
const store = createStore(
|
||||||
enableBatching(reducers),
|
enableBatching(reducers),
|
||||||
{}, // initial state,
|
{}, // initial state,
|
||||||
composeEnhancers(applyMiddleware(...middleware))
|
composeEnhancers(applyMiddleware(...middleware), reactotron.createEnhancer()),
|
||||||
);
|
);
|
||||||
window.store = store;
|
window.store = store;
|
||||||
|
|
||||||
const persistor = persistStore(store, persistOptions, err => {
|
const persistor = persistStore(store, null, err => {
|
||||||
if (err) {
|
if (err) {
|
||||||
console.log('Unable to load saved SETTINGS');
|
// console.log('Unable to load saved SETTINGS');
|
||||||
}
|
}
|
||||||
});
|
});
|
||||||
window.persistor = persistor;
|
window.persistor = persistor;
|
||||||
|
|
||||||
/*
|
|
||||||
const persistFilter = {
|
|
||||||
'auth': ['authToken'],
|
|
||||||
'claims': ['byId', 'claimsByUri'],
|
|
||||||
'content': ['positions'],
|
|
||||||
'subscriptions': ['enabledChannelNotifications', 'subscriptions'],
|
|
||||||
'settings': ['clientSettings'],
|
|
||||||
'tags': ['followedTags'],
|
|
||||||
'wallet': ['receiveAddress']
|
|
||||||
};
|
|
||||||
|
|
||||||
store.subscribe(() => {
|
|
||||||
const state = (({ auth, claims, content, subscriptions, settings, tags, wallet }) =>
|
|
||||||
({ auth, claims, content, subscriptions, settings, tags, wallet }))(store.getState());
|
|
||||||
NativeModules.StatePersistor.update(state, persistFilter);
|
|
||||||
}); */
|
|
||||||
|
|
||||||
// TODO: Find i18n module that is compatible with react-native
|
|
||||||
global.__ = str => str;
|
|
||||||
|
|
||||||
class LBRYApp extends React.Component {
|
class LBRYApp extends React.Component {
|
||||||
render() {
|
render() {
|
||||||
return (
|
return (
|
||||||
|
|||||||
+21
-21
@@ -67,29 +67,29 @@ class AboutPage extends React.PureComponent {
|
|||||||
|
|
||||||
render() {
|
render() {
|
||||||
const { accessToken, drawerStack, navigation, notify, popDrawerStack, userEmail } = this.props;
|
const { accessToken, drawerStack, navigation, notify, popDrawerStack, userEmail } = this.props;
|
||||||
const loading = 'Loading...';
|
const loading = __('Loading...');
|
||||||
const ver = this.state.versionInfo ? this.state.versionInfo : null;
|
const ver = this.state.versionInfo ? this.state.versionInfo : null;
|
||||||
|
|
||||||
return (
|
return (
|
||||||
<View style={aboutStyle.container}>
|
<View style={aboutStyle.container}>
|
||||||
<PageHeader title={'About LBRY'} onBackPressed={() => navigateBack(navigation, drawerStack, popDrawerStack)} />
|
<PageHeader title={'About LBRY'} onBackPressed={() => navigateBack(navigation, drawerStack, popDrawerStack)} />
|
||||||
<ScrollView style={aboutStyle.scrollContainer}>
|
<ScrollView style={aboutStyle.scrollContainer}>
|
||||||
<Text style={aboutStyle.title}>Content Freedom</Text>
|
<Text style={aboutStyle.title}>{__('Content Freedom')}</Text>
|
||||||
<Text style={aboutStyle.paragraph}>
|
<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.
|
'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.'
|
||||||
Users will be able to find a wide selection of videos, music, ebooks and other digital content they are
|
)}
|
||||||
interested in.
|
|
||||||
</Text>
|
</Text>
|
||||||
<View style={aboutStyle.links}>
|
<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/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/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" text={__('Frequently Asked Questions')} />
|
||||||
</View>
|
</View>
|
||||||
<Text style={aboutStyle.socialTitle}>Get Social</Text>
|
<Text style={aboutStyle.socialTitle}>{__('Get Social')}</Text>
|
||||||
<Text style={aboutStyle.paragraph}>
|
<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>
|
</Text>
|
||||||
<View style={aboutStyle.links}>
|
<View style={aboutStyle.links}>
|
||||||
<Link style={aboutStyle.link} href="https://discordapp.com/invite/Z3bERWA" text="Discord" />
|
<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://reddit.com/r/lbry" text="Reddit" />
|
||||||
<Link style={aboutStyle.link} href="https://t.me/lbryofficial" text="Telegram" />
|
<Link style={aboutStyle.link} href="https://t.me/lbryofficial" text="Telegram" />
|
||||||
</View>
|
</View>
|
||||||
<Text style={aboutStyle.releaseInfoTitle}>App info</Text>
|
<Text style={aboutStyle.releaseInfoTitle}>{__('App info')}</Text>
|
||||||
{userEmail && userEmail.trim().length > 0 && (
|
{userEmail && userEmail.trim().length > 0 && (
|
||||||
<View style={aboutStyle.verticalRow}>
|
<View style={aboutStyle.verticalRow}>
|
||||||
<View style={aboutStyle.innerRow}>
|
<View style={aboutStyle.innerRow}>
|
||||||
<View style={aboutStyle.col}>
|
<View style={aboutStyle.col}>
|
||||||
<Text style={aboutStyle.text}>Connected email</Text>
|
<Text style={aboutStyle.text}>{__('Connected email')}</Text>
|
||||||
</View>
|
</View>
|
||||||
<View style={aboutStyle.col}>
|
<View style={aboutStyle.col}>
|
||||||
<Text selectable style={aboutStyle.valueText}>
|
<Text selectable style={aboutStyle.valueText}>
|
||||||
@@ -116,7 +116,7 @@ class AboutPage extends React.PureComponent {
|
|||||||
<Link
|
<Link
|
||||||
style={aboutStyle.listLink}
|
style={aboutStyle.listLink}
|
||||||
href={`http://lbry.com/list/edit/${accessToken}`}
|
href={`http://lbry.com/list/edit/${accessToken}`}
|
||||||
text="Update mailing preferences"
|
text={__('Update mailing preferences')}
|
||||||
/>
|
/>
|
||||||
</View>
|
</View>
|
||||||
</View>
|
</View>
|
||||||
@@ -124,7 +124,7 @@ class AboutPage extends React.PureComponent {
|
|||||||
|
|
||||||
<View style={aboutStyle.row}>
|
<View style={aboutStyle.row}>
|
||||||
<View style={aboutStyle.col}>
|
<View style={aboutStyle.col}>
|
||||||
<Text style={aboutStyle.text}>App version</Text>
|
<Text style={aboutStyle.text}>{__('App version')}</Text>
|
||||||
</View>
|
</View>
|
||||||
<View style={aboutStyle.col}>
|
<View style={aboutStyle.col}>
|
||||||
<Text selectable style={aboutStyle.valueText}>
|
<Text selectable style={aboutStyle.valueText}>
|
||||||
@@ -135,7 +135,7 @@ class AboutPage extends React.PureComponent {
|
|||||||
|
|
||||||
<View style={aboutStyle.row}>
|
<View style={aboutStyle.row}>
|
||||||
<View style={aboutStyle.col}>
|
<View style={aboutStyle.col}>
|
||||||
<Text style={aboutStyle.text}>LBRY SDK</Text>
|
<Text style={aboutStyle.text}>{__('LBRY SDK')}</Text>
|
||||||
</View>
|
</View>
|
||||||
<View style={aboutStyle.col}>
|
<View style={aboutStyle.col}>
|
||||||
<Text selectable style={aboutStyle.valueText}>
|
<Text selectable style={aboutStyle.valueText}>
|
||||||
@@ -146,7 +146,7 @@ class AboutPage extends React.PureComponent {
|
|||||||
|
|
||||||
<View style={aboutStyle.row}>
|
<View style={aboutStyle.row}>
|
||||||
<View style={aboutStyle.col}>
|
<View style={aboutStyle.col}>
|
||||||
<Text style={aboutStyle.text}>Platform</Text>
|
<Text style={aboutStyle.text}>{__('Platform')}</Text>
|
||||||
</View>
|
</View>
|
||||||
<View style={aboutStyle.col}>
|
<View style={aboutStyle.col}>
|
||||||
<Text selectable style={aboutStyle.valueText}>
|
<Text selectable style={aboutStyle.valueText}>
|
||||||
@@ -157,7 +157,7 @@ class AboutPage extends React.PureComponent {
|
|||||||
|
|
||||||
<View style={aboutStyle.row}>
|
<View style={aboutStyle.row}>
|
||||||
<View style={aboutStyle.col}>
|
<View style={aboutStyle.col}>
|
||||||
<Text style={aboutStyle.text}>Installation ID</Text>
|
<Text style={aboutStyle.text}>{__('Installation ID')}</Text>
|
||||||
<Text selectable style={aboutStyle.lineValueText}>
|
<Text selectable style={aboutStyle.lineValueText}>
|
||||||
{this.state.lbryId ? this.state.lbryId : loading}
|
{this.state.lbryId ? this.state.lbryId : loading}
|
||||||
</Text>
|
</Text>
|
||||||
@@ -166,12 +166,12 @@ class AboutPage extends React.PureComponent {
|
|||||||
|
|
||||||
<View style={aboutStyle.row}>
|
<View style={aboutStyle.row}>
|
||||||
<View style={aboutStyle.col}>
|
<View style={aboutStyle.col}>
|
||||||
<Text style={aboutStyle.text}>Logs</Text>
|
<Text style={aboutStyle.text}>{__('Logs')}</Text>
|
||||||
</View>
|
</View>
|
||||||
<View style={aboutStyle.col}>
|
<View style={aboutStyle.col}>
|
||||||
<Link
|
<Link
|
||||||
style={aboutStyle.listLink}
|
style={aboutStyle.listLink}
|
||||||
text="Send log"
|
text={__('Send log')}
|
||||||
onPress={() => {
|
onPress={() => {
|
||||||
if (NativeModules.UtilityModule) {
|
if (NativeModules.UtilityModule) {
|
||||||
NativeModules.UtilityModule.shareLogFile(error => {
|
NativeModules.UtilityModule.shareLogFile(error => {
|
||||||
|
|||||||
@@ -1,5 +1,6 @@
|
|||||||
import { connect } from 'react-redux';
|
import { connect } from 'react-redux';
|
||||||
import { makeSelectClaimForUri, selectMyChannelClaims } from 'lbry-redux';
|
import { doAbandonClaim, doFetchChannelListMine, makeSelectClaimForUri, selectMyChannelClaims } from 'lbry-redux';
|
||||||
|
import { doFetchSubCount, makeSelectSubCountForUri } from 'lbryinc';
|
||||||
import { doPopDrawerStack } from 'redux/actions/drawer';
|
import { doPopDrawerStack } from 'redux/actions/drawer';
|
||||||
import { doSetSortByItem, doSetTimeItem } from 'redux/actions/settings';
|
import { doSetSortByItem, doSetTimeItem } from 'redux/actions/settings';
|
||||||
import { selectDrawerStack } from 'redux/selectors/drawer';
|
import { selectDrawerStack } from 'redux/selectors/drawer';
|
||||||
@@ -11,10 +12,14 @@ const select = (state, props) => ({
|
|||||||
claim: makeSelectClaimForUri(props.uri)(state),
|
claim: makeSelectClaimForUri(props.uri)(state),
|
||||||
drawerStack: selectDrawerStack(state),
|
drawerStack: selectDrawerStack(state),
|
||||||
sortByItem: selectSortByItem(state),
|
sortByItem: selectSortByItem(state),
|
||||||
|
subCount: makeSelectSubCountForUri(props.uri)(state),
|
||||||
timeItem: selectTimeItem(state),
|
timeItem: selectTimeItem(state),
|
||||||
});
|
});
|
||||||
|
|
||||||
const perform = dispatch => ({
|
const perform = dispatch => ({
|
||||||
|
abandonClaim: (txid, nout) => dispatch(doAbandonClaim(txid, nout)),
|
||||||
|
fetchChannelListMine: () => dispatch(doFetchChannelListMine()),
|
||||||
|
fetchSubCount: claimId => dispatch(doFetchSubCount(claimId)),
|
||||||
popDrawerStack: () => dispatch(doPopDrawerStack()),
|
popDrawerStack: () => dispatch(doPopDrawerStack()),
|
||||||
setSortByItem: item => dispatch(doSetSortByItem(item)),
|
setSortByItem: item => dispatch(doSetSortByItem(item)),
|
||||||
setTimeItem: item => dispatch(doSetTimeItem(item)),
|
setTimeItem: item => dispatch(doSetTimeItem(item)),
|
||||||
|
|||||||
+70
-24
@@ -13,15 +13,17 @@ import {
|
|||||||
} from 'react-native';
|
} from 'react-native';
|
||||||
import { TabView, SceneMap } from 'react-native-tab-view';
|
import { TabView, SceneMap } from 'react-native-tab-view';
|
||||||
import { normalizeURI } from 'lbry-redux';
|
import { normalizeURI } from 'lbry-redux';
|
||||||
import { navigateBack, getOrderBy } from 'utils/helper';
|
import { navigateBack, getOrderBy, formatLbryUrlForWeb } from 'utils/helper';
|
||||||
import ChannelIconItem from 'component/channelIconItem';
|
import ChannelIconItem from 'component/channelIconItem';
|
||||||
import ClaimList from 'component/claimList';
|
import ClaimList from 'component/claimList';
|
||||||
import Colors from 'styles/colors';
|
import Colors from 'styles/colors';
|
||||||
import Constants from 'constants'; // eslint-disable-line node/no-deprecated-api
|
import Constants from 'constants'; // eslint-disable-line node/no-deprecated-api
|
||||||
import Button from 'component/button';
|
import Button from 'component/button';
|
||||||
|
import EmptyStateView from 'component/emptyStateView';
|
||||||
import Icon from 'react-native-vector-icons/FontAwesome5';
|
import Icon from 'react-native-vector-icons/FontAwesome5';
|
||||||
import Link from 'component/link';
|
import Link from 'component/link';
|
||||||
import ModalPicker from 'component/modalPicker';
|
import ModalPicker from 'component/modalPicker';
|
||||||
|
import ModalTipView from 'component/modalTipView';
|
||||||
import PageHeader from 'component/pageHeader';
|
import PageHeader from 'component/pageHeader';
|
||||||
import SubscribeButton from 'component/subscribeButton';
|
import SubscribeButton from 'component/subscribeButton';
|
||||||
import SubscribeNotificationButton from 'component/subscribeNotificationButton';
|
import SubscribeNotificationButton from 'component/subscribeNotificationButton';
|
||||||
@@ -35,8 +37,10 @@ class ChannelPage extends React.PureComponent {
|
|||||||
autoStyle: null,
|
autoStyle: null,
|
||||||
showSortPicker: false,
|
showSortPicker: false,
|
||||||
showTimePicker: false,
|
showTimePicker: false,
|
||||||
orderBy: Constants.DEFAULT_ORDER_BY,
|
showTipView: false,
|
||||||
|
orderBy: ['release_time'], // sort by new by default
|
||||||
activeTab: Constants.CONTENT_TAB,
|
activeTab: Constants.CONTENT_TAB,
|
||||||
|
currentSortByItem: Constants.CLAIM_SEARCH_SORT_BY_ITEMS[1], // should always default to sorting channel pages by new
|
||||||
};
|
};
|
||||||
|
|
||||||
componentWillMount() {
|
componentWillMount() {
|
||||||
@@ -47,13 +51,17 @@ class ChannelPage extends React.PureComponent {
|
|||||||
}
|
}
|
||||||
|
|
||||||
componentDidMount() {
|
componentDidMount() {
|
||||||
|
const { claim, fetchChannelListMine, fetchSubCount } = this.props;
|
||||||
NativeModules.Firebase.setCurrentScreen('Channel');
|
NativeModules.Firebase.setCurrentScreen('Channel');
|
||||||
|
fetchChannelListMine();
|
||||||
|
if (claim) {
|
||||||
|
fetchSubCount(claim.claim_id);
|
||||||
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
handleSortByItemSelected = item => {
|
handleSortByItemSelected = item => {
|
||||||
const { setSortByItem } = this.props;
|
// sort by specific only to this component state
|
||||||
setSortByItem(item);
|
this.setState({ currentSortByItem: item, orderBy: getOrderBy(item), showSortPicker: false });
|
||||||
this.setState({ orderBy: getOrderBy(item), showSortPicker: false });
|
|
||||||
};
|
};
|
||||||
|
|
||||||
handleTimeItemSelected = item => {
|
handleTimeItemSelected = item => {
|
||||||
@@ -63,19 +71,20 @@ class ChannelPage extends React.PureComponent {
|
|||||||
};
|
};
|
||||||
|
|
||||||
listHeader = () => {
|
listHeader = () => {
|
||||||
const { sortByItem, timeItem } = this.props;
|
const { timeItem } = this.props;
|
||||||
|
const { currentSortByItem } = this.state;
|
||||||
|
|
||||||
return (
|
return (
|
||||||
<View style={channelPageStyle.listHeader}>
|
<View style={channelPageStyle.listHeader}>
|
||||||
<View style={discoverStyle.pickerRow}>
|
<View style={discoverStyle.pickerRow}>
|
||||||
<View style={discoverStyle.leftPickerRow}>
|
<View style={discoverStyle.leftPickerRow}>
|
||||||
<TouchableOpacity style={discoverStyle.tagSortBy} onPress={() => this.setState({ showSortPicker: true })}>
|
<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} />
|
<Icon style={discoverStyle.tagSortIcon} name={'sort-down'} size={14} />
|
||||||
</TouchableOpacity>
|
</TouchableOpacity>
|
||||||
{Constants.SORT_BY_TOP === sortByItem.name && (
|
{Constants.SORT_BY_TOP === currentSortByItem.name && (
|
||||||
<TouchableOpacity style={discoverStyle.tagTime} onPress={() => this.setState({ showTimePicker: true })}>
|
<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} />
|
<Icon style={discoverStyle.tagSortIcon} name={'sort-down'} size={14} />
|
||||||
</TouchableOpacity>
|
</TouchableOpacity>
|
||||||
)}
|
)}
|
||||||
@@ -118,7 +127,7 @@ class ChannelPage extends React.PureComponent {
|
|||||||
return (
|
return (
|
||||||
<View style={channelPageStyle.aboutTab}>
|
<View style={channelPageStyle.aboutTab}>
|
||||||
<View style={channelPageStyle.busyContainer}>
|
<View style={channelPageStyle.busyContainer}>
|
||||||
<Text style={channelPageStyle.infoText}>No information to display.</Text>
|
<Text style={channelPageStyle.infoText}>{__('No information to display.')}</Text>
|
||||||
</View>
|
</View>
|
||||||
</View>
|
</View>
|
||||||
);
|
);
|
||||||
@@ -128,23 +137,21 @@ class ChannelPage extends React.PureComponent {
|
|||||||
return (
|
return (
|
||||||
<View style={channelPageStyle.aboutTab}>
|
<View style={channelPageStyle.aboutTab}>
|
||||||
{!websiteUrl && !email && !description && (
|
{!websiteUrl && !email && !description && (
|
||||||
<View style={channelPageStyle.busyContainer}>
|
<EmptyStateView message={__("There's nothing here yet.\nPlease check back later.")} />
|
||||||
<Text style={channelPageStyle.infoText}>Nothing here yet. Please check back later.</Text>
|
|
||||||
</View>
|
|
||||||
)}
|
)}
|
||||||
|
|
||||||
{(websiteUrl || email || description) && (
|
{(websiteUrl || email || description) && (
|
||||||
<ScrollView style={channelPageStyle.aboutScroll} contentContainerStyle={channelPageStyle.aboutScrollContent}>
|
<ScrollView style={channelPageStyle.aboutScroll} contentContainerStyle={channelPageStyle.aboutScrollContent}>
|
||||||
{websiteUrl && websiteUrl.trim().length > 0 && (
|
{websiteUrl && websiteUrl.trim().length > 0 && (
|
||||||
<View style={channelPageStyle.aboutItem}>
|
<View style={channelPageStyle.aboutItem}>
|
||||||
<Text style={channelPageStyle.aboutTitle}>Website</Text>
|
<Text style={channelPageStyle.aboutTitle}>{__('Website')}</Text>
|
||||||
<Link style={channelPageStyle.aboutText} text={websiteUrl} href={websiteUrl} />
|
<Link style={channelPageStyle.aboutText} text={websiteUrl} href={websiteUrl} />
|
||||||
</View>
|
</View>
|
||||||
)}
|
)}
|
||||||
|
|
||||||
{email && email.trim().length > 0 && (
|
{email && email.trim().length > 0 && (
|
||||||
<View style={channelPageStyle.aboutItem}>
|
<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}`} />
|
<Link style={channelPageStyle.aboutText} text={email} href={`mailto:${email}`} />
|
||||||
</View>
|
</View>
|
||||||
)}
|
)}
|
||||||
@@ -171,6 +178,19 @@ class ChannelPage extends React.PureComponent {
|
|||||||
}
|
}
|
||||||
};
|
};
|
||||||
|
|
||||||
|
onTipPressed = () => {
|
||||||
|
this.setState({ showTipView: true });
|
||||||
|
};
|
||||||
|
|
||||||
|
onSharePressed = () => {
|
||||||
|
const { claim } = this.props;
|
||||||
|
if (claim) {
|
||||||
|
const { canonical_url: canonicalUrl, short_url: shortUrl, permanent_url: permanentUrl } = claim;
|
||||||
|
const url = Constants.SHARE_BASE_URL + formatLbryUrlForWeb(canonicalUrl || shortUrl || permanentUrl);
|
||||||
|
NativeModules.UtilityModule.shareUrl(url);
|
||||||
|
}
|
||||||
|
};
|
||||||
|
|
||||||
onDeletePressed = () => {
|
onDeletePressed = () => {
|
||||||
const { abandonClaim, claim, navigation } = this.props;
|
const { abandonClaim, claim, navigation } = this.props;
|
||||||
if (claim) {
|
if (claim) {
|
||||||
@@ -196,9 +216,9 @@ class ChannelPage extends React.PureComponent {
|
|||||||
};
|
};
|
||||||
|
|
||||||
render() {
|
render() {
|
||||||
const { channels, claim, navigation, uri, drawerStack, popDrawerStack, sortByItem, timeItem } = this.props;
|
const { channels, claim, navigation, uri, drawerStack, popDrawerStack, subCount, timeItem } = this.props;
|
||||||
const { name, permanent_url: permanentUrl } = claim;
|
const { name, permanent_url: permanentUrl } = claim;
|
||||||
const { autoStyle, showSortPicker, showTimePicker } = this.state;
|
const { autoStyle, currentSortByItem, showSortPicker, showTimePicker, showTipView } = this.state;
|
||||||
const ownedChannel = channels ? channels.map(channel => channel.permanent_url).includes(permanentUrl) : false;
|
const ownedChannel = channels ? channels.map(channel => channel.permanent_url).includes(permanentUrl) : false;
|
||||||
|
|
||||||
let thumbnailUrl,
|
let thumbnailUrl,
|
||||||
@@ -241,6 +261,10 @@ class ChannelPage extends React.PureComponent {
|
|||||||
|
|
||||||
<View style={channelPageStyle.channelHeader}>
|
<View style={channelPageStyle.channelHeader}>
|
||||||
<Text style={channelPageStyle.channelName}>{title && title.trim().length > 0 ? title : name}</Text>
|
<Text style={channelPageStyle.channelName}>{title && title.trim().length > 0 ? title : name}</Text>
|
||||||
|
<Text style={[channelPageStyle.followerCount, subCount >= 1 ? channelPageStyle.followerCountBg : null]}>
|
||||||
|
{subCount === 1 && __('%follower% follower', { follower: subCount })}
|
||||||
|
{subCount > 1 && __('%follower% followers', { follower: subCount })}
|
||||||
|
</Text>
|
||||||
</View>
|
</View>
|
||||||
|
|
||||||
<View style={[channelPageStyle.avatarImageContainer, autoStyle]}>
|
<View style={[channelPageStyle.avatarImageContainer, autoStyle]}>
|
||||||
@@ -260,21 +284,33 @@ class ChannelPage extends React.PureComponent {
|
|||||||
style={channelPageStyle.actionButton}
|
style={channelPageStyle.actionButton}
|
||||||
theme={'light'}
|
theme={'light'}
|
||||||
icon={'edit'}
|
icon={'edit'}
|
||||||
text={'Edit'}
|
text={__('Edit')}
|
||||||
onPress={this.onEditPressed}
|
onPress={this.onEditPressed}
|
||||||
/>
|
/>
|
||||||
)}
|
)}
|
||||||
{ownedChannel && (
|
{ownedChannel && (
|
||||||
<Button
|
<Button
|
||||||
style={channelPageStyle.deleteButton}
|
style={[channelPageStyle.actionButton, channelPageStyle.deleteButton]}
|
||||||
theme={'light'}
|
theme={'light'}
|
||||||
icon={'trash-alt'}
|
icon={'trash-alt'}
|
||||||
text={'Delete'}
|
text={__('Delete')}
|
||||||
onPress={this.onDeletePressed}
|
onPress={this.onDeletePressed}
|
||||||
/>
|
/>
|
||||||
)}
|
)}
|
||||||
|
<Button
|
||||||
|
style={[channelPageStyle.actionButton, channelPageStyle.shareButton]}
|
||||||
|
theme={'light'}
|
||||||
|
icon={'share-alt'}
|
||||||
|
onPress={this.onSharePressed}
|
||||||
|
/>
|
||||||
|
<Button
|
||||||
|
style={[channelPageStyle.actionButton, channelPageStyle.tipButton]}
|
||||||
|
theme={'light'}
|
||||||
|
icon={'gift'}
|
||||||
|
onPress={this.onTipPressed}
|
||||||
|
/>
|
||||||
{!ownedChannel && <SubscribeButton style={channelPageStyle.subscribeButton} uri={fullUri} name={name} />}
|
{!ownedChannel && <SubscribeButton style={channelPageStyle.subscribeButton} uri={fullUri} name={name} />}
|
||||||
{!ownedChannel && (
|
{false && !ownedChannel && (
|
||||||
<SubscribeNotificationButton
|
<SubscribeNotificationButton
|
||||||
style={[channelPageStyle.subscribeButton, channelPageStyle.bellButton]}
|
style={[channelPageStyle.subscribeButton, channelPageStyle.bellButton]}
|
||||||
uri={fullUri}
|
uri={fullUri}
|
||||||
@@ -289,14 +325,14 @@ class ChannelPage extends React.PureComponent {
|
|||||||
style={channelPageStyle.tab}
|
style={channelPageStyle.tab}
|
||||||
onPress={() => this.setState({ activeTab: Constants.CONTENT_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} />}
|
{Constants.CONTENT_TAB === this.state.activeTab && <View style={channelPageStyle.activeTabHint} />}
|
||||||
</TouchableOpacity>
|
</TouchableOpacity>
|
||||||
<TouchableOpacity
|
<TouchableOpacity
|
||||||
style={channelPageStyle.tab}
|
style={channelPageStyle.tab}
|
||||||
onPress={() => this.setState({ activeTab: Constants.ABOUT_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} />}
|
{Constants.ABOUT_TAB === this.state.activeTab && <View style={channelPageStyle.activeTabHint} />}
|
||||||
</TouchableOpacity>
|
</TouchableOpacity>
|
||||||
</View>
|
</View>
|
||||||
@@ -310,7 +346,7 @@ class ChannelPage extends React.PureComponent {
|
|||||||
title={__('Sort content by')}
|
title={__('Sort content by')}
|
||||||
onOverlayPress={() => this.setState({ showSortPicker: false })}
|
onOverlayPress={() => this.setState({ showSortPicker: false })}
|
||||||
onItemSelected={this.handleSortByItemSelected}
|
onItemSelected={this.handleSortByItemSelected}
|
||||||
selectedItem={sortByItem}
|
selectedItem={currentSortByItem}
|
||||||
items={Constants.CLAIM_SEARCH_SORT_BY_ITEMS}
|
items={Constants.CLAIM_SEARCH_SORT_BY_ITEMS}
|
||||||
/>
|
/>
|
||||||
)}
|
)}
|
||||||
@@ -323,6 +359,16 @@ class ChannelPage extends React.PureComponent {
|
|||||||
items={Constants.CLAIM_SEARCH_TIME_ITEMS}
|
items={Constants.CLAIM_SEARCH_TIME_ITEMS}
|
||||||
/>
|
/>
|
||||||
)}
|
)}
|
||||||
|
{showTipView && (
|
||||||
|
<ModalTipView
|
||||||
|
claim={claim}
|
||||||
|
channelName={claim.name}
|
||||||
|
contentName={title}
|
||||||
|
onCancelPress={() => this.setState({ showTipView: false })}
|
||||||
|
onOverlayPress={() => this.setState({ showTipView: false })}
|
||||||
|
onSendTipSuccessful={() => this.setState({ showTipView: false })}
|
||||||
|
/>
|
||||||
|
)}
|
||||||
</View>
|
</View>
|
||||||
);
|
);
|
||||||
}
|
}
|
||||||
|
|||||||
@@ -12,6 +12,7 @@ import {
|
|||||||
doUpdateChannel,
|
doUpdateChannel,
|
||||||
doToast,
|
doToast,
|
||||||
} from 'lbry-redux';
|
} from 'lbry-redux';
|
||||||
|
import { doGetSync } from 'lbryinc';
|
||||||
import { doPushDrawerStack, doPopDrawerStack, doSetPlayerVisible } from 'redux/actions/drawer';
|
import { doPushDrawerStack, doPopDrawerStack, doSetPlayerVisible } from 'redux/actions/drawer';
|
||||||
import { doUpdateChannelFormState, doClearChannelFormState } from 'redux/actions/form';
|
import { doUpdateChannelFormState, doClearChannelFormState } from 'redux/actions/form';
|
||||||
import { selectDrawerStack } from 'redux/selectors/drawer';
|
import { selectDrawerStack } from 'redux/selectors/drawer';
|
||||||
@@ -37,6 +38,7 @@ const perform = dispatch => ({
|
|||||||
clearChannelFormState: () => dispatch(doClearChannelFormState()),
|
clearChannelFormState: () => dispatch(doClearChannelFormState()),
|
||||||
createChannel: (name, amount, optionalParams) => dispatch(doCreateChannel(name, amount, optionalParams)),
|
createChannel: (name, amount, optionalParams) => dispatch(doCreateChannel(name, amount, optionalParams)),
|
||||||
fetchChannelListMine: () => dispatch(doFetchChannelListMine()),
|
fetchChannelListMine: () => dispatch(doFetchChannelListMine()),
|
||||||
|
getSync: (password, callback) => dispatch(doGetSync(password, callback)),
|
||||||
updateChannel: params => dispatch(doUpdateChannel(params)),
|
updateChannel: params => dispatch(doUpdateChannel(params)),
|
||||||
updateChannelFormState: data => dispatch(doUpdateChannelFormState(data)),
|
updateChannelFormState: data => dispatch(doUpdateChannelFormState(data)),
|
||||||
pushDrawerStack: (routeName, params) => dispatch(doPushDrawerStack(routeName, params)),
|
pushDrawerStack: (routeName, params) => dispatch(doPushDrawerStack(routeName, params)),
|
||||||
|
|||||||
+175
-92
@@ -1,5 +1,5 @@
|
|||||||
import React from 'react';
|
import React from 'react';
|
||||||
import { CLAIM_VALUES, isURIValid, regexInvalidURI } from 'lbry-redux';
|
import { CLAIM_VALUES, Lbry, formatCredits, isNameValid, regexInvalidURI } from 'lbry-redux';
|
||||||
import {
|
import {
|
||||||
ActivityIndicator,
|
ActivityIndicator,
|
||||||
Alert,
|
Alert,
|
||||||
@@ -14,11 +14,14 @@ import {
|
|||||||
TouchableOpacity,
|
TouchableOpacity,
|
||||||
View,
|
View,
|
||||||
} from 'react-native';
|
} from 'react-native';
|
||||||
import { navigateToUri, uploadImageAsset } from 'utils/helper';
|
import { navigateToUri, logPublish, uploadImageAsset } from 'utils/helper';
|
||||||
import Button from 'component/button';
|
import Button from 'component/button';
|
||||||
import ChannelIconItem from 'component/channelIconItem';
|
import ChannelIconItem from 'component/channelIconItem';
|
||||||
|
import ChannelRewardsDriver from 'component/channelRewardsDriver';
|
||||||
import Colors from 'styles/colors';
|
import Colors from 'styles/colors';
|
||||||
import Constants from 'constants'; // eslint-disable-line node/no-deprecated-api
|
import Constants from 'constants'; // eslint-disable-line node/no-deprecated-api
|
||||||
|
import EmptyStateView from 'component/emptyStateView';
|
||||||
|
import FastImage from 'react-native-fast-image';
|
||||||
import FloatingWalletBalance from 'component/floatingWalletBalance';
|
import FloatingWalletBalance from 'component/floatingWalletBalance';
|
||||||
import Icon from 'react-native-vector-icons/FontAwesome5';
|
import Icon from 'react-native-vector-icons/FontAwesome5';
|
||||||
import Link from 'component/link';
|
import Link from 'component/link';
|
||||||
@@ -30,10 +33,13 @@ import channelIconStyle from 'styles/channelIcon';
|
|||||||
import seedrandom from 'seedrandom';
|
import seedrandom from 'seedrandom';
|
||||||
|
|
||||||
export default class ChannelCreator extends React.PureComponent {
|
export default class ChannelCreator extends React.PureComponent {
|
||||||
|
scrollView = null;
|
||||||
|
|
||||||
state = {
|
state = {
|
||||||
autoStyle: null,
|
autoStyle: null,
|
||||||
canSave: false,
|
canSave: true,
|
||||||
claimId: null,
|
claimId: null,
|
||||||
|
creditsInputFocused: false,
|
||||||
currentSelectedValue: Constants.ITEM_ANONYMOUS,
|
currentSelectedValue: Constants.ITEM_ANONYMOUS,
|
||||||
currentPhase: null,
|
currentPhase: null,
|
||||||
displayName: null,
|
displayName: null,
|
||||||
@@ -100,11 +106,13 @@ export default class ChannelCreator extends React.PureComponent {
|
|||||||
generateAutoStyles = size => {
|
generateAutoStyles = size => {
|
||||||
const { channels = [] } = this.props;
|
const { channels = [] } = this.props;
|
||||||
const autoStyles = [];
|
const autoStyles = [];
|
||||||
for (let i = 0; i < size && i < channels.length; i++) {
|
if (channels) {
|
||||||
// seed generator using the claim_id
|
for (let i = 0; i < size && i < channels.length; i++) {
|
||||||
const rng = seedrandom(channels[i].permanent_url); // is this efficient?
|
// seed generator using the claim_id
|
||||||
const index = Math.floor(rng.quick() * ChannelIconItem.AUTO_THUMB_STYLES.length);
|
const rng = seedrandom(channels[i].permanent_url); // is this efficient?
|
||||||
autoStyles.push(ChannelIconItem.AUTO_THUMB_STYLES[index]);
|
const index = Math.floor(rng.quick() * ChannelIconItem.AUTO_THUMB_STYLES.length);
|
||||||
|
autoStyles.push(ChannelIconItem.AUTO_THUMB_STYLES[index]);
|
||||||
|
}
|
||||||
}
|
}
|
||||||
return autoStyles;
|
return autoStyles;
|
||||||
};
|
};
|
||||||
@@ -157,9 +165,6 @@ export default class ChannelCreator extends React.PureComponent {
|
|||||||
if (!fetchingChannels) {
|
if (!fetchingChannels) {
|
||||||
fetchChannelListMine();
|
fetchChannelListMine();
|
||||||
}
|
}
|
||||||
if (balance > 0.1) {
|
|
||||||
this.setState({ canSave: true });
|
|
||||||
}
|
|
||||||
|
|
||||||
DeviceEventEmitter.addListener('onDocumentPickerFilePicked', this.onFilePicked);
|
DeviceEventEmitter.addListener('onDocumentPickerFilePicked', this.onFilePicked);
|
||||||
DeviceEventEmitter.addListener('onDocumentPickerCanceled', this.onPickerCanceled);
|
DeviceEventEmitter.addListener('onDocumentPickerCanceled', this.onPickerCanceled);
|
||||||
@@ -175,10 +180,8 @@ export default class ChannelCreator extends React.PureComponent {
|
|||||||
|
|
||||||
if (!isEditMode && hasFormState) {
|
if (!isEditMode && hasFormState) {
|
||||||
this.loadPendingFormState();
|
this.loadPendingFormState();
|
||||||
this.setState({ currentPhase: Constants.PHASE_CREATE });
|
|
||||||
} else {
|
|
||||||
this.setState({ currentPhase: Constants.PHASE_LIST });
|
|
||||||
}
|
}
|
||||||
|
this.setState({ currentPhase: isEditMode || hasFormState ? Constants.PHASE_CREATE : Constants.PHASE_LIST });
|
||||||
});
|
});
|
||||||
};
|
};
|
||||||
|
|
||||||
@@ -223,9 +226,9 @@ export default class ChannelCreator extends React.PureComponent {
|
|||||||
error => {
|
error => {
|
||||||
notify({ message: `The image could not be uploaded: ${error}` });
|
notify({ message: `The image could not be uploaded: ${error}` });
|
||||||
this.setState({ uploadingImage: false });
|
this.setState({ uploadingImage: false });
|
||||||
}
|
},
|
||||||
);
|
);
|
||||||
}
|
},
|
||||||
);
|
);
|
||||||
} else {
|
} else {
|
||||||
// could not determine the file path
|
// could not determine the file path
|
||||||
@@ -240,7 +243,7 @@ export default class ChannelCreator extends React.PureComponent {
|
|||||||
componentDidUpdate() {
|
componentDidUpdate() {
|
||||||
const { channels = [] } = this.props;
|
const { channels = [] } = this.props;
|
||||||
const { editChannelUrl } = this.state;
|
const { editChannelUrl } = this.state;
|
||||||
if (channels.length > 0) {
|
if (channels && channels.length > 0) {
|
||||||
if (this.state.autoStyles.length !== channels.length) {
|
if (this.state.autoStyles.length !== channels.length) {
|
||||||
this.setState({
|
this.setState({
|
||||||
autoStyles: this.generateAutoStyles(channels.length),
|
autoStyles: this.generateAutoStyles(channels.length),
|
||||||
@@ -337,7 +340,7 @@ export default class ChannelCreator extends React.PureComponent {
|
|||||||
newChannelName = newChannelName.slice(1);
|
newChannelName = newChannelName.slice(1);
|
||||||
}
|
}
|
||||||
|
|
||||||
if (newChannelName.trim().length > 0 && !isURIValid(newChannelName)) {
|
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)) {
|
} 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.';
|
||||||
@@ -374,7 +377,15 @@ export default class ChannelCreator extends React.PureComponent {
|
|||||||
};
|
};
|
||||||
|
|
||||||
handleCreateChannelClick = () => {
|
handleCreateChannelClick = () => {
|
||||||
const { balance, clearChannelFormState, createChannel, onChannelChange, notify, updateChannel } = this.props;
|
const {
|
||||||
|
balance,
|
||||||
|
clearChannelFormState,
|
||||||
|
createChannel,
|
||||||
|
onChannelChange,
|
||||||
|
getSync,
|
||||||
|
notify,
|
||||||
|
updateChannel,
|
||||||
|
} = this.props;
|
||||||
const {
|
const {
|
||||||
claimId,
|
claimId,
|
||||||
coverImageUrl,
|
coverImageUrl,
|
||||||
@@ -390,7 +401,17 @@ export default class ChannelCreator extends React.PureComponent {
|
|||||||
website,
|
website,
|
||||||
} = this.state;
|
} = this.state;
|
||||||
|
|
||||||
if (newChannelName.trim().length === 0 || !isURIValid(newChannelName.substr(1), false)) {
|
if (balance < Constants.MINIMUM_TRANSACTION_BALANCE) {
|
||||||
|
notify({
|
||||||
|
message: 'Creating a channel requires credits. Press the blue bar to get some for free.',
|
||||||
|
});
|
||||||
|
if (this.scrollView) {
|
||||||
|
this.scrollView.scrollTo({ x: 0, y: 0, animated: true });
|
||||||
|
}
|
||||||
|
return;
|
||||||
|
}
|
||||||
|
|
||||||
|
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;
|
return;
|
||||||
}
|
}
|
||||||
@@ -421,7 +442,7 @@ export default class ChannelCreator extends React.PureComponent {
|
|||||||
createChannelError: undefined,
|
createChannelError: undefined,
|
||||||
});
|
});
|
||||||
|
|
||||||
const success = () => {
|
const success = channelClaim => {
|
||||||
this.setState({
|
this.setState({
|
||||||
creatingChannel: false,
|
creatingChannel: false,
|
||||||
addingChannel: false,
|
addingChannel: false,
|
||||||
@@ -437,6 +458,8 @@ export default class ChannelCreator extends React.PureComponent {
|
|||||||
clearChannelFormState();
|
clearChannelFormState();
|
||||||
notify({ message: 'The channel was successfully created.' });
|
notify({ message: 'The channel was successfully created.' });
|
||||||
this.showChannelList();
|
this.showChannelList();
|
||||||
|
|
||||||
|
logPublish(channelClaim);
|
||||||
};
|
};
|
||||||
|
|
||||||
const failure = () => {
|
const failure = () => {
|
||||||
@@ -454,8 +477,8 @@ export default class ChannelCreator extends React.PureComponent {
|
|||||||
return { name: tag };
|
return { name: tag };
|
||||||
}),
|
}),
|
||||||
website,
|
website,
|
||||||
cover: coverImageUrl,
|
coverUrl: coverImageUrl,
|
||||||
thumbnail: thumbnailUrl,
|
thumbnailUrl: thumbnailUrl,
|
||||||
};
|
};
|
||||||
|
|
||||||
if (this.state.editMode) {
|
if (this.state.editMode) {
|
||||||
@@ -467,24 +490,26 @@ export default class ChannelCreator extends React.PureComponent {
|
|||||||
claim_id: claimId,
|
claim_id: claimId,
|
||||||
amount: newChannelBid,
|
amount: newChannelBid,
|
||||||
},
|
},
|
||||||
optionalParams
|
optionalParams,
|
||||||
);
|
);
|
||||||
this.setState({ updateChannelStarted: true }, () => updateChannel(params));
|
this.setState({ updateChannelStarted: true }, () => updateChannel(params));
|
||||||
} else {
|
} else {
|
||||||
this.setState({ creatingChannel: true }, () =>
|
this.setState({ creatingChannel: true }, () =>
|
||||||
createChannel(channelName, newChannelBid, optionalParams).then(success, failure)
|
createChannel(channelName, newChannelBid, optionalParams).then(success, failure),
|
||||||
);
|
);
|
||||||
}
|
}
|
||||||
};
|
};
|
||||||
|
|
||||||
channelExists = name => {
|
channelExists = name => {
|
||||||
const { channels = [] } = this.props;
|
const { channels = [] } = this.props;
|
||||||
for (let channel of channels) {
|
if (channels) {
|
||||||
if (
|
for (let channel of channels) {
|
||||||
name.toLowerCase() === channel.name.toLowerCase() ||
|
if (
|
||||||
`@${name}`.toLowerCase() === channel.name.toLowerCase()
|
name.toLowerCase() === channel.name.toLowerCase() ||
|
||||||
) {
|
`@${name}`.toLowerCase() === channel.name.toLowerCase()
|
||||||
return true;
|
) {
|
||||||
|
return true;
|
||||||
|
}
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
@@ -503,7 +528,7 @@ export default class ChannelCreator extends React.PureComponent {
|
|||||||
avatarImagePickerOpen: false,
|
avatarImagePickerOpen: false,
|
||||||
coverImagePickerOpen: true,
|
coverImagePickerOpen: true,
|
||||||
},
|
},
|
||||||
() => NativeModules.UtilityModule.openDocumentPicker('image/*')
|
() => this.checkStoragePermission(),
|
||||||
);
|
);
|
||||||
};
|
};
|
||||||
|
|
||||||
@@ -519,7 +544,7 @@ export default class ChannelCreator extends React.PureComponent {
|
|||||||
avatarImagePickerOpen: true,
|
avatarImagePickerOpen: true,
|
||||||
coverImagePickerOpen: false,
|
coverImagePickerOpen: false,
|
||||||
},
|
},
|
||||||
() => NativeModules.UtilityModule.openDocumentPicker('image/*')
|
() => this.checkStoragePermission(),
|
||||||
);
|
);
|
||||||
};
|
};
|
||||||
|
|
||||||
@@ -534,15 +559,17 @@ export default class ChannelCreator extends React.PureComponent {
|
|||||||
};
|
};
|
||||||
|
|
||||||
showChannelList = () => {
|
showChannelList = () => {
|
||||||
const { popDrawerStack } = this.props;
|
const { drawerStack, popDrawerStack } = this.props;
|
||||||
popDrawerStack();
|
if (drawerStack[drawerStack.length - 1].route === Constants.DRAWER_ROUTE_CHANNEL_CREATOR_FORM) {
|
||||||
this.resetChannelCreator();
|
popDrawerStack();
|
||||||
|
}
|
||||||
this.setState({ currentPhase: Constants.PHASE_LIST });
|
this.setState({ currentPhase: Constants.PHASE_LIST });
|
||||||
|
this.resetChannelCreator();
|
||||||
};
|
};
|
||||||
|
|
||||||
resetChannelCreator = () => {
|
resetChannelCreator = () => {
|
||||||
this.setState({
|
this.setState({
|
||||||
canSave: false,
|
canSave: true,
|
||||||
claimId: null,
|
claimId: null,
|
||||||
editMode: false,
|
editMode: false,
|
||||||
displayName: null,
|
displayName: null,
|
||||||
@@ -556,8 +583,8 @@ export default class ChannelCreator extends React.PureComponent {
|
|||||||
newChannelBidError: '',
|
newChannelBidError: '',
|
||||||
createChannelError: undefined,
|
createChannelError: undefined,
|
||||||
showCreateChannel: false,
|
showCreateChannel: false,
|
||||||
thumbnailUrl: null,
|
thumbnailUrl: '',
|
||||||
coverImageUrl: null,
|
coverImageUrl: '',
|
||||||
avatarImagePickerOpen: false,
|
avatarImagePickerOpen: false,
|
||||||
coverImagePickerOpen: false,
|
coverImagePickerOpen: false,
|
||||||
|
|
||||||
@@ -599,15 +626,17 @@ export default class ChannelCreator extends React.PureComponent {
|
|||||||
};
|
};
|
||||||
|
|
||||||
prepareEdit = channel => {
|
prepareEdit = channel => {
|
||||||
const { pushDrawerStack } = this.props;
|
const { balance, pushDrawerStack } = this.props;
|
||||||
const { value } = channel;
|
const { value } = channel;
|
||||||
|
|
||||||
pushDrawerStack(Constants.DRAWER_ROUTE_CHANNEL_CREATOR_FORM);
|
pushDrawerStack(Constants.DRAWER_ROUTE_CHANNEL_CREATOR_FORM);
|
||||||
this.setState({
|
this.setState({
|
||||||
|
canSave: true,
|
||||||
claimId: channel.claim_id,
|
claimId: channel.claim_id,
|
||||||
currentPhase: Constants.PHASE_CREATE,
|
currentPhase: Constants.PHASE_CREATE,
|
||||||
|
displayName: value && value.title ? value.title : channel.name.substring(1),
|
||||||
editMode: true,
|
editMode: true,
|
||||||
coverImageUrl: value && value.cover ? value.cover.url : null,
|
coverImageUrl: value && value.cover ? value.cover.url : '',
|
||||||
currentChannelName: channel.name.substring(1),
|
currentChannelName: channel.name.substring(1),
|
||||||
newChannelName: channel.name.substring(1),
|
newChannelName: channel.name.substring(1),
|
||||||
newChannelTitle: value ? value.title : null,
|
newChannelTitle: value ? value.title : null,
|
||||||
@@ -616,7 +645,7 @@ export default class ChannelCreator extends React.PureComponent {
|
|||||||
email: value ? value.email : null,
|
email: value ? value.email : null,
|
||||||
website: value ? value.website_url : null,
|
website: value ? value.website_url : null,
|
||||||
tags: value && value.tags ? value.tags : [],
|
tags: value && value.tags ? value.tags : [],
|
||||||
thumbnailUrl: value && value.thumbnail ? value.thumbnail.url : null,
|
thumbnailUrl: value && value.thumbnail ? value.thumbnail.url : '',
|
||||||
showOptionalFields: value && (value.description || value.email || value.website_url || value.tags),
|
showOptionalFields: value && (value.description || value.email || value.website_url || value.tags),
|
||||||
});
|
});
|
||||||
};
|
};
|
||||||
@@ -645,7 +674,7 @@ export default class ChannelCreator extends React.PureComponent {
|
|||||||
},
|
},
|
||||||
},
|
},
|
||||||
],
|
],
|
||||||
{ cancelable: true }
|
{ cancelable: true },
|
||||||
);
|
);
|
||||||
};
|
};
|
||||||
|
|
||||||
@@ -721,8 +750,44 @@ export default class ChannelCreator extends React.PureComponent {
|
|||||||
this.addOrRemoveItem(channel);
|
this.addOrRemoveItem(channel);
|
||||||
};
|
};
|
||||||
|
|
||||||
|
checkStoragePermission = () => {
|
||||||
|
// check if we the permission to write to external storage has been granted
|
||||||
|
NativeModules.UtilityModule.canReadWriteStorage().then(canReadWrite => {
|
||||||
|
if (!canReadWrite) {
|
||||||
|
// request permission
|
||||||
|
NativeModules.UtilityModule.requestStoragePermission();
|
||||||
|
} else {
|
||||||
|
NativeModules.UtilityModule.openDocumentPicker('image/*');
|
||||||
|
}
|
||||||
|
});
|
||||||
|
};
|
||||||
|
|
||||||
|
handleStoragePermissionGranted = () => {
|
||||||
|
// update the configured download folder
|
||||||
|
NativeModules.UtilityModule.getDownloadDirectory().then(downloadDirectory => {
|
||||||
|
Lbry.settings_set({
|
||||||
|
key: 'download_dir',
|
||||||
|
value: downloadDirectory,
|
||||||
|
})
|
||||||
|
.then(() => {})
|
||||||
|
.catch(() => {});
|
||||||
|
});
|
||||||
|
|
||||||
|
// open picker for images
|
||||||
|
NativeModules.UtilityModule.openDocumentPicker('image/*');
|
||||||
|
};
|
||||||
|
|
||||||
|
handleStoragePermissionRefused = () => {
|
||||||
|
const { notify } = this.props;
|
||||||
|
notify({
|
||||||
|
message: __('Pictures from your device cannot be used because the permission to read storage was not granted.'),
|
||||||
|
isError: true,
|
||||||
|
});
|
||||||
|
this.setState({ avatarImagePickerOpen: false, coverImagePickerOpen: false });
|
||||||
|
};
|
||||||
|
|
||||||
render() {
|
render() {
|
||||||
const { abandoningClaimIds, fetchingChannels, updatingChannel, channels = [], navigation } = this.props;
|
const { abandoningClaimIds, balance, fetchingChannels, updatingChannel, channels = [], navigation } = this.props;
|
||||||
const {
|
const {
|
||||||
autoStyle,
|
autoStyle,
|
||||||
autoStyles,
|
autoStyles,
|
||||||
@@ -744,6 +809,8 @@ export default class ChannelCreator extends React.PureComponent {
|
|||||||
uploadingImage,
|
uploadingImage,
|
||||||
} = this.state;
|
} = this.state;
|
||||||
|
|
||||||
|
const hasChannels = channels && channels.length > 0;
|
||||||
|
|
||||||
return (
|
return (
|
||||||
<View style={channelCreatorStyle.container}>
|
<View style={channelCreatorStyle.container}>
|
||||||
<UriBar
|
<UriBar
|
||||||
@@ -756,34 +823,34 @@ export default class ChannelCreator extends React.PureComponent {
|
|||||||
onExitSelectionMode={this.onExitSelectionMode}
|
onExitSelectionMode={this.onExitSelectionMode}
|
||||||
/>
|
/>
|
||||||
|
|
||||||
|
{fetchingChannels && (
|
||||||
|
<View style={channelCreatorStyle.loading}>
|
||||||
|
<ActivityIndicator size={'large'} color={Colors.NextLbryGreen} />
|
||||||
|
</View>
|
||||||
|
)}
|
||||||
|
|
||||||
|
{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')}
|
||||||
|
onButtonPress={this.handleNewChannelPress}
|
||||||
|
/>
|
||||||
|
)}
|
||||||
|
|
||||||
{currentPhase === Constants.PHASE_LIST && (
|
{currentPhase === Constants.PHASE_LIST && (
|
||||||
<FlatList
|
<FlatList
|
||||||
extraData={this.state}
|
extraData={this.state}
|
||||||
ListHeaderComponent={
|
ListFooterComponent={
|
||||||
fetchingChannels ? (
|
!channels || channels.length === 0 ? null : (
|
||||||
<View style={channelCreatorStyle.listHeader}>
|
<View style={channelCreatorStyle.listFooter}>
|
||||||
<ActivityIndicator size={'small'} color={Colors.NextLbryGreen} />
|
<Button
|
||||||
</View>
|
style={channelCreatorStyle.createChannelButton}
|
||||||
) : null
|
text={__('Create a channel')}
|
||||||
}
|
onPress={this.handleNewChannelPress}
|
||||||
ListEmptyComponent={
|
/>
|
||||||
fetchingChannels ? null : (
|
|
||||||
<View style={channelCreatorStyle.listEmpty}>
|
|
||||||
<Text style={channelCreatorStyle.listEmptyText}>
|
|
||||||
You have not created a channel. Start now by creating a new channel!
|
|
||||||
</Text>
|
|
||||||
</View>
|
</View>
|
||||||
)
|
)
|
||||||
}
|
}
|
||||||
ListFooterComponent={
|
|
||||||
<View style={channelCreatorStyle.listFooter}>
|
|
||||||
<Button
|
|
||||||
style={channelCreatorStyle.createChannelButton}
|
|
||||||
text={'Create a channel'}
|
|
||||||
onPress={this.handleNewChannelPress}
|
|
||||||
/>
|
|
||||||
</View>
|
|
||||||
}
|
|
||||||
style={channelCreatorStyle.scrollContainer}
|
style={channelCreatorStyle.scrollContainer}
|
||||||
contentContainerStyle={channelCreatorStyle.scrollPadding}
|
contentContainerStyle={channelCreatorStyle.scrollPadding}
|
||||||
initialNumToRender={10}
|
initialNumToRender={10}
|
||||||
@@ -801,9 +868,9 @@ export default class ChannelCreator extends React.PureComponent {
|
|||||||
>
|
>
|
||||||
<View style={[channelCreatorStyle.channelListAvatar, itemAutoStyle]}>
|
<View style={[channelCreatorStyle.channelListAvatar, itemAutoStyle]}>
|
||||||
{itemThumbnailUrl && (
|
{itemThumbnailUrl && (
|
||||||
<Image
|
<FastImage
|
||||||
style={channelCreatorStyle.avatarImage}
|
style={channelCreatorStyle.avatarImage}
|
||||||
resizeMode={'cover'}
|
resizeMode={FastImage.resizeMode.cover}
|
||||||
source={{ uri: itemThumbnailUrl }}
|
source={{ uri: itemThumbnailUrl }}
|
||||||
/>
|
/>
|
||||||
)}
|
)}
|
||||||
@@ -825,20 +892,20 @@ export default class ChannelCreator extends React.PureComponent {
|
|||||||
</TouchableOpacity>
|
</TouchableOpacity>
|
||||||
);
|
);
|
||||||
}}
|
}}
|
||||||
data={channels.filter(channel => !abandoningClaimIds.includes(channel.claim_id))}
|
data={channels ? channels.filter(channel => !abandoningClaimIds.includes(channel.claim_id)) : []}
|
||||||
keyExtractor={(item, index) => item.claim_id}
|
keyExtractor={(item, index) => item.claim_id}
|
||||||
/>
|
/>
|
||||||
)}
|
)}
|
||||||
|
|
||||||
{currentPhase === Constants.PHASE_CREATE && (
|
{currentPhase === Constants.PHASE_CREATE && (
|
||||||
<ScrollView style={channelCreatorStyle.createChannelContainer}>
|
<ScrollView ref={ref => (this.scrollView = ref)} style={channelCreatorStyle.createChannelContainer}>
|
||||||
<View style={channelCreatorStyle.imageSelectors}>
|
<View style={channelCreatorStyle.imageSelectors}>
|
||||||
<TouchableOpacity style={channelCreatorStyle.coverImageTouchArea} onPress={this.onCoverImagePress}>
|
<TouchableOpacity style={channelCreatorStyle.coverImageTouchArea} onPress={this.onCoverImagePress}>
|
||||||
<Image
|
<Image
|
||||||
style={channelCreatorStyle.coverImage}
|
style={channelCreatorStyle.coverImage}
|
||||||
resizeMode={'cover'}
|
resizeMode={'cover'}
|
||||||
source={
|
source={
|
||||||
coverImageUrl !== null && coverImageUrl.trim().length > 0
|
!!coverImageUrl && coverImageUrl.trim().length > 0
|
||||||
? { uri: coverImageUrl }
|
? { uri: coverImageUrl }
|
||||||
: require('../../assets/default_channel_cover.png')
|
: require('../../assets/default_channel_cover.png')
|
||||||
}
|
}
|
||||||
@@ -850,21 +917,22 @@ export default class ChannelCreator extends React.PureComponent {
|
|||||||
{this.state.uploadingImage && (
|
{this.state.uploadingImage && (
|
||||||
<View style={channelCreatorStyle.uploadProgress}>
|
<View style={channelCreatorStyle.uploadProgress}>
|
||||||
<ActivityIndicator size={'small'} color={Colors.NextLbryGreen} />
|
<ActivityIndicator size={'small'} color={Colors.NextLbryGreen} />
|
||||||
<Text style={channelCreatorStyle.uploadText}>Uploading image...</Text>
|
<Text style={channelCreatorStyle.uploadText}>{__('Uploading image...')}</Text>
|
||||||
</View>
|
</View>
|
||||||
)}
|
)}
|
||||||
</TouchableOpacity>
|
</TouchableOpacity>
|
||||||
|
|
||||||
<View style={[channelCreatorStyle.avatarImageContainer, autoStyle]}>
|
<View style={[channelCreatorStyle.avatarImageContainer, autoStyle]}>
|
||||||
<TouchableOpacity style={channelCreatorStyle.avatarTouchArea} onPress={this.onAvatarImagePress}>
|
<TouchableOpacity style={channelCreatorStyle.avatarTouchArea} onPress={this.onAvatarImagePress}>
|
||||||
{thumbnailUrl !== null && thumbnailUrl.trim().length > 0 && (
|
{!!thumbnailUrl && thumbnailUrl.trim().length > 0 && (
|
||||||
<Image
|
<Image
|
||||||
style={channelCreatorStyle.avatarImage}
|
style={channelCreatorStyle.avatarImage}
|
||||||
resizeMode={'cover'}
|
resizeMode={'cover'}
|
||||||
source={{ uri: thumbnailUrl }}
|
source={{ uri: thumbnailUrl }}
|
||||||
/>
|
/>
|
||||||
)}
|
)}
|
||||||
{thumbnailUrl !== null && thumbnailUrl.trim().length === 0 && newChannelName.length > 1 && (
|
{(!!thumbnailUrl || (!!thumbnailUrl && thumbnailUrl.trim().length === 0)) &&
|
||||||
|
newChannelName.length > 0 && (
|
||||||
<Text style={channelIconStyle.autothumbCharacter}>
|
<Text style={channelIconStyle.autothumbCharacter}>
|
||||||
{newChannelName.substring(0, 1).toUpperCase()}
|
{newChannelName.substring(0, 1).toUpperCase()}
|
||||||
</Text>
|
</Text>
|
||||||
@@ -876,19 +944,20 @@ export default class ChannelCreator extends React.PureComponent {
|
|||||||
</TouchableOpacity>
|
</TouchableOpacity>
|
||||||
</View>
|
</View>
|
||||||
</View>
|
</View>
|
||||||
|
{balance < Constants.MINIMUM_TRANSACTION_BALANCE && <ChannelRewardsDriver navigation={navigation} />}
|
||||||
|
|
||||||
<View style={channelCreatorStyle.card}>
|
<View style={channelCreatorStyle.card}>
|
||||||
<View style={channelCreatorStyle.textInputLayout}>
|
<View style={channelCreatorStyle.textInputLayout}>
|
||||||
{(this.state.titleFocused ||
|
{(this.state.titleFocused ||
|
||||||
(this.state.newChannelTitle != null && this.state.newChannelTitle.trim().length > 0)) && (
|
(this.state.newChannelTitle != null && this.state.newChannelTitle.trim().length > 0)) && (
|
||||||
<Text style={channelCreatorStyle.textInputTitle}>Title</Text>
|
<Text style={channelCreatorStyle.textInputTitle}>{__('Title')}</Text>
|
||||||
)}
|
)}
|
||||||
<TextInput
|
<TextInput
|
||||||
editable={canSave && !creatingChannel && !updatingChannel}
|
editable={canSave && !creatingChannel && !updatingChannel}
|
||||||
style={channelCreatorStyle.inputText}
|
style={channelCreatorStyle.inputText}
|
||||||
value={this.state.newChannelTitle}
|
value={this.state.newChannelTitle}
|
||||||
onChangeText={this.handleNewChannelTitleChange}
|
onChangeText={this.handleNewChannelTitleChange}
|
||||||
placeholder={this.state.titleFocused ? '' : 'Title'}
|
placeholder={this.state.titleFocused ? '' : __('Title')}
|
||||||
underlineColorAndroid={Colors.NextLbryGreen}
|
underlineColorAndroid={Colors.NextLbryGreen}
|
||||||
onFocus={() => this.setState({ titleFocused: true })}
|
onFocus={() => this.setState({ titleFocused: true })}
|
||||||
onBlur={() => this.setState({ titleFocused: false })}
|
onBlur={() => this.setState({ titleFocused: false })}
|
||||||
@@ -898,16 +967,16 @@ export default class ChannelCreator extends React.PureComponent {
|
|||||||
<View style={channelCreatorStyle.channelInputLayout}>
|
<View style={channelCreatorStyle.channelInputLayout}>
|
||||||
{(this.state.channelNameFocused ||
|
{(this.state.channelNameFocused ||
|
||||||
(this.state.newChannelName != null && this.state.newChannelName.trim().length > 0)) && (
|
(this.state.newChannelName != null && this.state.newChannelName.trim().length > 0)) && (
|
||||||
<Text style={channelCreatorStyle.textInputTitle}>Channel</Text>
|
<Text style={channelCreatorStyle.textInputTitle}>{__('Channel')}</Text>
|
||||||
)}
|
)}
|
||||||
<View>
|
<View>
|
||||||
<Text style={channelCreatorStyle.channelAt}>@</Text>
|
<Text style={channelCreatorStyle.channelAt}>@</Text>
|
||||||
<TextInput
|
<TextInput
|
||||||
editable={canSave && !creatingChannel && !updatingChannel}
|
editable={canSave && !editMode && !creatingChannel && !updatingChannel}
|
||||||
style={channelCreatorStyle.channelNameInput}
|
style={channelCreatorStyle.channelNameInput}
|
||||||
value={this.state.newChannelName}
|
value={this.state.newChannelName}
|
||||||
onChangeText={value => this.handleNewChannelNameChange(value, true)}
|
onChangeText={value => this.handleNewChannelNameChange(value, true)}
|
||||||
placeholder={this.state.channelNameFocused ? '' : 'Channel'}
|
placeholder={this.state.channelNameFocused ? '' : __('Channel')}
|
||||||
underlineColorAndroid={Colors.NextLbryGreen}
|
underlineColorAndroid={Colors.NextLbryGreen}
|
||||||
onFocus={() => this.setState({ channelNameFocused: true })}
|
onFocus={() => this.setState({ channelNameFocused: true })}
|
||||||
onBlur={() => this.setState({ channelNameFocused: false })}
|
onBlur={() => this.setState({ channelNameFocused: false })}
|
||||||
@@ -917,21 +986,35 @@ export default class ChannelCreator extends React.PureComponent {
|
|||||||
{newChannelNameError.length > 0 && (
|
{newChannelNameError.length > 0 && (
|
||||||
<Text style={channelCreatorStyle.inlineError}>{newChannelNameError}</Text>
|
<Text style={channelCreatorStyle.inlineError}>{newChannelNameError}</Text>
|
||||||
)}
|
)}
|
||||||
|
{editMode && (
|
||||||
|
<Text style={channelCreatorStyle.helpText}>
|
||||||
|
{__('The channel name cannot be changed while editing.')}
|
||||||
|
</Text>
|
||||||
|
)}
|
||||||
|
|
||||||
<View style={channelCreatorStyle.bidRow}>
|
<View style={channelCreatorStyle.bidRow}>
|
||||||
<Text style={channelCreatorStyle.label}>Deposit</Text>
|
<Text style={channelCreatorStyle.label}>{__('Deposit')}</Text>
|
||||||
<TextInput
|
<TextInput
|
||||||
editable={canSave && !creatingChannel && !updatingChannel}
|
editable={canSave && !creatingChannel && !updatingChannel}
|
||||||
style={channelCreatorStyle.bidAmountInput}
|
style={channelCreatorStyle.bidAmountInput}
|
||||||
value={String(newChannelBid)}
|
value={String(newChannelBid)}
|
||||||
onChangeText={this.handleNewChannelBidChange}
|
onChangeText={this.handleNewChannelBidChange}
|
||||||
|
onFocus={() => this.setState({ creditsInputFocused: true })}
|
||||||
|
onBlur={() => this.setState({ creditsInputFocused: false })}
|
||||||
placeholder={'0.00'}
|
placeholder={'0.00'}
|
||||||
keyboardType={'number-pad'}
|
keyboardType={'number-pad'}
|
||||||
underlineColorAndroid={Colors.NextLbryGreen}
|
underlineColorAndroid={Colors.NextLbryGreen}
|
||||||
/>
|
/>
|
||||||
<Text style={channelCreatorStyle.currency}>LBC</Text>
|
<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>
|
</View>
|
||||||
<Text style={channelCreatorStyle.helpText}>
|
<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>
|
</Text>
|
||||||
</View>
|
</View>
|
||||||
|
|
||||||
@@ -940,7 +1023,7 @@ export default class ChannelCreator extends React.PureComponent {
|
|||||||
<View style={channelCreatorStyle.textInputLayout}>
|
<View style={channelCreatorStyle.textInputLayout}>
|
||||||
{(this.state.descriptionFocused ||
|
{(this.state.descriptionFocused ||
|
||||||
(this.state.description != null && this.state.description.trim().length > 0)) && (
|
(this.state.description != null && this.state.description.trim().length > 0)) && (
|
||||||
<Text style={channelCreatorStyle.textInputTitle}>Description</Text>
|
<Text style={channelCreatorStyle.textInputTitle}>{__('Description')}</Text>
|
||||||
)}
|
)}
|
||||||
<TextInput
|
<TextInput
|
||||||
editable={canSave && !creatingChannel && !updatingChannel}
|
editable={canSave && !creatingChannel && !updatingChannel}
|
||||||
@@ -948,7 +1031,7 @@ export default class ChannelCreator extends React.PureComponent {
|
|||||||
multiline
|
multiline
|
||||||
value={this.state.description}
|
value={this.state.description}
|
||||||
onChangeText={this.handleDescriptionChange}
|
onChangeText={this.handleDescriptionChange}
|
||||||
placeholder={this.state.descriptionFocused ? '' : 'Description'}
|
placeholder={this.state.descriptionFocused ? '' : __('Description')}
|
||||||
underlineColorAndroid={Colors.NextLbryGreen}
|
underlineColorAndroid={Colors.NextLbryGreen}
|
||||||
onFocus={() => this.setState({ descriptionFocused: true })}
|
onFocus={() => this.setState({ descriptionFocused: true })}
|
||||||
onBlur={() => this.setState({ descriptionFocused: false })}
|
onBlur={() => this.setState({ descriptionFocused: false })}
|
||||||
@@ -958,14 +1041,14 @@ export default class ChannelCreator extends React.PureComponent {
|
|||||||
<View style={channelCreatorStyle.textInputLayout}>
|
<View style={channelCreatorStyle.textInputLayout}>
|
||||||
{(this.state.websiteFocused ||
|
{(this.state.websiteFocused ||
|
||||||
(this.state.website != null && this.state.website.trim().length > 0)) && (
|
(this.state.website != null && this.state.website.trim().length > 0)) && (
|
||||||
<Text style={channelCreatorStyle.textInputTitle}>Website</Text>
|
<Text style={channelCreatorStyle.textInputTitle}>{__('Website')}</Text>
|
||||||
)}
|
)}
|
||||||
<TextInput
|
<TextInput
|
||||||
editable={canSave && !creatingChannel && !updatingChannel}
|
editable={canSave && !creatingChannel && !updatingChannel}
|
||||||
style={channelCreatorStyle.inputText}
|
style={channelCreatorStyle.inputText}
|
||||||
value={this.state.website}
|
value={this.state.website}
|
||||||
onChangeText={this.handleWebsiteChange}
|
onChangeText={this.handleWebsiteChange}
|
||||||
placeholder={this.state.websiteFocused ? '' : 'Website'}
|
placeholder={this.state.websiteFocused ? '' : __('Website')}
|
||||||
underlineColorAndroid={Colors.NextLbryGreen}
|
underlineColorAndroid={Colors.NextLbryGreen}
|
||||||
onFocus={() => this.setState({ websiteFocused: true })}
|
onFocus={() => this.setState({ websiteFocused: true })}
|
||||||
onBlur={() => this.setState({ websiteFocused: false })}
|
onBlur={() => this.setState({ websiteFocused: false })}
|
||||||
@@ -974,14 +1057,14 @@ export default class ChannelCreator extends React.PureComponent {
|
|||||||
|
|
||||||
<View style={channelCreatorStyle.textInputLayout}>
|
<View style={channelCreatorStyle.textInputLayout}>
|
||||||
{(this.state.emailFocused || (this.state.email != null && this.state.email.trim().length > 0)) && (
|
{(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
|
<TextInput
|
||||||
editable={canSave && !creatingChannel && !updatingChannel}
|
editable={canSave && !creatingChannel && !updatingChannel}
|
||||||
style={channelCreatorStyle.inputText}
|
style={channelCreatorStyle.inputText}
|
||||||
value={this.state.email}
|
value={this.state.email}
|
||||||
onChangeText={this.handleEmailChange}
|
onChangeText={this.handleEmailChange}
|
||||||
placeholder={this.state.emailFocused ? '' : 'Email'}
|
placeholder={this.state.emailFocused ? '' : __('Email')}
|
||||||
underlineColorAndroid={Colors.NextLbryGreen}
|
underlineColorAndroid={Colors.NextLbryGreen}
|
||||||
onFocus={() => this.setState({ emailFocused: true })}
|
onFocus={() => this.setState({ emailFocused: true })}
|
||||||
onBlur={() => this.setState({ emailFocused: false })}
|
onBlur={() => this.setState({ emailFocused: false })}
|
||||||
@@ -992,7 +1075,7 @@ export default class ChannelCreator extends React.PureComponent {
|
|||||||
|
|
||||||
{this.state.showOptionalFields && (
|
{this.state.showOptionalFields && (
|
||||||
<View style={channelCreatorStyle.card}>
|
<View style={channelCreatorStyle.card}>
|
||||||
<Text style={channelCreatorStyle.cardTitle}>Tags</Text>
|
<Text style={channelCreatorStyle.cardTitle}>{__('Tags')}</Text>
|
||||||
<View style={channelCreatorStyle.tagList}>
|
<View style={channelCreatorStyle.tagList}>
|
||||||
{this.state.tags &&
|
{this.state.tags &&
|
||||||
this.state.tags.map(tag => (
|
this.state.tags.map(tag => (
|
||||||
@@ -1016,7 +1099,7 @@ export default class ChannelCreator extends React.PureComponent {
|
|||||||
|
|
||||||
<View style={channelCreatorStyle.toggleContainer}>
|
<View style={channelCreatorStyle.toggleContainer}>
|
||||||
<Link
|
<Link
|
||||||
text={this.state.showOptionalFields ? 'Hide optional fields' : 'Show optional fields'}
|
text={this.state.showOptionalFields ? __('Hide optional fields') : __('Show optional fields')}
|
||||||
onPress={this.handleModePressed}
|
onPress={this.handleModePressed}
|
||||||
style={channelCreatorStyle.modeLink}
|
style={channelCreatorStyle.modeLink}
|
||||||
/>
|
/>
|
||||||
@@ -1028,11 +1111,11 @@ export default class ChannelCreator extends React.PureComponent {
|
|||||||
)}
|
)}
|
||||||
{!creatingChannel && !updatingChannel && (
|
{!creatingChannel && !updatingChannel && (
|
||||||
<View style={channelCreatorStyle.buttons}>
|
<View style={channelCreatorStyle.buttons}>
|
||||||
<Link style={channelCreatorStyle.cancelLink} text="Cancel" onPress={this.handleCreateCancel} />
|
<Link style={channelCreatorStyle.cancelLink} text={__('Cancel')} onPress={this.handleCreateCancel} />
|
||||||
<Button
|
<Button
|
||||||
style={channelCreatorStyle.createButton}
|
style={channelCreatorStyle.createButton}
|
||||||
disabled={!canSave || uploadingImage || !newChannelName || newChannelName.trim().length === 0}
|
disabled={!canSave || uploadingImage}
|
||||||
text={editMode ? 'Update' : 'Create'}
|
text={editMode ? __('Update') : __('Create')}
|
||||||
onPress={this.handleCreateChannelClick}
|
onPress={this.handleCreateChannelClick}
|
||||||
/>
|
/>
|
||||||
</View>
|
</View>
|
||||||
|
|||||||
@@ -11,6 +11,7 @@ import {
|
|||||||
selectSubscriptionClaims,
|
selectSubscriptionClaims,
|
||||||
selectUnreadSubscriptions,
|
selectUnreadSubscriptions,
|
||||||
} from 'lbryinc';
|
} from 'lbryinc';
|
||||||
|
import { doPushDrawerStack, doSetPlayerVisible } from 'redux/actions/drawer';
|
||||||
import { doSetClientSetting, doSetSortByItem, doSetTimeItem } from 'redux/actions/settings';
|
import { doSetClientSetting, doSetSortByItem, doSetTimeItem } from 'redux/actions/settings';
|
||||||
import { makeSelectClientSetting, selectSortByItem, selectTimeItem } from 'redux/selectors/settings';
|
import { makeSelectClientSetting, selectSortByItem, selectTimeItem } from 'redux/selectors/settings';
|
||||||
import Constants from 'constants'; // eslint-disable-line node/no-deprecated-api
|
import Constants from 'constants'; // eslint-disable-line node/no-deprecated-api
|
||||||
@@ -37,13 +38,15 @@ const perform = dispatch => ({
|
|||||||
fetchRewardedContent: () => dispatch(doFetchRewardedContent()),
|
fetchRewardedContent: () => dispatch(doFetchRewardedContent()),
|
||||||
fetchSubscriptions: () => dispatch(doFetchMySubscriptions()),
|
fetchSubscriptions: () => dispatch(doFetchMySubscriptions()),
|
||||||
fileList: () => dispatch(doFileList()),
|
fileList: () => dispatch(doFileList()),
|
||||||
|
pushDrawerStack: () => dispatch(doPushDrawerStack(Constants.DRAWER_ROUTE_DISCOVER)),
|
||||||
removeUnreadSubscriptions: () => dispatch(doRemoveUnreadSubscriptions()),
|
removeUnreadSubscriptions: () => dispatch(doRemoveUnreadSubscriptions()),
|
||||||
setClientSetting: (key, value) => dispatch(doSetClientSetting(key, value)),
|
setClientSetting: (key, value) => dispatch(doSetClientSetting(key, value)),
|
||||||
|
setPlayerVisible: () => dispatch(doSetPlayerVisible(false)),
|
||||||
setSortByItem: item => dispatch(doSetSortByItem(item)),
|
setSortByItem: item => dispatch(doSetSortByItem(item)),
|
||||||
setTimeItem: item => dispatch(doSetTimeItem(item)),
|
setTimeItem: item => dispatch(doSetTimeItem(item)),
|
||||||
});
|
});
|
||||||
|
|
||||||
export default connect(
|
export default connect(
|
||||||
select,
|
select,
|
||||||
perform
|
perform,
|
||||||
)(DiscoverPage);
|
)(DiscoverPage);
|
||||||
+40
-72
@@ -11,10 +11,9 @@ import {
|
|||||||
View,
|
View,
|
||||||
} from 'react-native';
|
} from 'react-native';
|
||||||
import { DEFAULT_FOLLOWED_TAGS, Lbry, normalizeURI, parseURI } from 'lbry-redux';
|
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 AsyncStorage from '@react-native-community/async-storage';
|
||||||
import moment from 'moment';
|
import moment from 'moment';
|
||||||
import CategoryList from 'component/categoryList';
|
|
||||||
import ClaimList from 'component/claimList';
|
import ClaimList from 'component/claimList';
|
||||||
import Constants from 'constants'; // eslint-disable-line node/no-deprecated-api
|
import Constants from 'constants'; // eslint-disable-line node/no-deprecated-api
|
||||||
import Colors from 'styles/colors';
|
import Colors from 'styles/colors';
|
||||||
@@ -38,8 +37,6 @@ class DiscoverPage extends React.PureComponent {
|
|||||||
};
|
};
|
||||||
|
|
||||||
componentDidMount() {
|
componentDidMount() {
|
||||||
NativeModules.Firebase.setCurrentScreen('Your tags');
|
|
||||||
|
|
||||||
// Track the total time taken if this is the first launch
|
// Track the total time taken if this is the first launch
|
||||||
AsyncStorage.getItem('firstLaunchTime').then(startTime => {
|
AsyncStorage.getItem('firstLaunchTime').then(startTime => {
|
||||||
if (startTime !== null && !isNaN(parseInt(startTime, 10))) {
|
if (startTime !== null && !isNaN(parseInt(startTime, 10))) {
|
||||||
@@ -63,17 +60,39 @@ class DiscoverPage extends React.PureComponent {
|
|||||||
}
|
}
|
||||||
});
|
});
|
||||||
|
|
||||||
const { sortByItem, fetchRewardedContent, fetchSubscriptions, fileList, followedTags } = this.props;
|
const { sortByItem, fetchRewardedContent, fileList, followedTags } = this.props;
|
||||||
|
|
||||||
this.buildTagCollection(followedTags);
|
this.buildTagCollection(followedTags);
|
||||||
fetchRewardedContent();
|
fetchRewardedContent();
|
||||||
fetchSubscriptions();
|
|
||||||
fileList();
|
fileList();
|
||||||
|
|
||||||
this.handleSortByItemSelected(sortByItem);
|
this.handleSortByItemSelected(sortByItem);
|
||||||
this.showRatingReminder();
|
this.showRatingReminder();
|
||||||
|
|
||||||
|
this.onComponentFocused();
|
||||||
}
|
}
|
||||||
|
|
||||||
|
componentWillReceiveProps(nextProps) {
|
||||||
|
const { currentRoute: prevRoute, followedTags: prevFollowedTags } = this.props;
|
||||||
|
const { currentRoute, followedTags } = nextProps;
|
||||||
|
|
||||||
|
if (Constants.DRAWER_ROUTE_DISCOVER === currentRoute && currentRoute !== prevRoute) {
|
||||||
|
this.onComponentFocused();
|
||||||
|
}
|
||||||
|
|
||||||
|
if (!_.isEqual(followedTags, prevFollowedTags)) {
|
||||||
|
this.buildTagCollection(followedTags);
|
||||||
|
}
|
||||||
|
}
|
||||||
|
|
||||||
|
onComponentFocused = () => {
|
||||||
|
const { pushDrawerStack, setPlayerVisible } = this.props;
|
||||||
|
// pushDrawerStack();
|
||||||
|
|
||||||
|
NativeModules.Firebase.setCurrentScreen('Your tags');
|
||||||
|
setPlayerVisible();
|
||||||
|
};
|
||||||
|
|
||||||
handleSortByItemSelected = item => {
|
handleSortByItemSelected = item => {
|
||||||
const { setSortByItem } = this.props;
|
const { setSortByItem } = this.props;
|
||||||
setSortByItem(item);
|
setSortByItem(item);
|
||||||
@@ -104,59 +123,6 @@ class DiscoverPage extends React.PureComponent {
|
|||||||
return null;
|
return null;
|
||||||
};
|
};
|
||||||
|
|
||||||
componentWillReceiveProps(nextProps) {
|
|
||||||
const { followedTags: prevFollowedTags } = this.props;
|
|
||||||
const { followedTags } = nextProps;
|
|
||||||
if (!_.isEqual(followedTags, prevFollowedTags)) {
|
|
||||||
this.buildTagCollection(followedTags);
|
|
||||||
}
|
|
||||||
}
|
|
||||||
|
|
||||||
componentDidUpdate(prevProps, prevState) {
|
|
||||||
const { unreadSubscriptions, enabledChannelNotifications } = this.props;
|
|
||||||
|
|
||||||
const utility = NativeModules.UtilityModule;
|
|
||||||
if (utility) {
|
|
||||||
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.indexOf(channelName) > -1) {
|
|
||||||
uris.forEach(uri => {
|
|
||||||
Lbry.resolve({ urls: uri }).then(result => {
|
|
||||||
const sub = result[uri].claim;
|
|
||||||
if (sub && sub.value && sub.value.stream) {
|
|
||||||
let isPlayable = false;
|
|
||||||
const source = sub.value.stream.source;
|
|
||||||
const metadata = sub.value.stream.metadata;
|
|
||||||
if (source) {
|
|
||||||
isPlayable =
|
|
||||||
source.contentType && ['audio', 'video'].indexOf(source.contentType.substring(0, 5)) > -1;
|
|
||||||
}
|
|
||||||
if (metadata) {
|
|
||||||
utility.showNotificationForContent(
|
|
||||||
uri,
|
|
||||||
metadata.title,
|
|
||||||
channelName,
|
|
||||||
metadata.thumbnail,
|
|
||||||
isPlayable
|
|
||||||
);
|
|
||||||
}
|
|
||||||
}
|
|
||||||
});
|
|
||||||
});
|
|
||||||
}
|
|
||||||
});
|
|
||||||
}
|
|
||||||
}
|
|
||||||
}
|
|
||||||
|
|
||||||
showRatingReminder = () => {
|
showRatingReminder = () => {
|
||||||
const { ratingReminderDisabled, ratingReminderLastShown, setClientSetting } = this.props;
|
const { ratingReminderDisabled, ratingReminderLastShown, setClientSetting } = this.props;
|
||||||
|
|
||||||
@@ -169,23 +135,25 @@ class DiscoverPage extends React.PureComponent {
|
|||||||
if (!isNaN(lastShownTime) && !isNaN(lastShownCount)) {
|
if (!isNaN(lastShownTime) && !isNaN(lastShownCount)) {
|
||||||
if (now > lastShownTime + Constants.RATING_REMINDER_INTERVAL * lastShownCount) {
|
if (now > lastShownTime + Constants.RATING_REMINDER_INTERVAL * lastShownCount) {
|
||||||
Alert.alert(
|
Alert.alert(
|
||||||
'Enjoying LBRY?',
|
__('Enjoying LBRY?'),
|
||||||
'Are you enjoying your experience with the LBRY app? You can leave a review for us on the Play Store.',
|
__(
|
||||||
|
'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'),
|
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: () => {
|
onPress: () => {
|
||||||
setClientSetting(Constants.SETTING_RATING_REMINDER_DISABLED, 'true');
|
setClientSetting(Constants.SETTING_RATING_REMINDER_DISABLED, 'true');
|
||||||
Linking.openURL(Constants.PLAY_STORE_URL);
|
Linking.openURL(Constants.PLAY_STORE_URL);
|
||||||
},
|
},
|
||||||
},
|
},
|
||||||
],
|
],
|
||||||
{ cancelable: false }
|
{ cancelable: false },
|
||||||
);
|
);
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
@@ -205,7 +173,7 @@ class DiscoverPage extends React.PureComponent {
|
|||||||
|
|
||||||
buildSections = () => {
|
buildSections = () => {
|
||||||
return this.state.tagCollection.map(tags => ({
|
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],
|
data: [tags],
|
||||||
}));
|
}));
|
||||||
};
|
};
|
||||||
@@ -229,7 +197,7 @@ class DiscoverPage extends React.PureComponent {
|
|||||||
|
|
||||||
handleTagPress = name => {
|
handleTagPress = name => {
|
||||||
const { navigation, sortByItem } = this.props;
|
const { navigation, sortByItem } = this.props;
|
||||||
if (name.toLowerCase() !== 'all tags you follow') {
|
if (name.toLowerCase() !== __('all tags you follow')) {
|
||||||
navigation.navigate({
|
navigation.navigate({
|
||||||
routeName: Constants.DRAWER_ROUTE_TAG,
|
routeName: Constants.DRAWER_ROUTE_TAG,
|
||||||
key: `tagPage`,
|
key: `tagPage`,
|
||||||
@@ -248,18 +216,18 @@ class DiscoverPage extends React.PureComponent {
|
|||||||
return (
|
return (
|
||||||
<View style={discoverStyle.listHeader}>
|
<View style={discoverStyle.listHeader}>
|
||||||
<View style={discoverStyle.titleRow}>
|
<View style={discoverStyle.titleRow}>
|
||||||
<Text style={discoverStyle.pageTitle}>Your tags</Text>
|
<Text style={discoverStyle.pageTitle}>{__('Your Tags')}</Text>
|
||||||
</View>
|
</View>
|
||||||
<View style={discoverStyle.pickerRow}>
|
<View style={discoverStyle.pickerRow}>
|
||||||
<View style={discoverStyle.leftPickerRow}>
|
<View style={discoverStyle.leftPickerRow}>
|
||||||
<TouchableOpacity style={discoverStyle.tagSortBy} onPress={() => this.setState({ showSortPicker: true })}>
|
<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} />
|
<Icon style={discoverStyle.tagSortIcon} name={'sort-down'} size={14} />
|
||||||
</TouchableOpacity>
|
</TouchableOpacity>
|
||||||
|
|
||||||
{Constants.SORT_BY_TOP === sortByItem.name && (
|
{Constants.SORT_BY_TOP === sortByItem.name && (
|
||||||
<TouchableOpacity style={discoverStyle.tagTime} onPress={() => this.setState({ showTimePicker: true })}>
|
<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} />
|
<Icon style={discoverStyle.tagSortIcon} name={'sort-down'} size={14} />
|
||||||
</TouchableOpacity>
|
</TouchableOpacity>
|
||||||
)}
|
)}
|
||||||
@@ -267,7 +235,7 @@ class DiscoverPage extends React.PureComponent {
|
|||||||
|
|
||||||
<Link
|
<Link
|
||||||
style={discoverStyle.customizeLink}
|
style={discoverStyle.customizeLink}
|
||||||
text={'Customize'}
|
text={__('Customize')}
|
||||||
onPress={() => this.setState({ showModalTagSelector: true })}
|
onPress={() => this.setState({ showModalTagSelector: true })}
|
||||||
/>
|
/>
|
||||||
</View>
|
</View>
|
||||||
@@ -283,7 +251,7 @@ class DiscoverPage extends React.PureComponent {
|
|||||||
|
|
||||||
return (
|
return (
|
||||||
<View style={discoverStyle.footer}>
|
<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}>
|
<View style={discoverStyle.footerTags}>
|
||||||
{remainingTags.map(tag => (
|
{remainingTags.map(tag => (
|
||||||
<Text
|
<Text
|
||||||
|
|||||||
+15
-10
@@ -11,10 +11,11 @@ import {
|
|||||||
View,
|
View,
|
||||||
ScrollView,
|
ScrollView,
|
||||||
} from 'react-native';
|
} from 'react-native';
|
||||||
import { __, navigateToUri, uriFromFileInfo } from 'utils/helper';
|
import { navigateToUri, uriFromFileInfo } from 'utils/helper';
|
||||||
import Colors from 'styles/colors';
|
import Colors from 'styles/colors';
|
||||||
import Constants from 'constants'; // eslint-disable-line node/no-deprecated-api
|
import Constants from 'constants'; // eslint-disable-line node/no-deprecated-api
|
||||||
import PageHeader from 'component/pageHeader';
|
import PageHeader from 'component/pageHeader';
|
||||||
|
import EmptyStateView from 'component/emptyStateView';
|
||||||
import FileListItem from 'component/fileListItem';
|
import FileListItem from 'component/fileListItem';
|
||||||
import FloatingWalletBalance from 'component/floatingWalletBalance';
|
import FloatingWalletBalance from 'component/floatingWalletBalance';
|
||||||
import StorageStatsCard from 'component/storageStatsCard';
|
import StorageStatsCard from 'component/storageStatsCard';
|
||||||
@@ -78,7 +79,7 @@ class DownloadsPage extends React.PureComponent {
|
|||||||
const { claims, fileInfos } = this.props;
|
const { claims, fileInfos } = this.props;
|
||||||
const claimUris = claims.map(claim => normalizeURI(`${claim.name}#${claim.claim_id}`));
|
const claimUris = claims.map(claim => normalizeURI(`${claim.name}#${claim.claim_id}`));
|
||||||
return fileInfos.filter(
|
return fileInfos.filter(
|
||||||
fileInfo => !claimUris.includes(normalizeURI(`${fileInfo.claim_name}#${fileInfo.claim_id}`))
|
fileInfo => !claimUris.includes(normalizeURI(`${fileInfo.claim_name}#${fileInfo.claim_id}`)),
|
||||||
);
|
);
|
||||||
};
|
};
|
||||||
|
|
||||||
@@ -124,7 +125,11 @@ class DownloadsPage extends React.PureComponent {
|
|||||||
onPress: () => {
|
onPress: () => {
|
||||||
const uris = Object.keys(selectedClaimsMap);
|
const uris = Object.keys(selectedClaimsMap);
|
||||||
uris.forEach(uri => {
|
uris.forEach(uri => {
|
||||||
const { txid, nout } = selectedClaimsMap[uri];
|
const { txid, nout, name, claim_id: claimId } = selectedClaimsMap[uri];
|
||||||
|
if (name && claimId) {
|
||||||
|
NativeModules.UtilityModule.deleteDownload(normalizeURI(`${name}#${claimId}`));
|
||||||
|
}
|
||||||
|
|
||||||
deleteFile(`${txid}:${nout}`, true);
|
deleteFile(`${txid}:${nout}`, true);
|
||||||
});
|
});
|
||||||
this.onExitSelectionMode();
|
this.onExitSelectionMode();
|
||||||
@@ -134,7 +139,7 @@ class DownloadsPage extends React.PureComponent {
|
|||||||
],
|
],
|
||||||
{
|
{
|
||||||
cancelable: true,
|
cancelable: true,
|
||||||
}
|
},
|
||||||
);
|
);
|
||||||
};
|
};
|
||||||
|
|
||||||
@@ -154,6 +159,10 @@ class DownloadsPage extends React.PureComponent {
|
|||||||
onDeleteActionPressed={this.onDeleteActionPressed}
|
onDeleteActionPressed={this.onDeleteActionPressed}
|
||||||
/>
|
/>
|
||||||
|
|
||||||
|
{!fetching && !hasDownloads && (
|
||||||
|
<EmptyStateView message={__('You do not have any\ndownloaded content on this device.')} />
|
||||||
|
)}
|
||||||
|
|
||||||
<View style={downloadsStyle.subContainer}>
|
<View style={downloadsStyle.subContainer}>
|
||||||
{hasDownloads && <StorageStatsCard fileInfos={this.getFilteredFileInfos()} />}
|
{hasDownloads && <StorageStatsCard fileInfos={this.getFilteredFileInfos()} />}
|
||||||
{fetching && (
|
{fetching && (
|
||||||
@@ -161,11 +170,7 @@ class DownloadsPage extends React.PureComponent {
|
|||||||
<ActivityIndicator size="large" color={Colors.NextLbryGreen} style={downloadsStyle.loading} />
|
<ActivityIndicator size="large" color={Colors.NextLbryGreen} style={downloadsStyle.loading} />
|
||||||
</View>
|
</View>
|
||||||
)}
|
)}
|
||||||
{!fetching && !hasDownloads && (
|
|
||||||
<View style={downloadsStyle.busyContainer}>
|
|
||||||
<Text style={downloadsStyle.noDownloadsText}>You do not have any downloaded content on this device.</Text>
|
|
||||||
</View>
|
|
||||||
)}
|
|
||||||
{!fetching && hasDownloads && (
|
{!fetching && hasDownloads && (
|
||||||
<FlatList
|
<FlatList
|
||||||
extraData={this.state}
|
extraData={this.state}
|
||||||
@@ -183,7 +188,7 @@ class DownloadsPage extends React.PureComponent {
|
|||||||
this.handleSelectItem(item, claim);
|
this.handleSelectItem(item, claim);
|
||||||
} else {
|
} else {
|
||||||
// TODO: when shortUrl is available for my claims, navigate to that URL instead
|
// TODO: when shortUrl is available for my claims, navigate to that URL instead
|
||||||
navigateToUri(navigation, item, { autoplay: true });
|
navigateToUri(navigation, item, { autoplay: true }, false, null);
|
||||||
}
|
}
|
||||||
}}
|
}}
|
||||||
onLongPress={claim => this.handleItemLongPress(item, claim)}
|
onLongPress={claim => this.handleItemLongPress(item, claim)}
|
||||||
|
|||||||
+33
-28
@@ -1,5 +1,6 @@
|
|||||||
import { connect } from 'react-redux';
|
import { connect } from 'react-redux';
|
||||||
import {
|
import {
|
||||||
|
doAbandonClaim,
|
||||||
doFetchFileInfo,
|
doFetchFileInfo,
|
||||||
doFetchChannelListMine,
|
doFetchChannelListMine,
|
||||||
doFetchClaimListMine,
|
doFetchClaimListMine,
|
||||||
@@ -7,6 +8,7 @@ import {
|
|||||||
doPurchaseUri,
|
doPurchaseUri,
|
||||||
doDeletePurchasedUri,
|
doDeletePurchasedUri,
|
||||||
doResolveUri,
|
doResolveUri,
|
||||||
|
doResolveUris,
|
||||||
doSendTip,
|
doSendTip,
|
||||||
doToast,
|
doToast,
|
||||||
makeSelectIsUriResolving,
|
makeSelectIsUriResolving,
|
||||||
@@ -25,54 +27,56 @@ import {
|
|||||||
selectPurchasedUris,
|
selectPurchasedUris,
|
||||||
selectFailedPurchaseUris,
|
selectFailedPurchaseUris,
|
||||||
selectPurchaseUriErrorMessage,
|
selectPurchaseUriErrorMessage,
|
||||||
|
selectIsSearching,
|
||||||
} from 'lbry-redux';
|
} from 'lbry-redux';
|
||||||
import {
|
import {
|
||||||
doClaimEligiblePurchaseRewards,
|
doClaimEligiblePurchaseRewards,
|
||||||
doFetchCostInfoForUri,
|
doFetchCostInfoForUri,
|
||||||
|
doFetchViewCount,
|
||||||
makeSelectCostInfoForUri,
|
makeSelectCostInfoForUri,
|
||||||
|
makeSelectViewCountForUri,
|
||||||
selectRewardContentClaimIds,
|
selectRewardContentClaimIds,
|
||||||
selectBlackListedOutpoints,
|
selectBlackListedOutpoints,
|
||||||
} from 'lbryinc';
|
} from 'lbryinc';
|
||||||
import {
|
import { doDeleteFile, doStopDownloadingFile } from 'redux/actions/file';
|
||||||
doStartDownload,
|
import { doPushDrawerStack, doPopDrawerStack, doSetPlayerVisible } from 'redux/actions/drawer';
|
||||||
doUpdateDownload,
|
import { doToggleFullscreenMode } from 'redux/actions/settings';
|
||||||
doCompleteDownload,
|
import { selectDrawerStack, makeSelectPlayerVisible } from 'redux/selectors/drawer';
|
||||||
doDeleteFile,
|
|
||||||
doStopDownloadingFile,
|
|
||||||
} from 'redux/actions/file';
|
|
||||||
import { doPopDrawerStack, doSetPlayerVisible } from 'redux/actions/drawer';
|
|
||||||
import { selectDrawerStack } from 'redux/selectors/drawer';
|
|
||||||
import FilePage from './view';
|
import FilePage from './view';
|
||||||
|
|
||||||
const select = (state, props) => {
|
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 {
|
return {
|
||||||
balance: selectBalance(state),
|
balance: selectBalance(state),
|
||||||
blackListedOutpoints: selectBlackListedOutpoints(state),
|
blackListedOutpoints: selectBlackListedOutpoints(state),
|
||||||
channels: selectMyChannelClaims(state),
|
channels: selectMyChannelClaims(state),
|
||||||
claim: makeSelectClaimForUri(selectProps.uri)(state),
|
claim: makeSelectClaimForUri(contentUri)(state),
|
||||||
drawerStack: selectDrawerStack(state),
|
drawerStack: selectDrawerStack(state),
|
||||||
isResolvingUri: makeSelectIsUriResolving(selectProps.uri)(state),
|
isResolvingUri: makeSelectIsUriResolving(contentUri)(state),
|
||||||
contentType: makeSelectContentTypeForUri(selectProps.uri)(state),
|
contentType: makeSelectContentTypeForUri(contentUri)(state),
|
||||||
costInfo: makeSelectCostInfoForUri(selectProps.uri)(state),
|
costInfo: makeSelectCostInfoForUri(contentUri)(state),
|
||||||
metadata: makeSelectMetadataForUri(selectProps.uri)(state),
|
metadata: makeSelectMetadataForUri(contentUri)(state),
|
||||||
// obscureNsfw: !selectShowNsfw(state),
|
fileInfo: makeSelectFileInfoForUri(contentUri)(state),
|
||||||
// tab: makeSelectCurrentParam('tab')(state),
|
|
||||||
fileInfo: makeSelectFileInfoForUri(selectProps.uri)(state),
|
|
||||||
rewardedContentClaimIds: selectRewardContentClaimIds(state, selectProps),
|
rewardedContentClaimIds: selectRewardContentClaimIds(state, selectProps),
|
||||||
channelUri: makeSelectChannelForClaimUri(selectProps.uri, true)(state),
|
channelUri: makeSelectChannelForClaimUri(contentUri, true)(state),
|
||||||
position: makeSelectContentPositionForUri(selectProps.uri)(state),
|
isPlayerVisible: makeSelectPlayerVisible(uri)(state), // use navigation uri for this selector
|
||||||
|
position: makeSelectContentPositionForUri(contentUri)(state),
|
||||||
purchasedUris: selectPurchasedUris(state),
|
purchasedUris: selectPurchasedUris(state),
|
||||||
failedPurchaseUris: selectFailedPurchaseUris(state),
|
failedPurchaseUris: selectFailedPurchaseUris(state),
|
||||||
myClaimUris: selectMyClaimUrisWithoutChannels(state),
|
myClaimUris: selectMyClaimUrisWithoutChannels(state),
|
||||||
purchaseUriErrorMessage: selectPurchaseUriErrorMessage(state),
|
purchaseUriErrorMessage: selectPurchaseUriErrorMessage(state),
|
||||||
streamingUrl: makeSelectStreamingUrlForUri(selectProps.uri)(state),
|
streamingUrl: makeSelectStreamingUrlForUri(contentUri)(state),
|
||||||
thumbnail: makeSelectThumbnailForUri(selectProps.uri)(state),
|
thumbnail: makeSelectThumbnailForUri(contentUri)(state),
|
||||||
title: makeSelectTitleForUri(selectProps.uri)(state),
|
title: makeSelectTitleForUri(contentUri)(state),
|
||||||
|
isSearchingRecommendContent: selectIsSearching(state),
|
||||||
|
viewCount: makeSelectViewCountForUri(contentUri)(state),
|
||||||
};
|
};
|
||||||
};
|
};
|
||||||
|
|
||||||
const perform = dispatch => ({
|
const perform = dispatch => ({
|
||||||
|
abandonClaim: (txid, nout) => dispatch(doAbandonClaim(txid, nout)),
|
||||||
claimEligibleRewards: () => dispatch(doClaimEligiblePurchaseRewards()),
|
claimEligibleRewards: () => dispatch(doClaimEligiblePurchaseRewards()),
|
||||||
deleteFile: (fileInfo, deleteFromDevice, abandonClaim) => {
|
deleteFile: (fileInfo, deleteFromDevice, abandonClaim) => {
|
||||||
dispatch(doDeleteFile(fileInfo, deleteFromDevice, abandonClaim));
|
dispatch(doDeleteFile(fileInfo, deleteFromDevice, abandonClaim));
|
||||||
@@ -81,22 +85,23 @@ const perform = dispatch => ({
|
|||||||
fetchCostInfo: uri => dispatch(doFetchCostInfoForUri(uri)),
|
fetchCostInfo: uri => dispatch(doFetchCostInfoForUri(uri)),
|
||||||
fetchMyClaims: () => dispatch(doFetchClaimListMine()),
|
fetchMyClaims: () => dispatch(doFetchClaimListMine()),
|
||||||
fetchChannelListMine: () => dispatch(doFetchChannelListMine()),
|
fetchChannelListMine: () => dispatch(doFetchChannelListMine()),
|
||||||
|
fetchViewCount: claimId => dispatch(doFetchViewCount(claimId)),
|
||||||
fileGet: (uri, saveFile) => dispatch(doFileGet(uri, saveFile)),
|
fileGet: (uri, saveFile) => dispatch(doFileGet(uri, saveFile)),
|
||||||
notify: data => dispatch(doToast(data)),
|
notify: data => dispatch(doToast(data)),
|
||||||
popDrawerStack: () => dispatch(doPopDrawerStack()),
|
popDrawerStack: () => dispatch(doPopDrawerStack()),
|
||||||
|
pushDrawerStack: (routeName, params) => dispatch(doPushDrawerStack(routeName, params)),
|
||||||
purchaseUri: (uri, costInfo, saveFile) => dispatch(doPurchaseUri(uri, costInfo, saveFile)),
|
purchaseUri: (uri, costInfo, saveFile) => dispatch(doPurchaseUri(uri, costInfo, saveFile)),
|
||||||
deletePurchasedUri: uri => dispatch(doDeletePurchasedUri(uri)),
|
deletePurchasedUri: uri => dispatch(doDeletePurchasedUri(uri)),
|
||||||
resolveUri: uri => dispatch(doResolveUri(uri)),
|
resolveUri: uri => dispatch(doResolveUri(uri)),
|
||||||
|
resolveUris: uris => dispatch(doResolveUris(uris)),
|
||||||
sendTip: (amount, claimId, isSupport, successCallback, errorCallback) =>
|
sendTip: (amount, claimId, isSupport, successCallback, errorCallback) =>
|
||||||
dispatch(doSendTip(amount, claimId, isSupport, successCallback, errorCallback)),
|
dispatch(doSendTip(amount, claimId, isSupport, successCallback, errorCallback)),
|
||||||
setPlayerVisible: () => dispatch(doSetPlayerVisible(true)),
|
setPlayerVisible: (visible, uri) => dispatch(doSetPlayerVisible(visible, uri)),
|
||||||
stopDownload: (uri, fileInfo) => dispatch(doStopDownloadingFile(uri, fileInfo)),
|
stopDownload: (uri, fileInfo) => dispatch(doStopDownloadingFile(uri, fileInfo)),
|
||||||
startDownload: (uri, outpoint, fileInfo) => dispatch(doStartDownload(uri, outpoint, fileInfo)),
|
toggleFullscreenMode: mode => dispatch(doToggleFullscreenMode(mode)),
|
||||||
updateDownload: (uri, outpoint, fileInfo, progress) => dispatch(doUpdateDownload(uri, outpoint, fileInfo, progress)),
|
|
||||||
completeDownload: (uri, outpoint, fileInfo) => dispatch(doCompleteDownload(uri, outpoint, fileInfo)),
|
|
||||||
});
|
});
|
||||||
|
|
||||||
export default connect(
|
export default connect(
|
||||||
select,
|
select,
|
||||||
perform
|
perform,
|
||||||
)(FilePage);
|
)(FilePage);
|
||||||
+854
-477
File diff suppressed because it is too large.
Load diff
@@ -1,14 +1,14 @@
|
|||||||
import { connect } from 'react-redux';
|
import { connect } from 'react-redux';
|
||||||
import { doToast } from 'lbry-redux';
|
import { SETTINGS, doToast } from 'lbry-redux';
|
||||||
import {
|
import {
|
||||||
doAuthenticate,
|
doAuthenticate,
|
||||||
doCheckSync,
|
doCheckSync,
|
||||||
doGetSync,
|
doGetSync,
|
||||||
doSetDefaultAccount,
|
|
||||||
doSyncApply,
|
doSyncApply,
|
||||||
doUserEmailNew,
|
doUserEmailNew,
|
||||||
doUserResendVerificationEmail,
|
doUserResendVerificationEmail,
|
||||||
selectAuthToken,
|
selectAuthToken,
|
||||||
|
selectEmailAlreadyExists,
|
||||||
selectEmailNewErrorMessage,
|
selectEmailNewErrorMessage,
|
||||||
selectEmailNewIsPending,
|
selectEmailNewIsPending,
|
||||||
selectEmailToVerify,
|
selectEmailToVerify,
|
||||||
@@ -22,16 +22,19 @@ import {
|
|||||||
selectUser,
|
selectUser,
|
||||||
} from 'lbryinc';
|
} from 'lbryinc';
|
||||||
import { doSetClientSetting } from 'redux/actions/settings';
|
import { doSetClientSetting } from 'redux/actions/settings';
|
||||||
|
import { makeSelectClientSetting } from 'redux/selectors/settings';
|
||||||
import FirstRun from './view';
|
import FirstRun from './view';
|
||||||
|
|
||||||
const select = state => ({
|
const select = state => ({
|
||||||
authenticating: selectAuthenticationIsPending(state),
|
authenticating: selectAuthenticationIsPending(state),
|
||||||
authToken: selectAuthToken(state),
|
authToken: selectAuthToken(state),
|
||||||
emailToVerify: selectEmailToVerify(state),
|
emailToVerify: selectEmailToVerify(state),
|
||||||
|
emailAlreadyExists: selectEmailAlreadyExists(state),
|
||||||
emailNewErrorMessage: selectEmailNewErrorMessage(state),
|
emailNewErrorMessage: selectEmailNewErrorMessage(state),
|
||||||
emailNewPending: selectEmailNewIsPending(state),
|
emailNewPending: selectEmailNewIsPending(state),
|
||||||
hasSyncedWallet: selectHasSyncedWallet(state),
|
hasSyncedWallet: selectHasSyncedWallet(state),
|
||||||
getSyncIsPending: selectGetSyncIsPending(state),
|
getSyncIsPending: selectGetSyncIsPending(state),
|
||||||
|
language: makeSelectClientSetting(SETTINGS.LANGUAGE)(state),
|
||||||
syncApplyErrorMessage: selectSyncApplyErrorMessage(state),
|
syncApplyErrorMessage: selectSyncApplyErrorMessage(state),
|
||||||
syncApplyIsPending: selectSyncApplyIsPending(state),
|
syncApplyIsPending: selectSyncApplyIsPending(state),
|
||||||
syncHash: selectSyncHash(state),
|
syncHash: selectSyncHash(state),
|
||||||
@@ -41,12 +44,11 @@ const select = state => ({
|
|||||||
|
|
||||||
const perform = dispatch => ({
|
const perform = dispatch => ({
|
||||||
addUserEmail: email => dispatch(doUserEmailNew(email)),
|
addUserEmail: email => dispatch(doUserEmailNew(email)),
|
||||||
authenticate: (appVersion, os) => dispatch(doAuthenticate(appVersion, os)),
|
authenticate: (appVersion, os, firebaseToken) => dispatch(doAuthenticate(appVersion, os, firebaseToken)),
|
||||||
setClientSetting: (key, value) => dispatch(doSetClientSetting(key, value)),
|
setClientSetting: (key, value) => dispatch(doSetClientSetting(key, value)),
|
||||||
syncApply: (hash, data, password) => dispatch(doSyncApply(hash, data, password)),
|
syncApply: (hash, data, password) => dispatch(doSyncApply(hash, data, password)),
|
||||||
getSync: password => dispatch(doGetSync(password)),
|
getSync: (password, callback) => dispatch(doGetSync(password, callback)),
|
||||||
checkSync: () => dispatch(doCheckSync()),
|
checkSync: () => dispatch(doCheckSync()),
|
||||||
setDefaultAccount: (success, failure) => dispatch(doSetDefaultAccount(success, failure)),
|
|
||||||
notify: data => dispatch(doToast(data)),
|
notify: data => dispatch(doToast(data)),
|
||||||
resendVerificationEmail: email => dispatch(doUserResendVerificationEmail(email)),
|
resendVerificationEmail: email => dispatch(doUserResendVerificationEmail(email)),
|
||||||
});
|
});
|
||||||
|
|||||||
@@ -3,7 +3,7 @@ import { Lbry } from 'lbry-redux';
|
|||||||
import { NativeModules, Platform, Text, TextInput, View } from 'react-native';
|
import { NativeModules, Platform, Text, TextInput, View } from 'react-native';
|
||||||
import AsyncStorage from '@react-native-community/async-storage';
|
import AsyncStorage from '@react-native-community/async-storage';
|
||||||
import Colors from 'styles/colors';
|
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 firstRunStyle from 'styles/firstRun';
|
||||||
|
|
||||||
class EmailCollectPage extends React.PureComponent {
|
class EmailCollectPage extends React.PureComponent {
|
||||||
@@ -44,7 +44,7 @@ class EmailCollectPage extends React.PureComponent {
|
|||||||
|
|
||||||
const content = (
|
const content = (
|
||||||
<View onLayout={() => onEmailViewLayout('collect')}>
|
<View onLayout={() => onEmailViewLayout('collect')}>
|
||||||
<Text style={firstRunStyle.title}>Setup account</Text>
|
<Text style={firstRunStyle.title}>{__('Setup account')}</Text>
|
||||||
<TextInput
|
<TextInput
|
||||||
style={firstRunStyle.emailInput}
|
style={firstRunStyle.emailInput}
|
||||||
placeholder={this.state.placeholder}
|
placeholder={this.state.placeholder}
|
||||||
@@ -64,10 +64,10 @@ class EmailCollectPage extends React.PureComponent {
|
|||||||
}}
|
}}
|
||||||
/>
|
/>
|
||||||
<Text style={firstRunStyle.paragraph}>
|
<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>
|
||||||
<Text style={firstRunStyle.infoParagraph}>
|
<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>
|
</Text>
|
||||||
</View>
|
</View>
|
||||||
);
|
);
|
||||||
|
|||||||
@@ -4,7 +4,7 @@ import { ActivityIndicator, Linking, NativeModules, Platform, Switch, Text, Text
|
|||||||
import AsyncStorage from '@react-native-community/async-storage';
|
import AsyncStorage from '@react-native-community/async-storage';
|
||||||
import Button from 'component/button';
|
import Button from 'component/button';
|
||||||
import Colors from 'styles/colors';
|
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 Icon from 'react-native-vector-icons/FontAwesome5';
|
||||||
import firstRunStyle from 'styles/firstRun';
|
import firstRunStyle from 'styles/firstRun';
|
||||||
|
|
||||||
@@ -13,28 +13,30 @@ class EmailVerifyPage extends React.PureComponent {
|
|||||||
const { email, notify, resendVerificationEmail } = this.props;
|
const { email, notify, resendVerificationEmail } = this.props;
|
||||||
resendVerificationEmail(email);
|
resendVerificationEmail(email);
|
||||||
AsyncStorage.setItem(Constants.KEY_EMAIL_VERIFY_PENDING, 'true');
|
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() {
|
render() {
|
||||||
const { onEmailViewLayout, email } = this.props;
|
const { onEmailViewLayout, email, emailAlreadyExists } = this.props;
|
||||||
|
|
||||||
const content = (
|
const content = (
|
||||||
<View onLayout={() => onEmailViewLayout('verify')}>
|
<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}>
|
<Text style={firstRunStyle.paragraph}>
|
||||||
An email has been sent to{' '}
|
{__('An email has been sent to')}
|
||||||
<Text style={firstRunStyle.nowrap} numberOfLines={1}>
|
{'\n\n'}
|
||||||
{email}
|
{email}
|
||||||
</Text>
|
{'\n\n'}
|
||||||
. Please follow the instructions in the message to verify your email address.
|
{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>
|
</Text>
|
||||||
|
|
||||||
<View style={firstRunStyle.buttonContainer}>
|
<View style={firstRunStyle.buttonContainer}>
|
||||||
<Button
|
<Button
|
||||||
style={firstRunStyle.verificationButton}
|
style={firstRunStyle.verificationButton}
|
||||||
theme={'light'}
|
theme={'light'}
|
||||||
text={'Resend'}
|
text={__('Resend')}
|
||||||
onPress={this.onResendPressed}
|
onPress={this.onResendPressed}
|
||||||
/>
|
/>
|
||||||
</View>
|
</View>
|
||||||
|
|||||||
@@ -12,7 +12,7 @@ import {
|
|||||||
View,
|
View,
|
||||||
} from 'react-native';
|
} from 'react-native';
|
||||||
import Colors from 'styles/colors';
|
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 Icon from 'react-native-vector-icons/FontAwesome5';
|
||||||
import firstRunStyle from 'styles/firstRun';
|
import firstRunStyle from 'styles/firstRun';
|
||||||
|
|
||||||
@@ -28,10 +28,10 @@ class SkipAccountPage extends React.PureComponent {
|
|||||||
<View onLayout={onSkipAccountViewLayout}>
|
<View onLayout={onSkipAccountViewLayout}>
|
||||||
<View style={firstRunStyle.row}>
|
<View style={firstRunStyle.row}>
|
||||||
<Icon name="exclamation-triangle" style={firstRunStyle.titleIcon} size={32} color={Colors.White} />
|
<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>
|
</View>
|
||||||
<Text style={firstRunStyle.paragraph}>
|
<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>
|
</Text>
|
||||||
|
|
||||||
<View style={[firstRunStyle.row, firstRunStyle.confirmContainer]}>
|
<View style={[firstRunStyle.row, firstRunStyle.confirmContainer]}>
|
||||||
@@ -45,8 +45,9 @@ class SkipAccountPage extends React.PureComponent {
|
|||||||
/>
|
/>
|
||||||
</View>
|
</View>
|
||||||
<Text style={firstRunStyle.rowParagraph}>
|
<Text style={firstRunStyle.rowParagraph}>
|
||||||
I understand that by uninstalling LBRY I will lose any balances or published content with no recovery
|
{__(
|
||||||
option.
|
'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>
|
</Text>
|
||||||
</View>
|
</View>
|
||||||
</View>
|
</View>
|
||||||
|
|||||||
@@ -14,7 +14,7 @@ import {
|
|||||||
import { BarPasswordStrengthDisplay } from 'react-native-password-strength-meter';
|
import { BarPasswordStrengthDisplay } from 'react-native-password-strength-meter';
|
||||||
import AsyncStorage from '@react-native-community/async-storage';
|
import AsyncStorage from '@react-native-community/async-storage';
|
||||||
import Colors from 'styles/colors';
|
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 firstRunStyle from 'styles/firstRun';
|
||||||
import Icon from 'react-native-vector-icons/FontAwesome5';
|
import Icon from 'react-native-vector-icons/FontAwesome5';
|
||||||
|
|
||||||
@@ -28,12 +28,32 @@ class WalletPage extends React.PureComponent {
|
|||||||
walletReady: false,
|
walletReady: false,
|
||||||
hasCheckedSync: false,
|
hasCheckedSync: false,
|
||||||
revealPassword: false,
|
revealPassword: false,
|
||||||
|
autoPassword: false,
|
||||||
|
autoLoginAttempted: false,
|
||||||
};
|
};
|
||||||
|
|
||||||
componentDidMount() {
|
componentDidMount() {
|
||||||
this.checkWalletReady();
|
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 = () => {
|
checkWalletReady = () => {
|
||||||
// make sure the sdk wallet component is ready
|
// make sure the sdk wallet component is ready
|
||||||
Lbry.status()
|
Lbry.status()
|
||||||
@@ -62,31 +82,42 @@ class WalletPage extends React.PureComponent {
|
|||||||
};
|
};
|
||||||
|
|
||||||
render() {
|
render() {
|
||||||
const { onPasswordChanged, onWalletViewLayout, getSyncIsPending, hasSyncedWallet, syncApplyIsPending } = this.props;
|
const {
|
||||||
|
onPasswordChanged,
|
||||||
|
onWalletViewLayout,
|
||||||
|
getSyncIsPending,
|
||||||
|
hasSyncedWallet,
|
||||||
|
syncApplyIsPending,
|
||||||
|
syncApplyStarted,
|
||||||
|
syncApplyCompleted,
|
||||||
|
} = this.props;
|
||||||
|
|
||||||
let content;
|
let content;
|
||||||
if (!this.state.walletReady || !this.state.hasCheckedSync || getSyncIsPending) {
|
if (!this.state.walletReady || !this.state.hasCheckedSync || getSyncIsPending) {
|
||||||
content = (
|
content = (
|
||||||
<View style={firstRunStyle.centered}>
|
<View style={firstRunStyle.centered}>
|
||||||
<ActivityIndicator size="large" color={Colors.White} style={firstRunStyle.waiting} />
|
<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>
|
</View>
|
||||||
);
|
);
|
||||||
} else if (syncApplyIsPending) {
|
} else if (syncApplyStarted || syncApplyIsPending || syncApplyCompleted) {
|
||||||
content = (
|
content = (
|
||||||
<View style={firstRunStyle.centered}>
|
<View style={firstRunStyle.centered}>
|
||||||
<ActivityIndicator size="large" color={Colors.White} style={firstRunStyle.waiting} />
|
<ActivityIndicator size="large" color={Colors.White} style={firstRunStyle.waiting} />
|
||||||
<Text style={firstRunStyle.paragraph}>Validating password...</Text>
|
<Text style={firstRunStyle.paragraph}>
|
||||||
|
{syncApplyIsPending ? __('Validating password') : __('Synchronizing')}...
|
||||||
|
</Text>
|
||||||
</View>
|
</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 = (
|
content = (
|
||||||
<View onLayout={onWalletViewLayout}>
|
<View onLayout={onWalletViewLayout}>
|
||||||
<Text style={firstRunStyle.title}>Password</Text>
|
<Text style={firstRunStyle.title}>{__('Password')}</Text>
|
||||||
<Text style={firstRunStyle.paragraph}>
|
<Text style={firstRunStyle.paragraph}>
|
||||||
{hasSyncedWallet
|
{hasSyncedWallet
|
||||||
? 'Please enter the password you used to secure your wallet.'
|
? __('Please enter the password you used to secure your wallet.')
|
||||||
: 'Please enter a password to secure your account and wallet.'}
|
: __('Please enter a password to secure your account and wallet.')}
|
||||||
</Text>
|
</Text>
|
||||||
<View style={firstRunStyle.passwordInputContainer}>
|
<View style={firstRunStyle.passwordInputContainer}>
|
||||||
<TextInput
|
<TextInput
|
||||||
@@ -115,15 +146,6 @@ class WalletPage extends React.PureComponent {
|
|||||||
<Icon name={this.state.revealPassword ? 'eye-slash' : 'eye'} size={16} style={firstRunStyle.revealIcon} />
|
<Icon name={this.state.revealPassword ? 'eye-slash' : 'eye'} size={16} style={firstRunStyle.revealIcon} />
|
||||||
</TouchableOpacity>
|
</TouchableOpacity>
|
||||||
</View>
|
</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 && (
|
{(!hasSyncedWallet && this.state.password && this.state.password.trim().length) > 0 && (
|
||||||
<View style={firstRunStyle.passwordStrength}>
|
<View style={firstRunStyle.passwordStrength}>
|
||||||
@@ -135,7 +157,7 @@ class WalletPage extends React.PureComponent {
|
|||||||
</View>
|
</View>
|
||||||
)}
|
)}
|
||||||
<Text style={firstRunStyle.infoParagraph}>
|
<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>
|
</Text>
|
||||||
</View>
|
</View>
|
||||||
);
|
);
|
||||||
|
|||||||
@@ -3,7 +3,8 @@ import { Lbry } from 'lbry-redux';
|
|||||||
import { ActivityIndicator, NativeModules, Platform, Text, View } from 'react-native';
|
import { ActivityIndicator, NativeModules, Platform, Text, View } from 'react-native';
|
||||||
import AsyncStorage from '@react-native-community/async-storage';
|
import AsyncStorage from '@react-native-community/async-storage';
|
||||||
import Colors from 'styles/colors';
|
import Colors from 'styles/colors';
|
||||||
import Constants from 'constants';
|
import Constants from 'constants'; // eslint-disable-line node/no-deprecated-api
|
||||||
|
import Link from 'component/link';
|
||||||
import firstRunStyle from 'styles/firstRun';
|
import firstRunStyle from 'styles/firstRun';
|
||||||
|
|
||||||
class WelcomePage extends React.PureComponent {
|
class WelcomePage extends React.PureComponent {
|
||||||
@@ -25,7 +26,7 @@ class WelcomePage extends React.PureComponent {
|
|||||||
} else {
|
} else {
|
||||||
// first_user_auth because it's the first time
|
// first_user_auth because it's the first time
|
||||||
AsyncStorage.getItem(Constants.KEY_FIRST_USER_AUTH).then(firstUserAuth => {
|
AsyncStorage.getItem(Constants.KEY_FIRST_USER_AUTH).then(firstUserAuth => {
|
||||||
if ('true' !== firstUserAuth) {
|
if (firstUserAuth !== 'true') {
|
||||||
// first_user_auth
|
// first_user_auth
|
||||||
NativeModules.Firebase.track('first_user_auth', null);
|
NativeModules.Firebase.track('first_user_auth', null);
|
||||||
AsyncStorage.setItem(Constants.KEY_FIRST_USER_AUTH, 'true');
|
AsyncStorage.setItem(Constants.KEY_FIRST_USER_AUTH, 'true');
|
||||||
@@ -44,31 +45,39 @@ class WelcomePage extends React.PureComponent {
|
|||||||
}
|
}
|
||||||
|
|
||||||
startAuthenticating = () => {
|
startAuthenticating = () => {
|
||||||
const { authenticate } = this.props;
|
|
||||||
this.setState({ authenticationStarted: true, authenticationFailed: false });
|
this.setState({ authenticationStarted: true, authenticationFailed: false });
|
||||||
NativeModules.VersionInfo.getAppVersion().then(appVersion => {
|
NativeModules.VersionInfo.getAppVersion().then(appVersion => {
|
||||||
Lbry.status()
|
NativeModules.Firebase.getMessagingToken()
|
||||||
.then(info => {
|
.then(firebaseToken => this.performAuthenticate(appVersion, firebaseToken))
|
||||||
this.setState({ sdkStarted: true });
|
.catch(() => {
|
||||||
|
this.performAuthenticate(appVersion); /* proceed without firebase */
|
||||||
authenticate(appVersion, Platform.OS);
|
|
||||||
})
|
|
||||||
.catch(error => {
|
|
||||||
if (this.state.statusTries >= WelcomePage.MAX_STATUS_TRIES) {
|
|
||||||
this.setState({ authenticationFailed: true });
|
|
||||||
|
|
||||||
// sdk_start_failed
|
|
||||||
NativeModules.Firebase.track('sdk_start_failed', null);
|
|
||||||
} else {
|
|
||||||
setTimeout(() => {
|
|
||||||
this.startAuthenticating();
|
|
||||||
this.setState({ statusTries: this.state.statusTries + 1 });
|
|
||||||
}, 1000); // Retry every second for a maximum of MAX_STATUS_TRIES tries (60 seconds)
|
|
||||||
}
|
|
||||||
});
|
});
|
||||||
});
|
});
|
||||||
};
|
};
|
||||||
|
|
||||||
|
performAuthenticate(appVersion, firebaseToken) {
|
||||||
|
const { authenticate } = this.props;
|
||||||
|
Lbry.status()
|
||||||
|
.then(info => {
|
||||||
|
this.setState({ sdkStarted: true });
|
||||||
|
|
||||||
|
authenticate(appVersion, Platform.OS, firebaseToken);
|
||||||
|
})
|
||||||
|
.catch(error => {
|
||||||
|
if (this.state.statusTries >= WelcomePage.MAX_STATUS_TRIES) {
|
||||||
|
this.setState({ authenticationFailed: true });
|
||||||
|
|
||||||
|
// sdk_start_failed
|
||||||
|
NativeModules.Firebase.track('sdk_start_failed', null);
|
||||||
|
} else {
|
||||||
|
setTimeout(() => {
|
||||||
|
this.startAuthenticating();
|
||||||
|
this.setState({ statusTries: this.state.statusTries + 1 });
|
||||||
|
}, 1000); // Retry every second for a maximum of MAX_STATUS_TRIES tries (60 seconds)
|
||||||
|
}
|
||||||
|
});
|
||||||
|
}
|
||||||
|
|
||||||
render() {
|
render() {
|
||||||
const { authenticating, authToken, onWelcomePageLayout } = this.props;
|
const { authenticating, authToken, onWelcomePageLayout } = this.props;
|
||||||
|
|
||||||
@@ -78,8 +87,9 @@ class WelcomePage extends React.PureComponent {
|
|||||||
content = (
|
content = (
|
||||||
<View>
|
<View>
|
||||||
<Text style={firstRunStyle.paragraph}>
|
<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>
|
</Text>
|
||||||
</View>
|
</View>
|
||||||
);
|
);
|
||||||
@@ -87,16 +97,22 @@ class WelcomePage extends React.PureComponent {
|
|||||||
content = (
|
content = (
|
||||||
<View style={firstRunStyle.centered}>
|
<View style={firstRunStyle.centered}>
|
||||||
<ActivityIndicator size="large" color={Colors.White} style={firstRunStyle.waiting} />
|
<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>
|
</View>
|
||||||
);
|
);
|
||||||
} else {
|
} else {
|
||||||
content = (
|
content = (
|
||||||
<View onLayout={onWelcomePageLayout}>
|
<View onLayout={onWelcomePageLayout}>
|
||||||
<Text style={firstRunStyle.title}>Welcome to LBRY.</Text>
|
<Text style={firstRunStyle.title}>{__('Welcome to LBRY.')}</Text>
|
||||||
<Text style={firstRunStyle.paragraph}>
|
<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{' '}
|
||||||
|
<Link style={firstRunStyle.tosLink} text={'Terms of Service'} href={'https://lbry.com/termsofservice'} />{' '}
|
||||||
|
and confirm I am over the age of 13.
|
||||||
</Text>
|
</Text>
|
||||||
</View>
|
</View>
|
||||||
);
|
);
|
||||||
|
|||||||
+151
-58
@@ -1,5 +1,5 @@
|
|||||||
import React from 'react';
|
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 { ActivityIndicator, Linking, NativeModules, Text, TouchableOpacity, View } from 'react-native';
|
||||||
import { NavigationActions, StackActions } from 'react-navigation';
|
import { NavigationActions, StackActions } from 'react-navigation';
|
||||||
import AsyncStorage from '@react-native-community/async-storage';
|
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 EmailVerifyPage from './internal/email-verify-page';
|
||||||
import SkipAccountPage from './internal/skip-account-page';
|
import SkipAccountPage from './internal/skip-account-page';
|
||||||
import firstRunStyle from 'styles/firstRun';
|
import firstRunStyle from 'styles/firstRun';
|
||||||
|
import RNFS from 'react-native-fs';
|
||||||
|
|
||||||
class FirstRunScreen extends React.PureComponent {
|
class FirstRunScreen extends React.PureComponent {
|
||||||
static pages = [
|
static pages = [
|
||||||
@@ -27,14 +28,17 @@ class FirstRunScreen extends React.PureComponent {
|
|||||||
emailCollectTracked: false,
|
emailCollectTracked: false,
|
||||||
emailSubmitted: false,
|
emailSubmitted: false,
|
||||||
enterPasswordTracked: false,
|
enterPasswordTracked: false,
|
||||||
|
autoLoginTried: false,
|
||||||
isFirstRun: false,
|
isFirstRun: false,
|
||||||
launchUrl: null,
|
launchUrl: null,
|
||||||
|
languageLoaded: false,
|
||||||
showSkip: false,
|
showSkip: false,
|
||||||
isEmailVerified: false,
|
isEmailVerified: false,
|
||||||
skipAccountConfirmed: false,
|
skipAccountConfirmed: false,
|
||||||
showBottomContainer: false,
|
showBottomContainer: false,
|
||||||
walletPassword: '',
|
walletPassword: '',
|
||||||
syncApplyStarted: false,
|
syncApplyStarted: false,
|
||||||
|
syncApplyCompleted: false,
|
||||||
};
|
};
|
||||||
|
|
||||||
componentDidMount() {
|
componentDidMount() {
|
||||||
@@ -44,29 +48,70 @@ class FirstRunScreen extends React.PureComponent {
|
|||||||
}
|
}
|
||||||
});
|
});
|
||||||
|
|
||||||
if (NativeModules.FirstRun) {
|
NativeModules.UtilityModule.getNativeStringSetting(SETTINGS.LANGUAGE, 'en').then(language =>
|
||||||
NativeModules.FirstRun.isFirstRun().then(firstRun => {
|
this.loadLanguage(language)
|
||||||
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();
|
|
||||||
}
|
|
||||||
}
|
}
|
||||||
|
|
||||||
|
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) {
|
componentWillReceiveProps(nextProps) {
|
||||||
const { emailNewErrorMessage, emailNewPending, syncApplyErrorMessage, syncApplyIsPending, user } = nextProps;
|
const { emailNewErrorMessage, emailNewPending, syncApplyErrorMessage, syncApplyIsPending, user } = nextProps;
|
||||||
const { notify, isApplyingSync, setClientSetting, setDefaultAccount } = this.props;
|
const { notify, isApplyingSync, setClientSetting } = this.props;
|
||||||
|
|
||||||
if (this.state.emailSubmitted && !emailNewPending) {
|
if (this.state.emailSubmitted && !emailNewPending) {
|
||||||
this.setState({ emailSubmitted: false });
|
this.setState({ emailSubmitted: false });
|
||||||
@@ -80,31 +125,43 @@ class FirstRunScreen extends React.PureComponent {
|
|||||||
}
|
}
|
||||||
|
|
||||||
if (this.state.syncApplyStarted && !syncApplyIsPending) {
|
if (this.state.syncApplyStarted && !syncApplyIsPending) {
|
||||||
this.setState({ syncApplyStarted: false });
|
|
||||||
if (syncApplyErrorMessage && syncApplyErrorMessage.trim().length > 0) {
|
if (syncApplyErrorMessage && syncApplyErrorMessage.trim().length > 0) {
|
||||||
notify({ message: syncApplyErrorMessage, isError: true });
|
if (this.state.autoLoginTried) {
|
||||||
this.setState({ showBottomContainer: true });
|
// 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 {
|
} else {
|
||||||
|
this.setState({ syncApplyCompleted: true });
|
||||||
// password successfully verified
|
// password successfully verified
|
||||||
NativeModules.UtilityModule.setSecureValue(Constants.KEY_FIRST_RUN_PASSWORD, this.state.walletPassword);
|
NativeModules.UtilityModule.setSecureValue(
|
||||||
setDefaultAccount(
|
Constants.KEY_WALLET_PASSWORD,
|
||||||
() => {
|
this.state.walletPassword ? this.state.walletPassword : ''
|
||||||
setClientSetting(Constants.SETTING_DEVICE_WALLET_SYNCED, true);
|
|
||||||
|
|
||||||
// unlock the wallet
|
|
||||||
Lbry.account_unlock({ password: this.state.walletPassword ? this.state.walletPassword : '' })
|
|
||||||
.then(() => this.closeFinalPage())
|
|
||||||
.catch(err =>
|
|
||||||
notify({ message: 'The wallet could not be unlocked at this time. Please restart the app.' })
|
|
||||||
);
|
|
||||||
},
|
|
||||||
err => {
|
|
||||||
notify({
|
|
||||||
message:
|
|
||||||
'The account restore operation could not be completed successfully. Please restart the app and try again.',
|
|
||||||
});
|
|
||||||
}
|
|
||||||
);
|
);
|
||||||
|
|
||||||
|
setClientSetting(Constants.SETTING_DEVICE_WALLET_SYNCED, true);
|
||||||
|
Lbry.wallet_status().then(status => {
|
||||||
|
// unlock the wallet
|
||||||
|
if (status.is_locked) {
|
||||||
|
Lbry.wallet_unlock({ password: this.state.walletPassword ? this.state.walletPassword : '' }).then(
|
||||||
|
unlocked => {
|
||||||
|
if (unlocked) {
|
||||||
|
this.closeFinalPage();
|
||||||
|
} else {
|
||||||
|
notify({ message: __('The wallet could not be unlocked at this time. Please restart the app.') });
|
||||||
|
}
|
||||||
|
}
|
||||||
|
);
|
||||||
|
} else {
|
||||||
|
// wallet not locked. close final page
|
||||||
|
this.closeFinalPage();
|
||||||
|
}
|
||||||
|
});
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
@@ -130,9 +187,9 @@ class FirstRunScreen extends React.PureComponent {
|
|||||||
const { navigation } = this.props;
|
const { navigation } = this.props;
|
||||||
const resetAction = StackActions.reset({
|
const resetAction = StackActions.reset({
|
||||||
index: 0,
|
index: 0,
|
||||||
actions: [NavigationActions.navigate({ routeName: 'Splash', params: { launchUri: this.state.launchUri } })],
|
actions: [NavigationActions.navigate({ routeName: 'Splash', params: { launchUri: this.state.launchUrl } })],
|
||||||
});
|
});
|
||||||
navigation.dispatch(resetAction);
|
setTimeout(() => navigation.dispatch(resetAction), 1000);
|
||||||
}
|
}
|
||||||
|
|
||||||
handleLeftButtonPressed = () => {
|
handleLeftButtonPressed = () => {
|
||||||
@@ -161,10 +218,23 @@ class FirstRunScreen extends React.PureComponent {
|
|||||||
});
|
});
|
||||||
};
|
};
|
||||||
|
|
||||||
|
autoLogin = () => {
|
||||||
|
const { hasSyncedWallet } = this.props;
|
||||||
|
if (hasSyncedWallet && !this.state.syncApplyStarted) {
|
||||||
|
this.checkWalletPassword();
|
||||||
|
}
|
||||||
|
};
|
||||||
|
|
||||||
handleContinuePressed = () => {
|
handleContinuePressed = () => {
|
||||||
const { notify, user, hasSyncedWallet } = this.props;
|
const { notify, user, hasSyncedWallet } = this.props;
|
||||||
const pageIndex = FirstRunScreen.pages.indexOf(this.state.currentPage);
|
const pageIndex = FirstRunScreen.pages.indexOf(this.state.currentPage);
|
||||||
if (Constants.FIRST_RUN_PAGE_WALLET === this.state.currentPage) {
|
|
||||||
|
if (Constants.FIRST_RUN_PAGE_WELCOME === this.state.currentPage) {
|
||||||
|
// only show the welcome screen on first run
|
||||||
|
this.closeFinalPage();
|
||||||
|
}
|
||||||
|
|
||||||
|
/* if (Constants.FIRST_RUN_PAGE_WALLET === this.state.currentPage) {
|
||||||
// do apply sync to check if the password is valid
|
// do apply sync to check if the password is valid
|
||||||
if (hasSyncedWallet) {
|
if (hasSyncedWallet) {
|
||||||
this.checkWalletPassword();
|
this.checkWalletPassword();
|
||||||
@@ -175,7 +245,7 @@ class FirstRunScreen extends React.PureComponent {
|
|||||||
}
|
}
|
||||||
|
|
||||||
if (Constants.FIRST_RUN_PAGE_SKIP_ACCOUNT === this.state.currentPage && !this.state.skipAccountConfirmed) {
|
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;
|
return;
|
||||||
}
|
}
|
||||||
|
|
||||||
@@ -192,7 +262,7 @@ class FirstRunScreen extends React.PureComponent {
|
|||||||
} else {
|
} else {
|
||||||
this.showNextPage();
|
this.showNextPage();
|
||||||
}
|
}
|
||||||
}
|
} */
|
||||||
};
|
};
|
||||||
|
|
||||||
handleEmailCollectPageContinue() {
|
handleEmailCollectPageContinue() {
|
||||||
@@ -201,7 +271,7 @@ class FirstRunScreen extends React.PureComponent {
|
|||||||
// validate the email
|
// validate the email
|
||||||
if (!email || email.indexOf('@') === -1) {
|
if (!email || email.indexOf('@') === -1) {
|
||||||
return notify({
|
return notify({
|
||||||
message: 'Please provide a valid email address to continue.',
|
message: __('Please provide a valid email address to continue.'),
|
||||||
});
|
});
|
||||||
}
|
}
|
||||||
|
|
||||||
@@ -233,6 +303,7 @@ class FirstRunScreen extends React.PureComponent {
|
|||||||
|
|
||||||
closeFinalPage() {
|
closeFinalPage() {
|
||||||
// Final page. Let the app know that first run experience is completed.
|
// Final page. Let the app know that first run experience is completed.
|
||||||
|
this.setState({ syncApplyStarted: false });
|
||||||
if (NativeModules.FirstRun) {
|
if (NativeModules.FirstRun) {
|
||||||
NativeModules.FirstRun.firstRunCompleted();
|
NativeModules.FirstRun.firstRunCompleted();
|
||||||
}
|
}
|
||||||
@@ -244,7 +315,7 @@ class FirstRunScreen extends React.PureComponent {
|
|||||||
onEmailChanged = email => {
|
onEmailChanged = email => {
|
||||||
this.setState({ email });
|
this.setState({ email });
|
||||||
if (Constants.FIRST_RUN_PAGE_EMAIL_COLLECT === this.state.currentPage) {
|
if (Constants.FIRST_RUN_PAGE_EMAIL_COLLECT === this.state.currentPage) {
|
||||||
this.setState({ showSkip: !email || email.trim().length === 0 });
|
this.setState({ showSkip: !email || typeof email !== 'string' || email.trim().length === 0 });
|
||||||
} else {
|
} else {
|
||||||
this.setState({ showSkip: false });
|
this.setState({ showSkip: false });
|
||||||
}
|
}
|
||||||
@@ -265,8 +336,12 @@ class FirstRunScreen extends React.PureComponent {
|
|||||||
this.setState({ showBottomContainer: true, showSkip: true });
|
this.setState({ showBottomContainer: true, showSkip: true });
|
||||||
};
|
};
|
||||||
|
|
||||||
onWalletPasswordChanged = password => {
|
onWalletPasswordChanged = (password, finalStep) => {
|
||||||
this.setState({ walletPassword: password !== null ? password : '' });
|
this.setState({ walletPassword: password !== null ? password : '' });
|
||||||
|
if (finalStep) {
|
||||||
|
// final step for a new user
|
||||||
|
this.setFreshPassword();
|
||||||
|
}
|
||||||
};
|
};
|
||||||
|
|
||||||
onWalletViewLayout = () => {
|
onWalletViewLayout = () => {
|
||||||
@@ -295,13 +370,20 @@ class FirstRunScreen extends React.PureComponent {
|
|||||||
const { getSync, setClientSetting } = this.props;
|
const { getSync, setClientSetting } = this.props;
|
||||||
if (NativeModules.UtilityModule) {
|
if (NativeModules.UtilityModule) {
|
||||||
const newPassword = this.state.walletPassword ? this.state.walletPassword : '';
|
const newPassword = this.state.walletPassword ? this.state.walletPassword : '';
|
||||||
NativeModules.UtilityModule.setSecureValue(Constants.KEY_FIRST_RUN_PASSWORD, newPassword);
|
NativeModules.UtilityModule.setSecureValue(Constants.KEY_WALLET_PASSWORD, newPassword);
|
||||||
Lbry.account_encrypt({ new_password: newPassword }).then(() => {
|
if (newPassword.trim().length === 0) {
|
||||||
// fresh account, new password set
|
// blank password. Do not encrypt
|
||||||
getSync(newPassword);
|
getSync(newPassword);
|
||||||
setClientSetting(Constants.SETTING_DEVICE_WALLET_SYNCED, true);
|
setClientSetting(Constants.SETTING_DEVICE_WALLET_SYNCED, true);
|
||||||
this.closeFinalPage();
|
this.closeFinalPage();
|
||||||
});
|
} else {
|
||||||
|
Lbry.wallet_encrypt({ new_password: newPassword }).then(() => {
|
||||||
|
// fresh account, new password set
|
||||||
|
getSync(newPassword);
|
||||||
|
setClientSetting(Constants.SETTING_DEVICE_WALLET_SYNCED, true);
|
||||||
|
this.closeFinalPage();
|
||||||
|
});
|
||||||
|
}
|
||||||
}
|
}
|
||||||
};
|
};
|
||||||
|
|
||||||
@@ -311,9 +393,11 @@ class FirstRunScreen extends React.PureComponent {
|
|||||||
authenticating,
|
authenticating,
|
||||||
authToken,
|
authToken,
|
||||||
checkSync,
|
checkSync,
|
||||||
|
emailAlreadyExists,
|
||||||
emailNewErrorMessage,
|
emailNewErrorMessage,
|
||||||
emailNewPending,
|
emailNewPending,
|
||||||
emailToVerify,
|
emailToVerify,
|
||||||
|
language,
|
||||||
notify,
|
notify,
|
||||||
hasSyncedWallet,
|
hasSyncedWallet,
|
||||||
getSyncIsPending,
|
getSyncIsPending,
|
||||||
@@ -351,6 +435,7 @@ class FirstRunScreen extends React.PureComponent {
|
|||||||
<EmailVerifyPage
|
<EmailVerifyPage
|
||||||
onEmailViewLayout={this.onEmailViewLayout}
|
onEmailViewLayout={this.onEmailViewLayout}
|
||||||
email={this.state.email}
|
email={this.state.email}
|
||||||
|
emailAlreadyExists={emailAlreadyExists}
|
||||||
notify={notify}
|
notify={notify}
|
||||||
resendVerificationEmail={resendVerificationEmail}
|
resendVerificationEmail={resendVerificationEmail}
|
||||||
/>
|
/>
|
||||||
@@ -364,8 +449,11 @@ class FirstRunScreen extends React.PureComponent {
|
|||||||
hasSyncedWallet={hasSyncedWallet}
|
hasSyncedWallet={hasSyncedWallet}
|
||||||
getSyncIsPending={getSyncIsPending}
|
getSyncIsPending={getSyncIsPending}
|
||||||
syncApplyIsPending={syncApplyIsPending}
|
syncApplyIsPending={syncApplyIsPending}
|
||||||
|
syncApplyStarted={this.state.syncApplyStarted}
|
||||||
|
syncApplyCompleted={this.state.syncApplyCompleted}
|
||||||
onWalletViewLayout={this.onWalletViewLayout}
|
onWalletViewLayout={this.onWalletViewLayout}
|
||||||
onPasswordChanged={this.onWalletPasswordChanged}
|
onPasswordChanged={this.onWalletPasswordChanged}
|
||||||
|
autoLogin={this.autoLogin}
|
||||||
/>
|
/>
|
||||||
);
|
);
|
||||||
break;
|
break;
|
||||||
@@ -398,27 +486,32 @@ class FirstRunScreen extends React.PureComponent {
|
|||||||
<Text style={firstRunStyle.buttonText}>
|
<Text style={firstRunStyle.buttonText}>
|
||||||
«{' '}
|
«{' '}
|
||||||
{Constants.FIRST_RUN_PAGE_SKIP_ACCOUNT === this.state.currentPage
|
{Constants.FIRST_RUN_PAGE_SKIP_ACCOUNT === this.state.currentPage
|
||||||
? 'Setup account'
|
? __('Setup account')
|
||||||
: 'Change email'}
|
: __('Change email')}
|
||||||
</Text>
|
</Text>
|
||||||
</TouchableOpacity>
|
</TouchableOpacity>
|
||||||
)}
|
)}
|
||||||
{!emailNewPending && Constants.FIRST_RUN_PAGE_EMAIL_COLLECT === this.state.currentPage && (
|
{!emailNewPending && Constants.FIRST_RUN_PAGE_EMAIL_COLLECT === this.state.currentPage && (
|
||||||
<TouchableOpacity style={firstRunStyle.leftButton} onPress={this.handleLeftButtonPressed}>
|
<TouchableOpacity style={firstRunStyle.leftButton} onPress={this.handleLeftButtonPressed}>
|
||||||
<Text style={firstRunStyle.smallLeftButtonText}>No, thanks »</Text>
|
<Text style={firstRunStyle.smallLeftButtonText}>{__('No, thanks')} »</Text>
|
||||||
</TouchableOpacity>
|
</TouchableOpacity>
|
||||||
)}
|
)}
|
||||||
|
|
||||||
{!emailNewPending && (
|
{!emailNewPending && (
|
||||||
<TouchableOpacity style={firstRunStyle.button} onPress={this.handleContinuePressed}>
|
<TouchableOpacity style={firstRunStyle.button} onPress={this.handleContinuePressed}>
|
||||||
{Constants.FIRST_RUN_PAGE_SKIP_ACCOUNT === this.state.currentPage && (
|
{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_SKIP_ACCOUNT !== this.state.currentPage &&
|
||||||
Constants.FIRST_RUN_PAGE_EMAIL_VERIFY !== this.state.currentPage && (
|
Constants.FIRST_RUN_PAGE_EMAIL_VERIFY !== this.state.currentPage && (
|
||||||
<Text style={firstRunStyle.buttonText}>
|
<Text style={firstRunStyle.buttonText}>
|
||||||
{Constants.FIRST_RUN_PAGE_WALLET === this.state.currentPage ? 'Use LBRY' : 'Continue'} »
|
{[Constants.FIRST_RUN_PAGE_WALLET, Constants.FIRST_RUN_PAGE_WELCOME].includes(
|
||||||
|
this.state.currentPage
|
||||||
|
)
|
||||||
|
? __('Use LBRY')
|
||||||
|
: __('Continue')}{' '}
|
||||||
|
»
|
||||||
</Text>
|
</Text>
|
||||||
)}
|
)}
|
||||||
</TouchableOpacity>
|
</TouchableOpacity>
|
||||||
|
|||||||
@@ -0,0 +1,46 @@
|
|||||||
|
import { connect } from 'react-redux';
|
||||||
|
import { selectMyChannelClaims, selectFetchingMyChannels, doFetchChannelListMine, doToast } from 'lbry-redux';
|
||||||
|
import {
|
||||||
|
selectReferralReward,
|
||||||
|
selectUserInvitesRemaining,
|
||||||
|
selectUserInviteNewIsPending,
|
||||||
|
selectUserInviteNewErrorMessage,
|
||||||
|
selectUserInviteReferralLink,
|
||||||
|
selectUserInviteReferralCode,
|
||||||
|
selectUserInvitees,
|
||||||
|
selectUserInviteStatusIsPending,
|
||||||
|
doFetchInviteStatus,
|
||||||
|
doUserInviteNew,
|
||||||
|
} from 'lbryinc';
|
||||||
|
import { doPushDrawerStack, doPopDrawerStack, doSetPlayerVisible } from 'redux/actions/drawer';
|
||||||
|
import { doUpdateChannelFormState, doClearChannelFormState } from 'redux/actions/form';
|
||||||
|
import { selectDrawerStack } from 'redux/selectors/drawer';
|
||||||
|
import { selectChannelFormState, selectHasChannelFormState } from 'redux/selectors/form';
|
||||||
|
import Constants from 'constants'; // eslint-disable-line node/no-deprecated-api
|
||||||
|
import InvitesPage from './view';
|
||||||
|
|
||||||
|
const select = state => ({
|
||||||
|
channels: selectMyChannelClaims(state),
|
||||||
|
fetchingChannels: selectFetchingMyChannels(state),
|
||||||
|
fetchingInvitees: selectUserInviteStatusIsPending(state),
|
||||||
|
errorMessage: selectUserInviteNewErrorMessage(state),
|
||||||
|
invitesRemaining: selectUserInvitesRemaining(state),
|
||||||
|
referralCode: selectUserInviteReferralCode(state),
|
||||||
|
isPending: selectUserInviteNewIsPending(state),
|
||||||
|
invitees: selectUserInvitees(state),
|
||||||
|
referralReward: selectReferralReward(state),
|
||||||
|
});
|
||||||
|
|
||||||
|
const perform = dispatch => ({
|
||||||
|
fetchChannelListMine: () => dispatch(doFetchChannelListMine()),
|
||||||
|
fetchInviteStatus: () => dispatch(doFetchInviteStatus()),
|
||||||
|
inviteNew: email => dispatch(doUserInviteNew(email)),
|
||||||
|
pushDrawerStack: () => dispatch(doPushDrawerStack(Constants.DRAWER_ROUTE_INVITES)),
|
||||||
|
setPlayerVisible: () => dispatch(doSetPlayerVisible(false)),
|
||||||
|
notify: data => dispatch(doToast(data)),
|
||||||
|
});
|
||||||
|
|
||||||
|
export default connect(
|
||||||
|
select,
|
||||||
|
perform,
|
||||||
|
)(InvitesPage);
|
||||||
@@ -0,0 +1,228 @@
|
|||||||
|
import React from 'react';
|
||||||
|
import { Lbry, parseURI } from 'lbry-redux';
|
||||||
|
import {
|
||||||
|
ActivityIndicator,
|
||||||
|
Clipboard,
|
||||||
|
NativeModules,
|
||||||
|
ScrollView,
|
||||||
|
Text,
|
||||||
|
TextInput,
|
||||||
|
TouchableOpacity,
|
||||||
|
View,
|
||||||
|
} from 'react-native';
|
||||||
|
import Colors from 'styles/colors';
|
||||||
|
import Constants from 'constants'; // eslint-disable-line node/no-deprecated-api
|
||||||
|
import Icon from 'react-native-vector-icons/FontAwesome5';
|
||||||
|
import Link from 'component/link';
|
||||||
|
import Button from 'component/button';
|
||||||
|
import ChannelSelector from 'component/channelSelector';
|
||||||
|
import PageHeader from 'component/pageHeader';
|
||||||
|
import RewardCard from 'component/rewardCard';
|
||||||
|
import RewardEnrolment from 'component/rewardEnrolment';
|
||||||
|
import UriBar from 'component/uriBar';
|
||||||
|
import invitesStyle from 'styles/invites';
|
||||||
|
|
||||||
|
class InvitesPage extends React.PureComponent {
|
||||||
|
state = {
|
||||||
|
channelName: null,
|
||||||
|
email: null,
|
||||||
|
inviteLink: null,
|
||||||
|
selectedChannel: null,
|
||||||
|
};
|
||||||
|
|
||||||
|
componentWillMount() {
|
||||||
|
const { navigation } = this.props;
|
||||||
|
// this.didFocusListener = navigation.addListener('didFocus', this.onComponentFocused);
|
||||||
|
}
|
||||||
|
|
||||||
|
componentWillUnmount() {
|
||||||
|
if (this.didFocusListener) {
|
||||||
|
this.didFocusListener.remove();
|
||||||
|
}
|
||||||
|
}
|
||||||
|
|
||||||
|
onComponentFocused = () => {
|
||||||
|
const { fetchChannelListMine, fetchInviteStatus, pushDrawerStack, navigation, setPlayerVisible, user } = this.props;
|
||||||
|
|
||||||
|
pushDrawerStack();
|
||||||
|
setPlayerVisible();
|
||||||
|
NativeModules.Firebase.setCurrentScreen('Invites').then(result => {
|
||||||
|
fetchChannelListMine();
|
||||||
|
fetchInviteStatus();
|
||||||
|
});
|
||||||
|
};
|
||||||
|
|
||||||
|
componentDidMount() {
|
||||||
|
this.onComponentFocused();
|
||||||
|
}
|
||||||
|
|
||||||
|
handleChannelChange = channelName => {
|
||||||
|
const { channels = [] } = this.props;
|
||||||
|
if (channels && channels.length > 0) {
|
||||||
|
const filtered = channels.filter(c => c.name === channelName);
|
||||||
|
if (filtered.length > 0) {
|
||||||
|
const channel = filtered[0];
|
||||||
|
this.setState({ channelName, inviteLink: this.getLinkForChannel(channel) });
|
||||||
|
}
|
||||||
|
}
|
||||||
|
};
|
||||||
|
|
||||||
|
getLinkForChannel = channel => {
|
||||||
|
const { claimId, claimName } = parseURI(channel.permanent_url);
|
||||||
|
return `https://lbry.tv/$/invite/${claimName}:${claimId}`;
|
||||||
|
};
|
||||||
|
|
||||||
|
handleInviteEmailChange = text => {
|
||||||
|
this.setState({ email: text });
|
||||||
|
};
|
||||||
|
|
||||||
|
handleInvitePress = () => {
|
||||||
|
const { inviteNew, notify } = this.props;
|
||||||
|
const { email } = this.state;
|
||||||
|
if (!email || email.indexOf('@') === -1) {
|
||||||
|
return notify({
|
||||||
|
message: __('Please enter a valid email address to send an invite to.'),
|
||||||
|
isError: true,
|
||||||
|
});
|
||||||
|
}
|
||||||
|
|
||||||
|
inviteNew(email);
|
||||||
|
};
|
||||||
|
|
||||||
|
componentWillReceiveProps(nextProps) {
|
||||||
|
const { isPending: prevPending, notify } = this.props;
|
||||||
|
const { channels = [], isPending, errorMessage } = nextProps;
|
||||||
|
const { email } = this.state;
|
||||||
|
|
||||||
|
if (!this.state.channelName && channels && channels.length > 0) {
|
||||||
|
const firstChannel = channels[0];
|
||||||
|
this.setState({ channelName: firstChannel.name, inviteLink: this.getLinkForChannel(firstChannel) });
|
||||||
|
}
|
||||||
|
|
||||||
|
if (prevPending && !isPending) {
|
||||||
|
if (errorMessage && errorMessage.trim().length > 0) {
|
||||||
|
notify({ message: errorMessage, isError: true });
|
||||||
|
} else {
|
||||||
|
notify({ message: __(`${email} was invited to the LBRY party!`) });
|
||||||
|
this.setState({ email: null });
|
||||||
|
}
|
||||||
|
}
|
||||||
|
}
|
||||||
|
|
||||||
|
handleInviteLinkPress = () => {
|
||||||
|
const { notify } = this.props;
|
||||||
|
Clipboard.setString(this.state.inviteLink);
|
||||||
|
notify({
|
||||||
|
message: __('Invite link copied'),
|
||||||
|
});
|
||||||
|
};
|
||||||
|
|
||||||
|
render() {
|
||||||
|
const { fetchingInvitees, user, navigation, notify, isPending, invitees } = this.props;
|
||||||
|
const { email, inviteLink } = this.state;
|
||||||
|
const hasInvitees = invitees && invitees.length > 0;
|
||||||
|
|
||||||
|
return (
|
||||||
|
<View style={invitesStyle.container}>
|
||||||
|
<UriBar navigation={navigation} />
|
||||||
|
|
||||||
|
<ScrollView style={invitesStyle.scrollContainer}>
|
||||||
|
<TouchableOpacity style={invitesStyle.rewardDriverCard} onPress={() => navigation.navigate('Rewards')}>
|
||||||
|
<Icon name="award" size={16} style={invitesStyle.rewardDriverIcon} />
|
||||||
|
<Text style={invitesStyle.rewardDriverText}>{__('Earn rewards for inviting your friends.')}</Text>
|
||||||
|
</TouchableOpacity>
|
||||||
|
|
||||||
|
<View style={invitesStyle.card}>
|
||||||
|
<Text style={invitesStyle.title}>{__('Invite Link')}</Text>
|
||||||
|
<Text style={invitesStyle.text}>
|
||||||
|
{__('Share this link with friends (or enemies) and get 20 LBC when they join lbry.tv')}
|
||||||
|
</Text>
|
||||||
|
|
||||||
|
<Text style={invitesStyle.subTitle}>{__('Your invite link')}</Text>
|
||||||
|
<View style={invitesStyle.row}>
|
||||||
|
<Text selectable numberOfLines={1} style={invitesStyle.inviteLink} onPress={this.handleInviteLinkPress}>
|
||||||
|
{this.state.inviteLink}
|
||||||
|
</Text>
|
||||||
|
<Button icon={'clipboard'} style={invitesStyle.button} onPress={this.handleInviteLinkPress} />
|
||||||
|
</View>
|
||||||
|
|
||||||
|
<Text style={invitesStyle.customizeTitle}>{__('Customize invite link')}</Text>
|
||||||
|
<ChannelSelector
|
||||||
|
showAnonymous={false}
|
||||||
|
channelName={this.state.channelName}
|
||||||
|
onChannelChange={this.handleChannelChange}
|
||||||
|
/>
|
||||||
|
</View>
|
||||||
|
|
||||||
|
<View style={invitesStyle.card}>
|
||||||
|
<Text style={invitesStyle.title}>{__('Invite by Email')}</Text>
|
||||||
|
<Text style={invitesStyle.text}>
|
||||||
|
{__('Invite someone you know by email and earn 20 LBC when they join lbry.tv.')}
|
||||||
|
</Text>
|
||||||
|
|
||||||
|
<TextInput
|
||||||
|
style={invitesStyle.emailInput}
|
||||||
|
editable={!isPending}
|
||||||
|
value={this.state.email}
|
||||||
|
onChangeText={this.handleInviteEmailChange}
|
||||||
|
placeholder={__('imaginary@friend.com')}
|
||||||
|
underlineColorAndroid={Colors.NextLbryGreen}
|
||||||
|
/>
|
||||||
|
<View style={invitesStyle.rightRow}>
|
||||||
|
{isPending && (
|
||||||
|
<ActivityIndicator size={'small'} color={Colors.NextLbryGreen} style={invitesStyle.loading} />
|
||||||
|
)}
|
||||||
|
<Button
|
||||||
|
disabled={!email || email.indexOf('@') === -1 || isPending}
|
||||||
|
style={invitesStyle.button}
|
||||||
|
text={__('Invite')}
|
||||||
|
onPress={this.handleInvitePress}
|
||||||
|
/>
|
||||||
|
</View>
|
||||||
|
</View>
|
||||||
|
|
||||||
|
<View style={[invitesStyle.card, invitesStyle.lastCard]}>
|
||||||
|
<View style={invitesStyle.titleRow}>
|
||||||
|
<Text style={invitesStyle.titleCol}>{__('Invite History')}</Text>
|
||||||
|
{fetchingInvitees && <ActivityIndicator size={'small'} color={Colors.NextLbryGreen} />}
|
||||||
|
</View>
|
||||||
|
|
||||||
|
<Text style={invitesStyle.text}>
|
||||||
|
{__(
|
||||||
|
'Earn 20 LBC for inviting a friend, an enemy, a frenemy, or an enefriend. Everyone needs content freedom.',
|
||||||
|
)}
|
||||||
|
</Text>
|
||||||
|
|
||||||
|
<View style={invitesStyle.invitees}>
|
||||||
|
{hasInvitees && (
|
||||||
|
<View style={invitesStyle.inviteesHeader}>
|
||||||
|
<Text style={invitesStyle.emailHeader} numberOfLines={1}>
|
||||||
|
{__('Email')}
|
||||||
|
</Text>
|
||||||
|
<Text style={invitesStyle.rewardHeader} numberOfLines={1}>
|
||||||
|
{__('Reward')}
|
||||||
|
</Text>
|
||||||
|
</View>
|
||||||
|
)}
|
||||||
|
{hasInvitees &&
|
||||||
|
invitees.map(invitee => (
|
||||||
|
<View key={invitee.email} style={invitesStyle.inviteeItem}>
|
||||||
|
<Text style={invitesStyle.inviteeEmail} numberOfLines={1}>
|
||||||
|
{invitee.email}
|
||||||
|
</Text>
|
||||||
|
<Text style={invitesStyle.rewardStatus} numberOfLines={1}>
|
||||||
|
{invitee.invite_reward_claimed && __('Claimed')}
|
||||||
|
{!invitee.invite_reward_claimed &&
|
||||||
|
(invitee.invite_reward_claimable ? __('Claimable') : __('Unclaimable'))}
|
||||||
|
</Text>
|
||||||
|
</View>
|
||||||
|
))}
|
||||||
|
</View>
|
||||||
|
</View>
|
||||||
|
</ScrollView>
|
||||||
|
</View>
|
||||||
|
);
|
||||||
|
}
|
||||||
|
}
|
||||||
|
|
||||||
|
export default InvitesPage;
|
||||||
@@ -1,15 +1,16 @@
|
|||||||
import { connect } from 'react-redux';
|
import { connect } from 'react-redux';
|
||||||
import {
|
import {
|
||||||
doPublish,
|
doPublish,
|
||||||
|
doFetchClaimListMine,
|
||||||
doResolveUri,
|
doResolveUri,
|
||||||
doToast,
|
doToast,
|
||||||
doUpdatePublishForm,
|
doUpdatePublishForm,
|
||||||
doUploadThumbnail,
|
|
||||||
selectBalance,
|
selectBalance,
|
||||||
|
selectMyClaims,
|
||||||
selectPublishFormValues,
|
selectPublishFormValues,
|
||||||
} from 'lbry-redux';
|
} from 'lbry-redux';
|
||||||
import { selectDrawerStack } from 'redux/selectors/drawer';
|
import { selectDrawerStack } from 'redux/selectors/drawer';
|
||||||
import { doUpdatePublishFormState, doClearPublishFormState } from 'redux/actions/form';
|
import { doUpdatePublishFormState, doClearPublishFormState, doPendingPublishSuccess } from 'redux/actions/form';
|
||||||
import { doPushDrawerStack, doPopDrawerStack, doSetPlayerVisible } from 'redux/actions/drawer';
|
import { doPushDrawerStack, doPopDrawerStack, doSetPlayerVisible } from 'redux/actions/drawer';
|
||||||
import { selectPublishFormState, selectHasPublishFormState } from 'redux/selectors/form';
|
import { selectPublishFormState, selectHasPublishFormState } from 'redux/selectors/form';
|
||||||
import Constants from 'constants'; // eslint-disable-line node/no-deprecated-api
|
import Constants from 'constants'; // eslint-disable-line node/no-deprecated-api
|
||||||
@@ -19,6 +20,7 @@ const select = state => ({
|
|||||||
balance: selectBalance(state),
|
balance: selectBalance(state),
|
||||||
drawerStack: selectDrawerStack(state),
|
drawerStack: selectDrawerStack(state),
|
||||||
hasFormState: selectHasPublishFormState(state),
|
hasFormState: selectHasPublishFormState(state),
|
||||||
|
myClaims: selectMyClaims(state),
|
||||||
publishFormState: selectPublishFormState(state),
|
publishFormState: selectPublishFormState(state),
|
||||||
publishFormValues: selectPublishFormValues(state),
|
publishFormValues: selectPublishFormValues(state),
|
||||||
});
|
});
|
||||||
@@ -26,9 +28,10 @@ const select = state => ({
|
|||||||
const perform = dispatch => ({
|
const perform = dispatch => ({
|
||||||
notify: data => dispatch(doToast(data)),
|
notify: data => dispatch(doToast(data)),
|
||||||
clearPublishFormState: () => dispatch(doClearPublishFormState()),
|
clearPublishFormState: () => dispatch(doClearPublishFormState()),
|
||||||
|
fetchMyClaims: () => dispatch(doFetchClaimListMine()),
|
||||||
|
pendingPublishSuccess: pendingClaim => dispatch(doPendingPublishSuccess(pendingClaim)),
|
||||||
updatePublishForm: value => dispatch(doUpdatePublishForm(value)),
|
updatePublishForm: value => dispatch(doUpdatePublishForm(value)),
|
||||||
updatePublishFormState: data => dispatch(doUpdatePublishFormState(data)),
|
updatePublishFormState: data => dispatch(doUpdatePublishFormState(data)),
|
||||||
uploadThumbnail: (filePath, fsAdapter) => dispatch(doUploadThumbnail(filePath, null, fsAdapter)),
|
|
||||||
publish: (success, fail) => dispatch(doPublish(success, fail)),
|
publish: (success, fail) => dispatch(doPublish(success, fail)),
|
||||||
resolveUri: uri => dispatch(doResolveUri(uri)),
|
resolveUri: uri => dispatch(doResolveUri(uri)),
|
||||||
pushDrawerStack: (routeName, params) => dispatch(doPushDrawerStack(routeName, params)),
|
pushDrawerStack: (routeName, params) => dispatch(doPushDrawerStack(routeName, params)),
|
||||||
@@ -38,5 +41,5 @@ const perform = dispatch => ({
|
|||||||
|
|
||||||
export default connect(
|
export default connect(
|
||||||
select,
|
select,
|
||||||
perform
|
perform,
|
||||||
)(PublishPage);
|
)(PublishPage);
|
||||||
+341
-143
@@ -16,11 +16,15 @@ import {
|
|||||||
} from 'react-native';
|
} from 'react-native';
|
||||||
import { FlatGrid } from 'react-native-super-grid';
|
import { FlatGrid } from 'react-native-super-grid';
|
||||||
import {
|
import {
|
||||||
|
Lbry,
|
||||||
isNameValid,
|
isNameValid,
|
||||||
|
batchActions,
|
||||||
buildURI,
|
buildURI,
|
||||||
|
formatCredits,
|
||||||
normalizeURI,
|
normalizeURI,
|
||||||
parseURI,
|
parseURI,
|
||||||
regexInvalidURI,
|
regexInvalidURI,
|
||||||
|
ACTIONS,
|
||||||
CLAIM_VALUES,
|
CLAIM_VALUES,
|
||||||
LICENSES,
|
LICENSES,
|
||||||
MATURE_TAGS,
|
MATURE_TAGS,
|
||||||
@@ -43,7 +47,7 @@ import Tag from 'component/tag';
|
|||||||
import TagSearch from 'component/tagSearch';
|
import TagSearch from 'component/tagSearch';
|
||||||
import UriBar from 'component/uriBar';
|
import UriBar from 'component/uriBar';
|
||||||
import publishStyle from 'styles/publish';
|
import publishStyle from 'styles/publish';
|
||||||
import { __, navigateToUri } from 'utils/helper';
|
import { navigateToUri, logPublish, uploadImageAsset } from 'utils/helper';
|
||||||
|
|
||||||
const languages = {
|
const languages = {
|
||||||
en: 'English',
|
en: 'English',
|
||||||
@@ -76,9 +80,12 @@ const languages = {
|
|||||||
class PublishPage extends React.PureComponent {
|
class PublishPage extends React.PureComponent {
|
||||||
camera = null;
|
camera = null;
|
||||||
|
|
||||||
|
scrollView = null;
|
||||||
|
|
||||||
state = {
|
state = {
|
||||||
canPublish: false,
|
canPublish: true,
|
||||||
canUseCamera: false,
|
canUseCamera: false,
|
||||||
|
creditsInputFocused: false,
|
||||||
documentPickerOpen: false,
|
documentPickerOpen: false,
|
||||||
editMode: false,
|
editMode: false,
|
||||||
titleFocused: false,
|
titleFocused: false,
|
||||||
@@ -129,8 +136,11 @@ class PublishPage extends React.PureComponent {
|
|||||||
uploadedThumbnailUri: null,
|
uploadedThumbnailUri: null,
|
||||||
vanityUrlSet: false,
|
vanityUrlSet: false,
|
||||||
|
|
||||||
|
thumbnailImagePickerOpen: false,
|
||||||
|
|
||||||
// other
|
// other
|
||||||
publishStarted: false,
|
publishStarted: false,
|
||||||
|
storagePermissionRequired: false,
|
||||||
};
|
};
|
||||||
|
|
||||||
didFocusListener;
|
didFocusListener;
|
||||||
@@ -152,6 +162,8 @@ class PublishPage extends React.PureComponent {
|
|||||||
DeviceEventEmitter.removeListener('onAllGalleryThumbnailsChecked', this.handleAllGalleryThumbnailsChecked);
|
DeviceEventEmitter.removeListener('onAllGalleryThumbnailsChecked', this.handleAllGalleryThumbnailsChecked);
|
||||||
DeviceEventEmitter.removeListener('onDocumentPickerFilePicked', this.onFilePicked);
|
DeviceEventEmitter.removeListener('onDocumentPickerFilePicked', this.onFilePicked);
|
||||||
DeviceEventEmitter.removeListener('onDocumentPickerCanceled', this.onPickerCanceled);
|
DeviceEventEmitter.removeListener('onDocumentPickerCanceled', this.onPickerCanceled);
|
||||||
|
DeviceEventEmitter.removeListener('onStoragePermissionGranted', this.handleStoragePermissionGranted);
|
||||||
|
DeviceEventEmitter.removeListener('onStoragePermissionRefused', this.handleStoragePermissionRefused);
|
||||||
}
|
}
|
||||||
|
|
||||||
handleGalleryThumbnailChecked = evt => {
|
handleGalleryThumbnailChecked = evt => {
|
||||||
@@ -174,23 +186,51 @@ class PublishPage extends React.PureComponent {
|
|||||||
this.setState({ ...publishFormState, advancedMode });
|
this.setState({ ...publishFormState, advancedMode });
|
||||||
};
|
};
|
||||||
|
|
||||||
|
checkStoragePermission = () => {
|
||||||
|
// check if we the permission to write to external storage has been granted
|
||||||
|
NativeModules.UtilityModule.canReadWriteStorage().then(canReadWrite => {
|
||||||
|
if (!canReadWrite) {
|
||||||
|
// request permission
|
||||||
|
NativeModules.UtilityModule.requestStoragePermission();
|
||||||
|
}
|
||||||
|
});
|
||||||
|
};
|
||||||
|
|
||||||
|
loadVideos = () => {
|
||||||
|
this.setState(
|
||||||
|
{
|
||||||
|
loadingVideos: true,
|
||||||
|
storagePermissionRequired: false,
|
||||||
|
},
|
||||||
|
() => {
|
||||||
|
NativeModules.Gallery.getVideos().then(videos => this.setState({ videos, loadingVideos: false }));
|
||||||
|
},
|
||||||
|
);
|
||||||
|
};
|
||||||
|
|
||||||
onComponentFocused = () => {
|
onComponentFocused = () => {
|
||||||
const { balance, hasFormState, pushDrawerStack, setPlayerVisible, navigation } = this.props;
|
const { balance, fetchMyClaims, hasFormState, pushDrawerStack, setPlayerVisible, navigation } = this.props;
|
||||||
NativeModules.Firebase.setCurrentScreen('Publish').then(result => {
|
NativeModules.Firebase.setCurrentScreen('Publish').then(result => {
|
||||||
pushDrawerStack(Constants.DRAWER_ROUTE_PUBLISH, navigation.state.params ? navigation.state.params : null);
|
pushDrawerStack(Constants.DRAWER_ROUTE_PUBLISH, navigation.state.params ? navigation.state.params : null);
|
||||||
setPlayerVisible();
|
setPlayerVisible();
|
||||||
|
|
||||||
|
DeviceEventEmitter.addListener('onStoragePermissionGranted', this.handleStoragePermissionGranted);
|
||||||
|
DeviceEventEmitter.addListener('onStoragePermissionRefused', this.handleStoragePermissionRefused);
|
||||||
|
|
||||||
NativeModules.Gallery.canUseCamera().then(canUseCamera => this.setState({ canUseCamera }));
|
NativeModules.Gallery.canUseCamera().then(canUseCamera => this.setState({ canUseCamera }));
|
||||||
NativeModules.Gallery.getThumbnailPath().then(thumbnailPath => this.setState({ thumbnailPath }));
|
NativeModules.Gallery.getThumbnailPath().then(thumbnailPath => this.setState({ thumbnailPath }));
|
||||||
this.setState(
|
fetchMyClaims();
|
||||||
{
|
|
||||||
canPublish: balance >= 0.1,
|
NativeModules.UtilityModule.canReadWriteStorage().then(canReadWrite => {
|
||||||
loadingVideos: true,
|
if (!canReadWrite) {
|
||||||
},
|
this.setState({ storagePermissionRequired: true }, () =>
|
||||||
() => {
|
NativeModules.UtilityModule.requestStoragePermission(),
|
||||||
NativeModules.Gallery.getVideos().then(videos => this.setState({ videos, loadingVideos: false }));
|
);
|
||||||
|
} else {
|
||||||
|
// Can only load videos when the storage permission is granted
|
||||||
|
this.loadVideos();
|
||||||
}
|
}
|
||||||
);
|
});
|
||||||
|
|
||||||
// Check if this is an edit action
|
// Check if this is an edit action
|
||||||
let isEditMode = false,
|
let isEditMode = false,
|
||||||
@@ -218,10 +258,8 @@ class PublishPage extends React.PureComponent {
|
|||||||
// replace name with the specified vanity URL if there was one in the pending state
|
// replace name with the specified vanity URL if there was one in the pending state
|
||||||
this.setState({ name: this.state.vanityUrl });
|
this.setState({ name: this.state.vanityUrl });
|
||||||
}
|
}
|
||||||
this.setState({ currentPhase: Constants.PHASE_DETAILS });
|
|
||||||
} else {
|
|
||||||
this.setState({ currentPhase: Constants.PHASE_SELECTOR });
|
|
||||||
}
|
}
|
||||||
|
this.setState({ currentPhase: isEditMode || hasFormState ? Constants.PHASE_DETAILS : Constants.PHASE_SELECTOR });
|
||||||
});
|
});
|
||||||
};
|
};
|
||||||
|
|
||||||
@@ -256,6 +294,7 @@ class PublishPage extends React.PureComponent {
|
|||||||
this.setState(
|
this.setState(
|
||||||
{
|
{
|
||||||
editMode: true,
|
editMode: true,
|
||||||
|
publishStarted: false,
|
||||||
currentPhase: Constants.PHASE_DETAILS,
|
currentPhase: Constants.PHASE_DETAILS,
|
||||||
|
|
||||||
hasEditedContentAddress: true,
|
hasEditedContentAddress: true,
|
||||||
@@ -282,7 +321,7 @@ class PublishPage extends React.PureComponent {
|
|||||||
this.handleChannelChange(channelName);
|
this.handleChannelChange(channelName);
|
||||||
}
|
}
|
||||||
pushDrawerStack(Constants.DRAWER_ROUTE_PUBLISH_FORM);
|
pushDrawerStack(Constants.DRAWER_ROUTE_PUBLISH_FORM);
|
||||||
}
|
},
|
||||||
);
|
);
|
||||||
};
|
};
|
||||||
|
|
||||||
@@ -318,7 +357,7 @@ class PublishPage extends React.PureComponent {
|
|||||||
};
|
};
|
||||||
|
|
||||||
handlePublishPressed = () => {
|
handlePublishPressed = () => {
|
||||||
const { notify, publish, updatePublishForm } = this.props;
|
const { balance, myClaims, notify, publish, updatePublishForm } = this.props;
|
||||||
const {
|
const {
|
||||||
editMode,
|
editMode,
|
||||||
bid,
|
bid,
|
||||||
@@ -339,19 +378,45 @@ class PublishPage extends React.PureComponent {
|
|||||||
uri,
|
uri,
|
||||||
} = this.state;
|
} = this.state;
|
||||||
|
|
||||||
|
if (balance < Constants.MINIMUM_TRANSACTION_BALANCE) {
|
||||||
|
notify({
|
||||||
|
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 });
|
||||||
|
}
|
||||||
|
return;
|
||||||
|
}
|
||||||
|
|
||||||
if (!title || title.trim().length === 0) {
|
if (!title || title.trim().length === 0) {
|
||||||
notify({ message: 'Please provide a title' });
|
notify({ message: __('Please provide a title'), isError: true });
|
||||||
return;
|
return;
|
||||||
}
|
}
|
||||||
|
|
||||||
if (!name) {
|
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.'), isError: true });
|
||||||
return;
|
return;
|
||||||
}
|
}
|
||||||
|
|
||||||
|
if (!isNameValid(name, false)) {
|
||||||
|
notify({ message: __('Your content address contains invalid characters.'), isError: true });
|
||||||
|
return;
|
||||||
|
} else if (!editMode && myClaims && myClaims.length > 0) {
|
||||||
|
if (myClaims.some(claim => claim.name.toLowerCase() === name.trim().toLowerCase())) {
|
||||||
|
notify({
|
||||||
|
message: __('You have already published to the specified content address. Please enter a new address.'),
|
||||||
|
isError: true,
|
||||||
|
});
|
||||||
|
return;
|
||||||
|
}
|
||||||
|
}
|
||||||
|
|
||||||
if (!currentMedia && !editMode) {
|
if (!currentMedia && !editMode) {
|
||||||
// sanity check. normally shouldn't happen
|
// 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.'),
|
||||||
|
isError: true,
|
||||||
|
});
|
||||||
return;
|
return;
|
||||||
}
|
}
|
||||||
|
|
||||||
@@ -359,7 +424,7 @@ class PublishPage extends React.PureComponent {
|
|||||||
filePath: currentMedia ? currentMedia.filePath : null,
|
filePath: currentMedia ? currentMedia.filePath : null,
|
||||||
bid: bid || 0.1,
|
bid: bid || 0.1,
|
||||||
title: title || '',
|
title: title || '',
|
||||||
thumbnail,
|
thumbnail: thumbnail || '',
|
||||||
description: description || '',
|
description: description || '',
|
||||||
language,
|
language,
|
||||||
license,
|
license,
|
||||||
@@ -382,10 +447,17 @@ class PublishPage extends React.PureComponent {
|
|||||||
};
|
};
|
||||||
|
|
||||||
handlePublishSuccess = data => {
|
handlePublishSuccess = data => {
|
||||||
const { navigation, notify } = this.props;
|
const { clearPublishFormState, navigation, notify, pendingPublishSuccess } = this.props;
|
||||||
|
const pendingClaim = data.outputs[0];
|
||||||
|
logPublish(pendingClaim);
|
||||||
|
|
||||||
|
pendingPublishSuccess(pendingClaim);
|
||||||
|
|
||||||
notify({
|
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 });
|
||||||
navigation.navigate({ routeName: Constants.DRAWER_ROUTE_PUBLISHES, params: { publishSuccess: true } });
|
navigation.navigate({ routeName: Constants.DRAWER_ROUTE_PUBLISHES, params: { publishSuccess: true } });
|
||||||
};
|
};
|
||||||
|
|
||||||
@@ -407,14 +479,6 @@ class PublishPage extends React.PureComponent {
|
|||||||
this.onComponentFocused();
|
this.onComponentFocused();
|
||||||
}
|
}
|
||||||
|
|
||||||
if (publishFormValues) {
|
|
||||||
if (publishFormValues.thumbnail && !this.state.uploadedThumbnailUri) {
|
|
||||||
const { thumbnail } = publishFormValues;
|
|
||||||
updatePublishFormState({ currentThumbnailUri: thumbnail, uploadedThumbnailUri: thumbnail });
|
|
||||||
this.setState({ currentThumbnailUri: thumbnail, uploadedThumbnailUri: thumbnail });
|
|
||||||
}
|
|
||||||
}
|
|
||||||
|
|
||||||
if (
|
if (
|
||||||
this.state.currentPhase === Constants.PHASE_DETAILS &&
|
this.state.currentPhase === Constants.PHASE_DETAILS &&
|
||||||
prevDrawerStack[prevDrawerStack.length - 1].route === Constants.DRAWER_ROUTE_PUBLISH_FORM &&
|
prevDrawerStack[prevDrawerStack.length - 1].route === Constants.DRAWER_ROUTE_PUBLISH_FORM &&
|
||||||
@@ -432,6 +496,7 @@ class PublishPage extends React.PureComponent {
|
|||||||
updatePublishFormState({ currentMedia: media, name: newName });
|
updatePublishFormState({ currentMedia: media, name: newName });
|
||||||
this.setState(
|
this.setState(
|
||||||
{
|
{
|
||||||
|
publishStarted: false,
|
||||||
currentMedia: media,
|
currentMedia: media,
|
||||||
title: null, // no title autogeneration (user will fill this in)
|
title: null, // no title autogeneration (user will fill this in)
|
||||||
name: newName,
|
name: newName,
|
||||||
@@ -440,7 +505,7 @@ class PublishPage extends React.PureComponent {
|
|||||||
() => {
|
() => {
|
||||||
this.handleNameChange(this.state.name);
|
this.handleNameChange(this.state.name);
|
||||||
pushDrawerStack(Constants.DRAWER_ROUTE_PUBLISH_FORM);
|
pushDrawerStack(Constants.DRAWER_ROUTE_PUBLISH_FORM);
|
||||||
}
|
},
|
||||||
);
|
);
|
||||||
}
|
}
|
||||||
|
|
||||||
@@ -449,7 +514,7 @@ class PublishPage extends React.PureComponent {
|
|||||||
};
|
};
|
||||||
|
|
||||||
showSelector() {
|
showSelector() {
|
||||||
const { updatePublishForm } = this.props;
|
const { clearPublishFormState, updatePublishForm } = this.props;
|
||||||
|
|
||||||
this.setState(
|
this.setState(
|
||||||
{
|
{
|
||||||
@@ -486,12 +551,15 @@ class PublishPage extends React.PureComponent {
|
|||||||
selectedChannel: null,
|
selectedChannel: null,
|
||||||
uploadedThumbnailUri: null,
|
uploadedThumbnailUri: null,
|
||||||
|
|
||||||
|
thumbnailImagePickerOpen: false,
|
||||||
|
|
||||||
vanityUrlSet: false,
|
vanityUrlSet: false,
|
||||||
},
|
},
|
||||||
() => {
|
() => {
|
||||||
|
clearPublishFormState();
|
||||||
// reset thumbnail
|
// reset thumbnail
|
||||||
updatePublishForm({ thumbnail: null });
|
updatePublishForm({ thumbnail: null });
|
||||||
}
|
},
|
||||||
);
|
);
|
||||||
}
|
}
|
||||||
|
|
||||||
@@ -518,23 +586,63 @@ class PublishPage extends React.PureComponent {
|
|||||||
},
|
},
|
||||||
() => {
|
() => {
|
||||||
NativeModules.UtilityModule.openDocumentPicker('*/*');
|
NativeModules.UtilityModule.openDocumentPicker('*/*');
|
||||||
}
|
},
|
||||||
);
|
);
|
||||||
};
|
};
|
||||||
|
|
||||||
onFilePicked = evt => {
|
handleThumbnailUploadSuccess = ({ url }) => {
|
||||||
this.setState({ documentPickerOpen: false }, () => {
|
const { updatePublishFormState } = this.props;
|
||||||
const currentMedia = {
|
|
||||||
id: -1,
|
this.setState({
|
||||||
filePath: `file://${evt.path}`,
|
uploadThumbnailStarted: false,
|
||||||
duration: 0,
|
currentThumbnailUri: url,
|
||||||
};
|
uploadedThumbnailUri: url,
|
||||||
this.setCurrentMedia(currentMedia);
|
|
||||||
});
|
});
|
||||||
|
updatePublishFormState({ currentThumbnailUri: url, uploadedThumbnailUri: url });
|
||||||
|
};
|
||||||
|
|
||||||
|
handleThumbnailUploadFailure = err => {
|
||||||
|
const { notify } = this.props;
|
||||||
|
this.setState({ uploadThumbnailStarted: false });
|
||||||
|
notify({ message: __('The thumbnail could not be uploaded. Please try again.') });
|
||||||
|
};
|
||||||
|
|
||||||
|
onFilePicked = evt => {
|
||||||
|
const { notify } = this.props;
|
||||||
|
if (evt.path && evt.path.length > 0) {
|
||||||
|
const fileUrl = `file://${evt.path}`;
|
||||||
|
|
||||||
|
if (this.state.documentPickerOpen) {
|
||||||
|
this.setState({ documentPickerOpen: false, thumbnailImagePickerOpen: false }, () => {
|
||||||
|
const currentMedia = {
|
||||||
|
id: -1,
|
||||||
|
filePath: evt.path,
|
||||||
|
duration: 0,
|
||||||
|
};
|
||||||
|
this.setCurrentMedia(currentMedia);
|
||||||
|
});
|
||||||
|
} else if (this.state.thumbnailImagePickerOpen) {
|
||||||
|
this.setState(
|
||||||
|
{
|
||||||
|
documentPickerOpen: false,
|
||||||
|
thumbnailImagePickerOpen: false,
|
||||||
|
uploadThumbnailStarted: true,
|
||||||
|
currentThumbnailUri: fileUrl,
|
||||||
|
},
|
||||||
|
() => {
|
||||||
|
// upload a new thumbnail
|
||||||
|
uploadImageAsset(fileUrl, this.handleThumbnailUploadSuccess, this.handleThumbnailUploadFailure);
|
||||||
|
},
|
||||||
|
);
|
||||||
|
}
|
||||||
|
} else {
|
||||||
|
// could not determine the file path
|
||||||
|
notify({ message: __('The path could not be determined. Please try a different file.'), isError: true });
|
||||||
|
}
|
||||||
};
|
};
|
||||||
|
|
||||||
onPickerCanceled = () => {
|
onPickerCanceled = () => {
|
||||||
this.setState({ documentPickerOpen: false });
|
this.setState({ documentPickerOpen: false, thumbnailImagePickerOpen: false });
|
||||||
};
|
};
|
||||||
|
|
||||||
handleCloseCameraPressed = () => {
|
handleCloseCameraPressed = () => {
|
||||||
@@ -569,12 +677,13 @@ class PublishPage extends React.PureComponent {
|
|||||||
{
|
{
|
||||||
currentThumbnailUri: null,
|
currentThumbnailUri: null,
|
||||||
updatingThumbnailUri: false,
|
updatingThumbnailUri: false,
|
||||||
|
publishStarted: false,
|
||||||
currentPhase: Constants.PHASE_DETAILS,
|
currentPhase: Constants.PHASE_DETAILS,
|
||||||
showCameraOverlay: false,
|
showCameraOverlay: false,
|
||||||
videoRecordingMode: false,
|
videoRecordingMode: false,
|
||||||
recordingVideo: false,
|
recordingVideo: false,
|
||||||
},
|
},
|
||||||
() => pushDrawerStack(Constants.DRAWER_ROUTE_PUBLISH_FORM)
|
() => pushDrawerStack(Constants.DRAWER_ROUTE_PUBLISH_FORM),
|
||||||
);
|
);
|
||||||
});
|
});
|
||||||
}
|
}
|
||||||
@@ -593,11 +702,12 @@ class PublishPage extends React.PureComponent {
|
|||||||
{
|
{
|
||||||
currentPhase: Constants.PHASE_DETAILS,
|
currentPhase: Constants.PHASE_DETAILS,
|
||||||
currentThumbnailUri: null,
|
currentThumbnailUri: null,
|
||||||
|
publishStarted: false,
|
||||||
updatingThumbnailUri: false,
|
updatingThumbnailUri: false,
|
||||||
showCameraOverlay: false,
|
showCameraOverlay: false,
|
||||||
videoRecordingMode: false,
|
videoRecordingMode: false,
|
||||||
},
|
},
|
||||||
() => pushDrawerStack(Constants.DRAWER_ROUTE_PUBLISH)
|
() => pushDrawerStack(Constants.DRAWER_ROUTE_PUBLISH),
|
||||||
);
|
);
|
||||||
});
|
});
|
||||||
}
|
}
|
||||||
@@ -611,8 +721,6 @@ class PublishPage extends React.PureComponent {
|
|||||||
});
|
});
|
||||||
};
|
};
|
||||||
|
|
||||||
handleUploadPressed = () => {};
|
|
||||||
|
|
||||||
getRandomFileId = () => {
|
getRandomFileId = () => {
|
||||||
// generate a random id for a photo or recorded video between 1 and 20 (for creating thumbnails)
|
// generate a random id for a photo or recorded video between 1 and 20 (for creating thumbnails)
|
||||||
const id = Math.floor(Math.random() * (20 - 2)) + 1;
|
const id = Math.floor(Math.random() * (20 - 2)) + 1;
|
||||||
@@ -644,7 +752,7 @@ class PublishPage extends React.PureComponent {
|
|||||||
}
|
}
|
||||||
|
|
||||||
if (!isNameValid(name, false)) {
|
if (!isNameValid(name, false)) {
|
||||||
notify({ message: 'Your content address contains invalid characters' });
|
notify({ message: __('Your content address contains invalid characters') });
|
||||||
return;
|
return;
|
||||||
}
|
}
|
||||||
|
|
||||||
@@ -674,7 +782,7 @@ class PublishPage extends React.PureComponent {
|
|||||||
updatePublishFormState({ tags: newTags });
|
updatePublishFormState({ tags: newTags });
|
||||||
this.setState({ tags: newTags });
|
this.setState({ tags: newTags });
|
||||||
} else {
|
} else {
|
||||||
notify({ message: __(`You already added the "${tag}" tag.`) });
|
notify({ message: __(`You already added the "${tag}" tag.`) }); // TODO: tokenize i18n
|
||||||
}
|
}
|
||||||
};
|
};
|
||||||
|
|
||||||
@@ -699,7 +807,7 @@ class PublishPage extends React.PureComponent {
|
|||||||
return;
|
return;
|
||||||
}
|
}
|
||||||
|
|
||||||
const { notify, uploadThumbnail } = this.props;
|
const { notify } = this.props;
|
||||||
const { thumbnailPath } = this.state;
|
const { thumbnailPath } = this.state;
|
||||||
|
|
||||||
this.setState({ updatingThumbnailUri: true });
|
this.setState({ updatingThumbnailUri: true });
|
||||||
@@ -714,7 +822,13 @@ class PublishPage extends React.PureComponent {
|
|||||||
|
|
||||||
// upload the thumbnail
|
// upload the thumbnail
|
||||||
if (!this.state.uploadedThumbnailUri) {
|
if (!this.state.uploadedThumbnailUri) {
|
||||||
this.setState({ uploadThumbnailStarted: true }, () => uploadThumbnail(this.getFilePathFromUri(uri), RNFS));
|
this.setState({ uploadThumbnailStarted: true }, () =>
|
||||||
|
uploadImageAsset(
|
||||||
|
this.getFilePathFromUri(uri),
|
||||||
|
this.handleThumbnailUploadSuccess,
|
||||||
|
this.handleThumbnailUploadFailure,
|
||||||
|
),
|
||||||
|
);
|
||||||
}
|
}
|
||||||
} else if (mediaType === 'image' || mediaType === 'video') {
|
} else if (mediaType === 'image' || mediaType === 'video') {
|
||||||
const create =
|
const create =
|
||||||
@@ -725,7 +839,9 @@ class PublishPage extends React.PureComponent {
|
|||||||
.then(path => {
|
.then(path => {
|
||||||
this.setState({ currentThumbnailUri: `file://${path}`, updatingThumbnailUri: false });
|
this.setState({ currentThumbnailUri: `file://${path}`, updatingThumbnailUri: false });
|
||||||
if (!this.state.uploadedThumbnailUri) {
|
if (!this.state.uploadedThumbnailUri) {
|
||||||
this.setState({ uploadThumbnailStarted: true }, () => uploadThumbnail(path, RNFS));
|
this.setState({ uploadThumbnailStarted: true }, () =>
|
||||||
|
uploadImageAsset(path, this.handleThumbnailUploadSuccess, this.handleThumbnailUploadFailure),
|
||||||
|
);
|
||||||
}
|
}
|
||||||
})
|
})
|
||||||
.catch(err => {
|
.catch(err => {
|
||||||
@@ -750,7 +866,7 @@ class PublishPage extends React.PureComponent {
|
|||||||
},
|
},
|
||||||
() => {
|
() => {
|
||||||
this.handleNameChange(this.state.name);
|
this.handleNameChange(this.state.name);
|
||||||
}
|
},
|
||||||
);
|
);
|
||||||
}
|
}
|
||||||
};
|
};
|
||||||
@@ -781,7 +897,7 @@ class PublishPage extends React.PureComponent {
|
|||||||
: '';
|
: '';
|
||||||
const licenseUrl = LICENSES.CC_LICENSES.reduce((value, item) => {
|
const licenseUrl = LICENSES.CC_LICENSES.reduce((value, item) => {
|
||||||
if (typeof value === 'object') {
|
if (typeof value === 'object') {
|
||||||
value = '';
|
value = license === value.value ? item.url : '';
|
||||||
}
|
}
|
||||||
if (license === item.value) {
|
if (license === item.value) {
|
||||||
value = item.url;
|
value = item.url;
|
||||||
@@ -799,14 +915,58 @@ class PublishPage extends React.PureComponent {
|
|||||||
this.setState({ otherLicenseDescription });
|
this.setState({ otherLicenseDescription });
|
||||||
};
|
};
|
||||||
|
|
||||||
|
handleThumbnailPressed = () => {
|
||||||
|
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.') });
|
||||||
|
}
|
||||||
|
return;
|
||||||
|
}
|
||||||
|
|
||||||
|
this.setState(
|
||||||
|
{
|
||||||
|
thumbnailImagePickerOpen: true,
|
||||||
|
},
|
||||||
|
() => {
|
||||||
|
NativeModules.UtilityModule.openDocumentPicker('image/*');
|
||||||
|
},
|
||||||
|
);
|
||||||
|
};
|
||||||
|
|
||||||
|
handleStoragePermissionGranted = () => {
|
||||||
|
// update the configured download folder
|
||||||
|
this.loadVideos();
|
||||||
|
NativeModules.UtilityModule.getDownloadDirectory().then(downloadDirectory => {
|
||||||
|
Lbry.settings_set({
|
||||||
|
key: 'download_dir',
|
||||||
|
value: downloadDirectory,
|
||||||
|
})
|
||||||
|
.then(() => {})
|
||||||
|
.catch(() => {});
|
||||||
|
});
|
||||||
|
};
|
||||||
|
|
||||||
|
handleStoragePermissionRefused = () => {
|
||||||
|
const { notify } = this.props;
|
||||||
|
notify({
|
||||||
|
message: __(
|
||||||
|
'Content from your device cannot be published because the permission to read storage was not granted.',
|
||||||
|
),
|
||||||
|
isError: true,
|
||||||
|
});
|
||||||
|
};
|
||||||
|
|
||||||
render() {
|
render() {
|
||||||
const { balance, navigation, notify, publishFormValues } = this.props;
|
const { balance, navigation, notify, publishFormValues } = this.props;
|
||||||
const {
|
const {
|
||||||
allThumbnailsChecked,
|
allThumbnailsChecked,
|
||||||
canUseCamera,
|
canUseCamera,
|
||||||
|
showCameraOverlay,
|
||||||
currentPhase,
|
currentPhase,
|
||||||
checkedThumbnails,
|
checkedThumbnails,
|
||||||
loadingVideos,
|
loadingVideos,
|
||||||
|
storagePermissionRequired,
|
||||||
thumbnailPath,
|
thumbnailPath,
|
||||||
videos,
|
videos,
|
||||||
} = this.state;
|
} = this.state;
|
||||||
@@ -816,7 +976,9 @@ class PublishPage extends React.PureComponent {
|
|||||||
content = (
|
content = (
|
||||||
<View style={publishStyle.gallerySelector}>
|
<View style={publishStyle.gallerySelector}>
|
||||||
<View style={publishStyle.actionsView}>
|
<View style={publishStyle.actionsView}>
|
||||||
{canUseCamera && <RNCamera style={publishStyle.cameraPreview} type={RNCamera.Constants.Type.back} />}
|
{canUseCamera && !showCameraOverlay && (
|
||||||
|
<RNCamera captureAudio={false} style={publishStyle.cameraPreview} type={RNCamera.Constants.Type.back} />
|
||||||
|
)}
|
||||||
<View style={publishStyle.actionsSubView}>
|
<View style={publishStyle.actionsSubView}>
|
||||||
<TouchableOpacity
|
<TouchableOpacity
|
||||||
style={[
|
style={[
|
||||||
@@ -826,7 +988,7 @@ class PublishPage extends React.PureComponent {
|
|||||||
onPress={this.handleRecordVideoPressed}
|
onPress={this.handleRecordVideoPressed}
|
||||||
>
|
>
|
||||||
<Icon name="video" size={48} color={Colors.White} />
|
<Icon name="video" size={48} color={Colors.White} />
|
||||||
<Text style={publishStyle.actionText}>Record</Text>
|
<Text style={publishStyle.actionText}>{__('Record')}</Text>
|
||||||
</TouchableOpacity>
|
</TouchableOpacity>
|
||||||
<View style={publishStyle.subActions}>
|
<View style={publishStyle.subActions}>
|
||||||
<TouchableOpacity
|
<TouchableOpacity
|
||||||
@@ -837,25 +999,32 @@ class PublishPage extends React.PureComponent {
|
|||||||
onPress={this.handleTakePhotoPressed}
|
onPress={this.handleTakePhotoPressed}
|
||||||
>
|
>
|
||||||
<Icon name="camera" size={48} color={Colors.White} />
|
<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>
|
||||||
<TouchableOpacity style={publishStyle.upload} onPress={this.handleUploadPressed}>
|
<TouchableOpacity style={publishStyle.upload} onPress={this.handleUploadPressed}>
|
||||||
<Icon name="file-upload" size={48} color={Colors.White} />
|
<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>
|
</TouchableOpacity>
|
||||||
</View>
|
</View>
|
||||||
</View>
|
</View>
|
||||||
</View>
|
</View>
|
||||||
{(loadingVideos || !allThumbnailsChecked) && (
|
{storagePermissionRequired && (
|
||||||
<View style={publishStyle.loadingView}>
|
|
||||||
<ActivityIndicator size="small" color={Colors.NextLbryGreen} />
|
|
||||||
<Text style={publishStyle.loadingText}>Please wait while we load your videos...</Text>
|
|
||||||
</View>
|
|
||||||
)}
|
|
||||||
{!loadingVideos && (!videos || videos.length === 0) && (
|
|
||||||
<View style={publishStyle.relativeCentered}>
|
<View style={publishStyle.relativeCentered}>
|
||||||
<Text style={publishStyle.noVideos}>
|
<Text style={publishStyle.noVideos}>
|
||||||
We could not find any videos on your device. Take a photo or record a video to get started.
|
{__('The storage permission is required to be able to display and publish your videos.')}
|
||||||
|
</Text>
|
||||||
|
</View>
|
||||||
|
)}
|
||||||
|
{!storagePermissionRequired && (loadingVideos || !allThumbnailsChecked) && (
|
||||||
|
<View style={publishStyle.loadingView}>
|
||||||
|
<ActivityIndicator size="small" color={Colors.NextLbryGreen} />
|
||||||
|
<Text style={publishStyle.loadingText}>{__('Please wait while we load your videos...')}</Text>
|
||||||
|
</View>
|
||||||
|
)}
|
||||||
|
{!storagePermissionRequired && !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.')}
|
||||||
</Text>
|
</Text>
|
||||||
</View>
|
</View>
|
||||||
)}
|
)}
|
||||||
@@ -892,33 +1061,35 @@ class PublishPage extends React.PureComponent {
|
|||||||
this.updateThumbnailUriForMedia(currentMedia);
|
this.updateThumbnailUriForMedia(currentMedia);
|
||||||
}
|
}
|
||||||
content = (
|
content = (
|
||||||
<ScrollView style={publishStyle.publishDetails}>
|
<ScrollView ref={ref => (this.scrollView = ref)} style={publishStyle.publishDetails}>
|
||||||
{currentThumbnailUri && currentThumbnailUri.trim().length > 0 && (
|
<TouchableOpacity style={publishStyle.mainThumbnailContainer} onPress={this.handleThumbnailPressed}>
|
||||||
<View style={publishStyle.mainThumbnailContainer}>
|
<FastImage
|
||||||
<FastImage
|
style={publishStyle.mainThumbnail}
|
||||||
style={publishStyle.mainThumbnail}
|
resizeMode={FastImage.resizeMode.contain}
|
||||||
resizeMode={FastImage.resizeMode.contain}
|
source={{ uri: currentThumbnailUri }}
|
||||||
source={{ uri: currentThumbnailUri }}
|
/>
|
||||||
/>
|
|
||||||
|
|
||||||
{this.state.uploadThumbnailStarted && !this.state.uploadedThumbnailUri && (
|
<View style={publishStyle.thumbnailEditOverlay}>
|
||||||
<View style={publishStyle.thumbnailUploadContainer}>
|
<Icon name={'edit'} style={publishStyle.editIcon} />
|
||||||
<ActivityIndicator size={'small'} color={Colors.NextLbryGreen} />
|
|
||||||
<Text style={publishStyle.thumbnailUploadText}>Uploading thumbnail...</Text>
|
|
||||||
</View>
|
|
||||||
)}
|
|
||||||
</View>
|
</View>
|
||||||
)}
|
|
||||||
{!this.state.canPublish && <PublishRewardsDriver navigation={navigation} />}
|
{this.state.uploadThumbnailStarted && (
|
||||||
|
<View style={publishStyle.thumbnailUploadContainer}>
|
||||||
|
<ActivityIndicator size={'small'} color={Colors.NextLbryGreen} />
|
||||||
|
<Text style={publishStyle.thumbnailUploadText}>{__('Uploading thumbnail...')}</Text>
|
||||||
|
</View>
|
||||||
|
)}
|
||||||
|
</TouchableOpacity>
|
||||||
|
{balance < Constants.MINIMUM_TRANSACTION_BALANCE && <PublishRewardsDriver navigation={navigation} />}
|
||||||
|
|
||||||
<View style={publishStyle.card}>
|
<View style={publishStyle.card}>
|
||||||
<View style={publishStyle.textInputLayout}>
|
<View style={publishStyle.textInputLayout}>
|
||||||
{(this.state.titleFocused || (this.state.title != null && this.state.title.trim().length > 0)) && (
|
{(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
|
<TextInput
|
||||||
editable={this.state.canPublish && !this.state.publishStarted}
|
editable={this.state.canPublish && !this.state.publishStarted}
|
||||||
placeholder={this.state.titleFocused ? '' : 'Title'}
|
placeholder={this.state.titleFocused ? '' : __('Title')}
|
||||||
style={publishStyle.inputText}
|
style={publishStyle.inputText}
|
||||||
value={this.state.title}
|
value={this.state.title}
|
||||||
numberOfLines={1}
|
numberOfLines={1}
|
||||||
@@ -932,12 +1103,12 @@ class PublishPage extends React.PureComponent {
|
|||||||
<View style={publishStyle.textInputLayout}>
|
<View style={publishStyle.textInputLayout}>
|
||||||
{(this.state.descriptionFocused ||
|
{(this.state.descriptionFocused ||
|
||||||
(this.state.description != null && this.state.description.trim().length > 0)) && (
|
(this.state.description != null && this.state.description.trim().length > 0)) && (
|
||||||
<Text style={publishStyle.textInputTitle}>Description</Text>
|
<Text style={publishStyle.textInputTitle}>{__('Description')}</Text>
|
||||||
)}
|
)}
|
||||||
<TextInput
|
<TextInput
|
||||||
editable={this.state.canPublish && !this.state.publishStarted}
|
editable={this.state.canPublish && !this.state.publishStarted}
|
||||||
multiline
|
multiline
|
||||||
placeholder={this.state.descriptionFocused ? '' : 'Description'}
|
placeholder={this.state.descriptionFocused ? '' : __('Description')}
|
||||||
style={publishStyle.inputText}
|
style={publishStyle.inputText}
|
||||||
value={this.state.description}
|
value={this.state.description}
|
||||||
underlineColorAndroid={Colors.NextLbryGreen}
|
underlineColorAndroid={Colors.NextLbryGreen}
|
||||||
@@ -949,7 +1120,7 @@ class PublishPage extends React.PureComponent {
|
|||||||
</View>
|
</View>
|
||||||
|
|
||||||
<View style={publishStyle.card}>
|
<View style={publishStyle.card}>
|
||||||
<Text style={publishStyle.cardTitle}>Tags</Text>
|
<Text style={publishStyle.cardTitle}>{__('Tags')}</Text>
|
||||||
<View style={publishStyle.tagList}>
|
<View style={publishStyle.tagList}>
|
||||||
{this.state.tags &&
|
{this.state.tags &&
|
||||||
this.state.tags.map(tag => (
|
this.state.tags.map(tag => (
|
||||||
@@ -966,7 +1137,7 @@ class PublishPage extends React.PureComponent {
|
|||||||
</View>
|
</View>
|
||||||
|
|
||||||
<View style={publishStyle.card}>
|
<View style={publishStyle.card}>
|
||||||
<Text style={publishStyle.cardTitle}>Channel</Text>
|
<Text style={publishStyle.cardTitle}>{__('Channel')}</Text>
|
||||||
|
|
||||||
<ChannelSelector
|
<ChannelSelector
|
||||||
enabled={this.state.canPublish && !this.state.publishStarted}
|
enabled={this.state.canPublish && !this.state.publishStarted}
|
||||||
@@ -977,14 +1148,16 @@ class PublishPage extends React.PureComponent {
|
|||||||
|
|
||||||
<View style={publishStyle.card}>
|
<View style={publishStyle.card}>
|
||||||
<View style={publishStyle.titleRow}>
|
<View style={publishStyle.titleRow}>
|
||||||
<Text style={publishStyle.cardTitle}>Price</Text>
|
<Text style={publishStyle.cardTitle}>{__('Price')}</Text>
|
||||||
<View style={publishStyle.switchTitleRow}>
|
<View style={publishStyle.switchTitleRow}>
|
||||||
<Switch value={this.state.priceSet} onValueChange={value => this.setState({ priceSet: value })} />
|
<Switch value={this.state.priceSet} onValueChange={value => this.setState({ priceSet: value })} />
|
||||||
</View>
|
</View>
|
||||||
</View>
|
</View>
|
||||||
|
|
||||||
{!this.state.priceSet && (
|
{!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 && (
|
{this.state.priceSet && (
|
||||||
@@ -1014,11 +1187,13 @@ class PublishPage extends React.PureComponent {
|
|||||||
</View>
|
</View>
|
||||||
|
|
||||||
<View style={publishStyle.card}>
|
<View style={publishStyle.card}>
|
||||||
<Text style={publishStyle.cardTitle}>Content address</Text>
|
<Text style={publishStyle.cardTitle}>{__('Content address')}</Text>
|
||||||
<Text style={publishStyle.helpText}>
|
<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 &&
|
{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>
|
</Text>
|
||||||
|
|
||||||
<TextInput
|
<TextInput
|
||||||
@@ -1040,17 +1215,27 @@ class PublishPage extends React.PureComponent {
|
|||||||
keyboardType={'numeric'}
|
keyboardType={'numeric'}
|
||||||
value={String(this.state.bid)}
|
value={String(this.state.bid)}
|
||||||
onChangeText={this.handleBidChange}
|
onChangeText={this.handleBidChange}
|
||||||
|
onFocus={() => this.setState({ creditsInputFocused: true })}
|
||||||
|
onBlur={() => this.setState({ creditsInputFocused: false })}
|
||||||
/>
|
/>
|
||||||
<Text style={publishStyle.currency}>LBC</Text>
|
<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>
|
</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>
|
</View>
|
||||||
|
|
||||||
{this.state.advancedMode && (
|
{this.state.advancedMode && (
|
||||||
<View style={publishStyle.card}>
|
<View style={publishStyle.card}>
|
||||||
<Text style={publishStyle.cardTitle}>Additional Options</Text>
|
<Text style={publishStyle.cardTitle}>{__('Additional Options')}</Text>
|
||||||
<View>
|
<View>
|
||||||
<Text style={publishStyle.cardText}>Language</Text>
|
<Text style={publishStyle.cardText}>{__('Language')}</Text>
|
||||||
<Picker
|
<Picker
|
||||||
enabled={this.state.canPublish && !this.state.publishStarted}
|
enabled={this.state.canPublish && !this.state.publishStarted}
|
||||||
selectedValue={this.state.language}
|
selectedValue={this.state.language}
|
||||||
@@ -1059,13 +1244,13 @@ class PublishPage extends React.PureComponent {
|
|||||||
onValueChange={this.handleLanguageValueChange}
|
onValueChange={this.handleLanguageValueChange}
|
||||||
>
|
>
|
||||||
{Object.keys(languages).map(lang => (
|
{Object.keys(languages).map(lang => (
|
||||||
<Picker.Item label={languages[lang]} value={lang} key={lang} />
|
<Picker.Item label={__(languages[lang])} value={lang} key={lang} />
|
||||||
))}
|
))}
|
||||||
</Picker>
|
</Picker>
|
||||||
</View>
|
</View>
|
||||||
|
|
||||||
<View>
|
<View>
|
||||||
<Text style={publishStyle.cardText}>License</Text>
|
<Text style={publishStyle.cardText}>{__('License')}</Text>
|
||||||
<Picker
|
<Picker
|
||||||
enabled={this.state.canPublish && !this.state.publishStarted}
|
enabled={this.state.canPublish && !this.state.publishStarted}
|
||||||
selectedValue={this.state.license}
|
selectedValue={this.state.license}
|
||||||
@@ -1073,18 +1258,22 @@ class PublishPage extends React.PureComponent {
|
|||||||
itemStyle={publishStyle.pickerItem}
|
itemStyle={publishStyle.pickerItem}
|
||||||
onValueChange={this.handleLicenseValueChange}
|
onValueChange={this.handleLicenseValueChange}
|
||||||
>
|
>
|
||||||
<Picker.Item label={'None'} value={LICENSES.NONE} key={LICENSES.NONE} />
|
<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={__('Public Domain')}
|
||||||
|
value={LICENSES.PUBLIC_DOMAIN}
|
||||||
|
key={LICENSES.PUBLIC_DOMAIN}
|
||||||
|
/>
|
||||||
{LICENSES.CC_LICENSES.map(({ value, url }) => (
|
{LICENSES.CC_LICENSES.map(({ value, url }) => (
|
||||||
<Picker.Item label={value} value={value} key={value} />
|
<Picker.Item label={value} value={value} key={value} />
|
||||||
))}
|
))}
|
||||||
<Picker.Item label={'Copyrighted...'} value={LICENSES.COPYRIGHT} key={LICENSES.COPYRIGHT} />
|
<Picker.Item label={__('Copyrighted...')} value={LICENSES.COPYRIGHT} key={LICENSES.COPYRIGHT} />
|
||||||
<Picker.Item label={'Other...'} value={LICENSES.OTHER} key={LICENSES.OTHER} />
|
<Picker.Item label={__('Other...')} value={LICENSES.OTHER} key={LICENSES.OTHER} />
|
||||||
</Picker>
|
</Picker>
|
||||||
{[LICENSES.COPYRIGHT, LICENSES.OTHER].includes(this.state.license) && (
|
{[LICENSES.COPYRIGHT, LICENSES.OTHER].includes(this.state.license) && (
|
||||||
<TextInput
|
<TextInput
|
||||||
editable={this.state.canPublish && !this.state.publishStarted}
|
editable={this.state.canPublish && !this.state.publishStarted}
|
||||||
placeholder={'License description'}
|
placeholder={__('License description')}
|
||||||
style={publishStyle.inputText}
|
style={publishStyle.inputText}
|
||||||
underlineColorAndroid={Colors.NextLbryGreen}
|
underlineColorAndroid={Colors.NextLbryGreen}
|
||||||
numberOfLines={1}
|
numberOfLines={1}
|
||||||
@@ -1098,29 +1287,29 @@ class PublishPage extends React.PureComponent {
|
|||||||
|
|
||||||
<View style={publishStyle.toggleContainer}>
|
<View style={publishStyle.toggleContainer}>
|
||||||
<Link
|
<Link
|
||||||
text={this.state.advancedMode ? 'Hide extra fields' : 'Show extra fields'}
|
text={this.state.advancedMode ? __('Hide extra fields') : __('Show extra fields')}
|
||||||
onPress={this.handleModePressed}
|
onPress={this.handleModePressed}
|
||||||
style={publishStyle.modeLink}
|
style={publishStyle.modeLink}
|
||||||
/>
|
/>
|
||||||
</View>
|
</View>
|
||||||
|
|
||||||
<View style={publishStyle.actionButtons}>
|
<View style={publishStyle.actionButtons}>
|
||||||
{(this.state.publishStarted || publishFormValues.publishing) && (
|
{this.state.publishStarted && (
|
||||||
<View style={publishStyle.progress}>
|
<View style={publishStyle.progress}>
|
||||||
<ActivityIndicator size={'small'} color={Colors.NextLbryGreen} />
|
<ActivityIndicator size={'small'} color={Colors.NextLbryGreen} />
|
||||||
</View>
|
</View>
|
||||||
)}
|
)}
|
||||||
|
|
||||||
{!publishFormValues.publishing && !this.state.publishStarted && (
|
{!this.state.publishStarted && (
|
||||||
<Link style={publishStyle.cancelLink} text="Cancel" onPress={() => this.showSelector()} />
|
<Link style={publishStyle.cancelLink} text={__('Cancel')} onPress={() => this.showSelector()} />
|
||||||
)}
|
)}
|
||||||
|
|
||||||
{!publishFormValues.publishing && !this.state.publishStarted && (
|
{!this.state.publishStarted && (
|
||||||
<View style={publishStyle.rightActionButtons}>
|
<View style={publishStyle.rightActionButtons}>
|
||||||
<Button
|
<Button
|
||||||
style={publishStyle.publishButton}
|
style={publishStyle.publishButton}
|
||||||
disabled={!this.state.canPublish || !this.state.uploadedThumbnailUri}
|
disabled={this.state.uploadThumbnailStarted}
|
||||||
text={this.state.editMode ? 'Save changes' : 'Publish'}
|
text={this.state.editMode ? __('Save changes') : __('Publish')}
|
||||||
onPress={this.handlePublishPressed}
|
onPress={this.handlePublishPressed}
|
||||||
/>
|
/>
|
||||||
</View>
|
</View>
|
||||||
@@ -1132,8 +1321,10 @@ class PublishPage extends React.PureComponent {
|
|||||||
content = (
|
content = (
|
||||||
<ScrollView style={publishStyle.publishDetails}>
|
<ScrollView style={publishStyle.publishDetails}>
|
||||||
<View style={publishStyle.successContainer}>
|
<View style={publishStyle.successContainer}>
|
||||||
<Text style={publishStyle.successTitle}>Success!</Text>
|
<Text style={publishStyle.successTitle}>{__('Success!')}</Text>
|
||||||
<Text style={publishStyle.successText}>Congratulations! Your content was successfully uploaded.</Text>
|
<Text style={publishStyle.successText}>
|
||||||
|
{__('Congratulations! Your content was successfully uploaded.')}
|
||||||
|
</Text>
|
||||||
<View style={publishStyle.successRow}>
|
<View style={publishStyle.successRow}>
|
||||||
<Link
|
<Link
|
||||||
style={publishStyle.successUrl}
|
style={publishStyle.successUrl}
|
||||||
@@ -1143,19 +1334,24 @@ class PublishPage extends React.PureComponent {
|
|||||||
<TouchableOpacity
|
<TouchableOpacity
|
||||||
onPress={() => {
|
onPress={() => {
|
||||||
Clipboard.setString(this.state.uri);
|
Clipboard.setString(this.state.uri);
|
||||||
notify({ message: 'Copied.' });
|
notify({ message: __('Copied.') });
|
||||||
}}
|
}}
|
||||||
>
|
>
|
||||||
<Icon name="clipboard" size={24} color={Colors.LbryGreen} />
|
<Icon name="clipboard" size={24} color={Colors.LbryGreen} />
|
||||||
</TouchableOpacity>
|
</TouchableOpacity>
|
||||||
</View>
|
</View>
|
||||||
<Text style={publishStyle.successText}>
|
<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>
|
</Text>
|
||||||
</View>
|
</View>
|
||||||
<View style={publishStyle.actionButtons}>
|
<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>
|
</View>
|
||||||
</ScrollView>
|
</ScrollView>
|
||||||
);
|
);
|
||||||
@@ -1168,34 +1364,36 @@ class PublishPage extends React.PureComponent {
|
|||||||
{false && Constants.PHASE_SELECTOR !== this.state.currentPhase && (
|
{false && Constants.PHASE_SELECTOR !== this.state.currentPhase && (
|
||||||
<FloatingWalletBalance navigation={navigation} />
|
<FloatingWalletBalance navigation={navigation} />
|
||||||
)}
|
)}
|
||||||
{this.state.canUseCamera && this.state.showCameraOverlay && (
|
{this.state.showCameraOverlay && (
|
||||||
<View style={publishStyle.cameraOverlay}>
|
<View style={publishStyle.cameraOverlay}>
|
||||||
<RNCamera
|
{this.state.canUseCamera && (
|
||||||
captureAudio={this.state.videoRecordingMode}
|
<RNCamera
|
||||||
style={publishStyle.fullCamera}
|
captureAudio={this.state.videoRecordingMode}
|
||||||
ref={ref => {
|
style={publishStyle.fullCamera}
|
||||||
this.camera = ref;
|
ref={ref => {
|
||||||
}}
|
this.camera = ref;
|
||||||
type={this.state.cameraType}
|
}}
|
||||||
flashMode={RNCamera.Constants.FlashMode.off}
|
type={this.state.cameraType}
|
||||||
androidCameraPermissionOptions={{
|
flashMode={RNCamera.Constants.FlashMode.off}
|
||||||
title: 'Camera',
|
androidCameraPermissionOptions={{
|
||||||
message: 'Please grant access to make use of your camera',
|
title: __('Camera'),
|
||||||
buttonPositive: 'OK',
|
message: __('Please grant access to make use of your camera'),
|
||||||
buttonNegative: 'Cancel',
|
buttonPositive: __('OK'),
|
||||||
}}
|
buttonNegative: __('Cancel'),
|
||||||
androidRecordAudioPermissionOptions={{
|
}}
|
||||||
title: 'Audio',
|
androidRecordAudioPermissionOptions={{
|
||||||
message: 'Please grant access to record audio',
|
title: __('Audio'),
|
||||||
buttonPositive: 'OK',
|
message: __('Please grant access to record audio'),
|
||||||
buttonNegative: 'Cancel',
|
buttonPositive: __('OK'),
|
||||||
}}
|
buttonNegative: __('Cancel'),
|
||||||
notAuthorizedView={
|
}}
|
||||||
<View style={publishStyle.fullCentered}>
|
notAuthorizedView={
|
||||||
<Text style={publishStyle.cameraInfo}>Camera not authorized</Text>
|
<View style={publishStyle.fullCentered}>
|
||||||
</View>
|
<Text style={publishStyle.cameraInfo}>{__('Camera not authorized')}</Text>
|
||||||
}
|
</View>
|
||||||
/>
|
}
|
||||||
|
/>
|
||||||
|
)}
|
||||||
<View
|
<View
|
||||||
style={[
|
style={[
|
||||||
publishStyle.cameraControls,
|
publishStyle.cameraControls,
|
||||||
|
|||||||
@@ -3,7 +3,9 @@ import {
|
|||||||
doAbandonClaim,
|
doAbandonClaim,
|
||||||
doCheckPendingPublishes,
|
doCheckPendingPublishes,
|
||||||
doFetchClaimListMine,
|
doFetchClaimListMine,
|
||||||
|
doToast,
|
||||||
selectMyClaimUrisWithoutChannels,
|
selectMyClaimUrisWithoutChannels,
|
||||||
|
selectPendingClaims,
|
||||||
selectIsFetchingClaimListMine,
|
selectIsFetchingClaimListMine,
|
||||||
} from 'lbry-redux';
|
} from 'lbry-redux';
|
||||||
import { doPushDrawerStack, doSetPlayerVisible } from 'redux/actions/drawer';
|
import { doPushDrawerStack, doSetPlayerVisible } from 'redux/actions/drawer';
|
||||||
@@ -13,12 +15,14 @@ import PublishesPage from './view';
|
|||||||
const select = state => ({
|
const select = state => ({
|
||||||
uris: selectMyClaimUrisWithoutChannels(state),
|
uris: selectMyClaimUrisWithoutChannels(state),
|
||||||
fetching: selectIsFetchingClaimListMine(state),
|
fetching: selectIsFetchingClaimListMine(state),
|
||||||
|
pendingClaims: selectPendingClaims(state),
|
||||||
});
|
});
|
||||||
|
|
||||||
const perform = dispatch => ({
|
const perform = dispatch => ({
|
||||||
abandonClaim: (txid, nout) => dispatch(doAbandonClaim(txid, nout)),
|
abandonClaim: (txid, nout) => dispatch(doAbandonClaim(txid, nout)),
|
||||||
fetchMyClaims: () => dispatch(doFetchClaimListMine()),
|
fetchMyClaims: () => dispatch(doFetchClaimListMine()),
|
||||||
checkPendingPublishes: () => dispatch(doCheckPendingPublishes()),
|
checkPendingPublishes: () => dispatch(doCheckPendingPublishes()),
|
||||||
|
notify: data => dispatch(doToast(data)),
|
||||||
pushDrawerStack: () => dispatch(doPushDrawerStack(Constants.DRAWER_ROUTE_PUBLISHES)),
|
pushDrawerStack: () => dispatch(doPushDrawerStack(Constants.DRAWER_ROUTE_PUBLISHES)),
|
||||||
setPlayerVisible: () => dispatch(doSetPlayerVisible(false)),
|
setPlayerVisible: () => dispatch(doSetPlayerVisible(false)),
|
||||||
});
|
});
|
||||||
|
|||||||
+18
-13
@@ -3,11 +3,12 @@ import { ActivityIndicator, Alert, FlatList, NativeModules, Text, TouchableOpaci
|
|||||||
import Button from 'component/button';
|
import Button from 'component/button';
|
||||||
import Colors from 'styles/colors';
|
import Colors from 'styles/colors';
|
||||||
import Constants from 'constants'; // eslint-disable-line node/no-deprecated-api
|
import Constants from 'constants'; // eslint-disable-line node/no-deprecated-api
|
||||||
|
import EmptyStateView from 'component/emptyStateView';
|
||||||
import FileListItem from 'component/fileListItem';
|
import FileListItem from 'component/fileListItem';
|
||||||
import FloatingWalletBalance from 'component/floatingWalletBalance';
|
import FloatingWalletBalance from 'component/floatingWalletBalance';
|
||||||
import UriBar from 'component/uriBar';
|
import UriBar from 'component/uriBar';
|
||||||
import publishStyle from 'styles/publish';
|
import publishStyle from 'styles/publish';
|
||||||
import { __, navigateToUri } from 'utils/helper';
|
import { navigateToUri } from 'utils/helper';
|
||||||
|
|
||||||
class PublishesPage extends React.PureComponent {
|
class PublishesPage extends React.PureComponent {
|
||||||
state = {
|
state = {
|
||||||
@@ -53,6 +54,8 @@ class PublishesPage extends React.PureComponent {
|
|||||||
};
|
};
|
||||||
|
|
||||||
addOrRemoveItem = (uri, claim) => {
|
addOrRemoveItem = (uri, claim) => {
|
||||||
|
const { pendingClaims } = this.state;
|
||||||
|
|
||||||
const { selectedClaimsMap } = this.state;
|
const { selectedClaimsMap } = this.state;
|
||||||
let selectedUris = [...this.state.selectedUris];
|
let selectedUris = [...this.state.selectedUris];
|
||||||
|
|
||||||
@@ -137,16 +140,11 @@ class PublishesPage extends React.PureComponent {
|
|||||||
)}
|
)}
|
||||||
|
|
||||||
{!fetching && (!uris || uris.length === 0) && (
|
{!fetching && (!uris || uris.length === 0) && (
|
||||||
<View style={publishStyle.noPublishes}>
|
<EmptyStateView
|
||||||
<Text style={publishStyle.noPublishText}>
|
message={__('It looks like you have not\npublished any content to LBRY yet.')}
|
||||||
{__('It looks like you have not published anything to LBRY yet.')}
|
buttonText={__('Publish something new')}
|
||||||
</Text>
|
onButtonPress={() => navigation.navigate({ routeName: Constants.DRAWER_ROUTE_PUBLISH })}
|
||||||
<Button
|
/>
|
||||||
style={publishStyle.publishNowButton}
|
|
||||||
text={__('Publish something new')}
|
|
||||||
onPress={() => navigation.navigate({ routeName: Constants.DRAWER_ROUTE_PUBLISH })}
|
|
||||||
/>
|
|
||||||
</View>
|
|
||||||
)}
|
)}
|
||||||
|
|
||||||
{uris && uris.length > 0 && (
|
{uris && uris.length > 0 && (
|
||||||
@@ -176,8 +174,15 @@ class PublishesPage extends React.PureComponent {
|
|||||||
if (selectionMode) {
|
if (selectionMode) {
|
||||||
this.handleSelectItem(item, claim);
|
this.handleSelectItem(item, claim);
|
||||||
} else {
|
} else {
|
||||||
// TODO: when shortUrl is available for my claims, navigate to that URL instead
|
const { notify, pendingClaims } = this.props;
|
||||||
navigateToUri(navigation, item);
|
if (pendingClaims.some(pendingClaim => pendingClaim.claim_id === claim.claim_id)) {
|
||||||
|
notify({
|
||||||
|
message: __('This content is currently pending. It will be available in a few minutes.'),
|
||||||
|
});
|
||||||
|
} else {
|
||||||
|
// TODO: when shortUrl is available for my claims, navigate to that URL instead
|
||||||
|
navigateToUri(navigation, item);
|
||||||
|
}
|
||||||
}
|
}
|
||||||
}}
|
}}
|
||||||
onLongPress={claim => this.handleItemLongPress(item, claim)}
|
onLongPress={claim => this.handleItemLongPress(item, claim)}
|
||||||
|
|||||||
@@ -8,10 +8,13 @@ import CustomRewardCard from 'component/customRewardCard';
|
|||||||
import PageHeader from 'component/pageHeader';
|
import PageHeader from 'component/pageHeader';
|
||||||
import RewardCard from 'component/rewardCard';
|
import RewardCard from 'component/rewardCard';
|
||||||
import RewardEnrolment from 'component/rewardEnrolment';
|
import RewardEnrolment from 'component/rewardEnrolment';
|
||||||
import RewardSummary from 'component/rewardSummary';
|
|
||||||
import UriBar from 'component/uriBar';
|
import UriBar from 'component/uriBar';
|
||||||
import rewardStyle from 'styles/reward';
|
import rewardStyle from 'styles/reward';
|
||||||
|
|
||||||
|
const FILTER_ALL = 'all';
|
||||||
|
const FILTER_AVAILABLE = 'available';
|
||||||
|
const FILTER_CLAIMED = 'claimed';
|
||||||
|
|
||||||
class RewardsPage extends React.PureComponent {
|
class RewardsPage extends React.PureComponent {
|
||||||
state = {
|
state = {
|
||||||
isEmailVerified: false,
|
isEmailVerified: false,
|
||||||
@@ -20,6 +23,7 @@ class RewardsPage extends React.PureComponent {
|
|||||||
verifyRequestStarted: false,
|
verifyRequestStarted: false,
|
||||||
revealVerification: true,
|
revealVerification: true,
|
||||||
firstRewardClaimed: false,
|
firstRewardClaimed: false,
|
||||||
|
currentFilter: FILTER_AVAILABLE,
|
||||||
};
|
};
|
||||||
|
|
||||||
scrollView = null;
|
scrollView = null;
|
||||||
@@ -105,9 +109,10 @@ class RewardsPage extends React.PureComponent {
|
|||||||
if (this.state.isEmailVerified && this.state.isIdentityVerified && !this.state.isRewardApproved) {
|
if (this.state.isEmailVerified && this.state.isIdentityVerified && !this.state.isRewardApproved) {
|
||||||
return (
|
return (
|
||||||
<View style={[rewardStyle.card, rewardStyle.verification]}>
|
<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}>
|
<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
|
<Link
|
||||||
style={rewardStyle.greenLink}
|
style={rewardStyle.greenLink}
|
||||||
href="https://discordapp.com/invite/Z3bERWA"
|
href="https://discordapp.com/invite/Z3bERWA"
|
||||||
@@ -130,13 +135,15 @@ class RewardsPage extends React.PureComponent {
|
|||||||
return (
|
return (
|
||||||
<View style={rewardStyle.busyContainer}>
|
<View style={rewardStyle.busyContainer}>
|
||||||
<ActivityIndicator size="large" color={Colors.NextLbryGreen} />
|
<ActivityIndicator size="large" color={Colors.NextLbryGreen} />
|
||||||
<Text style={rewardStyle.infoText}>Fetching rewards...</Text>
|
<Text style={rewardStyle.infoText}>{__('Fetching rewards...')}</Text>
|
||||||
</View>
|
</View>
|
||||||
);
|
);
|
||||||
} else if (user === null) {
|
} else if (user === null) {
|
||||||
return (
|
return (
|
||||||
<View style={rewardStyle.busyContainer}>
|
<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>
|
</View>
|
||||||
);
|
);
|
||||||
}
|
}
|
||||||
@@ -180,8 +187,13 @@ class RewardsPage extends React.PureComponent {
|
|||||||
});
|
});
|
||||||
};
|
};
|
||||||
|
|
||||||
|
setFilter = filter => {
|
||||||
|
this.setState({ currentFilter: filter });
|
||||||
|
};
|
||||||
|
|
||||||
render() {
|
render() {
|
||||||
const { user, navigation } = this.props;
|
const { user, navigation } = this.props;
|
||||||
|
const { currentFilter } = this.state;
|
||||||
|
|
||||||
return (
|
return (
|
||||||
<View style={rewardStyle.container}>
|
<View style={rewardStyle.container}>
|
||||||
@@ -195,8 +207,29 @@ class RewardsPage extends React.PureComponent {
|
|||||||
style={rewardStyle.scrollContainer}
|
style={rewardStyle.scrollContainer}
|
||||||
contentContainerStyle={rewardStyle.scrollContentContainer}
|
contentContainerStyle={rewardStyle.scrollContentContainer}
|
||||||
>
|
>
|
||||||
{this.renderUnclaimedRewards()}
|
<View style={rewardStyle.filterHeader}>
|
||||||
{this.renderClaimedRewards()}
|
<Link
|
||||||
|
style={[rewardStyle.filterLink, currentFilter === FILTER_ALL ? rewardStyle.activeFilterLink : null]}
|
||||||
|
text={__('All')}
|
||||||
|
onPress={() => this.setFilter(FILTER_ALL)}
|
||||||
|
/>
|
||||||
|
<Link
|
||||||
|
style={[
|
||||||
|
rewardStyle.filterLink,
|
||||||
|
currentFilter === FILTER_AVAILABLE ? rewardStyle.activeFilterLink : null,
|
||||||
|
]}
|
||||||
|
text={__('Available')}
|
||||||
|
onPress={() => this.setFilter(FILTER_AVAILABLE)}
|
||||||
|
/>
|
||||||
|
<Link
|
||||||
|
style={[rewardStyle.filterLink, currentFilter === FILTER_CLAIMED ? rewardStyle.activeFilterLink : null]}
|
||||||
|
text={__('Claimed')}
|
||||||
|
onPress={() => this.setFilter(FILTER_CLAIMED)}
|
||||||
|
/>
|
||||||
|
</View>
|
||||||
|
|
||||||
|
{(currentFilter === FILTER_AVAILABLE || currentFilter === FILTER_ALL) && this.renderUnclaimedRewards()}
|
||||||
|
{(currentFilter === FILTER_CLAIMED || currentFilter === FILTER_ALL) && this.renderClaimedRewards()}
|
||||||
</ScrollView>
|
</ScrollView>
|
||||||
)}
|
)}
|
||||||
</View>
|
</View>
|
||||||
|
|||||||
@@ -1,36 +1,46 @@
|
|||||||
import { connect } from 'react-redux';
|
import { connect } from 'react-redux';
|
||||||
import {
|
import {
|
||||||
doSearch,
|
doClaimSearch,
|
||||||
|
doResolveUris,
|
||||||
|
doResolvedSearch,
|
||||||
doUpdateSearchQuery,
|
doUpdateSearchQuery,
|
||||||
|
makeSelectResolvedSearchResults,
|
||||||
|
makeSelectResolvedSearchResultsLastPageReached,
|
||||||
makeSelectSearchUris,
|
makeSelectSearchUris,
|
||||||
|
selectClaimSearchByQuery,
|
||||||
selectIsSearching,
|
selectIsSearching,
|
||||||
|
selectResolvingUris,
|
||||||
selectSearchValue,
|
selectSearchValue,
|
||||||
makeSelectQueryWithOptions,
|
makeSelectQueryWithOptions,
|
||||||
selectSearchUrisByQuery,
|
|
||||||
} from 'lbry-redux';
|
} from 'lbry-redux';
|
||||||
import { doPushDrawerStack, doSetPlayerVisible } from 'redux/actions/drawer';
|
import { doPushDrawerStack, doSetPlayerVisible } from 'redux/actions/drawer';
|
||||||
import { selectCurrentRoute } from 'redux/selectors/drawer';
|
import { selectCurrentRoute } from 'redux/selectors/drawer';
|
||||||
import Constants from 'constants'; // eslint-disable-line node/no-deprecated-api
|
import Constants from 'constants'; // eslint-disable-line node/no-deprecated-api
|
||||||
import SearchPage from './view';
|
import SearchPage from './view';
|
||||||
|
|
||||||
const numSearchResults = 50;
|
|
||||||
|
|
||||||
const select = state => ({
|
const select = state => ({
|
||||||
|
claimSearchByQuery: selectClaimSearchByQuery(state),
|
||||||
currentRoute: selectCurrentRoute(state),
|
currentRoute: selectCurrentRoute(state),
|
||||||
isSearching: selectIsSearching(state),
|
isSearching: selectIsSearching(state),
|
||||||
query: selectSearchValue(state),
|
query: selectSearchValue(state),
|
||||||
uris: makeSelectSearchUris(makeSelectQueryWithOptions(null, numSearchResults)(state))(state),
|
resolvingUris: selectResolvingUris(state),
|
||||||
urisByQuery: selectSearchUrisByQuery(state),
|
uris: makeSelectSearchUris(makeSelectQueryWithOptions(null, Constants.DEFAULT_PAGE_SIZE)(state))(state),
|
||||||
|
results: makeSelectResolvedSearchResults(makeSelectQueryWithOptions(null, Constants.DEFAULT_PAGE_SIZE)(state))(state),
|
||||||
|
lastPageReached: makeSelectResolvedSearchResultsLastPageReached(
|
||||||
|
makeSelectQueryWithOptions(null, Constants.DEFAULT_PAGE_SIZE)(state),
|
||||||
|
)(state),
|
||||||
});
|
});
|
||||||
|
|
||||||
const perform = dispatch => ({
|
const perform = dispatch => ({
|
||||||
search: query => dispatch(doSearch(query, numSearchResults)),
|
search: (query, from) => dispatch(doResolvedSearch(query, Constants.DEFAULT_PAGE_SIZE, from, false, {})),
|
||||||
|
claimSearch: options => dispatch(doClaimSearch(options)),
|
||||||
updateSearchQuery: query => dispatch(doUpdateSearchQuery(query)),
|
updateSearchQuery: query => dispatch(doUpdateSearchQuery(query)),
|
||||||
pushDrawerStack: () => dispatch(doPushDrawerStack(Constants.DRAWER_ROUTE_SEARCH)),
|
pushDrawerStack: () => dispatch(doPushDrawerStack(Constants.DRAWER_ROUTE_SEARCH)),
|
||||||
|
resolveUris: uris => dispatch(doResolveUris(uris)),
|
||||||
setPlayerVisible: () => dispatch(doSetPlayerVisible(false)),
|
setPlayerVisible: () => dispatch(doSetPlayerVisible(false)),
|
||||||
});
|
});
|
||||||
|
|
||||||
export default connect(
|
export default connect(
|
||||||
select,
|
select,
|
||||||
perform
|
perform,
|
||||||
)(SearchPage);
|
)(SearchPage);
|
||||||
Loaded 100 of 165 files, more files were not shown because too many files have changed in this diff.
Show more
Reference in new issue
Block a user