Unverified Commit 736de8e5 authored by Akinwale Ariwodola's avatar Akinwale Ariwodola Committed by GitHub
Browse files

Merge pull request #121 from lbryio/invite-no-channels

Invite link with no channels
parents f06252d3 f81e2d74
...@@ -21,7 +21,7 @@ import RewardCard from 'component/rewardCard'; ...@@ -21,7 +21,7 @@ import RewardCard from 'component/rewardCard';
import RewardEnrolment from 'component/rewardEnrolment'; import RewardEnrolment from 'component/rewardEnrolment';
import UriBar from 'component/uriBar'; import UriBar from 'component/uriBar';
import invitesStyle from 'styles/invites'; import invitesStyle from 'styles/invites';
import { logPublish } from 'utils/helper'; import { fetchReferralCode, logPublish } from 'utils/helper';
class InvitesPage extends React.PureComponent { class InvitesPage extends React.PureComponent {
state = { state = {
...@@ -48,7 +48,19 @@ class InvitesPage extends React.PureComponent { ...@@ -48,7 +48,19 @@ class InvitesPage extends React.PureComponent {
pushDrawerStack(); pushDrawerStack();
setPlayerVisible(); setPlayerVisible();
NativeModules.Firebase.setCurrentScreen('Invites').then(result => { NativeModules.Firebase.setCurrentScreen('Invites').then(result => {
fetchChannelListMine(); fetchReferralCode(
response => {
if (response && response.length > 0) {
// only need to use the first referral code.
// inviteLink will be updated after channels are loaded (if the user has created at least one channel)
this.setState({ inviteLink: `https://lbry.tv/$/invite/${response[0]}` });
}
fetchChannelListMine();
},
error => {
fetchChannelListMine();
},
);
fetchInviteStatus(); fetchInviteStatus();
}); });
}; };
......
...@@ -410,3 +410,17 @@ export function formatTitle(title) { ...@@ -410,3 +410,17 @@ export function formatTitle(title) {
return title.length > 80 ? title.substring(0, 77).trim() + '...' : title; return title.length > 80 ? title.substring(0, 77).trim() + '...' : title;
} }
export function fetchReferralCode(successCallback, errorCallback) {
Lbryio.call('user_referral_code', 'list')
.then(response => {
if (successCallback) {
successCallback(response);
}
})
.catch(err => {
if (errorCallback) {
errorCallback(err);
}
});
}
Markdown is supported
0% or .
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment