-
-
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.
fix: create nft auto detection modal and remove nft polling logic
- Loading branch information
1 parent
da288b5
commit 72d4c1b
Showing
14 changed files
with
481 additions
and
68 deletions.
There are no files selected for viewing
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
29 changes: 29 additions & 0 deletions
29
app/components/Views/NFTAutoDetectionModal/NFTAutoDetectionModal.styles.ts
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,29 @@ | ||
import { StyleSheet } from 'react-native'; | ||
|
||
/** | ||
* Style sheet function for NFT auto detection modal component. | ||
* | ||
* @returns StyleSheet object. | ||
*/ | ||
const styleSheet = () => | ||
StyleSheet.create({ | ||
container: { | ||
alignItems: 'center', | ||
}, | ||
image: { | ||
width: 219, | ||
height: 219, | ||
}, | ||
description: { | ||
marginLeft: 32, | ||
marginRight: 32, | ||
}, | ||
buttonsContainer: { | ||
paddingTop: 24, | ||
marginLeft: 16, | ||
marginRight: 16, | ||
}, | ||
spacer: { height: 8 }, | ||
}); | ||
|
||
export default styleSheet; |
79 changes: 79 additions & 0 deletions
79
app/components/Views/NFTAutoDetectionModal/NFTAutoDetectionModal.tsx
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,79 @@ | ||
/* eslint-disable no-console */ | ||
|
||
import React, { useRef } from 'react'; | ||
import BottomSheet, { | ||
BottomSheetRef, | ||
} from '../../../component-library/components/BottomSheets/BottomSheet'; | ||
import { strings } from '../../../../locales/i18n'; | ||
import { useStyles } from '../../../component-library/hooks'; | ||
import styleSheet from './NFTAutoDetectionModal.styles'; | ||
import SheetHeader from '../../../component-library/components/Sheet/SheetHeader'; | ||
import Text from '../../../component-library/components/Texts/Text'; | ||
import { View, Image } from 'react-native'; | ||
|
||
import Button, { | ||
ButtonSize, | ||
ButtonVariants, | ||
ButtonWidthTypes, | ||
} from '../../../component-library/components/Buttons/Button'; | ||
import { useNavigation } from '@react-navigation/native'; | ||
import Engine from '../../../core/Engine'; | ||
|
||
const NFTAutoDetectionModal = () => { | ||
const { styles } = useStyles(styleSheet, {}); | ||
const sheetRef = useRef<BottomSheetRef>(null); | ||
const walletImage = require('../../../images/wallet-alpha.png'); // eslint-disable-line | ||
const navigation = useNavigation(); | ||
const dismissModal = (): void => { | ||
if (sheetRef?.current) { | ||
sheetRef.current.onCloseBottomSheet(); | ||
} else { | ||
navigation.goBack(); | ||
} | ||
}; | ||
|
||
const enableNftDetectionAndDismissModal = (): void => { | ||
const { PreferencesController } = Engine.context; | ||
PreferencesController.setUseNftDetection(true); | ||
dismissModal(); | ||
}; | ||
|
||
return ( | ||
<BottomSheet ref={sheetRef}> | ||
<SheetHeader title={strings('enable_nft-auto-detection.title')} /> | ||
<View> | ||
<View style={styles.container}> | ||
<Image source={walletImage} style={styles.image} /> | ||
</View> | ||
<View style={styles.description}> | ||
<Text>{strings('enable_nft-auto-detection.description')}</Text> | ||
|
||
<Text> • {strings('enable_nft-auto-detection.immediateAccess')}</Text> | ||
<Text> • {strings('enable_nft-auto-detection.navigate')}</Text> | ||
<Text> • {strings('enable_nft-auto-detection.dive')}</Text> | ||
</View> | ||
<View style={styles.buttonsContainer}> | ||
<Button | ||
variant={ButtonVariants.Primary} | ||
size={ButtonSize.Lg} | ||
width={ButtonWidthTypes.Full} | ||
label={strings('enable_nft-auto-detection.allow')} | ||
onPress={enableNftDetectionAndDismissModal} | ||
/> | ||
<View style={styles.spacer} /> | ||
|
||
<Button | ||
variant={ButtonVariants.Link} | ||
size={ButtonSize.Lg} | ||
width={ButtonWidthTypes.Full} | ||
label={strings('enable_nft-auto-detection.notRightNow')} | ||
onPress={dismissModal} | ||
//onPress={() => sheetRef.current?.onCloseBottomSheet()} | ||
/> | ||
</View> | ||
</View> | ||
</BottomSheet> | ||
); | ||
}; | ||
|
||
export default NFTAutoDetectionModal; |
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
Loading
Sorry, something went wrong. Reload?
Sorry, we cannot display this file.
Sorry, this file is invalid so it cannot be displayed.
Oops, something went wrong.