Skip to content

Commit

Permalink
holders fixes
Browse files Browse the repository at this point in the history
  • Loading branch information
voloshinskii committed May 13, 2024
1 parent 6568c71 commit 823a5d0
Show file tree
Hide file tree
Showing 6 changed files with 34 additions and 26 deletions.
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.2.0"
versionName "4.4.2"
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 @@ -1294,7 +1294,7 @@
"$(inherited)",
"@executable_path/Frameworks",
);
MARKETING_VERSION = 4.2.0;
MARKETING_VERSION = 4.4.2;
OTHER_LDFLAGS = (
"$(inherited)",
"-ObjC",
Expand Down Expand Up @@ -1328,7 +1328,7 @@
"$(inherited)",
"@executable_path/Frameworks",
);
MARKETING_VERSION = 4.2.0;
MARKETING_VERSION = 4.4.2;
OTHER_LDFLAGS = (
"$(inherited)",
"-ObjC",
Expand Down
9 changes: 6 additions & 3 deletions packages/mobile/src/components/CardsWidget/CardsWidget.tsx
Original file line number Diff line number Diff line change
Expand Up @@ -8,14 +8,17 @@ import { useCardsState } from '$wallet/hooks';
export const CardsWidget = memo(() => {
const state = useCardsState();

const shouldRenderCardsList =
state.accounts.filter((account) =>
['PENDING_CONTRACT', 'ACTIVE'].includes(account.state),
).length || state.prepaidCards.length;

return (
<View style={styles.container}>
{!state.accounts.length && !state.onboardBannerDismissed ? (
<OnboardBanner onDismissBanner={() => tk.wallet.cards.dismissOnboardBanner()} />
) : null}
{state.accounts.filter((account) =>
['PENDING_CONTRACT', 'ACTIVE'].includes(account.state),
).length ? (
{shouldRenderCardsList ? (
<>
<CardsList prepaidCards={state.prepaidCards} accounts={state.accounts} />
<Spacer y={16} />
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -32,11 +32,12 @@ export const CardsList = memo<CardsListProps>((props) => {
const unlockVault = useUnlockVault();
const enroll = useHoldersEnroll(unlockVault);
const openWebView = useCallback(
(accountId) => () => {
enroll(() =>
nav.push(MainStackRouteNames.HoldersWebView, { path: `/account/${accountId}` }),
);
},
(accountId, path: 'account' | 'card-prepaid' = 'account') =>
() => {
enroll(() =>
nav.push(MainStackRouteNames.HoldersWebView, { path: `/${path}/${accountId}` }),
);
},
[enroll, nav],
);
const getTokenPrice = useGetTokenPrice();
Expand Down Expand Up @@ -74,7 +75,7 @@ export const CardsList = memo<CardsListProps>((props) => {
))}
{props.prepaidCards.map((card) => (
<List.Item
onPress={openWebView(props.accounts[0]?.id)}
onPress={openWebView(card.id, 'card-prepaid')}
leftContent={
<View key={card.lastFourDigits} style={[styles.cardIcon]}>
<Image source={CARD_DESIGN_3} style={styles.cardCover.static} />
Expand Down
26 changes: 13 additions & 13 deletions packages/mobile/src/screens/HoldersWebView/HoldersWebView.tsx
Original file line number Diff line number Diff line change
Expand Up @@ -105,7 +105,6 @@ export const HoldersWebView = memo<HoldersWebViewProps>((props) => {
// Resolve parameters
let data: any;
let id: number;
let processed = false;
try {
let parsed = JSON.parse(nativeEvent.data);

Expand Down Expand Up @@ -245,11 +244,12 @@ export const HoldersWebView = memo<HoldersWebViewProps>((props) => {
initialInjectState: initialState,
});
}, [
accountState?.kycStatus,
accountState.kycStatus,
accountState?.state,
accountState?.suspended,
accountsPrivate,
injectedJavaScriptBeforeContentLoaded,
prepaidCards,
safeAreaInsets,
]);

Expand Down Expand Up @@ -290,15 +290,15 @@ export const HoldersWebView = memo<HoldersWebViewProps>((props) => {
style={styles.webView.static}
webviewDebuggingEnabled
/>
{mainButton && mainButton.isVisible && (
<KeyboardAvoidingView
style={[
styles.keyboardAvoidingView.static,
{ bottom: Math.max(safeAreaInsets.bottom, 16) },
]}
behavior={Platform.OS === 'ios' ? 'position' : undefined}
contentContainerStyle={styles.keyboardAvoidingViewContainer.static}
>
<KeyboardAvoidingView
style={[
styles.keyboardAvoidingView.static,
{ bottom: Math.max(safeAreaInsets.bottom, 16) },
]}
behavior={Platform.OS === 'ios' ? 'position' : undefined}
contentContainerStyle={styles.keyboardAvoidingViewContainer.static}
>
{mainButton && mainButton.isVisible && (
<Animated.View
style={Platform.select({
android: { marginHorizontal: 16, marginBottom: 16 },
Expand All @@ -308,8 +308,8 @@ export const HoldersWebView = memo<HoldersWebViewProps>((props) => {
>
<DappMainButton {...mainButton} />
</Animated.View>
</KeyboardAvoidingView>
)}
)}
</KeyboardAvoidingView>
</Animated.View>
);
});
Expand Down
6 changes: 5 additions & 1 deletion packages/mobile/src/wallet/managers/CardsManager.tsx
Original file line number Diff line number Diff line change
Expand Up @@ -14,7 +14,11 @@ export interface AccountCard {
kind: string;
}

export type PrepaidCard = AccountCard & { type: 'PREPAID'; fiatBalance: string };
export type PrepaidCard = AccountCard & {
id: string;
type: 'PREPAID';
fiatBalance: string;
};

export interface AccountState {
id: string;
Expand Down

0 comments on commit 823a5d0

Please sign in to comment.