Skip to content

Commit

Permalink
Merge remote-tracking branch 'upstream/master'
Browse files Browse the repository at this point in the history
  • Loading branch information
gruve-p committed Sep 3, 2024
2 parents b8a516a + a37cb91 commit ac4f3a2
Show file tree
Hide file tree
Showing 15 changed files with 272 additions and 147 deletions.
10 changes: 5 additions & 5 deletions Gemfile.lock
Original file line number Diff line number Diff line change
Expand Up @@ -24,16 +24,16 @@ GEM
artifactory (3.0.17)
atomos (0.1.3)
aws-eventstream (1.3.0)
aws-partitions (1.965.0)
aws-sdk-core (3.201.5)
aws-partitions (1.970.0)
aws-sdk-core (3.202.2)
aws-eventstream (~> 1, >= 1.3.0)
aws-partitions (~> 1, >= 1.651.0)
aws-sigv4 (~> 1.9)
jmespath (~> 1, >= 1.6.1)
aws-sdk-kms (1.88.0)
aws-sdk-core (~> 3, >= 3.201.0)
aws-sigv4 (~> 1.5)
aws-sdk-s3 (1.158.0)
aws-sdk-s3 (1.159.0)
aws-sdk-core (~> 3, >= 3.201.0)
aws-sdk-kms (~> 1)
aws-sigv4 (~> 1.5)
Expand Down Expand Up @@ -217,7 +217,7 @@ GEM
json (2.7.2)
jwt (2.8.2)
base64
logger (1.6.0)
logger (1.6.1)
mini_magick (4.13.2)
mini_mime (1.1.5)
minitest (5.25.1)
Expand All @@ -239,7 +239,7 @@ GEM
trailblazer-option (>= 0.1.1, < 0.2.0)
uber (< 0.2.0)
retriable (3.1.2)
rexml (3.3.5)
rexml (3.3.6)
strscan
rouge (2.0.7)
ruby-macho (2.5.1)
Expand Down
2 changes: 1 addition & 1 deletion android/app/build.gradle
Original file line number Diff line number Diff line change
Expand Up @@ -80,7 +80,7 @@ android {
minSdkVersion rootProject.ext.minSdkVersion
targetSdkVersion rootProject.ext.targetSdkVersion
versionCode 1
versionName "7.0.3"
versionName "7.0.4"
testBuildType System.getProperty('testBuildType', 'debug')
testInstrumentationRunner 'androidx.test.runner.AndroidJUnitRunner'
}
Expand Down
90 changes: 61 additions & 29 deletions components/ManageWalletsListItem.tsx
Original file line number Diff line number Diff line change
Expand Up @@ -7,18 +7,6 @@ import { TransactionListItem } from './TransactionListItem';
import { useTheme } from './themes';
import { BitcoinUnit } from '../models/bitcoinUnits';

interface ManageWalletsListItemProps {
item: Item;
isDraggingDisabled: boolean;
drag: () => void;
isActive: boolean;
state: { wallets: TWallet[]; searchQuery: string };
navigateToWallet: (wallet: TWallet) => void;
renderHighlightedText: (text: string, query: string) => JSX.Element;
handleDeleteWallet: (wallet: TWallet) => void;
handleToggleHideBalance: (wallet: TWallet) => void;
}

enum ItemType {
WalletSection = 'wallet',
TransactionSection = 'transaction',
Expand All @@ -36,6 +24,18 @@ interface TransactionItem {

type Item = WalletItem | TransactionItem;

interface ManageWalletsListItemProps {
item: Item;
isDraggingDisabled: boolean;
drag?: () => void;
isPlaceHolder?: boolean;
state: { wallets: TWallet[]; searchQuery: string };
navigateToWallet: (wallet: TWallet) => void;
renderHighlightedText: (text: string, query: string) => JSX.Element;
handleDeleteWallet: (wallet: TWallet) => void;
handleToggleHideBalance: (wallet: TWallet) => void;
}

interface SwipeContentProps {
onPress: () => void;
hideBalance?: boolean;
Expand All @@ -61,8 +61,8 @@ const ManageWalletsListItem: React.FC<ManageWalletsListItemProps> = ({
item,
isDraggingDisabled,
drag,
isActive,
state,
isPlaceHolder = false,
navigateToWallet,
renderHighlightedText,
handleDeleteWallet,
Expand All @@ -76,27 +76,59 @@ const ManageWalletsListItem: React.FC<ManageWalletsListItemProps> = ({
}
}, [item, navigateToWallet]);

const leftContent = useCallback(
(reset: () => void) => (
<LeftSwipeContent
onPress={() => {
handleToggleHideBalance(item.data as TWallet);
reset();
}}
hideBalance={(item.data as TWallet).hideBalance}
colors={colors}
/>
),
[colors, handleToggleHideBalance, item.data],
);

const rightContent = useCallback(
(reset: () => void) => (
<RightSwipeContent
onPress={() => {
handleDeleteWallet(item.data as TWallet);
reset();
}}
/>
),
[handleDeleteWallet, item.data],
);

if (item.type === ItemType.WalletSection) {
return (
<ListItem.Swipeable
leftWidth={80}
rightWidth={90}
minSlideWidth={40}
leftContent={
<LeftSwipeContent onPress={() => handleToggleHideBalance(item.data)} hideBalance={item.data.hideBalance} colors={colors} />
}
rightContent={<RightSwipeContent colors={colors} onPress={() => handleDeleteWallet(item.data)} />}
animation={{ duration: 400 }}
containerStyle={{ backgroundColor: colors.background }}
leftContent={leftContent}
rightContent={rightContent}
>
<View style={styles.walletCarouselItemContainer}>
<WalletCarouselItem
item={item.data}
handleLongPress={isDraggingDisabled ? undefined : drag}
isActive={isActive}
onPress={onPress}
searchQuery={state.searchQuery}
renderHighlightedText={renderHighlightedText}
/>
</View>
<ListItem.Content
style={{
backgroundColor: colors.background,
}}
>
<View style={styles.walletCarouselItemContainer}>
<WalletCarouselItem
item={item.data}
handleLongPress={isDraggingDisabled ? undefined : drag}
onPress={onPress}
animationsEnabled={false}
searchQuery={state.searchQuery}
isPlaceHolder={isPlaceHolder}
renderHighlightedText={renderHighlightedText}
/>
</View>
</ListItem.Content>
</ListItem.Swipeable>
);
} else if (item.type === ItemType.TransactionSection && item.data) {
Expand Down Expand Up @@ -135,4 +167,4 @@ const styles = StyleSheet.create({
},
});

export default ManageWalletsListItem;
export { ManageWalletsListItem, LeftSwipeContent, RightSwipeContent };
115 changes: 73 additions & 42 deletions components/WalletsCarousel.tsx
Original file line number Diff line number Diff line change
Expand Up @@ -98,7 +98,6 @@ interface WalletCarouselItemProps {
isSelectedWallet?: boolean;
customStyle?: ViewStyle;
horizontal?: boolean;
isActive?: boolean;
searchQuery?: string;
renderHighlightedText?: (text: string, query: string) => JSX.Element;
}
Expand Down Expand Up @@ -162,8 +161,32 @@ const iStyles = StyleSheet.create({
},
});

interface WalletCarouselItemProps {
item: TWallet;
onPress: (item: TWallet) => void;
handleLongPress?: () => void;
isSelectedWallet?: boolean;
customStyle?: ViewStyle;
horizontal?: boolean;
isPlaceHolder?: boolean;
searchQuery?: string;
renderHighlightedText?: (text: string, query: string) => JSX.Element;
animationsEnabled?: boolean;
}

export const WalletCarouselItem: React.FC<WalletCarouselItemProps> = React.memo(
({ item, onPress, handleLongPress, isSelectedWallet, customStyle, horizontal, searchQuery, renderHighlightedText }) => {
({
item,
onPress,
handleLongPress,
isSelectedWallet,
customStyle,
horizontal,
searchQuery,
renderHighlightedText,
animationsEnabled = true,
isPlaceHolder = false,
}) => {
const scaleValue = useRef(new Animated.Value(1.0)).current;
const { colors } = useTheme();
const { walletTransactionUpdateStatus } = useStorage();
Expand All @@ -172,22 +195,26 @@ export const WalletCarouselItem: React.FC<WalletCarouselItemProps> = React.memo(
const isLargeScreen = useIsLargeScreen();

const onPressedIn = useCallback(() => {
Animated.spring(scaleValue, {
toValue: 0.95,
useNativeDriver: true,
friction: 3,
tension: 100,
}).start();
}, [scaleValue]);
if (animationsEnabled) {
Animated.spring(scaleValue, {
toValue: 0.95,
useNativeDriver: true,
friction: 3,
tension: 100,
}).start();
}
}, [scaleValue, animationsEnabled]);

const onPressedOut = useCallback(() => {
Animated.spring(scaleValue, {
toValue: 1.0,
useNativeDriver: true,
friction: 3,
tension: 100,
}).start();
}, [scaleValue]);
if (animationsEnabled) {
Animated.spring(scaleValue, {
toValue: 1.0,
useNativeDriver: true,
friction: 3,
tension: 100,
}).start();
}
}, [scaleValue, animationsEnabled]);

const handlePress = useCallback(() => {
onPressedOut();
Expand Down Expand Up @@ -239,33 +266,37 @@ export const WalletCarouselItem: React.FC<WalletCarouselItemProps> = React.memo(
<LinearGradient colors={WalletGradient.gradientsFor(item.type)} style={iStyles.grad}>
<Image defaultSource={image} source={image} style={iStyles.image} />
<Text style={iStyles.br} />
<Text numberOfLines={1} style={[iStyles.label, { color: colors.inverseForegroundColor }]}>
{renderHighlightedText && searchQuery ? renderHighlightedText(item.getLabel(), searchQuery) : item.getLabel()}
</Text>
<View style={iStyles.balanceContainer}>
{item.hideBalance ? (
<>
<BlueSpacing10 />
<BlurredBalanceView />
</>
) : (
<Text
numberOfLines={1}
adjustsFontSizeToFit
key={`${balance}`} // force component recreation on balance change. To fix right-to-left languages, like Farsi
style={[iStyles.balance, { color: colors.inverseForegroundColor }]}
>
{`${balance} `}
{!isPlaceHolder && (
<>
<Text numberOfLines={1} style={[iStyles.label, { color: colors.inverseForegroundColor }]}>
{renderHighlightedText && searchQuery ? renderHighlightedText(item.getLabel(), searchQuery) : item.getLabel()}
</Text>
)}
</View>
<Text style={iStyles.br} />
<Text numberOfLines={1} style={[iStyles.latestTx, { color: colors.inverseForegroundColor }]}>
{loc.wallets.list_latest_transaction}
</Text>
<Text numberOfLines={1} style={[iStyles.latestTxTime, { color: colors.inverseForegroundColor }]}>
{latestTransactionText}
</Text>
<View style={iStyles.balanceContainer}>
{item.hideBalance ? (
<>
<BlueSpacing10 />
<BlurredBalanceView />
</>
) : (
<Text
numberOfLines={1}
adjustsFontSizeToFit
key={`${balance}`} // force component recreation on balance change. To fix right-to-left languages, like Farsi
style={[iStyles.balance, { color: colors.inverseForegroundColor }]}
>
{`${balance} `}
</Text>
)}
</View>
<Text style={iStyles.br} />
<Text numberOfLines={1} style={[iStyles.latestTx, { color: colors.inverseForegroundColor }]}>
{loc.wallets.list_latest_transaction}
</Text>
<Text numberOfLines={1} style={[iStyles.latestTxTime, { color: colors.inverseForegroundColor }]}>
{latestTransactionText}
</Text>
</>
)}
</LinearGradient>
</View>
</Pressable>
Expand Down
Binary file added img/flash-off.png
Loading
Sorry, something went wrong. Reload?
Sorry, we cannot display this file.
Sorry, this file is invalid so it cannot be displayed.
Binary file added img/flash-on.png
Loading
Sorry, something went wrong. Reload?
Sorry, we cannot display this file.
Sorry, this file is invalid so it cannot be displayed.
Loading

0 comments on commit ac4f3a2

Please sign in to comment.