mirror of
https://github.com/ecency/ecency-mobile.git
synced 2024-12-20 20:01:56 +03:00
commit
c00ad07ede
@ -315,7 +315,7 @@ PODS:
|
||||
- react-native-config/App (= 1.3.3)
|
||||
- react-native-config/App (1.3.3):
|
||||
- React
|
||||
- react-native-matomo-sdk (0.4.0):
|
||||
- react-native-matomo-sdk (0.4.1):
|
||||
- MatomoTracker (~> 7)
|
||||
- React (~> 0.60)
|
||||
- react-native-netinfo (5.9.5):
|
||||
@ -668,7 +668,7 @@ SPEC CHECKSUMS:
|
||||
React-jsinspector: fa0ecc501688c3c4c34f28834a76302233e29dc0
|
||||
react-native-cameraroll: e2917a5e62da9f10c3d525e157e25e694d2d6dfa
|
||||
react-native-config: 9a061347e0136fdb32d43a34d60999297d672361
|
||||
react-native-matomo-sdk: 03b35acda42463614f10ac61d013f7ae7dc8beed
|
||||
react-native-matomo-sdk: 025c54f92e1e26a4d0acee7c3f28cb0fc7e4729c
|
||||
react-native-netinfo: a53b00d949b6456913aaf507d9dba90c4008c611
|
||||
react-native-receive-sharing-intent: feba0a332a07977549a85aa58b496eb44368366a
|
||||
react-native-splash-screen: 200d11d188e2e78cea3ad319964f6142b6384865
|
||||
|
@ -5,7 +5,7 @@ import unionBy from 'lodash/unionBy';
|
||||
import Matomo from 'react-native-matomo-sdk';
|
||||
|
||||
// HIVE
|
||||
import { getPostsSummary, getPost } from '../../../providers/steem/dsteem';
|
||||
import { getAccountPosts, getPost, getRankedPosts } from '../../../providers/steem/dsteem';
|
||||
import { getPromotePosts } from '../../../providers/esteem/esteem';
|
||||
|
||||
// Component
|
||||
@ -147,18 +147,27 @@ const PostsContainer = ({
|
||||
}
|
||||
|
||||
const filter = type || selectedFilterValue;
|
||||
let options;
|
||||
let options = {};
|
||||
const limit = 6;
|
||||
let func = null;
|
||||
|
||||
if (filter === 'feed' || filter === 'blog' || getFor === 'blog' || filter === 'reblogs') {
|
||||
func = getAccountPosts;
|
||||
options = {
|
||||
tag: feedUsername,
|
||||
account: feedUsername,
|
||||
limit,
|
||||
sort: filter,
|
||||
};
|
||||
|
||||
if (pageType === 'profiles' && filter === 'feed') {
|
||||
options.sort = 'posts';
|
||||
}
|
||||
} else {
|
||||
func = getRankedPosts;
|
||||
options = {
|
||||
tag,
|
||||
limit,
|
||||
sort: filter,
|
||||
};
|
||||
}
|
||||
|
||||
@ -166,8 +175,7 @@ const PostsContainer = ({
|
||||
options.start_author = startAuthor;
|
||||
options.start_permlink = startPermlink;
|
||||
}
|
||||
// options.truncate_body = 200;
|
||||
getPostsSummary(filter, options, username, nsfw)
|
||||
func(options, username, nsfw)
|
||||
.then((result) => {
|
||||
if (result.length > 0) {
|
||||
let _posts = result;
|
||||
|
@ -390,24 +390,6 @@ export const ignoreUser = async (currentAccount, pin, data) => {
|
||||
);
|
||||
};
|
||||
|
||||
/**
|
||||
* @method getPosts get posts method
|
||||
* @param by get discussions by trending, created, active etc.
|
||||
* @param query tag, limit, start_author?, start_permalink?
|
||||
*/
|
||||
export const getPosts = async (by, query, user) => {
|
||||
try {
|
||||
let posts = await client.database.getDiscussions(by, query);
|
||||
|
||||
if (posts) {
|
||||
posts = parsePosts(posts, user);
|
||||
}
|
||||
return posts;
|
||||
} catch (error) {
|
||||
return error;
|
||||
}
|
||||
};
|
||||
|
||||
export const getActiveVotes = (author, permlink) =>
|
||||
new Promise((resolve, reject) => {
|
||||
client.database
|
||||
@ -420,9 +402,27 @@ export const getActiveVotes = (author, permlink) =>
|
||||
});
|
||||
});
|
||||
|
||||
export const getPostsSummary = async (by, query, currentUserName, filterNsfw) => {
|
||||
export const getRankedPosts = async (query, currentUserName, filterNsfw) => {
|
||||
try {
|
||||
let posts = await client.database.getDiscussions(by, query);
|
||||
let posts = await client.call('bridge', 'get_ranked_posts', query);
|
||||
|
||||
if (posts) {
|
||||
posts = parsePosts(posts, currentUserName, true);
|
||||
|
||||
if (filterNsfw !== '0') {
|
||||
const updatedPosts = filterNsfwPost(posts, filterNsfw);
|
||||
return updatedPosts;
|
||||
}
|
||||
}
|
||||
return posts;
|
||||
} catch (error) {
|
||||
return error;
|
||||
}
|
||||
};
|
||||
|
||||
export const getAccountPosts = async (query, currentUserName, filterNsfw) => {
|
||||
try {
|
||||
let posts = await client.call('bridge', 'get_account_posts', query);
|
||||
|
||||
if (posts) {
|
||||
posts = parsePosts(posts, currentUserName, true);
|
||||
@ -440,8 +440,10 @@ export const getPostsSummary = async (by, query, currentUserName, filterNsfw) =>
|
||||
|
||||
export const getUserComments = async (query) => {
|
||||
try {
|
||||
const comments = await client.database.getDiscussions('comments', query);
|
||||
const groomedComments = parseComments(comments);
|
||||
query.sort = 'comments';
|
||||
query.account = query.start_author;
|
||||
const _comments = await client.call('bridge', 'get_account_posts', query);
|
||||
const groomedComments = parseComments(_comments);
|
||||
return groomedComments;
|
||||
} catch (error) {
|
||||
return error;
|
||||
|
@ -1,9 +1,10 @@
|
||||
import get from 'lodash/get';
|
||||
/* eslint-disable array-callback-return */
|
||||
export default (posts, option) => {
|
||||
const updatedPosts = [];
|
||||
if (option === '1') {
|
||||
posts.map((post) => {
|
||||
if (post.parent_permlink === 'nsfw' || post.json_metadata.tags.includes('nsfw')) {
|
||||
if (post.parent_permlink === 'nsfw' || get(post, 'json_metadata.tags', []).includes('nsfw')) {
|
||||
post.nsfw = true;
|
||||
}
|
||||
});
|
||||
@ -12,7 +13,10 @@ export default (posts, option) => {
|
||||
|
||||
if (posts) {
|
||||
posts.map((post) => {
|
||||
if (post.parent_permlink !== 'nsfw' && !post.json_metadata.tags.includes('nsfw')) {
|
||||
if (
|
||||
post.parent_permlink !== 'nsfw' &&
|
||||
!get(post, 'json_metadata.tags', []).includes('nsfw')
|
||||
) {
|
||||
updatedPosts.push(post);
|
||||
}
|
||||
});
|
||||
|
Loading…
Reference in New Issue
Block a user