-
Notifications
You must be signed in to change notification settings - Fork 192
New issue
Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.
By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.
Already on GitHub? Sign in to your account
Add TextNow recipe #416
Add TextNow recipe #416
Conversation
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Hi! Thanks for raising this PR 😁
I've made some comments on your code if you care to answer.
Generally, LGTM but I don't have a way of testing the code because I don't have an account on this service.
class Messenger extends Ferdium { | ||
overrideUserAgent() { | ||
return window.navigator.userAgent | ||
.replaceAll(/(Ferdium|Electron)\/\S+ \([^)]+\)/g, '') | ||
.trim(); | ||
} | ||
}; |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Is this needed? If not, please remove it
localStorage.setItem( | ||
'_cs_desktopNotifsEnabled', | ||
JSON.stringify({ | ||
__t: Date.now(), | ||
__v: true, | ||
}), | ||
); |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Why is this needed?
if (typeof Ferdium.onNotify === 'function') { | ||
Ferdium.onNotify(notification => { | ||
if (typeof notification.title !== 'string') { | ||
notification.title = | ||
((notification.title.props || {}).content || [])[0] || 'Messenger'; | ||
} | ||
|
||
if (typeof notification.options.body !== 'string') { | ||
notification.options.body = | ||
(((notification.options.body || {}).props || {}).content || [])[0] || | ||
''; | ||
} | ||
|
||
return notification; | ||
}); | ||
} | ||
}; |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
This code is interesting 🤔
Why do you need it? Did you by any chance noticed that the title or body could be different from string and that would cause an error?
Hi @Arthur-Huan! Did you close this PR by accident? |
No, I realized some of the files were the wrong ones. It's kind of a mess on my computer and I must have mixed some files up. |
Pre-flight Checklist
Please ensure you've completed all of the following.
Description of Change
Adding the recipe for TextNow.