From bf83faed8d41bbc5ba962416aca6a2e3328111e2 Mon Sep 17 00:00:00 2001 From: "Saad A. Bazaz" Date: Thu, 28 Jul 2022 14:05:35 +0500 Subject: [PATCH] Use only api.whatsapp.com WhatsApp's new API does not require us to differentiate between web.whatsapp and api.whatsapp. api.whatsapp can handle WhatsApp mobile, WhatsApp Web and even WhatsApp Desktop. --- src/components/buttons/WhatsappShareButton.ts | 8 +------- 1 file changed, 1 insertion(+), 7 deletions(-) diff --git a/src/components/buttons/WhatsappShareButton.ts b/src/components/buttons/WhatsappShareButton.ts index 46323d5..9ffd98e 100644 --- a/src/components/buttons/WhatsappShareButton.ts +++ b/src/components/buttons/WhatsappShareButton.ts @@ -1,18 +1,12 @@ import transformObjectToParams from '../../utils'; import createShareButton from '../../hocs/createShareButton'; -function isMobileOrTablet() { - return /(android|iphone|ipad|mobile)/i.test(navigator.userAgent); -} - function whatsappLink( url: string, { title, separator }: { title?: string; separator?: string }, ) { return ( - 'https://' + - (isMobileOrTablet() ? 'api' : 'web') + - '.whatsapp.com/send' + + 'https://api.whatsapp.com/send' + transformObjectToParams({ text: title ? title + separator + url : url, })