discarded generateUUid in favour of author permlink mix

This commit is contained in:
Nouman Tahir 2021-03-22 22:45:14 +05:00
parent 1b5e640e76
commit 2c9905626c
4 changed files with 3 additions and 26 deletions

View File

@ -121,7 +121,7 @@ const PostCardView = ({
const height =
(evt.nativeEvent.height / evt.nativeEvent.width) * (dim.width - 18);
setCalcImgHeight(height);
setImageHeight(content.local_id, height);
setImageHeight(content.author + content.permlink, height);
}
}}
/>

View File

@ -75,7 +75,7 @@ const postsListContainer = ({
if (get(p, 'author', null) && posts.filter((x) => x.permlink === p.permlink).length <= 0) {
//get image height from cache if available
const localId = p.local_id;
const localId = p.author + p.permlink;
const imgHeight = imageHeights.get(localId)
e.push(
@ -92,7 +92,7 @@ const postsListContainer = ({
}
if (get(item, 'author', null)) {
//get image height from cache if available
const localId = item.local_id
const localId = item.author + item.permlink;
const imgHeight = imageHeights.get(localId)
e.push(

View File

@ -1,20 +0,0 @@
export default ({short}:{short:boolean} = {short:false}): string => {
var d = new Date().getTime(); //Timestamp
var d2 = 0;
const variant = short
? 'xxxx-4xxx-yxxx'
: 'xxxxxxxx-xxxx-4xxx-yxxx-xxxxxxxxxxxx';
return variant.replace(/[xy]/g, function (c) {
var r = Math.random() * 16; //random number between 0 and 16
if (d > 0) {
//Use timestamp until depleted
r = (d + r) % 16 | 0;
d = Math.floor(d / 16);
} else {
//Use microseconds since page-load if supported
r = (d2 + r) % 16 | 0;
d2 = Math.floor(d2 / 16);
}
return (c === 'x' ? r : (r & 0x3) | 0x8).toString(16);
});
};

View File

@ -9,7 +9,6 @@ import FastImage from 'react-native-fast-image';
import parseAsset from './parseAsset';
import { getReputation } from './reputation';
import { getResizedAvatar, getResizedImage } from './image';
import generateUuid from './generateUuid';
const webp = Platform.OS === 'ios' ? false : true;
@ -26,8 +25,6 @@ export const parsePost = (post, currentUserName, isPromoted, isList = false) =>
return null;
}
post.local_id = generateUuid({ short: true });
if (currentUserName === post.author) {
post.markdownBody = post.body;
}