Skip to content

Commit

Permalink
Release version 1.1.3 (226)
Browse files Browse the repository at this point in the history
  • Loading branch information
nguyenduythuc committed Oct 18, 2023
1 parent af20ed8 commit 5d3867d
Show file tree
Hide file tree
Showing 18 changed files with 149 additions and 61 deletions.
4 changes: 4 additions & 0 deletions CHANGELOG.md
Original file line number Diff line number Diff line change
@@ -1,3 +1,7 @@
## 1.1.3 (226)
- Fix bug nft doesn't show
- Fix bug show unclear message when send nft

## 1.1.3 (225)
- Cache the dApp list when opening the app for the first time (#1074)
- Update buy token ordering (#1076)
Expand Down
2 changes: 1 addition & 1 deletion android/app/build.gradle
Original file line number Diff line number Diff line change
Expand Up @@ -75,7 +75,7 @@ android {
applicationId "app.subwallet.mobile"
minSdkVersion rootProject.ext.minSdkVersion
targetSdkVersion rootProject.ext.targetSdkVersion
versionCode 225
versionCode 226
versionName "1.1.3"
missingDimensionStrategy 'react-native-camera', 'general'
}
Expand Down
6 changes: 3 additions & 3 deletions ios/Podfile.lock
Original file line number Diff line number Diff line change
Expand Up @@ -442,7 +442,7 @@ PODS:
- React-Core
- react-native-view-shot (3.7.0):
- React-Core
- react-native-webview (13.6.0):
- react-native-webview (13.6.2):
- React-Core
- React-NativeModulesApple (0.72.5):
- hermes-engine
Expand Down Expand Up @@ -972,7 +972,7 @@ SPEC CHECKSUMS:
react-native-version-number: b415bbec6a13f2df62bf978e85bc0d699462f37f
react-native-video: c26780b224543c62d5e1b2a7244a5cd1b50e8253
react-native-view-shot: f5507655f122e6b104888a11130f267a427f0d57
react-native-webview: 669ae162965f629a8d6a4bdd3b99a304d36ef1f2
react-native-webview: 8fc09f66a1a5b16bbe37c3878fda27d5982bb776
React-NativeModulesApple: 797bc6078d566eef3fb3f74127e6e1d2e945a15f
React-perflogger: cd8886513f68e1c135a1e79d20575c6489641597
React-RCTActionSheet: 726d2615ca62a77ce3e2c13d87f65379cdc73498
Expand Down Expand Up @@ -1017,4 +1017,4 @@ SPEC CHECKSUMS:

PODFILE CHECKSUM: d2e75413a9d4d28b9ab6ee8ae7baea6ba4324a25

COCOAPODS: 1.12.1
COCOAPODS: 1.13.0
4 changes: 2 additions & 2 deletions ios/SubWalletMobile.xcodeproj/project.pbxproj
Original file line number Diff line number Diff line change
Expand Up @@ -535,7 +535,7 @@
ASSETCATALOG_COMPILER_INCLUDE_ALL_APPICON_ASSETS = NO;
CLANG_ENABLE_MODULES = YES;
CODE_SIGN_ENTITLEMENTS = SubWalletMobile/SubWalletMobile.entitlements;
CURRENT_PROJECT_VERSION = 225;
CURRENT_PROJECT_VERSION = 226;
DEVELOPMENT_TEAM = ZUZ7T3GQMT;
ENABLE_BITCODE = NO;
INFOPLIST_FILE = SubWalletMobile/Info.plist;
Expand Down Expand Up @@ -568,7 +568,7 @@
ASSETCATALOG_COMPILER_INCLUDE_ALL_APPICON_ASSETS = NO;
CLANG_ENABLE_MODULES = YES;
CODE_SIGN_ENTITLEMENTS = SubWalletMobile/SubWalletMobile.entitlements;
CURRENT_PROJECT_VERSION = 225;
CURRENT_PROJECT_VERSION = 226;
DEVELOPMENT_TEAM = ZUZ7T3GQMT;
INFOPLIST_FILE = SubWalletMobile/Info.plist;
INFOPLIST_KEY_CFBundleDisplayName = SubWallet;
Expand Down
14 changes: 7 additions & 7 deletions package.json
Original file line number Diff line number Diff line change
@@ -1,7 +1,7 @@
{
"name": "SubWalletMobile",
"version": "1.1.3",
"build": "225",
"version": "1.1.4",
"build": "226",
"private": true,
"license": "Apache-2.0",
"reactNativePermissionsIOS": [
Expand Down Expand Up @@ -54,8 +54,8 @@
"@react-navigation/native": "^6.1.2",
"@react-navigation/native-stack": "^6.9.8",
"@reduxjs/toolkit": "^1.9.2",
"@subwallet/extension-chains": "^1.1.15-0",
"@subwallet/extension-dapp": "^1.1.15-0",
"@subwallet/extension-chains": "^1.1.17-0",
"@subwallet/extension-dapp": "^1.1.17-0",
"@subwallet/keyring": "^0.1.1",
"@subwallet/react-ui": "^5.1.2-b72",
"@subwallet/ui-keyring": "^0.1.1",
Expand Down Expand Up @@ -120,7 +120,7 @@
"react-native-version-number": "^0.3.6",
"react-native-video": "^5.2.1",
"react-native-view-shot": "^3.5.0",
"react-native-webview": "^13.2.3",
"react-native-webview": "^13.6.2",
"react-redux": "^8.0.5",
"redux-persist": "^6.0.0",
"redux-thunk": "^2.4.2",
Expand All @@ -140,7 +140,7 @@
"@react-native/eslint-config": "^0.72.2",
"@react-native/metro-config": "^0.72.11",
"@subwallet/chain-list": "^0.2.16-beta.4",
"@subwallet/extension-base": "^1.1.15-0",
"@subwallet/extension-base": "^1.1.17-0",
"@tsconfig/react-native": "^3.0.0",
"@types/jest": "^29.2.3",
"@types/react": "^18.0.25",
Expand Down Expand Up @@ -187,7 +187,7 @@
"@polkadot/util": "^12.2.1",
"@polkadot/api": "^10.7.2",
"@polkadot/util-crypto": "^12.2.1",
"@subwallet/extension-base": "^1.1.15-0",
"@subwallet/extension-base": "^1.1.17-0",
"@subwallet/chain-list": "0.2.16-beta.4",
"react-native-svg": "^13.6.0"
},
Expand Down
4 changes: 4 additions & 0 deletions src/AppNew.tsx
Original file line number Diff line number Diff line change
Expand Up @@ -30,6 +30,7 @@ import { SafeAreaProvider } from 'react-native-safe-area-context';
import { LockTimeout } from 'stores/types';
import { keyringLock } from './messaging';
import { updateAutoLockTime } from 'stores/MobileSettings';
import { useGetTokenConfigQuery } from 'stores/API';

const layerScreenStyle: StyleProp<any> = {
top: 0,
Expand Down Expand Up @@ -127,6 +128,7 @@ export const AppNew = () => {
const isCryptoReady = useCryptoReady();
const isI18nReady = useSetupI18n().isI18nReady;
useStoreBackgroundService();
const { refetch } = useGetTokenConfigQuery(undefined, { pollingInterval: 300000 });

// Enable lock screen on the start app
useEffect(() => {
Expand Down Expand Up @@ -163,11 +165,13 @@ export const AppNew = () => {
SplashScreen.hide();
}, 100);

refetch();
// if (buildNumber === 1) {
// Set default value on the first time install
// const buildNumberInt = parseInt(getBuildNumber(), 10);
// dispatch(setBuildNumber(buildNumberInt));
// }
// eslint-disable-next-line react-hooks/exhaustive-deps
}, []);

const isAppReady = isRequiredStoresReady && isCryptoReady && isI18nReady;
Expand Down
20 changes: 20 additions & 0 deletions src/hooks/screen/Home/Crypto/useShowBuyToken.ts
Original file line number Diff line number Diff line change
@@ -0,0 +1,20 @@
import { useMemo } from 'react';
import { Platform } from 'react-native';
import { useGetTokenConfigQuery } from 'stores/API';
import { getVersion } from 'react-native-device-info';

export function useShowBuyToken() {
const { data: tokenConfig } = useGetTokenConfigQuery(undefined, { pollingInterval: 60000 });
const isShowBuyToken = useMemo(() => {
if (Platform.OS === 'android') {
return true;
}
const currentAppVersion = getVersion();
if (tokenConfig?.buy?.includes(currentAppVersion)) {
return true;
}
return false;
}, [tokenConfig]);

return isShowBuyToken;
}
3 changes: 3 additions & 0 deletions src/hooks/screen/Home/Nft/useFetchNftCollection.ts
Original file line number Diff line number Diff line change
Expand Up @@ -52,6 +52,9 @@ export default function useFetchNftCollection(): NftCollectionType {
continue;
}
const collection: NftCollection = { ...nftCollection };
if (!collection.image) {
collection.image = nftItems.find(item => item.collectionId === collection.collectionId)?.image;
}
const key = `${collection.chain}-${collection.collectionId}`;
if (countMap[key] && countMap[key] > 0) {
collection.itemCount = countMap[key];
Expand Down
10 changes: 8 additions & 2 deletions src/screens/Home/Browser/BrowserHome.tsx
Original file line number Diff line number Diff line change
@@ -1,4 +1,4 @@
import React, { useCallback, useMemo } from 'react';
import React, { useCallback, useEffect, useMemo } from 'react';
import { FlatList, ListRenderItem, ScrollView, View } from 'react-native';
import { CaretRight } from 'phosphor-react-native';
import createStylesheet from './styles/BrowserHome';
Expand Down Expand Up @@ -97,10 +97,16 @@ const ItemSeparator = () => {
const BrowserHome = () => {
const stylesheet = createStylesheet();
const theme = useSubWalletTheme().swThemes;
const { data: dApps, isLoading } = useGetDAPPsQuery(undefined);
const { data: dApps, isLoading, refetch } = useGetDAPPsQuery(undefined);
const navigation = useNavigation<RootNavigationProps>();
const historyItems = useSelector((state: RootState) => state.browser.history);
const bookmarkItems = useSelector((state: RootState) => state.browser.bookmarks);

useEffect(() => {
refetch();
// eslint-disable-next-line react-hooks/exhaustive-deps
}, []);

const recommendedList = useMemo((): RecommendedListType[] | [] => {
if (!dApps) {
return [];
Expand Down
2 changes: 1 addition & 1 deletion src/screens/Home/Browser/BrowserTab.tsx
Original file line number Diff line number Diff line change
Expand Up @@ -346,7 +346,7 @@ const Component = ({ tabId, onOpenBrowserTabs, connectionTrigger }: Props, ref:

if (isSync) {
const injectScripts =
getJsInjectContent(true) + BridgeScript + injectPageJsContent + ConnectToNovaScript + DAppScript;
getJsInjectContent() + BridgeScript + injectPageJsContent + ConnectToNovaScript + DAppScript;

setInjectedScripts(injectScripts);
}
Expand Down
9 changes: 7 additions & 2 deletions src/screens/Home/Browser/index.tsx
Original file line number Diff line number Diff line change
@@ -1,4 +1,4 @@
import React, { useState } from 'react';
import React, { useEffect, useState } from 'react';
import { ScreenContainer } from 'components/ScreenContainer';
import BrowserHome from './BrowserHome';
import BrowserHeader from './Shared/BrowserHeader';
Expand Down Expand Up @@ -69,7 +69,7 @@ const tabbarIcon = (focused: boolean, item: RoutesType, theme: ThemeTypes) => {
export const BrowserScreen = ({ navigation }: NativeStackScreenProps<{}>) => {
const theme = useSubWalletTheme().swThemes;
const stylesheet = createStylesheet(theme);
const { data: categories } = useGetDAPPCategoriesQuery(undefined);
const { data: categories, refetch } = useGetDAPPCategoriesQuery(undefined);
const [searchString] = useState<string>('');
const categoryTabRoutes = categories ? categories.map(item => ({ key: item.slug, title: item.name })) : [];
const allTabRoutes = [{ key: 'all', title: i18n.common.all }, ...categoryTabRoutes];
Expand All @@ -86,6 +86,11 @@ export const BrowserScreen = ({ navigation }: NativeStackScreenProps<{}>) => {
};
};

useEffect(() => {
refetch();
// eslint-disable-next-line react-hooks/exhaustive-deps
}, []);

const screenListener = {
focus: () => {
Animated.timing(av, {
Expand Down
16 changes: 10 additions & 6 deletions src/screens/Home/Crypto/TokenGroupsDetailUpperBlock.tsx
Original file line number Diff line number Diff line change
Expand Up @@ -18,6 +18,7 @@ import { RootNavigationProps } from 'routes/index';
import { MAP_PREDEFINED_BUY_TOKEN } from 'constants/buy';
import { isAccountAll } from 'utils/accountAll';
import { BuyTokenInfo } from 'types/buy';
import { useShowBuyToken } from 'hooks/screen/Home/Crypto/useShowBuyToken';

interface Props {
balanceValue: SwNumberProps['value'];
Expand All @@ -42,6 +43,7 @@ export const TokenGroupsDetailUpperBlock = ({
const theme = useSubWalletTheme().swThemes;
const accounts = useSelector((state: RootState) => state.accountState.accounts);
const currentAccount = useSelector((state: RootState) => state.accountState.currentAccount);
const isShowBuyToken = useShowBuyToken();

const _style = createStyleSheet(theme);

Expand Down Expand Up @@ -117,12 +119,14 @@ export const TokenGroupsDetailUpperBlock = ({
onPress={onOpenSendFund}
buttonWrapperStyle={{ paddingHorizontal: theme.paddingSM }}
/>
<ActionButton
icon={ButtonIcon.Buy}
onPress={onOpenBuyTokens}
buttonWrapperStyle={{ paddingHorizontal: theme.paddingSM }}
disabled={!buyInfos.length}
/>
{isShowBuyToken && (
<ActionButton
icon={ButtonIcon.Buy}
onPress={onOpenBuyTokens}
buttonWrapperStyle={{ paddingHorizontal: theme.paddingSM }}
disabled={!buyInfos.length}
/>
)}
</View>
</View>
);
Expand Down
16 changes: 10 additions & 6 deletions src/screens/Home/Crypto/TokenGroupsUpperBlock.tsx
Original file line number Diff line number Diff line change
Expand Up @@ -15,6 +15,7 @@ import { ButtonIcon } from 'screens/Home/Crypto/shared/Button';
import { updateToggleBalance } from 'stores/base/Settings';
import { useNavigation } from '@react-navigation/native';
import { RootNavigationProps } from 'routes/index';
import { useShowBuyToken } from 'hooks/screen/Home/Crypto/useShowBuyToken';

interface Props {
totalValue: SwNumberProps['value'];
Expand Down Expand Up @@ -54,6 +55,7 @@ export const TokenGroupsUpperBlock = ({
const theme = useSubWalletTheme().swThemes;
const navigation = useNavigation<RootNavigationProps>();
const isShowBalance = useSelector((state: RootState) => state.settings.isShowBalance);
const isShowBuyToken = useShowBuyToken();
const _toggleBalances = () => {
updateToggleBalance();
toggleBalancesVisibility().catch(console.log);
Expand Down Expand Up @@ -145,12 +147,14 @@ export const TokenGroupsUpperBlock = ({
onPress={onOpenSendFund}
buttonWrapperStyle={{ paddingHorizontal: theme.paddingSM }}
/>
<ActionButton
label={i18n.cryptoScreen.buy}
icon={ButtonIcon.Buy}
onPress={() => navigation.navigate('Drawer', { screen: 'BuyToken', params: {} })}
buttonWrapperStyle={{ paddingHorizontal: theme.paddingSM }}
/>
{isShowBuyToken && (
<ActionButton
label={i18n.cryptoScreen.buy}
icon={ButtonIcon.Buy}
onPress={() => navigation.navigate('Drawer', { screen: 'BuyToken', params: {} })}
buttonWrapperStyle={{ paddingHorizontal: theme.paddingSM }}
/>
)}
</View>
</View>
);
Expand Down
13 changes: 13 additions & 0 deletions src/screens/Transaction/helper/nftParamsHandler.ts
Original file line number Diff line number Diff line change
Expand Up @@ -76,6 +76,17 @@ function psp34Parser(nftItem: NftItem) {
};
}

function varaParser(nftItem: NftItem) {
const contractAddress = nftItem.collectionId;
const tokenId = nftItem.id;

return {
contractAddress,
tokenId,
networkKey: nftItem.chain,
};
}

export default function nftParamsHandler(nftItem: NftItem, chain: string) {
if (nftItem.type === _AssetType.ERC721) {
return web3Parser(nftItem);
Expand All @@ -94,6 +105,8 @@ export default function nftParamsHandler(nftItem: NftItem, chain: string) {
return statemineParser(nftItem);
} else if (_NFT_CHAIN_GROUP.unique_network.includes(chain)) {
return uniqueParser(nftItem);
} else if (_NFT_CHAIN_GROUP.vara.includes(chain)) {
return varaParser(nftItem);
}
}

Expand Down
16 changes: 15 additions & 1 deletion src/stores/API.ts
Original file line number Diff line number Diff line change
@@ -1,9 +1,12 @@
import { createApi, fetchBaseQuery } from '@reduxjs/toolkit/query/react';
import { DAppInfo, DAPPCategory } from 'types/browser';
import { TokenConfig } from 'types/tokenConfig';

const baseQuery = fetchBaseQuery({ baseUrl: 'https://static-data.subwallet.app' });

export const browserDAPPs = createApi({
reducerPath: 'dApps',
baseQuery: fetchBaseQuery({ baseUrl: 'https://static-data.subwallet.app' }),
baseQuery,
endpoints: builder => ({
getDAPPs: builder.query<DAppInfo[], undefined>({
query: () => 'dapps/list.json',
Expand All @@ -14,4 +17,15 @@ export const browserDAPPs = createApi({
}),
});

export const tokenConfig = createApi({
reducerPath: 'tokenConfig',
baseQuery,
endpoints: builder => ({
getTokenConfig: builder.query<TokenConfig, undefined>({
query: () => 'tokens/config.json',
}),
}),
});

export const { useGetDAPPsQuery, useGetDAPPCategoriesQuery } = browserDAPPs;
export const { useGetTokenConfigQuery } = tokenConfig;
10 changes: 8 additions & 2 deletions src/stores/index.ts
Original file line number Diff line number Diff line change
Expand Up @@ -35,7 +35,7 @@ import LogoMap from 'stores/base/LogoMap';
import { mmkvReduxStore } from 'utils/storage';
import { PriceJson } from '@subwallet/extension-base/background/KoniTypes';
import { AssetRegistryStore, BalanceStore, BrowserSlice, ChainStore } from './types';
import { browserDAPPs } from './API';
import { browserDAPPs, tokenConfig } from './API';
import { setupListeners } from '@reduxjs/toolkit/query';

const persistRootConfig = {
Expand Down Expand Up @@ -93,6 +93,10 @@ const rootReducer = combineReducers({
{ key: browserDAPPs.reducerPath, storage: mmkvReduxStore },
browserDAPPs.reducer,
),
[tokenConfig.reducerPath]: persistReducer(
{ key: tokenConfig.reducerPath, storage: mmkvReduxStore },
tokenConfig.reducer,
),
});

const persistedReducer = persistReducer(persistRootConfig, rootReducer);
Expand All @@ -104,7 +108,9 @@ export const store = configureStore({
serializableCheck: {
ignoredActions: [FLUSH, REHYDRATE, PAUSE, PERSIST, PURGE, REGISTER],
},
}).concat(browserDAPPs.middleware),
})
.concat(browserDAPPs.middleware)
.concat(tokenConfig.middleware),
});

setupListeners(store.dispatch);
Expand Down
5 changes: 5 additions & 0 deletions src/types/tokenConfig.ts
Original file line number Diff line number Diff line change
@@ -0,0 +1,5 @@
export type TokenConfig = {
address: boolean;
send: boolean;
buy: string[];
};
Loading

0 comments on commit 5d3867d

Please sign in to comment.