Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Nt/wave image ratios #2760

Merged
merged 3 commits into from
Sep 21, 2023
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
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