diff --git a/.github/workflows/build-release.yml b/.github/workflows/build-release.yml index 9aca51611..dfaa20dc7 100644 --- a/.github/workflows/build-release.yml +++ b/.github/workflows/build-release.yml @@ -188,7 +188,7 @@ jobs: with: serviceAccountJson: ${{ secrets.SERVICE_ACCOUNT_JSON_CONTENT }} packageName: app.subwallet.mobile - releaseFiles: android/app/build/outputs/bundle/release/*.aab + releaseFiles: android/app/build/outputs/bundle/release/app-release.aab track: internal status: completed whatsNewDirectory: whatsNewDirectory diff --git a/.github/workflows/test-android.yml b/.github/workflows/test-android.yml new file mode 100644 index 000000000..fab802a8c --- /dev/null +++ b/.github/workflows/test-android.yml @@ -0,0 +1,92 @@ +name: Release builds + +on: + push: + branches: [ "upgrade-ui" ] + +jobs: + build-android: + name: Android builds + runs-on: macos-latest + env: + GH_PAT: ${{ secrets.GH_PAT }} + GH_RELEASE_GITHUB_API_TOKEN: ${{ secrets.GH_PAT }} + KS_PASSWORD: ${{ secrets.KS_PASSWORD }} + NEXTCLOUD_CONFIG: ${{ secrets.NEXTCLOUD_CONFIG }} + DISCORD_WEBHOOK: ${{ secrets.DISCORD_WEBHOOK }} + COMMIT_MESSAGE: ${{ github.event.pull_request.title }} + REF_NAME: ${{ github.ref_name }} + TRANSAK_API_KEY: ${{ secrets.TRANSAK_API_KEY }} + COINBASE_PAY_ID: ${{ secrets.COINBASE_PAY_ID }} + BUILD_PROVISION_PROFILE_BASE64: ${{ secrets.BUILD_PROVISION_PROFILE_BASE64 }} + steps: + - uses: actions/checkout@v4 + with: + fetch-depth: 0 + token: ${{ secrets.GH_PAT }} + + # - name: Add APP ENV + # run: | + # cp .env.development.example .env.production + # if [ -f .env.production ]; then + # sed -i '' "s/^TRANSAK_API_KEY=.*/TRANSAK_API_KEY=$TRANSAK_API_KEY/" .env.production + # sed -i '' "s/^COINBASE_PAY_ID=.*/COINBASE_PAY_ID=$COINBASE_PAY_ID/" .env.production + # else + # echo "TRANSAK_API_KEY=$TRANSAK_API_KEY" >> .env.production + # echo "COINBASE_PAY_ID=$COINBASE_PAY_ID" >> .env.production + # fi + + # - name: Cache Dependencies + # uses: actions/cache@v2 + # with: + # path: ~/.cache/yarn + # key: ${{ runner.os }}-yarn-${{ hashFiles('**/yarn.lock') }} + # restore-keys: | + # ${{ runner.os }}-yarn- + + # - name: Install dependencies + # run: yarn install --immutable | grep -v 'YN0013' + + # - uses: actions/setup-java@v1 + # with: + # java-version: '11' + + # - name: Cache Gradle Wrapper + # uses: actions/cache@v2 + # with: + # path: ~/.gradle/wrapper + # key: ${{ runner.os }}-gradle-wrapper-${{ hashFiles('gradle/wrapper/gradle-wrapper.properties') }} + + # - name: Cache Gradle Dependencies + # uses: actions/cache@v2 + # with: + # path: ~/.gradle/caches + # key: ${{ runner.os }}-gradle-caches-${{ hashFiles('gradle/wrapper/gradle-wrapper.properties') }} + # restore-keys: | + # ${{ runner.os }}-gradle-caches- + + # - name: Make Gradlew Executable + # run: cd android && chmod +x ./gradlew + + - name: Prepare sign datarun + run: | + recent_tag=$(git describe --tags --abbrev=0) + commit_messages=$(git log --pretty=format:"%s" $recent_tag..HEAD) + filtered_messages=$(echo "$commit_messages" | grep -oE '\[issue-[0-9]+\] .+' | sed -E 's/\[issue-([0-9]+)\] (.+)/- \2 (#\1)/') + mkdir -p whatsnew + echo "$filtered_messages" > whatsnew/whatsnew-en-US + + # # Build AAB file + # - name: Generate App AAB + # run: | + # cd android && export ENVFILE=.env.production && ./gradlew bundleRelease -PMYAPP_UPLOAD_STORE_FILE=${{ secrets.MYAPP_UPLOAD_STORE_FILE }} -PMYAPP_UPLOAD_STORE_PASSWORD=${{ secrets.ANDROID_KEY_STORE_PASSWORD }} -PMYAPP_UPLOAD_KEY_PASSWORD=${{ secrets.ANDROID_KEY_PASSWORD }} -PMYAPP_UPLOAD_KEY_ALIAS=${{ secrets.ANDROID_ALIAS }} + + - name: Upload to Play Store Internal Testing + uses: r0adkll/upload-google-play@v1 + with: + serviceAccountJsonPlainText: ${{ secrets.SERVICE_ACCOUNT_JSON_CONTENT }} + packageName: app.subwallet.mobile + releaseFiles: app-release.aab + track: internal + status: completed + whatsNewDirectory: whatsnew diff --git a/android/app/build.gradle b/android/app/build.gradle index 4413870d6..9c6a4e6d7 100644 --- a/android/app/build.gradle +++ b/android/app/build.gradle @@ -75,7 +75,7 @@ android { applicationId "app.subwallet.mobile" minSdkVersion rootProject.ext.minSdkVersion targetSdkVersion rootProject.ext.targetSdkVersion - versionCode 228 + versionCode 229 versionName "1.1.5" missingDimensionStrategy 'react-native-camera', 'general' } diff --git a/app-release.aab b/app-release.aab new file mode 100644 index 000000000..6be24e043 Binary files /dev/null and b/app-release.aab differ diff --git a/src/components/TokenSelectItem.tsx b/src/components/TokenSelectItem.tsx index e3588eb6c..e2c1dd5f7 100644 --- a/src/components/TokenSelectItem.tsx +++ b/src/components/TokenSelectItem.tsx @@ -1,15 +1,17 @@ -import React from 'react'; -import { StyleProp, TouchableOpacity, TouchableOpacityProps, View } from 'react-native'; +import React, { useMemo } from 'react'; +import { StyleSheet, TouchableOpacity, TouchableOpacityProps, View } from 'react-native'; import { getTokenLogo } from 'utils/index'; import Text from 'components/Text'; import { ColorMap } from 'styles/color'; import { FontMedium, FontSemiBold } from 'styles/sharedStyles'; import { CheckCircle } from 'phosphor-react-native'; -import { Icon } from 'components/design-system-ui'; +import { Icon, Typography } from 'components/design-system-ui'; import { useSubWalletTheme } from 'hooks/useSubWalletTheme'; +import { ThemeTypes } from 'styles/themes'; interface Props extends TouchableOpacityProps { symbol: string; + name: string; chain: string; logoKey: string; subLogoKey?: string; @@ -19,41 +21,9 @@ interface Props extends TouchableOpacityProps { iconSize?: number; } -const itemArea: StyleProp = { - flexDirection: 'row', - justifyContent: 'space-between', - paddingVertical: 14, - alignItems: 'center', - paddingHorizontal: 12, - backgroundColor: '#1A1A1A', - marginHorizontal: 16, - marginBottom: 8, - borderRadius: 8, -}; - -const itemBodyArea: StyleProp = { - flexDirection: 'row', - alignItems: 'center', -}; - -const itemTextStyle: StyleProp = { - paddingLeft: 8, - color: ColorMap.light, - fontSize: 16, - lineHeight: 24, - ...FontSemiBold, -}; - -const subTextStyle: StyleProp = { - paddingLeft: 8, - color: 'rgba(255, 255, 255, 0.45)', - fontSize: 12, - lineHeight: 20, - ...FontMedium, -}; - export const TokenSelectItem = ({ symbol, + name, chain, logoKey, subLogoKey, @@ -63,27 +33,27 @@ export const TokenSelectItem = ({ iconSize = 40, }: Props) => { const theme = useSubWalletTheme().swThemes; + const styles = useMemo(() => createStyle(theme), [theme]); return ( - - + + {getTokenLogo(logoKey, subLogoKey, iconSize, defaultItemKey)} - - {symbol} - {chain} + + + + {symbol} + + {`(${name})`} + + + {chain} {isSelected && ( - + )} @@ -91,3 +61,58 @@ export const TokenSelectItem = ({ ); }; + +function createStyle(theme: ThemeTypes) { + return StyleSheet.create({ + itemArea: { + flexDirection: 'row', + flex: 1, + // justifyContent: 'space-between', + paddingVertical: theme.paddingSM + 2, + alignItems: 'center', + paddingHorizontal: theme.paddingSM, + backgroundColor: theme.colorBgSecondary, + marginHorizontal: theme.padding, + marginBottom: theme.marginXS, + borderRadius: theme.borderRadiusLG, + }, + + itemBodyArea: { + flexDirection: 'row', + alignItems: 'center', + flex: 1, + }, + + itemTextStyle: { + paddingLeft: theme.marginXS, + color: ColorMap.light, + fontSize: theme.fontSizeLG, + lineHeight: theme.fontSizeLG * theme.lineHeightLG, + ...FontSemiBold, + }, + + itemTokenNameStyle: { + paddingLeft: theme.paddingXXS, + color: theme.colorTextTertiary, + fontSize: theme.fontSizeLG, + lineHeight: theme.fontSizeLG * theme.lineHeightLG, + flex: 1, + ...FontSemiBold, + }, + + subTextStyle: { + paddingLeft: theme.paddingXS, + color: theme.colorTextTertiary, + fontSize: theme.fontSizeSM, + lineHeight: theme.fontSizeSM * theme.lineHeightSM, + ...FontMedium, + }, + selectedIconWrapper: { + width: 40, + height: 40, + alignItems: 'center', + justifyContent: 'center', + marginRight: -theme.marginXS, + }, + }); +} diff --git a/src/components/common/SelectModal/parts/TokenSelectItem.tsx b/src/components/common/SelectModal/parts/TokenSelectItem.tsx index cbee9f970..c0582f624 100644 --- a/src/components/common/SelectModal/parts/TokenSelectItem.tsx +++ b/src/components/common/SelectModal/parts/TokenSelectItem.tsx @@ -13,10 +13,11 @@ interface Props { export function _TokenSelectItem({ item, selectedValueMap, onSelectItem, onCloseModal }: Props) { const chainInfoMap = useSelector((state: RootState) => state.chainStore.chainInfoMap); - const { symbol, originChain, slug } = item as TokenItemType; + const { symbol, originChain, slug, name } = item as TokenItemType; return ( { export default function useBuyToken(currentSymbol?: string) { const { accounts, isAllAccount, currentAccount } = useSelector((state: RootState) => state.accountState); + const { assetRegistry } = useSelector((state: RootState) => state.assetRegistry); const { isLocked } = useAppLock(); const { walletReference } = useSelector((state: RootState) => state.settings); const chainInfoMap = useSelector((state: RootState) => state.chainStore.chainInfoMap); @@ -155,7 +156,7 @@ export default function useBuyToken(currentSymbol?: string) { if (ledgerNetwork) { if (info.network === ledgerNetwork) { result.push({ - name: info.symbol, + name: assetRegistry[info.slug].name, slug: info.slug, symbol: info.symbol, originChain: info.network, @@ -164,7 +165,7 @@ export default function useBuyToken(currentSymbol?: string) { } else { if (accountType === 'ALL' || accountType === info.support) { result.push({ - name: info.symbol, + name: assetRegistry[info.slug].name, slug: info.slug, symbol: info.symbol, originChain: info.network, @@ -174,7 +175,7 @@ export default function useBuyToken(currentSymbol?: string) { }); return result; - }, [accountType, currentSymbol, ledgerNetwork]); + }, [accountType, assetRegistry, currentSymbol, ledgerNetwork]); const openSelectBuyAccount = useCallback((account: AccountJson) => { setSelectedService({ selectedService: undefined }); diff --git a/src/screens/Home/Crypto/TokenGroupsDetail.tsx b/src/screens/Home/Crypto/TokenGroupsDetail.tsx index 7f598d27e..5a6545322 100644 --- a/src/screens/Home/Crypto/TokenGroupsDetail.tsx +++ b/src/screens/Home/Crypto/TokenGroupsDetail.tsx @@ -53,7 +53,6 @@ export const TokenGroupsDetail = ({ return ''; }, [tokenGroupSlug, assetRegistryMap, multiChainAssetMap]); - console.log('groupSymbol', groupSymbol); const currentAccount = useSelector((state: RootState) => state.accountState.currentAccount); const { diff --git a/src/screens/ImportToken/ImportToken.tsx b/src/screens/ImportToken/ImportToken.tsx index 1b1670d10..2bc0ead2b 100644 --- a/src/screens/ImportToken/ImportToken.tsx +++ b/src/screens/ImportToken/ImportToken.tsx @@ -2,7 +2,7 @@ import React, { useCallback, useContext, useEffect, useMemo, useRef, useState } import { ContainerWithSubHeader } from 'components/ContainerWithSubHeader'; import { useNavigation } from '@react-navigation/native'; import { ImportTokenProps, RootNavigationProps } from 'routes/index'; -import { ScrollView, View } from 'react-native'; +import { ScrollView, StyleSheet, View } from 'react-native'; import { ContainerHorizontalPadding, MarginBottomForSubmitButton } from 'styles/sharedStyles'; import i18n from 'utils/i18n/i18n'; import { FormState } from 'hooks/screen/useFormControl'; @@ -38,6 +38,8 @@ import { Plus } from 'phosphor-react-native'; import { TokenTypeSelectField } from 'components/Field/TokenTypeSelect'; import { ModalRef } from 'types/modalRef'; import { ChainSelector } from 'components/Modal/common/ChainSelector'; +import { ThemeTypes } from 'styles/themes'; +import { useSubWalletTheme } from 'hooks/useSubWalletTheme'; interface TokenTypeOption { label: string; @@ -91,6 +93,8 @@ export const ImportToken = ({ route: { params: routeParams } }: ImportTokenProps const { isNetConnected, isReady } = useContext(WebRunnerContext); const [name, setName] = useState(''); const [error, setError] = useState(undefined); + const theme = useSubWalletTheme().swThemes; + const styles = useMemo(() => createStyle(theme), [theme]); const formConfig = { chain: { @@ -109,6 +113,10 @@ export const ImportToken = ({ route: { params: routeParams } }: ImportTokenProps name: i18n.common.decimals, value: tokenInfo ? String(tokenInfo?.decimals) : '', }, + tokenName: { + name: 'Token name', + value: tokenInfo ? String(tokenInfo?.name) : '', + }, contractAddress: { require: true, name: i18n.importToken.contractAddress, @@ -220,6 +228,7 @@ export const ImportToken = ({ route: { params: routeParams } }: ImportTokenProps } else { onUpdateErrors('contractAddress')(undefined); onChangeValue('symbol')(resp.symbol); + onChangeValue('tokenName')(resp.name); setName(resp.name); if (resp.decimals) { onChangeValue('decimals')(String(resp.decimals)); @@ -360,9 +369,22 @@ export const ImportToken = ({ route: { params: routeParams } }: ImportTokenProps )} - + + + + + - + {!isNetConnected && ( @@ -419,3 +441,13 @@ export const ImportToken = ({ route: { params: routeParams } }: ImportTokenProps ); }; + +function createStyle(theme: ThemeTypes) { + return StyleSheet.create({ + row: { + flexDirection: 'row', + gap: theme.sizeSM, + marginBottom: theme.marginXS, + }, + }); +} diff --git a/src/screens/Tokens/ConfigureToken.tsx b/src/screens/Tokens/ConfigureToken.tsx index 159836522..ef454394e 100644 --- a/src/screens/Tokens/ConfigureToken.tsx +++ b/src/screens/Tokens/ConfigureToken.tsx @@ -206,13 +206,21 @@ export const ConfigureToken = ({ /> )} + {tokenInfo && tokenInfo.name && ( + + )} + + + + {!!tokenInfo?.priceId && ( + + )} + {tokenInfo && tokenInfo.decimals && ( )} - {!!tokenInfo?.priceId && } - {!isNetConnected && ( )}