Huge News!Announcing our $40M Series B led by Abstract Ventures.Learn More
Socket
Sign inDemoInstall
Socket

expo-sms

Package Overview
Dependencies
Maintainers
22
Versions
106
Alerts
File Explorer

Advanced tools

Socket logo

Install Socket

Detect and block malicious and high-risk dependencies

Install

expo-sms - npm Package Compare versions

Comparing version 8.1.0 to 8.2.0

CHANGELOG.md

4

.expo/tsconfig.jest.json
{
"extends": "/Users/bbarthec/Work/expo/packages/expo-sms/tsconfig.json",
"extends": "/Users/tomasz/Work/expo/packages/expo-sms/tsconfig.json",
"compilerOptions": {

@@ -10,5 +10,5 @@ "module": "esnext",

"../../../node_modules/@types",
"/Users/bbarthec/Work/expo/packages/expo-module-scripts/ts-declarations"
"/Users/tomasz/Work/expo/packages/expo-module-scripts/ts-declarations"
]
}
}

@@ -1,4 +0,4 @@

import { SMSResponse } from './SMS.types';
import { SMSResponse, SMSOptions } from './SMS.types';
export { SMSResponse };
export declare function sendSMSAsync(addresses: string | string[], message: string): Promise<SMSResponse>;
export declare function sendSMSAsync(addresses: string | string[], message: string, options?: SMSOptions): Promise<SMSResponse>;
/**

@@ -5,0 +5,0 @@ * The device has a telephony radio with data communication support.

@@ -1,9 +0,29 @@

import { UnavailabilityError } from '@unimodules/core';
/* eslint-disable no-unused-expressions */
import { UnavailabilityError, Platform } from '@unimodules/core';
import ExpoSMS from './ExpoSMS';
export async function sendSMSAsync(addresses, message) {
const finalAddresses = Array.isArray(addresses) ? addresses : [addresses];
function processAttachments(attachments) {
if (!attachments) {
return null;
}
attachments = Array.isArray(attachments) ? attachments : [attachments];
if (Platform.OS === 'android' && attachments.length > 1) {
if (__DEV__) {
console.warn('Android only supports a single attachment. The first array item is used.');
}
attachments = attachments.slice(0, 1);
}
return attachments;
}
export async function sendSMSAsync(addresses, message, options) {
if (!ExpoSMS.sendSMSAsync) {
throw new UnavailabilityError('expo-sms', 'sendSMSAsync');
}
return ExpoSMS.sendSMSAsync(finalAddresses, message);
const finalAddresses = Array.isArray(addresses) ? addresses : [addresses];
const finalOptions = {
...options,
};
if (options?.attachments) {
finalOptions.attachments = processAttachments(options?.attachments) || undefined;
}
return ExpoSMS.sendSMSAsync(finalAddresses, message, finalOptions);
}

@@ -10,0 +30,0 @@ /**

export declare type SMSResponse = {
result: 'unknown' | 'sent' | 'cancelled';
};
export declare type SMSAttachment = {
uri: string;
mimeType: string;
filename: string;
};
export declare type SMSOptions = {
attachments?: SMSAttachment | SMSAttachment[] | undefined;
};
{
"name": "expo-sms",
"version": "8.1.0",
"version": "8.2.0",
"description": "Provides access to the system's UI/app for sending SMS messages.",

@@ -43,3 +43,3 @@ "main": "build/SMS.js",

},
"gitHead": "3ad68bbd9847ebc8a55272c263b17d998a92f64f"
}
"gitHead": "dfc7fdb9aee4ef6fa10a9693e3d0935a2d500ae2"
}

@@ -12,3 +12,3 @@ # expo-sms

For managed [managed](https://docs.expo.io/versions/latest/introduction/managed-vs-bare/) Expo projects, please follow the installation instructions in the [API documentation for the latest stable release](#api-documentation). If you follow the link and there is no documentation available then this library is not yet usable within managed projects &mdash; it is likely to be included in an upcoming Expo SDK release.
For managed [managed](https://docs.expo.io/versions/latest/introduction/managed-vs-bare/) Expo projects, please follow the installation instructions in the [API documentation for the latest stable release](https://docs.expo.io/versions/latest/sdk/sms/).

@@ -27,3 +27,3 @@ # Installation in bare React Native projects

Run `pod install` in the ios directory after installing the npm package.
Run `npx pod-install` after installing the npm package.

@@ -36,2 +36,2 @@ ### Configure for Android

Contributions are very welcome! Please refer to guidelines described in the [contributing guide]( https://github.com/expo/expo#contributing).
Contributions are very welcome! Please refer to guidelines described in the [contributing guide](https://github.com/expo/expo#contributing).

@@ -1,17 +0,41 @@

import { UnavailabilityError } from '@unimodules/core';
/* eslint-disable no-unused-expressions */
import { UnavailabilityError, Platform } from '@unimodules/core';
import ExpoSMS from './ExpoSMS';
import { SMSResponse } from './SMS.types';
import { SMSAttachment, SMSResponse, SMSOptions } from './SMS.types';
export { SMSResponse };
function processAttachments(
attachments: SMSAttachment | SMSAttachment[] | undefined
): SMSAttachment[] | null {
if (!attachments) {
return null;
}
attachments = Array.isArray(attachments) ? attachments : [attachments];
if (Platform.OS === 'android' && attachments.length > 1) {
if (__DEV__) {
console.warn('Android only supports a single attachment. The first array item is used.');
}
attachments = attachments.slice(0, 1);
}
return attachments;
}
export async function sendSMSAsync(
addresses: string | string[],
message: string
message: string,
options?: SMSOptions
): Promise<SMSResponse> {
const finalAddresses = Array.isArray(addresses) ? addresses : [addresses];
if (!ExpoSMS.sendSMSAsync) {
throw new UnavailabilityError('expo-sms', 'sendSMSAsync');
}
return ExpoSMS.sendSMSAsync(finalAddresses, message);
const finalAddresses = Array.isArray(addresses) ? addresses : [addresses];
const finalOptions = {
...options,
} as SMSOptions;
if (options?.attachments) {
finalOptions.attachments = processAttachments(options?.attachments) || undefined;
}
return ExpoSMS.sendSMSAsync(finalAddresses, message, finalOptions);
}

@@ -18,0 +42,0 @@

export type SMSResponse = {
result: 'unknown' | 'sent' | 'cancelled';
};
export type SMSAttachment = {
uri: string;
mimeType: string;
filename: string;
};
export type SMSOptions = {
attachments?: SMSAttachment | SMSAttachment[] | undefined;
};

Sorry, the diff of this file is not supported yet

Sorry, the diff of this file is not supported yet

Sorry, the diff of this file is not supported yet

Sorry, the diff of this file is not supported yet

Sorry, the diff of this file is not supported yet

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