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 { CLAIM_VALUES, isNameValid } from 'lbry-redux';
|
||||
import { ActivityIndicator, NativeModules, Picker, Text, TextInput, TouchableOpacity, View } from 'react-native';
|
||||
import { logPublish } from 'utils/helper';
|
||||
import Button from 'component/button';
|
||||
import Colors from 'styles/colors';
|
||||
import Constants from 'constants'; // eslint-disable-line node/no-deprecated-api
|
||||
|
@ -142,13 +143,14 @@ export default class ChannelSelector extends React.PureComponent {
|
|||
createChannelError: undefined,
|
||||
});
|
||||
|
||||
const success = () => {
|
||||
const success = channelClaim => {
|
||||
this.setState({
|
||||
creatingChannel: false,
|
||||
addingChannel: false,
|
||||
currentSelectedValue: channelName,
|
||||
showCreateChannel: false,
|
||||
});
|
||||
logPublish(channelClaim);
|
||||
|
||||
if (onChannelChange) {
|
||||
onChannelChange(channelName);
|
||||
|
|
|
@ -14,7 +14,7 @@ import {
|
|||
TouchableOpacity,
|
||||
View,
|
||||
} from 'react-native';
|
||||
import { navigateToUri, uploadImageAsset } from 'utils/helper';
|
||||
import { navigateToUri, logPublish, uploadImageAsset } from 'utils/helper';
|
||||
import Button from 'component/button';
|
||||
import ChannelIconItem from 'component/channelIconItem';
|
||||
import ChannelRewardsDriver from 'component/channelRewardsDriver';
|
||||
|
@ -440,7 +440,7 @@ export default class ChannelCreator extends React.PureComponent {
|
|||
createChannelError: undefined,
|
||||
});
|
||||
|
||||
const success = () => {
|
||||
const success = channelClaim => {
|
||||
this.setState({
|
||||
creatingChannel: false,
|
||||
addingChannel: false,
|
||||
|
@ -448,6 +448,7 @@ export default class ChannelCreator extends React.PureComponent {
|
|||
showCreateChannel: false,
|
||||
});
|
||||
|
||||
logPublish(channelClaim);
|
||||
if (onChannelChange) {
|
||||
onChannelChange(channelName);
|
||||
}
|
||||
|
|
|
@ -43,7 +43,7 @@ import Tag from 'component/tag';
|
|||
import TagSearch from 'component/tagSearch';
|
||||
import UriBar from 'component/uriBar';
|
||||
import publishStyle from 'styles/publish';
|
||||
import { __, navigateToUri, uploadImageAsset } from 'utils/helper';
|
||||
import { __, navigateToUri, logPublish, uploadImageAsset } from 'utils/helper';
|
||||
|
||||
const languages = {
|
||||
en: 'English',
|
||||
|
@ -371,7 +371,7 @@ class PublishPage extends React.PureComponent {
|
|||
filePath: currentMedia ? currentMedia.filePath : null,
|
||||
bid: bid || 0.1,
|
||||
title: title || '',
|
||||
thumbnail,
|
||||
thumbnail: thumbnail || '',
|
||||
description: description || '',
|
||||
language,
|
||||
license,
|
||||
|
@ -395,6 +395,11 @@ class PublishPage extends React.PureComponent {
|
|||
|
||||
handlePublishSuccess = data => {
|
||||
const { clearPublishFormState, navigation, notify } = this.props;
|
||||
const pendingClaim = data.outputs[0];
|
||||
logPublish(pendingClaim);
|
||||
|
||||
// TODO: fake temp claim for claim_list_mine
|
||||
|
||||
notify({
|
||||
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 => {
|
||||
console.log(error);
|
||||
const { notify } = this.props;
|
||||
notify({ message: __('Your content could not be published at this time. Please try again.') });
|
||||
this.setState({ publishStarted: false });
|
||||
|
|
|
@ -1,5 +1,6 @@
|
|||
import { NavigationActions, StackActions } from 'react-navigation';
|
||||
import { buildURI, isURIValid, normalizeURI } from 'lbry-redux';
|
||||
import { Lbryio } from 'lbryinc';
|
||||
import { doPopDrawerStack, doPushDrawerStack, doSetPlayerVisible } from 'redux/actions/drawer';
|
||||
import Constants, { DrawerRoutes, InnerDrawerRoutes } from 'constants'; // eslint-disable-line node/no-deprecated-api
|
||||
|
||||
|
@ -290,6 +291,23 @@ export function __(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) {
|
||||
const makeid = () => {
|
||||
let text = '';
|
||||
|
|
Loading…
Reference in a new issue