diff --git a/src/scripts/utils.js b/src/scripts/utils.js index 75e87ad..d6c31a6 100644 --- a/src/scripts/utils.js +++ b/src/scripts/utils.js @@ -136,6 +136,9 @@ export const getSampleInvoice = symbol => { return symbol === 'BTC' ? bitcoinInvoice : litecoinInvoice; }; +/** + * Get the fee estimation from the Boltz API + */ export const getFeeEstimation = callback => { const url = `${boltzApi}/getfeeestimation`; return () => { @@ -150,9 +153,19 @@ export const getFeeEstimation = callback => { }; }; +/** + * Detect whether the browser is a mobile one + */ +export const isMobileBrowser = () => { + return ( + typeof window.orientation !== 'undefined' || + navigator.userAgent.indexOf('IEMobile') !== -1 + ); +}; + /** * @param {{message: string, title: string }} info title and message - * @param {number} type type of alert + * @param {number} alertType type of alert */ export const notificationData = (info, alertType) => { let type; @@ -167,6 +180,7 @@ export const notificationData = (info, alertType) => { type = 'success'; break; } + return { message: info.message, title: info.title, diff --git a/src/views/landingpage/landingpage.js b/src/views/landingpage/landingpage.js index 932b0de..ff71231 100644 --- a/src/views/landingpage/landingpage.js +++ b/src/views/landingpage/landingpage.js @@ -11,14 +11,15 @@ import TaskBar from '../../components/taskbar'; import SwapTab from '../../components/swaptab'; import ModalComponent from '../../components/modal'; import BackGround from '../../components/background'; -import { notificationData } from '../../scripts/utils'; import { bitcoinNetwork, litecoinNetwork } from '../../constants'; +import { notificationData, isMobileBrowser } from '../../scripts/utils'; const boltz_logo = require('../../asset/icons/boltz_logo.png'); class LandingPage extends React.Component { constructor(props) { super(props); + this.state = { isOpen: false, }; @@ -26,6 +27,13 @@ class LandingPage extends React.Component { } componentDidMount = () => { + if (isMobileBrowser()) { + window.alert( + // eslint-disable-next-line max-len + 'We strongly advise against using Boltz on mobile devices as of right now. Please use a desktop or laptop' + ); + } + this.props.getPairs(); try {