Skip to content

Commit

Permalink
Merge pull request #2760 from ecency/nt/wave-updates
Browse files Browse the repository at this point in the history
Nt/wave image ratios
  • Loading branch information
feruzm authored Sep 21, 2023
2 parents 9a6d6d4 + dbf806a commit e146738
Show file tree
Hide file tree
Showing 6 changed files with 19 additions and 8 deletions.
1 change: 1 addition & 0 deletions src/components/comment/view/commentView.tsx
Original file line number Diff line number Diff line change
Expand Up @@ -104,6 +104,7 @@ const CommentView = ({
<View style={[{ marginLeft: 2, marginTop: -6 }]}>
<CommentBody
body={comment.body}
metadata={comment.json_metadata}
key={`key-${comment.permlink}`}
hideContent={_hideContent}
commentDepth={_depth}
Expand Down
3 changes: 3 additions & 0 deletions src/components/postElements/body/view/commentBodyView.tsx
Original file line number Diff line number Diff line change
Expand Up @@ -24,6 +24,7 @@ const WIDTH = getWindowDimensions().width;

interface CommentBodyProps {
body: string;
metadata?: any;
commentDepth: number;
hideContent: boolean;
handleOnContentPress: () => void;
Expand All @@ -38,6 +39,7 @@ interface CommentBodyProps {

const CommentBody = ({
body,
metadata,
commentDepth,
hideContent,
handleOnContentPress,
Expand Down Expand Up @@ -132,6 +134,7 @@ const CommentBody = ({
<PostHtmlRenderer
contentWidth={_contentWidth}
body={body}
metadata={metadata}
isComment={true}
setSelectedImage={handleImagePress}
setSelectedLink={handleLinkPress}
Expand Down
2 changes: 1 addition & 1 deletion src/components/postHtmlRenderer/postHtmlRenderer.tsx
Original file line number Diff line number Diff line change
Expand Up @@ -13,7 +13,7 @@ import { VideoPlayer } from '..';
interface PostHtmlRendererProps {
contentWidth: number;
body: string;
metadata: string;
metadata: any;
isComment?: boolean;
onLoaded?: () => void;
setSelectedImage: (imgUrl: string, postImageUrls: string[]) => void;
Expand Down
16 changes: 12 additions & 4 deletions src/components/quickReplyModal/usePostSubmitter.ts
Original file line number Diff line number Diff line change
@@ -1,7 +1,7 @@
import { useDispatch } from "react-redux";
import { useAppSelector } from "../../hooks";
import { postComment } from "../../providers/hive/dhive";
import { generateReplyPermlink, makeJsonMetadataReply } from "../../utils/editor";
import { extractMetadata, generateReplyPermlink, makeJsonMetadata } from "../../utils/editor";
import { Alert } from "react-native";
import { updateCommentCache } from "../../redux/actions/cacheActions";
import { toastNotification } from "../../redux/actions/uiAction";
Expand Down Expand Up @@ -46,14 +46,21 @@ export const usePostSubmitter = () => {
const category = parentPost.category || '';
const url = `/${category}/@${parentAuthor}/${parentPermlink}#@${author}/${permlink}`;

//adding jsonmeta with image ratios here....
const meta = await extractMetadata({
body:commentBody,
fetchRatios:true
})
const jsonMetadata = makeJsonMetadata(meta, parentTags || ['ecency'])

console.log(
currentAccount,
pinCode,
parentAuthor,
parentPermlink,
permlink,
commentBody,
parentTags,
jsonMetadata
);


Expand All @@ -65,7 +72,8 @@ export const usePostSubmitter = () => {
parentPermlink,
permlink,
commentBody,
parentTags,
[],
jsonMetadata
)

userActivityMutation.mutate({
Expand All @@ -90,7 +98,7 @@ export const usePostSubmitter = () => {
parent_author: parentAuthor,
parent_permlink: parentPermlink,
markdownBody: commentBody,
json_metadata: makeJsonMetadataReply(parentTags || ['ecency'])
json_metadata: jsonMetadata
}

dispatch(
Expand Down
4 changes: 2 additions & 2 deletions src/providers/hive/dhive.js
Original file line number Diff line number Diff line change
Expand Up @@ -1510,7 +1510,7 @@ export const postComment = (
permlink,
body,
parentTags,
isEdit = false,
jsonMetadata = null,
) =>
_postContent(
account,
Expand All @@ -1520,7 +1520,7 @@ export const postComment = (
permlink,
'',
body,
makeJsonMetadataReply(parentTags || ['ecency']),
jsonMetadata ? jsonMetadata : makeJsonMetadataReply(parentTags || ['ecency']),
null,
null,
)
Expand Down
1 change: 0 additions & 1 deletion src/redux/actions/cacheActions.ts
Original file line number Diff line number Diff line change
Expand Up @@ -18,7 +18,6 @@ import {
DELETE_CLAIM_CACHE_ENTRY,
} from '../constants/constants';
import {
ClaimCache,
Comment,
CacheStatus,
Draft,
Expand Down

0 comments on commit e146738

Please sign in to comment.