New Case Study:See how Anthropic automated 95% of dependency reviews with Socket.Learn More
Socket
Sign inDemoInstall
Socket

react-native-communications

Package Overview
Dependencies
Maintainers
1
Versions
20
Alerts
File Explorer

Advanced tools

Socket logo

Install Socket

Detect and block malicious and high-risk dependencies

Install

react-native-communications - npm Package Compare versions

Comparing version 2.1.4 to 2.2.0

33

AKCommunications.js

@@ -143,3 +143,34 @@ 'use strict';

export const web = function(address) {
export const textWithoutEncoding = function(phoneNumber = null, body = null) {
if(arguments.length > 2) {
console.log('you supplied too many arguments. You can either supply 0 or 1 or 2');
return;
}
let url = 'sms:';
if(phoneNumber) {
if(isCorrectType('String', phoneNumber)) {
url += phoneNumber;
} else {
console.log('the phone number should be provided as a string. It was provided as '
+ Object.prototype.toString.call(phoneNumber).slice(8, -1)
+ ',ignoring the value provided');
}
}
if(body) {
if(isCorrectType('String', body)) {
url += Platform.OS === 'ios' ? `&body=${body}` : `?body=${body}`;
} else {
console.log('the body should be provided as a string. It was provided as '
+ Object.prototype.toString.call(body).slice(8, -1)
+ ',ignoring the value provided');
}
}
LaunchURL(url);
}
export const web = (address = null) => {
if(!address) {

@@ -146,0 +177,0 @@ console.log('Missing address argument');

2

package.json
{
"name": "react-native-communications",
"version": "2.1.4",
"version": "2.2.0",
"description": "Open a web address or call, email, text or iMessage (iOS only) someone in React Native",

@@ -5,0 +5,0 @@ "main": "AKCommunications.js",

@@ -93,2 +93,5 @@ # react-native-communications

**Note**:
This method encodes the message body if provided (related to issue [#34](https://github.com/anarchicknight/react-native-communications/issues/34)). Some people have reported that this causes issues with spaces showing up as %20 on their devices. If this is the case for you please use the `textWithoutEncoding` method instead.
If 0 arguments are provided the new message view will launch with no recipient specified and no prefilled message.

@@ -103,3 +106,24 @@

---
```js
textWithoutEncoding(phoneNumber, body)
phoneNumber - String
body - String
```
**Note**:
This method has been added as a temporary fix for [#43](https://github.com/anarchicknight/react-native-communications/issues/43). If you are going to use this method please be aware that if you have any text for your message body which needs to be encoded you are responsible for doing this yourself before passing the string to the method.
If 0 arguments are provided the new message view will launch with no recipient specified and no prefilled message.
If only 1 argument is supplied it will be interpreted as the phoneNumber argument. If it is the correct type then the new message view will be launched with the recipient specified and no message prefilled. If it is the incorrect type then it will be ignored and the new message view launched as if 0 arguments were supplied.
If 2 arguments are provided the first will be interpreted as the phone number and the second as the message to prefill. If both arguments are the correct type then the new message view will be launched with the recipient specified and the message prefilled. If either argument is the wrong type it will be ignored. This makes it possible for example, to launch the new message view with no recipient but a prefilled message by calling `text(null, 'React Native is great!')`.
The method will exit if more than 2 arguments are provided and the new message view will not be launched.
---
```js
web(address)

@@ -200,2 +224,2 @@

- [ ] Refactor how arguments are passed in to the methods (change from multiple parameters to an args object)
- [ ] Work on V3 of the library to make major changes to how arguments are passed to methods and to change how we handle encoding of various parameters
SocketSocket SOC 2 Logo

Product

  • Package Alerts
  • Integrations
  • Docs
  • Pricing
  • FAQ
  • Roadmap
  • Changelog

Packages

npm

Stay in touch

Get open source security insights delivered straight into your inbox.


  • Terms
  • Privacy
  • Security

Made with ⚡️ by Socket Inc