diff --git a/src/page/publish/index.js b/src/page/publish/index.js index daf7e76..41094a2 100644 --- a/src/page/publish/index.js +++ b/src/page/publish/index.js @@ -1,6 +1,7 @@ import { connect } from 'react-redux'; import { doPublish, + doFetchClaimListMine, doResolveUri, doToast, doUpdatePublishForm, @@ -27,6 +28,7 @@ const select = state => ({ const perform = dispatch => ({ notify: data => dispatch(doToast(data)), clearPublishFormState: () => dispatch(doClearPublishFormState()), + fetchMyClaims: () => dispatch(doFetchClaimListMine()), pendingPublishSuccess: pendingClaim => dispatch(doPendingPublishSuccess(pendingClaim)), updatePublishForm: value => dispatch(doUpdatePublishForm(value)), updatePublishFormState: data => dispatch(doUpdatePublishFormState(data)), @@ -39,5 +41,5 @@ const perform = dispatch => ({ export default connect( select, - perform + perform, )(PublishPage); diff --git a/src/page/publish/view.js b/src/page/publish/view.js index 816d3e7..56504e4 100644 --- a/src/page/publish/view.js +++ b/src/page/publish/view.js @@ -209,7 +209,7 @@ class PublishPage extends React.PureComponent { }; onComponentFocused = () => { - const { balance, hasFormState, pushDrawerStack, setPlayerVisible, navigation } = this.props; + const { balance, fetchMyClaims, hasFormState, pushDrawerStack, setPlayerVisible, navigation } = this.props; NativeModules.Firebase.setCurrentScreen('Publish').then(result => { pushDrawerStack(Constants.DRAWER_ROUTE_PUBLISH, navigation.state.params ? navigation.state.params : null); setPlayerVisible(); @@ -219,6 +219,7 @@ class PublishPage extends React.PureComponent { NativeModules.Gallery.canUseCamera().then(canUseCamera => this.setState({ canUseCamera })); NativeModules.Gallery.getThumbnailPath().then(thumbnailPath => this.setState({ thumbnailPath })); + fetchMyClaims(); NativeModules.UtilityModule.canReadWriteStorage().then(canReadWrite => { if (!canReadWrite) { @@ -356,7 +357,7 @@ class PublishPage extends React.PureComponent { }; handlePublishPressed = () => { - const { balance, notify, publish, updatePublishForm } = this.props; + const { balance, myClaims, notify, publish, updatePublishForm } = this.props; const { editMode, bid, @@ -400,6 +401,14 @@ class PublishPage extends React.PureComponent { if (!isNameValid(name, false)) { notify({ message: __('Your content address contains invalid characters.'), isError: true }); return; + } else if (myClaims && myClaims.length > 0) { + if (myClaims.some(claim => claim.name.toLowerCase() === name.trim().toLowerCase())) { + notify({ + message: __('You have already published to the specified content address. Please enter a new address.'), + isError: true, + }); + return; + } } if (!currentMedia && !editMode) { @@ -628,7 +637,7 @@ class PublishPage extends React.PureComponent { } } else { // could not determine the file path - notify({ message: __('The path could not be determined. Please try a different file.') }); + notify({ message: __('The path could not be determined. Please try a different file.'), isError: true }); } }; diff --git a/src/page/splash/view.js b/src/page/splash/view.js index 7819f88..7bfbf9f 100644 --- a/src/page/splash/view.js +++ b/src/page/splash/view.js @@ -59,10 +59,12 @@ class SplashScreen extends React.PureComponent { } else if (lastRouteInStack) { // no launch url, check if there's a last route in stack to navigate to. const { route, params } = lastRouteInStack; - if (!DrawerRoutes.includes(route) && isURIValid(route)) { - navigateToUri(navigation, route); - } else { - navigation.navigate({ routeName: route, params }); + if (route) { + if (!DrawerRoutes.includes(route) && isURIValid(route)) { + navigateToUri(navigation, route); + } else { + navigation.navigate({ routeName: route, params }); + } } } };