Skip to content

Commit

Permalink
v1.17.1
Browse files Browse the repository at this point in the history
  • Loading branch information
mytonwalletorg committed Dec 21, 2023
1 parent adde2ee commit 11c55a3
Show file tree
Hide file tree
Showing 34 changed files with 307 additions and 146 deletions.
10 changes: 1 addition & 9 deletions .github/workflows/package-and-publish.yml
Original file line number Diff line number Diff line change
Expand Up @@ -312,10 +312,6 @@ jobs:
WEB_EXT_API_KEY: ${{ secrets.FIREFOX_API_KEY }}
WEB_EXT_API_SECRET: ${{ secrets.FIREFOX_API_SECRET }}
# App env
TONHTTPAPI_MAINNET_URL: ${{ vars.TONHTTPAPI_MAINNET_URL }}
TONAPIIO_MAINNET_URL: ${{ vars.TONAPIIO_MAINNET_URL }}
TONHTTPAPI_TESTNET_URL: ${{ vars.TONHTTPAPI_TESTNET_URL }}
TONAPIIO_TESTNET_URL: ${{ vars.TONAPIIO_TESTNET_URL }}
PROXY_HOSTS: ${{ vars.PROXY_HOSTS }}
STAKING_POOLS: ${{ vars.STAKING_POOLS }}
if: ${{ env.WEB_EXT_API_KEY != '' }}
Expand All @@ -324,12 +320,8 @@ jobs:
UNZIP_DIR=/tmp/${{ env.APP_NAME }}-firefox
mkdir $UNZIP_DIR
unzip ${{ env.FIREFOX_FILE_NAME }} -d $UNZIP_DIR
web-ext-submit --source-dir=$UNZIP_DIR/dist
npx web-ext-submit --source-dir=$UNZIP_DIR/dist
echo "APP_NAME=\"${APP_NAME}\"
TONHTTPAPI_MAINNET_URL=\"${TONHTTPAPI_MAINNET_URL}\"
TONHTTPAPI_TESTNET_URL=\"${TONHTTPAPI_TESTNET_URL}\"
TONAPIIO_MAINNET_URL=\"${TONAPIIO_MAINNET_URL}\"
TONAPIIO_TESTNET_URL=\"${TONAPIIO_TESTNET_URL}\"
PROXY_HOSTS=\"${PROXY_HOSTS}\"
STAKING_POOLS=\"${STAKING_POOLS}\"" >.env
bash deploy/firefox_pack_sources.sh
Expand Down
1 change: 1 addition & 0 deletions changelogs/1.17.1.txt
Original file line number Diff line number Diff line change
@@ -0,0 +1 @@
Some hotfixes
4 changes: 2 additions & 2 deletions package-lock.json

Some generated files are not rendered by default. Learn more about how customized files appear on GitHub.

2 changes: 1 addition & 1 deletion package.json
Original file line number Diff line number Diff line change
@@ -1,6 +1,6 @@
{
"name": "mytonwallet",
"version": "1.17.0",
"version": "1.17.1",
"description": "The most feature-rich web wallet and browser extension for TON – with support of multi-accounts, tokens (jettons), NFT, TON DNS, TON Sites, TON Proxy, and TON Magic.",
"main": "index.js",
"scripts": {
Expand Down
2 changes: 1 addition & 1 deletion public/get/index.html
Original file line number Diff line number Diff line change
Expand Up @@ -3,7 +3,7 @@
<head>
<meta charset="UTF-8">
<meta name="viewport" content="width=device-width, initial-scale=1.0">
<title>MyTonWallet Desktop</title>
<title>Install MyTonWallet</title>
<script src="./index.js"></script>
<link rel="stylesheet" href="./index.css">
</head>
Expand Down
27 changes: 22 additions & 5 deletions public/get/index.js
Original file line number Diff line number Diff line change
Expand Up @@ -2,6 +2,10 @@ const REPO = 'mytonwalletorg/mytonwallet';
const LATEST_RELEASE_API_URL = `https://api.github.com/repos/${REPO}/releases/latest`;
const LATEST_RELEASE_WEB_URL = `https://github.com/${REPO}/releases/latest`;
const WEB_APP_URL = '/';
const MOBILE_URLS = {
ios: 'https://apps.apple.com/ru/app/mytonwallet-anyway-ton-wallet/id6464677844',
android: 'https://play.google.com/store/apps/details?id=org.mytonwallet.app',
};

const platform = getPlatform();
const currentPage = location.href.includes('mac.html')
Expand Down Expand Up @@ -48,7 +52,7 @@ const packagesPromise = fetch(LATEST_RELEASE_API_URL)
});

(function init() {
if (platform === 'Windows' || platform === 'Linux') {
if (['Windows', 'Linux', 'iOS', 'Android'].includes(platform)) {
if (currentPage === 'index') {
setupDownloadButton();
setupVersion();
Expand Down Expand Up @@ -103,10 +107,17 @@ function setupVersion() {
document.addEventListener('DOMContentLoaded', () => {
Promise.all([packagesPromise, areSignaturesPresent()]).then(([packages, areSignaturesPresentResult]) => {
const versionEl = document.querySelector('.version');
const signaturesHtml = areSignaturesPresentResult
? '<a href="javascript:redirectToFullList();">Signatures</a>'
: '<span class="missing-signatures">Missing signatures!</span>';
versionEl.innerHTML = `v. ${packages.$version} · ${signaturesHtml}`;

let html = `v. ${packages.$version}`;
if (['Windows', 'macOS', 'Linux'].includes(platform)) {
const signaturesHtml = areSignaturesPresentResult
? '<a href="javascript:redirectToFullList();">Signatures</a>'
: '<span class="missing-signatures">Missing signatures!</span>';

html += ` · ${signaturesHtml}`;
}

versionEl.innerHTML = html;
});
});
}
Expand All @@ -127,13 +138,19 @@ function redirectToFullList() {
location.href = LATEST_RELEASE_WEB_URL;
}

function redirectToStore(platform) {
location.href = MOBILE_URLS[platform.toLowerCase()];
}

function downloadDefault() {
if (platform === 'Windows') {
download('win');
} else if (platform === 'Linux') {
download('linux');
} else if (platform === 'macOS') {
redirectToMac();
} else if (platform === 'iOS' || platform === 'Android') {
redirectToStore(platform);
} else {
redirectToUnsupported();
}
Expand Down
2 changes: 1 addition & 1 deletion public/version.txt
Original file line number Diff line number Diff line change
@@ -1 +1 @@
1.17.0
1.17.1
1 change: 1 addition & 0 deletions src/api/types/backend.ts
Original file line number Diff line number Diff line change
Expand Up @@ -42,6 +42,7 @@ export type ApiSwapAsset = {
blockchain: string;
slug: string;
decimals: number;
isPopular: boolean;
image?: string;
contract?: string;
keywords?: string[];
Expand Down
4 changes: 2 additions & 2 deletions src/components/App.tsx
Original file line number Diff line number Diff line change
Expand Up @@ -8,7 +8,7 @@ import { INACTIVE_MARKER, IS_CAPACITOR } from '../config';
import { setActiveTabChangeListener } from '../util/activeTabMonitor';
import buildClassName from '../util/buildClassName';
import {
CAN_DELEGATE_BOTTOM_SHEET, IS_ANDROID, IS_DELEGATED_BOTTOM_SHEET, IS_ELECTRON, IS_IOS, IS_LINUX,
IS_ANDROID, IS_DELEGATED_BOTTOM_SHEET, IS_DELEGATING_BOTTOM_SHEET, IS_ELECTRON, IS_IOS, IS_LINUX,
} from '../util/windowEnvironment';
import { updateSizes } from '../util/windowSize';

Expand Down Expand Up @@ -79,7 +79,7 @@ function App({

const lang = useLang();
const { isPortrait } = useDeviceScreen();
const areSettingsInModal = !isPortrait || IS_ELECTRON || CAN_DELEGATE_BOTTOM_SHEET || IS_DELEGATED_BOTTOM_SHEET;
const areSettingsInModal = !isPortrait || IS_ELECTRON || IS_DELEGATING_BOTTOM_SHEET || IS_DELEGATED_BOTTOM_SHEET;
const [isBarcodeSupported, setIsBarcodeSupported] = useState<boolean>(false);

const [isInactive, markInactive] = useFlag(false);
Expand Down
6 changes: 3 additions & 3 deletions src/components/Dialogs.tsx
Original file line number Diff line number Diff line change
Expand Up @@ -5,7 +5,7 @@ import { getActions, withGlobal } from '../global';

import renderText from '../global/helpers/renderText';
import { pick } from '../util/iteratees';
import { CAN_DELEGATE_BOTTOM_SHEET, IS_DELEGATED_BOTTOM_SHEET } from '../util/windowEnvironment';
import { IS_DELEGATED_BOTTOM_SHEET, IS_DELEGATING_BOTTOM_SHEET } from '../util/windowEnvironment';

import useFlag from '../hooks/useFlag';
import useLang from '../hooks/useLang';
Expand All @@ -30,7 +30,7 @@ const Dialogs: FC<StateProps> = ({ dialogs }) => {
const title = lang('Something went wrong');

useEffect(() => {
if (CAN_DELEGATE_BOTTOM_SHEET || IS_DELEGATED_BOTTOM_SHEET) {
if (IS_DELEGATING_BOTTOM_SHEET || IS_DELEGATED_BOTTOM_SHEET) {
if (message) {
Dialog.alert({
title,
Expand All @@ -46,7 +46,7 @@ const Dialogs: FC<StateProps> = ({ dialogs }) => {
}
}, [dialogs, lang, message, openModal, title]);

if (!message || CAN_DELEGATE_BOTTOM_SHEET || IS_DELEGATED_BOTTOM_SHEET) {
if (!message || IS_DELEGATING_BOTTOM_SHEET || IS_DELEGATED_BOTTOM_SHEET) {
return undefined;
}

Expand Down
56 changes: 34 additions & 22 deletions src/components/common/TokenSelector.tsx
Original file line number Diff line number Diff line change
Expand Up @@ -14,8 +14,9 @@ import {
import { ANIMATED_STICKER_MIDDLE_SIZE_PX, TON_BLOCKCHAIN } from '../../config';
import { Big } from '../../lib/big.js/index.js';
import {
selectCurrentAccountState,
selectCurrentAccountTokens,
selectPopularTokensWithoutAccountTokens,
selectPopularTokens,
selectSwapTokens,
} from '../../global/selectors';
import buildClassName from '../../util/buildClassName';
Expand Down Expand Up @@ -52,14 +53,15 @@ interface StateProps {
swapTokens?: UserSwapToken[];
tokenInSlug?: string;
pairsBySlug?: Record<string, AssetPairs>;
balancesBySlug?: Record<string, string>;
baseCurrency?: ApiBaseCurrency;
isLoading?: boolean;
}

interface OwnProps {
isActive?: boolean;
shouldFilter?: boolean;
onlyPopular?: boolean;
isInsideSettings?: boolean;
onClose: NoneToVoidFunction;
onBack: NoneToVoidFunction;
}
Expand All @@ -80,10 +82,11 @@ function TokenSelector({
swapTokens,
popularTokens,
shouldFilter,
onlyPopular,
isInsideSettings,
baseCurrency,
tokenInSlug,
pairsBySlug,
balancesBySlug,
isActive,
isLoading,
onBack,
Expand All @@ -96,6 +99,7 @@ function TokenSelector({
setSwapTokenIn,
setSwapTokenOut,
addToken,
addSwapToken,
} = getActions();
const lang = useLang();

Expand Down Expand Up @@ -124,14 +128,27 @@ function TokenSelector({
const [renderingKey, setRenderingKey] = useState(SearchState.Initial);
const [searchTokenList, setSearchTokenList] = useState<Token[]>([]);

const popularTokensPrev = usePrevious(popularTokens);
const balancesBySlugPrev = usePrevious(balancesBySlug);

const filterTokens = useLastCallback((tokens: Token[]) => filterAndSortTokens(tokens, tokenInSlug, pairsBySlug));

const allUnimportedTonTokens = useMemo(() => {
const balances = balancesBySlugPrev ?? balancesBySlug ?? {};
const tokens = (swapTokens ?? EMPTY_ARRAY).filter(
(popularToken) => {
const isTonBlockchain = 'blockchain' in popularToken && popularToken.blockchain === TON_BLOCKCHAIN;
const isTokenUnimported = balances[popularToken.slug] === undefined;
return isTonBlockchain && isTokenUnimported;
},
);

return tokens;
}, [balancesBySlug, balancesBySlugPrev, swapTokens]);

const { userTokensWithFilter, popularTokensWithFilter, swapTokensWithFilter } = useMemo(() => {
const currentUserTokens = userTokens ?? EMPTY_ARRAY;
const currentSwapTokens = swapTokens ?? EMPTY_ARRAY;
const currentPopularTokens = popularTokensPrev ?? popularTokens ?? EMPTY_ARRAY;
const currentPopularTokens = popularTokens ?? EMPTY_ARRAY;

if (!shouldFilter) {
return {
Expand All @@ -142,26 +159,18 @@ function TokenSelector({
}

const filteredPopularTokens = filterTokens(currentPopularTokens);
let filteredUserTokens: Token[];
let filteredSwapTokens: Token[];

if (onlyPopular) {
filteredUserTokens = EMPTY_ARRAY;
filteredSwapTokens = EMPTY_ARRAY;
} else {
filteredUserTokens = filterTokens(currentUserTokens);
filteredSwapTokens = filterTokens(currentSwapTokens);
}
const filteredUserTokens = filterTokens(currentUserTokens);
const filteredSwapTokens = filterTokens(currentSwapTokens);

return {
userTokensWithFilter: filteredUserTokens,
popularTokensWithFilter: filteredPopularTokens,
swapTokensWithFilter: filteredSwapTokens,
};
}, [filterTokens, onlyPopular, popularTokens, popularTokensPrev, shouldFilter, swapTokens, userTokens]);
}, [filterTokens, popularTokens, shouldFilter, swapTokens, userTokens]);

const filteredTokenList = useMemo(() => {
const tokensToFilter = onlyPopular ? popularTokensWithFilter : swapTokensWithFilter;
const tokensToFilter = isInsideSettings ? allUnimportedTonTokens : swapTokensWithFilter;
const lowerCaseSearchValue = searchValue.toLowerCase().trim();

return tokensToFilter.filter(({
Expand All @@ -177,7 +186,7 @@ function TokenSelector({

return isName || isSymbol || isKeyword;
}).sort((a, b) => b.amount - a.amount) ?? [];
}, [onlyPopular, popularTokensWithFilter, searchValue, swapTokensWithFilter]);
}, [allUnimportedTonTokens, isInsideSettings, searchValue, swapTokensWithFilter]);

const resetSearch = () => {
setSearchValue('');
Expand Down Expand Up @@ -228,9 +237,10 @@ function TokenSelector({
onClose();
}

if (onlyPopular) {
if (isInsideSettings) {
addToken({ token: selectedToken as UserToken });
} else {
addSwapToken({ token: selectedToken as UserSwapToken });
const setToken = shouldFilter ? setSwapTokenOut : setSwapTokenIn;
setToken({ tokenSlug: selectedToken.slug });
}
Expand Down Expand Up @@ -435,8 +445,8 @@ function TokenSelector({
}

function renderTokenGroups() {
if (onlyPopular) {
return renderTokenGroup(popularTokensWithFilter, lang('POPULAR'));
if (isInsideSettings) {
return renderTokenGroup(allUnimportedTonTokens, lang('A-Z'));
}

return (
Expand Down Expand Up @@ -489,11 +499,12 @@ function TokenSelector({
}

export default memo(withGlobal<OwnProps>((global): StateProps => {
const balances = selectCurrentAccountState(global)?.balances;
const { isLoading, token } = global.settings.importToken ?? {};
const { pairs, tokenInSlug } = global.currentSwap ?? {};

const userTokens = selectCurrentAccountTokens(global);
const popularTokens = selectPopularTokensWithoutAccountTokens(global);
const popularTokens = selectPopularTokens(global);
const swapTokens = selectSwapTokens(global);
const { baseCurrency } = global.settings;

Expand All @@ -506,6 +517,7 @@ export default memo(withGlobal<OwnProps>((global): StateProps => {
tokenInSlug,
baseCurrency,
pairsBySlug: pairs?.bySlug,
balancesBySlug: balances?.bySlug,
};
})(TokenSelector));

Expand Down
Loading

0 comments on commit 11c55a3

Please sign in to comment.