log publish
This commit is contained in:
parent
d5f6d494a4
commit
5d38da2d46
4 changed files with 32 additions and 5 deletions
|
@ -1,6 +1,7 @@
|
||||||
import React from 'react';
|
import React from 'react';
|
||||||
import { CLAIM_VALUES, isNameValid } from 'lbry-redux';
|
import { CLAIM_VALUES, isNameValid } from 'lbry-redux';
|
||||||
import { ActivityIndicator, NativeModules, Picker, Text, TextInput, TouchableOpacity, View } from 'react-native';
|
import { ActivityIndicator, NativeModules, Picker, Text, TextInput, TouchableOpacity, View } from 'react-native';
|
||||||
|
import { logPublish } from 'utils/helper';
|
||||||
import Button from 'component/button';
|
import Button from 'component/button';
|
||||||
import Colors from 'styles/colors';
|
import Colors from 'styles/colors';
|
||||||
import Constants from 'constants'; // eslint-disable-line node/no-deprecated-api
|
import Constants from 'constants'; // eslint-disable-line node/no-deprecated-api
|
||||||
|
@ -142,13 +143,14 @@ export default class ChannelSelector extends React.PureComponent {
|
||||||
createChannelError: undefined,
|
createChannelError: undefined,
|
||||||
});
|
});
|
||||||
|
|
||||||
const success = () => {
|
const success = channelClaim => {
|
||||||
this.setState({
|
this.setState({
|
||||||
creatingChannel: false,
|
creatingChannel: false,
|
||||||
addingChannel: false,
|
addingChannel: false,
|
||||||
currentSelectedValue: channelName,
|
currentSelectedValue: channelName,
|
||||||
showCreateChannel: false,
|
showCreateChannel: false,
|
||||||
});
|
});
|
||||||
|
logPublish(channelClaim);
|
||||||
|
|
||||||
if (onChannelChange) {
|
if (onChannelChange) {
|
||||||
onChannelChange(channelName);
|
onChannelChange(channelName);
|
||||||
|
|
|
@ -14,7 +14,7 @@ import {
|
||||||
TouchableOpacity,
|
TouchableOpacity,
|
||||||
View,
|
View,
|
||||||
} from 'react-native';
|
} from 'react-native';
|
||||||
import { navigateToUri, uploadImageAsset } from 'utils/helper';
|
import { navigateToUri, logPublish, uploadImageAsset } from 'utils/helper';
|
||||||
import Button from 'component/button';
|
import Button from 'component/button';
|
||||||
import ChannelIconItem from 'component/channelIconItem';
|
import ChannelIconItem from 'component/channelIconItem';
|
||||||
import ChannelRewardsDriver from 'component/channelRewardsDriver';
|
import ChannelRewardsDriver from 'component/channelRewardsDriver';
|
||||||
|
@ -440,7 +440,7 @@ export default class ChannelCreator extends React.PureComponent {
|
||||||
createChannelError: undefined,
|
createChannelError: undefined,
|
||||||
});
|
});
|
||||||
|
|
||||||
const success = () => {
|
const success = channelClaim => {
|
||||||
this.setState({
|
this.setState({
|
||||||
creatingChannel: false,
|
creatingChannel: false,
|
||||||
addingChannel: false,
|
addingChannel: false,
|
||||||
|
@ -448,6 +448,7 @@ export default class ChannelCreator extends React.PureComponent {
|
||||||
showCreateChannel: false,
|
showCreateChannel: false,
|
||||||
});
|
});
|
||||||
|
|
||||||
|
logPublish(channelClaim);
|
||||||
if (onChannelChange) {
|
if (onChannelChange) {
|
||||||
onChannelChange(channelName);
|
onChannelChange(channelName);
|
||||||
}
|
}
|
||||||
|
|
|
@ -43,7 +43,7 @@ import Tag from 'component/tag';
|
||||||
import TagSearch from 'component/tagSearch';
|
import TagSearch from 'component/tagSearch';
|
||||||
import UriBar from 'component/uriBar';
|
import UriBar from 'component/uriBar';
|
||||||
import publishStyle from 'styles/publish';
|
import publishStyle from 'styles/publish';
|
||||||
import { __, navigateToUri, uploadImageAsset } from 'utils/helper';
|
import { __, navigateToUri, logPublish, uploadImageAsset } from 'utils/helper';
|
||||||
|
|
||||||
const languages = {
|
const languages = {
|
||||||
en: 'English',
|
en: 'English',
|
||||||
|
@ -371,7 +371,7 @@ class PublishPage extends React.PureComponent {
|
||||||
filePath: currentMedia ? currentMedia.filePath : null,
|
filePath: currentMedia ? currentMedia.filePath : null,
|
||||||
bid: bid || 0.1,
|
bid: bid || 0.1,
|
||||||
title: title || '',
|
title: title || '',
|
||||||
thumbnail,
|
thumbnail: thumbnail || '',
|
||||||
description: description || '',
|
description: description || '',
|
||||||
language,
|
language,
|
||||||
license,
|
license,
|
||||||
|
@ -395,6 +395,11 @@ class PublishPage extends React.PureComponent {
|
||||||
|
|
||||||
handlePublishSuccess = data => {
|
handlePublishSuccess = data => {
|
||||||
const { clearPublishFormState, navigation, notify } = this.props;
|
const { clearPublishFormState, navigation, notify } = this.props;
|
||||||
|
const pendingClaim = data.outputs[0];
|
||||||
|
logPublish(pendingClaim);
|
||||||
|
|
||||||
|
// TODO: fake temp claim for claim_list_mine
|
||||||
|
|
||||||
notify({
|
notify({
|
||||||
message: `Your content was successfully published to ${this.state.uri}. It will be available in a few mintues.`,
|
message: `Your content was successfully published to ${this.state.uri}. It will be available in a few mintues.`,
|
||||||
});
|
});
|
||||||
|
@ -404,6 +409,7 @@ class PublishPage extends React.PureComponent {
|
||||||
};
|
};
|
||||||
|
|
||||||
handlePublishFailure = error => {
|
handlePublishFailure = error => {
|
||||||
|
console.log(error);
|
||||||
const { notify } = this.props;
|
const { notify } = this.props;
|
||||||
notify({ message: __('Your content could not be published at this time. Please try again.') });
|
notify({ message: __('Your content could not be published at this time. Please try again.') });
|
||||||
this.setState({ publishStarted: false });
|
this.setState({ publishStarted: false });
|
||||||
|
|
|
@ -1,5 +1,6 @@
|
||||||
import { NavigationActions, StackActions } from 'react-navigation';
|
import { NavigationActions, StackActions } from 'react-navigation';
|
||||||
import { buildURI, isURIValid, normalizeURI } from 'lbry-redux';
|
import { buildURI, isURIValid, normalizeURI } from 'lbry-redux';
|
||||||
|
import { Lbryio } from 'lbryinc';
|
||||||
import { doPopDrawerStack, doPushDrawerStack, doSetPlayerVisible } from 'redux/actions/drawer';
|
import { doPopDrawerStack, doPushDrawerStack, doSetPlayerVisible } from 'redux/actions/drawer';
|
||||||
import Constants, { DrawerRoutes, InnerDrawerRoutes } from 'constants'; // eslint-disable-line node/no-deprecated-api
|
import Constants, { DrawerRoutes, InnerDrawerRoutes } from 'constants'; // eslint-disable-line node/no-deprecated-api
|
||||||
|
|
||||||
|
@ -290,6 +291,23 @@ export function __(str) {
|
||||||
return str;
|
return str;
|
||||||
}
|
}
|
||||||
|
|
||||||
|
export function logPublish(claimResult) {
|
||||||
|
// eslint-disable-next-line no-undef
|
||||||
|
if (!__DEV__) {
|
||||||
|
const { permanent_url: uri, claim_id: claimId, txid, nout, signing_channel: signingChannel } = claimResult;
|
||||||
|
let channelClaimId;
|
||||||
|
if (signingChannel) {
|
||||||
|
channelClaimId = signingChannel.claim_id;
|
||||||
|
}
|
||||||
|
const outpoint = `${txid}:${nout}`;
|
||||||
|
const params = { uri, claim_id: claimId, outpoint };
|
||||||
|
if (channelClaimId) {
|
||||||
|
params['channel_claim_id'] = channelClaimId;
|
||||||
|
}
|
||||||
|
Lbryio.call('event', 'publish', params);
|
||||||
|
}
|
||||||
|
}
|
||||||
|
|
||||||
export function uploadImageAsset(filePath, success, failure) {
|
export function uploadImageAsset(filePath, success, failure) {
|
||||||
const makeid = () => {
|
const makeid = () => {
|
||||||
let text = '';
|
let text = '';
|
||||||
|
|
Loading…
Reference in a new issue