Support for superchats #406
4 changed files with 24 additions and 40 deletions
8
dist/bundle.es.js
vendored
8
dist/bundle.es.js
vendored
|
@ -3117,7 +3117,7 @@ function doSetDraftTransactionAddress(address) {
|
||||||
};
|
};
|
||||||
}
|
}
|
||||||
|
|
||||||
function doSendTip(params, isSupport, successCallback, errorCallback) {
|
function doSendTip(params, isSupport, successCallback, errorCallback, shouldNotify = true) {
|
||||||
return (dispatch, getState) => {
|
return (dispatch, getState) => {
|
||||||
const state = getState();
|
const state = getState();
|
||||||
const balance = selectBalance(state);
|
const balance = selectBalance(state);
|
||||||
|
@ -3133,19 +3133,21 @@ function doSendTip(params, isSupport, successCallback, errorCallback) {
|
||||||
return;
|
return;
|
||||||
}
|
}
|
||||||
|
|
||||||
const success = () => {
|
const success = response => {
|
||||||
|
if (shouldNotify) {
|
||||||
dispatch(doToast({
|
dispatch(doToast({
|
||||||
message: shouldSupport ? __('You deposited %amount% LBRY Credits as a support!', { amount: params.amount }) : __('You sent %amount% LBRY Credits as a tip, Mahalo!', { amount: params.amount }),
|
message: shouldSupport ? __('You deposited %amount% LBRY Credits as a support!', { amount: params.amount }) : __('You sent %amount% LBRY Credits as a tip, Mahalo!', { amount: params.amount }),
|
||||||
linkText: __('History'),
|
linkText: __('History'),
|
||||||
linkTarget: '/wallet'
|
linkTarget: '/wallet'
|
||||||
}));
|
}));
|
||||||
|
}
|
||||||
|
|
||||||
dispatch({
|
dispatch({
|
||||||
type: SUPPORT_TRANSACTION_COMPLETED
|
type: SUPPORT_TRANSACTION_COMPLETED
|
||||||
});
|
});
|
||||||
|
|
||||||
if (successCallback) {
|
if (successCallback) {
|
||||||
successCallback();
|
successCallback(response);
|
||||||
}
|
}
|
||||||
};
|
};
|
||||||
|
|
||||||
|
|
10
dist/flow-typed/Lbry.js
vendored
10
dist/flow-typed/Lbry.js
vendored
|
@ -124,14 +124,6 @@ declare type ChannelUpdateResponse = GenericTxResponse & {
|
||||||
declare type CommentCreateResponse = Comment;
|
declare type CommentCreateResponse = Comment;
|
||||||
declare type CommentUpdateResponse = Comment;
|
declare type CommentUpdateResponse = Comment;
|
||||||
|
|
||||||
declare type CommentListResponse = {
|
|
||||||
items: Array<Comment>,
|
|
||||||
page: number,
|
|
||||||
page_size: number,
|
|
||||||
total_items: number,
|
|
||||||
total_pages: number,
|
|
||||||
};
|
|
||||||
|
|
||||||
declare type MyReactions = {
|
declare type MyReactions = {
|
||||||
// Keys are the commentId
|
// Keys are the commentId
|
||||||
[string]: Array<string>,
|
[string]: Array<string>,
|
||||||
|
@ -308,8 +300,6 @@ declare type LbryTypes = {
|
||||||
preference_set: (params: {}) => Promise<any>,
|
preference_set: (params: {}) => Promise<any>,
|
||||||
|
|
||||||
// Commenting
|
// Commenting
|
||||||
comment_list: (params: {}) => Promise<CommentListResponse>,
|
|
||||||
comment_create: (params: {}) => Promise<CommentCreateResponse>,
|
|
||||||
comment_update: (params: {}) => Promise<CommentUpdateResponse>,
|
comment_update: (params: {}) => Promise<CommentUpdateResponse>,
|
||||||
comment_hide: (params: {}) => Promise<CommentHideResponse>,
|
comment_hide: (params: {}) => Promise<CommentHideResponse>,
|
||||||
comment_abandon: (params: {}) => Promise<CommentAbandonResponse>,
|
comment_abandon: (params: {}) => Promise<CommentAbandonResponse>,
|
||||||
|
|
10
flow-typed/Lbry.js
vendored
10
flow-typed/Lbry.js
vendored
|
@ -124,14 +124,6 @@ declare type ChannelUpdateResponse = GenericTxResponse & {
|
||||||
declare type CommentCreateResponse = Comment;
|
declare type CommentCreateResponse = Comment;
|
||||||
declare type CommentUpdateResponse = Comment;
|
declare type CommentUpdateResponse = Comment;
|
||||||
|
|
||||||
declare type CommentListResponse = {
|
|
||||||
items: Array<Comment>,
|
|
||||||
page: number,
|
|
||||||
page_size: number,
|
|
||||||
total_items: number,
|
|
||||||
total_pages: number,
|
|
||||||
};
|
|
||||||
|
|
||||||
declare type MyReactions = {
|
declare type MyReactions = {
|
||||||
// Keys are the commentId
|
// Keys are the commentId
|
||||||
[string]: Array<string>,
|
[string]: Array<string>,
|
||||||
|
@ -308,8 +300,6 @@ declare type LbryTypes = {
|
||||||
preference_set: (params: {}) => Promise<any>,
|
preference_set: (params: {}) => Promise<any>,
|
||||||
|
|
||||||
// Commenting
|
// Commenting
|
||||||
comment_list: (params: {}) => Promise<CommentListResponse>,
|
|
||||||
comment_create: (params: {}) => Promise<CommentCreateResponse>,
|
|
||||||
comment_update: (params: {}) => Promise<CommentUpdateResponse>,
|
comment_update: (params: {}) => Promise<CommentUpdateResponse>,
|
||||||
comment_hide: (params: {}) => Promise<CommentHideResponse>,
|
comment_hide: (params: {}) => Promise<CommentHideResponse>,
|
||||||
comment_abandon: (params: {}) => Promise<CommentAbandonResponse>,
|
comment_abandon: (params: {}) => Promise<CommentAbandonResponse>,
|
||||||
|
|
|
@ -349,7 +349,7 @@ export function doSetDraftTransactionAddress(address) {
|
||||||
};
|
};
|
||||||
}
|
}
|
||||||
|
|
||||||
export function doSendTip(params, isSupport, successCallback, errorCallback) {
|
export function doSendTip(params, isSupport, successCallback, errorCallback, shouldNotify = true) {
|
||||||
return (dispatch, getState) => {
|
return (dispatch, getState) => {
|
||||||
const state = getState();
|
const state = getState();
|
||||||
const balance = selectBalance(state);
|
const balance = selectBalance(state);
|
||||||
|
@ -368,7 +368,8 @@ export function doSendTip(params, isSupport, successCallback, errorCallback) {
|
||||||
return;
|
return;
|
||||||
}
|
}
|
||||||
|
|
||||||
const success = () => {
|
const success = response => {
|
||||||
|
if (shouldNotify) {
|
||||||
dispatch(
|
dispatch(
|
||||||
doToast({
|
doToast({
|
||||||
message: shouldSupport
|
message: shouldSupport
|
||||||
|
@ -378,13 +379,14 @@ export function doSendTip(params, isSupport, successCallback, errorCallback) {
|
||||||
linkTarget: '/wallet',
|
linkTarget: '/wallet',
|
||||||
})
|
})
|
||||||
);
|
);
|
||||||
|
}
|
||||||
|
|
||||||
dispatch({
|
dispatch({
|
||||||
type: ACTIONS.SUPPORT_TRANSACTION_COMPLETED,
|
type: ACTIONS.SUPPORT_TRANSACTION_COMPLETED,
|
||||||
});
|
});
|
||||||
|
|
||||||
if (successCallback) {
|
if (successCallback) {
|
||||||
successCallback();
|
successCallback(response);
|
||||||
}
|
}
|
||||||
};
|
};
|
||||||
|
|
||||||
|
|
Loading…
Reference in a new issue