cleanup - broken?
This commit is contained in:
parent
f9325a816e
commit
d6335464d3
4 changed files with 44 additions and 26 deletions
|
@ -136,7 +136,7 @@
|
||||||
"imagesloaded": "^4.1.4",
|
"imagesloaded": "^4.1.4",
|
||||||
"json-loader": "^0.5.4",
|
"json-loader": "^0.5.4",
|
||||||
"lbry-format": "https://github.com/lbryio/lbry-format.git",
|
"lbry-format": "https://github.com/lbryio/lbry-format.git",
|
||||||
"lbry-redux": "lbryio/lbry-redux#67d8540ccc0fbedf018ae0bdfe3cae17660a5a6c",
|
"lbry-redux": "lbryio/lbry-redux#1523bbd33fa215bedebc15bbf2b71a3f7c837a5b",
|
||||||
"lbryinc": "lbryio/lbryinc#cff5dd60934c4c6080e135f47ebbece1548c658c",
|
"lbryinc": "lbryio/lbryinc#cff5dd60934c4c6080e135f47ebbece1548c658c",
|
||||||
"lint-staged": "^7.0.2",
|
"lint-staged": "^7.0.2",
|
||||||
"localforage": "^1.7.1",
|
"localforage": "^1.7.1",
|
||||||
|
|
|
@ -7,7 +7,6 @@ import Button from 'component/button';
|
||||||
import { LbryFirst } from 'lbry-redux';
|
import { LbryFirst } from 'lbry-redux';
|
||||||
import LicenseType from './license-type';
|
import LicenseType from './license-type';
|
||||||
import Card from 'component/common/card';
|
import Card from 'component/common/card';
|
||||||
import { getAuthToken } from 'util/saved-passwords';
|
|
||||||
import ErrorText from 'component/common/error-text';
|
import ErrorText from 'component/common/error-text';
|
||||||
// @if TARGET='app'
|
// @if TARGET='app'
|
||||||
import { ipcRenderer } from 'electron';
|
import { ipcRenderer } from 'electron';
|
||||||
|
@ -39,18 +38,20 @@ function PublishAdditionalOptions(props: Props) {
|
||||||
updatePublishForm,
|
updatePublishForm,
|
||||||
useLBRYUploader,
|
useLBRYUploader,
|
||||||
needsYTAuth,
|
needsYTAuth,
|
||||||
|
accessToken,
|
||||||
|
fetchAccessToken,
|
||||||
} = props;
|
} = props;
|
||||||
const [hideSection, setHideSection] = usePersistedState('publish-advanced-options', true);
|
const [hideSection, setHideSection] = usePersistedState('publish-advanced-options', true);
|
||||||
const [hasLaunchedLbryFirst, setHasLaunchedLbryFirst] = React.useState(false);
|
const [hasLaunchedLbryFirst, setHasLaunchedLbryFirst] = React.useState(false);
|
||||||
const [ytError, setYtError] = React.useState(true);
|
const [ytError, setYtError] = React.useState(false);
|
||||||
const isLBRYFirstUser = user && user.lbry_first_approved;
|
const isLBRYFirstUser = user && user.lbry_first_approved;
|
||||||
const showLbryFirstCheckbox = !IS_WEB && isLBRYFirstUser && hasLaunchedLbryFirst;
|
const showLbryFirstCheckbox = !IS_WEB && isLBRYFirstUser && hasLaunchedLbryFirst;
|
||||||
const authToken = getAuthToken();
|
|
||||||
|
|
||||||
function toggleHideSection() {
|
function toggleHideSection() {
|
||||||
setHideSection(!hideSection);
|
setHideSection(!hideSection);
|
||||||
}
|
}
|
||||||
|
|
||||||
|
// @if TARGET='app'
|
||||||
function signup() {
|
function signup() {
|
||||||
updatePublishForm({ ytSignupPending: true });
|
updatePublishForm({ ytSignupPending: true });
|
||||||
LbryFirst.ytSignup()
|
LbryFirst.ytSignup()
|
||||||
|
@ -65,6 +66,8 @@ function PublishAdditionalOptions(props: Props) {
|
||||||
}
|
}
|
||||||
|
|
||||||
function unlink() {
|
function unlink() {
|
||||||
|
setYtError(false);
|
||||||
|
|
||||||
LbryFirst.remove()
|
LbryFirst.remove()
|
||||||
.then(response => {
|
.then(response => {
|
||||||
updatePublishForm({ needsYTAuth: true });
|
updatePublishForm({ needsYTAuth: true });
|
||||||
|
@ -76,17 +79,23 @@ function PublishAdditionalOptions(props: Props) {
|
||||||
}
|
}
|
||||||
|
|
||||||
React.useEffect(() => {
|
React.useEffect(() => {
|
||||||
if (isLBRYFirstUser) {
|
if (!accessToken) {
|
||||||
|
fetchAccessToken();
|
||||||
|
}
|
||||||
|
}, [accessToken, fetchAccessToken]);
|
||||||
|
|
||||||
|
React.useEffect(() => {
|
||||||
|
if (isLBRYFirstUser && !hasLaunchedLbryFirst) {
|
||||||
ipcRenderer.send('launch-lbry-first');
|
ipcRenderer.send('launch-lbry-first');
|
||||||
ipcRenderer.on('lbry-first-launched', () => {
|
ipcRenderer.on('lbry-first-launched', () => {
|
||||||
setHasLaunchedLbryFirst(true);
|
setHasLaunchedLbryFirst(true);
|
||||||
});
|
});
|
||||||
}
|
}
|
||||||
}, [isLBRYFirstUser, setHasLaunchedLbryFirst]);
|
}, [isLBRYFirstUser, hasLaunchedLbryFirst, setHasLaunchedLbryFirst]);
|
||||||
|
|
||||||
React.useEffect(() => {
|
React.useEffect(() => {
|
||||||
if (useLBRYUploader) {
|
if (useLBRYUploader && isLBRYFirstUser && hasLaunchedLbryFirst && accessToken) {
|
||||||
LbryFirst.hasYTAuth(authToken)
|
LbryFirst.hasYTAuth(accessToken)
|
||||||
.then(response => {
|
.then(response => {
|
||||||
updatePublishForm({ needsYTAuth: !response.HasAuth });
|
updatePublishForm({ needsYTAuth: !response.HasAuth });
|
||||||
})
|
})
|
||||||
|
@ -95,7 +104,8 @@ function PublishAdditionalOptions(props: Props) {
|
||||||
console.error(error); // eslint-disable-line
|
console.error(error); // eslint-disable-line
|
||||||
});
|
});
|
||||||
}
|
}
|
||||||
}, [authToken, updatePublishForm, useLBRYUploader]);
|
}, [updatePublishForm, useLBRYUploader, isLBRYFirstUser, hasLaunchedLbryFirst, accessToken]);
|
||||||
|
// @endif
|
||||||
|
|
||||||
return (
|
return (
|
||||||
<Card
|
<Card
|
||||||
|
@ -103,8 +113,9 @@ function PublishAdditionalOptions(props: Props) {
|
||||||
<React.Fragment>
|
<React.Fragment>
|
||||||
{!hideSection && (
|
{!hideSection && (
|
||||||
<div className={classnames({ 'card--disabled': !name })}>
|
<div className={classnames({ 'card--disabled': !name })}>
|
||||||
<div className="section">
|
{/* @if TARGET='app' */}
|
||||||
{showLbryFirstCheckbox && (
|
{showLbryFirstCheckbox && (
|
||||||
|
<div className="section">
|
||||||
<>
|
<>
|
||||||
<FormField
|
<FormField
|
||||||
checked={useLBRYUploader}
|
checked={useLBRYUploader}
|
||||||
|
@ -134,8 +145,9 @@ function PublishAdditionalOptions(props: Props) {
|
||||||
</div>
|
</div>
|
||||||
)}
|
)}
|
||||||
</>
|
</>
|
||||||
)}
|
</div>
|
||||||
</div>
|
)}
|
||||||
|
{/* @endif */}
|
||||||
<div className="section">
|
<div className="section">
|
||||||
<FormField
|
<FormField
|
||||||
label={__('Language')}
|
label={__('Language')}
|
||||||
|
|
|
@ -213,8 +213,6 @@ function PublishForm(props: Props) {
|
||||||
</div>
|
</div>
|
||||||
)}
|
)}
|
||||||
<section>
|
<section>
|
||||||
{!formDisabled && !formValid && <PublishFormErrors />}
|
|
||||||
|
|
||||||
<div className="card__actions">
|
<div className="card__actions">
|
||||||
<Button
|
<Button
|
||||||
button="primary"
|
button="primary"
|
||||||
|
@ -227,15 +225,23 @@ function PublishForm(props: Props) {
|
||||||
<Button button="link" onClick={clearPublish} label={__('Cancel')} />
|
<Button button="link" onClick={clearPublish} label={__('Cancel')} />
|
||||||
</div>
|
</div>
|
||||||
<p className="help">
|
<p className="help">
|
||||||
<I18nMessage
|
{!formDisabled && !formValid ? (
|
||||||
tokens={{
|
<PublishFormErrors />
|
||||||
lbry_terms_of_service: (
|
) : (
|
||||||
<Button button="link" href="https://www.lbry.com/termsofservice" label={__('LBRY Terms of Service')} />
|
<I18nMessage
|
||||||
),
|
tokens={{
|
||||||
}}
|
lbry_terms_of_service: (
|
||||||
>
|
<Button
|
||||||
By continuing, you accept the %lbry_terms_of_service%.
|
button="link"
|
||||||
</I18nMessage>
|
href="https://www.lbry.com/termsofservice"
|
||||||
|
label={__('LBRY Terms of Service')}
|
||||||
|
/>
|
||||||
|
),
|
||||||
|
}}
|
||||||
|
>
|
||||||
|
By continuing, you accept the %lbry_terms_of_service%.
|
||||||
|
</I18nMessage>
|
||||||
|
)}
|
||||||
</p>
|
</p>
|
||||||
</section>
|
</section>
|
||||||
</div>
|
</div>
|
||||||
|
|
|
@ -6383,9 +6383,9 @@ lazy-val@^1.0.4:
|
||||||
yargs "^13.2.2"
|
yargs "^13.2.2"
|
||||||
zstd-codec "^0.1.1"
|
zstd-codec "^0.1.1"
|
||||||
|
|
||||||
lbry-redux@lbryio/lbry-redux#67d8540ccc0fbedf018ae0bdfe3cae17660a5a6c:
|
lbry-redux@lbryio/lbry-redux#1523bbd33fa215bedebc15bbf2b71a3f7c837a5b:
|
||||||
version "0.0.1"
|
version "0.0.1"
|
||||||
resolved "https://codeload.github.com/lbryio/lbry-redux/tar.gz/67d8540ccc0fbedf018ae0bdfe3cae17660a5a6c"
|
resolved "https://codeload.github.com/lbryio/lbry-redux/tar.gz/1523bbd33fa215bedebc15bbf2b71a3f7c837a5b"
|
||||||
dependencies:
|
dependencies:
|
||||||
proxy-polyfill "0.1.6"
|
proxy-polyfill "0.1.6"
|
||||||
reselect "^3.0.0"
|
reselect "^3.0.0"
|
||||||
|
|
Loading…
Add table
Reference in a new issue