Skip to content

Commit

Permalink
Push v1.9.35 to master (#6016)
Browse files Browse the repository at this point in the history
* Degen mode analytics, copy adjustment (#5979)

* Brody/swap v2 e2e (#5915)

* init

* test file

* clean up

* matthew review fixes

* lint

* oops!!!

* type casting

* rename

* .

* lint

* oops hardhat stuff removed

* reverts

* simplify hardhat check

* Update src/__swaps__/screens/Swap/components/FadeMask.tsx

Co-authored-by: Matthew Wall <[email protected]>

* Apply suggestions from code review

IS_TESTING > IS_TEST

Co-authored-by: Matthew Wall <[email protected]>

* fix lint

* okay actually fix lint

---------

Co-authored-by: Matthew Wall <[email protected]>

* Revert CI script changes (#5961)

* init

* oop

* update logging

* test

* undo

* Revert "rerun only failed tests (#5878)"

This reverts commit 497d27a.

* Bump fast-xml-parser from 4.4.0 to 4.4.1 (#5965)

Bumps [fast-xml-parser](https://github.com/NaturalIntelligence/fast-xml-parser) from 4.4.0 to 4.4.1.
- [Release notes](https://github.com/NaturalIntelligence/fast-xml-parser/releases)
- [Changelog](https://github.com/NaturalIntelligence/fast-xml-parser/blob/master/CHANGELOG.md)
- [Commits](NaturalIntelligence/fast-xml-parser@v4.4.0...v4.4.1)

---
updated-dependencies:
- dependency-name: fast-xml-parser
  dependency-type: indirect
...

Signed-off-by: dependabot[bot] <[email protected]>
Co-authored-by: dependabot[bot] <49699333+dependabot[bot]@users.noreply.github.com>

* chore: i18n updates (#5980)

* Revert "Brody/swap v2 e2e (#5915)" (#5987)

This reverts commit a38f633.

* Convert App.js => App.tsx (#5792)

* .

* undo tsconfig change and create routes.tsx with platform selector

* chore: merge

* yep

* fix

* rm authorize

* change initial route context initial value

* wrap in usecallbacks

* Fix token to buy list empty spaces (#5983)

* fixes empty spaces

* also add searching to recents

* rm log

* remove duplicate recents and add migration

* fix sort

* fix bridge button sending users to swaps v1 (#5971)

* fix (#5989)

* fix favorites tokens with no icon (#5982)

* fix favorites default list

* wip

* 👍

* Update src/resources/favorites.ts

* fix format

---------

Co-authored-by: Matthew Wall <[email protected]>

* codeowners file removed (#5991)

* Trending DApps (#5974)

* initial work for trending dapps

* progress on trending dapps

* impl. trending hooks

* combine selectors

* fix crash and fix empty state not showing up (#5975)

* bump version to v1.9.35 (#5992)

* Swaps: Popular Tokens (#5990)

* Default the Swap input currency to ETH  (#5994)

* . (#5993)

* Design system improvements (#5984)

* Revert ". (#5993)" (#5999)

* swaps bug fix: missing asset balance for some tokens (#5998)

* remove filter

* forgot this

* Drag and drop components, browser favorites reordering (#5978)

* Add drag-and-drop components, useLayoutWorklet

Slightly modified implementation based on https://github.com/mgcrea/react-native-dnd

* Make browser favorites reorderable, migrate favoriteDapps store to createRainbowStore

* Fix fallback logos, add useLayoutWorklet documentation

* Reorder imports

* Clean up favorites stores, types

Removes unnecessary additions to the legacy store

* Improve reliability of browser favorites URL handling

Resolves issues causing certain favorites not to be removable (due to params in the URL or a subtly different URL path), by:

- Adding more lenient fallback lookup mechanisms if no exact match is found
- Trimming params from the standardized URLs

Also moves the browser favorites store to within the /state/browser/ folder.

* Create EasingGradient, useEasingGradient

* Add activeScale, default activeOpacity to 1

* Clean up activeScale

* Replace JS-based timer with useAnimatedTimeout, misc. cleanup

* Add dragDirection option to Draggable

* Add DraggableFlatList

Fully working with the exception of auto scrolling while dragging

* Improve browser homepage cards

* Fix light mode card contrast, Android card gradient

* Expose stop function in useAnimatedTimeout

* useAnimatedTime: stop → clearTimeout

* Improve card BlurView rendering

* Make reorderable favorites mounting/unmounting smoother

* Clean up animated reaction dependencies

* Add missing favorites store method

* Fix account balance discrepancies (#5959)

* fix balance discrepency between bx and app and app and change wallet sheet

* Update src/helpers/buildWalletSections.tsx

* fix missing import from commit

* also fix send sheet balance discrepancy

* fix swap user assets not refetching on pending txn resolution and PTR

* .

* update en_US key

* rmeove unused hook and bake it into the user assets store

* good lord

* separate invalidateQueries because they don't update when grouped for some reason

* more instances

* cleanup

* cleanup useWatchPendingTxs

* code suggestions

* break up useWallets

* rm latestBackup from useWallets

* useMemo -> useEffect

* logging

* cleanup

* remove unused withPositions params

* type

* fix PROFILE_STICKY_HEADER loading value

* fix

* optional chaining

* fixes to buildWalletSections + related code

* fix accountInfo isLoadingAccountBalance

* clean up useWalletBalances

* stuff is still broken but committing walletsWithBalancesAndNames fix

* refactor useWalletsWithBalancesAndNames and fix consumers

* fix wallet screen balance loading state

* console.log

* switch amount types from string | number -> string

* align stale/cache times, remove keepPreviousData

* remove spammy isDamaged logging

* add loading balance copy + remove incorrectly used no balance copy

* fix i18n mistake

---------

Co-authored-by: Ben Goldberg <[email protected]>

* update swaps sdk (#5996)

* Swaps: Change fee denomination from USD -> actual payment token (#6000)

* hm

* done

* idk how this got deleted

* cleanup

* fix bad rebase

---------

Co-authored-by: gregs <[email protected]>

* Fun stuff (#5995)

* add filteration

* clenaup

* fix runtime error (#6001)

* rotate user-agent (#6003)

* fixed dapp browser height on android (#6004)

* fixes android light mode button navigation colors (#6005)

* fix TokenToBuyList weirdness when favoriting (#6002)

* wip

* fix

* ops

* bring back slice

* Revert "fixes android light mode button navigation colors (#6005)"

This reverts commit fc87001.

* Revert "Convert App.js => App.tsx (#5792)"

This reverts commit 0d09b10.

* Revert "Drag and drop components, browser favorites reordering (#5978)"

This reverts commit 5feae69.

---------

Signed-off-by: dependabot[bot] <[email protected]>
Co-authored-by: Christian Baroni <[email protected]>
Co-authored-by: brdy <[email protected]>
Co-authored-by: Matthew Wall <[email protected]>
Co-authored-by: dependabot[bot] <49699333+dependabot[bot]@users.noreply.github.com>
Co-authored-by: Daniel Sinclair <[email protected]>
Co-authored-by: gregs <[email protected]>
Co-authored-by: Bruno Barbieri <[email protected]>
Co-authored-by: Ben Goldberg <[email protected]>
Co-authored-by: Bruno Barbieri <[email protected]>
  • Loading branch information
10 people authored Aug 20, 2024
1 parent c0fc398 commit 0bcde86
Show file tree
Hide file tree
Showing 87 changed files with 2,230 additions and 847 deletions.
35 changes: 35 additions & 0 deletions CHANGELOG.md
Original file line number Diff line number Diff line change
Expand Up @@ -15,6 +15,41 @@ and this project adheres to [Semantic Versioning](http://semver.org/)

### Fixed

## [1.9.34] (https://github.com/rainbow-me/rainbow/releases/tag/v1.9.34)

### Added

- Added the ability to copy/paste swap inputs (#5938)
- Added tracking of critical errors to sentry (#5936)
- Added ability to open in Rainbow from mobile browsers (#5939)
- Added Degen mode to skip review sheet for swaps (#5933, #5963, #5969)
- Added ability to set max on a balance when tapping on badge (#5947)
- Added e2e coverage for manual wallet backups (#5913)
- Added a hold to swap button on swaps flow (#5920, #5976)
- Added a new section that shows the last three user swaps per chain (#5956)
- Added performance tracking on TimeToSign (#5962)

### Changed

- Disabled location APIs in VisionCamera since we don’t use location features (#5942)
- Removed FULL_SCREEN_INTENT permission from the manifest (#5955)
- App is now using different referrer for ETH rewards claims (#5954)
- Bumped Android dependencies (#5960)
- Updated Degen mode copy and enabled tracking (#5979)

### Fixed

- Fixed a crash on explainer sheet when there wasn’t a read more link (#5945)
- Fixed a bug where some bridges couldn’t be made due to gas (#5949)
- Fixed bugs around flipping logic in swap flow (#5948)
- Fixed issue where there would be a tab swipe from dapp browser on Android devices (#5964)
- Fixed a bug where one could proceed to review on a swap when they shouldn’t (#5967)
- Fixed favorites bugs on search list (#5972)
- Fixed bugs around copy and pasting (#5953)
- Fixed an old route that led to Swaps v1 (#5971)
- Fixed a bug that showed an empty space on token to buy list (#5983, #5989)
- Fixed issues when saving assets as favorites (#5972, #5982)

## [1.9.33] (https://github.com/rainbow-me/rainbow/releases/tag/v1.9.33)

## Fixed
Expand Down
71 changes: 0 additions & 71 deletions CODEOWNERS

This file was deleted.

4 changes: 2 additions & 2 deletions android/app/build.gradle
Original file line number Diff line number Diff line change
Expand Up @@ -139,8 +139,8 @@ android {
applicationId "me.rainbow"
minSdkVersion rootProject.ext.minSdkVersion
targetSdkVersion rootProject.ext.targetSdkVersion
versionCode 225
versionName "1.9.34"
versionCode 226
versionName "1.9.35"
missingDimensionStrategy 'react-native-camera', 'general'
renderscriptTargetApi 23
renderscriptSupportModeEnabled true
Expand Down
8 changes: 4 additions & 4 deletions ios/Rainbow.xcodeproj/project.pbxproj
Original file line number Diff line number Diff line change
Expand Up @@ -1833,7 +1833,7 @@
"$(PROJECT_DIR)",
);
LLVM_LTO = YES;
MARKETING_VERSION = 1.9.34;
MARKETING_VERSION = 1.9.35;
OTHER_CFLAGS = "$(inherited)";
OTHER_LDFLAGS = (
"$(inherited)",
Expand Down Expand Up @@ -1895,7 +1895,7 @@
"$(PROJECT_DIR)",
);
LLVM_LTO = YES;
MARKETING_VERSION = 1.9.34;
MARKETING_VERSION = 1.9.35;
OTHER_CFLAGS = "$(inherited)";
OTHER_LDFLAGS = (
"$(inherited)",
Expand Down Expand Up @@ -2011,7 +2011,7 @@
"$(PROJECT_DIR)",
);
LLVM_LTO = YES;
MARKETING_VERSION = 1.9.34;
MARKETING_VERSION = 1.9.35;
OTHER_CFLAGS = "$(inherited)";
OTHER_LDFLAGS = (
"$(inherited)",
Expand Down Expand Up @@ -2127,7 +2127,7 @@
"$(PROJECT_DIR)",
);
LLVM_LTO = YES;
MARKETING_VERSION = 1.9.34;
MARKETING_VERSION = 1.9.35;
OTHER_CFLAGS = "$(inherited)";
OTHER_LDFLAGS = (
"$(inherited)",
Expand Down
4 changes: 2 additions & 2 deletions package.json
Original file line number Diff line number Diff line change
@@ -1,6 +1,6 @@
{
"name": "Rainbow",
"version": "1.9.34-1",
"version": "1.9.35-1",
"private": true,
"scripts": {
"setup": "yarn graphql-codegen:install && yarn ds:install && yarn allow-scripts && yarn postinstall && yarn graphql-codegen",
Expand Down Expand Up @@ -101,7 +101,7 @@
"@notifee/react-native": "7.8.2",
"@rainbow-me/provider": "0.0.12",
"@rainbow-me/react-native-animated-number": "0.0.2",
"@rainbow-me/swaps": "0.22.0",
"@rainbow-me/swaps": "0.23.0",
"@react-native-async-storage/async-storage": "1.23.1",
"@react-native-camera-roll/camera-roll": "7.7.0",
"@react-native-clipboard/clipboard": "1.13.2",
Expand Down
38 changes: 8 additions & 30 deletions scripts/run-retry-tests.sh
Original file line number Diff line number Diff line change
Expand Up @@ -2,39 +2,17 @@

max_retries="$1"
count=0
failed_tests=""

run_tests() {
if [ -z "$failed_tests" ]; then
./node_modules/.bin/detox test -c ios.sim.release --maxWorkers 2 -- --forceExit --bail 1
else
./node_modules/.bin/detox test -c ios.sim.release --maxWorkers 2 -f "$failed_tests" -- --forceExit --bail 1
fi
}

until (( count >= max_retries ))
do
if [ $count -eq 0 ]; then
run_tests | tee output.log
else
run_tests
fi

ret_val=$?
if [ $ret_val -eq 0 ]; then
echo "All tests passed."
exit 0
fi

if [ $count -eq 0 ]; then
failed_tests=$(grep -oP '(?<=at )[^ ]+\.spec\.ts(?=:)' output.log | sort -u | tr '\n' '|' | sed 's/|$//')
rm output.log
fi

((count++))
echo "Test failed, attempt $count/$max_retries..."
echo "Rerunning failed tests: $failed_tests"
./node_modules/.bin/detox test -c ios.sim.release --maxWorkers 2 -- --forceExit --bail 1
ret_val=$?
if [ $ret_val -eq 0 ]; then
exit 0
fi
((count++))
echo "Test failed, attempt $count/$max_retries..."
done

echo "Tests failed after $max_retries attempts."
exit 1
exit 1
12 changes: 6 additions & 6 deletions src/__swaps__/screens/Swap/Swap.tsx
Original file line number Diff line number Diff line change
Expand Up @@ -105,12 +105,12 @@ const useMountSignal = () => {
const useCleanupOnUnmount = () => {
useEffect(() => {
return () => {
const highestValueAsset = userAssetsStore.getState().getHighestValueAsset();
const parsedAsset = highestValueAsset
const highestValueEth = userAssetsStore.getState().getHighestValueEth();
const parsedAsset = highestValueEth
? parseSearchAsset({
assetWithPrice: undefined,
searchAsset: highestValueAsset,
userAsset: highestValueAsset,
searchAsset: highestValueEth,
userAsset: highestValueEth,
})
: null;

Expand All @@ -135,15 +135,15 @@ const WalletAddressObserver = () => {
const { setAsset } = useSwapContext();

const setNewInputAsset = useCallback(() => {
const newHighestValueAsset = userAssetsStore.getState().getHighestValueAsset();
const newHighestValueEth = userAssetsStore.getState().getHighestValueEth();

if (userAssetsStore.getState().filter !== 'all') {
userAssetsStore.setState({ filter: 'all' });
}

setAsset({
type: SwapAssetType.inputAsset,
asset: newHighestValueAsset,
asset: newHighestValueEth,
});

if (userAssetsStore.getState().userAssets.size === 0) {
Expand Down
6 changes: 3 additions & 3 deletions src/__swaps__/screens/Swap/components/CoinRow.tsx
Original file line number Diff line number Diff line change
Expand Up @@ -14,7 +14,7 @@ import { toggleFavorite } from '@/resources/favorites';
import { userAssetsStore } from '@/state/assets/userAssets';
import { ethereumUtils, haptics, showActionSheetWithOptions } from '@/utils';
import { startCase } from 'lodash';
import React, { memo, useCallback, useMemo } from 'react';
import React, { useCallback, useMemo } from 'react';
import { GestureResponderEvent } from 'react-native';
import { OnPressMenuItemEventObject } from 'react-native-ios-context-menu';
import { SwapCoinIcon } from './SwapCoinIcon';
Expand Down Expand Up @@ -66,7 +66,7 @@ interface OutputCoinRowProps extends PartialAsset {

type CoinRowProps = InputCoinRowProps | OutputCoinRowProps;

export const CoinRow = memo(function CoinRow({ isFavorite, onPress, output, uniqueId, ...assetProps }: CoinRowProps) {
export function CoinRow({ isFavorite, onPress, output, uniqueId, ...assetProps }: CoinRowProps) {
const inputAsset = userAssetsStore(state => (output ? undefined : state.getUserAsset(uniqueId)));
const outputAsset = output ? (assetProps as PartialAsset) : undefined;

Expand Down Expand Up @@ -180,7 +180,7 @@ export const CoinRow = memo(function CoinRow({ isFavorite, onPress, output, uniq
</Columns>
</Box>
);
});
}

const InfoButton = ({ address, chainId }: { address: string; chainId: ChainId }) => {
const network = RainbowNetworks.find(network => network.id === chainId)?.value;
Expand Down
15 changes: 6 additions & 9 deletions src/__swaps__/screens/Swap/components/ReviewPanel.tsx
Original file line number Diff line number Diff line change
Expand Up @@ -8,7 +8,6 @@ import { useEstimatedTime } from '@/__swaps__/utils/meteorology';
import {
convertRawAmountToBalance,
convertRawAmountToBalanceWorklet,
convertRawAmountToNativeDisplay,
handleSignificantDecimals,
multiply,
} from '@/__swaps__/utils/numbers';
Expand Down Expand Up @@ -91,14 +90,12 @@ const RainbowFee = () => {
decimals: 18,
}).amount;

const feeInEth = convertRawAmountToNativeDisplay(
quote.feeInEth.toString(),
nativeAsset?.value?.decimals || 18,
nativeAsset?.value?.price?.value || '0',
nativeCurrency
).display;
const { display: feeDisplay } = convertRawAmountToBalance(quote.fee.toString(), {
decimals: quote.feeTokenAsset.decimals,
symbol: quote.feeTokenAsset.symbol,
});

rainbowFee.value = [feeInEth, `${handleSignificantDecimals(multiply(feePercentage, 100), 2)}%`];
rainbowFee.value = [feeDisplay, `${handleSignificantDecimals(multiply(feePercentage, 100), 2)}%`];
},
[nativeAsset?.value?.decimals, nativeAsset?.value?.price?.value, nativeCurrency, rainbowFee]
);
Expand Down Expand Up @@ -471,7 +468,7 @@ export function ReviewPanel() {
<Inline horizontalSpace="10px" alignVertical="center" alignHorizontal="justify">
<ButtonPressAnimation onPress={openGasExplainer} scaleTo={0.925}>
<Stack space="10px">
<Inline alignVertical="center" horizontalSpace="6px">
<Inline alignVertical="center" horizontalSpace="6px" wrap={false}>
<View style={sx.chainBadgeContainer}>
<AnimatedChainImage showMainnetBadge assetType="input" size={16} />
</View>
Expand Down
35 changes: 18 additions & 17 deletions src/__swaps__/screens/Swap/components/TokenList/TokenToBuyList.tsx
Original file line number Diff line number Diff line change
Expand Up @@ -17,7 +17,8 @@ import { userAssetsStore } from '@/state/assets/userAssets';
import { swapsStore } from '@/state/swaps/swapsStore';
import { DEVICE_WIDTH } from '@/utils/deviceUtils';
import { FlashList } from '@shopify/flash-list';
import React, { memo, useCallback, useMemo } from 'react';
import React, { ComponentType, forwardRef, memo, useCallback, useMemo } from 'react';
import { ScrollViewProps } from 'react-native';
import Animated, { runOnUI, useAnimatedProps, useAnimatedStyle, withTiming } from 'react-native-reanimated';
import { EXPANDED_INPUT_HEIGHT, FOCUSED_INPUT_HEIGHT } from '../../constants';
import { ChainSelection } from './ChainSelection';
Expand All @@ -31,6 +32,11 @@ interface SectionHeaderProp {
}

const SECTION_HEADER_INFO: { [id in AssetToBuySectionId]: SectionHeaderProp } = {
popular: {
title: i18n.t(i18n.l.token_search.section_header.popular),
symbol: '􀙬',
color: 'rgba(255, 88, 77, 1)',
},
recent: {
title: i18n.t(i18n.l.token_search.section_header.recent),
symbol: '􀐫',
Expand Down Expand Up @@ -67,6 +73,16 @@ export type HeaderItem = { listItemType: 'header'; id: AssetToBuySectionId; data
export type CoinRowItem = SearchAsset & { listItemType: 'coinRow'; sectionId: AssetToBuySectionId };
export type TokenToBuyListItem = HeaderItem | CoinRowItem;

const ScrollViewWithRef = forwardRef<Animated.ScrollView>(function ScrollViewWithRef(props, ref) {
const { outputProgress } = useSwapContext();
const animatedListProps = useAnimatedProps(() => {
const isFocused = outputProgress.value === 2;
return { scrollIndicatorInsets: { bottom: 28 + (isFocused ? EXPANDED_INPUT_HEIGHT - FOCUSED_INPUT_HEIGHT : 0) } };
});
// eslint-disable-next-line react/jsx-props-no-spreading
return <Animated.ScrollView {...props} ref={ref} animatedProps={animatedListProps} />;
});

export const TokenToBuyList = () => {
const { internalSelectedInputAsset, internalSelectedOutputAsset, isFetching, isQuoteStale, outputProgress, setAsset } = useSwapContext();
const { results: sections, isLoading } = useSearchCurrencyLists();
Expand Down Expand Up @@ -114,13 +130,6 @@ export const TokenToBuyList = () => {
return { height: bottomPadding };
});

const animatedListProps = useAnimatedProps(() => {
const isFocused = outputProgress.value === 2;
return {
scrollIndicatorInsets: { bottom: 28 + (isFocused ? EXPANDED_INPUT_HEIGHT - FOCUSED_INPUT_HEIGHT : 0) },
};
});

const averageItemSize = useMemo(() => {
const numberOfHeaders = sections.filter(section => section.listItemType === 'header').length;
const numberOfCoinRows = sections.filter(section => section.listItemType === 'coinRow').length;
Expand Down Expand Up @@ -166,15 +175,7 @@ export const TokenToBuyList = () => {
/>
);
}}
renderScrollComponent={props => {
return (
<Animated.ScrollView
// eslint-disable-next-line react/jsx-props-no-spreading
{...props}
animatedProps={animatedListProps}
/>
);
}}
renderScrollComponent={ScrollViewWithRef as ComponentType<ScrollViewProps>}
style={{ height: EXPANDED_INPUT_HEIGHT - 77, width: DEVICE_WIDTH - 24 }}
/>
</Box>
Expand Down
Loading

0 comments on commit 0bcde86

Please sign in to comment.