From 2f6f81c16af70537bca7f5540bcb29ddfe07293e Mon Sep 17 00:00:00 2001 From: Evan Kaloudis Date: Sat, 11 Mar 2023 12:40:55 -0500 Subject: [PATCH] BlueWallet LndHub.io warning message --- components/BlueWalletWarning.tsx | 26 +++++++++++++++++ components/LayerBalances/index.tsx | 45 ++++++++++++++++------------ components/SuccessErrorMessage.tsx | 47 +++++++++++++++++++++++++----- locales/en.json | 1 + 4 files changed, 92 insertions(+), 27 deletions(-) create mode 100644 components/BlueWalletWarning.tsx diff --git a/components/BlueWalletWarning.tsx b/components/BlueWalletWarning.tsx new file mode 100644 index 0000000000..5484597162 --- /dev/null +++ b/components/BlueWalletWarning.tsx @@ -0,0 +1,26 @@ +import { View } from 'react-native'; +import { ErrorMessage } from './SuccessErrorMessage'; +import stores from '../stores/Stores'; +import { localeString } from '../utils/LocaleUtils'; + +export default function BlueWalletWarning() { + const SettingsStore = stores.settingsStore; + const node: any = + SettingsStore.settings.nodes && + SettingsStore.settings.nodes[SettingsStore.settings.selectedNode || 0]; + const isLndHubIo = + node.implementation === 'lndhub' && + (node.lndhubUrl.includes('https://lndhub.io') || + node.lndhubUrl.includes('https://lndhub.herokuapp.com')); + + if (!isLndHubIo) return; + return ( + + + + ); +} diff --git a/components/LayerBalances/index.tsx b/components/LayerBalances/index.tsx index 97267f1863..a3bae90a63 100644 --- a/components/LayerBalances/index.tsx +++ b/components/LayerBalances/index.tsx @@ -15,6 +15,8 @@ import UnitsStore from './../../stores/UnitsStore'; import BackendUtils from '../../utils/BackendUtils'; import { themeColor } from './../../utils/ThemeUtils'; +import BlueWalletWarning from '../../components/BlueWalletWarning'; + import OnChainSvg from '../../assets/images/SVG/DynamicSVG/OnChainSvg'; import LightningSvg from '../../assets/images/SVG/DynamicSVG/LightningSvg'; @@ -126,25 +128,30 @@ export default class LayerBalances extends Component { } return ( - } - renderItem={({ item, index }) => ( - - )} - keyExtractor={(_item, index) => `message ${index}`} - style={{ top: 20 }} - onRefresh={() => onRefresh()} - refreshing={false} - /> + <> + + ( + + )} + renderItem={({ item, index }) => ( + + )} + keyExtractor={(_item, index) => `message ${index}`} + style={{ top: 20 }} + onRefresh={() => onRefresh()} + refreshing={false} + /> + ); } } diff --git a/components/SuccessErrorMessage.tsx b/components/SuccessErrorMessage.tsx index bd61164afb..8543af2967 100644 --- a/components/SuccessErrorMessage.tsx +++ b/components/SuccessErrorMessage.tsx @@ -1,26 +1,57 @@ import * as React from 'react'; -import { StyleSheet, Text } from 'react-native'; +import { StyleSheet, Text, TouchableOpacity } from 'react-native'; +import UrlUtils from '../utils/UrlUtils'; interface MessageProps { message?: string; + fontSize?: number; + link: string; + mainStyle: any; } -const SuccessMessage = (props: MessageProps) => ( - {props.message} +const Message = ({ message, fontSize, link, mainStyle }: MessageProps) => + link ? ( + UrlUtils.goToUrl(link)}> + + {message} + + + ) : ( + {message} + ); + +const SuccessMessage = ({ message, fontSize, link }: MessageProps) => ( + ); -const WarningMessage = (props: MessageProps) => ( - {props.message} +const WarningMessage = ({ message, fontSize, link }: MessageProps) => ( + ); -const ErrorMessage = (props: MessageProps) => ( - {props.message} +const ErrorMessage = ({ message, fontSize, link }: MessageProps) => ( + ); const styles = StyleSheet.create({ field: { fontFamily: 'Lato-Regular', - fontSize: 20, width: '100%', top: 10, borderRadius: 6, diff --git a/locales/en.json b/locales/en.json index 651330ec17..b744094fc1 100644 --- a/locales/en.json +++ b/locales/en.json @@ -539,6 +539,7 @@ "components.ChannelPicker.modal.title": "Select Channel to use", "components.ChannelPicker.modal.description": "Select the Channel to be used in this operation. You may want to only use specific channels to preserve your privacy.", "components.ChannelPicker.modal.set": "Set Channel", + "components.BlueWalletWarning.warning": "WARNING: LNDHub.io is shutting down. Move your funds by April 30th or you will lose them.", "backends.LND.wsReq.warning": "You may have to enable Certificate Verification to make these kind of calls", "utils.handleAnything.lightningAddressError": "Error fetching Lightning Address data", "utils.handleAnything.notValid": "Value provided was not a valid Bitcoin address or Lightning Invoice",