Skip to content

Commit

Permalink
fix address parsing, fix payment details styles
Browse files Browse the repository at this point in the history
  • Loading branch information
nikolay.natorin committed Dec 3, 2020
1 parent acf8480 commit a783b74
Show file tree
Hide file tree
Showing 3 changed files with 6 additions and 6 deletions.
5 changes: 3 additions & 2 deletions src/lib/messaging.js
Original file line number Diff line number Diff line change
Expand Up @@ -3,6 +3,7 @@ import { getChash160, isValidAddress } from 'obyte/lib/utils';
import { getSignedMessageInfoFromJsonBase64 } from './oCustom';

export const REG_WALLET_ADDRESS = /(.*?\s|^)([2-7A-Z]{32})([\s.,;!:].*?|$)/g;
// export const REG_WALLET_ADDRESS = /^([A-Z0-9]{32})$/g;
export const REG_REQUEST_PAYMENT = /\[.*?\]\(((?:byteball-tn|byteball|obyte-tn|obyte):([0-9A-Z]{32})(?:\?([\w=&;+%]+))?)\)/g;
export const REGEX_SIGN_MESSAGE_REQUEST = /\[(.+?)\]\(sign-message-request(-network-aware)?:(.+?)\)/g;
export const REGEX_SIGNED_MESSAGE = /\[(.+?)\]\(signed-message:([\w\/+=]+?)\)/g;
Expand Down Expand Up @@ -61,9 +62,9 @@ export const parseTextMessage = originalText => {
type = 'PROSAIC_CONTRACT';
return toDelayedReplacement({ type, text: '[UNSUPPORTED ACTION]' });
})
.replace(REG_WALLET_ADDRESS, (str, description, address) => {
.replace(REG_WALLET_ADDRESS, (str, pre, address, post) => {
type = 'WALLET_ADDRESS';
return toDelayedReplacement({ type, description, address });
return `${pre}${toDelayedReplacement({ type, address })}${post}`;
})
.replace(REG_REQUEST_PAYMENT, (str, payload, address, amount) => {
type = 'REQUEST_PAYMENT';
Expand Down
5 changes: 2 additions & 3 deletions src/screens/ChatScreen/index.js
Original file line number Diff line number Diff line change
Expand Up @@ -84,15 +84,14 @@ const ChatScreen = ({
)
}
case "WALLET_ADDRESS": {
const { address, description } = data;
const { address, pre, post } = data;
return user._id !== 1
? (
<TouchableOpacity onPress={() => navigation.navigate('MakePayment', { walletAddress: data.address })}>
{description ? <Text style={style}>{description}</Text> : null}
<Text style={replacedStyle}>{address}</Text>
</TouchableOpacity>
)
: <Text style={style}>{description ? `${description}${address}` : address}</Text>
: <Text style={style}>{address}</Text>
}
case "REQUEST_PAYMENT": {
const { amount, address } = data;
Expand Down
2 changes: 1 addition & 1 deletion src/screens/TransactionInfoScreen/index.js
Original file line number Diff line number Diff line change
Expand Up @@ -38,7 +38,7 @@ class TransactionInfoScreen extends React.Component {
titlePosition='center'
hasBackButton
/>
<View contentContainerStyle={styles.content}>
<View style={styles.content}>
<View style={styles.amountBlock}>
<View style={styles.amountRow}>
<Text style={styles.primaryAmount}>
Expand Down

0 comments on commit a783b74

Please sign in to comment.