Skip to content

Commit

Permalink
fix(whatsapp web): provided support for whatsapp web
Browse files Browse the repository at this point in the history
  • Loading branch information
opensrc0 committed Apr 10, 2024
1 parent a80375f commit a2d9187
Showing 1 changed file with 11 additions and 7 deletions.
18 changes: 11 additions & 7 deletions __app/component/WhatsappShare/WhatsappShare.js
Original file line number Diff line number Diff line change
Expand Up @@ -21,14 +21,18 @@ function WhatsappShare({
const failureMsg = { ...failureMsgDefault, ...failureMsgProps };

const getWhatsappShare = () => {
if (mobile) {
window.location.href = `https://wa.me/${mobile}/?text=${msg}`;
handleSuccess({ msgType: 'SUCCESSFUL', msg: successMsg, successCb, data: msg });
} else if (msg) {
window.location.href = `https://wa.me/?text=${msg}`;
handleSuccess({ msgType: 'SUCCESSFUL', msg: successMsg, successCb, data: msg });
if (navigator.userAgent.match(/iPhone|Android/i)) {
if (mobile) {
window.location.href = `https://wa.me/${mobile}/?text=${msg}`;
handleSuccess({ msgType: 'SUCCESSFUL', msg: successMsg, successCb, data: msg });
} else if (msg) {
window.location.href = `https://wa.me/?text=${msg}`;
handleSuccess({ msgType: 'SUCCESSFUL', msg: successMsg, successCb, data: msg });
} else {
return handleError({ msgType: 'BAD_REQUEST', msg: failureMsg.badRequest, failureCb });
}
} else {
return handleError({ msgType: 'BAD_REQUEST', msg: failureMsg.badRequest, failureCb });
window.location.href = `https://web.whatsapp.com/send?text=${msg}&phone=${mobile}`;
}

return true;
Expand Down

0 comments on commit a2d9187

Please sign in to comment.