-
-
Notifications
You must be signed in to change notification settings - Fork 1.1k
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
Feature/2816 token detection mvp (#2901)
* Update AssetDetectionController to use TokenDetectionController * Update redux with token list controller data * Replace contract map with token list from TokenListController. Add typescript support * - Update to use iconUrl from token list - Create token list selectors - Minor refactor into typescript - Update copies * Hook up preferences controller to handle static token list * Use controllers v12.1.0. Set up last bit for token list controller constructor * Remove controllers tgz * Add comments to token reducers * Remove all contract metadata imports * Upgrade nodeify library to fix pbkdf2 library crasher * Remove comment and lock library version * Remove unused field on engine reducer * Add missing blue100 * Change Alert to use enums. Add jest types. Remove comments. Write test for token util. * Handle undefined passed to token util * Update enzyme to support jest diving redux connected components * Fix all unit tests that uses Redux. Update snapshots. * Update app to support latest controllers. * Provide TokensController with provider on initialization. * Clean up code to display asset logos * Create static asset generation script. Generate on build + watch. * Update static logos * Properly format static logos file * Update controller package * Mock static-logos.js for testing * ignored tokens updates * add migration * cleanup * Upgrade controller version * Use latest controller version that includes abort controller polyfill * Use TokenListController types * Remove unused EthInput * Remove commented code in QuotesView.js * No need to set address on tokenlist array * Update controller version * Remove TransactionDirection unused file. ESLint ignore static assets file * Refactor wallet to tsx * Add missing deps array * Add missing tab label * Don't lint generated static logos file. Fix crasher for ipfs logos. * Fix unit test * Update title and cta label on tokens and nft pages * Fix unit test * Fix unit test * Rename asset list extension * Showing icons for payment request flow * Fix showing icon in payments. Fix tests Co-authored-by: Alex <adonesky@gmail.com>
- Loading branch information
Showing
136 changed files
with
1,952 additions
and
2,465 deletions.
There are no files selected for viewing
This file was deleted.
Oops, something went wrong.
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,99 @@ | ||
import React, { useCallback, ReactNode } from 'react'; | ||
import { | ||
View, | ||
StyleSheet, | ||
TouchableOpacity, | ||
ViewStyle, | ||
StyleProp, | ||
TouchableOpacityProps, | ||
ViewProps, | ||
TextStyle | ||
} from 'react-native'; | ||
import { colors } from '../../styles/common'; | ||
import CustomText from './Text'; | ||
// TODO: Convert into typescript and correctly type optionals | ||
const Text = CustomText as any; | ||
|
||
export enum AlertType { | ||
Info = 'Info', | ||
Warning = 'Warning', | ||
Error = 'Error' | ||
} | ||
|
||
type Props = { | ||
type: AlertType; | ||
style?: StyleProp<ViewStyle>; | ||
small?: boolean; | ||
renderIcon?: () => ReactNode; | ||
onPress?: () => void; | ||
children?: ReactNode; | ||
}; | ||
|
||
const Alert = ({ type = AlertType.Info, small, renderIcon, style, onPress, children, ...props }: Props) => { | ||
const Wrapper: React.ComponentClass<TouchableOpacityProps | ViewProps> = onPress ? TouchableOpacity : View; | ||
|
||
const getStyles: (type: AlertType) => [StyleProp<ViewStyle>, StyleProp<TextStyle>] = useCallback(type => { | ||
switch (type) { | ||
case AlertType.Warning: { | ||
return [styles.warning, { ...styles.textWarning, ...styles.baseTextStyle }]; | ||
} | ||
case AlertType.Error: { | ||
return [styles.error, { ...styles.textError, ...styles.baseTextStyle }]; | ||
} | ||
case AlertType.Info: | ||
default: { | ||
return [styles.info, { ...styles.textInfo, ...styles.baseTextStyle }]; | ||
} | ||
} | ||
}, []); | ||
|
||
const [wrapperStyle, textStyle] = getStyles(type); | ||
|
||
return ( | ||
<Wrapper style={[styles.base, small && styles.baseSmall, wrapperStyle, style]} onPress={onPress} {...props}> | ||
{renderIcon && <View style={styles.iconWrapper}>{renderIcon()}</View>} | ||
{typeof children === 'function' ? ( | ||
children(textStyle) | ||
) : ( | ||
<Text small={small} style={[textStyle, !!renderIcon && styles.textIconStyle]}> | ||
{children} | ||
</Text> | ||
)} | ||
</Wrapper> | ||
); | ||
}; | ||
|
||
const styles = StyleSheet.create({ | ||
base: { | ||
paddingHorizontal: 12, | ||
paddingVertical: 8, | ||
borderWidth: 1, | ||
borderRadius: 8, | ||
flexDirection: 'row' | ||
}, | ||
baseSmall: { | ||
paddingVertical: 8 | ||
}, | ||
info: { | ||
backgroundColor: colors.blue100, | ||
borderColor: colors.blue | ||
}, | ||
warning: { | ||
backgroundColor: colors.yellow100, | ||
borderColor: colors.yellowWarningBorder | ||
}, | ||
error: { | ||
backgroundColor: colors.red000, | ||
borderColor: colors.red | ||
}, | ||
baseTextStyle: { fontSize: 14, flex: 1, lineHeight: 17 }, | ||
textInfo: { color: colors.blue }, | ||
textWarning: { color: colors.black }, | ||
textError: { color: colors.red }, | ||
textIconStyle: { marginRight: 12 }, | ||
iconWrapper: { | ||
alignItems: 'center' | ||
} | ||
}); | ||
|
||
export default Alert; |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Oops, something went wrong.