diff --git a/app/components/UI/SeedPhraseVideo/index.js b/app/components/UI/SeedPhraseVideo/index.js index 55dd64c3a94..386e4882b00 100644 --- a/app/components/UI/SeedPhraseVideo/index.js +++ b/app/components/UI/SeedPhraseVideo/index.js @@ -1,122 +1,58 @@ import React, { useCallback, useState } from 'react'; import PropTypes from 'prop-types'; -import { StyleSheet, View, Image, TouchableOpacity } from 'react-native'; -import VideoPlayer from 'react-native-video-controls'; -import { colors, fontStyles } from '../../../styles/common'; -import Logger from '../../../util/Logger'; +import { StyleSheet, View } from 'react-native'; +import AndroidMediaPlayer from '../../Views/MediaPlayer/AndroidMediaPlayer'; +import Video from 'react-native-video'; +import Device from '../../../util/Device'; +import Loader from '../../Views/MediaPlayer/Loader'; import scaling from '../../../util/scaling'; -import Svg, { Circle, Path } from 'react-native-svg'; -import Text from '../../Base/Text'; -import { strings } from '../../../../locales/i18n'; const styles = StyleSheet.create({ videoContainer: { - justifyContent: 'center', - alignItems: 'center', - position: 'relative', - borderRadius: 8, - overflow: 'hidden', - width: '100%', - height: 180 - }, - image: { - zIndex: 0, - width: scaling.scale(138), - height: scaling.scale(162) + height: scaling.scale(240), + width: '100%' }, - cover: { - justifyContent: 'center', - alignItems: 'center', - zIndex: 1, + loaderContainer: { position: 'absolute', - left: 0, - top: 0, - backgroundColor: colors.grey, - opacity: 0.2, + zIndex: 999, width: '100%', height: '100%' - }, - errorWrapper: { - justifyContent: 'center', - alignItems: 'center' - }, - errorText: { - ...fontStyles.normal, - color: colors.red } }); -const FAILED_TO_LOAD_MSG = strings('app_settings.video_failed'); - -// eslint-disable-next-line import/no-commonjs -const explain_backup_seedphrase = require('../../../images/explain-backup-seedphrase.png'); - const video_source_uri = 'https://github.com/MetaMask/metamask-mobile/blob/develop/app/videos/recovery-phrase.mp4?raw=true'; -const SeedPhraseVideo = ({ style }) => { - const [isPlaying, setPlaying] = useState(false); - const [isError, setError] = useState(false); - - const reset = useCallback(() => setPlaying(false), [setPlaying]); - - const onError = useCallback( - e => { - Logger.error(e, FAILED_TO_LOAD_MSG); - setError(true); - setPlaying(false); - }, - [setError, setPlaying] - ); +const SeedPhraseVideo = ({ style, onClose }) => { + const [error, setError] = useState(false); + const [loading, setLoading] = useState(true); - const onPlay = useCallback(() => { - Logger.log('User clicked play'); - setPlaying(true); - }, [setPlaying]); + const onLoad = useCallback(() => setLoading(false), [setLoading]); + const onError = useCallback(() => setError(true), [setError]); return ( - - {!isPlaying ? ( - <> - {isError ? ( - - {FAILED_TO_LOAD_MSG} - - ) : ( - <> - - {isError ? <> : <>} - - - - - - - - )} - - ) : ( - + {loading && ( + + + + )} + {Device.isAndroid() ? ( + + ) : ( + @@ -124,7 +60,8 @@ const SeedPhraseVideo = ({ style }) => { }; SeedPhraseVideo.propTypes = { - style: PropTypes.object + style: PropTypes.object, + onClose: PropTypes.func }; export default SeedPhraseVideo; diff --git a/app/components/Views/AccountBackupStep1/__snapshots__/index.test.js.snap b/app/components/Views/AccountBackupStep1/__snapshots__/index.test.js.snap index 97f41e13132..d034cf424fb 100644 --- a/app/components/Views/AccountBackupStep1/__snapshots__/index.test.js.snap +++ b/app/components/Views/AccountBackupStep1/__snapshots__/index.test.js.snap @@ -61,14 +61,16 @@ exports[`AccountBackupStep1 should render correctly 1`] = ` "fontFamily": "EuclidCircularB-Bold", "fontSize": 24, "fontWeight": "600", - "marginBottom": 40, + "marginBottom": 24, "textAlign": "center", } } > Secure your wallet - + { {strings('account_backup_step_1.title')} - + {strings('account_backup_step_1.info_text_1_1')}{' '} diff --git a/app/components/Views/MediaPlayer/index.js b/app/components/Views/MediaPlayer/index.js index 5b7b68a2a9a..a8a089e3927 100644 --- a/app/components/Views/MediaPlayer/index.js +++ b/app/components/Views/MediaPlayer/index.js @@ -10,7 +10,8 @@ const styles = StyleSheet.create({ loaderContainer: { position: 'absolute', zIndex: 999, - width: '100%' + width: '100%', + height: '100%' } }); diff --git a/app/components/Views/Settings/SecuritySettings/__snapshots__/index.test.js.snap b/app/components/Views/Settings/SecuritySettings/__snapshots__/index.test.js.snap index 9bcc47bdff7..d36cd60f6dc 100644 --- a/app/components/Views/Settings/SecuritySettings/__snapshots__/index.test.js.snap +++ b/app/components/Views/Settings/SecuritySettings/__snapshots__/index.test.js.snap @@ -38,37 +38,43 @@ exports[`SecuritySettings should render correctly 1`] = ` > - - - + + + Protect your wallet this.props.navigation.goBack(); + render = () => { const { approvedHosts, seedphraseBackedUp, browserHistory, privacyMode, thirdPartyApiMode } = this.props; const { @@ -532,15 +534,15 @@ class Settings extends PureComponent { {strings('app_settings.security_heading')} - + {!seedphraseBackedUp ? ( <> {' '} ) : null} - {strings('app_settings.protect_title')} + {strings('app_settings.protect_title')} - + {strings('app_settings.protect_desc')}