From 8e377d0e742b1eb158630088a16211b97fdc6f69 Mon Sep 17 00:00:00 2001 From: Michael Tintiuc Date: Sat, 1 Feb 2020 15:44:04 +0200 Subject: [PATCH 1/4] Fixes #116. Listen to audio focus change --- src/component/mediaPlayer/view.js | 9 +++++++-- 1 file changed, 7 insertions(+), 2 deletions(-) diff --git a/src/component/mediaPlayer/view.js b/src/component/mediaPlayer/view.js index 53af706..e9e0acf 100644 --- a/src/component/mediaPlayer/view.js +++ b/src/component/mediaPlayer/view.js @@ -167,7 +167,7 @@ class MediaPlayer extends React.PureComponent { togglePlay = () => { this.showPlayerControls(); - this.setState({ paused: !this.state.paused }, this.handlePausedState); + this.setState({ paused: !this.state.paused }, this.updateBackgroundMediaNotification); }; handlePausedState = () => { @@ -188,7 +188,7 @@ class MediaPlayer extends React.PureComponent { }; onEnd = () => { - this.setState({ paused: true }); + this.setState({ paused: true }, this.updateBackgroundMediaNotification); if (this.props.onPlaybackFinished) { this.props.onPlaybackFinished(); } @@ -327,6 +327,10 @@ class MediaPlayer extends React.PureComponent { } }; + onFocusChanged = evt => { + this.setState({ paused: !(this.state.paused && evt.hasAudioFocus) }, this.updateBackgroundMediaNotification); + }; + onBuffer = () => { if (!this.state.paused) { this.setState({ buffering: true }, () => this.manualHidePlayerControls()); @@ -469,6 +473,7 @@ class MediaPlayer extends React.PureComponent { onEnd={this.onEnd} onError={this.onError} minLoadRetryCount={999} + onAudioFocusChanged={this.onFocusChanged} /> {this.state.firstPlay && thumbnail && ( -- 2.45.3 From 4656be64a7408b76074e202d81913938d9d4972e Mon Sep 17 00:00:00 2001 From: YULIUS KURNIAWAN KRISTIANTO Date: Mon, 3 Feb 2020 04:40:41 +0700 Subject: [PATCH 2/4] Update LICENSE update year --- LICENSE | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/LICENSE b/LICENSE index eb958df..a293e51 100644 --- a/LICENSE +++ b/LICENSE @@ -1,6 +1,6 @@ The MIT License (MIT) -Copyright (c) 2017-2019 LBRY Inc +Copyright (c) 2017-2020 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: -- 2.45.3 From 81bdd37576ad96e91b9e6fb294ba29e474b52a1f Mon Sep 17 00:00:00 2001 From: Akinwale Ariwodola Date: Mon, 10 Feb 2020 12:38:20 +0100 Subject: [PATCH 3/4] call publish endpoint with selected channel on invites page --- src/page/invites/view.js | 3 +++ 1 file changed, 3 insertions(+) diff --git a/src/page/invites/view.js b/src/page/invites/view.js index efdf761..faa87f9 100644 --- a/src/page/invites/view.js +++ b/src/page/invites/view.js @@ -21,6 +21,7 @@ import RewardCard from 'component/rewardCard'; import RewardEnrolment from 'component/rewardEnrolment'; import UriBar from 'component/uriBar'; import invitesStyle from 'styles/invites'; +import { logPublish } from 'utils/helper'; class InvitesPage extends React.PureComponent { state = { @@ -62,6 +63,7 @@ class InvitesPage extends React.PureComponent { const filtered = channels.filter(c => c.name === channelName); if (filtered.length > 0) { const channel = filtered[0]; + logPublish(channel); this.setState({ channelName, inviteLink: this.getLinkForChannel(channel) }); } } @@ -96,6 +98,7 @@ class InvitesPage extends React.PureComponent { if (!this.state.channelName && channels && channels.length > 0) { const firstChannel = channels[0]; + logPublish(firstChannel); this.setState({ channelName: firstChannel.name, inviteLink: this.getLinkForChannel(firstChannel) }); } -- 2.45.3 From f81e2d74417cd60ecb2dcb5900fdbb8c94192e6b Mon Sep 17 00:00:00 2001 From: Akinwale Ariwodola Date: Mon, 10 Feb 2020 12:54:35 +0100 Subject: [PATCH 4/4] generate default invite link if no channels are present --- src/page/invites/view.js | 16 ++++++++++++++-- src/utils/helper.js | 14 ++++++++++++++ 2 files changed, 28 insertions(+), 2 deletions(-) diff --git a/src/page/invites/view.js b/src/page/invites/view.js index faa87f9..098d1f4 100644 --- a/src/page/invites/view.js +++ b/src/page/invites/view.js @@ -21,7 +21,7 @@ import RewardCard from 'component/rewardCard'; import RewardEnrolment from 'component/rewardEnrolment'; import UriBar from 'component/uriBar'; import invitesStyle from 'styles/invites'; -import { logPublish } from 'utils/helper'; +import { fetchReferralCode, logPublish } from 'utils/helper'; class InvitesPage extends React.PureComponent { state = { @@ -48,7 +48,19 @@ class InvitesPage extends React.PureComponent { pushDrawerStack(); setPlayerVisible(); 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(); }); }; diff --git a/src/utils/helper.js b/src/utils/helper.js index 49e2f62..71b7193 100644 --- a/src/utils/helper.js +++ b/src/utils/helper.js @@ -400,3 +400,17 @@ export function formatTitle(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); + } + }); +} -- 2.45.3