Skip to content

Commit

Permalink
Merge branch 'dev' into stage
Browse files Browse the repository at this point in the history
  • Loading branch information
JavidHaji-zada committed Dec 7, 2023
2 parents c2b9f9d + db93708 commit e71cbc6
Show file tree
Hide file tree
Showing 25 changed files with 177 additions and 88 deletions.
36 changes: 23 additions & 13 deletions src/api/watcher-service.ts
Original file line number Diff line number Diff line change
Expand Up @@ -11,8 +11,7 @@ const watcherAPI = `${Config.WALLET_API_URL}/api/v1/watcher`;

const getWatcherInfoOfCurrentUser =
async (): Promise<WatcherInfoDTO | null> => {
const notificationService = new NotificationService();
const pushToken = await notificationService.getPushToken();
const pushToken = await NotificationService.getPushToken();
try {
const response = await axios.get(`${watcherAPI}/${pushToken}`);
return response.data;
Expand All @@ -22,8 +21,7 @@ const getWatcherInfoOfCurrentUser =
};

const createWatcherForCurrentUser = async () => {
const notificationService = new NotificationService();
const pushToken = await notificationService.getPushToken();
const pushToken = await NotificationService.getPushToken();
try {
return await axios.post(`${watcherAPI}`, { push_token: pushToken });
} catch (error) {
Expand All @@ -32,8 +30,7 @@ const createWatcherForCurrentUser = async () => {
};

const watchAddresses = async (addresses: string[]): Promise<void> => {
const notificationService = new NotificationService();
const pushToken = await notificationService.getPushToken();
const pushToken = await NotificationService.getPushToken();
const notificationSettings: NotificationSettings =
((await Cache.getItem(
CacheKey.NotificationSettings
Expand All @@ -52,8 +49,7 @@ const watchAddresses = async (addresses: string[]): Promise<void> => {
};

const removeAllWatchersFromCurrentUser = async (): Promise<void> => {
const notificationService = new NotificationService();
const pushToken = await notificationService.getPushToken();
const pushToken = await NotificationService.getPushToken();
if (!pushToken) return;
try {
await axios.delete(`${watcherAPI}`, {
Expand All @@ -69,8 +65,7 @@ const removeAllWatchersFromCurrentUser = async (): Promise<void> => {
const removeWatcherForAddresses = async (
addresses: string[]
): Promise<void> => {
const notificationService = new NotificationService();
const pushToken = await notificationService.getPushToken();
const pushToken = await NotificationService.getPushToken();
if (!addresses || !addresses.length || !pushToken) return;
try {
await axios.delete(`${watcherAPI}-addresses`, {
Expand All @@ -89,8 +84,7 @@ const updateNotificationSettings = async (
settings: NotificationSettings
): Promise<void> => {
const { pricePercentThreshold, priceAlerts, transactionAlerts } = settings;
const notificationService = new NotificationService();
const pushToken = await notificationService.getPushToken();
const pushToken = await NotificationService.getPushToken();
try {
await axios.put(`${watcherAPI}`, {
addresses: [],
Expand All @@ -105,11 +99,27 @@ const updateNotificationSettings = async (
}
};

const updatePushToken = async (
oldToken: string,
newToken: string
): Promise<void> => {
try {
await axios.put(`${watcherAPI}/push-token`, {
addresses: [],
old_push_token: oldToken,
new_push_token: newToken
});
} catch (error) {
throw error;
}
};

export const watcherService = {
watchAddresses,
removeWatcherForAddresses,
getWatcherInfoOfCurrentUser,
createWatcherForCurrentUser,
removeAllWatchersFromCurrentUser,
updateNotificationSettings
updateNotificationSettings,
updatePushToken
};
16 changes: 9 additions & 7 deletions src/components/modular/SingleAsset/index.tsx
Original file line number Diff line number Diff line change
Expand Up @@ -37,13 +37,15 @@ export const SingleAsset = (props: SingleAssetProps): JSX.Element => {
>
{name === '' ? 'Unknown token' : name || address}
</Text>
<Text
fontFamily="Mersad_600SemiBold"
fontSize={16}
color={COLORS.neutral800}
>
${NumberUtils.limitDecimalCount(usdPrice, 2)}
</Text>
{usdPrice >= 0 && (
<Text
fontFamily="Mersad_600SemiBold"
fontSize={16}
color={COLORS.neutral800}
>
${NumberUtils.limitDecimalCount(usdPrice, 2)}
</Text>
)}
</Row>
<Spacer horizontal value={scale(8)} />
<Row justifyContent="space-between">
Expand Down
18 changes: 10 additions & 8 deletions src/components/modular/TransactionItem/index.tsx
Original file line number Diff line number Diff line change
Expand Up @@ -66,14 +66,16 @@ export const TransactionItem = (props: TransactionItemProps): JSX.Element => {
{transaction.symbol}
</Text>
<Spacer value={verticalScale(4)} />
<Text
fontSize={12}
align="right"
fontFamily="Inter_500Medium"
color={COLORS.alphaBlack50}
>
${NumberUtils.limitDecimalCount(usdAmount, 2)}
</Text>
{usdAmount >= 0 && (
<Text
fontSize={12}
align="right"
fontFamily="Inter_500Medium"
color={COLORS.alphaBlack50}
>
${NumberUtils.limitDecimalCount(usdAmount, 2)}
</Text>
)}
</View>
</Row>
</View>
Expand Down
5 changes: 2 additions & 3 deletions src/components/svg/icons/About.tsx
Original file line number Diff line number Diff line change
Expand Up @@ -2,12 +2,11 @@ import React from 'react';
import { Path, Svg } from 'react-native-svg';
import { IconProps } from '@components/svg/icons';
import { COLORS } from '@constants/colors';
import { moderateScale } from '@utils/scaling';

export function AboutIcon(props: IconProps) {
const { scale = 1, color = COLORS.brand500 } = props;
const width = moderateScale(24),
height = moderateScale(24);
const width = 24,
height = 24;

return (
<Svg
Expand Down
5 changes: 2 additions & 3 deletions src/components/svg/icons/Add.tsx
Original file line number Diff line number Diff line change
@@ -1,13 +1,12 @@
import React from 'react';
import { Path, Svg } from 'react-native-svg';
import { COLORS } from '@constants/colors';
import { moderateScale } from '@utils/scaling';
import { IconProps } from './Icon.types';

export function AddIcon(props: IconProps) {
const { color = COLORS.brand500, scale = 1 } = props;
const width = moderateScale(16),
height = moderateScale(16);
const width = 16,
height = 16;

return (
<Svg
Expand Down
5 changes: 2 additions & 3 deletions src/components/svg/icons/Back.tsx
Original file line number Diff line number Diff line change
Expand Up @@ -2,12 +2,11 @@ import React from 'react';
import { Path, Svg } from 'react-native-svg';
import { IconProps } from '@components/svg/icons';
import { COLORS } from '@constants/colors';
import { moderateScale } from '@utils/scaling';

export function BackIcon(props: IconProps) {
const { color = COLORS.brand500, scale = 1 } = props;
const width = moderateScale(24),
height = moderateScale(24);
const width = 24,
height = 24;
return (
<Svg
width={width * scale}
Expand Down
5 changes: 2 additions & 3 deletions src/components/svg/icons/BellIcon.tsx
Original file line number Diff line number Diff line change
Expand Up @@ -2,12 +2,11 @@ import React from 'react';
import { Path, Svg } from 'react-native-svg';
import { IconProps } from '@components/svg/icons/Icon.types';
import { COLORS } from '@constants/colors';
import { moderateScale } from '@utils/scaling';

export function BellIcon(props: IconProps) {
const { color = COLORS.neutral100, scale = 1 } = props;
const width = moderateScale(40);
const height = moderateScale(40);
const width = 40;
const height = 40;
return (
<Svg
width={width * scale}
Expand Down
5 changes: 2 additions & 3 deletions src/components/svg/icons/Browser.tsx
Original file line number Diff line number Diff line change
@@ -1,12 +1,11 @@
import React from 'react';
import { Path, Svg } from 'react-native-svg';
import { IconProps } from './Icon.types';
import { moderateScale } from '@utils/scaling';

export function BrowserIcon(props: Omit<IconProps, 'variant'>) {
const { color = '#222', scale = 1 } = props;
const width = moderateScale(16),
height = moderateScale(16);
const width = 16,
height = 16;
return (
<Svg
width={width * scale}
Expand Down
5 changes: 2 additions & 3 deletions src/components/svg/icons/ChevronDown.tsx
Original file line number Diff line number Diff line change
Expand Up @@ -3,16 +3,15 @@ import { Path, Svg } from 'react-native-svg';
import { RotateTransform } from 'react-native';
import { IconProps } from '@components/svg/icons';
import { COLORS } from '@constants/colors';
import { moderateScale } from '@utils/scaling';

export function ChevronDownIcon(
props: IconProps & {
rotate?: RotateTransform['rotate'];
}
) {
const { color = COLORS.brand500, rotate = '0deg' } = props;
const width = moderateScale(24),
height = moderateScale(24);
const width = 24,
height = 24;
return (
<Svg
width={width}
Expand Down
5 changes: 2 additions & 3 deletions src/components/svg/icons/Close.tsx
Original file line number Diff line number Diff line change
Expand Up @@ -2,12 +2,11 @@ import React from 'react';
import { Path, Svg } from 'react-native-svg';
import { IconProps } from '@components/svg/icons';
import { COLORS } from '@constants/colors';
import { moderateScale } from '@utils/scaling';

export function CloseIcon(props: IconProps) {
const { color = COLORS.neutral900, scale = 1 } = props;
const width = moderateScale(24),
height = moderateScale(24);
const width = 24,
height = 24;

return (
<Svg
Expand Down
7 changes: 3 additions & 4 deletions src/components/svg/icons/DownArrow.tsx
Original file line number Diff line number Diff line change
Expand Up @@ -2,7 +2,6 @@ import React from 'react';
import { Path, Svg } from 'react-native-svg';
import { IconProps } from '@components/svg/icons';
import { COLORS } from '@constants/colors';
import { moderateScale } from '@utils/scaling';
import { RotateTransform } from 'react-native';

export function DownArrowIcon(
Expand All @@ -11,8 +10,8 @@ export function DownArrowIcon(
}
) {
const { color = COLORS.neutral900, scale = 1 } = props;
const width = moderateScale(24),
height = moderateScale(24);
const width = 14,
height = 16;

return (
<Svg
Expand All @@ -22,7 +21,7 @@ export function DownArrowIcon(
fill="none"
>
<Path
d="M19.716 13.704a1 1 0 10-1.425-1.403L13 17.67V4a1 1 0 00-2 0v13.665L5.715 12.3a1 1 0 00-1.425 1.403l6.823 6.925a1.25 1.25 0 001.78 0l6.823-6.925z"
d="M13.792 9.265a.75.75 0 00-1.09-1.03l-4.955 5.239V.75a.75.75 0 00-1.5 0v12.726L1.29 8.235A.75.75 0 00.2 9.265l6.07 6.418a.995.995 0 00.566.3.753.753 0 00.329-.002.995.995 0 00.557-.298l6.07-6.418z"
fill={color}
/>
</Svg>
Expand Down
5 changes: 2 additions & 3 deletions src/components/svg/icons/Edit.tsx
Original file line number Diff line number Diff line change
Expand Up @@ -2,12 +2,11 @@ import React from 'react';
import { Path, Svg } from 'react-native-svg';
import { IconProps } from '@components/svg/icons';
import { COLORS } from '@constants/colors';
import { moderateScale } from '@utils/scaling';

export function EditIcon(props: IconProps) {
const { color = COLORS.neutral900, scale = 1 } = props;
const width = moderateScale(20),
height = moderateScale(20);
const width = 20,
height = 20;
return (
<Svg
width={width * scale}
Expand Down
5 changes: 2 additions & 3 deletions src/components/svg/icons/Help.tsx
Original file line number Diff line number Diff line change
Expand Up @@ -2,12 +2,11 @@ import React from 'react';
import { Path, Svg } from 'react-native-svg';
import { IconProps } from '@components/svg/icons';
import { COLORS } from '@constants/colors';
import { moderateScale } from '@utils/scaling';

export function HelpIcon(props: IconProps) {
const { color = COLORS.neutral900, scale = 1 } = props;
const width = moderateScale(20),
height = moderateScale(20);
const width = 20,
height = 20;

return (
<Svg
Expand Down
5 changes: 2 additions & 3 deletions src/components/svg/icons/Info.tsx
Original file line number Diff line number Diff line change
@@ -1,12 +1,11 @@
import React from 'react';
import Svg, { Path } from 'react-native-svg';
import { IconProps } from './Icon.types';
import { moderateScale } from '@utils/scaling';

export function InfoIcon(props: IconProps) {
const { scale = 1, color = '#FF4747' } = props;
const width = moderateScale(88);
const height = moderateScale(88);
const width = 88;
const height = 88;
return (
<Svg
width={width * scale}
Expand Down
5 changes: 2 additions & 3 deletions src/components/svg/icons/Lock.tsx
Original file line number Diff line number Diff line change
Expand Up @@ -2,12 +2,11 @@ import React from 'react';
import { Path, Svg } from 'react-native-svg';
import { IconProps } from '@components/svg/icons';
import { COLORS } from '@constants/colors';
import { moderateScale } from '@utils/scaling';

export function LockIcon(props: IconProps) {
const { color = COLORS.brand500, scale = 1 } = props;
const width = moderateScale(24),
height = moderateScale(24);
const width = 24,
height = 24;
return (
<Svg
width={width * scale}
Expand Down
7 changes: 3 additions & 4 deletions src/components/svg/icons/SettingsFilled.tsx
Original file line number Diff line number Diff line change
@@ -1,13 +1,12 @@
import React from 'react';
import { IconProps } from '@components/svg/icons/Icon.types';
import { Path, Svg } from 'react-native-svg';
import { moderateScale } from '@utils/scaling';
import { COLORS } from '@constants/colors';

export function SettingsFilledIcon(props: IconProps) {
const { scale = 1, color = COLORS.neutral900 } = props;
const width = moderateScale(20),
height = moderateScale(20);
const width = 20,
height = 20;
return (
<Svg
width={width * scale}
Expand All @@ -16,7 +15,7 @@ export function SettingsFilledIcon(props: IconProps) {
viewBox={`0 0 ${width} ${height}`}
>
<Path
d="M10.013.25c.734.008 1.465.093 2.181.253a.75.75 0 01.582.649l.17 1.527a1.384 1.384 0 001.928 1.116l1.4-.615a.75.75 0 01.85.174 9.793 9.793 0 012.204 3.792.75.75 0 01-.271.825l-1.242.916a1.38 1.38 0 00.001 2.226l1.243.915a.75.75 0 01.271.826 9.798 9.798 0 01-2.203 3.792.75.75 0 01-.849.175l-1.406-.617a1.38 1.38 0 00-1.927 1.114l-.169 1.526a.75.75 0 01-.572.647 9.518 9.518 0 01-4.405 0 .75.75 0 01-.572-.647l-.17-1.524a1.382 1.382 0 00-1.924-1.11l-1.407.616a.75.75 0 01-.849-.175 9.798 9.798 0 01-2.203-3.796.75.75 0 01.271-.826l1.244-.916a1.38 1.38 0 000-2.226L.945 7.973a.75.75 0 01-.272-.826 9.793 9.793 0 012.205-3.792.75.75 0 01.849-.174l1.4.615a1.387 1.387 0 001.93-1.118l.17-1.526a.75.75 0 01.583-.65C8.53.344 9.261.26 10.013.25zM10 7a3 3 0 100 6 3 3 0 000-6z"
d="M10.012.25c.734.009 1.466.093 2.182.253a.75.75 0 01.582.649l.17 1.527a1.384 1.384 0 001.928 1.116l1.4-.615a.75.75 0 01.85.174 9.793 9.793 0 012.204 3.792.75.75 0 01-.271.826l-1.242.915a1.38 1.38 0 00.001 2.226l1.242.915a.75.75 0 01.272.826 9.798 9.798 0 01-2.204 3.792.75.75 0 01-.848.175l-1.406-.617a1.381 1.381 0 00-1.927 1.114l-.169 1.526a.75.75 0 01-.572.647 9.518 9.518 0 01-4.406 0 .75.75 0 01-.572-.646l-.168-1.525a1.382 1.382 0 00-1.925-1.11l-1.407.616a.75.75 0 01-.849-.175 9.798 9.798 0 01-2.203-3.796.75.75 0 01.271-.826l1.243-.916a1.381 1.381 0 000-2.226L.945 7.973a.75.75 0 01-.271-.826 9.793 9.793 0 012.204-3.792.75.75 0 01.85-.174l1.4.615a1.387 1.387 0 001.93-1.118l.17-1.526a.75.75 0 01.583-.649c.717-.16 1.45-.244 2.201-.253zM10 7a3 3 0 100 6 3 3 0 000-6z"
fill={color}
/>
</Svg>
Expand Down
5 changes: 2 additions & 3 deletions src/components/svg/icons/Wallet.tsx
Original file line number Diff line number Diff line change
Expand Up @@ -2,12 +2,11 @@ import React from 'react';
import { Path, Svg } from 'react-native-svg';
import { IconProps } from '@components/svg/icons';
import { COLORS } from '@constants/colors';
import { moderateScale } from '@utils/scaling';

export function WalletIcon(props: IconProps) {
const { color = COLORS.brand500, scale = 1 } = props;
const width = moderateScale(24),
height = moderateScale(24);
const width = 24,
height = 24;
return (
<Svg
width={width * scale}
Expand Down
1 change: 1 addition & 0 deletions src/contexts/Passcode/index.tsx
Original file line number Diff line number Diff line change
Expand Up @@ -105,6 +105,7 @@ export const PasscodeProvider: FC<{ children: React.ReactNode }> = ({
}
} catch (error) {
console.error('Face ID error:', error);
Alert.alert('Error occured', JSON.stringify(error));
}
}, [isFaceIDEnabled, supportedBiometrics, t]);

Expand Down
Loading

0 comments on commit e71cbc6

Please sign in to comment.