Compare commits
125
Commits
| Author | SHA1 | Date | |
|---|---|---|---|
|
|
b17ce45f22 | ||
|
|
53f143f232 | ||
|
|
c58aecb35e | ||
|
|
2685d0f7a9 | ||
|
|
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 | ||
|
|
23cf8b15bc | ||
|
|
76cc8eaea1 | ||
|
|
f372b33f42 | ||
|
|
a26fb3e06b | ||
|
|
8bd3bd21e8 | ||
|
|
0115025b86 | ||
|
|
34fa24ffd0 | ||
|
|
9e8ba95fec | ||
|
|
d63253cc30 | ||
|
|
6ce143b145 | ||
|
|
c7ce7ea284 | ||
|
|
076122def4 | ||
|
|
625559528d |
No files matched your search
@@ -1,6 +1,6 @@
|
||||
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:
|
||||
|
||||
|
||||
@@ -0,0 +1,242 @@
|
||||
{
|
||||
"Waiting for name resolution": "Waiting for name resolution",
|
||||
"Starting up": "Starting up",
|
||||
"Connecting": "Connecting",
|
||||
"Unlocking account": "Unlocking account",
|
||||
"Decrypting wallet": "Decrypting wallet",
|
||||
"Your Tags": "Your Tags",
|
||||
"Customize": "Customize",
|
||||
"Find content": "Find content",
|
||||
"Your content": "Your content",
|
||||
"Wallet": "Wallet",
|
||||
"All tags you follow": "All tags you follow",
|
||||
"FREE": "FREE",
|
||||
"Delete": "Delete",
|
||||
"Share": "Share",
|
||||
"Tip": "Tip",
|
||||
"Report": "Report",
|
||||
"View": "View",
|
||||
"Follow": "Follow",
|
||||
"Fetching cost info...": "Fetching cost info...",
|
||||
"Play": "Play",
|
||||
"Channels you follow": "Channels you follow",
|
||||
"Suggested": "Suggested",
|
||||
"ALL": "ALL",
|
||||
"No content to display at this time. Please check back later.": "No content to display at this time. Please check back later.",
|
||||
"All Content": "All Content",
|
||||
"Create a channel": "Create a channel",
|
||||
"Title": "Title",
|
||||
"Channel": "Channel",
|
||||
"Deposit": "Deposit",
|
||||
"This LBC remains yours. It is a deposit to reserve the name and can be undone at any time.": "This LBC remains yours. It is a deposit to reserve the name and can be undone at any time.",
|
||||
"Show optional fields": "Show optional fields",
|
||||
"Cancel": "Cancel",
|
||||
"Create": "Create",
|
||||
"Description": "Description",
|
||||
"Website": "Website",
|
||||
"Email": "Email",
|
||||
"Tags": "Tags",
|
||||
"Hide optional fields": "Hide optional fields",
|
||||
"Mature tags": "Mature tags",
|
||||
"Other": "Other",
|
||||
"Publish something new": "Publish something new",
|
||||
"Record": "Record",
|
||||
"Take a photo": "Take a photo",
|
||||
"Upload a file": "Upload a file",
|
||||
"Please wait while we load your videos...": "Please wait while we load your videos...",
|
||||
"Price": "Price",
|
||||
"Your content will be free. Press the toggle to set a price.": "Your content will be free. Press the toggle to set a price.",
|
||||
"Content address": "Content address",
|
||||
"The address where people can find your content (ex. lbry://myvideo). ": "The address where people can find your content (ex. lbry://myvideo). ",
|
||||
"This LBC remains yours and the deposit can be undone at any time.": "This LBC remains yours and the deposit can be undone at any time.",
|
||||
"Show extra fields": "Show extra fields",
|
||||
"Publish": "Publish",
|
||||
"Additional Options": "Additional Options",
|
||||
"Language": "Language",
|
||||
"License": "License",
|
||||
"None": "None",
|
||||
"Public Domain": "Public Domain",
|
||||
"Copyrighted...": "Copyrighted...",
|
||||
"Other...": "Other...",
|
||||
"Hide extra fields": "Hide extra fields",
|
||||
"Balance": "Balance",
|
||||
"You currently have": "You currently have",
|
||||
"Receive Credits": "Receive Credits",
|
||||
"Use this wallet address to receive credits sent by another user (or yourself).": "Use this wallet address to receive credits sent by another user (or yourself).",
|
||||
"Get new address": "Get new address",
|
||||
"You can generate a new address at any time, and any previous addresses will continue to work. Using multiple addresses can be helpful for keeping track of incoming payments from multiple sources.": "You can generate a new address at any time, and any previous addresses will continue to work. Using multiple addresses can be helpful for keeping track of incoming payments from multiple sources.",
|
||||
"Send Credits": "Send Credits",
|
||||
"Recipient address": "Recipient address",
|
||||
"Amount": "Amount",
|
||||
"View All": "View All",
|
||||
"Looks like you don't have any recent transactions.": "Looks like you don't have any recent transactions.",
|
||||
"Wallet Sync": "Wallet Sync",
|
||||
"Sync status": "Sync status",
|
||||
"On": "On",
|
||||
"Connected email": "Connected email",
|
||||
"Manual backup": "Manual backup",
|
||||
"Fetching transactions...": "Fetching transactions...",
|
||||
"Loading transactions...": "Loading transactions...",
|
||||
"The transaction URL could not be opened": "The transaction URL could not be opened",
|
||||
"LBRY credits allow you to purchase content, publish content, and influence the network.": "LBRY credits allow you to purchase content, publish content, and influence the network.",
|
||||
"You get credits for free for providing an email address and taking other basic actions.": "You get credits for free for providing an email address and taking other basic actions.",
|
||||
"Learn more": "Learn more",
|
||||
"Not interested": "Not interested",
|
||||
"Get started": "Get started",
|
||||
"Fetching rewards...": "Fetching rewards...",
|
||||
"Custom Code": "Custom Code",
|
||||
"Are you a supermodel or rockstar that received a custom reward code? Claim it here.": "Are you a supermodel or rockstar that received a custom reward code? Claim it here.",
|
||||
"Settings": "Settings",
|
||||
"Content": "Content",
|
||||
"Enable background media playback": "Enable background media playback",
|
||||
"Enable this option to play audio or video in the background when the app is suspended.": "Enable this option to play audio or video in the background when the app is suspended.",
|
||||
"Choose language": "Choose language",
|
||||
"Show mature content": "Show mature content",
|
||||
"Notifications": "Notifications",
|
||||
"Choose the notifications you would like to receive.": "Choose the notifications you would like to receive.",
|
||||
"Subscriptions": "Subscriptions",
|
||||
"Rewards": "Rewards",
|
||||
"Content Interests": "Content Interests",
|
||||
"Search": "Search",
|
||||
"Show URL suggestions": "Show URL suggestions",
|
||||
"Keep the SDK background service running after closing the app": "Keep the SDK background service running after closing the app",
|
||||
"Enable this option for quicker app launch and to keep the synchronisation with the blockchain up to date.": "Enable this option for quicker app launch and to keep the synchronisation with the blockchain up to date.",
|
||||
"Loading...": "Loading...",
|
||||
"LBRY is a free, open, and community-run digital marketplace. It is a decentralized peer-to-peer content distribution platform for creators to upload and share content, and earn LBRY credits for their effort. Users will be able to find a wide selection of videos, music, ebooks and other digital content they are interested in.": "LBRY is a free, open, and community-run digital marketplace. It is a decentralized peer-to-peer content distribution platform for creators to upload and share content, and earn LBRY credits for their effort. Users will be able to find a wide selection of videos, music, ebooks and other digital content they are interested in.",
|
||||
"What is LBRY?": "What is LBRY?",
|
||||
"Android App Basics": "Android App Basics",
|
||||
"Frequently Asked Questions": "Frequently Asked Questions",
|
||||
"You can interact with the LBRY team and members of the community on Discord, Facebook, Instagram, Twitter or Reddit.": "You can interact with the LBRY team and members of the community on Discord, Facebook, Instagram, Twitter or Reddit.",
|
||||
"App info": "App info",
|
||||
"Update mailing preferences": "Update mailing preferences",
|
||||
"App version": "App version",
|
||||
"LBRY SDK": "LBRY SDK",
|
||||
"Platform": "Platform",
|
||||
"Installation ID": "Installation ID",
|
||||
"Logs": "Logs",
|
||||
"Send log": "Send log",
|
||||
"Testing network": "Testing network",
|
||||
"Spanish": "Spanish",
|
||||
"Portuguese": "Portuguese",
|
||||
"Polish": "Polish",
|
||||
"Malay": "Malay",
|
||||
"Please wait while we get some things ready...": "Please wait while we get some things ready...",
|
||||
"LBRY is a community-controlled content platform where you can find and publish videos, music, books, and more.": "LBRY is a community-controlled content platform where you can find and publish videos, music, books, and more.",
|
||||
"Continue": "Continue",
|
||||
"Setup account": "Setup account",
|
||||
"An account will allow you to earn rewards and keep your account and settings synced.": "An account will allow you to earn rewards and keep your account and settings synced.",
|
||||
"This information is disclosed only to LBRY, Inc. and not to the LBRY network.": "This information is disclosed only to LBRY, Inc. and not to the LBRY network.",
|
||||
"No, thanks": "No, thanks",
|
||||
"Use LBRY": "Use LBRY",
|
||||
"Are you sure?": "Are you sure?",
|
||||
"Without an account, you will not receive rewards, sync and backup services, or security updates.": "Without an account, you will not receive rewards, sync and backup services, or security updates.",
|
||||
"I understand that by uninstalling LBRY I will lose any balances or published content with no recovery option if it is not backed up manually (see wallet page)": "I understand that by uninstalling LBRY I will lose any balances or published content with no recovery option if it is not backed up manually (see wallet page)",
|
||||
"Change email": "Change email",
|
||||
"Your email address was successfully verified.": "Your email address was successfully verified.",
|
||||
"Retrieving your account information...": "Retrieving your account information...",
|
||||
"Synchronizing": "Synchronizing",
|
||||
"Validating password": "Validating password",
|
||||
"Invalid password specified. Please enter the password for your previously synchronised wallet.": "Invalid password specified. Please enter the password for your previously synchronised wallet.",
|
||||
"Please enter the password you used to secure your wallet.": "Please enter the password you used to secure your wallet.",
|
||||
"If you did not provide a password, please press Use LBRY to continue.": "If you did not provide a password, please press Use LBRY to continue.",
|
||||
"Note: for wallet security purposes, LBRY is unable to reset your password.": "Note: for wallet security purposes, LBRY is unable to reset your password.",
|
||||
"More tags you follow": "More tags you follow",
|
||||
"Blockchain Sync": "Blockchain Sync",
|
||||
"Network Loading": "Network Loading",
|
||||
"Initializing LBRY service": "Initializing LBRY service",
|
||||
"Sign In": "Sign In",
|
||||
"SIGN IN": "SIGN IN",
|
||||
"You have not created a channel.\nStart now by creating a new channel!": "You have not created a channel.\nStart now by creating a new channel!",
|
||||
"Send verification email": "Send verification email",
|
||||
"You do not have any\ndownloaded content on this device.": "You do not have any\ndownloaded content on this device.",
|
||||
"It looks like you have not\npublished any content to LBRY yet.": "It looks like you have not\npublished any content to LBRY yet.",
|
||||
"An account with LBRY Inc. allows you to earn rewards, backup your wallet, and keep everything synced.": "An account with LBRY Inc. allows you to earn rewards, backup your wallet, and keep everything synced.",
|
||||
"Without an account, you assume all responsibility for securing your wallet and LBRY data.": "Without an account, you assume all responsibility for securing your wallet and LBRY data.",
|
||||
"Skip Account": "Skip Account",
|
||||
"Sign Up": "Sign Up",
|
||||
"Indonesian": "Indonesian",
|
||||
"Hindi": "Hindi",
|
||||
"Verify Email": "Verify Email",
|
||||
"Resend": "Resend",
|
||||
"Edit": "Edit",
|
||||
"Please follow the instructions in the email sent to your address to continue.": "Please follow the instructions in the email sent to your address to continue.",
|
||||
"Please enter a password to secure your account and wallet.": "Please enter a password to secure your account and wallet.",
|
||||
"Anonymous": "Anonymous",
|
||||
"Connecting...": "Connecting...",
|
||||
"Gujarati": "Gujarati",
|
||||
"Turkish": "Turkish",
|
||||
"Italian": "Italian",
|
||||
"English": "English",
|
||||
"Use device language": "Use device language",
|
||||
"Tags you follow": "Tags you follow",
|
||||
"Everyone": "Everyone",
|
||||
"Greek": "Greek",
|
||||
"Romanian": "Romanian",
|
||||
"Norwegian": "Norwegian",
|
||||
"Korean": "Korean",
|
||||
"Cambodian": "Cambodian",
|
||||
"Croatian": "Croatian",
|
||||
"Czech": "Czech",
|
||||
"Arabic": "Arabic",
|
||||
"Thai": "Thai",
|
||||
"Vietnamese": "Vietnamese",
|
||||
"Dutch": "Dutch",
|
||||
"Russian": "Russian",
|
||||
"Japanese": "Japanese",
|
||||
"German": "German",
|
||||
"Trending": "Trending",
|
||||
"Channels": "Channels",
|
||||
"Library": "Library",
|
||||
"Publishes": "Publishes",
|
||||
"New Publish": "New Publish",
|
||||
"About": "About",
|
||||
"Sort content by": "Sort content by",
|
||||
"Trending content": "Trending content",
|
||||
"New content": "New content",
|
||||
"Top content": "Top content",
|
||||
"Search movies, music, and more": "Search movies, music, and more",
|
||||
"Please provide a valid email address to continue.": "Please provide a valid email address to continue.",
|
||||
"A lbry.tv account allows you to earn rewards, backup your wallet, and keep everything in sync.": "A lbry.tv account allows you to earn rewards, backup your wallet, and keep everything in sync.",
|
||||
"%num% blocks behind": "%num% blocks behind",
|
||||
"Catching up with the blockchain ($%progress%%)": "Catching up with the blockchain ($%progress%%)",
|
||||
"Catching up with the blockchain (%progress%%)": "Catching up with the blockchain (%progress%%)",
|
||||
"Get %amount% free credits after creating an account.": "Get %amount% free credits after creating an account.",
|
||||
"Off": "Off",
|
||||
"Sync FAQ": "Sync FAQ",
|
||||
"Please provide an email address.": "Please provide an email address.",
|
||||
"An email has been sent to": "An email has been sent to",
|
||||
"Please click the link in the message to complete signing in.": "Please click the link in the message to complete signing in.",
|
||||
"%amount% free credits available in rewards.": "%amount% free credits available in rewards.",
|
||||
"Tap to learn more.": "Tap to learn more.",
|
||||
"password": "password",
|
||||
"Enable sync": "Enable sync",
|
||||
"Disable wallet sync": "Disable wallet sync",
|
||||
"Are you sure you want to turn off wallet sync?": "Are you sure you want to turn off wallet sync?",
|
||||
"No": "No",
|
||||
"Yes": "Yes",
|
||||
"Wallet sync was successfully disabled.": "Wallet sync was successfully disabled.",
|
||||
"more": "more",
|
||||
"Related Content": "Related Content",
|
||||
"There are no results to display for \"%query%\". Please try a different search term.": "There are no results to display for \"%query%\". Please try a different search term.",
|
||||
"Download": "Download",
|
||||
"This content is Not Safe For Work. To view adult content, please change your Settings.": "This content is Not Safe For Work. To view adult content, please change your Settings.",
|
||||
"Stop": "Stop",
|
||||
"%progress%% complete": "%progress%% complete",
|
||||
"Customize your tags": "Customize your tags",
|
||||
"Done": "Done",
|
||||
"Search for more tags": "Search for more tags",
|
||||
"Send": "Send",
|
||||
"Recent Transactions": "Recent Transactions",
|
||||
"Nothing here. Publish something!": "Nothing here. Publish something!",
|
||||
"CONTENT": "CONTENT",
|
||||
"ABOUT": "ABOUT",
|
||||
"New": "New",
|
||||
"Content Freedom": "Content Freedom",
|
||||
"Get Social": "Get Social",
|
||||
"used": "used",
|
||||
"Stats": "Stats",
|
||||
"Welcome to LBRY.": "Welcome to LBRY.",
|
||||
"Account Recommended": "Account Recommended",
|
||||
"%amount% available credits": "%amount% available credits",
|
||||
"%amount% available credit": "%amount% available credit"
|
||||
}
|
||||
Generated
+156
-79
@@ -4160,22 +4160,26 @@
|
||||
"dependencies": {
|
||||
"abbrev": {
|
||||
"version": "1.1.1",
|
||||
"bundled": true,
|
||||
"resolved": false,
|
||||
"integrity": "sha512-nne9/IiQ/hzIhY6pdDnbBtz7DjPTKrY00P/zvPSm5pOFkl6xuGrGnXn/VtTNNfNtAfZ9/1RtehkszU9qcTii0Q==",
|
||||
"optional": true
|
||||
},
|
||||
"ansi-regex": {
|
||||
"version": "2.1.1",
|
||||
"bundled": true,
|
||||
"resolved": false,
|
||||
"integrity": "sha1-w7M6te42DYbg5ijwRorn7yfWVN8=",
|
||||
"optional": true
|
||||
},
|
||||
"aproba": {
|
||||
"version": "1.2.0",
|
||||
"bundled": true,
|
||||
"resolved": false,
|
||||
"integrity": "sha512-Y9J6ZjXtoYh8RnXVCMOU/ttDmk1aBjunq9vO0ta5x85WDQiQfUF9sIPBITdbiiIVcBo03Hi3jMxigBtsddlXRw==",
|
||||
"optional": true
|
||||
},
|
||||
"are-we-there-yet": {
|
||||
"version": "1.1.5",
|
||||
"bundled": true,
|
||||
"resolved": false,
|
||||
"integrity": "sha512-5hYdAkZlcG8tOLujVDTgCT+uPX0VnpAH28gWsLfzpXYm7wP6mp5Q/gYyR7YQ0cKVJcXJnl3j2kpBan13PtQf6w==",
|
||||
"optional": true,
|
||||
"requires": {
|
||||
"delegates": "^1.0.0",
|
||||
@@ -4184,12 +4188,14 @@
|
||||
},
|
||||
"balanced-match": {
|
||||
"version": "1.0.0",
|
||||
"bundled": true,
|
||||
"resolved": false,
|
||||
"integrity": "sha1-ibTRmasr7kneFk6gK4nORi1xt2c=",
|
||||
"optional": true
|
||||
},
|
||||
"brace-expansion": {
|
||||
"version": "1.1.11",
|
||||
"bundled": true,
|
||||
"resolved": false,
|
||||
"integrity": "sha512-iCuPHDFgrHX7H2vEI/5xpz07zSHB00TpugqhmYtVmMO6518mCuRMoOYFldEBl0g187ufozdaHgWKcYFb61qGiA==",
|
||||
"optional": true,
|
||||
"requires": {
|
||||
"balanced-match": "^1.0.0",
|
||||
@@ -4198,32 +4204,38 @@
|
||||
},
|
||||
"chownr": {
|
||||
"version": "1.1.1",
|
||||
"bundled": true,
|
||||
"resolved": false,
|
||||
"integrity": "sha512-j38EvO5+LHX84jlo6h4UzmOwi0UgW61WRyPtJz4qaadK5eY3BTS5TY/S1Stc3Uk2lIM6TPevAlULiEJwie860g==",
|
||||
"optional": true
|
||||
},
|
||||
"code-point-at": {
|
||||
"version": "1.1.0",
|
||||
"bundled": true,
|
||||
"resolved": false,
|
||||
"integrity": "sha1-DQcLTQQ6W+ozovGkDi7bPZpMz3c=",
|
||||
"optional": true
|
||||
},
|
||||
"concat-map": {
|
||||
"version": "0.0.1",
|
||||
"bundled": true,
|
||||
"resolved": false,
|
||||
"integrity": "sha1-2Klr13/Wjfd5OnMDajug1UBdR3s=",
|
||||
"optional": true
|
||||
},
|
||||
"console-control-strings": {
|
||||
"version": "1.1.0",
|
||||
"bundled": true,
|
||||
"resolved": false,
|
||||
"integrity": "sha1-PXz0Rk22RG6mRL9LOVB/mFEAjo4=",
|
||||
"optional": true
|
||||
},
|
||||
"core-util-is": {
|
||||
"version": "1.0.2",
|
||||
"bundled": true,
|
||||
"resolved": false,
|
||||
"integrity": "sha1-tf1UIgqivFq1eqtxQMlAdUUDwac=",
|
||||
"optional": true
|
||||
},
|
||||
"debug": {
|
||||
"version": "4.1.1",
|
||||
"bundled": true,
|
||||
"resolved": false,
|
||||
"integrity": "sha512-pYAIzeRo8J6KPEaJ0VWOh5Pzkbw/RetuzehGM7QRRX5he4fPHx2rdKMB256ehJCkX+XRQm16eZLqLNS8RSZXZw==",
|
||||
"optional": true,
|
||||
"requires": {
|
||||
"ms": "^2.1.1"
|
||||
@@ -4231,22 +4243,26 @@
|
||||
},
|
||||
"deep-extend": {
|
||||
"version": "0.6.0",
|
||||
"bundled": true,
|
||||
"resolved": false,
|
||||
"integrity": "sha512-LOHxIOaPYdHlJRtCQfDIVZtfw/ufM8+rVj649RIHzcm/vGwQRXFt6OPqIFWsm2XEMrNIEtWR64sY1LEKD2vAOA==",
|
||||
"optional": true
|
||||
},
|
||||
"delegates": {
|
||||
"version": "1.0.0",
|
||||
"bundled": true,
|
||||
"resolved": false,
|
||||
"integrity": "sha1-hMbhWbgZBP3KWaDvRM2HDTElD5o=",
|
||||
"optional": true
|
||||
},
|
||||
"detect-libc": {
|
||||
"version": "1.0.3",
|
||||
"bundled": true,
|
||||
"resolved": false,
|
||||
"integrity": "sha1-+hN8S9aY7fVc1c0CrFWfkaTEups=",
|
||||
"optional": true
|
||||
},
|
||||
"fs-minipass": {
|
||||
"version": "1.2.5",
|
||||
"bundled": true,
|
||||
"resolved": false,
|
||||
"integrity": "sha512-JhBl0skXjUPCFH7x6x61gQxrKyXsxB5gcgePLZCwfyCGGsTISMoIeObbrvVeP6Xmyaudw4TT43qV2Gz+iyd2oQ==",
|
||||
"optional": true,
|
||||
"requires": {
|
||||
"minipass": "^2.2.1"
|
||||
@@ -4254,12 +4270,14 @@
|
||||
},
|
||||
"fs.realpath": {
|
||||
"version": "1.0.0",
|
||||
"bundled": true,
|
||||
"resolved": false,
|
||||
"integrity": "sha1-FQStJSMVjKpA20onh8sBQRmU6k8=",
|
||||
"optional": true
|
||||
},
|
||||
"gauge": {
|
||||
"version": "2.7.4",
|
||||
"bundled": true,
|
||||
"resolved": false,
|
||||
"integrity": "sha1-LANAXHU4w51+s3sxcCLjJfsBi/c=",
|
||||
"optional": true,
|
||||
"requires": {
|
||||
"aproba": "^1.0.3",
|
||||
@@ -4274,7 +4292,8 @@
|
||||
},
|
||||
"glob": {
|
||||
"version": "7.1.3",
|
||||
"bundled": true,
|
||||
"resolved": false,
|
||||
"integrity": "sha512-vcfuiIxogLV4DlGBHIUOwI0IbrJ8HWPc4MU7HzviGeNho/UJDfi6B5p3sHeWIQ0KGIU0Jpxi5ZHxemQfLkkAwQ==",
|
||||
"optional": true,
|
||||
"requires": {
|
||||
"fs.realpath": "^1.0.0",
|
||||
@@ -4287,12 +4306,14 @@
|
||||
},
|
||||
"has-unicode": {
|
||||
"version": "2.0.1",
|
||||
"bundled": true,
|
||||
"resolved": false,
|
||||
"integrity": "sha1-4Ob+aijPUROIVeCG0Wkedx3iqLk=",
|
||||
"optional": true
|
||||
},
|
||||
"iconv-lite": {
|
||||
"version": "0.4.24",
|
||||
"bundled": true,
|
||||
"resolved": false,
|
||||
"integrity": "sha512-v3MXnZAcvnywkTUEZomIActle7RXXeedOR31wwl7VlyoXO4Qi9arvSenNQWne1TcRwhCL1HwLI21bEqdpj8/rA==",
|
||||
"optional": true,
|
||||
"requires": {
|
||||
"safer-buffer": ">= 2.1.2 < 3"
|
||||
@@ -4300,7 +4321,8 @@
|
||||
},
|
||||
"ignore-walk": {
|
||||
"version": "3.0.1",
|
||||
"bundled": true,
|
||||
"resolved": false,
|
||||
"integrity": "sha512-DTVlMx3IYPe0/JJcYP7Gxg7ttZZu3IInhuEhbchuqneY9wWe5Ojy2mXLBaQFUQmo0AW2r3qG7m1mg86js+gnlQ==",
|
||||
"optional": true,
|
||||
"requires": {
|
||||
"minimatch": "^3.0.4"
|
||||
@@ -4308,7 +4330,8 @@
|
||||
},
|
||||
"inflight": {
|
||||
"version": "1.0.6",
|
||||
"bundled": true,
|
||||
"resolved": false,
|
||||
"integrity": "sha1-Sb1jMdfQLQwJvJEKEHW6gWW1bfk=",
|
||||
"optional": true,
|
||||
"requires": {
|
||||
"once": "^1.3.0",
|
||||
@@ -4317,17 +4340,20 @@
|
||||
},
|
||||
"inherits": {
|
||||
"version": "2.0.3",
|
||||
"bundled": true,
|
||||
"resolved": false,
|
||||
"integrity": "sha1-Yzwsg+PaQqUC9SRmAiSA9CCCYd4=",
|
||||
"optional": true
|
||||
},
|
||||
"ini": {
|
||||
"version": "1.3.5",
|
||||
"bundled": true,
|
||||
"resolved": false,
|
||||
"integrity": "sha512-RZY5huIKCMRWDUqZlEi72f/lmXKMvuszcMBduliQ3nnWbx9X/ZBQO7DijMEYS9EhHBb2qacRUMtC7svLwe0lcw==",
|
||||
"optional": true
|
||||
},
|
||||
"is-fullwidth-code-point": {
|
||||
"version": "1.0.0",
|
||||
"bundled": true,
|
||||
"resolved": false,
|
||||
"integrity": "sha1-754xOG8DGn8NZDr4L95QxFfvAMs=",
|
||||
"optional": true,
|
||||
"requires": {
|
||||
"number-is-nan": "^1.0.0"
|
||||
@@ -4335,12 +4361,14 @@
|
||||
},
|
||||
"isarray": {
|
||||
"version": "1.0.0",
|
||||
"bundled": true,
|
||||
"resolved": false,
|
||||
"integrity": "sha1-u5NdSFgsuhaMBoNJV6VKPgcSTxE=",
|
||||
"optional": true
|
||||
},
|
||||
"minimatch": {
|
||||
"version": "3.0.4",
|
||||
"bundled": true,
|
||||
"resolved": false,
|
||||
"integrity": "sha512-yJHVQEhyqPLUTgt9B83PXu6W3rx4MvvHvSUvToogpwoGDOUQ+yDrR0HRot+yOCdCO7u4hX3pWft6kWBBcqh0UA==",
|
||||
"optional": true,
|
||||
"requires": {
|
||||
"brace-expansion": "^1.1.7"
|
||||
@@ -4348,12 +4376,14 @@
|
||||
},
|
||||
"minimist": {
|
||||
"version": "0.0.8",
|
||||
"bundled": true,
|
||||
"resolved": false,
|
||||
"integrity": "sha1-hX/Kv8M5fSYluCKCYuhqp6ARsF0=",
|
||||
"optional": true
|
||||
},
|
||||
"minipass": {
|
||||
"version": "2.3.5",
|
||||
"bundled": true,
|
||||
"resolved": false,
|
||||
"integrity": "sha512-Gi1W4k059gyRbyVUZQ4mEqLm0YIUiGYfvxhF6SIlk3ui1WVxMTGfGdQ2SInh3PDrRTVvPKgULkpJtT4RH10+VA==",
|
||||
"optional": true,
|
||||
"requires": {
|
||||
"safe-buffer": "^5.1.2",
|
||||
@@ -4362,7 +4392,8 @@
|
||||
},
|
||||
"minizlib": {
|
||||
"version": "1.2.1",
|
||||
"bundled": true,
|
||||
"resolved": false,
|
||||
"integrity": "sha512-7+4oTUOWKg7AuL3vloEWekXY2/D20cevzsrNT2kGWm+39J9hGTCBv8VI5Pm5lXZ/o3/mdR4f8rflAPhnQb8mPA==",
|
||||
"optional": true,
|
||||
"requires": {
|
||||
"minipass": "^2.2.1"
|
||||
@@ -4370,7 +4401,8 @@
|
||||
},
|
||||
"mkdirp": {
|
||||
"version": "0.5.1",
|
||||
"bundled": true,
|
||||
"resolved": false,
|
||||
"integrity": "sha1-MAV0OOrGz3+MR2fzhkjWaX11yQM=",
|
||||
"optional": true,
|
||||
"requires": {
|
||||
"minimist": "0.0.8"
|
||||
@@ -4378,12 +4410,14 @@
|
||||
},
|
||||
"ms": {
|
||||
"version": "2.1.1",
|
||||
"bundled": true,
|
||||
"resolved": false,
|
||||
"integrity": "sha512-tgp+dl5cGk28utYktBsrFqA7HKgrhgPsg6Z/EfhWI4gl1Hwq8B/GmY/0oXZ6nF8hDVesS/FpnYaD/kOWhYQvyg==",
|
||||
"optional": true
|
||||
},
|
||||
"needle": {
|
||||
"version": "2.3.0",
|
||||
"bundled": true,
|
||||
"resolved": false,
|
||||
"integrity": "sha512-QBZu7aAFR0522EyaXZM0FZ9GLpq6lvQ3uq8gteiDUp7wKdy0lSd2hPlgFwVuW1CBkfEs9PfDQsQzZghLs/psdg==",
|
||||
"optional": true,
|
||||
"requires": {
|
||||
"debug": "^4.1.0",
|
||||
@@ -4393,7 +4427,8 @@
|
||||
},
|
||||
"node-pre-gyp": {
|
||||
"version": "0.12.0",
|
||||
"bundled": true,
|
||||
"resolved": false,
|
||||
"integrity": "sha512-4KghwV8vH5k+g2ylT+sLTjy5wmUOb9vPhnM8NHvRf9dHmnW/CndrFXy2aRPaPST6dugXSdHXfeaHQm77PIz/1A==",
|
||||
"optional": true,
|
||||
"requires": {
|
||||
"detect-libc": "^1.0.2",
|
||||
@@ -4410,7 +4445,8 @@
|
||||
},
|
||||
"nopt": {
|
||||
"version": "4.0.1",
|
||||
"bundled": true,
|
||||
"resolved": false,
|
||||
"integrity": "sha1-0NRoWv1UFRk8jHUFYC0NF81kR00=",
|
||||
"optional": true,
|
||||
"requires": {
|
||||
"abbrev": "1",
|
||||
@@ -4419,12 +4455,14 @@
|
||||
},
|
||||
"npm-bundled": {
|
||||
"version": "1.0.6",
|
||||
"bundled": true,
|
||||
"resolved": false,
|
||||
"integrity": "sha512-8/JCaftHwbd//k6y2rEWp6k1wxVfpFzB6t1p825+cUb7Ym2XQfhwIC5KwhrvzZRJu+LtDE585zVaS32+CGtf0g==",
|
||||
"optional": true
|
||||
},
|
||||
"npm-packlist": {
|
||||
"version": "1.4.1",
|
||||
"bundled": true,
|
||||
"resolved": false,
|
||||
"integrity": "sha512-+TcdO7HJJ8peiiYhvPxsEDhF3PJFGUGRcFsGve3vxvxdcpO2Z4Z7rkosRM0kWj6LfbK/P0gu3dzk5RU1ffvFcw==",
|
||||
"optional": true,
|
||||
"requires": {
|
||||
"ignore-walk": "^3.0.1",
|
||||
@@ -4433,7 +4471,8 @@
|
||||
},
|
||||
"npmlog": {
|
||||
"version": "4.1.2",
|
||||
"bundled": true,
|
||||
"resolved": false,
|
||||
"integrity": "sha512-2uUqazuKlTaSI/dC8AzicUck7+IrEaOnN/e0jd3Xtt1KcGpwx30v50mL7oPyr/h9bL3E4aZccVwpwP+5W9Vjkg==",
|
||||
"optional": true,
|
||||
"requires": {
|
||||
"are-we-there-yet": "~1.1.2",
|
||||
@@ -4444,17 +4483,20 @@
|
||||
},
|
||||
"number-is-nan": {
|
||||
"version": "1.0.1",
|
||||
"bundled": true,
|
||||
"resolved": false,
|
||||
"integrity": "sha1-CXtgK1NCKlIsGvuHkDGDNpQaAR0=",
|
||||
"optional": true
|
||||
},
|
||||
"object-assign": {
|
||||
"version": "4.1.1",
|
||||
"bundled": true,
|
||||
"resolved": false,
|
||||
"integrity": "sha1-IQmtx5ZYh8/AXLvUQsrIv7s2CGM=",
|
||||
"optional": true
|
||||
},
|
||||
"once": {
|
||||
"version": "1.4.0",
|
||||
"bundled": true,
|
||||
"resolved": false,
|
||||
"integrity": "sha1-WDsap3WWHUsROsF9nFC6753Xa9E=",
|
||||
"optional": true,
|
||||
"requires": {
|
||||
"wrappy": "1"
|
||||
@@ -4462,17 +4504,20 @@
|
||||
},
|
||||
"os-homedir": {
|
||||
"version": "1.0.2",
|
||||
"bundled": true,
|
||||
"resolved": false,
|
||||
"integrity": "sha1-/7xJiDNuDoM94MFox+8VISGqf7M=",
|
||||
"optional": true
|
||||
},
|
||||
"os-tmpdir": {
|
||||
"version": "1.0.2",
|
||||
"bundled": true,
|
||||
"resolved": false,
|
||||
"integrity": "sha1-u+Z0BseaqFxc/sdm/lc0VV36EnQ=",
|
||||
"optional": true
|
||||
},
|
||||
"osenv": {
|
||||
"version": "0.1.5",
|
||||
"bundled": true,
|
||||
"resolved": false,
|
||||
"integrity": "sha512-0CWcCECdMVc2Rw3U5w9ZjqX6ga6ubk1xDVKxtBQPK7wis/0F2r9T6k4ydGYhecl7YUBxBVxhL5oisPsNxAPe2g==",
|
||||
"optional": true,
|
||||
"requires": {
|
||||
"os-homedir": "^1.0.0",
|
||||
@@ -4481,17 +4526,20 @@
|
||||
},
|
||||
"path-is-absolute": {
|
||||
"version": "1.0.1",
|
||||
"bundled": true,
|
||||
"resolved": false,
|
||||
"integrity": "sha1-F0uSaHNVNP+8es5r9TpanhtcX18=",
|
||||
"optional": true
|
||||
},
|
||||
"process-nextick-args": {
|
||||
"version": "2.0.0",
|
||||
"bundled": true,
|
||||
"resolved": false,
|
||||
"integrity": "sha512-MtEC1TqN0EU5nephaJ4rAtThHtC86dNN9qCuEhtshvpVBkAW5ZO7BASN9REnF9eoXGcRub+pFuKEpOHE+HbEMw==",
|
||||
"optional": true
|
||||
},
|
||||
"rc": {
|
||||
"version": "1.2.8",
|
||||
"bundled": true,
|
||||
"resolved": false,
|
||||
"integrity": "sha512-y3bGgqKj3QBdxLbLkomlohkvsA8gdAiUQlSBJnBhfn+BPxg4bc62d8TcBW15wavDfgexCgccckhcZvywyQYPOw==",
|
||||
"optional": true,
|
||||
"requires": {
|
||||
"deep-extend": "^0.6.0",
|
||||
@@ -4502,14 +4550,16 @@
|
||||
"dependencies": {
|
||||
"minimist": {
|
||||
"version": "1.2.0",
|
||||
"bundled": true,
|
||||
"resolved": false,
|
||||
"integrity": "sha1-o1AIsg9BOD7sH7kU9M1d95omQoQ=",
|
||||
"optional": true
|
||||
}
|
||||
}
|
||||
},
|
||||
"readable-stream": {
|
||||
"version": "2.3.6",
|
||||
"bundled": true,
|
||||
"resolved": false,
|
||||
"integrity": "sha512-tQtKA9WIAhBF3+VLAseyMqZeBjW0AHJoxOtYqSUZNJxauErmLbVm2FW1y+J/YA9dUrAC39ITejlZWhVIwawkKw==",
|
||||
"optional": true,
|
||||
"requires": {
|
||||
"core-util-is": "~1.0.0",
|
||||
@@ -4523,7 +4573,8 @@
|
||||
},
|
||||
"rimraf": {
|
||||
"version": "2.6.3",
|
||||
"bundled": true,
|
||||
"resolved": false,
|
||||
"integrity": "sha512-mwqeW5XsA2qAejG46gYdENaxXjx9onRNCfn7L0duuP4hCuTIi/QO7PDK07KJfp1d+izWPrzEJDcSqBa0OZQriA==",
|
||||
"optional": true,
|
||||
"requires": {
|
||||
"glob": "^7.1.3"
|
||||
@@ -4531,37 +4582,44 @@
|
||||
},
|
||||
"safe-buffer": {
|
||||
"version": "5.1.2",
|
||||
"bundled": true,
|
||||
"resolved": false,
|
||||
"integrity": "sha512-Gd2UZBJDkXlY7GbJxfsE8/nvKkUEU1G38c1siN6QP6a9PT9MmHB8GnpscSmMJSoF8LOIrt8ud/wPtojys4G6+g==",
|
||||
"optional": true
|
||||
},
|
||||
"safer-buffer": {
|
||||
"version": "2.1.2",
|
||||
"bundled": true,
|
||||
"resolved": false,
|
||||
"integrity": "sha512-YZo3K82SD7Riyi0E1EQPojLz7kpepnSQI9IyPbHHg1XXXevb5dJI7tpyN2ADxGcQbHG7vcyRHk0cbwqcQriUtg==",
|
||||
"optional": true
|
||||
},
|
||||
"sax": {
|
||||
"version": "1.2.4",
|
||||
"bundled": true,
|
||||
"resolved": false,
|
||||
"integrity": "sha512-NqVDv9TpANUjFm0N8uM5GxL36UgKi9/atZw+x7YFnQ8ckwFGKrl4xX4yWtrey3UJm5nP1kUbnYgLopqWNSRhWw==",
|
||||
"optional": true
|
||||
},
|
||||
"semver": {
|
||||
"version": "5.7.0",
|
||||
"bundled": true,
|
||||
"resolved": false,
|
||||
"integrity": "sha512-Ya52jSX2u7QKghxeoFGpLwCtGlt7j0oY9DYb5apt9nPlJ42ID+ulTXESnt/qAQcoSERyZ5sl3LDIOw0nAn/5DA==",
|
||||
"optional": true
|
||||
},
|
||||
"set-blocking": {
|
||||
"version": "2.0.0",
|
||||
"bundled": true,
|
||||
"resolved": false,
|
||||
"integrity": "sha1-BF+XgtARrppoA93TgrJDkrPYkPc=",
|
||||
"optional": true
|
||||
},
|
||||
"signal-exit": {
|
||||
"version": "3.0.2",
|
||||
"bundled": true,
|
||||
"resolved": false,
|
||||
"integrity": "sha1-tf3AjxKH6hF4Yo5BXiUTK3NkbG0=",
|
||||
"optional": true
|
||||
},
|
||||
"string-width": {
|
||||
"version": "1.0.2",
|
||||
"bundled": true,
|
||||
"resolved": false,
|
||||
"integrity": "sha1-EYvfW4zcUaKn5w0hHgfisLmxB9M=",
|
||||
"optional": true,
|
||||
"requires": {
|
||||
"code-point-at": "^1.0.0",
|
||||
@@ -4571,7 +4629,8 @@
|
||||
},
|
||||
"string_decoder": {
|
||||
"version": "1.1.1",
|
||||
"bundled": true,
|
||||
"resolved": false,
|
||||
"integrity": "sha512-n/ShnvDi6FHbbVfviro+WojiFzv+s8MPMHBczVePfUpDJLwoLT0ht1l4YwBCbi8pJAveEEdnkHyPyTP/mzRfwg==",
|
||||
"optional": true,
|
||||
"requires": {
|
||||
"safe-buffer": "~5.1.0"
|
||||
@@ -4579,7 +4638,8 @@
|
||||
},
|
||||
"strip-ansi": {
|
||||
"version": "3.0.1",
|
||||
"bundled": true,
|
||||
"resolved": false,
|
||||
"integrity": "sha1-ajhfuIU9lS1f8F0Oiq+UJ43GPc8=",
|
||||
"optional": true,
|
||||
"requires": {
|
||||
"ansi-regex": "^2.0.0"
|
||||
@@ -4587,12 +4647,14 @@
|
||||
},
|
||||
"strip-json-comments": {
|
||||
"version": "2.0.1",
|
||||
"bundled": true,
|
||||
"resolved": false,
|
||||
"integrity": "sha1-PFMZQukIwml8DsNEhYwobHygpgo=",
|
||||
"optional": true
|
||||
},
|
||||
"tar": {
|
||||
"version": "4.4.8",
|
||||
"bundled": true,
|
||||
"resolved": false,
|
||||
"integrity": "sha512-LzHF64s5chPQQS0IYBn9IN5h3i98c12bo4NCO7e0sGM2llXQ3p2FGC5sdENN4cTW48O915Sh+x+EXx7XW96xYQ==",
|
||||
"optional": true,
|
||||
"requires": {
|
||||
"chownr": "^1.1.1",
|
||||
@@ -4606,12 +4668,14 @@
|
||||
},
|
||||
"util-deprecate": {
|
||||
"version": "1.0.2",
|
||||
"bundled": true,
|
||||
"resolved": false,
|
||||
"integrity": "sha1-RQ1Nyfpw3nMnYvvS1KKJgUGaDM8=",
|
||||
"optional": true
|
||||
},
|
||||
"wide-align": {
|
||||
"version": "1.1.3",
|
||||
"bundled": true,
|
||||
"resolved": false,
|
||||
"integrity": "sha512-QGkOQc8XL6Bt5PwnsExKBPuMKBxnGxWWW3fU55Xt4feHozMUhdUMaBCk290qpm/wG5u/RSKzwdAC4i51YigihA==",
|
||||
"optional": true,
|
||||
"requires": {
|
||||
"string-width": "^1.0.2 || 2"
|
||||
@@ -4619,12 +4683,14 @@
|
||||
},
|
||||
"wrappy": {
|
||||
"version": "1.0.2",
|
||||
"bundled": true,
|
||||
"resolved": false,
|
||||
"integrity": "sha1-tSQ9jz7BqjXxNkYFvA0QNuMKtp8=",
|
||||
"optional": true
|
||||
},
|
||||
"yallist": {
|
||||
"version": "3.0.3",
|
||||
"bundled": true,
|
||||
"resolved": false,
|
||||
"integrity": "sha512-S+Zk8DEWE6oKpV+vI3qWkaK+jSbIK86pCwe2IF/xwIpQ8jEuxpw9NyaGjmp9+BoJv5FV2piqCDcoCtStppiq2A==",
|
||||
"optional": true
|
||||
}
|
||||
}
|
||||
@@ -5574,8 +5640,8 @@
|
||||
}
|
||||
},
|
||||
"lbry-redux": {
|
||||
"version": "github:lbryio/lbry-redux#3133ea60b0302c162f7b6f67cc858997f1d2ab52",
|
||||
"from": "github:lbryio/lbry-redux#3133ea60b0302c162f7b6f67cc858997f1d2ab52",
|
||||
"version": "github:lbryio/lbry-redux#9b11cfed62af7f0f8eb6fa3c88a1f8d2cce46afc",
|
||||
"from": "github:lbryio/lbry-redux#9b11cfed62af7f0f8eb6fa3c88a1f8d2cce46afc",
|
||||
"requires": {
|
||||
"proxy-polyfill": "0.1.6",
|
||||
"reselect": "^3.0.0",
|
||||
@@ -5583,8 +5649,8 @@
|
||||
}
|
||||
},
|
||||
"lbryinc": {
|
||||
"version": "github:lbryio/lbryinc#b9f354ae50bd57691765a7d042c5054167878bf4",
|
||||
"from": "github:lbryio/lbryinc#b9f354ae50bd57691765a7d042c5054167878bf4",
|
||||
"version": "github:lbryio/lbryinc#9ffb883cc11e36d55a729c65b70c405a4a56d35e",
|
||||
"from": "github:lbryio/lbryinc#9ffb883cc11e36d55a729c65b70c405a4a56d35e",
|
||||
"requires": {
|
||||
"reselect": "^3.0.0"
|
||||
}
|
||||
@@ -8059,9 +8125,9 @@
|
||||
}
|
||||
},
|
||||
"react-native-gesture-handler": {
|
||||
"version": "1.1.0",
|
||||
"resolved": "https://registry.npmjs.org/react-native-gesture-handler/-/react-native-gesture-handler-1.1.0.tgz",
|
||||
"integrity": "sha512-E9IKHpmL+sz/iCYkUriTUjBaQBORWV+oheYPQleADkxjo2sYsQfnlyTz4EQYFONkUwJ6WmfTNkYt2/yc5U4Ziw==",
|
||||
"version": "1.3.0",
|
||||
"resolved": "https://registry.npmjs.org/react-native-gesture-handler/-/react-native-gesture-handler-1.3.0.tgz",
|
||||
"integrity": "sha512-ASRFIXBuKRvqlmwkWJhV8yP2dTpvcqVrLNpd7FKVBFHYWr6SAxjGyO9Ik8w1lAxDhMlRP2IcJ9p9eq5X2WWeLQ==",
|
||||
"requires": {
|
||||
"hoist-non-react-statics": "^2.3.1",
|
||||
"invariant": "^2.2.2",
|
||||
@@ -8324,13 +8390,24 @@
|
||||
"requires": {
|
||||
"react-native-tab-view": "^1.2.0"
|
||||
}
|
||||
},
|
||||
"react-navigation-stack": {
|
||||
"version": "1.5.5",
|
||||
"resolved": "https://registry.npmjs.org/react-navigation-stack/-/react-navigation-stack-1.5.5.tgz",
|
||||
"integrity": "sha512-qMhOhmUmyPNfFGWMbwv5flrNVsFU4JZSBWnONSgVGK4KWGW8DbobXBi4i4sBAC9Kg8EqJK0qyWcxnkMJJtfMWA==",
|
||||
"requires": {
|
||||
"prop-types": "^15.7.2"
|
||||
}
|
||||
}
|
||||
}
|
||||
},
|
||||
"react-navigation-drawer": {
|
||||
"version": "2.0.0",
|
||||
"resolved": "https://registry.npmjs.org/react-navigation-drawer/-/react-navigation-drawer-2.0.0.tgz",
|
||||
"integrity": "sha512-M9Ov4kOj0nh9HDMYoYJtd6ZaIKYLlC3y2LmGr4kNIPZ1zj4fIXi8ibaolZOe28xmZakWFZzN7bbUf2f+Rbc8Og=="
|
||||
"version": "1.4.0",
|
||||
"resolved": "https://registry.npmjs.org/react-navigation-drawer/-/react-navigation-drawer-1.4.0.tgz",
|
||||
"integrity": "sha512-ZyWBozcjB2aZ7vwCALv90cYA2NpDjM+WALaiYRshvPvue8l7cqynePbHK8GhlMGyJDwZqp4MxQmu8u1XAKp3Bw==",
|
||||
"requires": {
|
||||
"react-native-tab-view": "^1.2.0"
|
||||
}
|
||||
},
|
||||
"react-navigation-redux-helpers": {
|
||||
"version": "3.0.2",
|
||||
@@ -8341,9 +8418,9 @@
|
||||
}
|
||||
},
|
||||
"react-navigation-stack": {
|
||||
"version": "1.5.0",
|
||||
"resolved": "https://registry.npmjs.org/react-navigation-stack/-/react-navigation-stack-1.5.0.tgz",
|
||||
"integrity": "sha512-XwgdQY8c7PguPw/cx6GCRMnYMe6P/izzOpeOfE8g6sWrWW2vs/vwodRb9a820QePhX0I7dkgxdnTSq+o7/R49Q==",
|
||||
"version": "1.8.1",
|
||||
"resolved": "https://registry.npmjs.org/react-navigation-stack/-/react-navigation-stack-1.8.1.tgz",
|
||||
"integrity": "sha512-XOkHuYlQjZKnD4jTU0Ml847sKjpwsJpQ6JX4ZfOq8D0e6fPWXbpYNhvUnzHMHMm+tnbhTqkqP1Umu40Hmx748Q==",
|
||||
"requires": {
|
||||
"prop-types": "^15.7.2"
|
||||
}
|
||||
|
||||
+5
-4
@@ -12,8 +12,8 @@
|
||||
"base-64": "^0.1.0",
|
||||
"@expo/vector-icons": "^8.1.0",
|
||||
"gfycat-style-urls": "^1.0.3",
|
||||
"lbry-redux": "lbryio/lbry-redux#3133ea60b0302c162f7b6f67cc858997f1d2ab52",
|
||||
"lbryinc": "lbryio/lbryinc#b9f354ae50bd57691765a7d042c5054167878bf4",
|
||||
"lbry-redux": "lbryio/lbry-redux#9b11cfed62af7f0f8eb6fa3c88a1f8d2cce46afc",
|
||||
"lbryinc": "lbryio/lbryinc#9ffb883cc11e36d55a729c65b70c405a4a56d35e",
|
||||
"lodash": ">=4.17.11",
|
||||
"merge": ">=1.2.1",
|
||||
"moment": "^2.22.1",
|
||||
@@ -25,7 +25,7 @@
|
||||
"react-native-exception-handler": "2.9.0",
|
||||
"react-native-fast-image": "^6.1.1",
|
||||
"react-native-fs": "^2.13.3",
|
||||
"react-native-gesture-handler": "1.1.0",
|
||||
"react-native-gesture-handler": "1.3.0",
|
||||
"react-native-image-zoom-viewer": "^2.2.5",
|
||||
"react-native-password-strength-meter": "^0.0.2",
|
||||
"react-native-phone-input": "lbryio/react-native-phone-input",
|
||||
@@ -34,8 +34,9 @@
|
||||
"react-native-vector-icons": "^6.6.0",
|
||||
"react-native-video": "lbryio/react-native-video#exoplayer-lbry-android",
|
||||
"react-navigation": "^3.11.0",
|
||||
"react-navigation-drawer": "^2.0.0",
|
||||
"react-navigation-drawer": "^1.4.0",
|
||||
"react-navigation-redux-helpers": "^3.0.2",
|
||||
"react-navigation-stack": "^1.8.1",
|
||||
"react-redux": "^5.0.3",
|
||||
"redux": "^4.0.4",
|
||||
"redux-persist": "^5.10.0",
|
||||
|
||||
Binary file not shown.
|
After Width: | Height: | Size: 265 KiB |
Binary file not shown.
|
After Width: | Height: | Size: 278 KiB |
@@ -18,18 +18,29 @@ import SubscriptionsPage from 'page/subscriptions';
|
||||
import TransactionHistoryPage from 'page/transactionHistory';
|
||||
import VerificationScreen from 'page/verification';
|
||||
import WalletPage from 'page/wallet';
|
||||
import { createStackNavigator, NavigationActions } from 'react-navigation';
|
||||
import { NavigationActions } from 'react-navigation';
|
||||
import { createDrawerNavigator } from 'react-navigation-drawer';
|
||||
import { createStackNavigator } from 'react-navigation-stack';
|
||||
import {
|
||||
createReduxContainer,
|
||||
createReactNavigationReduxMiddleware,
|
||||
createNavigationReducer,
|
||||
} from 'react-navigation-redux-helpers';
|
||||
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 {
|
||||
AppState,
|
||||
BackHandler,
|
||||
DeviceEventEmitter,
|
||||
Linking,
|
||||
NativeModules,
|
||||
StatusBar,
|
||||
TextInput,
|
||||
ToastAndroid,
|
||||
} from 'react-native';
|
||||
import { selectDrawerStack } from 'redux/selectors/drawer';
|
||||
import { SETTINGS, doDismissToast, doPopulateSharedUserState, doPreferenceGet, doToast, selectToast } from 'lbry-redux';
|
||||
import {
|
||||
Lbryio,
|
||||
doGetSync,
|
||||
doUserCheckEmailVerified,
|
||||
doUserEmailVerify,
|
||||
@@ -37,9 +48,10 @@ import {
|
||||
selectEmailToVerify,
|
||||
selectEmailVerifyIsPending,
|
||||
selectEmailVerifyErrorMessage,
|
||||
selectHashChanged,
|
||||
selectUser,
|
||||
} from 'lbryinc';
|
||||
import { makeSelectClientSetting } from 'redux/selectors/settings';
|
||||
import { makeSelectClientSetting, selectFullscreenMode } from 'redux/selectors/settings';
|
||||
import { decode as atob } from 'base-64';
|
||||
import { dispatchNavigateBack, dispatchNavigateToUri, transformUrl } from 'utils/helper';
|
||||
import AsyncStorage from '@react-native-community/async-storage';
|
||||
@@ -51,6 +63,8 @@ import discoverStyle from 'styles/discover';
|
||||
import searchStyle from 'styles/search';
|
||||
import SearchRightHeaderIcon from 'component/searchRightHeaderIcon';
|
||||
|
||||
const SYNC_GET_INTERVAL = 1000 * 60 * 5; // every 5 minutes
|
||||
|
||||
const menuNavigationButton = navigation => (
|
||||
<NavigationButton
|
||||
name="bars"
|
||||
@@ -210,6 +224,7 @@ const drawer = createDrawerNavigator(
|
||||
},
|
||||
{
|
||||
drawerWidth: 300,
|
||||
drawerBackgroundColor: 'transparent',
|
||||
headerMode: 'none',
|
||||
backBehavior: 'none',
|
||||
unmountInactiveRoutes: true,
|
||||
@@ -266,9 +281,11 @@ class AppWithNavigationState extends React.Component {
|
||||
constructor() {
|
||||
super();
|
||||
this.emailVerifyCheckInterval = null;
|
||||
this.syncGetInterval = null;
|
||||
this.state = {
|
||||
emailVerifyDone: false,
|
||||
verifyPending: false,
|
||||
syncHashChanged: false,
|
||||
};
|
||||
}
|
||||
|
||||
@@ -289,8 +306,19 @@ class AppWithNavigationState extends React.Component {
|
||||
}
|
||||
|
||||
componentDidMount() {
|
||||
const { dispatch, user } = this.props;
|
||||
this.emailVerifyCheckInterval = setInterval(() => this.checkEmailVerification(), 5000);
|
||||
Linking.addEventListener('url', this._handleUrl);
|
||||
|
||||
// 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 = () => {
|
||||
@@ -303,28 +331,48 @@ class AppWithNavigationState extends React.Component {
|
||||
});
|
||||
};
|
||||
|
||||
getUserSettings = () => {
|
||||
const { dispatch } = this.props;
|
||||
doPreferenceGet(
|
||||
'shared',
|
||||
preference => {
|
||||
dispatch(doPopulateSharedUserState(preference));
|
||||
},
|
||||
error => {
|
||||
/* failed */
|
||||
}
|
||||
);
|
||||
};
|
||||
|
||||
componentWillUnmount() {
|
||||
AppState.removeEventListener('change', this._handleAppStateChange);
|
||||
BackHandler.removeEventListener('hardwareBackPress');
|
||||
Linking.removeEventListener('url', this._handleUrl);
|
||||
if (this.emailVerifyCheckInterval > -1) {
|
||||
clearInterval(this.emailVerifyCheckInterval);
|
||||
}
|
||||
if (this.syncGetInterval > -1) {
|
||||
clearInterval(this.syncGetInterval);
|
||||
}
|
||||
}
|
||||
|
||||
componentDidUpdate() {
|
||||
const { dispatch, user } = this.props;
|
||||
const { dispatch, user, hashChanged } = this.props;
|
||||
if (this.state.verifyPending && this.emailVerifyCheckInterval > 0 && user && user.has_verified_email) {
|
||||
clearInterval(this.emailVerifyCheckInterval);
|
||||
AsyncStorage.setItem(Constants.KEY_EMAIL_VERIFY_PENDING, 'false');
|
||||
this.setState({ verifyPending: false });
|
||||
|
||||
NativeModules.Firebase.track('email_verified', { email: user.primary_email });
|
||||
ToastAndroid.show('Your email address was successfully verified.', ToastAndroid.LONG);
|
||||
ToastAndroid.show(__('Your email address was successfully verified.'), ToastAndroid.LONG);
|
||||
|
||||
// upon successful email verification, do wallet sync (if password has been set)
|
||||
NativeModules.UtilityModule.getSecureValue(Constants.KEY_FIRST_RUN_PASSWORD).then(walletPassword => {
|
||||
if (walletPassword && walletPassword.trim().length > 0) {
|
||||
dispatch(doGetSync(walletPassword));
|
||||
}
|
||||
});
|
||||
// get user settings after email verification
|
||||
this.getUserSettings();
|
||||
}
|
||||
|
||||
if (hashChanged && !this.state.syncHashChanged) {
|
||||
this.setState({ syncHashChanged: true });
|
||||
this.getUserSettings();
|
||||
}
|
||||
}
|
||||
|
||||
@@ -353,7 +401,7 @@ class AppWithNavigationState extends React.Component {
|
||||
this.setState({ emailVerifyDone: true });
|
||||
const message = emailVerifyErrorMessage
|
||||
? String(emailVerifyErrorMessage)
|
||||
: 'Your email address was successfully verified.';
|
||||
: __('Your email address was successfully verified.');
|
||||
if (!emailVerifyErrorMessage) {
|
||||
AsyncStorage.removeItem(Constants.KEY_FIRST_RUN_EMAIL);
|
||||
}
|
||||
@@ -388,6 +436,26 @@ class AppWithNavigationState extends React.Component {
|
||||
if (backgroundPlayEnabled || NativeModules.BackgroundMedia) {
|
||||
NativeModules.BackgroundMedia.hidePlaybackNotification();
|
||||
}
|
||||
|
||||
// check fullscreen mode and show / hide navigation bar accordingly
|
||||
this.checkFullscreenMode();
|
||||
}
|
||||
};
|
||||
|
||||
checkFullscreenMode = () => {
|
||||
const { fullscreenMode } = this.props;
|
||||
StatusBar.setHidden(fullscreenMode);
|
||||
|
||||
if (fullscreenMode) {
|
||||
// fullscreen, so change orientation to landscape mode
|
||||
NativeModules.ScreenOrientation.lockOrientationLandscape();
|
||||
// hide the navigation bar (on devices that have the soft navigation bar)
|
||||
NativeModules.UtilityModule.hideNavigationBar();
|
||||
} else {
|
||||
// Switch back to portrait mode when the media is not fullscreen
|
||||
NativeModules.ScreenOrientation.lockOrientationPortrait();
|
||||
// hide the navigation bar (on devices that have the soft navigation bar)
|
||||
NativeModules.UtilityModule.showNavigationBar();
|
||||
}
|
||||
};
|
||||
|
||||
@@ -408,7 +476,7 @@ class AppWithNavigationState extends React.Component {
|
||||
try {
|
||||
dispatch(doUserEmailVerify(verification.token, verification.recaptcha));
|
||||
} catch (error) {
|
||||
const message = 'Invalid Verification Token';
|
||||
const message = __('Invalid Verification Token');
|
||||
dispatch(doUserEmailVerifyFailure(message));
|
||||
dispatch(doToast({ message }));
|
||||
}
|
||||
@@ -432,6 +500,7 @@ class AppWithNavigationState extends React.Component {
|
||||
|
||||
const mapStateToProps = state => ({
|
||||
backgroundPlayEnabled: makeSelectClientSetting(SETTINGS.BACKGROUND_PLAY_ENABLED)(state),
|
||||
hashChanged: selectHashChanged(state),
|
||||
keepDaemonRunning: makeSelectClientSetting(SETTINGS.KEEP_DAEMON_RUNNING)(state),
|
||||
nav: state.nav,
|
||||
toast: selectToast(state),
|
||||
@@ -441,6 +510,7 @@ const mapStateToProps = state => ({
|
||||
emailVerifyErrorMessage: selectEmailVerifyErrorMessage(state),
|
||||
showNsfw: makeSelectClientSetting(SETTINGS.SHOW_NSFW)(state),
|
||||
user: selectUser(state),
|
||||
fullscreenMode: selectFullscreenMode(state),
|
||||
});
|
||||
|
||||
export default connect(mapStateToProps)(AppWithNavigationState);
|
||||
@@ -15,7 +15,7 @@ export default class Address extends React.PureComponent<Props> {
|
||||
|
||||
return (
|
||||
<View style={[walletStyle.row, style]}>
|
||||
<Text selectable={true} numberOfLines={1} style={walletStyle.address}>
|
||||
<Text selectable numberOfLines={1} style={walletStyle.address}>
|
||||
{address || ''}
|
||||
</Text>
|
||||
<Button
|
||||
@@ -24,7 +24,7 @@ export default class Address extends React.PureComponent<Props> {
|
||||
onPress={() => {
|
||||
Clipboard.setString(address);
|
||||
doToast({
|
||||
message: 'Address copied',
|
||||
message: __('Address copied'),
|
||||
});
|
||||
}}
|
||||
/>
|
||||
|
||||
@@ -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;
|
||||
@@ -63,7 +63,7 @@ export default class ChannelIconItem extends React.PureComponent {
|
||||
>
|
||||
{isPlaceholder && (
|
||||
<View style={channelIconStyle.centered}>
|
||||
<Text style={channelIconStyle.placeholderText}>ALL</Text>
|
||||
<Text style={channelIconStyle.placeholderText}>{__('ALL')}</Text>
|
||||
</View>
|
||||
)}
|
||||
{!isPlaceholder && thumbnail && (
|
||||
|
||||
@@ -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,
|
||||
doToast,
|
||||
} from 'lbry-redux';
|
||||
import { doGetSync } from 'lbryinc';
|
||||
import ChannelSelector from './view';
|
||||
|
||||
const select = state => ({
|
||||
@@ -19,6 +20,7 @@ const perform = dispatch => ({
|
||||
notify: data => dispatch(doToast(data)),
|
||||
createChannel: (name, amount) => dispatch(doCreateChannel(name, amount)),
|
||||
fetchChannelListMine: () => dispatch(doFetchChannelListMine()),
|
||||
getSync: (password, callback) => dispatch(doGetSync(password, callback)),
|
||||
});
|
||||
|
||||
export default connect(
|
||||
|
||||
@@ -1,6 +1,7 @@
|
||||
import React from 'react';
|
||||
import { CLAIM_VALUES, isURIValid } from 'lbry-redux';
|
||||
import { ActivityIndicator, Picker, Text, TextInput, TouchableOpacity, View } from 'react-native';
|
||||
import { CLAIM_VALUES, formatCredits, isNameValid } from 'lbry-redux';
|
||||
import { ActivityIndicator, NativeModules, Picker, Text, TextInput, TouchableOpacity, View } from 'react-native';
|
||||
import { logPublish } from 'utils/helper';
|
||||
import Button from 'component/button';
|
||||
import Colors from 'styles/colors';
|
||||
import Constants from 'constants'; // eslint-disable-line node/no-deprecated-api
|
||||
@@ -13,6 +14,7 @@ export default class ChannelSelector extends React.PureComponent {
|
||||
super(props);
|
||||
|
||||
this.state = {
|
||||
creditsInputFocused: false,
|
||||
currentSelectedValue: Constants.ITEM_ANONYMOUS,
|
||||
newChannelName: '',
|
||||
newChannelBid: 0.1,
|
||||
@@ -26,15 +28,18 @@ export default class ChannelSelector extends React.PureComponent {
|
||||
}
|
||||
|
||||
componentDidMount() {
|
||||
const { channels, channelName, fetchChannelListMine, fetchingChannels } = this.props;
|
||||
if (!channels.length && !fetchingChannels) {
|
||||
const { channels = [], channelName, fetchChannelListMine, fetchingChannels } = this.props;
|
||||
if ((!channels || channels.length === 0) && !fetchingChannels) {
|
||||
fetchChannelListMine();
|
||||
}
|
||||
this.setState({ currentSelectedValue: channelName });
|
||||
}
|
||||
|
||||
componentDidUpdate() {
|
||||
const { channelName } = this.props;
|
||||
if (this.state.currentSelectedValue !== channelName) {
|
||||
componentWillReceiveProps(nextProps) {
|
||||
const { channels: prevChannels = [], channelName } = this.props;
|
||||
const { channels = [] } = nextProps;
|
||||
|
||||
if (channels && channels.length !== prevChannels.length && channelName !== this.state.currentSelectedValue) {
|
||||
this.setState({ currentSelectedValue: channelName });
|
||||
}
|
||||
}
|
||||
@@ -82,10 +87,10 @@ export default class ChannelSelector extends React.PureComponent {
|
||||
newChannelName = newChannelName.slice(1);
|
||||
}
|
||||
|
||||
if (newChannelName.trim().length > 0 && !isURIValid(newChannelName)) {
|
||||
newChannelNameError = 'Your channel name contains invalid characters.';
|
||||
if (newChannelName.trim().length > 0 && !isNameValid(newChannelName)) {
|
||||
newChannelNameError = __('Your channel name contains invalid characters.');
|
||||
} else if (this.channelExists(newChannelName)) {
|
||||
newChannelNameError = 'You have already created a channel with the same name.';
|
||||
newChannelNameError = __('You have already created a channel with the same name.');
|
||||
}
|
||||
|
||||
this.setState({
|
||||
@@ -114,21 +119,21 @@ export default class ChannelSelector extends React.PureComponent {
|
||||
};
|
||||
|
||||
handleCreateChannelClick = () => {
|
||||
const { balance, createChannel, onChannelChange, notify } = this.props;
|
||||
const { balance, createChannel, getSync, onChannelChange, notify } = this.props;
|
||||
const { newChannelBid, newChannelName } = this.state;
|
||||
|
||||
if (newChannelName.trim().length === 0 || !isURIValid(newChannelName.substr(1), false)) {
|
||||
notify({ message: 'Your channel name contains invalid characters.' });
|
||||
if (newChannelName.trim().length === 0 || !isNameValid(newChannelName.substr(1), false)) {
|
||||
notify({ message: __('Your channel name contains invalid characters.') });
|
||||
return;
|
||||
}
|
||||
|
||||
if (this.channelExists(newChannelName)) {
|
||||
notify({ message: 'You have already created a channel with the same name.' });
|
||||
notify({ message: __('You have already created a channel with the same name.') });
|
||||
return;
|
||||
}
|
||||
|
||||
if (newChannelBid > balance) {
|
||||
notify({ message: 'Deposit cannot be higher than your balance' });
|
||||
notify({ message: __('Deposit cannot be higher than your balance') });
|
||||
return;
|
||||
}
|
||||
|
||||
@@ -139,21 +144,25 @@ export default class ChannelSelector extends React.PureComponent {
|
||||
createChannelError: undefined,
|
||||
});
|
||||
|
||||
const success = () => {
|
||||
const success = channelClaim => {
|
||||
this.setState({
|
||||
creatingChannel: false,
|
||||
addingChannel: false,
|
||||
currentSelectedValue: channelName,
|
||||
showCreateChannel: false,
|
||||
});
|
||||
logPublish(channelClaim);
|
||||
|
||||
if (onChannelChange) {
|
||||
onChannelChange(channelName);
|
||||
}
|
||||
|
||||
// sync wallet
|
||||
NativeModules.UtilityModule.getSecureValue(Constants.KEY_WALLET_PASSWORD).then(password => getSync(password));
|
||||
};
|
||||
|
||||
const failure = () => {
|
||||
notify({ message: 'Unable to create channel due to an internal error.' });
|
||||
notify({ message: __('Unable to create channel due to an internal error.') });
|
||||
this.setState({
|
||||
creatingChannel: false,
|
||||
});
|
||||
@@ -164,12 +173,14 @@ export default class ChannelSelector extends React.PureComponent {
|
||||
|
||||
channelExists = name => {
|
||||
const { channels = [] } = this.props;
|
||||
for (let channel of channels) {
|
||||
if (
|
||||
name.toLowerCase() === channel.name.toLowerCase() ||
|
||||
`@${name}`.toLowerCase() === channel.name.toLowerCase()
|
||||
) {
|
||||
return true;
|
||||
if (channels) {
|
||||
for (let channel of channels) {
|
||||
if (
|
||||
name.toLowerCase() === channel.name.toLowerCase() ||
|
||||
`@${name}`.toLowerCase() === channel.name.toLowerCase()
|
||||
) {
|
||||
return true;
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
@@ -178,8 +189,10 @@ export default class ChannelSelector extends React.PureComponent {
|
||||
|
||||
render() {
|
||||
const channel = this.state.addingChannel ? 'new' : this.props.channel;
|
||||
const { enabled, fetchingChannels, channels = [] } = this.props;
|
||||
const pickerItems = [Constants.ITEM_ANONYMOUS, Constants.ITEM_CREATE_A_CHANNEL].concat(channels.map(ch => ch.name));
|
||||
const { balance, enabled, fetchingChannels, channels = [] } = this.props;
|
||||
const pickerItems = [Constants.ITEM_ANONYMOUS, Constants.ITEM_CREATE_A_CHANNEL].concat(
|
||||
channels ? channels.map(ch => ch.name) : []
|
||||
);
|
||||
|
||||
const {
|
||||
newChannelName,
|
||||
@@ -202,7 +215,11 @@ export default class ChannelSelector extends React.PureComponent {
|
||||
onValueChange={this.handlePickerValueChange}
|
||||
>
|
||||
{pickerItems.map(item => (
|
||||
<Picker.Item label={item} value={item} key={item} />
|
||||
<Picker.Item
|
||||
label={[Constants.ITEM_ANONYMOUS, Constants.ITEM_CREATE_A_CHANNEL].includes(item) ? __(item) : item}
|
||||
value={item}
|
||||
key={item}
|
||||
/>
|
||||
))}
|
||||
</Picker>
|
||||
|
||||
@@ -215,7 +232,7 @@ export default class ChannelSelector extends React.PureComponent {
|
||||
style={channelSelectorStyle.channelNameInput}
|
||||
value={this.state.newChannelName}
|
||||
onChangeText={this.handleNewChannelNameChange}
|
||||
placeholder={'Channel name'}
|
||||
placeholder={__('Channel name')}
|
||||
underlineColorAndroid={Colors.NextLbryGreen}
|
||||
/>
|
||||
</View>
|
||||
@@ -223,30 +240,38 @@ export default class ChannelSelector extends React.PureComponent {
|
||||
<Text style={channelSelectorStyle.inlineError}>{newChannelNameError}</Text>
|
||||
)}
|
||||
<View style={channelSelectorStyle.bidRow}>
|
||||
<Text style={channelSelectorStyle.label}>Deposit</Text>
|
||||
<Text style={channelSelectorStyle.label}>{__('Deposit')}</Text>
|
||||
<TextInput
|
||||
style={channelSelectorStyle.bidAmountInput}
|
||||
value={String(newChannelBid)}
|
||||
onChangeText={this.handleNewChannelBidChange}
|
||||
onFocus={() => this.setState({ creditsInputFocused: true })}
|
||||
onBlur={() => this.setState({ creditsInputFocused: false })}
|
||||
placeholder={'0.00'}
|
||||
keyboardType={'number-pad'}
|
||||
underlineColorAndroid={Colors.NextLbryGreen}
|
||||
/>
|
||||
<Text style={channelSelectorStyle.currency}>LBC</Text>
|
||||
<View style={channelSelectorStyle.balance}>
|
||||
{this.state.creditsInputFocused && <Icon name="coins" size={12} />}
|
||||
{this.state.creditsInputFocused && (
|
||||
<Text style={channelSelectorStyle.balanceText}>{formatCredits(parseFloat(balance), 1, true)}</Text>
|
||||
)}
|
||||
</View>
|
||||
</View>
|
||||
<Text style={channelSelectorStyle.helpText}>
|
||||
This LBC remains yours. It is a deposit to reserve the name and can be undone at any time.
|
||||
{__('This LBC remains yours. It is a deposit to reserve the name and can be undone at any time.')}
|
||||
</Text>
|
||||
|
||||
<View style={channelSelectorStyle.buttonContainer}>
|
||||
{creatingChannel && <ActivityIndicator size={'small'} color={Colors.LbryGreen} />}
|
||||
{!creatingChannel && (
|
||||
<View style={channelSelectorStyle.buttons}>
|
||||
<Link style={channelSelectorStyle.cancelLink} text="Cancel" onPress={this.handleCreateCancel} />
|
||||
<Link style={channelSelectorStyle.cancelLink} text={__('Cancel')} onPress={this.handleCreateCancel} />
|
||||
<Button
|
||||
style={channelSelectorStyle.createButton}
|
||||
disabled={!(newChannelName.trim().length > 0 && newChannelBid > 0)}
|
||||
text="Create"
|
||||
text={__('Create')}
|
||||
onPress={this.handleCreateChannelClick}
|
||||
/>
|
||||
</View>
|
||||
|
||||
@@ -12,7 +12,7 @@ import claimListStyle from 'styles/claimList';
|
||||
import discoverStyle from 'styles/discover';
|
||||
import moment from 'moment';
|
||||
|
||||
const horizontalLimit = 7;
|
||||
const horizontalLimit = 10;
|
||||
const softLimit = 500;
|
||||
|
||||
class ClaimList extends React.PureComponent {
|
||||
@@ -147,7 +147,7 @@ class ClaimList extends React.PureComponent {
|
||||
renderMorePlaceholder = () => {
|
||||
return (
|
||||
<TouchableOpacity style={discoverStyle.fileItemMore} onPress={this.onMorePressed}>
|
||||
<Text style={discoverStyle.moreText}>more</Text>
|
||||
<Text style={discoverStyle.moreText}>{__('more')}</Text>
|
||||
<Icon style={discoverStyle.moreIcon} name={'angle-double-down'} color={Colors.White} size={16} />
|
||||
</TouchableOpacity>
|
||||
);
|
||||
@@ -155,7 +155,9 @@ class ClaimList extends React.PureComponent {
|
||||
|
||||
verticalListEmptyComponent = () => {
|
||||
return (
|
||||
<Text style={claimListStyle.noContentText}>No content to display at this time. Please check back later.</Text>
|
||||
<Text style={claimListStyle.noContentText}>
|
||||
{__('No content to display at this time. Please check back later.')}
|
||||
</Text>
|
||||
);
|
||||
};
|
||||
|
||||
|
||||
@@ -20,7 +20,7 @@ class CustomRewardCard extends React.PureComponent<Props> {
|
||||
if (error && error.trim().length > 0) {
|
||||
notify({ message: error });
|
||||
} else {
|
||||
notify({ message: 'Reward successfully claimed!' });
|
||||
notify({ message: __('Reward successfully claimed!') });
|
||||
this.setState({ rewardCode: '' });
|
||||
}
|
||||
this.setState({ claimStarted: false });
|
||||
@@ -37,12 +37,12 @@ class CustomRewardCard extends React.PureComponent<Props> {
|
||||
if (showVerification) {
|
||||
showVerification();
|
||||
}
|
||||
notify({ message: 'Unfortunately, you are not eligible to claim this reward at this time.' });
|
||||
notify({ message: __('Unfortunately, you are not eligible to claim this reward at this time.') });
|
||||
return;
|
||||
}
|
||||
|
||||
if (!rewardCode || rewardCode.trim().length === 0) {
|
||||
notify({ message: 'Please enter a reward code to claim.' });
|
||||
notify({ message: __('Please enter a reward code to claim.') });
|
||||
return;
|
||||
}
|
||||
|
||||
@@ -60,9 +60,9 @@ class CustomRewardCard extends React.PureComponent<Props> {
|
||||
{rewardIsPending && <ActivityIndicator size="small" color={Colors.NextLbryGreen} />}
|
||||
</View>
|
||||
<View style={rewardStyle.midCol}>
|
||||
<Text style={rewardStyle.rewardTitle}>Custom Code</Text>
|
||||
<Text style={rewardStyle.rewardTitle}>{__('Custom Code')}</Text>
|
||||
<Text style={rewardStyle.rewardDescription}>
|
||||
Are you a supermodel or rockstar that received a custom reward code? Claim it here.
|
||||
{__('Are you a supermodel or rockstar that received a custom reward code? Claim it here.')}
|
||||
</Text>
|
||||
|
||||
<View>
|
||||
@@ -74,7 +74,7 @@ class CustomRewardCard extends React.PureComponent<Props> {
|
||||
/>
|
||||
<Button
|
||||
style={rewardStyle.redeemButton}
|
||||
text={'Redeem'}
|
||||
text={__('Redeem')}
|
||||
disabled={!this.state.rewardCode || this.state.rewardCode.trim().length === 0 || rewardIsPending}
|
||||
onPress={() => {
|
||||
if (!rewardIsPending) {
|
||||
|
||||
@@ -1,4 +1,18 @@
|
||||
import { connect } from 'react-redux';
|
||||
import { doFetchChannelListMine, selectMyChannelClaims } from 'lbry-redux';
|
||||
import { selectUser } from 'lbryinc';
|
||||
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,21 +1,23 @@
|
||||
import React from 'react';
|
||||
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 Icon from 'react-native-vector-icons/FontAwesome5';
|
||||
import channelIconStyle from 'styles/channelIcon';
|
||||
import discoverStyle from 'styles/discover';
|
||||
|
||||
const groupedMenuItems = {
|
||||
'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: 'globe-americas', label: 'All content', route: Constants.DRAWER_ROUTE_TRENDING },
|
||||
{ icon: 'globe-americas', label: 'All Content', route: Constants.DRAWER_ROUTE_TRENDING },
|
||||
],
|
||||
'Your content': [
|
||||
{ icon: 'at', label: 'Channels', route: Constants.DRAWER_ROUTE_CHANNEL_CREATOR },
|
||||
{ icon: 'download', label: 'Library', route: Constants.DRAWER_ROUTE_MY_LBRY },
|
||||
{ icon: 'cloud-upload-alt', label: 'Publishes', route: Constants.DRAWER_ROUTE_PUBLISHES },
|
||||
{ icon: 'upload', label: 'New publish', route: Constants.DRAWER_ROUTE_PUBLISH },
|
||||
{ icon: 'upload', label: 'New Publish', route: Constants.DRAWER_ROUTE_PUBLISH },
|
||||
],
|
||||
Wallet: [
|
||||
{ icon: 'wallet', label: 'Wallet', route: Constants.DRAWER_ROUTE_WALLET },
|
||||
@@ -30,55 +32,153 @@ const groupedMenuItems = {
|
||||
const groupNames = Object.keys(groupedMenuItems);
|
||||
|
||||
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() {
|
||||
const { activeTintColor, navigation, onItemPress } = this.props;
|
||||
const { activeTintColor, navigation, user, onItemPress } = this.props;
|
||||
const { state } = navigation;
|
||||
|
||||
const activeItemKey = state.routes[state.index] ? state.routes[state.index].key : null;
|
||||
const signedIn = user && user.has_verified_email;
|
||||
const avatarImageUrl = this.getAvatarImageUrl();
|
||||
|
||||
return (
|
||||
<ScrollView contentContainerStyle={discoverStyle.menuScrollContent}>
|
||||
<SafeAreaView style={discoverStyle.drawerContentContainer} forceInset={{ top: 'always', horizontal: 'never' }}>
|
||||
{groupNames.map(groupName => {
|
||||
const menuItems = groupedMenuItems[groupName];
|
||||
|
||||
return (
|
||||
<View key={groupName} style={discoverStyle.menuGroup}>
|
||||
{groupNames[3] !== groupName && (
|
||||
<Text key={`${groupName}-title`} style={discoverStyle.menuGroupName}>
|
||||
{groupName}
|
||||
</Text>
|
||||
)}
|
||||
{menuItems.map(item => {
|
||||
const focused =
|
||||
activeItemKey === item.route ||
|
||||
(activeItemKey === Constants.FULL_ROUTE_NAME_DISCOVER &&
|
||||
item.route === Constants.DRAWER_ROUTE_DISCOVER) ||
|
||||
(activeItemKey === Constants.FULL_ROUTE_NAME_WALLET &&
|
||||
item.route === Constants.DRAWER_ROUTE_WALLET);
|
||||
return (
|
||||
<TouchableOpacity
|
||||
accessible
|
||||
accessibilityLabel={item.label}
|
||||
style={[discoverStyle.menuItemTouchArea, focused ? discoverStyle.menuItemTouchAreaFocused : null]}
|
||||
key={item.label}
|
||||
onPress={() => navigation.navigate({ routeName: item.route })}
|
||||
delayPressIn={0}
|
||||
>
|
||||
<View style={discoverStyle.menuItemIcon}>
|
||||
<Icon name={item.icon} size={16} solid={item.solid} color={focused ? activeTintColor : null} />
|
||||
</View>
|
||||
<Text style={[discoverStyle.menuItem, focused ? discoverStyle.menuItemFocused : null]}>
|
||||
{item.label}
|
||||
</Text>
|
||||
</TouchableOpacity>
|
||||
);
|
||||
})}
|
||||
<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>
|
||||
);
|
||||
})}
|
||||
</SafeAreaView>
|
||||
</ScrollView>
|
||||
)}
|
||||
</View>
|
||||
)}
|
||||
|
||||
<ScrollView contentContainerStyle={discoverStyle.menuScrollContent}>
|
||||
<SafeAreaView
|
||||
style={discoverStyle.drawerContentContainer}
|
||||
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 => {
|
||||
const menuItems = groupedMenuItems[groupName];
|
||||
|
||||
return (
|
||||
<View key={groupName} style={discoverStyle.menuGroup}>
|
||||
{groupNames[3] !== groupName && (
|
||||
<Text key={`${groupName}-title`} style={discoverStyle.menuGroupName}>
|
||||
{__(groupName)}
|
||||
</Text>
|
||||
)}
|
||||
{menuItems.map(item => {
|
||||
const focused =
|
||||
activeItemKey === item.route ||
|
||||
(activeItemKey === Constants.FULL_ROUTE_NAME_DISCOVER &&
|
||||
item.route === Constants.DRAWER_ROUTE_DISCOVER) ||
|
||||
(activeItemKey === Constants.FULL_ROUTE_NAME_WALLET &&
|
||||
item.route === Constants.DRAWER_ROUTE_WALLET);
|
||||
return (
|
||||
<TouchableOpacity
|
||||
accessible
|
||||
accessibilityLabel={__(item.label)}
|
||||
style={[
|
||||
discoverStyle.menuItemTouchArea,
|
||||
focused ? discoverStyle.menuItemTouchAreaFocused : null,
|
||||
]}
|
||||
key={item.label}
|
||||
onPress={() => navigation.navigate({ routeName: item.route })}
|
||||
delayPressIn={0}
|
||||
>
|
||||
<View style={discoverStyle.menuItemIcon}>
|
||||
<Icon
|
||||
name={item.icon}
|
||||
size={16}
|
||||
solid={item.solid}
|
||||
color={focused ? activeTintColor : null}
|
||||
/>
|
||||
</View>
|
||||
<Text style={[discoverStyle.menuItem, focused ? discoverStyle.menuItemFocused : null]}>
|
||||
{__(item.label)}
|
||||
</Text>
|
||||
</TouchableOpacity>
|
||||
);
|
||||
})}
|
||||
</View>
|
||||
);
|
||||
})}
|
||||
</SafeAreaView>
|
||||
</ScrollView>
|
||||
</View>
|
||||
);
|
||||
}
|
||||
}
|
||||
|
||||
@@ -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;
|
||||
@@ -12,8 +12,8 @@ class FileDownloadButton extends React.PureComponent {
|
||||
}
|
||||
|
||||
componentWillReceiveProps(nextProps) {
|
||||
//this.checkAvailability(nextProps.uri);
|
||||
//this.restartDownload(nextProps);
|
||||
// this.checkAvailability(nextProps.uri);
|
||||
// this.restartDownload(nextProps);
|
||||
}
|
||||
|
||||
restartDownload(props) {
|
||||
@@ -50,13 +50,11 @@ class FileDownloadButton extends React.PureComponent {
|
||||
|
||||
if ((fileInfo && !fileInfo.stopped) || loading || downloading) {
|
||||
const progress = fileInfo && fileInfo.written_bytes ? (fileInfo.written_bytes / fileInfo.total_bytes) * 100 : 0,
|
||||
label = fileInfo ? progress.toFixed(0) + '% complete' : 'Connecting...';
|
||||
label = fileInfo ? __('%progress%% complete', { progress: progress.toFixed(0) }) : __('Connecting...');
|
||||
|
||||
return (
|
||||
<View style={[style, fileDownloadButtonStyle.container]}>
|
||||
<View
|
||||
style={{ width: `${progress}%`, backgroundColor: '#ff0000', position: 'absolute', left: 0, top: 0 }}
|
||||
></View>
|
||||
<View style={{ width: `${progress}%`, backgroundColor: '#ff0000', position: 'absolute', left: 0, top: 0 }} />
|
||||
<Text style={fileDownloadButtonStyle.text}>{label}</Text>
|
||||
</View>
|
||||
);
|
||||
@@ -64,20 +62,18 @@ class FileDownloadButton extends React.PureComponent {
|
||||
if (!costInfo) {
|
||||
return (
|
||||
<View style={[style, fileDownloadButtonStyle.container]}>
|
||||
<Text style={fileDownloadButtonStyle.text}>Fetching cost info...</Text>
|
||||
<Text style={fileDownloadButtonStyle.text}>{__('Fetching cost info...')}</Text>
|
||||
</View>
|
||||
);
|
||||
}
|
||||
return (
|
||||
<Button
|
||||
icon={isPlayable ? 'play' : null}
|
||||
text={isPlayable ? 'Play' : isViewable ? 'View' : 'Download'}
|
||||
text={isPlayable ? __('Play') : isViewable ? __('View') : __('Download')}
|
||||
onLayout={onButtonLayout}
|
||||
style={[style, fileDownloadButtonStyle.container]}
|
||||
onPress={() => {
|
||||
if (NativeModules.Firebase) {
|
||||
NativeModules.Firebase.track('purchase_uri', { uri: uri });
|
||||
}
|
||||
NativeModules.Firebase.track('purchase_uri', { uri: uri });
|
||||
purchaseUri(uri, costInfo, !isPlayable);
|
||||
if (NativeModules.UtilityModule) {
|
||||
NativeModules.UtilityModule.checkDownloads();
|
||||
@@ -98,7 +94,7 @@ class FileDownloadButton extends React.PureComponent {
|
||||
style={[style, fileDownloadButtonStyle.container]}
|
||||
onPress={openFile}
|
||||
>
|
||||
<Text style={fileDownloadButtonStyle.text}>{isViewable ? 'View' : 'Open'}</Text>
|
||||
<Text style={fileDownloadButtonStyle.text}>{isViewable ? __('View') : __('Open')}</Text>
|
||||
</TouchableOpacity>
|
||||
);
|
||||
}
|
||||
|
||||
@@ -10,13 +10,15 @@ import {
|
||||
makeSelectClaimIsNsfw,
|
||||
makeSelectShortUrlForUri,
|
||||
} from 'lbry-redux';
|
||||
import { selectRewardContentClaimIds } from 'lbryinc';
|
||||
import { selectBlackListedOutpoints, selectFilteredOutpoints, selectRewardContentClaimIds } from 'lbryinc';
|
||||
import { selectShowNsfw } from 'redux/selectors/settings';
|
||||
import FileItem from './view';
|
||||
|
||||
const select = (state, props) => ({
|
||||
blackListedOutpoints: selectBlackListedOutpoints(state),
|
||||
claim: makeSelectClaimForUri(props.uri)(state),
|
||||
fileInfo: makeSelectFileInfoForUri(props.uri)(state),
|
||||
filteredOutpoints: selectFilteredOutpoints(state),
|
||||
metadata: makeSelectMetadataForUri(props.uri)(state),
|
||||
rewardedContentClaimIds: selectRewardContentClaimIds(state),
|
||||
isResolvingUri: makeSelectIsUriResolving(props.uri)(state),
|
||||
|
||||
@@ -30,20 +30,22 @@ class FileItem extends React.PureComponent {
|
||||
}
|
||||
|
||||
navigateToFileUri = () => {
|
||||
const { navigation, uri, shortUrl } = this.props;
|
||||
const { claim, navigation, uri, shortUrl } = this.props;
|
||||
const normalizedUri = normalizeURI(uri);
|
||||
if (NativeModules.Firebase) {
|
||||
NativeModules.Firebase.track('explore_click', { uri: normalizedUri, short_url: shortUrl });
|
||||
}
|
||||
navigateToUri(navigation, shortUrl || uri);
|
||||
navigateToUri(navigation, shortUrl || uri, null, false, claim ? claim.permanent_url : null);
|
||||
};
|
||||
|
||||
render() {
|
||||
const {
|
||||
blackListedOutpoints,
|
||||
claim,
|
||||
title,
|
||||
thumbnail,
|
||||
fileInfo,
|
||||
filteredOutpoints,
|
||||
metadata,
|
||||
isResolvingUri,
|
||||
rewardedContentClaimIds,
|
||||
@@ -58,7 +60,19 @@ class FileItem extends React.PureComponent {
|
||||
} = this.props;
|
||||
|
||||
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;
|
||||
}
|
||||
|
||||
@@ -110,11 +124,17 @@ class FileItem extends React.PureComponent {
|
||||
style={discoverStyle.channelName}
|
||||
text={channelName}
|
||||
onPress={() => {
|
||||
navigateToUri(navigation, normalizeURI(shortChannelUri || fullChannelUri));
|
||||
navigateToUri(
|
||||
navigation,
|
||||
normalizeURI(shortChannelUri || fullChannelUri),
|
||||
null,
|
||||
false,
|
||||
fullChannelUri
|
||||
);
|
||||
}}
|
||||
/>
|
||||
)}
|
||||
{!channelName && !isResolvingUri && <Text style={discoverStyle.anonChannelName}>Anonymous</Text>}
|
||||
{!channelName && !isResolvingUri && <Text style={discoverStyle.anonChannelName}>{__('Anonymous')}</Text>}
|
||||
<DateTime style={discoverStyle.dateTime} textStyle={discoverStyle.dateTimeText} timeAgo uri={uri} />
|
||||
</View>
|
||||
)}
|
||||
|
||||
@@ -61,6 +61,7 @@ class FileItemMedia extends React.PureComponent {
|
||||
let style = this.props.style;
|
||||
const { duration, isResolvingUri, thumbnail, title, resizeMode } = this.props;
|
||||
const atStyle = this.state.autoThumbStyle;
|
||||
|
||||
if (this.isThumbnailValid(thumbnail) && !this.state.imageLoadFailed) {
|
||||
if (style == null) {
|
||||
style = fileItemMediaStyle.thumbnail;
|
||||
|
||||
@@ -40,8 +40,8 @@ class FileListItem extends React.PureComponent {
|
||||
};
|
||||
|
||||
componentDidMount() {
|
||||
const { claim, resolveUri, uri } = this.props;
|
||||
if (!claim) {
|
||||
const { claim, resolveUri, uri, batchResolve } = this.props;
|
||||
if (!claim && !batchResolve) {
|
||||
resolveUri(uri);
|
||||
}
|
||||
}
|
||||
@@ -59,7 +59,7 @@ class FileListItem extends React.PureComponent {
|
||||
if (featuredResult && !claim) {
|
||||
navigation.navigate({ routeName: Constants.DRAWER_ROUTE_PUBLISH, params: { vanityUrl: uri.trim() } });
|
||||
} else {
|
||||
navigateToUri(navigation, shortUrl || uri, { autoplay });
|
||||
navigateToUri(navigation, shortUrl || uri, { autoplay }, false, claim ? claim.permanent_url : null);
|
||||
}
|
||||
};
|
||||
|
||||
@@ -120,7 +120,9 @@ class FileListItem extends React.PureComponent {
|
||||
shortChannelUri = signingChannel ? signingChannel.short_url : null;
|
||||
|
||||
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);
|
||||
}
|
||||
|
||||
@@ -187,7 +189,7 @@ class FileListItem extends React.PureComponent {
|
||||
|
||||
{featuredResult && !isResolving && !claim && (
|
||||
<View style={fileListStyle.titleContainer}>
|
||||
<Text style={fileListStyle.featuredTitle}>Nothing here. Publish something!</Text>
|
||||
<Text style={fileListStyle.featuredTitle}>{__('Nothing here. Publish something!')}</Text>
|
||||
</View>
|
||||
)}
|
||||
|
||||
@@ -196,7 +198,13 @@ class FileListItem extends React.PureComponent {
|
||||
style={fileListStyle.publisher}
|
||||
text={channel}
|
||||
onPress={() => {
|
||||
navigateToUri(navigation, normalizeURI(shortChannelUri || fullChannelUri));
|
||||
navigateToUri(
|
||||
navigation,
|
||||
normalizeURI(shortChannelUri || fullChannelUri),
|
||||
null,
|
||||
false,
|
||||
fullChannelUri
|
||||
);
|
||||
}}
|
||||
/>
|
||||
)}
|
||||
|
||||
@@ -42,11 +42,16 @@ class CreditAmount extends React.PureComponent {
|
||||
|
||||
let amountText;
|
||||
if (this.props.showFree && parseFloat(this.props.amount) === 0) {
|
||||
amountText = 'FREE';
|
||||
amountText = __('FREE');
|
||||
} else {
|
||||
if (this.props.label) {
|
||||
const label =
|
||||
typeof this.props.label === 'string' ? this.props.label : parseFloat(amount) == 1 ? 'credit' : 'credits';
|
||||
typeof this.props.label === 'string'
|
||||
? this.props.label
|
||||
: parseFloat(amount) === 1
|
||||
? __('credit')
|
||||
: __('credits');
|
||||
// TODO: handling singular / plural in other languages?
|
||||
|
||||
amountText = `${formattedAmount} ${label}`;
|
||||
} else {
|
||||
@@ -57,14 +62,14 @@ class CreditAmount extends React.PureComponent {
|
||||
}
|
||||
}
|
||||
|
||||
/*{this.props.isEstimate ? (
|
||||
/* {this.props.isEstimate ? (
|
||||
<span
|
||||
className="credit-amount__estimate"
|
||||
title={__('This is an estimate and does not include data fees')}
|
||||
>
|
||||
*
|
||||
</span>
|
||||
) : null}*/
|
||||
) : null} */
|
||||
return <Text style={style}>{amountText}</Text>;
|
||||
}
|
||||
}
|
||||
|
||||
@@ -9,8 +9,8 @@ class FileRewardsDriver extends React.PureComponent<Props> {
|
||||
|
||||
return (
|
||||
<TouchableOpacity style={filePageStyle.rewardDriverCard} onPress={() => navigation.navigate('Rewards')}>
|
||||
<Icon name="award" size={16} style={filePageStyle.rewardIcon} />
|
||||
<Text style={filePageStyle.rewardDriverText}>Earn some credits to access this content.</Text>
|
||||
<Icon name="award" size={16} style={filePageStyle.rewardDriverIcon} />
|
||||
<Text style={filePageStyle.rewardDriverText}>{__('Earn some credits to access this content.')}</Text>
|
||||
</TouchableOpacity>
|
||||
);
|
||||
}
|
||||
|
||||
@@ -34,7 +34,7 @@ class FloatingWalletBalance extends React.PureComponent<Props> {
|
||||
<Icon name="coins" size={12} style={floatingButtonStyle.balanceIcon} />
|
||||
{isNaN(balance) && <ActivityIndicator size="small" color={Colors.White} />}
|
||||
{(!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>
|
||||
</View>
|
||||
|
||||
@@ -46,7 +46,7 @@ export default class ModalPicker extends React.PureComponent {
|
||||
onPress={() => onItemSelected(item)}
|
||||
>
|
||||
{item.icon && <Icon style={modalPickerStyle.itemIcon} name={item.icon} size={16} />}
|
||||
<Text style={modalPickerStyle.itemLabel}>{item.label}</Text>
|
||||
<Text style={modalPickerStyle.itemLabel}>{__(item.label)}</Text>
|
||||
{selectedItem && selectedItem.name === item.name && (
|
||||
<Icon style={modalPickerStyle.itemSelected} name={'check'} color={Colors.LbryGreen} size={16} />
|
||||
)}
|
||||
|
||||
@@ -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 TagSearch from 'component/tagSearch';
|
||||
import modalTagSelectorStyle from 'styles/modalTagSelector';
|
||||
import { __ } from 'utils/helper';
|
||||
|
||||
const minimumTags = 2;
|
||||
|
||||
@@ -55,9 +54,9 @@ export default class ModalTagSelector extends React.PureComponent {
|
||||
|
||||
return (
|
||||
<TouchableOpacity style={modalTagSelectorStyle.overlay} activeOpacity={1} onPress={onOverlayPress}>
|
||||
<View style={modalTagSelectorStyle.container}>
|
||||
<TouchableOpacity style={modalTagSelectorStyle.container} activeOpacity={1}>
|
||||
<View style={modalTagSelectorStyle.titleRow}>
|
||||
<Text style={modalTagSelectorStyle.title}>Customize your tags</Text>
|
||||
<Text style={modalTagSelectorStyle.title}>{__('Customize your tags')}</Text>
|
||||
</View>
|
||||
<View style={modalTagSelectorStyle.tagList}>
|
||||
{tags &&
|
||||
@@ -73,9 +72,9 @@ export default class ModalTagSelector extends React.PureComponent {
|
||||
</View>
|
||||
<TagSearch handleAddTag={this.handleAddTag} selectedTags={tags} />
|
||||
<View style={modalTagSelectorStyle.buttons}>
|
||||
<Button style={modalTagSelectorStyle.doneButton} text={'Done'} onPress={onDonePress} />
|
||||
<Button style={modalTagSelectorStyle.doneButton} text={__('Done')} onPress={onDonePress} />
|
||||
</View>
|
||||
</View>
|
||||
</TouchableOpacity>
|
||||
</TouchableOpacity>
|
||||
);
|
||||
}
|
||||
|
||||
@@ -7,7 +7,7 @@ class NsfwOverlay extends React.PureComponent {
|
||||
return (
|
||||
<TouchableOpacity style={discoverStyle.overlay} activeOpacity={1} onPress={this.props.onPress}>
|
||||
<Text style={discoverStyle.overlayText}>
|
||||
This content is Not Safe For Work. To view adult content, please change your Settings.
|
||||
{__('This content is Not Safe For Work. To view adult content, please change your Settings.')}
|
||||
</Text>
|
||||
</TouchableOpacity>
|
||||
);
|
||||
|
||||
@@ -4,17 +4,21 @@ import Colors from 'styles/colors';
|
||||
import Icon from 'react-native-vector-icons/FontAwesome5';
|
||||
import publishStyle from 'styles/publish';
|
||||
|
||||
class PublishRewadsDriver extends React.PureComponent<Props> {
|
||||
class PublishRewardsDriver 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}>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>
|
||||
);
|
||||
}
|
||||
}
|
||||
|
||||
export default PublishRewadsDriver;
|
||||
export default PublishRewardsDriver;
|
||||
@@ -1,11 +1,11 @@
|
||||
import { connect } from 'react-redux';
|
||||
import {
|
||||
doResolveUris,
|
||||
makeSelectClaimForUri,
|
||||
makeSelectRecommendedContentForUri,
|
||||
makeSelectTitleForUri,
|
||||
selectIsSearching,
|
||||
} from 'lbry-redux';
|
||||
import { doNativeSearch } from 'redux/actions/performance';
|
||||
import RelatedContent from './view';
|
||||
|
||||
const select = (state, props) => ({
|
||||
@@ -16,7 +16,7 @@ const select = (state, props) => ({
|
||||
});
|
||||
|
||||
const perform = dispatch => ({
|
||||
search: query => dispatch(doNativeSearch(query, 20, undefined, true)),
|
||||
resolveUris: uris => dispatch(doResolveUris(uris)),
|
||||
});
|
||||
|
||||
export default connect(
|
||||
|
||||
@@ -8,49 +8,27 @@ import fileListStyle from 'styles/fileList';
|
||||
import relatedContentStyle from 'styles/relatedContent';
|
||||
|
||||
export default class RelatedContent extends React.PureComponent {
|
||||
constructor() {
|
||||
super();
|
||||
|
||||
this.didSearch = undefined;
|
||||
}
|
||||
|
||||
componentDidMount() {
|
||||
this.getRecommendedContent();
|
||||
}
|
||||
state = {
|
||||
urlsResolved: false,
|
||||
};
|
||||
|
||||
componentDidUpdate(prevProps) {
|
||||
const { claim, uri } = this.props;
|
||||
const { resolveUris, recommendedContent } = this.props;
|
||||
|
||||
if (uri !== prevProps.uri) {
|
||||
this.didSearch = false;
|
||||
}
|
||||
|
||||
if (claim && !this.didSearch) {
|
||||
this.getRecommendedContent();
|
||||
if (recommendedContent && recommendedContent.length > 0 && !this.state.urisResolved) {
|
||||
this.setState({ urisResolved: true }, () => {
|
||||
// batch resolve the uris
|
||||
resolveUris(recommendedContent);
|
||||
});
|
||||
}
|
||||
}
|
||||
|
||||
getRecommendedContent() {
|
||||
const { search, title } = this.props;
|
||||
|
||||
if (title) {
|
||||
search(title);
|
||||
this.didSearch = true;
|
||||
}
|
||||
}
|
||||
|
||||
didSearch;
|
||||
|
||||
render() {
|
||||
const { recommendedContent, isSearching, navigation, uri, fullUri } = this.props;
|
||||
|
||||
if (!isSearching && (!recommendedContent || recommendedContent.length === 0)) {
|
||||
return null;
|
||||
}
|
||||
const { recommendedContent, navigation, uri, fullUri } = this.props;
|
||||
|
||||
return (
|
||||
<View style={relatedContentStyle.container}>
|
||||
<Text style={relatedContentStyle.title}>Related Content</Text>
|
||||
<Text style={relatedContentStyle.title}>{__('Related Content')}</Text>
|
||||
{recommendedContent &&
|
||||
recommendedContent
|
||||
.filter(recommendedUri => recommendedUri !== normalizeURI(fullUri))
|
||||
@@ -59,13 +37,11 @@ export default class RelatedContent extends React.PureComponent {
|
||||
style={fileListStyle.item}
|
||||
key={recommendedUri}
|
||||
uri={recommendedUri}
|
||||
batchResolve
|
||||
navigation={navigation}
|
||||
autoplay
|
||||
/>
|
||||
))}
|
||||
{isSearching && (
|
||||
<ActivityIndicator size="small" color={Colors.NextLbryGreen} style={relatedContentStyle.loading} />
|
||||
)}
|
||||
</View>
|
||||
);
|
||||
}
|
||||
|
||||
@@ -13,6 +13,7 @@ type Props = {
|
||||
id: string,
|
||||
reward_title: string,
|
||||
reward_amount: number,
|
||||
reward_range?: string,
|
||||
transaction_id: string,
|
||||
created_at: string,
|
||||
reward_description: string,
|
||||
@@ -33,7 +34,7 @@ class RewardCard extends React.PureComponent<Props> {
|
||||
notify({ message: errorMessage });
|
||||
clearError(reward);
|
||||
} else {
|
||||
notify({ message: 'Reward successfully claimed!' });
|
||||
notify({ message: __('Reward successfully claimed!') });
|
||||
}
|
||||
this.setState({ claimStarted: false });
|
||||
}
|
||||
@@ -46,7 +47,7 @@ class RewardCard extends React.PureComponent<Props> {
|
||||
if (showVerification) {
|
||||
showVerification();
|
||||
}
|
||||
notify({ message: 'Unfortunately, you are not eligible to claim this reward at this time.' });
|
||||
notify({ message: __('Unfortunately, you are not eligible to claim this reward at this time.') });
|
||||
return;
|
||||
}
|
||||
|
||||
@@ -55,6 +56,21 @@ class RewardCard extends React.PureComponent<Props> {
|
||||
});
|
||||
};
|
||||
|
||||
getDisplayAmount = () => {
|
||||
const { reward } = this.props;
|
||||
if (reward) {
|
||||
const claimed = !!reward.transaction_id;
|
||||
if (!claimed && reward.reward_range && reward.reward_range.includes('-')) {
|
||||
return reward.reward_range.split('-')[0] + '+'; // ex: 5+
|
||||
} else if (reward.reward_amount > 0) {
|
||||
return reward.reward_amount;
|
||||
}
|
||||
}
|
||||
|
||||
// unknown amount which normally shouldn't happen
|
||||
return '?';
|
||||
};
|
||||
|
||||
render() {
|
||||
const { canClaim, isPending, onClaimPress, reward } = this.props;
|
||||
const claimed = !!reward.transaction_id;
|
||||
@@ -96,12 +112,12 @@ class RewardCard extends React.PureComponent<Props> {
|
||||
style={rewardStyle.link}
|
||||
href={`https://explorer.lbry.com/tx/${reward.transaction_id}`}
|
||||
text={reward.transaction_id.substring(0, 7)}
|
||||
error={'The transaction URL could not be opened'}
|
||||
error={__('The transaction URL could not be opened')}
|
||||
/>
|
||||
)}
|
||||
</View>
|
||||
<View style={rewardStyle.rightCol}>
|
||||
<Text style={rewardStyle.rewardAmount}>{reward.reward_amount}</Text>
|
||||
<Text style={rewardStyle.rewardAmount}>{this.getDisplayAmount()}</Text>
|
||||
<Text style={rewardStyle.rewardCurrency}>LBC</Text>
|
||||
</View>
|
||||
</TouchableOpacity>
|
||||
|
||||
@@ -1,8 +1,8 @@
|
||||
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 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 Colors from 'styles/colors';
|
||||
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 } });
|
||||
};
|
||||
|
||||
onLearnMorePressed = () => {
|
||||
Linking.openURL('https://lbry.com/faq/earn-credits');
|
||||
};
|
||||
|
||||
render() {
|
||||
const { fetching, navigation, unclaimedRewardAmount, user } = this.props;
|
||||
|
||||
return (
|
||||
<View style={rewardStyle.enrollContainer} onPress>
|
||||
<View style={rewardStyle.enrollContainer}>
|
||||
<View style={rewardStyle.summaryRow}>
|
||||
<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 style={rewardStyle.onboarding}>
|
||||
<Text style={rewardStyle.enrollDescText}>
|
||||
LBRY credits allow you to purchase content, publish content, and influence the network. You can start
|
||||
earning credits by watching videos on LBRY.
|
||||
{__('LBRY credits allow you to purchase content, publish content, and influence the network.')}
|
||||
{'\n\n'}
|
||||
{__('You get credits for free for providing an email address and taking other basic actions.')}
|
||||
{'\n\n'}
|
||||
<Link style={rewardStyle.learnMoreLink} text={__('Learn more')} onPress={this.onLearnMorePressed} />.
|
||||
</Text>
|
||||
</View>
|
||||
|
||||
<View style={rewardStyle.buttonRow}>
|
||||
<Link style={rewardStyle.notInterestedLink} text={'Not interested'} onPress={this.onNotInterestedPressed} />
|
||||
<Button style={rewardStyle.enrollButton} theme={'light'} text={'Enroll'} onPress={this.onEnrollPressed} />
|
||||
<Link
|
||||
style={rewardStyle.notInterestedLink}
|
||||
text={__('Not interested')}
|
||||
onPress={this.onNotInterestedPressed}
|
||||
/>
|
||||
<Button
|
||||
style={rewardStyle.enrollButton}
|
||||
theme={'light'}
|
||||
text={__('Get started')}
|
||||
onPress={this.onEnrollPressed}
|
||||
/>
|
||||
</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 { normalizeURI, parseURI } from 'lbry-redux';
|
||||
import { ActivityIndicator, Platform, Switch, Text, TouchableOpacity, View } from 'react-native';
|
||||
import { formatBytes } from '../../utils/helper';
|
||||
import Colors from '../../styles/colors';
|
||||
import storageStatsStyle from '../../styles/storageStats';
|
||||
import { formatBytes } from 'utils/helper';
|
||||
import Colors from 'styles/colors';
|
||||
import storageStatsStyle from 'styles/storageStats';
|
||||
|
||||
class StorageStatsCard extends React.PureComponent {
|
||||
state = {
|
||||
@@ -75,10 +75,10 @@ class StorageStatsCard extends React.PureComponent {
|
||||
<View style={[storageStatsStyle.row, storageStatsStyle.totalSizeContainer]}>
|
||||
<View style={storageStatsStyle.summary}>
|
||||
<Text style={storageStatsStyle.totalSize}>{formatBytes(this.state.totalBytes, 2)}</Text>
|
||||
<Text style={storageStatsStyle.annotation}>used</Text>
|
||||
<Text style={storageStatsStyle.annotation}>{__('used')}</Text>
|
||||
</View>
|
||||
<View style={[storageStatsStyle.row, storageStatsStyle.toggleStatsContainer]}>
|
||||
<Text style={storageStatsStyle.statsText}>Stats</Text>
|
||||
<Text style={storageStatsStyle.statsText}>{__('Stats')}</Text>
|
||||
<Switch
|
||||
style={storageStatsStyle.statsToggle}
|
||||
value={this.state.showStats}
|
||||
@@ -98,28 +98,28 @@ class StorageStatsCard extends React.PureComponent {
|
||||
{this.state.totalAudioBytes > 0 && (
|
||||
<View style={[storageStatsStyle.row, storageStatsStyle.legendItem]}>
|
||||
<View style={[storageStatsStyle.legendBox, storageStatsStyle.audioDistribution]} />
|
||||
<Text style={storageStatsStyle.legendText}>Audio</Text>
|
||||
<Text style={storageStatsStyle.legendText}>{__('Audio')}</Text>
|
||||
<Text style={storageStatsStyle.legendSize}>{formatBytes(this.state.totalAudioBytes, 2)}</Text>
|
||||
</View>
|
||||
)}
|
||||
{this.state.totalImageBytes > 0 && (
|
||||
<View style={[storageStatsStyle.row, storageStatsStyle.legendItem]}>
|
||||
<View style={[storageStatsStyle.legendBox, storageStatsStyle.imageDistribution]} />
|
||||
<Text style={storageStatsStyle.legendText}>Images</Text>
|
||||
<Text style={storageStatsStyle.legendText}>{__('Images')}</Text>
|
||||
<Text style={storageStatsStyle.legendSize}>{formatBytes(this.state.totalImageBytes, 2)}</Text>
|
||||
</View>
|
||||
)}
|
||||
{this.state.totalVideoBytes > 0 && (
|
||||
<View style={[storageStatsStyle.row, storageStatsStyle.legendItem]}>
|
||||
<View style={[storageStatsStyle.legendBox, storageStatsStyle.videoDistribution]} />
|
||||
<Text style={storageStatsStyle.legendText}>Videos</Text>
|
||||
<Text style={storageStatsStyle.legendText}>{__('Videos')}</Text>
|
||||
<Text style={storageStatsStyle.legendSize}>{formatBytes(this.state.totalVideoBytes, 2)}</Text>
|
||||
</View>
|
||||
)}
|
||||
{this.state.totalOtherBytes > 0 && (
|
||||
<View style={[storageStatsStyle.row, storageStatsStyle.legendItem]}>
|
||||
<View style={[storageStatsStyle.legendBox, storageStatsStyle.otherDistribution]} />
|
||||
<Text style={storageStatsStyle.legendText}>Other</Text>
|
||||
<Text style={storageStatsStyle.legendText}>{__('Other')}</Text>
|
||||
<Text style={storageStatsStyle.legendSize}>{formatBytes(this.state.totalOtherBytes, 2)}</Text>
|
||||
</View>
|
||||
)}
|
||||
|
||||
@@ -57,7 +57,7 @@ class SuggestedSubscriptionItem extends React.PureComponent {
|
||||
style={subscriptionsStyle.suggestedItemName}
|
||||
numberOfLines={1}
|
||||
text={claim.name}
|
||||
onPress={() => navigateToUri(navigation, normalizeURI(shortUrl || uri))}
|
||||
onPress={() => navigateToUri(navigation, normalizeURI(shortUrl || uri), null, false, claim.permanent_url)}
|
||||
/>
|
||||
)}
|
||||
{tags && (
|
||||
@@ -72,7 +72,9 @@ class SuggestedSubscriptionItem extends React.PureComponent {
|
||||
)}
|
||||
</View>
|
||||
|
||||
<SubscribeButton style={subscriptionsStyle.suggestedItemSubscribe} uri={normalizeURI(uri)} />
|
||||
{claim && (
|
||||
<SubscribeButton style={subscriptionsStyle.suggestedItemSubscribe} uri={normalizeURI(claim.permanent_url)} />
|
||||
)}
|
||||
</View>
|
||||
);
|
||||
}
|
||||
|
||||
@@ -1,6 +1,7 @@
|
||||
import { connect } from 'react-redux';
|
||||
import { doClaimSearch, selectFetchingClaimSearch, selectClaimSearchByQuery, selectFollowedTags } from 'lbry-redux';
|
||||
import { selectSuggestedChannels, selectIsFetchingSuggested } from 'lbryinc';
|
||||
import { selectShowNsfw } from 'redux/selectors/settings';
|
||||
import SuggestedSubscriptions from './view';
|
||||
|
||||
const select = state => ({
|
||||
@@ -8,6 +9,7 @@ const select = state => ({
|
||||
suggested: selectSuggestedChannels(state),
|
||||
loading: selectIsFetchingSuggested(state) || selectFetchingClaimSearch(state),
|
||||
claimSearchByQuery: selectClaimSearchByQuery(state),
|
||||
showNsfwContent: selectShowNsfw(state),
|
||||
});
|
||||
|
||||
const perform = dispatch => ({
|
||||
|
||||
@@ -1,7 +1,7 @@
|
||||
import React from 'react';
|
||||
import { ActivityIndicator, FlatList, SectionList, Text, View } from 'react-native';
|
||||
import { createNormalizedClaimSearchKey, normalizeURI } from 'lbry-redux';
|
||||
import { __, navigateToUri } from 'utils/helper';
|
||||
import { ActivityIndicator, SectionList, Text, View } from 'react-native';
|
||||
import { MATURE_TAGS, createNormalizedClaimSearchKey, normalizeURI } from 'lbry-redux';
|
||||
import { navigateToUri } from 'utils/helper';
|
||||
import SubscribeButton from 'component/subscribeButton';
|
||||
import SuggestedSubscriptionItem from 'component/suggestedSubscriptionItem';
|
||||
import Colors from 'styles/colors';
|
||||
@@ -16,13 +16,16 @@ class SuggestedSubscriptions extends React.PureComponent {
|
||||
};
|
||||
|
||||
componentDidMount() {
|
||||
const { claimSearch, followedTags } = this.props;
|
||||
const { claimSearch, followedTags, showNsfwContent } = this.props;
|
||||
const options = {
|
||||
any_tags: _.shuffle(followedTags.map(tag => tag.name)).slice(0, 3),
|
||||
page: 1,
|
||||
no_totals: true,
|
||||
claim_type: 'channel',
|
||||
};
|
||||
if (!showNsfwContent) {
|
||||
options.not_tags = MATURE_TAGS;
|
||||
}
|
||||
this.setState({ options });
|
||||
claimSearch(options);
|
||||
}
|
||||
@@ -35,7 +38,7 @@ class SuggestedSubscriptions extends React.PureComponent {
|
||||
const suggestedUris = suggested ? suggested.map(suggested => suggested.uri) : [];
|
||||
return [
|
||||
{
|
||||
title: __('Tags you follow'),
|
||||
title: __('Suggested channels'),
|
||||
data: claimSearchUris ? claimSearchUris.filter(uri => !suggestedUris.includes(uri)) : [],
|
||||
},
|
||||
{
|
||||
@@ -46,7 +49,7 @@ class SuggestedSubscriptions extends React.PureComponent {
|
||||
};
|
||||
|
||||
render() {
|
||||
const { suggested, loading, navigation } = this.props;
|
||||
const { suggested, inModal, loading, navigation } = this.props;
|
||||
|
||||
if (loading) {
|
||||
return (
|
||||
@@ -58,8 +61,10 @@ class SuggestedSubscriptions extends React.PureComponent {
|
||||
|
||||
return (
|
||||
<SectionList
|
||||
style={subscriptionsStyle.scrollContainer}
|
||||
contentContainerStyle={subscriptionsStyle.suggestedScrollPadding}
|
||||
style={inModal ? subscriptionsStyle.modalScrollContainer : subscriptionsStyle.scrollContainer}
|
||||
contentContainerStyle={
|
||||
inModal ? subscriptionsStyle.modalSuggestedScrollContent : subscriptionsStyle.suggestedScrollContent
|
||||
}
|
||||
renderItem={({ item, index, section }) => (
|
||||
<SuggestedSubscriptionItem key={item} uri={normalizeURI(item)} navigation={navigation} />
|
||||
)}
|
||||
|
||||
@@ -74,7 +74,7 @@ export default class TagSearch extends React.PureComponent {
|
||||
<TextInput
|
||||
editable={editable}
|
||||
style={tagStyle.searchInput}
|
||||
placeholder={'Search for more tags'}
|
||||
placeholder={__('Search for more tags')}
|
||||
underlineColorAndroid={Colors.NextLbryGreen}
|
||||
value={this.state.tag}
|
||||
numberOfLines={1}
|
||||
@@ -89,7 +89,7 @@ export default class TagSearch extends React.PureComponent {
|
||||
</KeyboardAvoidingView>
|
||||
{showNsfwTags && (
|
||||
<View style={tagStyle.nsfwTagsContainer}>
|
||||
<Text style={tagStyle.nsfwTagsTitle}>Mature tags</Text>
|
||||
<Text style={tagStyle.nsfwTagsTitle}>{__('Mature tags')}</Text>
|
||||
<View style={tagStyle.tagResultsList}>
|
||||
{MATURE_TAGS.map(tag => (
|
||||
<Tag
|
||||
|
||||
@@ -2,10 +2,10 @@
|
||||
import React from 'react';
|
||||
import { Text, View, Linking } from 'react-native';
|
||||
import { buildURI, formatCredits } from 'lbry-redux';
|
||||
import { navigateToUri } from '../../../utils/helper';
|
||||
import Link from '../../link';
|
||||
import { navigateToUri } from 'utils/helper';
|
||||
import Link from 'component/link';
|
||||
import moment from 'moment';
|
||||
import transactionListStyle from '../../../styles/transactionList';
|
||||
import transactionListStyle from 'styles/transactionList';
|
||||
|
||||
class TransactionListItem extends React.PureComponent {
|
||||
capitalize(string: string) {
|
||||
@@ -43,14 +43,14 @@ class TransactionListItem extends React.PureComponent {
|
||||
style={transactionListStyle.smallLink}
|
||||
text={txid.substring(0, 8)}
|
||||
href={`https://explorer.lbry.com/tx/${txid}`}
|
||||
error={'The transaction URL could not be opened'}
|
||||
error={__('The transaction URL could not be opened')}
|
||||
/>
|
||||
</View>
|
||||
<View style={transactionListStyle.col}>
|
||||
{date ? (
|
||||
<Text style={transactionListStyle.smallText}>{moment(date).format('MMM D')}</Text>
|
||||
) : (
|
||||
<Text style={transactionListStyle.smallText}>Pending</Text>
|
||||
<Text style={transactionListStyle.smallText}>{__('Pending')}</Text>
|
||||
)}
|
||||
</View>
|
||||
</View>
|
||||
|
||||
@@ -47,7 +47,7 @@ class TransactionList extends React.PureComponent {
|
||||
return (
|
||||
<View>
|
||||
{!transactionList.length && (
|
||||
<Text style={transactionListStyle.noTransactions}>{emptyMessage || 'No transactions to list.'}</Text>
|
||||
<Text style={transactionListStyle.noTransactions}>{emptyMessage || __('No transactions to list.')}</Text>
|
||||
)}
|
||||
|
||||
{!!transactionList.length && (
|
||||
|
||||
@@ -2,11 +2,11 @@
|
||||
import React from 'react';
|
||||
// import BusyIndicator from 'component/common/busy-indicator';
|
||||
import { Text, View } from 'react-native';
|
||||
import Button from '../button';
|
||||
import Link from '../link';
|
||||
import TransactionList from '../transactionList';
|
||||
import type { Transaction } from '../transactionList/view';
|
||||
import walletStyle from '../../styles/wallet';
|
||||
import Button from 'component/button';
|
||||
import Link from 'component/link';
|
||||
import TransactionList from 'component/transactionList';
|
||||
import type { Transaction } from 'component/transactionList/view';
|
||||
import walletStyle from 'styles/wallet';
|
||||
|
||||
type Props = {
|
||||
fetchTransactions: () => void,
|
||||
@@ -26,15 +26,15 @@ class TransactionListRecent extends React.PureComponent<Props> {
|
||||
return (
|
||||
<View style={walletStyle.transactionsCard}>
|
||||
<View style={[walletStyle.row, walletStyle.transactionsHeader]}>
|
||||
<Text style={walletStyle.transactionsTitle}>Recent Transactions</Text>
|
||||
<Link style={walletStyle.link} navigation={navigation} text={'View All'} href={'#TransactionHistory'} />
|
||||
<Text style={walletStyle.transactionsTitle}>{__('Recent Transactions')}</Text>
|
||||
<Link style={walletStyle.link} navigation={navigation} text={__('View All')} href={'#TransactionHistory'} />
|
||||
</View>
|
||||
{fetchingTransactions && <Text style={walletStyle.infoText}>Fetching transactions...</Text>}
|
||||
{fetchingTransactions && <Text style={walletStyle.infoText}>{__('Fetching transactions...')}</Text>}
|
||||
{!fetchingTransactions && (
|
||||
<TransactionList
|
||||
navigation={navigation}
|
||||
transactions={transactions.slice(0, 5)}
|
||||
emptyMessage={"Looks like you don't have any recent transactions."}
|
||||
emptyMessage={__("Looks like you don't have any recent transactions.")}
|
||||
/>
|
||||
)}
|
||||
</View>
|
||||
|
||||
@@ -4,8 +4,10 @@ import {
|
||||
selectSearchState as selectSearch,
|
||||
selectSearchValue,
|
||||
selectSearchSuggestions,
|
||||
SETTINGS,
|
||||
} from 'lbry-redux';
|
||||
import { selectCurrentRoute } from 'redux/selectors/drawer';
|
||||
import { makeSelectClientSetting } from 'redux/selectors/settings';
|
||||
import UriBar from './view';
|
||||
|
||||
const select = state => {
|
||||
@@ -16,6 +18,7 @@ const select = state => {
|
||||
query: selectSearchValue(state),
|
||||
currentRoute: selectCurrentRoute(state),
|
||||
suggestions: selectSearchSuggestions(state),
|
||||
showUriBarSuggestions: makeSelectClientSetting(SETTINGS.SHOW_URI_BAR_SUGGESTIONS)(state),
|
||||
};
|
||||
};
|
||||
|
||||
|
||||
@@ -20,6 +20,10 @@ class UriBarItem extends React.PureComponent {
|
||||
icon = <Icon name="search" size={18} />;
|
||||
break;
|
||||
|
||||
case SEARCH_TYPES.TAG:
|
||||
icon = <Icon name="hashtag" size={18} />;
|
||||
break;
|
||||
|
||||
case SEARCH_TYPES.FILE:
|
||||
default:
|
||||
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.CHANNEL && `View the @${shorthand} channel`}
|
||||
{type === SEARCH_TYPES.FILE && `View content at ${value}`}
|
||||
{type === SEARCH_TYPES.TAG && `Explore the '${value}' tag`}
|
||||
</Text>
|
||||
</View>
|
||||
</TouchableOpacity>
|
||||
|
||||
@@ -1,7 +1,7 @@
|
||||
// @flow
|
||||
import React from 'react';
|
||||
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 Constants from 'constants'; // eslint-disable-line node/no-deprecated-api
|
||||
import UriBarItem from './internal/uri-bar-item';
|
||||
@@ -14,6 +14,8 @@ class UriBar extends React.PureComponent {
|
||||
|
||||
textInput = null;
|
||||
|
||||
keyboardDidShowListener = null;
|
||||
|
||||
keyboardDidHideListener = null;
|
||||
|
||||
state = {
|
||||
@@ -21,17 +23,19 @@ class UriBar extends React.PureComponent {
|
||||
currentValue: null,
|
||||
inputText: null,
|
||||
focused: false,
|
||||
|
||||
// TODO: Add a setting to enable / disable direct search?
|
||||
directSearch: true,
|
||||
keyboardHeight: 0,
|
||||
};
|
||||
|
||||
componentDidMount() {
|
||||
this.keyboardDidShowListener = Keyboard.addListener('keyboardDidShow', this._keyboardDidShow);
|
||||
this.keyboardDidHideListener = Keyboard.addListener('keyboardDidHide', this._keyboardDidHide);
|
||||
this.setSelection();
|
||||
}
|
||||
|
||||
componentWillUnmount() {
|
||||
if (this.keyboardDidShowListener) {
|
||||
this.keyboardDidShowListener.remove();
|
||||
}
|
||||
if (this.keyboardDidHideListener) {
|
||||
this.keyboardDidHideListener.remove();
|
||||
}
|
||||
@@ -49,25 +53,28 @@ class UriBar extends React.PureComponent {
|
||||
handleChangeText = text => {
|
||||
const newValue = text || '';
|
||||
clearTimeout(this.state.changeTextTimeout);
|
||||
const { updateSearchQuery, onSearchSubmitted, navigation } = this.props;
|
||||
const { updateSearchQuery, onSearchSubmitted, showUriBarSuggestions, navigation } = this.props;
|
||||
|
||||
let timeout = setTimeout(() => {
|
||||
if (text.trim().length === 0) {
|
||||
// don't do anything if the text is empty
|
||||
return;
|
||||
}
|
||||
updateSearchQuery(text);
|
||||
|
||||
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 } });
|
||||
let timeout = -1;
|
||||
if (!showUriBarSuggestions) {
|
||||
timeout = setTimeout(() => {
|
||||
if (text.trim().length === 0) {
|
||||
// don't do anything if the text is empty
|
||||
return;
|
||||
}
|
||||
}
|
||||
}, UriBar.INPUT_TIMEOUT);
|
||||
|
||||
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);
|
||||
}
|
||||
this.setState({ inputText: newValue, currentValue: newValue, changeTextTimeout: timeout });
|
||||
};
|
||||
|
||||
@@ -86,18 +93,34 @@ class UriBar extends React.PureComponent {
|
||||
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 {
|
||||
const uri = normalizeURI(value);
|
||||
navigateToUri(navigation, uri);
|
||||
}
|
||||
};
|
||||
|
||||
_keyboardDidShow = evt => {
|
||||
this.setState({ keyboardHeight: evt.endCoordinates.height });
|
||||
};
|
||||
|
||||
_keyboardDidHide = () => {
|
||||
if (this.textInput) {
|
||||
this.textInput.blur();
|
||||
}
|
||||
this.setState({ focused: false });
|
||||
this.setState({ focused: false, keyboardHeight: 0 });
|
||||
};
|
||||
|
||||
setSelection() {
|
||||
@@ -152,16 +175,18 @@ class UriBar extends React.PureComponent {
|
||||
selectedItemCount,
|
||||
selectionMode,
|
||||
suggestions,
|
||||
showUriBarSuggestions,
|
||||
value,
|
||||
} = this.props;
|
||||
if (this.state.currentValue === null) {
|
||||
this.setState({ currentValue: value });
|
||||
}
|
||||
|
||||
let style = [uriBarStyle.overlay, belowOverlay ? null : uriBarStyle.overlayElevated];
|
||||
|
||||
// TODO: Add optional setting to enable URI / search bar suggestions
|
||||
/* if (this.state.focused) { style.push(uriBarStyle.inFocus); } */
|
||||
let style = [
|
||||
uriBarStyle.overlay,
|
||||
belowOverlay ? null : uriBarStyle.overlayElevated,
|
||||
this.state.focused && showUriBarSuggestions ? uriBarStyle.inFocus : null,
|
||||
];
|
||||
|
||||
// TODO: selectionModeActions should be dynamically created / specified
|
||||
return (
|
||||
@@ -231,7 +256,7 @@ class UriBar extends React.PureComponent {
|
||||
this.setSelection();
|
||||
}}
|
||||
selectTextOnFocus
|
||||
placeholder={'Search movies, music, and more'}
|
||||
placeholder={__('Search movies, music, and more')}
|
||||
underlineColorAndroid={'transparent'}
|
||||
numberOfLines={1}
|
||||
clearButtonMode={'while-editing'}
|
||||
@@ -248,20 +273,21 @@ class UriBar extends React.PureComponent {
|
||||
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>
|
||||
{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>
|
||||
);
|
||||
}
|
||||
|
||||
@@ -27,21 +27,22 @@ class WalletAddress extends React.PureComponent<Props> {
|
||||
|
||||
return (
|
||||
<View style={walletStyle.card}>
|
||||
<Text style={walletStyle.title}>Receive Credits</Text>
|
||||
<Text style={walletStyle.title}>{__('Receive Credits')}</Text>
|
||||
<Text style={[walletStyle.text, walletStyle.bottomMarginMedium]}>
|
||||
Use this wallet address to receive credits sent by another user (or yourself).
|
||||
{__('Use this wallet address to receive credits sent by another user (or yourself).')}
|
||||
</Text>
|
||||
<Address address={receiveAddress} style={walletStyle.bottomMarginSmall} />
|
||||
<Button
|
||||
style={[walletStyle.button, walletStyle.bottomMarginLarge]}
|
||||
icon={'sync'}
|
||||
text={'Get new address'}
|
||||
text={__('Get new address')}
|
||||
onPress={getNewAddress}
|
||||
disabled={gettingNewAddress}
|
||||
/>
|
||||
<Text style={walletStyle.smallText}>
|
||||
You can generate a new address at any time, and any previous addresses will continue to work. Using multiple
|
||||
addresses can be helpful for keeping track of incoming payments from multiple sources.
|
||||
{__(
|
||||
'You can generate a new address at any time, and any previous addresses will continue to work. Using multiple addresses can be helpful for keeping track of incoming payments from multiple sources.'
|
||||
)}
|
||||
</Text>
|
||||
</View>
|
||||
);
|
||||
|
||||
@@ -16,8 +16,8 @@ class WalletBalance extends React.PureComponent<Props> {
|
||||
return (
|
||||
<View style={walletStyle.balanceCard}>
|
||||
<Image style={walletStyle.balanceBackground} resizeMode={'cover'} source={require('../../assets/stripe.png')} />
|
||||
<Text style={walletStyle.balanceTitle}>Balance</Text>
|
||||
<Text style={walletStyle.balanceCaption}>You currently have</Text>
|
||||
<Text style={walletStyle.balanceTitle}>{__('Balance')}</Text>
|
||||
<Text style={walletStyle.balanceCaption}>{__('You currently have')}</Text>
|
||||
<Text style={walletStyle.balance}>
|
||||
{(balance || balance === 0) && formatCredits(parseFloat(balance), 2) + ' LBC'}
|
||||
</Text>
|
||||
|
||||
@@ -1,4 +1,10 @@
|
||||
import { connect } from 'react-redux';
|
||||
import { selectUnclaimedRewardValue, selectUser } from 'lbryinc';
|
||||
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> {
|
||||
render() {
|
||||
const { navigation } = this.props;
|
||||
const { navigation, unclaimedRewardAmount, user } = this.props;
|
||||
const signedIn = user && user.has_verified_email;
|
||||
|
||||
return (
|
||||
<TouchableOpacity style={walletStyle.rewardDriverCard} onPress={() => navigation.navigate('Rewards')}>
|
||||
<Icon name="award" size={16} style={walletStyle.rewardIcon} />
|
||||
<Text style={walletStyle.rewardDriverText}>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>
|
||||
);
|
||||
}
|
||||
|
||||
@@ -1,9 +1,10 @@
|
||||
// @flow
|
||||
import React from 'react';
|
||||
import { regexAddress } from 'lbry-redux';
|
||||
import { formatCredits, regexAddress } from 'lbry-redux';
|
||||
import { Alert, Clipboard, TextInput, Text, View } from 'react-native';
|
||||
import Button from 'component/button';
|
||||
import Colors from 'styles/colors';
|
||||
import Icon from 'react-native-vector-icons/FontAwesome5';
|
||||
import walletStyle from 'styles/wallet';
|
||||
|
||||
type DraftTransaction = {
|
||||
@@ -24,6 +25,7 @@ class WalletSend extends React.PureComponent<Props> {
|
||||
address: null,
|
||||
addressChanged: false,
|
||||
addressValid: false,
|
||||
creditsInputFocused: false,
|
||||
};
|
||||
|
||||
componentWillUpdate(nextProps) {
|
||||
@@ -38,24 +40,24 @@ class WalletSend extends React.PureComponent<Props> {
|
||||
const { address, amount } = this.state;
|
||||
if (address && !regexAddress.test(address)) {
|
||||
notify({
|
||||
message: 'The recipient address is not a valid LBRY address.',
|
||||
message: __('The recipient address is not a valid LBRY address.'),
|
||||
});
|
||||
return;
|
||||
}
|
||||
|
||||
if (amount > balance) {
|
||||
notify({
|
||||
message: 'Insufficient credits',
|
||||
message: __('Insufficient credits'),
|
||||
});
|
||||
return;
|
||||
}
|
||||
|
||||
if (amount && address) {
|
||||
// Show confirmation before send
|
||||
Alert.alert('Send LBC', `Are you sure you want to send ${amount} LBC to ${address}?`, [
|
||||
{ text: 'No' },
|
||||
Alert.alert(__('Send LBC'), `Are you sure you want to send ${amount} LBC to ${address}?`, [
|
||||
{ text: __('No') },
|
||||
{
|
||||
text: 'Yes',
|
||||
text: __('Yes'),
|
||||
onPress: () => {
|
||||
sendToAddress(address, parseFloat(amount));
|
||||
this.setState({ address: null, amount: null });
|
||||
@@ -69,7 +71,7 @@ class WalletSend extends React.PureComponent<Props> {
|
||||
if (this.state.addressChanged && !this.state.addressValid) {
|
||||
const { notify } = this.props;
|
||||
notify({
|
||||
message: 'The recipient address is not a valid LBRY address.',
|
||||
message: __('The recipient address is not a valid LBRY address.'),
|
||||
});
|
||||
}
|
||||
};
|
||||
@@ -82,19 +84,20 @@ class WalletSend extends React.PureComponent<Props> {
|
||||
|
||||
render() {
|
||||
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 (
|
||||
<View style={walletStyle.card}>
|
||||
<Text style={walletStyle.title}>Send Credits</Text>
|
||||
<Text style={walletStyle.text}>Recipient address</Text>
|
||||
<Text style={walletStyle.title}>{__('Send Credits')}</Text>
|
||||
<Text style={walletStyle.text}>{__('Recipient address')}</Text>
|
||||
<View style={[walletStyle.row, walletStyle.bottomMarginMedium]}>
|
||||
<TextInput
|
||||
onChangeText={value =>
|
||||
this.setState({
|
||||
address: value,
|
||||
addressChanged: true,
|
||||
addressValid: value.trim().length == 0 || regexAddress.test(value),
|
||||
addressValid: value.trim().length === 0 || regexAddress.test(value),
|
||||
})
|
||||
}
|
||||
onBlur={this.handleAddressInputBlur}
|
||||
@@ -111,12 +114,14 @@ class WalletSend extends React.PureComponent<Props> {
|
||||
onPress={() => Clipboard.getString().then(value => this.setState({ address: value, addressChanged: true }))}
|
||||
/>
|
||||
</View>
|
||||
<Text style={walletStyle.text}>Amount</Text>
|
||||
<Text style={walletStyle.text}>{__('Amount')}</Text>
|
||||
<View style={walletStyle.row}>
|
||||
<View style={walletStyle.amountRow}>
|
||||
<TextInput
|
||||
ref={ref => (this.amountInput = ref)}
|
||||
onChangeText={value => this.setState({ amount: value })}
|
||||
onFocus={() => this.setState({ creditsInputFocused: true })}
|
||||
onBlur={() => this.setState({ creditsInputFocused: false })}
|
||||
keyboardType={'numeric'}
|
||||
placeholder={'0'}
|
||||
underlineColorAndroid={Colors.NextLbryGreen}
|
||||
@@ -124,9 +129,15 @@ class WalletSend extends React.PureComponent<Props> {
|
||||
style={[walletStyle.input, walletStyle.amountInput]}
|
||||
/>
|
||||
<Text style={[walletStyle.text, walletStyle.currency]}>LBC</Text>
|
||||
<View style={walletStyle.balanceFocus}>
|
||||
{this.state.creditsInputFocused && <Icon name="coins" size={12} />}
|
||||
{this.state.creditsInputFocused && (
|
||||
<Text style={walletStyle.balanceText}>{formatCredits(parseFloat(balance), 1, true)}</Text>
|
||||
)}
|
||||
</View>
|
||||
</View>
|
||||
<Button
|
||||
text={'Send'}
|
||||
text={__('Send')}
|
||||
style={[walletStyle.button, walletStyle.sendButton]}
|
||||
disabled={!canSend}
|
||||
onPress={this.handleSend}
|
||||
|
||||
@@ -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 { doToast } from 'lbry-redux';
|
||||
import { selectUserEmail } from 'lbryinc';
|
||||
import Constants from 'constants';
|
||||
import Constants from 'constants'; // eslint-disable-line node/no-deprecated-api
|
||||
import WalletSyncDriver from './view';
|
||||
|
||||
const select = state => ({
|
||||
|
||||
@@ -1,7 +1,7 @@
|
||||
import React from 'react';
|
||||
import { Alert, NativeModules, Switch, Text, View } from 'react-native';
|
||||
import Button from 'component/button';
|
||||
import Constants from 'constants';
|
||||
import Constants from 'constants'; // eslint-disable-line node/no-deprecated-api
|
||||
import Link from 'component/link';
|
||||
import walletStyle from 'styles/wallet';
|
||||
|
||||
@@ -15,15 +15,15 @@ class WalletSyncDriver extends React.PureComponent<Props> {
|
||||
// turning off
|
||||
// set deviceWalletSynced to false (if confirmed)
|
||||
Alert.alert(
|
||||
'Disable wallet sync',
|
||||
'Are you sure you want to turn off wallet sync?',
|
||||
__('Disable wallet sync'),
|
||||
__('Are you sure you want to turn off wallet sync?'),
|
||||
[
|
||||
{ text: 'No' },
|
||||
{ text: __('No') },
|
||||
{
|
||||
text: 'Yes',
|
||||
text: __('Yes'),
|
||||
onPress: () => {
|
||||
setClientSetting(Constants.SETTING_DEVICE_WALLET_SYNCED, false);
|
||||
notify({ message: 'Wallet sync was successfully disabled.' });
|
||||
notify({ message: __('Wallet sync was successfully disabled.') });
|
||||
},
|
||||
},
|
||||
],
|
||||
@@ -37,14 +37,14 @@ class WalletSyncDriver extends React.PureComponent<Props> {
|
||||
|
||||
return (
|
||||
<View style={walletStyle.syncDriverCard}>
|
||||
<Text style={walletStyle.syncDriverTitle}>Wallet Sync</Text>
|
||||
<Text style={walletStyle.syncDriverTitle}>{__('Wallet Sync')}</Text>
|
||||
<View style={walletStyle.switchRow}>
|
||||
<View style={walletStyle.tableCol}>
|
||||
<Text style={walletStyle.labelText}>Sync status</Text>
|
||||
<Text style={walletStyle.labelText}>{__('Sync status')}</Text>
|
||||
</View>
|
||||
<View style={walletStyle.tableColRow}>
|
||||
<Text selectable={true} style={walletStyle.valueText}>
|
||||
{deviceWalletSynced ? 'On' : 'Off'}
|
||||
<Text selectable style={walletStyle.valueText}>
|
||||
{deviceWalletSynced ? __('On') : __('Off')}
|
||||
</Text>
|
||||
<Switch
|
||||
style={walletStyle.syncSwitch}
|
||||
@@ -56,11 +56,11 @@ class WalletSyncDriver extends React.PureComponent<Props> {
|
||||
{deviceWalletSynced && (
|
||||
<View style={walletStyle.tableRow}>
|
||||
<View style={walletStyle.tableCol}>
|
||||
<Text style={walletStyle.labelText}>Connected email</Text>
|
||||
<Text style={walletStyle.labelText}>{__('Connected email')}</Text>
|
||||
</View>
|
||||
<View style={walletStyle.tableCol}>
|
||||
<Text selectable={true} style={walletStyle.valueText}>
|
||||
{userEmail ? userEmail : 'No connected email'}
|
||||
<Text selectable style={walletStyle.valueText} numberOfLines={1}>
|
||||
{userEmail || __('No connected email')}
|
||||
</Text>
|
||||
</View>
|
||||
</View>
|
||||
@@ -69,7 +69,7 @@ class WalletSyncDriver extends React.PureComponent<Props> {
|
||||
<View style={walletStyle.linkRow}>
|
||||
<View style={walletStyle.tableCol}>
|
||||
<Link
|
||||
text="Manual backup"
|
||||
text={__('Manual backup')}
|
||||
href="https://lbry.com/faq/how-to-backup-wallet#android"
|
||||
style={walletStyle.syncDriverLink}
|
||||
/>
|
||||
@@ -77,7 +77,7 @@ class WalletSyncDriver extends React.PureComponent<Props> {
|
||||
<View style={walletStyle.rightTableCol}>
|
||||
{!deviceWalletSynced && (
|
||||
<Link
|
||||
text="Sync FAQ"
|
||||
text={__('Sync FAQ')}
|
||||
href="https://lbry.com/faq/how-to-backup-wallet#sync"
|
||||
style={[walletStyle.syncDriverLink, walletStyle.rightLink]}
|
||||
/>
|
||||
|
||||
+14
-3
@@ -32,7 +32,7 @@ const Constants = {
|
||||
ABOUT_TAB: 'about',
|
||||
|
||||
KEY_FIRST_RUN_EMAIL: 'firstRunEmail',
|
||||
KEY_FIRST_RUN_PASSWORD: 'firstRunPassword',
|
||||
KEY_WALLET_PASSWORD: 'firstRunPassword',
|
||||
KEY_FIRST_USER_AUTH: 'firstUserAuth',
|
||||
KEY_SHOULD_VERIFY_EMAIL: 'shouldVerifyEmail',
|
||||
KEY_EMAIL_VERIFY_PENDING: 'emailVerifyPending',
|
||||
@@ -64,6 +64,8 @@ const Constants = {
|
||||
ACTION_CLEAR_PUBLISH_FORM_STATE: 'CLEAR_PUBLISH_FORM_STATE',
|
||||
ACTION_CLEAR_CHANNEL_FORM_STATE: 'CLEAR_CHANNEL_FORM_STATE',
|
||||
|
||||
ACTION_FULLSCREEN_MODE_TOGGLED: 'FULLSCREEN_MODE_TOGGLED',
|
||||
|
||||
ORIENTATION_HORIZONTAL: 'horizontal',
|
||||
ORIENTATION_VERTICAL: 'vertical',
|
||||
|
||||
@@ -93,6 +95,7 @@ const Constants = {
|
||||
FULL_ROUTE_NAME_WALLET: 'WalletStack',
|
||||
|
||||
ROUTE_FILE: 'File',
|
||||
DRAWER_ROUTE_FILE_VIEW: 'FileView',
|
||||
|
||||
ITEM_CREATE_A_CHANNEL: 'Create a channel...',
|
||||
ITEM_ANONYMOUS: 'Publish anonymously',
|
||||
@@ -127,7 +130,7 @@ const Constants = {
|
||||
{ name: TIME_ALL, label: 'All time' },
|
||||
],
|
||||
|
||||
DEFAULT_ORDER_BY: ['trending_global', 'trending_mixed'],
|
||||
DEFAULT_ORDER_BY: ['trending_group', 'trending_mixed'],
|
||||
|
||||
ORDER_BY_EFFECTIVE_AMOUNT: 'effective_amount',
|
||||
|
||||
@@ -138,6 +141,10 @@ const Constants = {
|
||||
MORE_PLACEHOLDER: '_more',
|
||||
|
||||
TRUE_STRING: 'true',
|
||||
|
||||
MINIMUM_TRANSACTION_BALANCE: 0.1,
|
||||
|
||||
SHARE_BASE_URL: 'https://open.lbry.com',
|
||||
};
|
||||
|
||||
export default Constants;
|
||||
@@ -161,4 +168,8 @@ export const DrawerRoutes = [
|
||||
];
|
||||
|
||||
// sub-pages for main routes
|
||||
export const InnerDrawerRoutes = [Constants.DRAWER_ROUTE_CHANNEL_CREATOR_FORM, Constants.DRAWER_ROUTE_PUBLISH_FORM];
|
||||
export const InnerDrawerRoutes = [
|
||||
Constants.DRAWER_ROUTE_CHANNEL_CREATOR_FORM,
|
||||
Constants.DRAWER_ROUTE_PUBLISH_FORM,
|
||||
Constants.DRAWER_ROUTE_FILE_VIEW,
|
||||
];
|
||||
+79
@@ -0,0 +1,79 @@
|
||||
import { NativeModules, Platform } from 'react-native';
|
||||
import { SETTINGS } from 'lbry-redux';
|
||||
import { doTransifexUpload } from 'lbryinc';
|
||||
import AsyncStorage from '@react-native-community/async-storage';
|
||||
import RNFS from 'react-native-fs';
|
||||
|
||||
const isProduction = !__DEV__; // eslint-disable-line no-undef
|
||||
let knownMessages = null;
|
||||
|
||||
window.language = NativeModules.UtilityModule.language;
|
||||
window.i18n_messages = window.i18n_messages || {};
|
||||
|
||||
function saveMessage(message) {
|
||||
// file path that won't get wiped if app storage is cleared or the app is uninstalled
|
||||
const messagesFilePath = RNFS.ExternalStorageDirectoryPath + '/lbry-app-strings.json';
|
||||
|
||||
if (knownMessages === null) {
|
||||
RNFS.readFile(messagesFilePath, 'utf8')
|
||||
.then(fileContents => {
|
||||
knownMessages = JSON.parse(fileContents);
|
||||
checkMessageAndSave(message, messagesFilePath);
|
||||
})
|
||||
.catch(err => {
|
||||
knownMessages = {}; // no known messages, initialise the object
|
||||
checkMessageAndSave(message, messagesFilePath);
|
||||
});
|
||||
} else {
|
||||
checkMessageAndSave(message, messagesFilePath);
|
||||
}
|
||||
}
|
||||
|
||||
function checkMessageAndSave(message, messagesFilePath) {
|
||||
if (!knownMessages[message]) {
|
||||
knownMessages[message] = message;
|
||||
const contents = JSON.stringify(knownMessages, null, 2);
|
||||
|
||||
RNFS.writeFile(messagesFilePath, contents, 'utf8')
|
||||
.then(() => {
|
||||
// successful write
|
||||
// send to transifex (should we do this even if the file doesn't get saved?)
|
||||
// TODO: load token from .env
|
||||
/* doTransifexUpload(
|
||||
contents,
|
||||
'lbry-mobile',
|
||||
'*token*',
|
||||
() => {
|
||||
// successful
|
||||
},
|
||||
err => {
|
||||
// failed
|
||||
}
|
||||
); */
|
||||
})
|
||||
.catch(err => {
|
||||
if (err) {
|
||||
throw err;
|
||||
}
|
||||
});
|
||||
}
|
||||
}
|
||||
|
||||
export function __(message, tokens) {
|
||||
const w = global.window ? global.window : window;
|
||||
let language = w.language ? w.language : 'en';
|
||||
|
||||
if (!isProduction) {
|
||||
saveMessage(message);
|
||||
}
|
||||
|
||||
const translatedMessage = w.i18n_messages[language] ? w.i18n_messages[language][message] || message : message;
|
||||
|
||||
if (!tokens) {
|
||||
return translatedMessage;
|
||||
}
|
||||
|
||||
return translatedMessage.replace(/%([^%]+)%/g, function($1, $2) {
|
||||
return tokens[$2] || $2;
|
||||
});
|
||||
}
|
||||
+66
-24
@@ -4,6 +4,8 @@ import { Provider, connect } from 'react-redux';
|
||||
import { AppRegistry, Text, View, NativeModules } from 'react-native';
|
||||
import {
|
||||
Lbry,
|
||||
buildSharedStateMiddleware,
|
||||
blockedReducer,
|
||||
claimsReducer,
|
||||
contentReducer,
|
||||
fileReducer,
|
||||
@@ -13,18 +15,25 @@ import {
|
||||
searchReducer,
|
||||
tagsReducer,
|
||||
walletReducer,
|
||||
ACTIONS as LBRY_REDUX_ACTIONS,
|
||||
} from 'lbry-redux';
|
||||
import {
|
||||
Lbryio,
|
||||
authReducer,
|
||||
blacklistReducer,
|
||||
costInfoReducer,
|
||||
doGetSync,
|
||||
filteredReducer,
|
||||
homepageReducer,
|
||||
rewardsReducer,
|
||||
selectUserVerifiedEmail,
|
||||
statsReducer,
|
||||
subscriptionsReducer,
|
||||
syncReducer,
|
||||
userReducer,
|
||||
LBRYINC_ACTIONS,
|
||||
} from 'lbryinc';
|
||||
import { makeSelectClientSetting } from 'redux/selectors/settings';
|
||||
import { createStore, applyMiddleware, compose } from 'redux';
|
||||
import AppWithNavigationState, {
|
||||
AppNavigator,
|
||||
@@ -32,6 +41,8 @@ import AppWithNavigationState, {
|
||||
reactNavigationMiddleware,
|
||||
} from 'component/AppNavigator';
|
||||
import { REHYDRATE, PURGE, persistCombineReducers, persistStore } from 'redux-persist';
|
||||
import { __ } from 'i18n';
|
||||
import Constants from 'constants'; // eslint-disable-line node/no-deprecated-api
|
||||
import getStoredStateMigrateV4 from 'redux-persist/lib/integration/getStoredStateMigrateV4';
|
||||
import FilesystemStorage from 'redux-persist-filesystem-storage';
|
||||
import createCompressor from 'redux-persist-transform-compress';
|
||||
@@ -42,8 +53,11 @@ import drawerReducer from 'redux/reducers/drawer';
|
||||
import settingsReducer from 'redux/reducers/settings';
|
||||
import thunk from 'redux-thunk';
|
||||
|
||||
window.__ = __;
|
||||
|
||||
const globalExceptionHandler = (error, isFatal) => {
|
||||
if (error && NativeModules.Firebase) {
|
||||
console.log(error);
|
||||
NativeModules.Firebase.logException(isFatal, error.message ? error.message : 'No message', JSON.stringify(error));
|
||||
}
|
||||
};
|
||||
@@ -79,18 +93,27 @@ function enableBatching(reducer) {
|
||||
|
||||
const compressor = createCompressor();
|
||||
const authFilter = createFilter('auth', ['authToken']);
|
||||
const blockedFilter = createFilter('blocked', ['blockedChannels']);
|
||||
const contentFilter = createFilter('content', ['positions']);
|
||||
const saveClaimsFilter = createFilter('claims', ['claimsByUri']);
|
||||
const subscriptionsFilter = createFilter('subscriptions', ['enabledChannelNotifications', 'subscriptions']);
|
||||
const subscriptionsFilter = createFilter('subscriptions', ['enabledChannelNotifications', 'subscriptions', 'latest']);
|
||||
const settingsFilter = createFilter('settings', ['clientSettings']);
|
||||
const tagsFilter = createFilter('tags', ['followedTags']);
|
||||
const walletFilter = createFilter('wallet', ['receiveAddress']);
|
||||
|
||||
const v4PersistOptions = {
|
||||
whitelist: ['auth', 'claims', 'content', 'subscriptions', 'settings', 'tags', 'wallet'],
|
||||
whitelist: ['auth', 'blocked', 'claims', 'content', 'subscriptions', 'settings', 'tags', 'wallet'],
|
||||
// Order is important. Needs to be compressed last or other transforms can't
|
||||
// read the data
|
||||
transforms: [authFilter, saveClaimsFilter, subscriptionsFilter, settingsFilter, walletFilter, compressor],
|
||||
transforms: [
|
||||
authFilter,
|
||||
blockedFilter,
|
||||
saveClaimsFilter,
|
||||
subscriptionsFilter,
|
||||
settingsFilter,
|
||||
walletFilter,
|
||||
compressor,
|
||||
],
|
||||
debounce: 10000,
|
||||
storage: FilesystemStorage,
|
||||
};
|
||||
@@ -103,6 +126,7 @@ const persistOptions = Object.assign({}, v4PersistOptions, {
|
||||
const reducers = persistCombineReducers(persistOptions, {
|
||||
auth: authReducer,
|
||||
blacklist: blacklistReducer,
|
||||
blocked: blockedReducer,
|
||||
claims: claimsReducer,
|
||||
content: contentReducer,
|
||||
costInfo: costInfoReducer,
|
||||
@@ -118,6 +142,7 @@ const reducers = persistCombineReducers(persistOptions, {
|
||||
rewards: rewardsReducer,
|
||||
settings: settingsReducer,
|
||||
search: searchReducer,
|
||||
stats: statsReducer,
|
||||
subscriptions: subscriptionsReducer,
|
||||
sync: syncReducer,
|
||||
tags: tagsReducer,
|
||||
@@ -125,8 +150,45 @@ const reducers = persistCombineReducers(persistOptions, {
|
||||
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 middleware = [thunk, bulkThunk, reactNavigationMiddleware];
|
||||
const middleware = [sharedStateMiddleware, thunk, bulkThunk, reactNavigationMiddleware];
|
||||
|
||||
// eslint-disable-next-line no-underscore-dangle
|
||||
const composeEnhancers = compose;
|
||||
@@ -145,26 +207,6 @@ const persistor = persistStore(store, persistOptions, err => {
|
||||
});
|
||||
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 {
|
||||
render() {
|
||||
return (
|
||||
|
||||
+21
-21
@@ -67,29 +67,29 @@ class AboutPage extends React.PureComponent {
|
||||
|
||||
render() {
|
||||
const { accessToken, drawerStack, navigation, notify, popDrawerStack, userEmail } = this.props;
|
||||
const loading = 'Loading...';
|
||||
const loading = __('Loading...');
|
||||
const ver = this.state.versionInfo ? this.state.versionInfo : null;
|
||||
|
||||
return (
|
||||
<View style={aboutStyle.container}>
|
||||
<PageHeader title={'About LBRY'} onBackPressed={() => navigateBack(navigation, drawerStack, popDrawerStack)} />
|
||||
<ScrollView style={aboutStyle.scrollContainer}>
|
||||
<Text style={aboutStyle.title}>Content Freedom</Text>
|
||||
<Text style={aboutStyle.title}>{__('Content Freedom')}</Text>
|
||||
<Text style={aboutStyle.paragraph}>
|
||||
LBRY is a free, open, and community-run digital marketplace. It is a decentralized peer-to-peer content
|
||||
distribution platform for creators to upload and share content, and earn LBRY credits for their effort.
|
||||
Users will be able to find a wide selection of videos, music, ebooks and other digital content they are
|
||||
interested in.
|
||||
{__(
|
||||
'LBRY is a free, open, and community-run digital marketplace. It is a decentralized peer-to-peer content distribution platform for creators to upload and share content, and earn LBRY credits for their effort. Users will be able to find a wide selection of videos, music, ebooks and other digital content they are interested in.'
|
||||
)}
|
||||
</Text>
|
||||
<View style={aboutStyle.links}>
|
||||
<Link style={aboutStyle.link} href="https://lbry.com/faq/what-is-lbry" text="What is LBRY?" />
|
||||
<Link style={aboutStyle.link} href="https://lbry.com/faq/android-basics" text="Android App Basics" />
|
||||
<Link style={aboutStyle.link} href="https://lbry.com/faq" text="Frequently Asked Questions" />
|
||||
<Link style={aboutStyle.link} href="https://lbry.com/faq/what-is-lbry" text={__('What is LBRY?')} />
|
||||
<Link style={aboutStyle.link} href="https://lbry.com/faq/android-basics" text={__('Android App Basics')} />
|
||||
<Link style={aboutStyle.link} href="https://lbry.com/faq" text={__('Frequently Asked Questions')} />
|
||||
</View>
|
||||
<Text style={aboutStyle.socialTitle}>Get Social</Text>
|
||||
<Text style={aboutStyle.socialTitle}>{__('Get Social')}</Text>
|
||||
<Text style={aboutStyle.paragraph}>
|
||||
You can interact with the LBRY team and members of the community on Discord, Facebook, Instagram, Twitter or
|
||||
Reddit.
|
||||
{__(
|
||||
'You can interact with the LBRY team and members of the community on Discord, Facebook, Instagram, Twitter or Reddit.'
|
||||
)}
|
||||
</Text>
|
||||
<View style={aboutStyle.links}>
|
||||
<Link style={aboutStyle.link} href="https://discordapp.com/invite/Z3bERWA" text="Discord" />
|
||||
@@ -99,12 +99,12 @@ class AboutPage extends React.PureComponent {
|
||||
<Link style={aboutStyle.link} href="https://reddit.com/r/lbry" text="Reddit" />
|
||||
<Link style={aboutStyle.link} href="https://t.me/lbryofficial" text="Telegram" />
|
||||
</View>
|
||||
<Text style={aboutStyle.releaseInfoTitle}>App info</Text>
|
||||
<Text style={aboutStyle.releaseInfoTitle}>{__('App info')}</Text>
|
||||
{userEmail && userEmail.trim().length > 0 && (
|
||||
<View style={aboutStyle.verticalRow}>
|
||||
<View style={aboutStyle.innerRow}>
|
||||
<View style={aboutStyle.col}>
|
||||
<Text style={aboutStyle.text}>Connected email</Text>
|
||||
<Text style={aboutStyle.text}>{__('Connected email')}</Text>
|
||||
</View>
|
||||
<View style={aboutStyle.col}>
|
||||
<Text selectable style={aboutStyle.valueText}>
|
||||
@@ -116,7 +116,7 @@ class AboutPage extends React.PureComponent {
|
||||
<Link
|
||||
style={aboutStyle.listLink}
|
||||
href={`http://lbry.com/list/edit/${accessToken}`}
|
||||
text="Update mailing preferences"
|
||||
text={__('Update mailing preferences')}
|
||||
/>
|
||||
</View>
|
||||
</View>
|
||||
@@ -124,7 +124,7 @@ class AboutPage extends React.PureComponent {
|
||||
|
||||
<View style={aboutStyle.row}>
|
||||
<View style={aboutStyle.col}>
|
||||
<Text style={aboutStyle.text}>App version</Text>
|
||||
<Text style={aboutStyle.text}>{__('App version')}</Text>
|
||||
</View>
|
||||
<View style={aboutStyle.col}>
|
||||
<Text selectable style={aboutStyle.valueText}>
|
||||
@@ -135,7 +135,7 @@ class AboutPage extends React.PureComponent {
|
||||
|
||||
<View style={aboutStyle.row}>
|
||||
<View style={aboutStyle.col}>
|
||||
<Text style={aboutStyle.text}>LBRY SDK</Text>
|
||||
<Text style={aboutStyle.text}>{__('LBRY SDK')}</Text>
|
||||
</View>
|
||||
<View style={aboutStyle.col}>
|
||||
<Text selectable style={aboutStyle.valueText}>
|
||||
@@ -146,7 +146,7 @@ class AboutPage extends React.PureComponent {
|
||||
|
||||
<View style={aboutStyle.row}>
|
||||
<View style={aboutStyle.col}>
|
||||
<Text style={aboutStyle.text}>Platform</Text>
|
||||
<Text style={aboutStyle.text}>{__('Platform')}</Text>
|
||||
</View>
|
||||
<View style={aboutStyle.col}>
|
||||
<Text selectable style={aboutStyle.valueText}>
|
||||
@@ -157,7 +157,7 @@ class AboutPage extends React.PureComponent {
|
||||
|
||||
<View style={aboutStyle.row}>
|
||||
<View style={aboutStyle.col}>
|
||||
<Text style={aboutStyle.text}>Installation ID</Text>
|
||||
<Text style={aboutStyle.text}>{__('Installation ID')}</Text>
|
||||
<Text selectable style={aboutStyle.lineValueText}>
|
||||
{this.state.lbryId ? this.state.lbryId : loading}
|
||||
</Text>
|
||||
@@ -166,12 +166,12 @@ class AboutPage extends React.PureComponent {
|
||||
|
||||
<View style={aboutStyle.row}>
|
||||
<View style={aboutStyle.col}>
|
||||
<Text style={aboutStyle.text}>Logs</Text>
|
||||
<Text style={aboutStyle.text}>{__('Logs')}</Text>
|
||||
</View>
|
||||
<View style={aboutStyle.col}>
|
||||
<Link
|
||||
style={aboutStyle.listLink}
|
||||
text="Send log"
|
||||
text={__('Send log')}
|
||||
onPress={() => {
|
||||
if (NativeModules.UtilityModule) {
|
||||
NativeModules.UtilityModule.shareLogFile(error => {
|
||||
|
||||
@@ -1,5 +1,6 @@
|
||||
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 { doSetSortByItem, doSetTimeItem } from 'redux/actions/settings';
|
||||
import { selectDrawerStack } from 'redux/selectors/drawer';
|
||||
@@ -11,10 +12,14 @@ const select = (state, props) => ({
|
||||
claim: makeSelectClaimForUri(props.uri)(state),
|
||||
drawerStack: selectDrawerStack(state),
|
||||
sortByItem: selectSortByItem(state),
|
||||
subCount: makeSelectSubCountForUri(props.uri)(state),
|
||||
timeItem: selectTimeItem(state),
|
||||
});
|
||||
|
||||
const perform = dispatch => ({
|
||||
abandonClaim: (txid, nout) => dispatch(doAbandonClaim(txid, nout)),
|
||||
fetchChannelListMine: () => dispatch(doFetchChannelListMine()),
|
||||
fetchSubCount: claimId => dispatch(doFetchSubCount(claimId)),
|
||||
popDrawerStack: () => dispatch(doPopDrawerStack()),
|
||||
setSortByItem: item => dispatch(doSetSortByItem(item)),
|
||||
setTimeItem: item => dispatch(doSetTimeItem(item)),
|
||||
|
||||
+48
-24
@@ -13,12 +13,13 @@ import {
|
||||
} from 'react-native';
|
||||
import { TabView, SceneMap } from 'react-native-tab-view';
|
||||
import { normalizeURI } from 'lbry-redux';
|
||||
import { navigateBack, getOrderBy } from 'utils/helper';
|
||||
import { navigateBack, getOrderBy, formatLbryUrlForWeb } from 'utils/helper';
|
||||
import ChannelIconItem from 'component/channelIconItem';
|
||||
import ClaimList from 'component/claimList';
|
||||
import Colors from 'styles/colors';
|
||||
import Constants from 'constants'; // eslint-disable-line node/no-deprecated-api
|
||||
import Button from 'component/button';
|
||||
import EmptyStateView from 'component/emptyStateView';
|
||||
import Icon from 'react-native-vector-icons/FontAwesome5';
|
||||
import Link from 'component/link';
|
||||
import ModalPicker from 'component/modalPicker';
|
||||
@@ -35,8 +36,9 @@ class ChannelPage extends React.PureComponent {
|
||||
autoStyle: null,
|
||||
showSortPicker: false,
|
||||
showTimePicker: false,
|
||||
orderBy: Constants.DEFAULT_ORDER_BY,
|
||||
orderBy: ['release_time'], // sort by new by default
|
||||
activeTab: Constants.CONTENT_TAB,
|
||||
currentSortByItem: Constants.CLAIM_SEARCH_SORT_BY_ITEMS[1], // should always default to sorting channel pages by new
|
||||
};
|
||||
|
||||
componentWillMount() {
|
||||
@@ -47,13 +49,17 @@ class ChannelPage extends React.PureComponent {
|
||||
}
|
||||
|
||||
componentDidMount() {
|
||||
const { claim, fetchChannelListMine, fetchSubCount } = this.props;
|
||||
NativeModules.Firebase.setCurrentScreen('Channel');
|
||||
fetchChannelListMine();
|
||||
if (claim) {
|
||||
fetchSubCount(claim.claim_id);
|
||||
}
|
||||
}
|
||||
|
||||
handleSortByItemSelected = item => {
|
||||
const { setSortByItem } = this.props;
|
||||
setSortByItem(item);
|
||||
this.setState({ orderBy: getOrderBy(item), showSortPicker: false });
|
||||
// sort by specific only to this component state
|
||||
this.setState({ currentSortByItem: item, orderBy: getOrderBy(item), showSortPicker: false });
|
||||
};
|
||||
|
||||
handleTimeItemSelected = item => {
|
||||
@@ -63,19 +69,20 @@ class ChannelPage extends React.PureComponent {
|
||||
};
|
||||
|
||||
listHeader = () => {
|
||||
const { sortByItem, timeItem } = this.props;
|
||||
const { timeItem } = this.props;
|
||||
const { currentSortByItem } = this.state;
|
||||
|
||||
return (
|
||||
<View style={channelPageStyle.listHeader}>
|
||||
<View style={discoverStyle.pickerRow}>
|
||||
<View style={discoverStyle.leftPickerRow}>
|
||||
<TouchableOpacity style={discoverStyle.tagSortBy} onPress={() => this.setState({ showSortPicker: true })}>
|
||||
<Text style={discoverStyle.tagSortText}>{sortByItem.label.split(' ')[0]}</Text>
|
||||
<Text style={discoverStyle.tagSortText}>{__(currentSortByItem.label.split(' ')[0])}</Text>
|
||||
<Icon style={discoverStyle.tagSortIcon} name={'sort-down'} size={14} />
|
||||
</TouchableOpacity>
|
||||
{Constants.SORT_BY_TOP === sortByItem.name && (
|
||||
{Constants.SORT_BY_TOP === currentSortByItem.name && (
|
||||
<TouchableOpacity style={discoverStyle.tagTime} onPress={() => this.setState({ showTimePicker: true })}>
|
||||
<Text style={discoverStyle.tagSortText}>{timeItem.label}</Text>
|
||||
<Text style={discoverStyle.tagSortText}>{__(timeItem.label)}</Text>
|
||||
<Icon style={discoverStyle.tagSortIcon} name={'sort-down'} size={14} />
|
||||
</TouchableOpacity>
|
||||
)}
|
||||
@@ -118,7 +125,7 @@ class ChannelPage extends React.PureComponent {
|
||||
return (
|
||||
<View style={channelPageStyle.aboutTab}>
|
||||
<View style={channelPageStyle.busyContainer}>
|
||||
<Text style={channelPageStyle.infoText}>No information to display.</Text>
|
||||
<Text style={channelPageStyle.infoText}>{__('No information to display.')}</Text>
|
||||
</View>
|
||||
</View>
|
||||
);
|
||||
@@ -128,23 +135,21 @@ class ChannelPage extends React.PureComponent {
|
||||
return (
|
||||
<View style={channelPageStyle.aboutTab}>
|
||||
{!websiteUrl && !email && !description && (
|
||||
<View style={channelPageStyle.busyContainer}>
|
||||
<Text style={channelPageStyle.infoText}>Nothing here yet. Please check back later.</Text>
|
||||
</View>
|
||||
<EmptyStateView message={__("There's nothing here yet.\nPlease check back later.")} />
|
||||
)}
|
||||
|
||||
{(websiteUrl || email || description) && (
|
||||
<ScrollView style={channelPageStyle.aboutScroll} contentContainerStyle={channelPageStyle.aboutScrollContent}>
|
||||
{websiteUrl && websiteUrl.trim().length > 0 && (
|
||||
<View style={channelPageStyle.aboutItem}>
|
||||
<Text style={channelPageStyle.aboutTitle}>Website</Text>
|
||||
<Text style={channelPageStyle.aboutTitle}>{__('Website')}</Text>
|
||||
<Link style={channelPageStyle.aboutText} text={websiteUrl} href={websiteUrl} />
|
||||
</View>
|
||||
)}
|
||||
|
||||
{email && email.trim().length > 0 && (
|
||||
<View style={channelPageStyle.aboutItem}>
|
||||
<Text style={channelPageStyle.aboutTitle}>Email</Text>
|
||||
<Text style={channelPageStyle.aboutTitle}>{__('Email')}</Text>
|
||||
<Link style={channelPageStyle.aboutText} text={email} href={`mailto:${email}`} />
|
||||
</View>
|
||||
)}
|
||||
@@ -171,6 +176,15 @@ class ChannelPage extends React.PureComponent {
|
||||
}
|
||||
};
|
||||
|
||||
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 = () => {
|
||||
const { abandonClaim, claim, navigation } = this.props;
|
||||
if (claim) {
|
||||
@@ -196,9 +210,9 @@ class ChannelPage extends React.PureComponent {
|
||||
};
|
||||
|
||||
render() {
|
||||
const { channels, claim, navigation, uri, drawerStack, popDrawerStack, sortByItem, timeItem } = this.props;
|
||||
const { channels, claim, navigation, uri, drawerStack, popDrawerStack, subCount, timeItem } = this.props;
|
||||
const { name, permanent_url: permanentUrl } = claim;
|
||||
const { autoStyle, showSortPicker, showTimePicker } = this.state;
|
||||
const { autoStyle, currentSortByItem, showSortPicker, showTimePicker } = this.state;
|
||||
const ownedChannel = channels ? channels.map(channel => channel.permanent_url).includes(permanentUrl) : false;
|
||||
|
||||
let thumbnailUrl,
|
||||
@@ -241,6 +255,10 @@ class ChannelPage extends React.PureComponent {
|
||||
|
||||
<View style={channelPageStyle.channelHeader}>
|
||||
<Text style={channelPageStyle.channelName}>{title && title.trim().length > 0 ? title : name}</Text>
|
||||
<Text style={channelPageStyle.followerCount}>
|
||||
{subCount === 1 && __('%follower% follower', { follower: subCount })}
|
||||
{subCount > 1 && __('%follower% followers', { follower: subCount })}
|
||||
</Text>
|
||||
</View>
|
||||
|
||||
<View style={[channelPageStyle.avatarImageContainer, autoStyle]}>
|
||||
@@ -260,21 +278,27 @@ class ChannelPage extends React.PureComponent {
|
||||
style={channelPageStyle.actionButton}
|
||||
theme={'light'}
|
||||
icon={'edit'}
|
||||
text={'Edit'}
|
||||
text={__('Edit')}
|
||||
onPress={this.onEditPressed}
|
||||
/>
|
||||
)}
|
||||
{ownedChannel && (
|
||||
<Button
|
||||
style={channelPageStyle.deleteButton}
|
||||
style={[channelPageStyle.actionButton, channelPageStyle.deleteButton]}
|
||||
theme={'light'}
|
||||
icon={'trash-alt'}
|
||||
text={'Delete'}
|
||||
text={__('Delete')}
|
||||
onPress={this.onDeletePressed}
|
||||
/>
|
||||
)}
|
||||
<Button
|
||||
style={[channelPageStyle.actionButton, channelPageStyle.shareButton]}
|
||||
theme={'light'}
|
||||
icon={'share-alt'}
|
||||
onPress={this.onSharePressed}
|
||||
/>
|
||||
{!ownedChannel && <SubscribeButton style={channelPageStyle.subscribeButton} uri={fullUri} name={name} />}
|
||||
{!ownedChannel && (
|
||||
{false && !ownedChannel && (
|
||||
<SubscribeNotificationButton
|
||||
style={[channelPageStyle.subscribeButton, channelPageStyle.bellButton]}
|
||||
uri={fullUri}
|
||||
@@ -289,14 +313,14 @@ class ChannelPage extends React.PureComponent {
|
||||
style={channelPageStyle.tab}
|
||||
onPress={() => this.setState({ activeTab: Constants.CONTENT_TAB })}
|
||||
>
|
||||
<Text style={channelPageStyle.tabTitle}>CONTENT</Text>
|
||||
<Text style={channelPageStyle.tabTitle}>{__('CONTENT')}</Text>
|
||||
{Constants.CONTENT_TAB === this.state.activeTab && <View style={channelPageStyle.activeTabHint} />}
|
||||
</TouchableOpacity>
|
||||
<TouchableOpacity
|
||||
style={channelPageStyle.tab}
|
||||
onPress={() => this.setState({ activeTab: Constants.ABOUT_TAB })}
|
||||
>
|
||||
<Text style={channelPageStyle.tabTitle}>ABOUT</Text>
|
||||
<Text style={channelPageStyle.tabTitle}>{__('ABOUT')}</Text>
|
||||
{Constants.ABOUT_TAB === this.state.activeTab && <View style={channelPageStyle.activeTabHint} />}
|
||||
</TouchableOpacity>
|
||||
</View>
|
||||
@@ -310,7 +334,7 @@ class ChannelPage extends React.PureComponent {
|
||||
title={__('Sort content by')}
|
||||
onOverlayPress={() => this.setState({ showSortPicker: false })}
|
||||
onItemSelected={this.handleSortByItemSelected}
|
||||
selectedItem={sortByItem}
|
||||
selectedItem={currentSortByItem}
|
||||
items={Constants.CLAIM_SEARCH_SORT_BY_ITEMS}
|
||||
/>
|
||||
)}
|
||||
|
||||
@@ -12,10 +12,11 @@ import {
|
||||
doUpdateChannel,
|
||||
doToast,
|
||||
} from 'lbry-redux';
|
||||
import { doGetSync } 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 } from 'redux/selectors/form';
|
||||
import { selectChannelFormState, selectHasChannelFormState } from 'redux/selectors/form';
|
||||
import Constants from 'constants'; // eslint-disable-line node/no-deprecated-api
|
||||
import ChannelCreator from './view';
|
||||
|
||||
@@ -26,6 +27,7 @@ const select = state => ({
|
||||
drawerStack: selectDrawerStack(state),
|
||||
fetchingChannels: selectFetchingMyChannels(state),
|
||||
balance: selectBalance(state),
|
||||
hasFormState: selectHasChannelFormState(state),
|
||||
updatingChannel: selectUpdatingChannel(state),
|
||||
updateChannelError: selectUpdateChannelError(state),
|
||||
});
|
||||
@@ -36,6 +38,7 @@ const perform = dispatch => ({
|
||||
clearChannelFormState: () => dispatch(doClearChannelFormState()),
|
||||
createChannel: (name, amount, optionalParams) => dispatch(doCreateChannel(name, amount, optionalParams)),
|
||||
fetchChannelListMine: () => dispatch(doFetchChannelListMine()),
|
||||
getSync: (password, callback) => dispatch(doGetSync(password, callback)),
|
||||
updateChannel: params => dispatch(doUpdateChannel(params)),
|
||||
updateChannelFormState: data => dispatch(doUpdateChannelFormState(data)),
|
||||
pushDrawerStack: (routeName, params) => dispatch(doPushDrawerStack(routeName, params)),
|
||||
|
||||
+136
-85
@@ -1,5 +1,5 @@
|
||||
import React from 'react';
|
||||
import { CLAIM_VALUES, isURIValid, regexInvalidURI } from 'lbry-redux';
|
||||
import { CLAIM_VALUES, formatCredits, isNameValid, regexInvalidURI } from 'lbry-redux';
|
||||
import {
|
||||
ActivityIndicator,
|
||||
Alert,
|
||||
@@ -14,11 +14,13 @@ import {
|
||||
TouchableOpacity,
|
||||
View,
|
||||
} from 'react-native';
|
||||
import { navigateToUri, uploadImageAsset } from 'utils/helper';
|
||||
import { navigateToUri, logPublish, uploadImageAsset } from 'utils/helper';
|
||||
import Button from 'component/button';
|
||||
import ChannelIconItem from 'component/channelIconItem';
|
||||
import ChannelRewardsDriver from 'component/channelRewardsDriver';
|
||||
import Colors from 'styles/colors';
|
||||
import Constants from 'constants'; // eslint-disable-line node/no-deprecated-api
|
||||
import EmptyStateView from 'component/emptyStateView';
|
||||
import FloatingWalletBalance from 'component/floatingWalletBalance';
|
||||
import Icon from 'react-native-vector-icons/FontAwesome5';
|
||||
import Link from 'component/link';
|
||||
@@ -30,12 +32,15 @@ import channelIconStyle from 'styles/channelIcon';
|
||||
import seedrandom from 'seedrandom';
|
||||
|
||||
export default class ChannelCreator extends React.PureComponent {
|
||||
scrollView = null;
|
||||
|
||||
state = {
|
||||
autoStyle: null,
|
||||
canSave: false,
|
||||
canSave: true,
|
||||
claimId: null,
|
||||
creditsInputFocused: false,
|
||||
currentSelectedValue: Constants.ITEM_ANONYMOUS,
|
||||
currentPhase: Constants.PHASE_LIST,
|
||||
currentPhase: null,
|
||||
displayName: null,
|
||||
channelNameUserEdited: false,
|
||||
newChannelTitle: '',
|
||||
@@ -100,18 +105,20 @@ export default class ChannelCreator extends React.PureComponent {
|
||||
generateAutoStyles = size => {
|
||||
const { channels = [] } = this.props;
|
||||
const autoStyles = [];
|
||||
for (let i = 0; i < size && i < channels.length; i++) {
|
||||
// seed generator using the claim_id
|
||||
const rng = seedrandom(channels[i].permanent_url); // is this efficient?
|
||||
const index = Math.floor(rng.quick() * ChannelIconItem.AUTO_THUMB_STYLES.length);
|
||||
autoStyles.push(ChannelIconItem.AUTO_THUMB_STYLES[index]);
|
||||
if (channels) {
|
||||
for (let i = 0; i < size && i < channels.length; i++) {
|
||||
// seed generator using the claim_id
|
||||
const rng = seedrandom(channels[i].permanent_url); // is this efficient?
|
||||
const index = Math.floor(rng.quick() * ChannelIconItem.AUTO_THUMB_STYLES.length);
|
||||
autoStyles.push(ChannelIconItem.AUTO_THUMB_STYLES[index]);
|
||||
}
|
||||
}
|
||||
return autoStyles;
|
||||
};
|
||||
|
||||
componentWillReceiveProps(nextProps) {
|
||||
const { currentRoute, drawerStack, updatingChannel, updateChannelError } = nextProps;
|
||||
const { currentRoute: prevRoute, drawerStack: prevDrawerStack, notify } = this.props;
|
||||
const { currentRoute, drawerStack, updatingChannel, updateChannelError } = nextProps;
|
||||
|
||||
if (Constants.DRAWER_ROUTE_CHANNEL_CREATOR === currentRoute && currentRoute !== prevRoute) {
|
||||
this.onComponentFocused();
|
||||
@@ -148,6 +155,7 @@ export default class ChannelCreator extends React.PureComponent {
|
||||
navigation,
|
||||
pushDrawerStack,
|
||||
setPlayerVisible,
|
||||
hasFormState,
|
||||
} = this.props;
|
||||
|
||||
NativeModules.Firebase.setCurrentScreen('Channels').then(result => {
|
||||
@@ -156,22 +164,23 @@ export default class ChannelCreator extends React.PureComponent {
|
||||
if (!fetchingChannels) {
|
||||
fetchChannelListMine();
|
||||
}
|
||||
if (balance > 0.1) {
|
||||
this.setState({ canSave: true });
|
||||
}
|
||||
|
||||
DeviceEventEmitter.addListener('onDocumentPickerFilePicked', this.onFilePicked);
|
||||
DeviceEventEmitter.addListener('onDocumentPickerCanceled', this.onPickerCanceled);
|
||||
|
||||
let isEditMode = false;
|
||||
if (navigation.state.params) {
|
||||
const { editChannelUrl, displayForm } = navigation.state.params;
|
||||
if (editChannelUrl) {
|
||||
isEditMode = true;
|
||||
this.setState({ editChannelUrl, currentPhase: Constants.PHASE_CREATE });
|
||||
} else if (displayForm) {
|
||||
this.loadPendingFormState();
|
||||
this.setState({ currentPhase: Constants.PHASE_CREATE });
|
||||
}
|
||||
}
|
||||
|
||||
if (!isEditMode && hasFormState) {
|
||||
this.loadPendingFormState();
|
||||
}
|
||||
this.setState({ currentPhase: isEditMode || hasFormState ? Constants.PHASE_CREATE : Constants.PHASE_LIST });
|
||||
});
|
||||
};
|
||||
|
||||
@@ -233,7 +242,7 @@ export default class ChannelCreator extends React.PureComponent {
|
||||
componentDidUpdate() {
|
||||
const { channels = [] } = this.props;
|
||||
const { editChannelUrl } = this.state;
|
||||
if (channels.length > 0) {
|
||||
if (channels && channels.length > 0) {
|
||||
if (this.state.autoStyles.length !== channels.length) {
|
||||
this.setState({
|
||||
autoStyles: this.generateAutoStyles(channels.length),
|
||||
@@ -330,7 +339,7 @@ export default class ChannelCreator extends React.PureComponent {
|
||||
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.';
|
||||
} else if (this.channelExists(newChannelName)) {
|
||||
newChannelNameError = 'You have already created a channel with the same name.';
|
||||
@@ -367,7 +376,15 @@ export default class ChannelCreator extends React.PureComponent {
|
||||
};
|
||||
|
||||
handleCreateChannelClick = () => {
|
||||
const { balance, clearChannelFormState, createChannel, onChannelChange, notify, updateChannel } = this.props;
|
||||
const {
|
||||
balance,
|
||||
clearChannelFormState,
|
||||
createChannel,
|
||||
onChannelChange,
|
||||
getSync,
|
||||
notify,
|
||||
updateChannel,
|
||||
} = this.props;
|
||||
const {
|
||||
claimId,
|
||||
coverImageUrl,
|
||||
@@ -383,12 +400,22 @@ export default class ChannelCreator extends React.PureComponent {
|
||||
website,
|
||||
} = 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.' });
|
||||
return;
|
||||
}
|
||||
|
||||
if (email.trim().length > 0 && (email.indexOf('@') === -1 || email.indexOf('.') === -1)) {
|
||||
if (email && email.trim().length > 0 && (email.indexOf('@') === -1 || email.indexOf('.') === -1)) {
|
||||
notify({ message: 'Please provide a valid email address.' });
|
||||
return;
|
||||
}
|
||||
@@ -414,7 +441,7 @@ export default class ChannelCreator extends React.PureComponent {
|
||||
createChannelError: undefined,
|
||||
});
|
||||
|
||||
const success = () => {
|
||||
const success = channelClaim => {
|
||||
this.setState({
|
||||
creatingChannel: false,
|
||||
addingChannel: false,
|
||||
@@ -430,6 +457,8 @@ export default class ChannelCreator extends React.PureComponent {
|
||||
clearChannelFormState();
|
||||
notify({ message: 'The channel was successfully created.' });
|
||||
this.showChannelList();
|
||||
|
||||
logPublish(channelClaim);
|
||||
};
|
||||
|
||||
const failure = () => {
|
||||
@@ -447,8 +476,8 @@ export default class ChannelCreator extends React.PureComponent {
|
||||
return { name: tag };
|
||||
}),
|
||||
website,
|
||||
cover: coverImageUrl,
|
||||
thumbnail: thumbnailUrl,
|
||||
coverUrl: coverImageUrl,
|
||||
thumbnailUrl: thumbnailUrl,
|
||||
};
|
||||
|
||||
if (this.state.editMode) {
|
||||
@@ -472,12 +501,14 @@ export default class ChannelCreator extends React.PureComponent {
|
||||
|
||||
channelExists = name => {
|
||||
const { channels = [] } = this.props;
|
||||
for (let channel of channels) {
|
||||
if (
|
||||
name.toLowerCase() === channel.name.toLowerCase() ||
|
||||
`@${name}`.toLowerCase() === channel.name.toLowerCase()
|
||||
) {
|
||||
return true;
|
||||
if (channels) {
|
||||
for (let channel of channels) {
|
||||
if (
|
||||
name.toLowerCase() === channel.name.toLowerCase() ||
|
||||
`@${name}`.toLowerCase() === channel.name.toLowerCase()
|
||||
) {
|
||||
return true;
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
@@ -519,7 +550,6 @@ export default class ChannelCreator extends React.PureComponent {
|
||||
handleNewChannelPress = () => {
|
||||
const { pushDrawerStack } = this.props;
|
||||
pushDrawerStack(Constants.DRAWER_ROUTE_CHANNEL_CREATOR_FORM);
|
||||
this.loadPendingFormState();
|
||||
this.setState({ currentPhase: Constants.PHASE_CREATE });
|
||||
};
|
||||
|
||||
@@ -528,15 +558,17 @@ export default class ChannelCreator extends React.PureComponent {
|
||||
};
|
||||
|
||||
showChannelList = () => {
|
||||
const { popDrawerStack } = this.props;
|
||||
popDrawerStack();
|
||||
this.resetChannelCreator();
|
||||
const { drawerStack, popDrawerStack } = this.props;
|
||||
if (drawerStack[drawerStack.length - 1].route === Constants.DRAWER_ROUTE_CHANNEL_CREATOR_FORM) {
|
||||
popDrawerStack();
|
||||
}
|
||||
this.setState({ currentPhase: Constants.PHASE_LIST });
|
||||
this.resetChannelCreator();
|
||||
};
|
||||
|
||||
resetChannelCreator = () => {
|
||||
this.setState({
|
||||
canSave: false,
|
||||
canSave: true,
|
||||
claimId: null,
|
||||
editMode: false,
|
||||
displayName: null,
|
||||
@@ -550,8 +582,8 @@ export default class ChannelCreator extends React.PureComponent {
|
||||
newChannelBidError: '',
|
||||
createChannelError: undefined,
|
||||
showCreateChannel: false,
|
||||
thumbnailUrl: null,
|
||||
coverImageUrl: null,
|
||||
thumbnailUrl: '',
|
||||
coverImageUrl: '',
|
||||
avatarImagePickerOpen: false,
|
||||
coverImagePickerOpen: false,
|
||||
|
||||
@@ -593,15 +625,17 @@ export default class ChannelCreator extends React.PureComponent {
|
||||
};
|
||||
|
||||
prepareEdit = channel => {
|
||||
const { pushDrawerStack } = this.props;
|
||||
const { balance, pushDrawerStack } = this.props;
|
||||
const { value } = channel;
|
||||
|
||||
pushDrawerStack(Constants.DRAWER_ROUTE_CHANNEL_CREATOR_FORM);
|
||||
this.setState({
|
||||
canSave: true,
|
||||
claimId: channel.claim_id,
|
||||
currentPhase: Constants.PHASE_CREATE,
|
||||
displayName: value && value.title ? value.title : channel.name.substring(1),
|
||||
editMode: true,
|
||||
coverImageUrl: value && value.cover ? value.cover.url : null,
|
||||
coverImageUrl: value && value.cover ? value.cover.url : '',
|
||||
currentChannelName: channel.name.substring(1),
|
||||
newChannelName: channel.name.substring(1),
|
||||
newChannelTitle: value ? value.title : null,
|
||||
@@ -610,7 +644,7 @@ export default class ChannelCreator extends React.PureComponent {
|
||||
email: value ? value.email : null,
|
||||
website: value ? value.website_url : null,
|
||||
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),
|
||||
});
|
||||
};
|
||||
@@ -716,7 +750,7 @@ export default class ChannelCreator extends React.PureComponent {
|
||||
};
|
||||
|
||||
render() {
|
||||
const { abandoningClaimIds, fetchingChannels, updatingChannel, channels = [], navigation } = this.props;
|
||||
const { abandoningClaimIds, balance, fetchingChannels, updatingChannel, channels = [], navigation } = this.props;
|
||||
const {
|
||||
autoStyle,
|
||||
autoStyles,
|
||||
@@ -738,6 +772,8 @@ export default class ChannelCreator extends React.PureComponent {
|
||||
uploadingImage,
|
||||
} = this.state;
|
||||
|
||||
const hasChannels = channels && channels.length > 0;
|
||||
|
||||
return (
|
||||
<View style={channelCreatorStyle.container}>
|
||||
<UriBar
|
||||
@@ -750,34 +786,34 @@ export default class ChannelCreator extends React.PureComponent {
|
||||
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 && (
|
||||
<FlatList
|
||||
extraData={this.state}
|
||||
ListHeaderComponent={
|
||||
fetchingChannels ? (
|
||||
<View style={channelCreatorStyle.listHeader}>
|
||||
<ActivityIndicator size={'small'} color={Colors.NextLbryGreen} />
|
||||
</View>
|
||||
) : null
|
||||
}
|
||||
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>
|
||||
ListFooterComponent={
|
||||
!channels || channels.length === 0 ? null : (
|
||||
<View style={channelCreatorStyle.listFooter}>
|
||||
<Button
|
||||
style={channelCreatorStyle.createChannelButton}
|
||||
text={__('Create a channel')}
|
||||
onPress={this.handleNewChannelPress}
|
||||
/>
|
||||
</View>
|
||||
)
|
||||
}
|
||||
ListFooterComponent={
|
||||
<View style={channelCreatorStyle.listFooter}>
|
||||
<Button
|
||||
style={channelCreatorStyle.createChannelButton}
|
||||
text={'Create a channel'}
|
||||
onPress={this.handleNewChannelPress}
|
||||
/>
|
||||
</View>
|
||||
}
|
||||
style={channelCreatorStyle.scrollContainer}
|
||||
contentContainerStyle={channelCreatorStyle.scrollPadding}
|
||||
initialNumToRender={10}
|
||||
@@ -819,13 +855,13 @@ export default class ChannelCreator extends React.PureComponent {
|
||||
</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}
|
||||
/>
|
||||
)}
|
||||
|
||||
{currentPhase === Constants.PHASE_CREATE && (
|
||||
<ScrollView style={channelCreatorStyle.createChannelContainer}>
|
||||
<ScrollView ref={ref => (this.scrollView = ref)} style={channelCreatorStyle.createChannelContainer}>
|
||||
<View style={channelCreatorStyle.imageSelectors}>
|
||||
<TouchableOpacity style={channelCreatorStyle.coverImageTouchArea} onPress={this.onCoverImagePress}>
|
||||
<Image
|
||||
@@ -844,7 +880,7 @@ export default class ChannelCreator extends React.PureComponent {
|
||||
{this.state.uploadingImage && (
|
||||
<View style={channelCreatorStyle.uploadProgress}>
|
||||
<ActivityIndicator size={'small'} color={Colors.NextLbryGreen} />
|
||||
<Text style={channelCreatorStyle.uploadText}>Uploading image...</Text>
|
||||
<Text style={channelCreatorStyle.uploadText}>{__('Uploading image...')}</Text>
|
||||
</View>
|
||||
)}
|
||||
</TouchableOpacity>
|
||||
@@ -858,7 +894,7 @@ export default class ChannelCreator extends React.PureComponent {
|
||||
source={{ uri: thumbnailUrl }}
|
||||
/>
|
||||
)}
|
||||
{thumbnailUrl !== null && thumbnailUrl.trim().length === 0 && newChannelName.length > 1 && (
|
||||
{(thumbnailUrl === null || thumbnailUrl.trim().length === 0) && newChannelName.length > 0 && (
|
||||
<Text style={channelIconStyle.autothumbCharacter}>
|
||||
{newChannelName.substring(0, 1).toUpperCase()}
|
||||
</Text>
|
||||
@@ -870,19 +906,20 @@ export default class ChannelCreator extends React.PureComponent {
|
||||
</TouchableOpacity>
|
||||
</View>
|
||||
</View>
|
||||
{balance < Constants.MINIMUM_TRANSACTION_BALANCE && <ChannelRewardsDriver navigation={navigation} />}
|
||||
|
||||
<View style={channelCreatorStyle.card}>
|
||||
<View style={channelCreatorStyle.textInputLayout}>
|
||||
{(this.state.titleFocused ||
|
||||
(this.state.newChannelTitle != null && this.state.newChannelTitle.trim().length > 0)) && (
|
||||
<Text style={channelCreatorStyle.textInputTitle}>Title</Text>
|
||||
<Text style={channelCreatorStyle.textInputTitle}>{__('Title')}</Text>
|
||||
)}
|
||||
<TextInput
|
||||
editable={canSave && !creatingChannel && !updatingChannel}
|
||||
style={channelCreatorStyle.inputText}
|
||||
value={this.state.newChannelTitle}
|
||||
onChangeText={this.handleNewChannelTitleChange}
|
||||
placeholder={this.state.titleFocused ? '' : 'Title'}
|
||||
placeholder={this.state.titleFocused ? '' : __('Title')}
|
||||
underlineColorAndroid={Colors.NextLbryGreen}
|
||||
onFocus={() => this.setState({ titleFocused: true })}
|
||||
onBlur={() => this.setState({ titleFocused: false })}
|
||||
@@ -892,16 +929,16 @@ export default class ChannelCreator extends React.PureComponent {
|
||||
<View style={channelCreatorStyle.channelInputLayout}>
|
||||
{(this.state.channelNameFocused ||
|
||||
(this.state.newChannelName != null && this.state.newChannelName.trim().length > 0)) && (
|
||||
<Text style={channelCreatorStyle.textInputTitle}>Channel</Text>
|
||||
<Text style={channelCreatorStyle.textInputTitle}>{__('Channel')}</Text>
|
||||
)}
|
||||
<View>
|
||||
<Text style={channelCreatorStyle.channelAt}>@</Text>
|
||||
<TextInput
|
||||
editable={canSave && !creatingChannel && !updatingChannel}
|
||||
editable={canSave && !editMode && !creatingChannel && !updatingChannel}
|
||||
style={channelCreatorStyle.channelNameInput}
|
||||
value={this.state.newChannelName}
|
||||
onChangeText={value => this.handleNewChannelNameChange(value, true)}
|
||||
placeholder={this.state.channelNameFocused ? '' : 'Channel'}
|
||||
placeholder={this.state.channelNameFocused ? '' : __('Channel')}
|
||||
underlineColorAndroid={Colors.NextLbryGreen}
|
||||
onFocus={() => this.setState({ channelNameFocused: true })}
|
||||
onBlur={() => this.setState({ channelNameFocused: false })}
|
||||
@@ -911,21 +948,35 @@ export default class ChannelCreator extends React.PureComponent {
|
||||
{newChannelNameError.length > 0 && (
|
||||
<Text style={channelCreatorStyle.inlineError}>{newChannelNameError}</Text>
|
||||
)}
|
||||
{editMode && (
|
||||
<Text style={channelCreatorStyle.helpText}>
|
||||
{__('The channel name cannot be changed while editing.')}
|
||||
</Text>
|
||||
)}
|
||||
|
||||
<View style={channelCreatorStyle.bidRow}>
|
||||
<Text style={channelCreatorStyle.label}>Deposit</Text>
|
||||
<Text style={channelCreatorStyle.label}>{__('Deposit')}</Text>
|
||||
<TextInput
|
||||
editable={canSave && !creatingChannel && !updatingChannel}
|
||||
style={channelCreatorStyle.bidAmountInput}
|
||||
value={String(newChannelBid)}
|
||||
onChangeText={this.handleNewChannelBidChange}
|
||||
onFocus={() => this.setState({ creditsInputFocused: true })}
|
||||
onBlur={() => this.setState({ creditsInputFocused: false })}
|
||||
placeholder={'0.00'}
|
||||
keyboardType={'number-pad'}
|
||||
underlineColorAndroid={Colors.NextLbryGreen}
|
||||
/>
|
||||
<Text style={channelCreatorStyle.currency}>LBC</Text>
|
||||
<View style={channelCreatorStyle.balance}>
|
||||
{this.state.creditsInputFocused && <Icon name="coins" size={12} />}
|
||||
{this.state.creditsInputFocused && (
|
||||
<Text style={channelCreatorStyle.balanceText}>{formatCredits(parseFloat(balance), 1, true)}</Text>
|
||||
)}
|
||||
</View>
|
||||
</View>
|
||||
<Text style={channelCreatorStyle.helpText}>
|
||||
This LBC remains yours. It is a deposit to reserve the name and can be undone at any time.
|
||||
{__('This LBC remains yours. It is a deposit to reserve the name and can be undone at any time.')}
|
||||
</Text>
|
||||
</View>
|
||||
|
||||
@@ -934,7 +985,7 @@ export default class ChannelCreator extends React.PureComponent {
|
||||
<View style={channelCreatorStyle.textInputLayout}>
|
||||
{(this.state.descriptionFocused ||
|
||||
(this.state.description != null && this.state.description.trim().length > 0)) && (
|
||||
<Text style={channelCreatorStyle.textInputTitle}>Description</Text>
|
||||
<Text style={channelCreatorStyle.textInputTitle}>{__('Description')}</Text>
|
||||
)}
|
||||
<TextInput
|
||||
editable={canSave && !creatingChannel && !updatingChannel}
|
||||
@@ -942,7 +993,7 @@ export default class ChannelCreator extends React.PureComponent {
|
||||
multiline
|
||||
value={this.state.description}
|
||||
onChangeText={this.handleDescriptionChange}
|
||||
placeholder={this.state.descriptionFocused ? '' : 'Description'}
|
||||
placeholder={this.state.descriptionFocused ? '' : __('Description')}
|
||||
underlineColorAndroid={Colors.NextLbryGreen}
|
||||
onFocus={() => this.setState({ descriptionFocused: true })}
|
||||
onBlur={() => this.setState({ descriptionFocused: false })}
|
||||
@@ -952,14 +1003,14 @@ export default class ChannelCreator extends React.PureComponent {
|
||||
<View style={channelCreatorStyle.textInputLayout}>
|
||||
{(this.state.websiteFocused ||
|
||||
(this.state.website != null && this.state.website.trim().length > 0)) && (
|
||||
<Text style={channelCreatorStyle.textInputTitle}>Website</Text>
|
||||
<Text style={channelCreatorStyle.textInputTitle}>{__('Website')}</Text>
|
||||
)}
|
||||
<TextInput
|
||||
editable={canSave && !creatingChannel && !updatingChannel}
|
||||
style={channelCreatorStyle.inputText}
|
||||
value={this.state.website}
|
||||
onChangeText={this.handleWebsiteChange}
|
||||
placeholder={this.state.websiteFocused ? '' : 'Website'}
|
||||
placeholder={this.state.websiteFocused ? '' : __('Website')}
|
||||
underlineColorAndroid={Colors.NextLbryGreen}
|
||||
onFocus={() => this.setState({ websiteFocused: true })}
|
||||
onBlur={() => this.setState({ websiteFocused: false })}
|
||||
@@ -968,14 +1019,14 @@ export default class ChannelCreator extends React.PureComponent {
|
||||
|
||||
<View style={channelCreatorStyle.textInputLayout}>
|
||||
{(this.state.emailFocused || (this.state.email != null && this.state.email.trim().length > 0)) && (
|
||||
<Text style={channelCreatorStyle.textInputTitle}>Email</Text>
|
||||
<Text style={channelCreatorStyle.textInputTitle}>{__('Email')}</Text>
|
||||
)}
|
||||
<TextInput
|
||||
editable={canSave && !creatingChannel && !updatingChannel}
|
||||
style={channelCreatorStyle.inputText}
|
||||
value={this.state.email}
|
||||
onChangeText={this.handleEmailChange}
|
||||
placeholder={this.state.emailFocused ? '' : 'Email'}
|
||||
placeholder={this.state.emailFocused ? '' : __('Email')}
|
||||
underlineColorAndroid={Colors.NextLbryGreen}
|
||||
onFocus={() => this.setState({ emailFocused: true })}
|
||||
onBlur={() => this.setState({ emailFocused: false })}
|
||||
@@ -986,7 +1037,7 @@ export default class ChannelCreator extends React.PureComponent {
|
||||
|
||||
{this.state.showOptionalFields && (
|
||||
<View style={channelCreatorStyle.card}>
|
||||
<Text style={channelCreatorStyle.cardTitle}>Tags</Text>
|
||||
<Text style={channelCreatorStyle.cardTitle}>{__('Tags')}</Text>
|
||||
<View style={channelCreatorStyle.tagList}>
|
||||
{this.state.tags &&
|
||||
this.state.tags.map(tag => (
|
||||
@@ -1010,7 +1061,7 @@ export default class ChannelCreator extends React.PureComponent {
|
||||
|
||||
<View style={channelCreatorStyle.toggleContainer}>
|
||||
<Link
|
||||
text={this.state.showOptionalFields ? 'Hide optional fields' : 'Show optional fields'}
|
||||
text={this.state.showOptionalFields ? __('Hide optional fields') : __('Show optional fields')}
|
||||
onPress={this.handleModePressed}
|
||||
style={channelCreatorStyle.modeLink}
|
||||
/>
|
||||
@@ -1022,11 +1073,11 @@ export default class ChannelCreator extends React.PureComponent {
|
||||
)}
|
||||
{!creatingChannel && !updatingChannel && (
|
||||
<View style={channelCreatorStyle.buttons}>
|
||||
<Link style={channelCreatorStyle.cancelLink} text="Cancel" onPress={this.handleCreateCancel} />
|
||||
<Link style={channelCreatorStyle.cancelLink} text={__('Cancel')} onPress={this.handleCreateCancel} />
|
||||
<Button
|
||||
style={channelCreatorStyle.createButton}
|
||||
disabled={!canSave || uploadingImage || !newChannelName || newChannelName.trim().length === 0}
|
||||
text={editMode ? 'Update' : 'Create'}
|
||||
disabled={!canSave || uploadingImage}
|
||||
text={editMode ? __('Update') : __('Create')}
|
||||
onPress={this.handleCreateChannelClick}
|
||||
/>
|
||||
</View>
|
||||
|
||||
@@ -11,6 +11,7 @@ import {
|
||||
selectSubscriptionClaims,
|
||||
selectUnreadSubscriptions,
|
||||
} from 'lbryinc';
|
||||
import { doPushDrawerStack } from 'redux/actions/drawer';
|
||||
import { doSetClientSetting, doSetSortByItem, doSetTimeItem } from 'redux/actions/settings';
|
||||
import { makeSelectClientSetting, selectSortByItem, selectTimeItem } from 'redux/selectors/settings';
|
||||
import Constants from 'constants'; // eslint-disable-line node/no-deprecated-api
|
||||
@@ -37,6 +38,7 @@ const perform = dispatch => ({
|
||||
fetchRewardedContent: () => dispatch(doFetchRewardedContent()),
|
||||
fetchSubscriptions: () => dispatch(doFetchMySubscriptions()),
|
||||
fileList: () => dispatch(doFileList()),
|
||||
pushDrawerStack: () => dispatch(doPushDrawerStack(Constants.DRAWER_ROUTE_DISCOVER)),
|
||||
removeUnreadSubscriptions: () => dispatch(doRemoveUnreadSubscriptions()),
|
||||
setClientSetting: (key, value) => dispatch(doSetClientSetting(key, value)),
|
||||
setSortByItem: item => dispatch(doSetSortByItem(item)),
|
||||
|
||||
+37
-71
@@ -11,10 +11,9 @@ import {
|
||||
View,
|
||||
} from 'react-native';
|
||||
import { DEFAULT_FOLLOWED_TAGS, Lbry, normalizeURI, parseURI } from 'lbry-redux';
|
||||
import { __, formatTagTitle, getOrderBy } from 'utils/helper';
|
||||
import { formatTagTitle, getOrderBy } from 'utils/helper';
|
||||
import AsyncStorage from '@react-native-community/async-storage';
|
||||
import moment from 'moment';
|
||||
import CategoryList from 'component/categoryList';
|
||||
import ClaimList from 'component/claimList';
|
||||
import Constants from 'constants'; // eslint-disable-line node/no-deprecated-api
|
||||
import Colors from 'styles/colors';
|
||||
@@ -38,8 +37,6 @@ class DiscoverPage extends React.PureComponent {
|
||||
};
|
||||
|
||||
componentDidMount() {
|
||||
NativeModules.Firebase.setCurrentScreen('Your tags');
|
||||
|
||||
// Track the total time taken if this is the first launch
|
||||
AsyncStorage.getItem('firstLaunchTime').then(startTime => {
|
||||
if (startTime !== null && !isNaN(parseInt(startTime, 10))) {
|
||||
@@ -63,17 +60,37 @@ class DiscoverPage extends React.PureComponent {
|
||||
}
|
||||
});
|
||||
|
||||
const { sortByItem, fetchRewardedContent, fetchSubscriptions, fileList, followedTags } = this.props;
|
||||
const { sortByItem, fetchRewardedContent, fileList, followedTags } = this.props;
|
||||
|
||||
this.buildTagCollection(followedTags);
|
||||
fetchRewardedContent();
|
||||
fetchSubscriptions();
|
||||
fileList();
|
||||
|
||||
this.handleSortByItemSelected(sortByItem);
|
||||
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 } = this.props;
|
||||
// pushDrawerStack();
|
||||
NativeModules.Firebase.setCurrentScreen('Your tags');
|
||||
};
|
||||
|
||||
handleSortByItemSelected = item => {
|
||||
const { setSortByItem } = this.props;
|
||||
setSortByItem(item);
|
||||
@@ -104,59 +121,6 @@ class DiscoverPage extends React.PureComponent {
|
||||
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 = () => {
|
||||
const { ratingReminderDisabled, ratingReminderLastShown, setClientSetting } = this.props;
|
||||
|
||||
@@ -169,16 +133,18 @@ class DiscoverPage extends React.PureComponent {
|
||||
if (!isNaN(lastShownTime) && !isNaN(lastShownCount)) {
|
||||
if (now > lastShownTime + Constants.RATING_REMINDER_INTERVAL * lastShownCount) {
|
||||
Alert.alert(
|
||||
'Enjoying LBRY?',
|
||||
'Are you enjoying your experience with the LBRY app? You can leave a review for us on the Play Store.',
|
||||
__('Enjoying LBRY?'),
|
||||
__(
|
||||
'Are you enjoying your experience with the LBRY app? You can leave a review for us on the Play Store.'
|
||||
),
|
||||
[
|
||||
{
|
||||
text: 'Never ask again',
|
||||
text: __('Never ask again'),
|
||||
onPress: () => setClientSetting(Constants.SETTING_RATING_REMINDER_DISABLED, 'true'),
|
||||
},
|
||||
{ text: 'Maybe later', onPress: () => this.updateRatingReminderShown(lastShownCount) },
|
||||
{ text: __('Maybe later'), onPress: () => this.updateRatingReminderShown(lastShownCount) },
|
||||
{
|
||||
text: 'Rate app',
|
||||
text: __('Rate app'),
|
||||
onPress: () => {
|
||||
setClientSetting(Constants.SETTING_RATING_REMINDER_DISABLED, 'true');
|
||||
Linking.openURL(Constants.PLAY_STORE_URL);
|
||||
@@ -205,7 +171,7 @@ class DiscoverPage extends React.PureComponent {
|
||||
|
||||
buildSections = () => {
|
||||
return this.state.tagCollection.map(tags => ({
|
||||
title: tags.length === 1 ? tags[0] : 'All tags you follow',
|
||||
title: tags.length === 1 ? tags[0] : __('All tags you follow'),
|
||||
data: [tags],
|
||||
}));
|
||||
};
|
||||
@@ -229,7 +195,7 @@ class DiscoverPage extends React.PureComponent {
|
||||
|
||||
handleTagPress = name => {
|
||||
const { navigation, sortByItem } = this.props;
|
||||
if (name.toLowerCase() !== 'all tags you follow') {
|
||||
if (name.toLowerCase() !== __('all tags you follow')) {
|
||||
navigation.navigate({
|
||||
routeName: Constants.DRAWER_ROUTE_TAG,
|
||||
key: `tagPage`,
|
||||
@@ -248,18 +214,18 @@ class DiscoverPage extends React.PureComponent {
|
||||
return (
|
||||
<View style={discoverStyle.listHeader}>
|
||||
<View style={discoverStyle.titleRow}>
|
||||
<Text style={discoverStyle.pageTitle}>Your tags</Text>
|
||||
<Text style={discoverStyle.pageTitle}>{__('Your Tags')}</Text>
|
||||
</View>
|
||||
<View style={discoverStyle.pickerRow}>
|
||||
<View style={discoverStyle.leftPickerRow}>
|
||||
<TouchableOpacity style={discoverStyle.tagSortBy} onPress={() => this.setState({ showSortPicker: true })}>
|
||||
<Text style={discoverStyle.tagSortText}>{sortByItem.label.split(' ')[0]}</Text>
|
||||
<Text style={discoverStyle.tagSortText}>{__(sortByItem.label.split(' ')[0])}</Text>
|
||||
<Icon style={discoverStyle.tagSortIcon} name={'sort-down'} size={14} />
|
||||
</TouchableOpacity>
|
||||
|
||||
{Constants.SORT_BY_TOP === sortByItem.name && (
|
||||
<TouchableOpacity style={discoverStyle.tagTime} onPress={() => this.setState({ showTimePicker: true })}>
|
||||
<Text style={discoverStyle.tagSortText}>{timeItem.label}</Text>
|
||||
<Text style={discoverStyle.tagSortText}>{__(timeItem.label)}</Text>
|
||||
<Icon style={discoverStyle.tagSortIcon} name={'sort-down'} size={14} />
|
||||
</TouchableOpacity>
|
||||
)}
|
||||
@@ -267,7 +233,7 @@ class DiscoverPage extends React.PureComponent {
|
||||
|
||||
<Link
|
||||
style={discoverStyle.customizeLink}
|
||||
text={'Customize'}
|
||||
text={__('Customize')}
|
||||
onPress={() => this.setState({ showModalTagSelector: true })}
|
||||
/>
|
||||
</View>
|
||||
@@ -283,7 +249,7 @@ class DiscoverPage extends React.PureComponent {
|
||||
|
||||
return (
|
||||
<View style={discoverStyle.footer}>
|
||||
<Text style={discoverStyle.footerTitle}>More tags you follow</Text>
|
||||
<Text style={discoverStyle.footerTitle}>{__('More tags you follow')}</Text>
|
||||
<View style={discoverStyle.footerTags}>
|
||||
{remainingTags.map(tag => (
|
||||
<Text
|
||||
|
||||
@@ -11,10 +11,11 @@ import {
|
||||
View,
|
||||
ScrollView,
|
||||
} from 'react-native';
|
||||
import { __, navigateToUri, uriFromFileInfo } from 'utils/helper';
|
||||
import { navigateToUri, uriFromFileInfo } from 'utils/helper';
|
||||
import Colors from 'styles/colors';
|
||||
import Constants from 'constants'; // eslint-disable-line node/no-deprecated-api
|
||||
import PageHeader from 'component/pageHeader';
|
||||
import EmptyStateView from 'component/emptyStateView';
|
||||
import FileListItem from 'component/fileListItem';
|
||||
import FloatingWalletBalance from 'component/floatingWalletBalance';
|
||||
import StorageStatsCard from 'component/storageStatsCard';
|
||||
@@ -154,6 +155,10 @@ class DownloadsPage extends React.PureComponent {
|
||||
onDeleteActionPressed={this.onDeleteActionPressed}
|
||||
/>
|
||||
|
||||
{!fetching && !hasDownloads && (
|
||||
<EmptyStateView message={__('You do not have any\ndownloaded content on this device.')} />
|
||||
)}
|
||||
|
||||
<View style={downloadsStyle.subContainer}>
|
||||
{hasDownloads && <StorageStatsCard fileInfos={this.getFilteredFileInfos()} />}
|
||||
{fetching && (
|
||||
@@ -161,11 +166,7 @@ class DownloadsPage extends React.PureComponent {
|
||||
<ActivityIndicator size="large" color={Colors.NextLbryGreen} style={downloadsStyle.loading} />
|
||||
</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 && (
|
||||
<FlatList
|
||||
extraData={this.state}
|
||||
|
||||
+32
-15
@@ -1,5 +1,6 @@
|
||||
import { connect } from 'react-redux';
|
||||
import {
|
||||
doAbandonClaim,
|
||||
doFetchFileInfo,
|
||||
doFetchChannelListMine,
|
||||
doFetchClaimListMine,
|
||||
@@ -7,6 +8,7 @@ import {
|
||||
doPurchaseUri,
|
||||
doDeletePurchasedUri,
|
||||
doResolveUri,
|
||||
doSearch,
|
||||
doSendTip,
|
||||
doToast,
|
||||
makeSelectIsUriResolving,
|
||||
@@ -16,6 +18,7 @@ import {
|
||||
makeSelectContentPositionForUri,
|
||||
makeSelectContentTypeForUri,
|
||||
makeSelectMetadataForUri,
|
||||
makeSelectRecommendedContentForUri,
|
||||
makeSelectStreamingUrlForUri,
|
||||
makeSelectThumbnailForUri,
|
||||
makeSelectTitleForUri,
|
||||
@@ -25,10 +28,14 @@ import {
|
||||
selectPurchasedUris,
|
||||
selectFailedPurchaseUris,
|
||||
selectPurchaseUriErrorMessage,
|
||||
selectIsSearching,
|
||||
} from 'lbry-redux';
|
||||
import {
|
||||
doClaimEligiblePurchaseRewards,
|
||||
doFetchCostInfoForUri,
|
||||
doFetchViewCount,
|
||||
makeSelectCostInfoForUri,
|
||||
makeSelectViewCountForUri,
|
||||
selectRewardContentClaimIds,
|
||||
selectBlackListedOutpoints,
|
||||
} from 'lbryinc';
|
||||
@@ -39,39 +46,45 @@ import {
|
||||
doDeleteFile,
|
||||
doStopDownloadingFile,
|
||||
} from 'redux/actions/file';
|
||||
import { doPopDrawerStack, doSetPlayerVisible } from 'redux/actions/drawer';
|
||||
import { doPushDrawerStack, doPopDrawerStack, doSetPlayerVisible } from 'redux/actions/drawer';
|
||||
import { doToggleFullscreenMode } from 'redux/actions/settings';
|
||||
import { selectDrawerStack } from 'redux/selectors/drawer';
|
||||
import FilePage from './view';
|
||||
|
||||
const select = (state, props) => {
|
||||
const selectProps = { uri: props.navigation.state.params.uri };
|
||||
const { uri, fullUri } = props.navigation.state.params;
|
||||
const contentUri = fullUri || uri;
|
||||
const selectProps = { uri: contentUri };
|
||||
return {
|
||||
balance: selectBalance(state),
|
||||
blackListedOutpoints: selectBlackListedOutpoints(state),
|
||||
channels: selectMyChannelClaims(state),
|
||||
claim: makeSelectClaimForUri(selectProps.uri)(state),
|
||||
claim: makeSelectClaimForUri(contentUri)(state),
|
||||
drawerStack: selectDrawerStack(state),
|
||||
isResolvingUri: makeSelectIsUriResolving(selectProps.uri)(state),
|
||||
contentType: makeSelectContentTypeForUri(selectProps.uri)(state),
|
||||
costInfo: makeSelectCostInfoForUri(selectProps.uri)(state),
|
||||
metadata: makeSelectMetadataForUri(selectProps.uri)(state),
|
||||
// obscureNsfw: !selectShowNsfw(state),
|
||||
// tab: makeSelectCurrentParam('tab')(state),
|
||||
fileInfo: makeSelectFileInfoForUri(selectProps.uri)(state),
|
||||
isResolvingUri: makeSelectIsUriResolving(contentUri)(state),
|
||||
contentType: makeSelectContentTypeForUri(contentUri)(state),
|
||||
costInfo: makeSelectCostInfoForUri(contentUri)(state),
|
||||
metadata: makeSelectMetadataForUri(contentUri)(state),
|
||||
fileInfo: makeSelectFileInfoForUri(contentUri)(state),
|
||||
rewardedContentClaimIds: selectRewardContentClaimIds(state, selectProps),
|
||||
channelUri: makeSelectChannelForClaimUri(selectProps.uri, true)(state),
|
||||
position: makeSelectContentPositionForUri(selectProps.uri)(state),
|
||||
channelUri: makeSelectChannelForClaimUri(contentUri, true)(state),
|
||||
position: makeSelectContentPositionForUri(contentUri)(state),
|
||||
purchasedUris: selectPurchasedUris(state),
|
||||
failedPurchaseUris: selectFailedPurchaseUris(state),
|
||||
myClaimUris: selectMyClaimUrisWithoutChannels(state),
|
||||
purchaseUriErrorMessage: selectPurchaseUriErrorMessage(state),
|
||||
streamingUrl: makeSelectStreamingUrlForUri(selectProps.uri)(state),
|
||||
thumbnail: makeSelectThumbnailForUri(selectProps.uri)(state),
|
||||
title: makeSelectTitleForUri(selectProps.uri)(state),
|
||||
streamingUrl: makeSelectStreamingUrlForUri(contentUri)(state),
|
||||
thumbnail: makeSelectThumbnailForUri(contentUri)(state),
|
||||
title: makeSelectTitleForUri(contentUri)(state),
|
||||
recommendedContent: makeSelectRecommendedContentForUri(contentUri)(state),
|
||||
isSearchingRecommendContent: selectIsSearching(state),
|
||||
viewCount: makeSelectViewCountForUri(contentUri)(state),
|
||||
};
|
||||
};
|
||||
|
||||
const perform = dispatch => ({
|
||||
abandonClaim: (txid, nout) => dispatch(doAbandonClaim(txid, nout)),
|
||||
claimEligibleRewards: () => dispatch(doClaimEligiblePurchaseRewards()),
|
||||
deleteFile: (fileInfo, deleteFromDevice, abandonClaim) => {
|
||||
dispatch(doDeleteFile(fileInfo, deleteFromDevice, abandonClaim));
|
||||
},
|
||||
@@ -79,12 +92,15 @@ const perform = dispatch => ({
|
||||
fetchCostInfo: uri => dispatch(doFetchCostInfoForUri(uri)),
|
||||
fetchMyClaims: () => dispatch(doFetchClaimListMine()),
|
||||
fetchChannelListMine: () => dispatch(doFetchChannelListMine()),
|
||||
fetchViewCount: claimId => dispatch(doFetchViewCount(claimId)),
|
||||
fileGet: (uri, saveFile) => dispatch(doFileGet(uri, saveFile)),
|
||||
notify: data => dispatch(doToast(data)),
|
||||
popDrawerStack: () => dispatch(doPopDrawerStack()),
|
||||
pushDrawerStack: (routeName, params) => dispatch(doPushDrawerStack(routeName, params)),
|
||||
purchaseUri: (uri, costInfo, saveFile) => dispatch(doPurchaseUri(uri, costInfo, saveFile)),
|
||||
deletePurchasedUri: uri => dispatch(doDeletePurchasedUri(uri)),
|
||||
resolveUri: uri => dispatch(doResolveUri(uri)),
|
||||
searchRecommended: query => dispatch(doSearch(query, 20, undefined, true)),
|
||||
sendTip: (amount, claimId, isSupport, successCallback, errorCallback) =>
|
||||
dispatch(doSendTip(amount, claimId, isSupport, successCallback, errorCallback)),
|
||||
setPlayerVisible: () => dispatch(doSetPlayerVisible(true)),
|
||||
@@ -92,6 +108,7 @@ const perform = dispatch => ({
|
||||
startDownload: (uri, outpoint, fileInfo) => dispatch(doStartDownload(uri, outpoint, fileInfo)),
|
||||
updateDownload: (uri, outpoint, fileInfo, progress) => dispatch(doUpdateDownload(uri, outpoint, fileInfo, progress)),
|
||||
completeDownload: (uri, outpoint, fileInfo) => dispatch(doCompleteDownload(uri, outpoint, fileInfo)),
|
||||
toggleFullscreenMode: mode => dispatch(doToggleFullscreenMode(mode)),
|
||||
});
|
||||
|
||||
export default connect(
|
||||
|
||||
+356
-136
@@ -1,11 +1,13 @@
|
||||
import React from 'react';
|
||||
import { Lbry, normalizeURI, parseURI } from 'lbry-redux';
|
||||
import { Lbry, formatCredits, normalizeURI, parseURI } from 'lbry-redux';
|
||||
import { Lbryio } from 'lbryinc';
|
||||
import {
|
||||
ActivityIndicator,
|
||||
Alert,
|
||||
DeviceEventEmitter,
|
||||
Dimensions,
|
||||
Image,
|
||||
Linking,
|
||||
NativeModules,
|
||||
ScrollView,
|
||||
StatusBar,
|
||||
@@ -18,10 +20,11 @@ import {
|
||||
WebView,
|
||||
} from 'react-native';
|
||||
import { NavigationEvents } from 'react-navigation';
|
||||
import { navigateBack, navigateToUri } from 'utils/helper';
|
||||
import { navigateBack, navigateToUri, formatLbryUrlForWeb } from 'utils/helper';
|
||||
import Icon from 'react-native-vector-icons/FontAwesome5';
|
||||
import ImageViewer from 'react-native-image-zoom-viewer';
|
||||
import Button from 'component/button';
|
||||
import EmptyStateView from 'component/emptyStateView';
|
||||
import Tag from 'component/tag';
|
||||
import ChannelPage from 'page/channel';
|
||||
import Colors from 'styles/colors';
|
||||
@@ -41,6 +44,7 @@ import Video from 'react-native-video';
|
||||
import FileRewardsDriver from 'component/fileRewardsDriver';
|
||||
import filePageStyle from 'styles/filePage';
|
||||
import uriBarStyle from 'styles/uriBar';
|
||||
import _ from 'lodash';
|
||||
|
||||
class FilePage extends React.PureComponent {
|
||||
static navigationOptions = {
|
||||
@@ -58,10 +62,14 @@ class FilePage extends React.PureComponent {
|
||||
constructor(props) {
|
||||
super(props);
|
||||
this.state = {
|
||||
autoPlayMedia: false,
|
||||
attemptAutoGet: false,
|
||||
autoOpened: false,
|
||||
autoDownloadStarted: false,
|
||||
autoPlayMedia: false,
|
||||
creditsInputFocused: false,
|
||||
downloadButtonShown: false,
|
||||
downloadPressed: false,
|
||||
didSearchRecommended: false,
|
||||
fileViewLogged: false,
|
||||
fullscreenMode: false,
|
||||
fileGetStarted: false,
|
||||
@@ -82,6 +90,7 @@ class FilePage extends React.PureComponent {
|
||||
uriVars: null,
|
||||
stopDownloadConfirmed: false,
|
||||
streamingMode: false,
|
||||
viewCountFetched: false,
|
||||
};
|
||||
}
|
||||
|
||||
@@ -100,7 +109,7 @@ class FilePage extends React.PureComponent {
|
||||
DeviceEventEmitter.addListener('onDownloadUpdated', this.handleDownloadUpdated);
|
||||
DeviceEventEmitter.addListener('onDownloadCompleted', this.handleDownloadCompleted);
|
||||
|
||||
const { fetchChannelListMine, fileInfo, isResolvingUri, resolveUri, navigation } = this.props;
|
||||
const { fetchMyClaims, fileInfo, isResolvingUri, resolveUri, navigation } = this.props;
|
||||
const { uri, uriVars } = navigation.state.params;
|
||||
this.setState({ uri, uriVars });
|
||||
|
||||
@@ -108,7 +117,8 @@ class FilePage extends React.PureComponent {
|
||||
|
||||
this.fetchFileInfo(this.props);
|
||||
this.fetchCostInfo(this.props);
|
||||
fetchChannelListMine();
|
||||
|
||||
fetchMyClaims();
|
||||
|
||||
if (NativeModules.Firebase) {
|
||||
NativeModules.Firebase.track('open_file_page', { uri: uri });
|
||||
@@ -122,15 +132,28 @@ class FilePage extends React.PureComponent {
|
||||
this.onComponentFocused();
|
||||
}
|
||||
|
||||
difference = (object, base) => {
|
||||
function changes(object, base) {
|
||||
return _.transform(object, function(result, value, key) {
|
||||
if (!_.isEqual(value, base[key])) {
|
||||
result[key] = _.isObject(value) && _.isObject(base[key]) ? changes(value, base[key]) : value;
|
||||
}
|
||||
});
|
||||
}
|
||||
return changes(object, base);
|
||||
};
|
||||
|
||||
componentWillReceiveProps(nextProps) {
|
||||
const {
|
||||
claim,
|
||||
currentRoute,
|
||||
failedPurchaseUris: prevFailedPurchaseUris,
|
||||
fetchViewCount,
|
||||
purchasedUris: prevPurchasedUris,
|
||||
navigation,
|
||||
contentType,
|
||||
notify,
|
||||
drawerStack: prevDrawerStack,
|
||||
} = this.props;
|
||||
const { uri } = navigation.state.params;
|
||||
const {
|
||||
@@ -140,6 +163,7 @@ class FilePage extends React.PureComponent {
|
||||
purchasedUris,
|
||||
purchaseUriErrorMessage,
|
||||
streamingUrl,
|
||||
drawerStack,
|
||||
} = nextProps;
|
||||
|
||||
if (Constants.ROUTE_FILE === currentRoute && currentRoute !== prevRoute) {
|
||||
@@ -179,15 +203,45 @@ class FilePage extends React.PureComponent {
|
||||
this.setState({ streamingMode: true, currentStreamUrl: fileInfo.streaming_url });
|
||||
}
|
||||
}
|
||||
|
||||
if (
|
||||
prevDrawerStack[prevDrawerStack.length - 1].route === Constants.DRAWER_ROUTE_FILE_VIEW &&
|
||||
prevDrawerStack.length !== drawerStack.length
|
||||
) {
|
||||
this.setState({
|
||||
downloadPressed: false,
|
||||
showImageViewer: false,
|
||||
showWebView: false,
|
||||
});
|
||||
}
|
||||
|
||||
if (claim && !this.state.viewCountFetched) {
|
||||
this.setState({ viewCountFetched: true }, () => fetchViewCount(claim.claim_id));
|
||||
}
|
||||
}
|
||||
|
||||
componentDidUpdate(prevProps) {
|
||||
const { claim, contentType, fileInfo, isResolvingUri, resolveUri, navigation } = this.props;
|
||||
const {
|
||||
claim,
|
||||
contentType,
|
||||
costInfo,
|
||||
fileInfo,
|
||||
isResolvingUri,
|
||||
resolveUri,
|
||||
navigation,
|
||||
purchaseUri,
|
||||
searchRecommended,
|
||||
title,
|
||||
} = this.props;
|
||||
const { uri } = this.state;
|
||||
if (!isResolvingUri && claim === undefined && uri) {
|
||||
resolveUri(uri);
|
||||
}
|
||||
|
||||
if (title && !this.state.didSearchRecommended) {
|
||||
this.setState({ didSearchRecommended: true }, () => searchRecommended(title));
|
||||
}
|
||||
|
||||
// Returned to the page. If mediaLoaded, and currentMediaInfo is different, update
|
||||
if (this.state.mediaLoaded && window.currentMediaInfo && window.currentMediaInfo.uri !== this.state.uri) {
|
||||
const { metadata } = this.props;
|
||||
@@ -197,6 +251,21 @@ class FilePage extends React.PureComponent {
|
||||
uri: this.state.uri,
|
||||
};
|
||||
}
|
||||
|
||||
// attempt to retrieve images and html/text automatically once the claim is loaded, and it's free
|
||||
const mediaType = Lbry.getMediaType(contentType);
|
||||
const isViewable = mediaType === 'image' || mediaType === 'text';
|
||||
if (claim && costInfo && costInfo.cost === 0 && !this.state.autoGetAttempted && isViewable) {
|
||||
this.setState(
|
||||
{
|
||||
autoGetAttempted: true,
|
||||
downloadPressed: true,
|
||||
autoPlayMedia: true,
|
||||
stopDownloadConfirmed: false,
|
||||
},
|
||||
() => purchaseUri(claim.permanent_url, costInfo, true)
|
||||
);
|
||||
}
|
||||
}
|
||||
|
||||
fetchFileInfo(props) {
|
||||
@@ -211,25 +280,25 @@ class FilePage extends React.PureComponent {
|
||||
}
|
||||
}
|
||||
|
||||
handleFullscreenToggle = mode => {
|
||||
this.setState({ fullscreenMode: mode });
|
||||
StatusBar.setHidden(mode);
|
||||
if (NativeModules.ScreenOrientation) {
|
||||
if (mode) {
|
||||
// fullscreen, so change orientation to landscape mode
|
||||
NativeModules.ScreenOrientation.lockOrientationLandscape();
|
||||
if (NativeModules.UtilityModule) {
|
||||
// hide the navigation bar (on devices that use have soft navigation bar)
|
||||
NativeModules.UtilityModule.hideNavigationBar();
|
||||
}
|
||||
} else {
|
||||
// Switch back to portrait mode when the media is not fullscreen
|
||||
NativeModules.ScreenOrientation.lockOrientationPortrait();
|
||||
if (NativeModules.UtilityModule) {
|
||||
// hide the navigation bar (on devices that use have soft navigation bar)
|
||||
NativeModules.UtilityModule.showNavigationBar();
|
||||
}
|
||||
}
|
||||
handleFullscreenToggle = isFullscreen => {
|
||||
const { toggleFullscreenMode } = this.props;
|
||||
this.setState({ fullscreenMode: isFullscreen });
|
||||
toggleFullscreenMode(isFullscreen);
|
||||
|
||||
StatusBar.setHidden(isFullscreen);
|
||||
|
||||
if (isFullscreen) {
|
||||
// fullscreen, so change orientation to landscape mode
|
||||
NativeModules.ScreenOrientation.lockOrientationLandscape();
|
||||
|
||||
// hide the navigation bar (on devices that have the soft navigation bar)
|
||||
NativeModules.UtilityModule.hideNavigationBar();
|
||||
} else {
|
||||
// Switch back to portrait mode when the media is not fullscreen
|
||||
NativeModules.ScreenOrientation.lockOrientationPortrait();
|
||||
|
||||
// hide the navigation bar (on devices that have the soft navigation bar)
|
||||
NativeModules.UtilityModule.showNavigationBar();
|
||||
}
|
||||
};
|
||||
|
||||
@@ -239,7 +308,7 @@ class FilePage extends React.PureComponent {
|
||||
};
|
||||
|
||||
onDeletePressed = () => {
|
||||
const { claim, deleteFile, deletePurchasedUri, fileInfo, navigation } = this.props;
|
||||
const { abandonClaim, claim, deleteFile, deletePurchasedUri, myClaimUris, fileInfo, navigation } = this.props;
|
||||
|
||||
Alert.alert(
|
||||
'Delete file',
|
||||
@@ -261,6 +330,16 @@ class FilePage extends React.PureComponent {
|
||||
mediaLoaded: false,
|
||||
stopDownloadConfirmed: false,
|
||||
});
|
||||
|
||||
if (claim) {
|
||||
const fullUri = normalizeURI(`${claim.name}#${claim.claim_id}`);
|
||||
const ownedClaim = myClaimUris.includes(fullUri);
|
||||
if (ownedClaim) {
|
||||
const { txid, nout } = claim;
|
||||
abandonClaim(txid, nout);
|
||||
navigation.navigate({ routeName: Constants.DRAWER_ROUTE_PUBLISHES });
|
||||
}
|
||||
}
|
||||
},
|
||||
},
|
||||
],
|
||||
@@ -478,6 +557,7 @@ class FilePage extends React.PureComponent {
|
||||
return;
|
||||
}
|
||||
|
||||
const { claimEligibleRewards } = this.props;
|
||||
const { nout, claim_id: claimId, txid } = claim;
|
||||
const outpoint = `${txid}:${nout}`;
|
||||
const params = {
|
||||
@@ -489,10 +569,21 @@ class FilePage extends React.PureComponent {
|
||||
params.time_to_start = timeToStart;
|
||||
}
|
||||
|
||||
Lbryio.call('file', 'view', params).catch(() => {});
|
||||
Lbryio.call('file', 'view', params)
|
||||
.then(() => claimEligibleRewards())
|
||||
.catch(() => {});
|
||||
this.setState({ fileViewLogged: true });
|
||||
};
|
||||
|
||||
handleSharePress = () => {
|
||||
const { claim, notify } = 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);
|
||||
}
|
||||
};
|
||||
|
||||
handleSendTip = () => {
|
||||
const { claim, balance, navigation, notify, sendTip } = this.props;
|
||||
const { uri } = navigation.state.params;
|
||||
@@ -540,6 +631,18 @@ class FilePage extends React.PureComponent {
|
||||
setPlayerVisible();
|
||||
};
|
||||
|
||||
onDownloadPressed = () => {
|
||||
const { claim, costInfo, purchaseUri } = this.props;
|
||||
this.setState(
|
||||
{
|
||||
downloadPressed: true,
|
||||
autoPlayMedia: false,
|
||||
stopDownloadConfirmed: false,
|
||||
},
|
||||
() => purchaseUri(claim.permanent_url, costInfo, true)
|
||||
);
|
||||
};
|
||||
|
||||
onBackButtonPressed = () => {
|
||||
const { navigation, drawerStack, popDrawerStack } = this.props;
|
||||
navigateBack(navigation, drawerStack, popDrawerStack);
|
||||
@@ -564,6 +667,50 @@ class FilePage extends React.PureComponent {
|
||||
}
|
||||
};
|
||||
|
||||
openFile = (localFileUri, mediaType) => {
|
||||
const { pushDrawerStack } = this.props;
|
||||
const isWebViewable = mediaType === 'text';
|
||||
|
||||
if (mediaType === 'image') {
|
||||
// use image viewer
|
||||
if (!this.state.showImageViewer) {
|
||||
this.setState(
|
||||
{
|
||||
imageUrls: [
|
||||
{
|
||||
url: localFileUri,
|
||||
},
|
||||
],
|
||||
showImageViewer: true,
|
||||
},
|
||||
() => pushDrawerStack(Constants.DRAWER_ROUTE_FILE_VIEW)
|
||||
);
|
||||
}
|
||||
}
|
||||
if (isWebViewable) {
|
||||
// show webview
|
||||
if (!this.state.showWebView) {
|
||||
this.setState(
|
||||
{
|
||||
showWebView: true,
|
||||
},
|
||||
() => pushDrawerStack(Constants.DRAWER_ROUTE_FILE_VIEW)
|
||||
);
|
||||
}
|
||||
}
|
||||
};
|
||||
|
||||
onMediaContainerPressed = () => {
|
||||
const { costInfo, contentType, purchaseUri } = this.props;
|
||||
const { uri } = this.state;
|
||||
const mediaType = Lbry.getMediaType(contentType);
|
||||
const isPlayable = mediaType === 'video' || mediaType === 'audio';
|
||||
purchaseUri(uri, costInfo, isPlayable);
|
||||
if (isPlayable) {
|
||||
this.onFileDownloadButtonPlayed();
|
||||
}
|
||||
};
|
||||
|
||||
render() {
|
||||
const {
|
||||
balance,
|
||||
@@ -582,38 +729,56 @@ class FilePage extends React.PureComponent {
|
||||
navigation,
|
||||
position,
|
||||
purchaseUri,
|
||||
pushDrawerStack,
|
||||
isSearchingRecommendContent,
|
||||
recommendedContent,
|
||||
thumbnail,
|
||||
title,
|
||||
viewCount,
|
||||
} = this.props;
|
||||
const { uri, autoplay } = navigation.state.params;
|
||||
|
||||
const { isChannel } = parseURI(uri);
|
||||
const myChannelUris = channels ? channels.map(channel => channel.permanent_url) : [];
|
||||
const ownedClaim = myClaimUris.includes(uri) || myChannelUris.includes(uri);
|
||||
const { isChannel } = parseURI(uri);
|
||||
|
||||
let innerContent = null;
|
||||
if ((isResolvingUri && !claim) || !claim) {
|
||||
return (
|
||||
<View style={filePageStyle.container}>
|
||||
<UriBar value={uri} navigation={navigation} />
|
||||
{isResolvingUri && (
|
||||
<View style={filePageStyle.busyContainer}>
|
||||
<ActivityIndicator size="large" color={Colors.NextLbryGreen} />
|
||||
<Text style={filePageStyle.infoText}>Loading decentralized data...</Text>
|
||||
<Text style={filePageStyle.infoText}>{__('Loading decentralized data...')}</Text>
|
||||
</View>
|
||||
)}
|
||||
{claim === null && !isResolvingUri && (
|
||||
<View style={filePageStyle.container}>
|
||||
{ownedClaim && (
|
||||
<Text style={filePageStyle.emptyClaimText}>
|
||||
{isChannel
|
||||
? 'It looks like you just created this channel. It will appear in a few minutes.'
|
||||
: 'It looks you just published this content. It will appear in a few minutes.'}
|
||||
</Text>
|
||||
<EmptyStateView
|
||||
message={
|
||||
isChannel
|
||||
? __('It looks like you just created this channel. It will appear in a few minutes.')
|
||||
: __('It looks you just published this content. It will appear in a few minutes.')
|
||||
}
|
||||
/>
|
||||
)}
|
||||
{!ownedClaim && (
|
||||
<EmptyStateView
|
||||
message={__("There's nothing at this location.")}
|
||||
buttonText={__('Publish something here')}
|
||||
onButtonPress={() =>
|
||||
navigation.navigate({
|
||||
routeName: Constants.DRAWER_ROUTE_PUBLISH,
|
||||
params: { vanityUrl: uri.trim() },
|
||||
})
|
||||
}
|
||||
/>
|
||||
)}
|
||||
{!ownedClaim && <Text style={filePageStyle.emptyClaimText}>There's nothing at this location.</Text>}
|
||||
</View>
|
||||
)}
|
||||
<UriBar value={uri} navigation={navigation} />
|
||||
<FloatingWalletBalance navigation={navigation} />
|
||||
</View>
|
||||
);
|
||||
}
|
||||
@@ -640,10 +805,11 @@ class FilePage extends React.PureComponent {
|
||||
<View style={filePageStyle.pageContainer}>
|
||||
<View style={filePageStyle.dmcaContainer}>
|
||||
<Text style={filePageStyle.dmcaText}>
|
||||
In response to a complaint we received under the US Digital Millennium Copyright Act, we have blocked
|
||||
access to this content from our applications.
|
||||
{__(
|
||||
'In response to a complaint we received under the US Digital Millennium Copyright Act, we have blocked access to this content from our applications.'
|
||||
)}
|
||||
</Text>
|
||||
<Link style={filePageStyle.dmcaLink} href="https://lbry.com/faq/dmca" text="Read More" />
|
||||
<Link style={filePageStyle.dmcaLink} href="https://lbry.com/faq/dmca" text={__('Read More')} />
|
||||
</View>
|
||||
<UriBar value={uri} navigation={navigation} />
|
||||
</View>
|
||||
@@ -660,6 +826,7 @@ class FilePage extends React.PureComponent {
|
||||
const description = metadata.description ? metadata.description : null;
|
||||
const mediaType = Lbry.getMediaType(contentType);
|
||||
const isPlayable = mediaType === 'video' || mediaType === 'audio';
|
||||
const isWebViewable = mediaType === 'text';
|
||||
const { height, signing_channel: signingChannel, value } = claim;
|
||||
const channelName = signingChannel && signingChannel.name;
|
||||
const channelClaimId = claim && claim.signing_channel && claim.signing_channel.claim_id;
|
||||
@@ -698,33 +865,9 @@ class FilePage extends React.PureComponent {
|
||||
(fileInfo && (fileInfo.written_bytes >= 2097152 || fileInfo.written_bytes === fileInfo.total_bytes)); // 2MB = 1024*1024*2
|
||||
const duration = claim && claim.value && claim.value.video ? claim.value.video.duration : null;
|
||||
const isViewable = mediaType === 'image' || mediaType === 'text';
|
||||
const isWebViewable = mediaType === 'text';
|
||||
const canOpen = isViewable && completed;
|
||||
const localFileUri = this.localUriForFileInfo(fileInfo);
|
||||
|
||||
const openFile = () => {
|
||||
if (mediaType === 'image') {
|
||||
// use image viewer
|
||||
if (!this.state.showImageViewer) {
|
||||
this.setState({
|
||||
imageUrls: [
|
||||
{
|
||||
url: localFileUri,
|
||||
},
|
||||
],
|
||||
showImageViewer: true,
|
||||
});
|
||||
}
|
||||
}
|
||||
if (isWebViewable) {
|
||||
// show webview
|
||||
if (!this.state.showWebView) {
|
||||
this.setState({
|
||||
showWebView: true,
|
||||
});
|
||||
}
|
||||
}
|
||||
};
|
||||
const unsupported = !isPlayable && !canOpen;
|
||||
|
||||
if (fileInfo && !this.state.autoDownloadStarted && this.state.uriVars && this.state.uriVars.download === 'true') {
|
||||
this.setState({ autoDownloadStarted: true }, () => {
|
||||
@@ -735,16 +878,16 @@ class FilePage extends React.PureComponent {
|
||||
});
|
||||
}
|
||||
|
||||
if (this.state.downloadPressed && canOpen) {
|
||||
if (this.state.downloadPressed && canOpen && !this.state.autoOpened) {
|
||||
// automatically open a web viewable or image file after the download button is pressed
|
||||
openFile();
|
||||
this.setState({ autoOpened: true }, () => this.openFile(localFileUri, mediaType));
|
||||
}
|
||||
|
||||
return (
|
||||
<View style={filePageStyle.pageContainer}>
|
||||
{!this.state.fullscreenMode && <UriBar value={uri} navigation={navigation} />}
|
||||
{this.state.showWebView && isWebViewable && (
|
||||
<WebView source={{ uri: localFileUri }} style={filePageStyle.viewer} />
|
||||
<WebView allowFileAccess source={{ uri: localFileUri }} style={filePageStyle.viewer} />
|
||||
)}
|
||||
|
||||
{this.state.showImageViewer && (
|
||||
@@ -762,7 +905,11 @@ class FilePage extends React.PureComponent {
|
||||
}
|
||||
onLayout={this.checkOrientation}
|
||||
>
|
||||
<View style={filePageStyle.mediaContainer}>
|
||||
<TouchableOpacity
|
||||
activeOpacity={0.5}
|
||||
style={filePageStyle.mediaContainer}
|
||||
onPress={this.onMediaContainerPressed}
|
||||
>
|
||||
{(canOpen || (!fileInfo || (isPlayable && !canLoadMedia)) || (!canOpen && fileInfo)) && (
|
||||
<FileItemMedia
|
||||
duration={duration}
|
||||
@@ -771,17 +918,38 @@ class FilePage extends React.PureComponent {
|
||||
thumbnail={thumbnail}
|
||||
/>
|
||||
)}
|
||||
{(!this.state.downloadButtonShown || this.state.downloadPressed) && !this.state.mediaLoaded && (
|
||||
{!unsupported &&
|
||||
(!this.state.downloadButtonShown || this.state.downloadPressed) &&
|
||||
!this.state.mediaLoaded && (
|
||||
<ActivityIndicator size="large" color={Colors.NextLbryGreen} style={filePageStyle.loading} />
|
||||
)}
|
||||
|
||||
{unsupported && fileInfo && completed && (
|
||||
<View style={filePageStyle.unsupportedContent}>
|
||||
<Image
|
||||
style={filePageStyle.unsupportedContentImage}
|
||||
resizeMode={'stretch'}
|
||||
source={require('../../assets/gerbil-happy.png')}
|
||||
/>
|
||||
<View style={filePageStyle.unspportedContentTextContainer}>
|
||||
<Text style={filePageStyle.unsupportedContentTitle}>{__('Unsupported Content')}</Text>
|
||||
<Text style={filePageStyle.unsupportedContentText}>
|
||||
Sorry, we are unable to display this content in the app. You can find the file named{' '}
|
||||
<Text style={filePageStyle.unsupportedContentFilename}>{fileInfo.file_name}</Text> in your
|
||||
downloads folder.
|
||||
</Text>
|
||||
</View>
|
||||
</View>
|
||||
)}
|
||||
|
||||
{((isPlayable && !completed && !canLoadMedia) ||
|
||||
canOpen ||
|
||||
(!completed && !this.state.streamingMode)) &&
|
||||
!this.state.downloadPressed && (
|
||||
<FileDownloadButton
|
||||
uri={uri}
|
||||
uri={claim && claim.permanent_url ? claim.permanent_url : uri}
|
||||
style={filePageStyle.downloadButton}
|
||||
openFile={openFile}
|
||||
openFile={() => this.openFile(localFileUri, mediaType)}
|
||||
isPlayable={isPlayable}
|
||||
isViewable={isViewable}
|
||||
onPlay={this.onFileDownloadButtonPlayed}
|
||||
@@ -800,7 +968,7 @@ class FilePage extends React.PureComponent {
|
||||
<TouchableOpacity style={filePageStyle.backButton} onPress={this.onBackButtonPressed}>
|
||||
<Icon name={'arrow-left'} size={18} style={filePageStyle.backButtonIcon} />
|
||||
</TouchableOpacity>
|
||||
</View>
|
||||
</TouchableOpacity>
|
||||
{(this.state.streamingMode || (canLoadMedia && fileInfo && isPlayable)) && (
|
||||
<View
|
||||
style={playerBgStyle}
|
||||
@@ -842,48 +1010,8 @@ class FilePage extends React.PureComponent {
|
||||
/>
|
||||
)}
|
||||
|
||||
{showActions && showFileActions && (
|
||||
<View style={filePageStyle.actions}>
|
||||
{showFileActions && (
|
||||
<View style={filePageStyle.fileActions}>
|
||||
{canEdit && (
|
||||
<Button
|
||||
style={[filePageStyle.actionButton, filePageStyle.editButton]}
|
||||
theme={'light'}
|
||||
icon={'edit'}
|
||||
text={'Edit'}
|
||||
onPress={this.onEditPressed}
|
||||
/>
|
||||
)}
|
||||
|
||||
{completed && (
|
||||
<Button
|
||||
style={filePageStyle.actionButton}
|
||||
theme={'light'}
|
||||
icon={'trash'}
|
||||
text={'Delete'}
|
||||
onPress={this.onDeletePressed}
|
||||
/>
|
||||
)}
|
||||
{!completed &&
|
||||
fileInfo &&
|
||||
!fileInfo.stopped &&
|
||||
fileInfo.written_bytes < fileInfo.total_bytes &&
|
||||
!this.state.stopDownloadConfirmed && (
|
||||
<Button
|
||||
style={filePageStyle.actionButton}
|
||||
icon={'stop'}
|
||||
theme={'light'}
|
||||
text={'Stop Download'}
|
||||
onPress={this.onStopDownloadPressed}
|
||||
/>
|
||||
)}
|
||||
</View>
|
||||
)}
|
||||
</View>
|
||||
)}
|
||||
<ScrollView
|
||||
style={showActions ? filePageStyle.scrollContainerActions : filePageStyle.scrollContainer}
|
||||
style={filePageStyle.scrollContainer}
|
||||
contentContainerstyle={showActions ? null : filePageStyle.scrollContent}
|
||||
keyboardShouldPersistTaps={'handled'}
|
||||
ref={ref => {
|
||||
@@ -894,16 +1022,93 @@ class FilePage extends React.PureComponent {
|
||||
style={filePageStyle.titleTouch}
|
||||
onPress={() => this.setState({ showDescription: !this.state.showDescription })}
|
||||
>
|
||||
<View style={filePageStyle.titleRow}>
|
||||
<Text style={filePageStyle.title} selectable>
|
||||
{title}
|
||||
</Text>
|
||||
{isRewardContent && <Icon name="award" style={filePageStyle.rewardIcon} size={16} />}
|
||||
<View style={filePageStyle.descriptionToggle}>
|
||||
<Icon name={this.state.showDescription ? 'caret-up' : 'caret-down'} size={24} />
|
||||
<View style={filePageStyle.titleArea}>
|
||||
<View style={filePageStyle.titleRow}>
|
||||
<Text style={filePageStyle.title} selectable>
|
||||
{title}
|
||||
</Text>
|
||||
{isRewardContent && <Icon name="award" style={filePageStyle.rewardIcon} size={16} />}
|
||||
<View style={filePageStyle.descriptionToggle}>
|
||||
<Icon name={this.state.showDescription ? 'caret-up' : 'caret-down'} size={24} />
|
||||
</View>
|
||||
</View>
|
||||
<Text style={filePageStyle.viewCount}>
|
||||
{viewCount === 1 && __('%view% view', { view: viewCount })}
|
||||
{viewCount > 1 && __('%view% views', { view: viewCount })}
|
||||
</Text>
|
||||
</View>
|
||||
</TouchableWithoutFeedback>
|
||||
|
||||
<View style={filePageStyle.largeButtonsRow}>
|
||||
<TouchableOpacity style={filePageStyle.largeButton} onPress={this.handleSharePress}>
|
||||
<Icon name={'share-alt'} size={16} style={filePageStyle.largeButtonIcon} />
|
||||
<Text style={filePageStyle.largeButtonText}>{__('Share')}</Text>
|
||||
</TouchableOpacity>
|
||||
|
||||
<TouchableOpacity
|
||||
style={filePageStyle.largeButton}
|
||||
onPress={() => this.setState({ showTipView: true })}
|
||||
>
|
||||
<Icon name={'gift'} size={16} style={filePageStyle.largeButtonIcon} />
|
||||
<Text style={filePageStyle.largeButtonText}>{__('Tip')}</Text>
|
||||
</TouchableOpacity>
|
||||
|
||||
{!canEdit && !isPlayable && (
|
||||
<View style={filePageStyle.sharedLargeButton}>
|
||||
{!fileInfo ||
|
||||
(fileInfo.written_bytes <= 0 && !completed && (
|
||||
<TouchableOpacity style={filePageStyle.innerLargeButton} onPress={this.onDownloadPressed}>
|
||||
<Icon name={'download'} size={16} style={filePageStyle.largeButtonIcon} />
|
||||
<Text style={filePageStyle.largeButtonText}>{__('Download')}</Text>
|
||||
</TouchableOpacity>
|
||||
))}
|
||||
|
||||
{!completed &&
|
||||
fileInfo &&
|
||||
!fileInfo.stopped &&
|
||||
fileInfo.written_bytes > 0 &&
|
||||
fileInfo.written_bytes < fileInfo.total_bytes &&
|
||||
!this.state.stopDownloadConfirmed && (
|
||||
<TouchableOpacity style={filePageStyle.innerLargeButton} onPress={this.onStopDownloadPressed}>
|
||||
<Icon name={'stop'} size={16} style={filePageStyle.largeButtonIcon} />
|
||||
<Text style={filePageStyle.largeButtonText}>{__('Stop')}</Text>
|
||||
</TouchableOpacity>
|
||||
)}
|
||||
|
||||
{completed && fileInfo && fileInfo.written_bytes >= fileInfo.total_bytes && (
|
||||
<TouchableOpacity style={filePageStyle.innerLargeButton} onPress={this.onOpenFilePressed}>
|
||||
<Icon name={'folder-open'} size={16} style={filePageStyle.largeButtonIcon} />
|
||||
<Text style={filePageStyle.largeButtonText}>{__('Open')}</Text>
|
||||
</TouchableOpacity>
|
||||
)}
|
||||
</View>
|
||||
)}
|
||||
|
||||
{!canEdit && (
|
||||
<TouchableOpacity
|
||||
style={filePageStyle.largeButton}
|
||||
onPress={() => Linking.openURL(`https://lbry.com/dmca/${claim.claim_id}`)}
|
||||
>
|
||||
<Icon name={'flag'} size={16} style={filePageStyle.largeButtonIcon} />
|
||||
<Text style={filePageStyle.largeButtonText}>{__('Report')}</Text>
|
||||
</TouchableOpacity>
|
||||
)}
|
||||
|
||||
{canEdit && (
|
||||
<TouchableOpacity style={filePageStyle.largeButton} onPress={this.onEditPressed}>
|
||||
<Icon name={'edit'} size={16} style={filePageStyle.largeButtonIcon} />
|
||||
<Text style={filePageStyle.largeButtonText}>{__('Edit')}</Text>
|
||||
</TouchableOpacity>
|
||||
)}
|
||||
|
||||
{(completed || canEdit) && (
|
||||
<TouchableOpacity style={filePageStyle.largeButton} onPress={this.onDeletePressed}>
|
||||
<Icon name={'trash-alt'} size={16} style={filePageStyle.largeButtonIcon} />
|
||||
<Text style={filePageStyle.largeButtonText}>{__('Delete')}</Text>
|
||||
</TouchableOpacity>
|
||||
)}
|
||||
</View>
|
||||
|
||||
<View style={filePageStyle.channelRow}>
|
||||
<View style={filePageStyle.publishInfo}>
|
||||
{channelName && (
|
||||
@@ -914,13 +1119,19 @@ class FilePage extends React.PureComponent {
|
||||
numberOfLines={1}
|
||||
ellipsizeMode={'tail'}
|
||||
onPress={() => {
|
||||
navigateToUri(navigation, normalizeURI(shortChannelUri || fullChannelUri));
|
||||
navigateToUri(
|
||||
navigation,
|
||||
normalizeURI(shortChannelUri || fullChannelUri),
|
||||
null,
|
||||
false,
|
||||
fullChannelUri
|
||||
);
|
||||
}}
|
||||
/>
|
||||
)}
|
||||
{!channelName && (
|
||||
<Text style={filePageStyle.anonChannelName} selectable ellipsizeMode={'tail'}>
|
||||
Anonymous
|
||||
{__('Anonymous')}
|
||||
</Text>
|
||||
)}
|
||||
<DateTime
|
||||
@@ -940,12 +1151,6 @@ class FilePage extends React.PureComponent {
|
||||
onPress={this.onSaveFilePressed}
|
||||
/>
|
||||
)}
|
||||
<Button
|
||||
style={[filePageStyle.actionButton, filePageStyle.tipButton]}
|
||||
theme={'light'}
|
||||
icon={'gift'}
|
||||
onPress={() => this.setState({ showTipView: true })}
|
||||
/>
|
||||
{channelName && (
|
||||
<SubscribeButton
|
||||
style={filePageStyle.actionButton}
|
||||
@@ -954,7 +1159,7 @@ class FilePage extends React.PureComponent {
|
||||
hideText={false}
|
||||
/>
|
||||
)}
|
||||
{channelName && (
|
||||
{false && channelName && (
|
||||
<SubscribeNotificationButton
|
||||
style={[filePageStyle.actionButton, filePageStyle.bellButton]}
|
||||
uri={fullChannelUri}
|
||||
@@ -973,6 +1178,8 @@ class FilePage extends React.PureComponent {
|
||||
editable={!this.state.sendTipStarted}
|
||||
ref={ref => (this.tipAmountInput = ref)}
|
||||
onChangeText={value => this.setState({ tipAmount: value })}
|
||||
onFocus={() => this.setState({ creditsInputFocused: true })}
|
||||
onBlur={() => this.setState({ creditsInputFocused: false })}
|
||||
underlineColorAndroid={Colors.NextLbryGreen}
|
||||
keyboardType={'numeric'}
|
||||
placeholder={'0'}
|
||||
@@ -981,15 +1188,21 @@ class FilePage extends React.PureComponent {
|
||||
style={[filePageStyle.input, filePageStyle.tipAmountInput]}
|
||||
/>
|
||||
<Text style={[filePageStyle.text, filePageStyle.currency]}>LBC</Text>
|
||||
<View style={filePageStyle.balance}>
|
||||
{this.state.creditsInputFocused && <Icon name="coins" size={12} />}
|
||||
{this.state.creditsInputFocused && (
|
||||
<Text style={filePageStyle.balanceText}>{formatCredits(parseFloat(balance), 1, true)}</Text>
|
||||
)}
|
||||
</View>
|
||||
</View>
|
||||
{this.state.sendTipStarted && <ActivityIndicator size={'small'} color={Colors.NextLbryGreen} />}
|
||||
<Link
|
||||
style={[filePageStyle.link, filePageStyle.cancelTipLink]}
|
||||
text={'Cancel'}
|
||||
text={__('Cancel')}
|
||||
onPress={() => this.setState({ showTipView: false })}
|
||||
/>
|
||||
<Button
|
||||
text={'Send a tip'}
|
||||
text={__('Send a tip')}
|
||||
style={[filePageStyle.button, filePageStyle.sendButton]}
|
||||
disabled={!canSendTip || this.state.sendTipStarted}
|
||||
onPress={this.handleSendTip}
|
||||
@@ -1008,7 +1221,7 @@ class FilePage extends React.PureComponent {
|
||||
</Text>
|
||||
{tags && tags.length > 0 && (
|
||||
<View style={filePageStyle.tagContainer}>
|
||||
<Text style={filePageStyle.tagTitle}>Tags</Text>
|
||||
<Text style={filePageStyle.tagTitle}>{__('Tags')}</Text>
|
||||
<View style={filePageStyle.tagList}>{this.renderTags(tags)}</View>
|
||||
</View>
|
||||
)}
|
||||
@@ -1020,13 +1233,20 @@ class FilePage extends React.PureComponent {
|
||||
)}
|
||||
|
||||
<View onLayout={this.setRelatedContentPosition} />
|
||||
<RelatedContent navigation={navigation} uri={uri} fullUri={fullUri} />
|
||||
|
||||
{isSearchingRecommendContent && (
|
||||
<ActivityIndicator size="small" color={Colors.NextLbryGreen} style={filePageStyle.relatedLoading} />
|
||||
)}
|
||||
{!isSearchingRecommendContent && recommendedContent && recommendedContent.length > 0 && (
|
||||
<RelatedContent navigation={navigation} uri={uri} fullUri={fullUri} />
|
||||
)}
|
||||
</ScrollView>
|
||||
</View>
|
||||
)}
|
||||
{!this.state.fullscreenMode && !this.state.showImageViewer && !this.state.showWebView && (
|
||||
<FloatingWalletBalance navigation={navigation} />
|
||||
)}
|
||||
{!this.state.creditsInputFocused &&
|
||||
!this.state.fullscreenMode &&
|
||||
!this.state.showImageViewer &&
|
||||
!this.state.showWebView && <FloatingWalletBalance navigation={navigation} />}
|
||||
</View>
|
||||
);
|
||||
}
|
||||
|
||||
@@ -1,14 +1,14 @@
|
||||
import { connect } from 'react-redux';
|
||||
import { doToast } from 'lbry-redux';
|
||||
import { SETTINGS, doToast } from 'lbry-redux';
|
||||
import {
|
||||
doAuthenticate,
|
||||
doCheckSync,
|
||||
doGetSync,
|
||||
doSetDefaultAccount,
|
||||
doSyncApply,
|
||||
doUserEmailNew,
|
||||
doUserResendVerificationEmail,
|
||||
selectAuthToken,
|
||||
selectEmailAlreadyExists,
|
||||
selectEmailNewErrorMessage,
|
||||
selectEmailNewIsPending,
|
||||
selectEmailToVerify,
|
||||
@@ -22,16 +22,19 @@ import {
|
||||
selectUser,
|
||||
} from 'lbryinc';
|
||||
import { doSetClientSetting } from 'redux/actions/settings';
|
||||
import { makeSelectClientSetting } from 'redux/selectors/settings';
|
||||
import FirstRun from './view';
|
||||
|
||||
const select = state => ({
|
||||
authenticating: selectAuthenticationIsPending(state),
|
||||
authToken: selectAuthToken(state),
|
||||
emailToVerify: selectEmailToVerify(state),
|
||||
emailAlreadyExists: selectEmailAlreadyExists(state),
|
||||
emailNewErrorMessage: selectEmailNewErrorMessage(state),
|
||||
emailNewPending: selectEmailNewIsPending(state),
|
||||
hasSyncedWallet: selectHasSyncedWallet(state),
|
||||
getSyncIsPending: selectGetSyncIsPending(state),
|
||||
language: makeSelectClientSetting(SETTINGS.LANGUAGE)(state),
|
||||
syncApplyErrorMessage: selectSyncApplyErrorMessage(state),
|
||||
syncApplyIsPending: selectSyncApplyIsPending(state),
|
||||
syncHash: selectSyncHash(state),
|
||||
@@ -41,12 +44,11 @@ const select = state => ({
|
||||
|
||||
const perform = dispatch => ({
|
||||
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)),
|
||||
syncApply: (hash, data, password) => dispatch(doSyncApply(hash, data, password)),
|
||||
getSync: password => dispatch(doGetSync(password)),
|
||||
getSync: (password, callback) => dispatch(doGetSync(password, callback)),
|
||||
checkSync: () => dispatch(doCheckSync()),
|
||||
setDefaultAccount: (success, failure) => dispatch(doSetDefaultAccount(success, failure)),
|
||||
notify: data => dispatch(doToast(data)),
|
||||
resendVerificationEmail: email => dispatch(doUserResendVerificationEmail(email)),
|
||||
});
|
||||
|
||||
@@ -3,7 +3,7 @@ import { Lbry } from 'lbry-redux';
|
||||
import { NativeModules, Platform, Text, TextInput, View } from 'react-native';
|
||||
import AsyncStorage from '@react-native-community/async-storage';
|
||||
import Colors from 'styles/colors';
|
||||
import Constants from 'constants';
|
||||
import Constants from 'constants'; // eslint-disable-line node/no-deprecated-api
|
||||
import firstRunStyle from 'styles/firstRun';
|
||||
|
||||
class EmailCollectPage extends React.PureComponent {
|
||||
@@ -44,7 +44,7 @@ class EmailCollectPage extends React.PureComponent {
|
||||
|
||||
const content = (
|
||||
<View onLayout={() => onEmailViewLayout('collect')}>
|
||||
<Text style={firstRunStyle.title}>Setup account</Text>
|
||||
<Text style={firstRunStyle.title}>{__('Setup account')}</Text>
|
||||
<TextInput
|
||||
style={firstRunStyle.emailInput}
|
||||
placeholder={this.state.placeholder}
|
||||
@@ -64,10 +64,10 @@ class EmailCollectPage extends React.PureComponent {
|
||||
}}
|
||||
/>
|
||||
<Text style={firstRunStyle.paragraph}>
|
||||
An account will allow you to earn rewards and keep your account and settings synced.
|
||||
{__('A lbry.tv account allows you to earn rewards, backup your wallet, and keep everything in sync.')}
|
||||
</Text>
|
||||
<Text style={firstRunStyle.infoParagraph}>
|
||||
This information is disclosed only to LBRY, Inc. and not to the LBRY network.
|
||||
{__('This information is disclosed only to LBRY, Inc. and not to the LBRY network.')}
|
||||
</Text>
|
||||
</View>
|
||||
);
|
||||
|
||||
@@ -4,7 +4,7 @@ import { ActivityIndicator, Linking, NativeModules, Platform, Switch, Text, Text
|
||||
import AsyncStorage from '@react-native-community/async-storage';
|
||||
import Button from 'component/button';
|
||||
import Colors from 'styles/colors';
|
||||
import Constants from 'constants';
|
||||
import Constants from 'constants'; // eslint-disable-line node/no-deprecated-api
|
||||
import Icon from 'react-native-vector-icons/FontAwesome5';
|
||||
import firstRunStyle from 'styles/firstRun';
|
||||
|
||||
@@ -13,28 +13,30 @@ class EmailVerifyPage extends React.PureComponent {
|
||||
const { email, notify, resendVerificationEmail } = this.props;
|
||||
resendVerificationEmail(email);
|
||||
AsyncStorage.setItem(Constants.KEY_EMAIL_VERIFY_PENDING, 'true');
|
||||
notify({ message: 'Please follow the instructions in the email sent to your address to continue.' });
|
||||
notify({ message: __('Please follow the instructions in the email sent to your address to continue.') });
|
||||
};
|
||||
|
||||
render() {
|
||||
const { onEmailViewLayout, email } = this.props;
|
||||
const { onEmailViewLayout, email, emailAlreadyExists } = this.props;
|
||||
|
||||
const content = (
|
||||
<View onLayout={() => onEmailViewLayout('verify')}>
|
||||
<Text style={firstRunStyle.title}>Verify Email</Text>
|
||||
<Text style={firstRunStyle.title}>{emailAlreadyExists ? __('Sign In') : __('Verify Email')}</Text>
|
||||
|
||||
<Text style={firstRunStyle.paragraph}>
|
||||
An email has been sent to{' '}
|
||||
<Text style={firstRunStyle.nowrap} numberOfLines={1}>
|
||||
{email}
|
||||
</Text>
|
||||
. Please follow the instructions in the message to verify your email address.
|
||||
{__('An email has been sent to')}
|
||||
{'\n\n'}
|
||||
{email}
|
||||
{'\n\n'}
|
||||
{emailAlreadyExists && __('Please click the link in the message to complete signing in')}
|
||||
{!emailAlreadyExists && __('Please click the link in the message to verify your email address')}.
|
||||
</Text>
|
||||
|
||||
<View style={firstRunStyle.buttonContainer}>
|
||||
<Button
|
||||
style={firstRunStyle.verificationButton}
|
||||
theme={'light'}
|
||||
text={'Resend'}
|
||||
text={__('Resend')}
|
||||
onPress={this.onResendPressed}
|
||||
/>
|
||||
</View>
|
||||
|
||||
@@ -12,7 +12,7 @@ import {
|
||||
View,
|
||||
} from 'react-native';
|
||||
import Colors from 'styles/colors';
|
||||
import Constants from 'constants';
|
||||
import Constants from 'constants'; // eslint-disable-line node/no-deprecated-api
|
||||
import Icon from 'react-native-vector-icons/FontAwesome5';
|
||||
import firstRunStyle from 'styles/firstRun';
|
||||
|
||||
@@ -28,10 +28,10 @@ class SkipAccountPage extends React.PureComponent {
|
||||
<View onLayout={onSkipAccountViewLayout}>
|
||||
<View style={firstRunStyle.row}>
|
||||
<Icon name="exclamation-triangle" style={firstRunStyle.titleIcon} size={32} color={Colors.White} />
|
||||
<Text style={firstRunStyle.title}>Are you sure?</Text>
|
||||
<Text style={firstRunStyle.title}>{__('Are you sure?')}</Text>
|
||||
</View>
|
||||
<Text style={firstRunStyle.paragraph}>
|
||||
Without an account, you will not receive rewards, sync and backup services, or security updates.
|
||||
{__('Without an account, you will not receive rewards, sync and backup services, or security updates.')}
|
||||
</Text>
|
||||
|
||||
<View style={[firstRunStyle.row, firstRunStyle.confirmContainer]}>
|
||||
@@ -45,8 +45,9 @@ class SkipAccountPage extends React.PureComponent {
|
||||
/>
|
||||
</View>
|
||||
<Text style={firstRunStyle.rowParagraph}>
|
||||
I understand that by uninstalling LBRY I will lose any balances or published content with no recovery
|
||||
option.
|
||||
{__(
|
||||
'I understand that by uninstalling LBRY I will lose any balances or published content with no recovery option if it is not backed up manually (see wallet page)'
|
||||
)}
|
||||
</Text>
|
||||
</View>
|
||||
</View>
|
||||
|
||||
@@ -14,7 +14,7 @@ import {
|
||||
import { BarPasswordStrengthDisplay } from 'react-native-password-strength-meter';
|
||||
import AsyncStorage from '@react-native-community/async-storage';
|
||||
import Colors from 'styles/colors';
|
||||
import Constants from 'constants';
|
||||
import Constants from 'constants'; // eslint-disable-line node/no-deprecated-api
|
||||
import firstRunStyle from 'styles/firstRun';
|
||||
import Icon from 'react-native-vector-icons/FontAwesome5';
|
||||
|
||||
@@ -28,12 +28,32 @@ class WalletPage extends React.PureComponent {
|
||||
walletReady: false,
|
||||
hasCheckedSync: false,
|
||||
revealPassword: false,
|
||||
autoPassword: false,
|
||||
autoLoginAttempted: false,
|
||||
};
|
||||
|
||||
componentDidMount() {
|
||||
this.checkWalletReady();
|
||||
}
|
||||
|
||||
componentDidUpdate() {
|
||||
const { hasSyncedWallet, getSyncIsPending, onPasswordChanged, autoLogin } = this.props;
|
||||
if (this.state.walletReady && this.state.hasCheckedSync && !getSyncIsPending) {
|
||||
if (!hasSyncedWallet && !this.state.autoPassword) {
|
||||
// new account, in which case, don't ask for a password, and act as the final first run step
|
||||
this.setState({ password: '', autoPassword: true });
|
||||
if (onPasswordChanged) {
|
||||
onPasswordChanged('', true);
|
||||
}
|
||||
}
|
||||
|
||||
if (hasSyncedWallet && !this.state.autoLoginAttempted && autoLogin) {
|
||||
autoLogin();
|
||||
this.setState({ autoLoginAttempted: true });
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
checkWalletReady = () => {
|
||||
// make sure the sdk wallet component is ready
|
||||
Lbry.status()
|
||||
@@ -62,31 +82,42 @@ class WalletPage extends React.PureComponent {
|
||||
};
|
||||
|
||||
render() {
|
||||
const { onPasswordChanged, onWalletViewLayout, getSyncIsPending, hasSyncedWallet, syncApplyIsPending } = this.props;
|
||||
const {
|
||||
onPasswordChanged,
|
||||
onWalletViewLayout,
|
||||
getSyncIsPending,
|
||||
hasSyncedWallet,
|
||||
syncApplyIsPending,
|
||||
syncApplyStarted,
|
||||
syncApplyCompleted,
|
||||
} = this.props;
|
||||
|
||||
let content;
|
||||
if (!this.state.walletReady || !this.state.hasCheckedSync || getSyncIsPending) {
|
||||
content = (
|
||||
<View style={firstRunStyle.centered}>
|
||||
<ActivityIndicator size="large" color={Colors.White} style={firstRunStyle.waiting} />
|
||||
<Text style={firstRunStyle.paragraph}>Retrieving your account information...</Text>
|
||||
<Text style={firstRunStyle.paragraph}>{__('Retrieving your account information...')}</Text>
|
||||
</View>
|
||||
);
|
||||
} else if (syncApplyIsPending) {
|
||||
} else if (syncApplyStarted || syncApplyIsPending || syncApplyCompleted) {
|
||||
content = (
|
||||
<View style={firstRunStyle.centered}>
|
||||
<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>
|
||||
);
|
||||
} else {
|
||||
} else if (hasSyncedWallet && this.state.autoLoginAttempted) {
|
||||
// only display this view if it's not a new user (or auto-login has been attempted once)
|
||||
content = (
|
||||
<View onLayout={onWalletViewLayout}>
|
||||
<Text style={firstRunStyle.title}>Password</Text>
|
||||
<Text style={firstRunStyle.title}>{__('Password')}</Text>
|
||||
<Text style={firstRunStyle.paragraph}>
|
||||
{hasSyncedWallet
|
||||
? 'Please enter the password you used to secure your wallet.'
|
||||
: 'Please enter a password to secure your account and wallet.'}
|
||||
? __('Please enter the password you used to secure your wallet.')
|
||||
: __('Please enter a password to secure your account and wallet.')}
|
||||
</Text>
|
||||
<View style={firstRunStyle.passwordInputContainer}>
|
||||
<TextInput
|
||||
@@ -115,15 +146,6 @@ class WalletPage extends React.PureComponent {
|
||||
<Icon name={this.state.revealPassword ? 'eye-slash' : 'eye'} size={16} style={firstRunStyle.revealIcon} />
|
||||
</TouchableOpacity>
|
||||
</View>
|
||||
{(!this.state.password || this.state.password.trim().length === 0) && (
|
||||
<View style={firstRunStyle.passwordWarning}>
|
||||
<Text style={firstRunStyle.passwordWarningText}>
|
||||
{hasSyncedWallet
|
||||
? 'If you did not provide a password, please press Use LBRY to continue.'
|
||||
: 'You can proceed without a password, but this is not recommended.'}
|
||||
</Text>
|
||||
</View>
|
||||
)}
|
||||
|
||||
{(!hasSyncedWallet && this.state.password && this.state.password.trim().length) > 0 && (
|
||||
<View style={firstRunStyle.passwordStrength}>
|
||||
@@ -135,7 +157,7 @@ class WalletPage extends React.PureComponent {
|
||||
</View>
|
||||
)}
|
||||
<Text style={firstRunStyle.infoParagraph}>
|
||||
Note: for wallet security purposes, LBRY is unable to reset your password.
|
||||
{__('Note: for wallet security purposes, LBRY is unable to reset your password.')}
|
||||
</Text>
|
||||
</View>
|
||||
);
|
||||
|
||||
@@ -3,7 +3,8 @@ import { Lbry } from 'lbry-redux';
|
||||
import { ActivityIndicator, NativeModules, Platform, Text, View } from 'react-native';
|
||||
import AsyncStorage from '@react-native-community/async-storage';
|
||||
import Colors from 'styles/colors';
|
||||
import Constants from 'constants';
|
||||
import Constants from 'constants'; // eslint-disable-line node/no-deprecated-api
|
||||
import Link from 'component/link';
|
||||
import firstRunStyle from 'styles/firstRun';
|
||||
|
||||
class WelcomePage extends React.PureComponent {
|
||||
@@ -25,7 +26,7 @@ class WelcomePage extends React.PureComponent {
|
||||
} else {
|
||||
// first_user_auth because it's the first time
|
||||
AsyncStorage.getItem(Constants.KEY_FIRST_USER_AUTH).then(firstUserAuth => {
|
||||
if ('true' !== firstUserAuth) {
|
||||
if (firstUserAuth !== 'true') {
|
||||
// first_user_auth
|
||||
NativeModules.Firebase.track('first_user_auth', null);
|
||||
AsyncStorage.setItem(Constants.KEY_FIRST_USER_AUTH, 'true');
|
||||
@@ -44,31 +45,39 @@ class WelcomePage extends React.PureComponent {
|
||||
}
|
||||
|
||||
startAuthenticating = () => {
|
||||
const { authenticate } = this.props;
|
||||
this.setState({ authenticationStarted: true, authenticationFailed: false });
|
||||
NativeModules.VersionInfo.getAppVersion().then(appVersion => {
|
||||
Lbry.status()
|
||||
.then(info => {
|
||||
this.setState({ sdkStarted: true });
|
||||
|
||||
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)
|
||||
}
|
||||
NativeModules.Firebase.getMessagingToken()
|
||||
.then(firebaseToken => this.performAuthenticate(appVersion, firebaseToken))
|
||||
.catch(() => {
|
||||
this.performAuthenticate(appVersion); /* proceed without firebase */
|
||||
});
|
||||
});
|
||||
};
|
||||
|
||||
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() {
|
||||
const { authenticating, authToken, onWelcomePageLayout } = this.props;
|
||||
|
||||
@@ -78,8 +87,9 @@ class WelcomePage extends React.PureComponent {
|
||||
content = (
|
||||
<View>
|
||||
<Text style={firstRunStyle.paragraph}>
|
||||
The LBRY servers were unreachable at this time. Please check your Internet connection and then restart the
|
||||
app to try again.
|
||||
{__(
|
||||
'The LBRY servers were unreachable at this time. Please check your Internet connection and then restart the app to try again.'
|
||||
)}
|
||||
</Text>
|
||||
</View>
|
||||
);
|
||||
@@ -87,16 +97,22 @@ class WelcomePage extends React.PureComponent {
|
||||
content = (
|
||||
<View style={firstRunStyle.centered}>
|
||||
<ActivityIndicator size="large" color={Colors.White} style={firstRunStyle.waiting} />
|
||||
<Text style={firstRunStyle.paragraph}>Please wait while we get some things ready...</Text>
|
||||
<Text style={firstRunStyle.paragraph}>{__('Please wait while we get some things ready...')}</Text>
|
||||
</View>
|
||||
);
|
||||
} else {
|
||||
content = (
|
||||
<View onLayout={onWelcomePageLayout}>
|
||||
<Text style={firstRunStyle.title}>Welcome to LBRY.</Text>
|
||||
<Text style={firstRunStyle.title}>{__('Welcome to LBRY.')}</Text>
|
||||
<Text style={firstRunStyle.paragraph}>
|
||||
LBRY is a community-controlled content platform where you can find and publish videos, music, books, and
|
||||
more.
|
||||
{__(
|
||||
'LBRY is a community-controlled content platform where you can find and publish videos, music, books, and more.'
|
||||
)}
|
||||
</Text>
|
||||
<Text style={[firstRunStyle.infoParagraph, firstRunStyle.tosParagraph]}>
|
||||
By continuing, I agree to the{' '}
|
||||
<Link style={firstRunStyle.tosLink} text={'Terms of Service'} href={'https://lbry.com/termsofservice'} />{' '}
|
||||
and confirm I am over the age of 13.
|
||||
</Text>
|
||||
</View>
|
||||
);
|
||||
|
||||
+137
-55
@@ -1,5 +1,5 @@
|
||||
import React from 'react';
|
||||
import { Lbry } from 'lbry-redux';
|
||||
import { SETTINGS, Lbry } from 'lbry-redux';
|
||||
import { ActivityIndicator, Linking, NativeModules, Text, TouchableOpacity, View } from 'react-native';
|
||||
import { NavigationActions, StackActions } from 'react-navigation';
|
||||
import AsyncStorage from '@react-native-community/async-storage';
|
||||
@@ -11,6 +11,7 @@ import EmailCollectPage from './internal/email-collect-page';
|
||||
import EmailVerifyPage from './internal/email-verify-page';
|
||||
import SkipAccountPage from './internal/skip-account-page';
|
||||
import firstRunStyle from 'styles/firstRun';
|
||||
import RNFS from 'react-native-fs';
|
||||
|
||||
class FirstRunScreen extends React.PureComponent {
|
||||
static pages = [
|
||||
@@ -27,14 +28,17 @@ class FirstRunScreen extends React.PureComponent {
|
||||
emailCollectTracked: false,
|
||||
emailSubmitted: false,
|
||||
enterPasswordTracked: false,
|
||||
autoLoginTried: false,
|
||||
isFirstRun: false,
|
||||
launchUrl: null,
|
||||
languageLoaded: false,
|
||||
showSkip: false,
|
||||
isEmailVerified: false,
|
||||
skipAccountConfirmed: false,
|
||||
showBottomContainer: false,
|
||||
walletPassword: '',
|
||||
syncApplyStarted: false,
|
||||
syncApplyCompleted: false,
|
||||
};
|
||||
|
||||
componentDidMount() {
|
||||
@@ -44,29 +48,70 @@ class FirstRunScreen extends React.PureComponent {
|
||||
}
|
||||
});
|
||||
|
||||
if (NativeModules.FirstRun) {
|
||||
NativeModules.FirstRun.isFirstRun().then(firstRun => {
|
||||
AsyncStorage.removeItem(Constants.KEY_FIRST_RUN_EMAIL);
|
||||
AsyncStorage.removeItem(Constants.KEY_EMAIL_VERIFY_PENDING);
|
||||
this.setState({ isFirstRun: firstRun });
|
||||
|
||||
if (firstRun) {
|
||||
NativeModules.Firebase.setCurrentScreen('First Run');
|
||||
this.setState({ currentPage: FirstRunScreen.pages[0] });
|
||||
} else {
|
||||
// Not the first run. Navigate to the splash screen right away
|
||||
this.launchSplashScreen();
|
||||
}
|
||||
});
|
||||
} else {
|
||||
// The first run module was not detected. Go straight to the splash screen.
|
||||
this.launchSplashScreen();
|
||||
}
|
||||
NativeModules.UtilityModule.getNativeStringSetting(SETTINGS.LANGUAGE, 'en').then(language =>
|
||||
this.loadLanguage(language)
|
||||
);
|
||||
}
|
||||
|
||||
loadLanguage = language => {
|
||||
if (!language || language === 'en') {
|
||||
this.checkFirstRun();
|
||||
} else {
|
||||
// Load the current language setting before doing anything
|
||||
const languageFile = RNFS.ExternalDirectoryPath + '/' + language + '.json';
|
||||
RNFS.readFile(languageFile, 'utf8')
|
||||
.then(fileContents => {
|
||||
const json = JSON.parse(fileContents);
|
||||
window.language = language;
|
||||
window.i18n_messages[language] = json;
|
||||
// language exists, so download an update
|
||||
this.downloadLanguageUpdate(language);
|
||||
this.checkFirstRun();
|
||||
})
|
||||
.catch(err => {
|
||||
// language file doesn't exist? maintain the default language
|
||||
this.checkFirstRun();
|
||||
});
|
||||
}
|
||||
};
|
||||
|
||||
downloadLanguageUpdate = language => {
|
||||
fetch('https://lbry.com/i18n/get/lbry-mobile/app-strings/' + language + '.json')
|
||||
.then(r => r.json())
|
||||
.then(j => {
|
||||
window.i18n_messages[language] = j;
|
||||
|
||||
// write the language file to the filesystem
|
||||
const langFilePath = RNFS.ExternalDirectoryPath + '/' + language + '.json';
|
||||
RNFS.writeFile(langFilePath, JSON.stringify(j), 'utf8');
|
||||
|
||||
// update state and client setting
|
||||
window.language = language;
|
||||
})
|
||||
.catch(() => {
|
||||
/* pass */
|
||||
});
|
||||
};
|
||||
|
||||
checkFirstRun = () => {
|
||||
NativeModules.FirstRun.isFirstRun().then(firstRun => {
|
||||
AsyncStorage.removeItem(Constants.KEY_FIRST_RUN_EMAIL);
|
||||
AsyncStorage.removeItem(Constants.KEY_EMAIL_VERIFY_PENDING);
|
||||
this.setState({ isFirstRun: firstRun });
|
||||
|
||||
if (firstRun) {
|
||||
NativeModules.Firebase.setCurrentScreen('First Run');
|
||||
this.setState({ currentPage: FirstRunScreen.pages[0] });
|
||||
} else {
|
||||
// Not the first run. Navigate to the splash screen right away
|
||||
this.launchSplashScreen();
|
||||
}
|
||||
});
|
||||
};
|
||||
|
||||
componentWillReceiveProps(nextProps) {
|
||||
const { emailNewErrorMessage, emailNewPending, syncApplyErrorMessage, syncApplyIsPending, user } = nextProps;
|
||||
const { notify, isApplyingSync, setClientSetting, setDefaultAccount } = this.props;
|
||||
const { notify, isApplyingSync, setClientSetting } = this.props;
|
||||
|
||||
if (this.state.emailSubmitted && !emailNewPending) {
|
||||
this.setState({ emailSubmitted: false });
|
||||
@@ -80,31 +125,43 @@ class FirstRunScreen extends React.PureComponent {
|
||||
}
|
||||
|
||||
if (this.state.syncApplyStarted && !syncApplyIsPending) {
|
||||
this.setState({ syncApplyStarted: false });
|
||||
if (syncApplyErrorMessage && syncApplyErrorMessage.trim().length > 0) {
|
||||
notify({ message: syncApplyErrorMessage, isError: true });
|
||||
this.setState({ showBottomContainer: true });
|
||||
if (this.state.autoLoginTried) {
|
||||
// don't show the error message for auto-login if it fails
|
||||
notify({ message: __(syncApplyErrorMessage), isError: true });
|
||||
}
|
||||
this.setState({
|
||||
autoLoginTried: true,
|
||||
showBottomContainer: true,
|
||||
syncApplyStarted: false,
|
||||
syncApplyCompleted: false,
|
||||
});
|
||||
} else {
|
||||
this.setState({ syncApplyCompleted: true });
|
||||
// password successfully verified
|
||||
NativeModules.UtilityModule.setSecureValue(Constants.KEY_FIRST_RUN_PASSWORD, this.state.walletPassword);
|
||||
setDefaultAccount(
|
||||
() => {
|
||||
setClientSetting(Constants.SETTING_DEVICE_WALLET_SYNCED, true);
|
||||
|
||||
// unlock the wallet
|
||||
Lbry.account_unlock({ password: this.state.walletPassword ? this.state.walletPassword : '' })
|
||||
.then(() => this.closeFinalPage())
|
||||
.catch(err =>
|
||||
notify({ message: 'The wallet could not be unlocked at this time. Please restart the app.' })
|
||||
);
|
||||
},
|
||||
err => {
|
||||
notify({
|
||||
message:
|
||||
'The account restore operation could not be completed successfully. Please restart the app and try again.',
|
||||
});
|
||||
}
|
||||
NativeModules.UtilityModule.setSecureValue(
|
||||
Constants.KEY_WALLET_PASSWORD,
|
||||
this.state.walletPassword ? this.state.walletPassword : ''
|
||||
);
|
||||
|
||||
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 resetAction = StackActions.reset({
|
||||
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 = () => {
|
||||
@@ -161,6 +218,13 @@ class FirstRunScreen extends React.PureComponent {
|
||||
});
|
||||
};
|
||||
|
||||
autoLogin = () => {
|
||||
const { hasSyncedWallet } = this.props;
|
||||
if (hasSyncedWallet && !this.state.syncApplyStarted) {
|
||||
this.checkWalletPassword();
|
||||
}
|
||||
};
|
||||
|
||||
handleContinuePressed = () => {
|
||||
const { notify, user, hasSyncedWallet } = this.props;
|
||||
const pageIndex = FirstRunScreen.pages.indexOf(this.state.currentPage);
|
||||
@@ -175,7 +239,7 @@ class FirstRunScreen extends React.PureComponent {
|
||||
}
|
||||
|
||||
if (Constants.FIRST_RUN_PAGE_SKIP_ACCOUNT === this.state.currentPage && !this.state.skipAccountConfirmed) {
|
||||
notify({ message: 'Please confirm that you want to use LBRY without creating an account.' });
|
||||
notify({ message: __('Please confirm that you want to use LBRY without creating an account.') });
|
||||
return;
|
||||
}
|
||||
|
||||
@@ -201,7 +265,7 @@ class FirstRunScreen extends React.PureComponent {
|
||||
// validate the email
|
||||
if (!email || email.indexOf('@') === -1) {
|
||||
return notify({
|
||||
message: 'Please provide a valid email address to continue.',
|
||||
message: __('Please provide a valid email address to continue.'),
|
||||
});
|
||||
}
|
||||
|
||||
@@ -233,6 +297,7 @@ class FirstRunScreen extends React.PureComponent {
|
||||
|
||||
closeFinalPage() {
|
||||
// Final page. Let the app know that first run experience is completed.
|
||||
this.setState({ syncApplyStarted: false });
|
||||
if (NativeModules.FirstRun) {
|
||||
NativeModules.FirstRun.firstRunCompleted();
|
||||
}
|
||||
@@ -265,8 +330,12 @@ class FirstRunScreen extends React.PureComponent {
|
||||
this.setState({ showBottomContainer: true, showSkip: true });
|
||||
};
|
||||
|
||||
onWalletPasswordChanged = password => {
|
||||
onWalletPasswordChanged = (password, finalStep) => {
|
||||
this.setState({ walletPassword: password !== null ? password : '' });
|
||||
if (finalStep) {
|
||||
// final step for a new user
|
||||
this.setFreshPassword();
|
||||
}
|
||||
};
|
||||
|
||||
onWalletViewLayout = () => {
|
||||
@@ -295,13 +364,20 @@ class FirstRunScreen extends React.PureComponent {
|
||||
const { getSync, setClientSetting } = this.props;
|
||||
if (NativeModules.UtilityModule) {
|
||||
const newPassword = this.state.walletPassword ? this.state.walletPassword : '';
|
||||
NativeModules.UtilityModule.setSecureValue(Constants.KEY_FIRST_RUN_PASSWORD, newPassword);
|
||||
Lbry.account_encrypt({ new_password: newPassword }).then(() => {
|
||||
// fresh account, new password set
|
||||
NativeModules.UtilityModule.setSecureValue(Constants.KEY_WALLET_PASSWORD, newPassword);
|
||||
if (newPassword.trim().length === 0) {
|
||||
// blank password. Do not encrypt
|
||||
getSync(newPassword);
|
||||
setClientSetting(Constants.SETTING_DEVICE_WALLET_SYNCED, true);
|
||||
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 +387,11 @@ class FirstRunScreen extends React.PureComponent {
|
||||
authenticating,
|
||||
authToken,
|
||||
checkSync,
|
||||
emailAlreadyExists,
|
||||
emailNewErrorMessage,
|
||||
emailNewPending,
|
||||
emailToVerify,
|
||||
language,
|
||||
notify,
|
||||
hasSyncedWallet,
|
||||
getSyncIsPending,
|
||||
@@ -351,6 +429,7 @@ class FirstRunScreen extends React.PureComponent {
|
||||
<EmailVerifyPage
|
||||
onEmailViewLayout={this.onEmailViewLayout}
|
||||
email={this.state.email}
|
||||
emailAlreadyExists={emailAlreadyExists}
|
||||
notify={notify}
|
||||
resendVerificationEmail={resendVerificationEmail}
|
||||
/>
|
||||
@@ -364,8 +443,11 @@ class FirstRunScreen extends React.PureComponent {
|
||||
hasSyncedWallet={hasSyncedWallet}
|
||||
getSyncIsPending={getSyncIsPending}
|
||||
syncApplyIsPending={syncApplyIsPending}
|
||||
syncApplyStarted={this.state.syncApplyStarted}
|
||||
syncApplyCompleted={this.state.syncApplyCompleted}
|
||||
onWalletViewLayout={this.onWalletViewLayout}
|
||||
onPasswordChanged={this.onWalletPasswordChanged}
|
||||
autoLogin={this.autoLogin}
|
||||
/>
|
||||
);
|
||||
break;
|
||||
@@ -398,27 +480,27 @@ class FirstRunScreen extends React.PureComponent {
|
||||
<Text style={firstRunStyle.buttonText}>
|
||||
«{' '}
|
||||
{Constants.FIRST_RUN_PAGE_SKIP_ACCOUNT === this.state.currentPage
|
||||
? 'Setup account'
|
||||
: 'Change email'}
|
||||
? __('Setup account')
|
||||
: __('Change email')}
|
||||
</Text>
|
||||
</TouchableOpacity>
|
||||
)}
|
||||
{!emailNewPending && Constants.FIRST_RUN_PAGE_EMAIL_COLLECT === this.state.currentPage && (
|
||||
<TouchableOpacity style={firstRunStyle.leftButton} onPress={this.handleLeftButtonPressed}>
|
||||
<Text style={firstRunStyle.smallLeftButtonText}>No, thanks »</Text>
|
||||
<Text style={firstRunStyle.smallLeftButtonText}>{__('No, thanks')} »</Text>
|
||||
</TouchableOpacity>
|
||||
)}
|
||||
|
||||
{!emailNewPending && (
|
||||
<TouchableOpacity style={firstRunStyle.button} onPress={this.handleContinuePressed}>
|
||||
{Constants.FIRST_RUN_PAGE_SKIP_ACCOUNT === this.state.currentPage && (
|
||||
<Text style={firstRunStyle.smallButtonText}>Use LBRY »</Text>
|
||||
<Text style={firstRunStyle.smallButtonText}>{__('Use LBRY')} »</Text>
|
||||
)}
|
||||
|
||||
{Constants.FIRST_RUN_PAGE_SKIP_ACCOUNT !== this.state.currentPage &&
|
||||
Constants.FIRST_RUN_PAGE_EMAIL_VERIFY !== this.state.currentPage && (
|
||||
<Text style={firstRunStyle.buttonText}>
|
||||
{Constants.FIRST_RUN_PAGE_WALLET === this.state.currentPage ? 'Use LBRY' : 'Continue'} »
|
||||
{Constants.FIRST_RUN_PAGE_WALLET === this.state.currentPage ? __('Use LBRY') : __('Continue')} »
|
||||
</Text>
|
||||
)}
|
||||
</TouchableOpacity>
|
||||
|
||||
@@ -4,26 +4,36 @@ import {
|
||||
doResolveUri,
|
||||
doToast,
|
||||
doUpdatePublishForm,
|
||||
doUploadThumbnail,
|
||||
selectBalance,
|
||||
selectMyClaims,
|
||||
selectPublishFormValues,
|
||||
} from 'lbry-redux';
|
||||
import { doPushDrawerStack, doSetPlayerVisible } from 'redux/actions/drawer';
|
||||
import { selectDrawerStack } from 'redux/selectors/drawer';
|
||||
import { doUpdatePublishFormState, doClearPublishFormState, doPendingPublishSuccess } from 'redux/actions/form';
|
||||
import { doPushDrawerStack, doPopDrawerStack, doSetPlayerVisible } from 'redux/actions/drawer';
|
||||
import { selectPublishFormState, selectHasPublishFormState } from 'redux/selectors/form';
|
||||
import Constants from 'constants'; // eslint-disable-line node/no-deprecated-api
|
||||
import PublishPage from './view';
|
||||
|
||||
const select = state => ({
|
||||
balance: selectBalance(state),
|
||||
drawerStack: selectDrawerStack(state),
|
||||
hasFormState: selectHasPublishFormState(state),
|
||||
myClaims: selectMyClaims(state),
|
||||
publishFormState: selectPublishFormState(state),
|
||||
publishFormValues: selectPublishFormValues(state),
|
||||
});
|
||||
|
||||
const perform = dispatch => ({
|
||||
notify: data => dispatch(doToast(data)),
|
||||
clearPublishFormState: () => dispatch(doClearPublishFormState()),
|
||||
pendingPublishSuccess: pendingClaim => dispatch(doPendingPublishSuccess(pendingClaim)),
|
||||
updatePublishForm: value => dispatch(doUpdatePublishForm(value)),
|
||||
uploadThumbnail: (filePath, fsAdapter) => dispatch(doUploadThumbnail(filePath, null, fsAdapter)),
|
||||
updatePublishFormState: data => dispatch(doUpdatePublishFormState(data)),
|
||||
publish: (success, fail) => dispatch(doPublish(success, fail)),
|
||||
resolveUri: uri => dispatch(doResolveUri(uri)),
|
||||
pushDrawerStack: () => dispatch(doPushDrawerStack(Constants.DRAWER_ROUTE_PUBLISH)),
|
||||
pushDrawerStack: (routeName, params) => dispatch(doPushDrawerStack(routeName, params)),
|
||||
popDrawerStack: () => dispatch(doPopDrawerStack()),
|
||||
setPlayerVisible: () => dispatch(doSetPlayerVisible(false)),
|
||||
});
|
||||
|
||||
|
||||
+395
-165
File diff suppressed because it is too large.
Load diff
@@ -3,7 +3,9 @@ import {
|
||||
doAbandonClaim,
|
||||
doCheckPendingPublishes,
|
||||
doFetchClaimListMine,
|
||||
doToast,
|
||||
selectMyClaimUrisWithoutChannels,
|
||||
selectPendingClaims,
|
||||
selectIsFetchingClaimListMine,
|
||||
} from 'lbry-redux';
|
||||
import { doPushDrawerStack, doSetPlayerVisible } from 'redux/actions/drawer';
|
||||
@@ -13,12 +15,14 @@ import PublishesPage from './view';
|
||||
const select = state => ({
|
||||
uris: selectMyClaimUrisWithoutChannels(state),
|
||||
fetching: selectIsFetchingClaimListMine(state),
|
||||
pendingClaims: selectPendingClaims(state),
|
||||
});
|
||||
|
||||
const perform = dispatch => ({
|
||||
abandonClaim: (txid, nout) => dispatch(doAbandonClaim(txid, nout)),
|
||||
fetchMyClaims: () => dispatch(doFetchClaimListMine()),
|
||||
checkPendingPublishes: () => dispatch(doCheckPendingPublishes()),
|
||||
notify: data => dispatch(doToast(data)),
|
||||
pushDrawerStack: () => dispatch(doPushDrawerStack(Constants.DRAWER_ROUTE_PUBLISHES)),
|
||||
setPlayerVisible: () => dispatch(doSetPlayerVisible(false)),
|
||||
});
|
||||
|
||||
+27
-13
@@ -3,11 +3,12 @@ import { ActivityIndicator, Alert, FlatList, NativeModules, Text, TouchableOpaci
|
||||
import Button from 'component/button';
|
||||
import Colors from 'styles/colors';
|
||||
import Constants from 'constants'; // eslint-disable-line node/no-deprecated-api
|
||||
import EmptyStateView from 'component/emptyStateView';
|
||||
import FileListItem from 'component/fileListItem';
|
||||
import FloatingWalletBalance from 'component/floatingWalletBalance';
|
||||
import UriBar from 'component/uriBar';
|
||||
import publishStyle from 'styles/publish';
|
||||
import { __, navigateToUri } from 'utils/helper';
|
||||
import { navigateToUri } from 'utils/helper';
|
||||
|
||||
class PublishesPage extends React.PureComponent {
|
||||
state = {
|
||||
@@ -53,6 +54,8 @@ class PublishesPage extends React.PureComponent {
|
||||
};
|
||||
|
||||
addOrRemoveItem = (uri, claim) => {
|
||||
const { pendingClaims } = this.state;
|
||||
|
||||
const { selectedClaimsMap } = this.state;
|
||||
let selectedUris = [...this.state.selectedUris];
|
||||
|
||||
@@ -137,16 +140,11 @@ class PublishesPage extends React.PureComponent {
|
||||
)}
|
||||
|
||||
{!fetching && (!uris || uris.length === 0) && (
|
||||
<View style={publishStyle.noPublishes}>
|
||||
<Text style={publishStyle.noPublishText}>
|
||||
{__('It looks like you have not published anything to LBRY yet.')}
|
||||
</Text>
|
||||
<Button
|
||||
style={publishStyle.publishNowButton}
|
||||
text={__('Publish something new')}
|
||||
onPress={() => navigation.navigate({ routeName: Constants.DRAWER_ROUTE_PUBLISH })}
|
||||
/>
|
||||
</View>
|
||||
<EmptyStateView
|
||||
message={__('It looks like you have not\npublished any content to LBRY yet.')}
|
||||
buttonText={__('Publish something new')}
|
||||
onButtonPress={() => navigation.navigate({ routeName: Constants.DRAWER_ROUTE_PUBLISH })}
|
||||
/>
|
||||
)}
|
||||
|
||||
{uris && uris.length > 0 && (
|
||||
@@ -157,6 +155,15 @@ class PublishesPage extends React.PureComponent {
|
||||
initialNumToRender={8}
|
||||
maxToRenderPerBatch={24}
|
||||
removeClippedSubviews
|
||||
ListFooterComponent={
|
||||
<View style={publishStyle.publishesFooter}>
|
||||
<Button
|
||||
style={publishStyle.publishesFooterButton}
|
||||
text={__('Publish something new')}
|
||||
onPress={() => navigation.navigate({ routeName: Constants.DRAWER_ROUTE_PUBLISH })}
|
||||
/>
|
||||
</View>
|
||||
}
|
||||
renderItem={({ item }) => (
|
||||
<FileListItem
|
||||
key={item}
|
||||
@@ -167,8 +174,15 @@ class PublishesPage extends React.PureComponent {
|
||||
if (selectionMode) {
|
||||
this.handleSelectItem(item, claim);
|
||||
} else {
|
||||
// TODO: when shortUrl is available for my claims, navigate to that URL instead
|
||||
navigateToUri(navigation, item);
|
||||
const { notify, pendingClaims } = this.props;
|
||||
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)}
|
||||
|
||||
@@ -8,7 +8,6 @@ import CustomRewardCard from 'component/customRewardCard';
|
||||
import PageHeader from 'component/pageHeader';
|
||||
import RewardCard from 'component/rewardCard';
|
||||
import RewardEnrolment from 'component/rewardEnrolment';
|
||||
import RewardSummary from 'component/rewardSummary';
|
||||
import UriBar from 'component/uriBar';
|
||||
import rewardStyle from 'styles/reward';
|
||||
|
||||
@@ -105,9 +104,10 @@ class RewardsPage extends React.PureComponent {
|
||||
if (this.state.isEmailVerified && this.state.isIdentityVerified && !this.state.isRewardApproved) {
|
||||
return (
|
||||
<View style={[rewardStyle.card, rewardStyle.verification]}>
|
||||
<Text style={rewardStyle.title}>Manual Reward Verification</Text>
|
||||
<Text style={rewardStyle.title}>{__('Manual Reward Verification')}</Text>
|
||||
<Text style={rewardStyle.text}>
|
||||
You need to be manually verified before you can start claiming rewards. Please request to be verified on the{' '}
|
||||
__('You need to be manually verified before you can start claiming rewards.') Please request to be verified
|
||||
on the{' '}
|
||||
<Link
|
||||
style={rewardStyle.greenLink}
|
||||
href="https://discordapp.com/invite/Z3bERWA"
|
||||
@@ -130,13 +130,15 @@ class RewardsPage extends React.PureComponent {
|
||||
return (
|
||||
<View style={rewardStyle.busyContainer}>
|
||||
<ActivityIndicator size="large" color={Colors.NextLbryGreen} />
|
||||
<Text style={rewardStyle.infoText}>Fetching rewards...</Text>
|
||||
<Text style={rewardStyle.infoText}>{__('Fetching rewards...')}</Text>
|
||||
</View>
|
||||
);
|
||||
} else if (user === null) {
|
||||
return (
|
||||
<View style={rewardStyle.busyContainer}>
|
||||
<Text style={rewardStyle.infoText}>This app is unable to earn rewards due to an authentication failure.</Text>
|
||||
<Text style={rewardStyle.infoText}>
|
||||
{__('This app is unable to earn rewards due to an authentication failure.')}
|
||||
</Text>
|
||||
</View>
|
||||
);
|
||||
}
|
||||
|
||||
@@ -1,8 +1,10 @@
|
||||
import { connect } from 'react-redux';
|
||||
import {
|
||||
doClaimSearch,
|
||||
doSearch,
|
||||
doUpdateSearchQuery,
|
||||
makeSelectSearchUris,
|
||||
selectClaimSearchByQuery,
|
||||
selectIsSearching,
|
||||
selectSearchValue,
|
||||
makeSelectQueryWithOptions,
|
||||
@@ -13,9 +15,10 @@ import { selectCurrentRoute } from 'redux/selectors/drawer';
|
||||
import Constants from 'constants'; // eslint-disable-line node/no-deprecated-api
|
||||
import SearchPage from './view';
|
||||
|
||||
const numSearchResults = 50;
|
||||
const numSearchResults = 25;
|
||||
|
||||
const select = state => ({
|
||||
claimSearchByQuery: selectClaimSearchByQuery(state),
|
||||
currentRoute: selectCurrentRoute(state),
|
||||
isSearching: selectIsSearching(state),
|
||||
query: selectSearchValue(state),
|
||||
@@ -25,6 +28,7 @@ const select = state => ({
|
||||
|
||||
const perform = dispatch => ({
|
||||
search: query => dispatch(doSearch(query, numSearchResults)),
|
||||
claimSearch: options => dispatch(doClaimSearch(options)),
|
||||
updateSearchQuery: query => dispatch(doUpdateSearchQuery(query)),
|
||||
pushDrawerStack: () => dispatch(doPushDrawerStack(Constants.DRAWER_ROUTE_SEARCH)),
|
||||
setPlayerVisible: () => dispatch(doSetPlayerVisible(false)),
|
||||
|
||||
+59
-9
@@ -1,6 +1,15 @@
|
||||
import React from 'react';
|
||||
import { Lbry, parseURI, normalizeURI, isURIValid } from 'lbry-redux';
|
||||
import { ActivityIndicator, Button, FlatList, NativeModules, Text, TextInput, View } from 'react-native';
|
||||
import { Lbry, createNormalizedClaimSearchKey, parseURI, normalizeURI, isURIValid } from 'lbry-redux';
|
||||
import {
|
||||
ActivityIndicator,
|
||||
Button,
|
||||
FlatList,
|
||||
NativeModules,
|
||||
Text,
|
||||
TextInput,
|
||||
TouchableOpacity,
|
||||
View,
|
||||
} from 'react-native';
|
||||
import { navigateToUri } from 'utils/helper';
|
||||
import Colors from 'styles/colors';
|
||||
import Constants from 'constants'; // eslint-disable-line node/no-deprecated-api
|
||||
@@ -14,6 +23,9 @@ class SearchPage extends React.PureComponent {
|
||||
state = {
|
||||
currentQuery: null,
|
||||
currentUri: null,
|
||||
showTagResult: false,
|
||||
claimSearchRun: false,
|
||||
claimSearchOptions: null,
|
||||
};
|
||||
|
||||
static navigationOptions = {
|
||||
@@ -43,6 +55,9 @@ class SearchPage extends React.PureComponent {
|
||||
this.setState({
|
||||
currentQuery: searchQuery,
|
||||
currentUri: isURIValid(searchQuery) ? normalizeURI(searchQuery) : null,
|
||||
claimSearchOptions: null,
|
||||
claimSearchRun: false,
|
||||
showTagResult: false,
|
||||
});
|
||||
search(searchQuery);
|
||||
}
|
||||
@@ -80,7 +95,12 @@ class SearchPage extends React.PureComponent {
|
||||
|
||||
handleSearchSubmitted = keywords => {
|
||||
const { search } = this.props;
|
||||
this.setState({ currentUri: isURIValid(keywords) ? normalizeURI(keywords) : null });
|
||||
this.setState({
|
||||
currentUri: isURIValid(keywords) ? normalizeURI(keywords) : null,
|
||||
claimSearchOptions: null,
|
||||
claimSearchRun: false,
|
||||
showTagResult: false,
|
||||
});
|
||||
search(keywords);
|
||||
};
|
||||
|
||||
@@ -89,22 +109,51 @@ class SearchPage extends React.PureComponent {
|
||||
return (
|
||||
<View style={searchStyle.noResults}>
|
||||
<Text style={searchStyle.noResultsText}>
|
||||
There are no results to display for <Text style={searchStyle.boldText}>{query}</Text>. Please try a different
|
||||
search term.
|
||||
{__('There are no results to display for "%query%". Please try a different search term.', { query })}
|
||||
</Text>
|
||||
</View>
|
||||
);
|
||||
};
|
||||
|
||||
listHeaderComponent = () => {
|
||||
const { navigation } = this.props;
|
||||
listHeaderComponent = showTagResult => {
|
||||
const { navigation, claimSearch, claimSearchByQuery } = this.props;
|
||||
const { currentUri } = this.state;
|
||||
const query = this.getSearchQuery();
|
||||
|
||||
const canBeTag = query && query.trim().length > 0 && isURIValid(query);
|
||||
if (canBeTag && !this.state.claimSearchRun) {
|
||||
const options = {
|
||||
any_tags: [query],
|
||||
page: 1,
|
||||
no_totals: true,
|
||||
};
|
||||
this.setState({ claimSearchOptions: options, claimSearchRun: true }, () => claimSearch(options));
|
||||
}
|
||||
|
||||
if (this.state.claimSearchRun && this.state.claimSearchOptions) {
|
||||
const claimSearchKey = createNormalizedClaimSearchKey(this.state.claimSearchOptions);
|
||||
const claimSearchUris = claimSearchByQuery[claimSearchKey];
|
||||
this.setState({ showTagResult: claimSearchUris && claimSearchUris.length > 0 });
|
||||
}
|
||||
|
||||
return (
|
||||
<FileListItem uri={currentUri} featuredResult style={searchStyle.featuredResultItem} navigation={navigation} />
|
||||
<View>
|
||||
<FileListItem uri={currentUri} featuredResult style={searchStyle.featuredResultItem} navigation={navigation} />
|
||||
{showTagResult && (
|
||||
<TouchableOpacity style={searchStyle.tagResultItem} onPress={() => this.handleTagResultPressed(query)}>
|
||||
<Text style={searchStyle.tagResultTitle}>#{query.toLowerCase()}</Text>
|
||||
<Text style={searchStyle.tagResultDescription}>{__('Explore content for this tag')}</Text>
|
||||
</TouchableOpacity>
|
||||
)}
|
||||
</View>
|
||||
);
|
||||
};
|
||||
|
||||
handleTagResultPressed = tag => {
|
||||
const { navigation } = this.props;
|
||||
navigation.navigate({ routeName: Constants.DRAWER_ROUTE_TAG, key: `tagPage`, params: { tag: tag.toLowerCase() } });
|
||||
};
|
||||
|
||||
render() {
|
||||
const { isSearching, navigation, query, uris, urisByQuery } = this.props;
|
||||
|
||||
@@ -119,6 +168,7 @@ class SearchPage extends React.PureComponent {
|
||||
)}
|
||||
|
||||
<FlatList
|
||||
extraData={this.state}
|
||||
style={searchStyle.scrollContainer}
|
||||
contentContainerStyle={searchStyle.scrollPadding}
|
||||
keyboardShouldPersistTaps={'handled'}
|
||||
@@ -128,7 +178,7 @@ class SearchPage extends React.PureComponent {
|
||||
maxToRenderPerBatch={20}
|
||||
removeClippedSubviews
|
||||
ListEmptyComponent={!isSearching ? this.listEmptyComponent() : null}
|
||||
ListHeaderComponent={this.state.currentUri ? this.listHeaderComponent() : null}
|
||||
ListHeaderComponent={this.state.currentUri ? this.listHeaderComponent(this.state.showTagResult) : null}
|
||||
renderItem={({ item }) => (
|
||||
<FileListItem key={item} uri={item} style={searchStyle.resultItem} navigation={navigation} />
|
||||
)}
|
||||
|
||||
@@ -1,10 +1,10 @@
|
||||
import { connect } from 'react-redux';
|
||||
import { SETTINGS } from 'lbry-redux';
|
||||
import { SETTINGS, doToast } from 'lbry-redux';
|
||||
import { doPushDrawerStack, doPopDrawerStack, doSetPlayerVisible } from 'redux/actions/drawer';
|
||||
import { doSetClientSetting } from 'redux/actions/settings';
|
||||
import { selectCurrentRoute, selectDrawerStack } from 'redux/selectors/drawer';
|
||||
import { makeSelectClientSetting } from 'redux/selectors/settings';
|
||||
import Constants from 'constants';
|
||||
import Constants from 'constants'; // eslint-disable-line node/no-deprecated-api
|
||||
import SettingsPage from './view';
|
||||
|
||||
const select = state => ({
|
||||
@@ -12,10 +12,17 @@ const select = state => ({
|
||||
currentRoute: selectCurrentRoute(state),
|
||||
drawerStack: selectDrawerStack(state),
|
||||
keepDaemonRunning: makeSelectClientSetting(SETTINGS.KEEP_DAEMON_RUNNING)(state),
|
||||
language: makeSelectClientSetting(SETTINGS.LANGUAGE)(state),
|
||||
showNsfw: makeSelectClientSetting(SETTINGS.SHOW_NSFW)(state),
|
||||
showUriBarSuggestions: makeSelectClientSetting(SETTINGS.SHOW_URI_BAR_SUGGESTIONS)(state),
|
||||
receiveSubscriptionNotifications: makeSelectClientSetting(SETTINGS.RECEIVE_SUBSCRIPTION_NOTIFICATIONS)(state),
|
||||
receiveRewardNotifications: makeSelectClientSetting(SETTINGS.RECEIVE_REWARD_NOTIFICATIONS)(state),
|
||||
receiveInterestsNotifications: makeSelectClientSetting(SETTINGS.RECEIVE_INTERESTS_NOTIFICATIONS)(state),
|
||||
receiveCreatorNotifications: makeSelectClientSetting(SETTINGS.RECEIVE_CREATOR_NOTIFICATIONS)(state),
|
||||
});
|
||||
|
||||
const perform = dispatch => ({
|
||||
notify: data => dispatch(doToast(data)),
|
||||
pushDrawerStack: () => dispatch(doPushDrawerStack(Constants.DRAWER_ROUTE_SETTINGS)),
|
||||
popDrawerStack: () => dispatch(doPopDrawerStack()),
|
||||
setClientSetting: (key, value) => dispatch(doSetClientSetting(key, value)),
|
||||
|
||||
+217
-13
@@ -1,12 +1,33 @@
|
||||
import React from 'react';
|
||||
import { SETTINGS } from 'lbry-redux';
|
||||
import { Text, View, ScrollView, Switch, NativeModules } from 'react-native';
|
||||
import { ActivityIndicator, Picker, Platform, Text, View, ScrollView, Switch, NativeModules } from 'react-native';
|
||||
import { navigateBack } from 'utils/helper';
|
||||
import AsyncStorage from '@react-native-community/async-storage';
|
||||
import Colors from 'styles/colors';
|
||||
import Constants from 'constants'; // eslint-disable-line node/no-deprecated-api
|
||||
import PageHeader from 'component/pageHeader';
|
||||
import RNFS from 'react-native-fs';
|
||||
import settingsStyle from 'styles/settings';
|
||||
|
||||
const languageOptions = [
|
||||
{ code: 'default', name: 'Use device language' },
|
||||
{ code: 'en', name: 'English' },
|
||||
{ code: 'gu', name: 'Gujarati' },
|
||||
{ code: 'hi', name: 'Hindi' },
|
||||
{ code: 'id', name: 'Indonesian' },
|
||||
{ code: 'it', name: 'Italian' },
|
||||
{ code: 'ms', name: 'Malay' },
|
||||
{ code: 'tr', name: 'Turkish' },
|
||||
{ code: 'pl', name: 'Polish' },
|
||||
{ code: 'pt', name: 'Portuguese' },
|
||||
{ code: 'es', name: 'Spanish' },
|
||||
];
|
||||
|
||||
class SettingsPage extends React.PureComponent {
|
||||
state = {
|
||||
downloadingLanguage: false,
|
||||
};
|
||||
|
||||
static navigationOptions = {
|
||||
title: 'Settings',
|
||||
};
|
||||
@@ -43,30 +64,110 @@ class SettingsPage extends React.PureComponent {
|
||||
}
|
||||
}
|
||||
|
||||
setNativeBooleanSetting = (key, value) => {
|
||||
const { setClientSetting } = this.props;
|
||||
setClientSetting(key, value);
|
||||
NativeModules.UtilityModule.setNativeBooleanSetting(key, value);
|
||||
};
|
||||
|
||||
getBooleanSetting = (value, defaultValue) => {
|
||||
return value === null || value === undefined ? defaultValue : value;
|
||||
};
|
||||
|
||||
handleLanguageValueChange = value => {
|
||||
const { notify, setClientSetting } = this.props;
|
||||
|
||||
let language;
|
||||
if (value === 'default') {
|
||||
language =
|
||||
Platform.OS === 'android'
|
||||
? NativeModules.I18nManager.localeIdentifier
|
||||
: NativeModules.SettingsManager.settings.AppleLocale;
|
||||
language = language ? language.substring(0, 2) : 'en';
|
||||
} else {
|
||||
language = value;
|
||||
}
|
||||
|
||||
// check the local filesystem for the language first? Or download remote strings first?
|
||||
if (language === 'en') {
|
||||
// don't attempt to download English
|
||||
NativeModules.UtilityModule.setNativeStringSetting(SETTINGS.LANGUAGE, language);
|
||||
|
||||
// update state and client setting
|
||||
window.language = language;
|
||||
setClientSetting(SETTINGS.LANGUAGE, value);
|
||||
} else {
|
||||
// download and save the language file
|
||||
this.setState({ downloadingLanguage: true }, () => {
|
||||
fetch('https://lbry.com/i18n/get/lbry-mobile/app-strings/' + language + '.json')
|
||||
.then(r => r.json())
|
||||
.then(j => {
|
||||
window.i18n_messages[language] = j;
|
||||
|
||||
// write the language file to the filesystem
|
||||
const langFilePath = RNFS.ExternalDirectoryPath + '/' + language + '.json';
|
||||
RNFS.writeFile(langFilePath, JSON.stringify(j), 'utf8');
|
||||
|
||||
// save the setting outside redux because when the first component mounts, the redux value isn't loaded yet
|
||||
// so we have to load it from native settings
|
||||
NativeModules.UtilityModule.setNativeStringSetting(SETTINGS.LANGUAGE, language);
|
||||
|
||||
// update state and client setting
|
||||
window.language = language;
|
||||
setClientSetting(SETTINGS.LANGUAGE, value);
|
||||
|
||||
this.setState({ downloadingLanguage: false });
|
||||
})
|
||||
.catch(e => {
|
||||
notify({ message: __('Failed to load %language% translations.', { language: language }), isError: true });
|
||||
this.setState({ downloadingLanguage: false });
|
||||
});
|
||||
});
|
||||
}
|
||||
};
|
||||
|
||||
handleBackPressed = () => {
|
||||
const { navigation, notify, drawerStack, popDrawerStack } = this.props;
|
||||
|
||||
if (this.state.downloadingLanguage) {
|
||||
notify({ message: 'Please wait for the language file to finish downloading' });
|
||||
return;
|
||||
}
|
||||
|
||||
navigateBack(navigation, drawerStack, popDrawerStack);
|
||||
};
|
||||
|
||||
render() {
|
||||
const {
|
||||
backgroundPlayEnabled,
|
||||
drawerStack,
|
||||
keepDaemonRunning,
|
||||
navigation,
|
||||
popDrawerStack,
|
||||
receiveSubscriptionNotifications,
|
||||
receiveRewardNotifications,
|
||||
receiveInterestsNotifications,
|
||||
receiveCreatorNotifications,
|
||||
language,
|
||||
showNsfw,
|
||||
showUriBarSuggestions,
|
||||
setClientSetting,
|
||||
} = this.props;
|
||||
|
||||
// default to true if the setting is null or undefined
|
||||
const actualKeepDaemonRunning =
|
||||
keepDaemonRunning === null || keepDaemonRunning === undefined ? true : keepDaemonRunning;
|
||||
const actualKeepDaemonRunning = this.getBooleanSetting(keepDaemonRunning, true);
|
||||
const actualReceiveSubscriptionNotifications = this.getBooleanSetting(receiveSubscriptionNotifications, true);
|
||||
const actualReceiveRewardNotifications = this.getBooleanSetting(receiveRewardNotifications, true);
|
||||
const actualReceiveInterestsNotifications = this.getBooleanSetting(receiveInterestsNotifications, true);
|
||||
const actualReceiveCreatorNotifications = this.getBooleanSetting(receiveCreatorNotifications, true);
|
||||
|
||||
return (
|
||||
<View style={settingsStyle.container}>
|
||||
<PageHeader title={'Settings'} onBackPressed={() => navigateBack(navigation, drawerStack, popDrawerStack)} />
|
||||
<PageHeader title={__('Settings')} onBackPressed={this.handleBackPressed} />
|
||||
<ScrollView style={settingsStyle.scrollContainer}>
|
||||
<Text style={settingsStyle.sectionTitle}>{__('Content')}</Text>
|
||||
<View style={settingsStyle.row}>
|
||||
<View style={settingsStyle.switchText}>
|
||||
<Text style={settingsStyle.label}>Enable background media playback</Text>
|
||||
<Text style={settingsStyle.label}>{__('Enable background media playback')}</Text>
|
||||
<Text style={settingsStyle.description}>
|
||||
Enable this option to play audio or video in the background when the app is suspended.
|
||||
{__('Enable this option to play audio or video in the background when the app is suspended.')}
|
||||
</Text>
|
||||
</View>
|
||||
<View style={settingsStyle.switchContainer}>
|
||||
@@ -77,21 +178,124 @@ class SettingsPage extends React.PureComponent {
|
||||
</View>
|
||||
</View>
|
||||
|
||||
<Text style={settingsStyle.sectionTitle}>{__('Language')}</Text>
|
||||
<View style={settingsStyle.pickerRow}>
|
||||
<View style={settingsStyle.pickerText}>
|
||||
<Text style={settingsStyle.label}>{__('Choose language')}</Text>
|
||||
</View>
|
||||
<View style={settingsStyle.pickerContainer}>
|
||||
{this.state.downloadingLanguage && <ActivityIndicator size={'small'} color={Colors.NextLbryGreen} />}
|
||||
<Picker
|
||||
enabled={!this.state.downloadingLanguage}
|
||||
selectedValue={language || 'default'}
|
||||
style={settingsStyle.languagePicker}
|
||||
itemStyle={settingsStyle.languagePickerItem}
|
||||
onValueChange={this.handleLanguageValueChange}
|
||||
>
|
||||
{languageOptions.map(option => (
|
||||
<Picker.Item label={__(option.name)} value={option.code} key={option.code} />
|
||||
))}
|
||||
</Picker>
|
||||
</View>
|
||||
</View>
|
||||
|
||||
<View style={settingsStyle.row}>
|
||||
<View style={settingsStyle.switchText}>
|
||||
<Text style={settingsStyle.label}>Show NSFW content</Text>
|
||||
<Text style={settingsStyle.label}>{__('Show mature content')}</Text>
|
||||
</View>
|
||||
<View style={settingsStyle.switchContainer}>
|
||||
<Switch value={showNsfw} onValueChange={value => setClientSetting(SETTINGS.SHOW_NSFW, value)} />
|
||||
</View>
|
||||
</View>
|
||||
|
||||
<View style={settingsStyle.sectionDivider} />
|
||||
<Text style={settingsStyle.sectionTitle}>{__('Notifications')}</Text>
|
||||
<Text style={settingsStyle.sectionDescription}>
|
||||
{__('Choose the notifications you would like to receive.')}
|
||||
</Text>
|
||||
<View style={settingsStyle.row}>
|
||||
<View style={settingsStyle.switchText}>
|
||||
<Text style={settingsStyle.label}>Keep the daemon background service running after closing the app</Text>
|
||||
<Text style={settingsStyle.label}>{__('Subscriptions')}</Text>
|
||||
</View>
|
||||
<View style={settingsStyle.switchContainer}>
|
||||
<Switch
|
||||
value={actualReceiveSubscriptionNotifications}
|
||||
onValueChange={value => {
|
||||
this.setNativeBooleanSetting(SETTINGS.RECEIVE_SUBSCRIPTION_NOTIFICATIONS, value);
|
||||
}}
|
||||
/>
|
||||
</View>
|
||||
</View>
|
||||
|
||||
<View style={settingsStyle.row}>
|
||||
<View style={settingsStyle.switchText}>
|
||||
<Text style={settingsStyle.label}>{__('Rewards')}</Text>
|
||||
</View>
|
||||
<View style={settingsStyle.switchContainer}>
|
||||
<Switch
|
||||
value={actualReceiveRewardNotifications}
|
||||
onValueChange={value => {
|
||||
this.setNativeBooleanSetting(SETTINGS.RECEIVE_REWARD_NOTIFICATIONS, value);
|
||||
}}
|
||||
/>
|
||||
</View>
|
||||
</View>
|
||||
|
||||
<View style={settingsStyle.row}>
|
||||
<View style={settingsStyle.switchText}>
|
||||
<Text style={settingsStyle.label}>{__('Content Interests')}</Text>
|
||||
</View>
|
||||
<View style={settingsStyle.switchContainer}>
|
||||
<Switch
|
||||
value={actualReceiveInterestsNotifications}
|
||||
onValueChange={value => {
|
||||
this.setNativeBooleanSetting(SETTINGS.RECEIVE_INTERESTS_NOTIFICATIONS, value);
|
||||
}}
|
||||
/>
|
||||
</View>
|
||||
</View>
|
||||
|
||||
{false && (
|
||||
<View style={settingsStyle.row}>
|
||||
<View style={settingsStyle.switchText}>
|
||||
<Text style={settingsStyle.label}>{__('Content creator tips')}</Text>
|
||||
</View>
|
||||
<View style={settingsStyle.switchContainer}>
|
||||
<Switch
|
||||
value={actualReceiveCreatorNotifications}
|
||||
onValueChange={value => {
|
||||
this.setNativeBooleanSetting(SETTINGS.RECEIVE_CREATOR_NOTIFICATIONS, value);
|
||||
}}
|
||||
/>
|
||||
</View>
|
||||
</View>
|
||||
)}
|
||||
|
||||
<View style={settingsStyle.sectionDivider} />
|
||||
<Text style={settingsStyle.sectionTitle}>{__('Search')}</Text>
|
||||
<View style={settingsStyle.row}>
|
||||
<View style={settingsStyle.switchText}>
|
||||
<Text style={settingsStyle.label}>{__('Show URL suggestions')}</Text>
|
||||
</View>
|
||||
<View style={settingsStyle.switchContainer}>
|
||||
<Switch
|
||||
value={showUriBarSuggestions}
|
||||
onValueChange={value => setClientSetting(SETTINGS.SHOW_URI_BAR_SUGGESTIONS, value)}
|
||||
/>
|
||||
</View>
|
||||
</View>
|
||||
|
||||
<View style={settingsStyle.sectionDivider} />
|
||||
<Text style={settingsStyle.sectionTitle}>{__('Other')}</Text>
|
||||
<View style={settingsStyle.row}>
|
||||
<View style={settingsStyle.switchText}>
|
||||
<Text style={settingsStyle.label}>
|
||||
{__('Keep the SDK background service running after closing the app')}
|
||||
</Text>
|
||||
<Text style={settingsStyle.description}>
|
||||
Enable this option for quicker app launch and to keep the synchronisation with the blockchain up to
|
||||
date.
|
||||
{__(
|
||||
'Enable this option for quicker app launch and to keep the synchronisation with the blockchain up to date.'
|
||||
)}
|
||||
</Text>
|
||||
</View>
|
||||
<View style={settingsStyle.switchContainer}>
|
||||
|
||||
@@ -1,5 +1,5 @@
|
||||
import { connect } from 'react-redux';
|
||||
import { doBalanceSubscribe, doUpdateBlockHeight, doToast } from 'lbry-redux';
|
||||
import { SETTINGS, doBalanceSubscribe, doUpdateBlockHeight, doPopulateSharedUserState, doToast } from 'lbry-redux';
|
||||
import {
|
||||
doAuthenticate,
|
||||
doBlackListedOutpointsSubscribe,
|
||||
@@ -23,17 +23,18 @@ const select = state => ({
|
||||
});
|
||||
|
||||
const perform = dispatch => ({
|
||||
authenticate: (appVersion, os) => dispatch(doAuthenticate(appVersion, os)),
|
||||
authenticate: (appVersion, os, firebaseToken) => dispatch(doAuthenticate(appVersion, os, firebaseToken)),
|
||||
balanceSubscribe: () => dispatch(doBalanceSubscribe()),
|
||||
blacklistedOutpointsSubscribe: () => dispatch(doBlackListedOutpointsSubscribe()),
|
||||
filteredOutpointsSubscribe: () => dispatch(doFilteredOutpointsSubscribe()),
|
||||
checkSubscriptionsInit: () => dispatch(doCheckSubscriptionsInit()),
|
||||
fetchRewardedContent: () => dispatch(doFetchRewardedContent()),
|
||||
fetchSubscriptions: callback => dispatch(doFetchMySubscriptions(callback)),
|
||||
getSync: password => dispatch(doGetSync(password)),
|
||||
getSync: (password, callback) => dispatch(doGetSync(password, callback)),
|
||||
notify: data => dispatch(doToast(data)),
|
||||
setClientSetting: (key, value) => dispatch(doSetClientSetting(key, value)),
|
||||
setEmailToVerify: email => dispatch(doUserEmailToVerify(email)),
|
||||
populateSharedUserState: settings => dispatch(doPopulateSharedUserState(settings)),
|
||||
updateBlockHeight: () => dispatch(doUpdateBlockHeight()),
|
||||
verifyUserEmail: (token, recaptcha) => dispatch(doUserEmailVerify(token, recaptcha)),
|
||||
verifyUserEmailFailure: error => dispatch(doUserEmailVerifyFailure(error)),
|
||||
|
||||
+132
-90
@@ -1,6 +1,7 @@
|
||||
import React from 'react';
|
||||
import { Lbry } from 'lbry-redux';
|
||||
import { ActivityIndicator, Linking, NativeModules, Platform, Text, View } from 'react-native';
|
||||
import { Lbry, doPreferenceGet } from 'lbry-redux';
|
||||
import { Lbryio } from 'lbryinc';
|
||||
import { ActivityIndicator, DeviceEventEmitter, Linking, NativeModules, Platform, Text, View } from 'react-native';
|
||||
import { NavigationActions, StackActions } from 'react-navigation';
|
||||
import { decode as atob } from 'base-64';
|
||||
import { navigateToUri, transformUrl } from 'utils/helper';
|
||||
@@ -12,12 +13,10 @@ import PropTypes from 'prop-types';
|
||||
import Colors from 'styles/colors';
|
||||
import Constants from 'constants'; // eslint-disable-line node/no-deprecated-api
|
||||
import splashStyle from 'styles/splash';
|
||||
import RNFS from 'react-native-fs';
|
||||
|
||||
const BLOCK_HEIGHT_INTERVAL = 1000 * 60 * 2.5; // every 2.5 minutes
|
||||
|
||||
const testingNetwork = 'Testing network';
|
||||
const waitingForResolution = 'Waiting for name resolution';
|
||||
|
||||
class SplashScreen extends React.PureComponent {
|
||||
static navigationOptions = {
|
||||
title: 'Splash',
|
||||
@@ -26,8 +25,8 @@ class SplashScreen extends React.PureComponent {
|
||||
state = {
|
||||
accountUnlockFailed: false,
|
||||
daemonReady: false,
|
||||
details: 'Starting up',
|
||||
message: 'Connecting',
|
||||
details: __('Starting up'),
|
||||
message: __('Connecting'),
|
||||
isRunning: false,
|
||||
isLagging: false,
|
||||
launchUrl: null,
|
||||
@@ -37,12 +36,6 @@ class SplashScreen extends React.PureComponent {
|
||||
subscriptionsFetched: false,
|
||||
};
|
||||
|
||||
componentWillMount() {
|
||||
if (NativeModules.DaemonServiceControl) {
|
||||
NativeModules.DaemonServiceControl.startService();
|
||||
}
|
||||
}
|
||||
|
||||
updateStatus() {
|
||||
Lbry.status().then(status => {
|
||||
this._updateStatusCallback(status);
|
||||
@@ -57,7 +50,10 @@ class SplashScreen extends React.PureComponent {
|
||||
});
|
||||
navigation.dispatch(resetAction);
|
||||
|
||||
const launchUrl = navigation.state.params.launchUrl || this.state.launchUrl;
|
||||
const launchUrl =
|
||||
navigation.state.params && navigation.state.params.launchUrl
|
||||
? navigation.state.params.launchUrl
|
||||
: this.state.launchUrl;
|
||||
if (launchUrl) {
|
||||
if (launchUrl.startsWith('lbry://?verify=')) {
|
||||
let verification = {};
|
||||
@@ -71,13 +67,13 @@ class SplashScreen extends React.PureComponent {
|
||||
try {
|
||||
verifyUserEmail(verification.token, verification.recaptcha);
|
||||
} catch (error) {
|
||||
const message = 'Invalid Verification Token';
|
||||
const message = __('Invalid Verification Token');
|
||||
verifyUserEmailFailure(message);
|
||||
notify({ message });
|
||||
}
|
||||
} else {
|
||||
notify({
|
||||
message: 'Invalid Verification URI',
|
||||
message: __('Invalid Verification URI'),
|
||||
});
|
||||
}
|
||||
} else {
|
||||
@@ -88,17 +84,18 @@ class SplashScreen extends React.PureComponent {
|
||||
|
||||
componentWillReceiveProps(nextProps) {
|
||||
const { emailToVerify, getSync, setEmailToVerify, verifyUserEmail, verifyUserEmailFailure } = this.props;
|
||||
const { daemonReady, shouldAuthenticate } = this.state;
|
||||
const { user } = nextProps;
|
||||
|
||||
if (this.state.daemonReady && this.state.shouldAuthenticate && user && user.id) {
|
||||
if (daemonReady && shouldAuthenticate && user && user.id) {
|
||||
this.setState({ shouldAuthenticate: false }, () => {
|
||||
// user is authenticated, navigate to the main view
|
||||
if (user.has_verified_email) {
|
||||
NativeModules.UtilityModule.getSecureValue(Constants.KEY_FIRST_RUN_PASSWORD).then(walletPassword => {
|
||||
if (walletPassword && walletPassword.trim().length > 0) {
|
||||
getSync(walletPassword);
|
||||
}
|
||||
this.navigateToMain();
|
||||
NativeModules.UtilityModule.getSecureValue(Constants.KEY_WALLET_PASSWORD).then(walletPassword => {
|
||||
getSync(walletPassword, () => {
|
||||
this.getUserSettings();
|
||||
this.navigateToMain();
|
||||
});
|
||||
});
|
||||
return;
|
||||
}
|
||||
@@ -108,6 +105,26 @@ class SplashScreen extends React.PureComponent {
|
||||
}
|
||||
}
|
||||
|
||||
getUserSettings = () => {
|
||||
const { populateSharedUserState } = this.props;
|
||||
|
||||
doPreferenceGet(
|
||||
'shared',
|
||||
preference => {
|
||||
populateSharedUserState(preference);
|
||||
},
|
||||
error => {
|
||||
/* failed */
|
||||
}
|
||||
);
|
||||
};
|
||||
|
||||
onNotificationTargetLaunch = evt => {
|
||||
if (evt.url && evt.url.startsWith('lbry://')) {
|
||||
this.setState({ launchUrl: evt.url });
|
||||
}
|
||||
};
|
||||
|
||||
finishSplashScreen = () => {
|
||||
const {
|
||||
authenticate,
|
||||
@@ -129,16 +146,20 @@ class SplashScreen extends React.PureComponent {
|
||||
|
||||
if (user && user.id && user.has_verified_email) {
|
||||
// user already authenticated
|
||||
NativeModules.UtilityModule.getSecureValue(Constants.KEY_FIRST_RUN_PASSWORD).then(walletPassword => {
|
||||
if (walletPassword) {
|
||||
getSync(walletPassword);
|
||||
}
|
||||
this.navigateToMain();
|
||||
NativeModules.UtilityModule.getSecureValue(Constants.KEY_WALLET_PASSWORD).then(walletPassword => {
|
||||
getSync(walletPassword, () => {
|
||||
this.getUserSettings();
|
||||
this.navigateToMain();
|
||||
});
|
||||
});
|
||||
} else {
|
||||
NativeModules.VersionInfo.getAppVersion().then(appVersion => {
|
||||
this.setState({ shouldAuthenticate: true });
|
||||
authenticate(appVersion, Platform.OS);
|
||||
NativeModules.Firebase.getMessagingToken()
|
||||
.then(firebaseToken => {
|
||||
authenticate(appVersion, Platform.OS, firebaseToken);
|
||||
})
|
||||
.catch(() => authenticate(appVersion, Platform.OS));
|
||||
});
|
||||
}
|
||||
});
|
||||
@@ -151,6 +172,8 @@ class SplashScreen extends React.PureComponent {
|
||||
_updateStatusCallback(status) {
|
||||
const { fetchSubscriptions, getSync, setClientSetting } = this.props;
|
||||
const startupStatus = status.startup_status;
|
||||
const walletStatus = status.wallet;
|
||||
|
||||
// At the minimum, wallet should be started and blocks_behind equal to 0 before calling resolve
|
||||
const hasStarted = startupStatus.stream_manager && startupStatus.wallet && status.wallet.blocks_behind <= 0;
|
||||
if (hasStarted) {
|
||||
@@ -164,43 +187,45 @@ class SplashScreen extends React.PureComponent {
|
||||
isRunning: true,
|
||||
});
|
||||
|
||||
// For now, automatically unlock the wallet if a password is set so that downloads work
|
||||
NativeModules.UtilityModule.getSecureValue(Constants.KEY_FIRST_RUN_PASSWORD).then(password => {
|
||||
if (password) {
|
||||
this.setState({
|
||||
message: 'Unlocking account',
|
||||
details: 'Decrypting wallet',
|
||||
});
|
||||
Lbry.wallet_status().then(secureWalletStatus => {
|
||||
// For now, automatically unlock the wallet if a password is set so that downloads work
|
||||
NativeModules.UtilityModule.getSecureValue(Constants.KEY_WALLET_PASSWORD).then(password => {
|
||||
if ((secureWalletStatus.is_encrypted && !secureWalletStatus.is_locked) || secureWalletStatus.is_locked) {
|
||||
this.setState({
|
||||
message: __('Unlocking account'),
|
||||
details: __('Decrypting wallet'),
|
||||
});
|
||||
|
||||
// unlock the wallet and then finish the splash screen
|
||||
Lbry.account_unlock({ password: password || '' })
|
||||
.then(() => {
|
||||
this.setState({
|
||||
message: testingNetwork,
|
||||
details: waitingForResolution,
|
||||
});
|
||||
this.finishSplashScreen();
|
||||
})
|
||||
.catch(() => this.handleAccountUnlockFailed());
|
||||
} else {
|
||||
this.setState({
|
||||
message: testingNetwork,
|
||||
details: waitingForResolution,
|
||||
});
|
||||
this.finishSplashScreen();
|
||||
}
|
||||
// unlock the wallet and then finish the splash screen
|
||||
Lbry.wallet_unlock({ password: password || '' }).then(unlocked => {
|
||||
if (unlocked) {
|
||||
this.setState({
|
||||
message: __('Testing network'),
|
||||
details: __('Waiting for name resolution'),
|
||||
});
|
||||
this.finishSplashScreen();
|
||||
} else {
|
||||
this.handleAccountUnlockFailed();
|
||||
}
|
||||
});
|
||||
} else {
|
||||
this.setState({
|
||||
message: __('Testing network'),
|
||||
details: __('Waiting for name resolution'),
|
||||
});
|
||||
this.finishSplashScreen();
|
||||
}
|
||||
});
|
||||
});
|
||||
|
||||
return;
|
||||
}
|
||||
|
||||
const blockchainHeaders = status.blockchain_headers;
|
||||
const walletStatus = status.wallet;
|
||||
|
||||
if (blockchainHeaders) {
|
||||
const headerSyncProgress = walletStatus ? walletStatus.headers_synchronization_progress : null;
|
||||
if (headerSyncProgress && headerSyncProgress < 100) {
|
||||
this.setState({
|
||||
isDownloadingHeaders: blockchainHeaders.downloading_headers,
|
||||
headersDownloadProgress: blockchainHeaders.download_progress,
|
||||
isDownloadingHeaders: true,
|
||||
headersDownloadProgress: headerSyncProgress,
|
||||
});
|
||||
} else {
|
||||
// set downloading flag to false if blockchain_headers isn't in the status response
|
||||
@@ -209,23 +234,24 @@ class SplashScreen extends React.PureComponent {
|
||||
});
|
||||
}
|
||||
|
||||
if (blockchainHeaders && blockchainHeaders.downloading_headers) {
|
||||
const downloadProgress = blockchainHeaders.download_progress ? blockchainHeaders.download_progress : 0;
|
||||
if (headerSyncProgress < 100) {
|
||||
const downloadProgress = isNaN(parseInt(headerSyncProgress, 10)) ? '0' : headerSyncProgress || '0';
|
||||
this.setState({
|
||||
message: 'Blockchain Sync',
|
||||
details: `Catching up with the blockchain (${downloadProgress}%)`,
|
||||
message: __('Blockchain Sync'),
|
||||
details: __('Catching up with the blockchain (%progress%%)', { progress: downloadProgress }),
|
||||
});
|
||||
} else if (walletStatus && walletStatus.blocks_behind > 0) {
|
||||
const behind = walletStatus.blocks_behind;
|
||||
const behindText = behind + ' block' + (behind === 1 ? '' : 's') + ' behind';
|
||||
const behindText =
|
||||
behind === 1 ? __('%num% block behind', { num: behind }) : __('%num% blocks behind', { num: behind });
|
||||
this.setState({
|
||||
message: 'Blockchain Sync',
|
||||
message: __('Blockchain Sync'),
|
||||
details: behindText,
|
||||
});
|
||||
} else {
|
||||
this.setState({
|
||||
message: 'Network Loading',
|
||||
details: 'Initializing LBRY service',
|
||||
message: __('Network Loading'),
|
||||
details: __('Initializing LBRY service'),
|
||||
});
|
||||
}
|
||||
|
||||
@@ -234,11 +260,16 @@ class SplashScreen extends React.PureComponent {
|
||||
}, 1000);
|
||||
}
|
||||
|
||||
componentDidMount() {
|
||||
if (NativeModules.Firebase) {
|
||||
NativeModules.Firebase.track('app_launch', null);
|
||||
}
|
||||
componentWillMount() {
|
||||
DeviceEventEmitter.addListener('onNotificationTargetLaunch', this.onNotificationTargetLaunch);
|
||||
}
|
||||
|
||||
componentWillUnmount() {
|
||||
DeviceEventEmitter.removeListener('onNotificationTargetLaunch', this.onNotificationTargetLaunch);
|
||||
}
|
||||
|
||||
componentDidMount() {
|
||||
NativeModules.Firebase.track('app_launch', null);
|
||||
NativeModules.Firebase.setCurrentScreen('Splash');
|
||||
|
||||
this.props.fetchRewardedContent();
|
||||
@@ -246,6 +277,27 @@ class SplashScreen extends React.PureComponent {
|
||||
if (url) {
|
||||
this.setState({ launchUrl: url });
|
||||
}
|
||||
|
||||
NativeModules.UtilityModule.getNotificationLaunchTarget().then(target => {
|
||||
if (target) {
|
||||
this.setState({ launchUrl: target });
|
||||
}
|
||||
|
||||
// Only connect after checking initial launch url / notification launch target
|
||||
Lbry.connect()
|
||||
.then(() => {
|
||||
this.updateStatus();
|
||||
})
|
||||
.catch(e => {
|
||||
this.setState({
|
||||
isLagging: true,
|
||||
message: __('Connection Failure'),
|
||||
details: __(
|
||||
'We could not establish a connection to the SDK. Your data connection may be preventing LBRY from connecting. Contact hello@lbry.com if you think this is a software bug.'
|
||||
),
|
||||
});
|
||||
});
|
||||
});
|
||||
});
|
||||
|
||||
// Start measuring the first launch time from the splash screen
|
||||
@@ -257,27 +309,14 @@ class SplashScreen extends React.PureComponent {
|
||||
AsyncStorage.setItem('firstLaunchTime', String(moment().unix()));
|
||||
}
|
||||
});
|
||||
|
||||
Lbry.connect()
|
||||
.then(() => {
|
||||
this.updateStatus();
|
||||
})
|
||||
.catch(e => {
|
||||
this.setState({
|
||||
isLagging: true,
|
||||
message: 'Connection Failure',
|
||||
details:
|
||||
'We could not establish a connection to the daemon. Your data connection may be preventing LBRY from connecting. Contact hello@lbry.com if you think this is a software bug.',
|
||||
});
|
||||
});
|
||||
}
|
||||
|
||||
handleContinueAnywayPressed = () => {
|
||||
this.setState(
|
||||
{
|
||||
accountUnlockFailed: false,
|
||||
message: testingNetwork,
|
||||
details: waitingForResolution,
|
||||
message: __('Testing network'),
|
||||
details: __('Waiting for name resolution'),
|
||||
},
|
||||
() => this.finishSplashScreen()
|
||||
);
|
||||
@@ -289,19 +328,22 @@ class SplashScreen extends React.PureComponent {
|
||||
if (accountUnlockFailed) {
|
||||
return (
|
||||
<View style={splashStyle.container}>
|
||||
<Text style={splashStyle.errorTitle}>Oops! Something went wrong.</Text>
|
||||
<Text style={splashStyle.errorTitle}>{__('Oops! Something went wrong.')}</Text>
|
||||
<Text style={splashStyle.paragraph}>
|
||||
Your wallet failed to unlock, which means you may not be able to play any videos or access your funds.
|
||||
{__(
|
||||
'Your wallet failed to unlock, which means you may not be able to play any videos or access your funds.'
|
||||
)}
|
||||
</Text>
|
||||
<Text style={splashStyle.paragraph}>
|
||||
You can try to fix this by tapping Stop on the LBRY service notification and starting the app again. If the
|
||||
problem continues, you may have to reinstall the app and restore your account.
|
||||
{__(
|
||||
'You can try to fix this by tapping Stop on the LBRY service notification and starting the app again. If the problem continues, you may have to reinstall the app and restore your account.'
|
||||
)}
|
||||
</Text>
|
||||
|
||||
<Button
|
||||
style={splashStyle.continueButton}
|
||||
theme={'light'}
|
||||
text={'Continue anyway'}
|
||||
text={__('Continue anyway')}
|
||||
onPress={this.handleContinueAnywayPressed}
|
||||
/>
|
||||
</View>
|
||||
|
||||
@@ -1,5 +1,6 @@
|
||||
import { connect } from 'react-redux';
|
||||
import {
|
||||
doChannelUnsubscribe,
|
||||
doFetchMySubscriptions,
|
||||
doSetViewMode,
|
||||
doFetchRecommendedSubscriptions,
|
||||
@@ -36,6 +37,7 @@ const select = state => ({
|
||||
});
|
||||
|
||||
const perform = dispatch => ({
|
||||
channelUnsubscribe: subscription => dispatch(doChannelUnsubscribe(subscription)),
|
||||
doFetchMySubscriptions: () => dispatch(doFetchMySubscriptions()),
|
||||
doFetchRecommendedSubscriptions: () => dispatch(doFetchRecommendedSubscriptions()),
|
||||
doSetViewMode: viewMode => dispatch(doSetViewMode(viewMode)),
|
||||
|
||||
@@ -11,7 +11,7 @@ import {
|
||||
View,
|
||||
} from 'react-native';
|
||||
import { buildURI, parseURI } from 'lbry-redux';
|
||||
import { __, getOrderBy } from 'utils/helper';
|
||||
import { getOrderBy } from 'utils/helper';
|
||||
import AsyncStorage from '@react-native-community/async-storage';
|
||||
import moment from 'moment';
|
||||
import Button from 'component/button';
|
||||
@@ -25,6 +25,7 @@ import FileItem from 'component/fileItem';
|
||||
import Icon from 'react-native-vector-icons/FontAwesome5';
|
||||
import Link from 'component/link';
|
||||
import ModalPicker from 'component/modalPicker';
|
||||
import ModalSuggestedSubscriptions from 'component/modalSuggestedSubscriptions';
|
||||
import SubscribedChannelList from 'component/subscribedChannelList';
|
||||
import SuggestedSubscriptions from 'component/suggestedSubscriptions';
|
||||
import UriBar from 'component/uriBar';
|
||||
@@ -34,6 +35,7 @@ class SubscriptionsPage extends React.PureComponent {
|
||||
showingSuggestedSubs: false,
|
||||
showSortPicker: false,
|
||||
showTimePicker: false,
|
||||
showModalSuggestedSubs: false,
|
||||
orderBy: ['release_time'],
|
||||
filteredChannels: [],
|
||||
currentSortByItem: Constants.CLAIM_SEARCH_SORT_BY_ITEMS[1], // should always default to sorting subscriptions by new
|
||||
@@ -80,6 +82,8 @@ class SubscriptionsPage extends React.PureComponent {
|
||||
if (Constants.DRAWER_ROUTE_SUBSCRIPTIONS === currentRoute && currentRoute !== prevRoute) {
|
||||
this.onComponentFocused();
|
||||
}
|
||||
|
||||
this.unsubscribeShortChannelUrls();
|
||||
}
|
||||
|
||||
handleSortByItemSelected = item => {
|
||||
@@ -107,6 +111,16 @@ class SubscriptionsPage extends React.PureComponent {
|
||||
return [Constants.ALL_PLACEHOLDER].concat(channelUris);
|
||||
};
|
||||
|
||||
// Added in 0.12.1. Can be dropped on or after 1 Feb 2020.
|
||||
unsubscribeShortChannelUrls = () => {
|
||||
// this should only have to happen once
|
||||
const { subscribedChannels, channelUnsubscribe } = this.props;
|
||||
const badSubs = subscribedChannels.filter(sub => sub.uri.split('#')[1].length < 5);
|
||||
if (badSubs.length > 0) {
|
||||
badSubs.forEach(sub => channelUnsubscribe(sub));
|
||||
}
|
||||
};
|
||||
|
||||
render() {
|
||||
const {
|
||||
suggestedChannels,
|
||||
@@ -122,7 +136,7 @@ class SubscriptionsPage extends React.PureComponent {
|
||||
unreadSubscriptions,
|
||||
navigation,
|
||||
} = this.props;
|
||||
const { currentSortByItem, filteredChannels, showSortPicker, showTimePicker } = this.state;
|
||||
const { currentSortByItem, filteredChannels, showModalSuggestedSubs, showSortPicker, showTimePicker } = this.state;
|
||||
|
||||
const numberOfSubscriptions = subscribedChannels ? subscribedChannels.length : 0;
|
||||
const hasSubscriptions = numberOfSubscriptions > 0;
|
||||
@@ -147,27 +161,35 @@ class SubscriptionsPage extends React.PureComponent {
|
||||
<View style={subscriptionsStyle.container}>
|
||||
<UriBar navigation={navigation} belowOverlay={this.state.showSortPicker} />
|
||||
<View style={subscriptionsStyle.titleRow}>
|
||||
<Text style={subscriptionsStyle.pageTitle}>Channels you follow</Text>
|
||||
<Text style={subscriptionsStyle.pageTitle}>{__('Channels you follow')}</Text>
|
||||
</View>
|
||||
{!this.state.showingSuggestedSubs && hasSubscriptions && (
|
||||
<View style={subscriptionsStyle.pickerRow}>
|
||||
<TouchableOpacity
|
||||
style={subscriptionsStyle.tagSortBy}
|
||||
onPress={() => this.setState({ showSortPicker: true })}
|
||||
>
|
||||
<Text style={subscriptionsStyle.tagSortText}>{currentSortByItem.label.split(' ')[0]}</Text>
|
||||
<Icon style={subscriptionsStyle.tagSortIcon} name={'sort-down'} size={14} />
|
||||
</TouchableOpacity>
|
||||
|
||||
{Constants.SORT_BY_TOP === currentSortByItem.name && (
|
||||
<View style={subscriptionsStyle.leftPickerRow}>
|
||||
<TouchableOpacity
|
||||
style={subscriptionsStyle.tagSortBy}
|
||||
onPress={() => this.setState({ showTimePicker: true })}
|
||||
onPress={() => this.setState({ showSortPicker: true })}
|
||||
>
|
||||
<Text style={subscriptionsStyle.tagSortText}>{timeItem.label}</Text>
|
||||
<Text style={subscriptionsStyle.tagSortText}>{__(currentSortByItem.label.split(' ')[0])}</Text>
|
||||
<Icon style={subscriptionsStyle.tagSortIcon} name={'sort-down'} size={14} />
|
||||
</TouchableOpacity>
|
||||
)}
|
||||
|
||||
{Constants.SORT_BY_TOP === currentSortByItem.name && (
|
||||
<TouchableOpacity
|
||||
style={subscriptionsStyle.tagSortBy}
|
||||
onPress={() => this.setState({ showTimePicker: true })}
|
||||
>
|
||||
<Text style={subscriptionsStyle.tagSortText}>{__(timeItem.label)}</Text>
|
||||
<Icon style={subscriptionsStyle.tagSortIcon} name={'sort-down'} size={14} />
|
||||
</TouchableOpacity>
|
||||
)}
|
||||
</View>
|
||||
|
||||
<Link
|
||||
style={subscriptionsStyle.suggestedLink}
|
||||
text={__('Suggested')}
|
||||
onPress={() => this.setState({ showModalSuggestedSubs: true })}
|
||||
/>
|
||||
</View>
|
||||
)}
|
||||
{!this.state.showingSuggestedSubs && hasSubscriptions && !loading && (
|
||||
@@ -197,7 +219,9 @@ class SubscriptionsPage extends React.PureComponent {
|
||||
<View style={subscriptionsStyle.suggestedSubsContainer}>
|
||||
{!hasSubscriptions && (
|
||||
<View style={subscriptionsStyle.infoArea}>
|
||||
<Text style={subscriptionsStyle.infoText}>You are not subscribed to any channels at the moment.</Text>
|
||||
<Text style={subscriptionsStyle.infoText}>
|
||||
{__('You are not subscribed to any channels at the moment.')}
|
||||
</Text>
|
||||
</View>
|
||||
)}
|
||||
|
||||
@@ -208,7 +232,7 @@ class SubscriptionsPage extends React.PureComponent {
|
||||
</Text>
|
||||
<Button
|
||||
style={subscriptionsStyle.button}
|
||||
text={'View my subscriptions'}
|
||||
text={__('View my subscriptions')}
|
||||
onPress={() => this.setState({ showingSuggestedSubs: false })}
|
||||
/>
|
||||
</View>
|
||||
@@ -223,13 +247,15 @@ class SubscriptionsPage extends React.PureComponent {
|
||||
</View>
|
||||
)}
|
||||
|
||||
{!showSortPicker && !showTimePicker && <FloatingWalletBalance navigation={navigation} />}
|
||||
{!showSortPicker && !showTimePicker && !showModalSuggestedSubs && (
|
||||
<FloatingWalletBalance navigation={navigation} />
|
||||
)}
|
||||
{showSortPicker && (
|
||||
<ModalPicker
|
||||
title={__('Sort content by')}
|
||||
onOverlayPress={() => this.setState({ showSortPicker: false })}
|
||||
onItemSelected={this.handleSortByItemSelected}
|
||||
selectedItem={this.state.currentSortByItem}
|
||||
selectedItem={currentSortByItem}
|
||||
items={Constants.CLAIM_SEARCH_SORT_BY_ITEMS}
|
||||
/>
|
||||
)}
|
||||
@@ -242,6 +268,13 @@ class SubscriptionsPage extends React.PureComponent {
|
||||
items={Constants.CLAIM_SEARCH_TIME_ITEMS}
|
||||
/>
|
||||
)}
|
||||
{showModalSuggestedSubs && (
|
||||
<ModalSuggestedSubscriptions
|
||||
navigation={navigation}
|
||||
onOverlayPress={() => this.setState({ showModalSuggestedSubs: false })}
|
||||
onDonePress={() => this.setState({ showModalSuggestedSubs: false })}
|
||||
/>
|
||||
)}
|
||||
</View>
|
||||
);
|
||||
}
|
||||
|
||||
@@ -105,12 +105,12 @@ class TagPage extends React.PureComponent {
|
||||
<View style={discoverStyle.pickerRow}>
|
||||
<View style={discoverStyle.leftPickerRow}>
|
||||
<TouchableOpacity style={discoverStyle.tagSortBy} onPress={() => this.setState({ showSortPicker: true })}>
|
||||
<Text style={discoverStyle.tagSortText}>{sortByItem.label.split(' ')[0]}</Text>
|
||||
<Text style={discoverStyle.tagSortText}>{__(sortByItem.label.split(' ')[0])}</Text>
|
||||
<Icon style={discoverStyle.tagSortIcon} name={'sort-down'} size={14} />
|
||||
</TouchableOpacity>
|
||||
{Constants.SORT_BY_TOP === sortByItem.name && (
|
||||
<TouchableOpacity style={discoverStyle.tagTime} onPress={() => this.setState({ showTimePicker: true })}>
|
||||
<Text style={discoverStyle.tagSortText}>{timeItem.label}</Text>
|
||||
<Text style={discoverStyle.tagSortText}>{__(timeItem.label)}</Text>
|
||||
<Icon style={discoverStyle.tagSortIcon} name={'sort-down'} size={14} />
|
||||
</TouchableOpacity>
|
||||
)}
|
||||
@@ -118,7 +118,7 @@ class TagPage extends React.PureComponent {
|
||||
|
||||
<Link
|
||||
style={discoverStyle.customizeLink}
|
||||
text={this.isFollowingTag(tag) ? 'Unfollow' : 'Follow'}
|
||||
text={this.isFollowingTag(tag) ? __('Unfollow') : __('Follow')}
|
||||
onPress={this.handleFollowTagToggle}
|
||||
/>
|
||||
</View>
|
||||
|
||||
@@ -2,6 +2,7 @@ import React from 'react';
|
||||
import { ActivityIndicator, NativeModules, View, ScrollView, Text } from 'react-native';
|
||||
import Colors from 'styles/colors';
|
||||
import Constants from 'constants'; // eslint-disable-line node/no-deprecated-api
|
||||
import EmptyStateView from 'component/emptyStateView';
|
||||
import TransactionList from 'component/transactionList';
|
||||
import UriBar from 'component/uriBar';
|
||||
import walletStyle from 'styles/wallet';
|
||||
@@ -50,14 +51,14 @@ class TransactionHistoryPage extends React.PureComponent {
|
||||
{fetchingTransactions && (
|
||||
<View style={walletStyle.loadingContainer}>
|
||||
<ActivityIndicator size={'small'} color={Colors.NextLbryGreen} />
|
||||
<Text style={walletStyle.loadingText}>Loading transactions...</Text>
|
||||
<Text style={walletStyle.loadingText}>{__('Loading transactions...')}</Text>
|
||||
</View>
|
||||
)}
|
||||
{!fetchingTransactions && transactions.length === 0 && (
|
||||
<EmptyStateView message={__('No transactions to list.')} />
|
||||
)}
|
||||
<ScrollView style={walletStyle.transactionHistoryScroll}>
|
||||
<View style={walletStyle.historyList}>
|
||||
{!fetchingTransactions && transactions.length === 0 && (
|
||||
<Text style={walletStyle.infoText}>No transactions to list.</Text>
|
||||
)}
|
||||
{!fetchingTransactions && transactions && transactions.length > 0 && (
|
||||
<TransactionList navigation={navigation} transactions={transactions} />
|
||||
)}
|
||||
|
||||
@@ -92,7 +92,7 @@ class TrendingPage extends React.PureComponent {
|
||||
return (
|
||||
<View style={discoverStyle.listHeader}>
|
||||
<View style={discoverStyle.titleRow}>
|
||||
<Text style={discoverStyle.pageTitle}>All content</Text>
|
||||
<Text style={discoverStyle.pageTitle}>{__('All Content')}</Text>
|
||||
</View>
|
||||
<View style={discoverStyle.pickerRow}>
|
||||
<View style={discoverStyle.leftPickerRow}>
|
||||
@@ -100,24 +100,24 @@ class TrendingPage extends React.PureComponent {
|
||||
style={discoverStyle.allTagSortBy}
|
||||
onPress={() => this.setState({ showSortPicker: true })}
|
||||
>
|
||||
<Text style={discoverStyle.tagSortText}>{sortByItem.label.split(' ')[0]}</Text>
|
||||
<Text style={discoverStyle.tagSortText}>{__(sortByItem.label.split(' ')[0])}</Text>
|
||||
<Icon style={discoverStyle.tagSortIcon} name={'sort-down'} size={14} />
|
||||
</TouchableOpacity>
|
||||
|
||||
<Text style={discoverStyle.pickerLabel}>for</Text>
|
||||
<Text style={discoverStyle.pickerLabel}>{__('for')}</Text>
|
||||
<TouchableOpacity
|
||||
style={discoverStyle.allTagSortBy}
|
||||
onPress={() => this.setState({ showTrendingForPicker: true })}
|
||||
>
|
||||
<Text style={discoverStyle.tagSortText}>{currentTrendingForItem.label.split(' ')[0]}</Text>
|
||||
<Text style={discoverStyle.tagSortText}>{__(currentTrendingForItem.label.split(' ')[0])}</Text>
|
||||
<Icon style={discoverStyle.tagSortIcon} name={'sort-down'} size={14} />
|
||||
</TouchableOpacity>
|
||||
|
||||
{sortByTop && <Text style={discoverStyle.pickerLabel}>from</Text>}
|
||||
{sortByTop && <Text style={discoverStyle.pickerLabel}>{__('from')}</Text>}
|
||||
|
||||
{sortByTop && (
|
||||
<TouchableOpacity style={discoverStyle.tagTime} onPress={() => this.setState({ showTimePicker: true })}>
|
||||
<Text style={discoverStyle.tagSortText}>{timeItem.label}</Text>
|
||||
<Text style={discoverStyle.tagSortText}>{__(timeItem.label)}</Text>
|
||||
<Icon style={discoverStyle.tagSortIcon} name={'sort-down'} size={14} />
|
||||
</TouchableOpacity>
|
||||
)}
|
||||
@@ -126,7 +126,7 @@ class TrendingPage extends React.PureComponent {
|
||||
{TRENDING_FOR_ITEMS[1].name === currentTrendingForItem.name && (
|
||||
<Link
|
||||
style={discoverStyle.customizeLink}
|
||||
text={'Customize'}
|
||||
text={__('Customize')}
|
||||
onPress={() => this.setState({ showModalTagSelector: true })}
|
||||
/>
|
||||
)}
|
||||
@@ -170,7 +170,7 @@ class TrendingPage extends React.PureComponent {
|
||||
)}
|
||||
{showTrendingForPicker && (
|
||||
<ModalPicker
|
||||
title={'Filter for'}
|
||||
title={__('Filter for')}
|
||||
onOverlayPress={() => this.setState({ showTrendingForPicker: false })}
|
||||
onItemSelected={this.handleTrendingForItemSelected}
|
||||
selectedItem={currentTrendingForItem}
|
||||
|
||||
@@ -1,9 +1,8 @@
|
||||
import { connect } from 'react-redux';
|
||||
import { doToast } from 'lbry-redux';
|
||||
import { doToast, doPopulateSharedUserState } from 'lbry-redux';
|
||||
import {
|
||||
doCheckSync,
|
||||
doGetSync,
|
||||
doSetDefaultAccount,
|
||||
doSyncApply,
|
||||
doUserEmailNew,
|
||||
doUserEmailToVerify,
|
||||
@@ -15,6 +14,7 @@ import {
|
||||
selectPhoneToVerify,
|
||||
selectPhoneVerifyIsPending,
|
||||
selectPhoneVerifyErrorMessage,
|
||||
selectEmailAlreadyExists,
|
||||
selectEmailNewErrorMessage,
|
||||
selectEmailNewIsPending,
|
||||
selectEmailToVerify,
|
||||
@@ -33,6 +33,7 @@ import Constants from 'constants'; // eslint-disable-line node/no-deprecated-api
|
||||
import Verification from './view';
|
||||
|
||||
const select = state => ({
|
||||
emailAlreadyExists: selectEmailAlreadyExists(state),
|
||||
emailToVerify: selectEmailToVerify(state),
|
||||
emailNewErrorMessage: selectEmailNewErrorMessage(state),
|
||||
emailNewPending: selectEmailNewIsPending(state),
|
||||
@@ -55,12 +56,12 @@ const select = state => ({
|
||||
const perform = dispatch => ({
|
||||
addUserEmail: email => dispatch(doUserEmailNew(email)),
|
||||
addUserPhone: (phone, countryCode) => dispatch(doUserPhoneNew(phone, countryCode)),
|
||||
getSync: password => dispatch(doGetSync(password)),
|
||||
getSync: (password, callback) => dispatch(doGetSync(password, callback)),
|
||||
checkSync: () => dispatch(doCheckSync()),
|
||||
verifyPhone: verificationCode => dispatch(doUserPhoneVerify(verificationCode)),
|
||||
notify: data => dispatch(doToast(data)),
|
||||
populateSharedUserState: settings => dispatch(doPopulateSharedUserState(settings)),
|
||||
setClientSetting: (key, value) => dispatch(doSetClientSetting(key, value)),
|
||||
setDefaultAccount: (success, failure) => dispatch(doSetDefaultAccount(success, failure)),
|
||||
setEmailToVerify: email => dispatch(doUserEmailToVerify(email)),
|
||||
syncApply: (hash, data, password) => dispatch(doSyncApply(hash, data, password)),
|
||||
resendVerificationEmail: email => dispatch(doUserResendVerificationEmail(email)),
|
||||
|
||||
Loaded 100 of 131 files, more files were not shown because too many files have changed in this diff.
Show more
Reference in new issue
Block a user