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

fix(mobile): User's QoL improvements #834

Merged
merged 9 commits into from
May 9, 2024
Merged
Show file tree
Hide file tree
Changes from 4 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
2 changes: 1 addition & 1 deletion packages/mobile/android/app/build.gradle
Original file line number Diff line number Diff line change
Expand Up @@ -92,7 +92,7 @@ android {
minSdkVersion rootProject.ext.minSdkVersion
targetSdkVersion rootProject.ext.targetSdkVersion
versionCode 433
versionName "4.5.0"
versionName "4.4.1"
missingDimensionStrategy 'react-native-camera', 'general'
missingDimensionStrategy 'store', 'play'
}
Expand Down
4 changes: 2 additions & 2 deletions packages/mobile/ios/ton_keeper.xcodeproj/project.pbxproj
Original file line number Diff line number Diff line change
Expand Up @@ -1298,7 +1298,7 @@
"$(inherited)",
"@executable_path/Frameworks",
);
MARKETING_VERSION = 4.5.0;
MARKETING_VERSION = 4.4.1;
OTHER_LDFLAGS = (
"$(inherited)",
"-ObjC",
Expand Down Expand Up @@ -1332,7 +1332,7 @@
"$(inherited)",
"@executable_path/Frameworks",
);
MARKETING_VERSION = 4.5.0;
MARKETING_VERSION = 4.4.1;
OTHER_LDFLAGS = (
"$(inherited)",
"-ObjC",
Expand Down
9 changes: 3 additions & 6 deletions packages/mobile/src/core/Jetton/Jetton.tsx
Original file line number Diff line number Diff line change
@@ -1,16 +1,13 @@
import React, { useCallback, useMemo } from 'react';
import { JettonProps } from './Jetton.interface';
import * as S from './Jetton.style';
import { IconButton, PopupMenu, PopupMenuItem, Skeleton, SwapIcon, Text } from '$uikit';
import { ns } from '$utils';
import { PopupMenu, PopupMenuItem, Skeleton, Text } from '$uikit';
import { useJetton } from '$hooks/useJetton';
import { useTokenPrice } from '$hooks/useTokenPrice';
import { openDAppBrowser, openSend } from '$navigation';

import { formatter } from '$utils/formatter';
import { useNavigation } from '@tonkeeper/router';
import { useSwapStore } from '$store/zustand/swap';
import { shallow } from 'zustand/shallow';
import { useFlags } from '$utils/flags';
import { HideableAmount } from '$core/HideableAmount/HideableAmount';
import { Events, JettonVerification, SendAnalyticsFrom } from '$store/models';
Expand Down Expand Up @@ -54,12 +51,12 @@ export const Jetton: React.FC<JettonProps> = ({ route }) => {

const isWatchOnly = wallet && wallet.isWatchOnly;
const fiatCurrency = useWalletCurrency();
const shouldShowChart = jettonPrice.fiat !== 0;
const shouldExcludeChartPeriods = config.get('exclude_jetton_chart_periods');

const nav = useNavigation();

const showSwap = useSwapStore((s) => !!s.assets[jetton.jettonAddress], shallow);
const shouldShowChart = jettonPrice.fiat !== 0;
const showSwap = jettonPrice.fiat !== 0;

const handleSend = useCallback(() => {
trackEvent(Events.SendOpen, { from: SendAnalyticsFrom.TokenScreen });
Expand Down
Original file line number Diff line number Diff line change
@@ -1,6 +1,6 @@
import React, { memo, useEffect, useMemo } from 'react';
import { NFTOperationFooter, useNFTOperationState } from '../NFTOperationFooter';
import { SignRawParams, TxBodyOptions } from '../TXRequest.types';
import { SignRawMessage, SignRawParams, TxBodyOptions } from '../TXRequest.types';
import { useUnlockVault } from '../useUnlockVault';
import { calculateMessageTransferAmount, delay } from '$utils';
import { debugLog } from '$utils/debugLog';
Expand Down Expand Up @@ -352,6 +352,10 @@ export const SignRawModal = memo<SignRawModalProps>((props) => {
);
});

function isValidMessage(message: SignRawMessage): boolean {
return Address.isValid(message.address) && new BigNumber(message.amount).gt('0');
}

export const openSignRawModal = async (
params: SignRawParams,
options: TxBodyOptions,
Expand All @@ -370,6 +374,10 @@ export const openSignRawModal = async (
try {
Toast.loading();

if (!params.messages.every((mes) => isValidMessage(mes))) {
throw new Error('Invalid message');
}

if (isTonConnect) {
await TonConnectRemoteBridge.closeOtherTransactions();
}
Expand Down
5 changes: 0 additions & 5 deletions packages/mobile/src/store/main/sagas.ts
Original file line number Diff line number Diff line change
Expand Up @@ -20,7 +20,6 @@ import { InternalNotificationModel } from '$store/models';

import { initStats, trackEvent, trackFirstLaunch } from '$utils/stats';
import { favoritesActions } from '$store/favorites';
import { useSwapStore } from '$store/zustand/swap';
import { tk } from '$wallet';
import { config } from '$config';

Expand Down Expand Up @@ -54,10 +53,6 @@ export function* initHandler() {
const logs = yield call(getSavedLogs);
yield put(mainActions.setLogs(logs));

if (tk.wallet) {
useSwapStore.getState().actions.fetchAssets();
}

yield put(mainActions.loadNotifications());

yield put(favoritesActions.loadSuggests());
Expand Down
2 changes: 0 additions & 2 deletions packages/mobile/src/store/zustand/swap/index.ts

This file was deleted.

46 changes: 0 additions & 46 deletions packages/mobile/src/store/zustand/swap/types.ts

This file was deleted.

82 changes: 0 additions & 82 deletions packages/mobile/src/store/zustand/swap/useSwapStore.ts

This file was deleted.

16 changes: 0 additions & 16 deletions packages/mobile/src/utils/stats.ts
Original file line number Diff line number Diff line change
@@ -1,5 +1,4 @@
import { config } from '$config';
import { init, logEvent } from '@amplitude/analytics-browser';
import AsyncStorage from '@react-native-async-storage/async-storage';
import Aptabase from '@aptabase/react-native';
import DeviceInfo from 'react-native-device-info';
Expand All @@ -19,20 +18,6 @@ export function initStats() {
appVersion: DeviceInfo.getVersion(),
});
}
init(config.get('amplitudeKey'), '-', {
minIdLength: 1,
deviceId: '-',
trackingOptions: {
ipAddress: false,
deviceModel: true,
language: false,
osName: true,
osVersion: true,
platform: true,
adid: false,
carrier: false,
},
});
TrakingEnabled = true;
}

Expand All @@ -48,7 +33,6 @@ export async function trackEvent(name: string, params: any = {}) {
Object.assign(params, { firebase_user_id: DeviceInfo.getUniqueId() }),
);
}
logEvent(name, params);
} catch (e) {}
}

Expand Down
11 changes: 9 additions & 2 deletions packages/mobile/src/wallet/models/ActivityModel/ActivityModel.ts
Original file line number Diff line number Diff line change
Expand Up @@ -11,7 +11,11 @@ import {
ActionItem,
AnyActionItem,
} from './ActivityModelTypes';
import { AccountEvent, ActionStatusEnum } from '@tonkeeper/core/src/TonAPI';
import {
AccountEvent,
ActionStatusEnum,
JettonVerificationType,
} from '@tonkeeper/core/src/TonAPI';
import { toLowerCaseFirstLetter } from '@tonkeeper/uikit';
import { Address } from '@tonkeeper/core';
import { TronEvent } from '@tonkeeper/core/src/TronAPI/TronAPIGenerated';
Expand Down Expand Up @@ -167,7 +171,10 @@ export class ActivityModel {
type: ActionAmountType.Jetton,
jettonAddress: payload.jetton.address,
decimals: payload.jetton.decimals,
symbol: payload.jetton.symbol,
symbol:
payload.jetton.verification === JettonVerificationType.Blacklist
? 'FAKE'
: payload.jetton.symbol,
value: payload.amount,
};
case ActionType.NftPurchase:
Expand Down
Original file line number Diff line number Diff line change
@@ -1,5 +1,5 @@
import { Address, AmountFormatter } from '@tonkeeper/core';
import { JettonBalance } from '@tonkeeper/core/src/TonAPI';
import { JettonBalance, JettonVerificationType } from '@tonkeeper/core/src/TonAPI';
import { JettonMetadata, JettonVerification } from './types';

export class JettonBalanceModel {
Expand Down Expand Up @@ -28,5 +28,9 @@ export class JettonBalanceModel {
this.walletAddress = new Address(jettonBalance.wallet_address.address).toFriendly();
this.verification = jettonBalance.jetton
.verification as unknown as JettonVerification;

if (jettonBalance.jetton.verification === JettonVerificationType.Blacklist) {
this.metadata.symbol = 'FAKE';
}
}
}