Skip to content

Commit

Permalink
chore(icon): upd
Browse files Browse the repository at this point in the history
  • Loading branch information
bolshchikov committed Apr 19, 2024
1 parent e64648c commit 5e42a77
Show file tree
Hide file tree
Showing 4 changed files with 11 additions and 3 deletions.
3 changes: 2 additions & 1 deletion .gitignore
Original file line number Diff line number Diff line change
@@ -1,4 +1,5 @@
npm-debug.log
node_modules/
dist/
tmp/
tmp/
.DS_Store
Binary file modified public/icon.png
Loading
Sorry, something went wrong. Reload?
Sorry, we cannot display this file.
Sorry, this file is invalid so it cannot be displayed.
3 changes: 3 additions & 0 deletions public/manifest.json
Original file line number Diff line number Diff line change
Expand Up @@ -10,6 +10,9 @@
"default_icon": "icon.png",
"default_popup": "popup.html"
},
"icons": {
"48": "icon.png"
},
"content_scripts": [
{
"matches": [
Expand Down
8 changes: 6 additions & 2 deletions src/background.ts
Original file line number Diff line number Diff line change
Expand Up @@ -3,7 +3,7 @@ import { countryDialCodes } from './countryCodes';
chrome.runtime.onInstalled.addListener(() => {
chrome.contextMenus.create({
id: 'sendWhatsApp',
title: 'Send WhatsApp',
title: 'Send WhatsApp message',
contexts: ['selection'],
});
});
Expand All @@ -26,7 +26,11 @@ function extractPhoneNumber(text?: string): string {
if (!text) {
throw new Error('No phone text provided')
}
return text.replace(/\D/g, '');
const phoneNumber = text.replace(/\D/g, '');
if (phoneNumber.length === 0) {
throw new Error('No phone number is provided');
}
return phoneNumber;
}

function getUserCountry() {
Expand Down

0 comments on commit 5e42a77

Please sign in to comment.