expo-notifications 0.13.3 → 0.14.0

This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
package/CHANGELOG.md CHANGED
@@ -10,13 +10,11 @@
10
10
 
11
11
  ### 💡 Others
12
12
 
13
- ## 0.13.3 — 2021-10-21
13
+ ## 0.14.0 — 2021-12-03
14
14
 
15
- _This version does not introduce any user-facing changes._
16
-
17
- ## 0.13.2 — 2021-10-15
15
+ ### 💡 Others
18
16
 
19
- _This version does not introduce any user-facing changes._
17
+ - Update `fs-extra` dependency. ([#15069](https://github.com/expo/expo/pull/15069) by [@Simek](https://github.com/Simek))
20
18
 
21
19
  ## 0.13.1 — 2021-10-01
22
20
 
package/README.md CHANGED
@@ -22,7 +22,7 @@ Please refer to the [installation instructions in the Expo documentation](https:
22
22
 
23
23
  # Installation in bare React Native projects
24
24
 
25
- For bare React Native projects, you must ensure that you have [installed and configured the `react-native-unimodules` package](https://github.com/expo/expo/tree/master/packages/react-native-unimodules) before continuing.
25
+ For bare React Native projects, you must ensure that you have [installed and configured the `expo` package](https://docs.expo.dev/bare/installing-expo-modules/) before continuing.
26
26
 
27
27
  ### Add the package to your npm dependencies
28
28
 
@@ -3,7 +3,7 @@ apply plugin: 'kotlin-android'
3
3
  apply plugin: 'maven'
4
4
 
5
5
  group = 'host.exp.exponent'
6
- version = '0.13.3'
6
+ version = '0.14.0'
7
7
 
8
8
  buildscript {
9
9
  // Simple helper that allows the root project to override versions declared by this library.
@@ -61,7 +61,7 @@ android {
61
61
  minSdkVersion safeExtGet("minSdkVersion", 21)
62
62
  targetSdkVersion safeExtGet("targetSdkVersion", 30)
63
63
  versionCode 21
64
- versionName '0.13.3'
64
+ versionName '0.14.0'
65
65
  }
66
66
 
67
67
  lintOptions {
package/package.json CHANGED
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "expo-notifications",
3
- "version": "0.13.3",
3
+ "version": "0.14.0",
4
4
  "description": "Notifications module",
5
5
  "main": "build/index.js",
6
6
  "types": "build/index.d.ts",
@@ -44,18 +44,20 @@
44
44
  "assert": "^2.0.0",
45
45
  "badgin": "^1.1.5",
46
46
  "expo-application": "~4.0.0",
47
- "expo-constants": "~12.1.2",
48
- "expo-modules-core": "~0.4.4",
49
- "fs-extra": "^9.0.1",
50
- "unimodules-task-manager-interface": "~7.0.3",
47
+ "expo-constants": "~13.0.0",
48
+ "fs-extra": "^9.1.0",
49
+ "unimodules-task-manager-interface": "~7.1.0",
51
50
  "uuid": "^3.4.0"
52
51
  },
53
52
  "devDependencies": {
54
53
  "@types/node-fetch": "^2.5.7",
55
54
  "@types/uuid": "^3.4.7",
56
55
  "expo-module-scripts": "^2.0.0",
57
- "memfs": "^2.15.5",
56
+ "memfs": "^3.2.0",
58
57
  "node-fetch": "^2.6.1"
59
58
  },
60
- "gitHead": "4fa0497a180ae707fa860cb03858630ab7af19f4"
59
+ "peerDependencies": {
60
+ "expo": "*"
61
+ },
62
+ "gitHead": "2e5c6983b86d5ecfca028ba64002897d8adc2cc4"
61
63
  }
@@ -5,8 +5,8 @@ const withNotificationsAndroid_1 = require("./withNotificationsAndroid");
5
5
  const withNotificationsIOS_1 = require("./withNotificationsIOS");
6
6
  const pkg = require('expo-notifications/package.json');
7
7
  const withNotifications = (config, props) => {
8
- config = withNotificationsAndroid_1.withNotificationsAndroid(config, props || {});
9
- config = withNotificationsIOS_1.withNotificationsIOS(config, props || {});
8
+ config = (0, withNotificationsAndroid_1.withNotificationsAndroid)(config, props || {});
9
+ config = (0, withNotificationsIOS_1.withNotificationsIOS)(config, props || {});
10
10
  return config;
11
11
  };
12
- exports.default = config_plugins_1.createRunOncePlugin(withNotifications, pkg.name, pkg.version);
12
+ exports.default = (0, config_plugins_1.createRunOncePlugin)(withNotifications, pkg.name, pkg.version);
@@ -26,7 +26,7 @@ exports.NOTIFICATION_ICON_COLOR_RESOURCE = `@color/${exports.NOTIFICATION_ICON_C
26
26
  const withNotificationIcons = (config, { icon }) => {
27
27
  // If no icon provided in the config plugin props, fallback to value from app.json
28
28
  icon = icon || getNotificationIcon(config);
29
- return config_plugins_1.withDangerousMod(config, [
29
+ return (0, config_plugins_1.withDangerousMod)(config, [
30
30
  'android',
31
31
  async (config) => {
32
32
  await setNotificationIconAsync(config.modRequest.projectRoot, icon);
@@ -37,7 +37,7 @@ const withNotificationIcons = (config, { icon }) => {
37
37
  exports.withNotificationIcons = withNotificationIcons;
38
38
  const withNotificationIconColor = (config, { color }) => {
39
39
  // If no color provided in the config plugin props, fallback to value from app.json
40
- return config_plugins_1.withAndroidColors(config, (config) => {
40
+ return (0, config_plugins_1.withAndroidColors)(config, (config) => {
41
41
  color = color || getNotificationColor(config);
42
42
  config.modResults = setNotificationIconColor(color, config.modResults);
43
43
  return config;
@@ -48,14 +48,14 @@ const withNotificationManifest = (config, { icon, color }) => {
48
48
  // If no icon or color provided in the config plugin props, fallback to value from app.json
49
49
  icon = icon || getNotificationIcon(config);
50
50
  color = color || getNotificationColor(config);
51
- return config_plugins_1.withAndroidManifest(config, (config) => {
51
+ return (0, config_plugins_1.withAndroidManifest)(config, (config) => {
52
52
  config.modResults = setNotificationConfig({ icon, color }, config.modResults);
53
53
  return config;
54
54
  });
55
55
  };
56
56
  exports.withNotificationManifest = withNotificationManifest;
57
57
  const withNotificationSounds = (config, { sounds }) => {
58
- return config_plugins_1.withDangerousMod(config, [
58
+ return (0, config_plugins_1.withDangerousMod)(config, [
59
59
  'android',
60
60
  (config) => {
61
61
  setNotificationSounds(config.modRequest.projectRoot, sounds);
@@ -112,20 +112,20 @@ function setNotificationConfig(props, manifest) {
112
112
  async function writeNotificationIconImageFilesAsync(icon, projectRoot) {
113
113
  await Promise.all(Object.values(exports.dpiValues).map(async ({ folderName, scale }) => {
114
114
  const drawableFolderName = folderName.replace('mipmap', 'drawable');
115
- const dpiFolderPath = path_1.resolve(projectRoot, exports.ANDROID_RES_PATH, drawableFolderName);
116
- if (!fs_1.existsSync(dpiFolderPath)) {
117
- fs_1.mkdirSync(dpiFolderPath, { recursive: true });
115
+ const dpiFolderPath = (0, path_1.resolve)(projectRoot, exports.ANDROID_RES_PATH, drawableFolderName);
116
+ if (!(0, fs_1.existsSync)(dpiFolderPath)) {
117
+ (0, fs_1.mkdirSync)(dpiFolderPath, { recursive: true });
118
118
  }
119
119
  const iconSizePx = BASELINE_PIXEL_SIZE * scale;
120
120
  try {
121
- const resizedIcon = (await image_utils_1.generateImageAsync({ projectRoot, cacheType: 'android-notification' }, {
121
+ const resizedIcon = (await (0, image_utils_1.generateImageAsync)({ projectRoot, cacheType: 'android-notification' }, {
122
122
  src: icon,
123
123
  width: iconSizePx,
124
124
  height: iconSizePx,
125
125
  resizeMode: 'cover',
126
126
  backgroundColor: 'transparent',
127
127
  })).source;
128
- fs_1.writeFileSync(path_1.resolve(dpiFolderPath, exports.NOTIFICATION_ICON + '.png'), resizedIcon);
128
+ (0, fs_1.writeFileSync)((0, path_1.resolve)(dpiFolderPath, exports.NOTIFICATION_ICON + '.png'), resizedIcon);
129
129
  }
130
130
  catch (e) {
131
131
  throw new Error(ERROR_MSG_PREFIX + 'Encountered an issue resizing Android notification icon: ' + e);
@@ -135,10 +135,10 @@ async function writeNotificationIconImageFilesAsync(icon, projectRoot) {
135
135
  function removeNotificationIconImageFiles(projectRoot) {
136
136
  Object.values(exports.dpiValues).forEach(async ({ folderName }) => {
137
137
  const drawableFolderName = folderName.replace('mipmap', 'drawable');
138
- const dpiFolderPath = path_1.resolve(projectRoot, exports.ANDROID_RES_PATH, drawableFolderName);
139
- const iconFile = path_1.resolve(dpiFolderPath, exports.NOTIFICATION_ICON + '.png');
140
- if (fs_1.existsSync(iconFile)) {
141
- fs_1.unlinkSync(iconFile);
138
+ const dpiFolderPath = (0, path_1.resolve)(projectRoot, exports.ANDROID_RES_PATH, drawableFolderName);
139
+ const iconFile = (0, path_1.resolve)(dpiFolderPath, exports.NOTIFICATION_ICON + '.png');
140
+ if ((0, fs_1.existsSync)(iconFile)) {
141
+ (0, fs_1.unlinkSync)(iconFile);
142
142
  }
143
143
  });
144
144
  }
@@ -160,16 +160,16 @@ exports.setNotificationSounds = setNotificationSounds;
160
160
  * there isn't already an existing file under that name.
161
161
  */
162
162
  function writeNotificationSoundFile(soundFileRelativePath, projectRoot) {
163
- const rawResourcesPath = path_1.resolve(projectRoot, exports.ANDROID_RES_PATH, 'raw');
164
- const inputFilename = path_1.basename(soundFileRelativePath);
163
+ const rawResourcesPath = (0, path_1.resolve)(projectRoot, exports.ANDROID_RES_PATH, 'raw');
164
+ const inputFilename = (0, path_1.basename)(soundFileRelativePath);
165
165
  if (inputFilename) {
166
166
  try {
167
- const sourceFilepath = path_1.resolve(projectRoot, soundFileRelativePath);
168
- const destinationFilepath = path_1.resolve(rawResourcesPath, inputFilename);
169
- if (!fs_1.existsSync(rawResourcesPath)) {
170
- fs_1.mkdirSync(rawResourcesPath, { recursive: true });
167
+ const sourceFilepath = (0, path_1.resolve)(projectRoot, soundFileRelativePath);
168
+ const destinationFilepath = (0, path_1.resolve)(rawResourcesPath, inputFilename);
169
+ if (!(0, fs_1.existsSync)(rawResourcesPath)) {
170
+ (0, fs_1.mkdirSync)(rawResourcesPath, { recursive: true });
171
171
  }
172
- fs_1.copyFileSync(sourceFilepath, destinationFilepath);
172
+ (0, fs_1.copyFileSync)(sourceFilepath, destinationFilepath);
173
173
  }
174
174
  catch (e) {
175
175
  throw new Error(ERROR_MSG_PREFIX + 'Encountered an issue copying Android notification sounds: ' + e);
@@ -177,10 +177,10 @@ function writeNotificationSoundFile(soundFileRelativePath, projectRoot) {
177
177
  }
178
178
  }
179
179
  const withNotificationsAndroid = (config, { icon = null, color = null, sounds = [] }) => {
180
- config = exports.withNotificationIconColor(config, { color });
181
- config = exports.withNotificationIcons(config, { icon });
182
- config = exports.withNotificationManifest(config, { icon, color });
183
- config = exports.withNotificationSounds(config, { sounds });
180
+ config = (0, exports.withNotificationIconColor)(config, { color });
181
+ config = (0, exports.withNotificationIcons)(config, { icon });
182
+ config = (0, exports.withNotificationManifest)(config, { icon, color });
183
+ config = (0, exports.withNotificationSounds)(config, { sounds });
184
184
  return config;
185
185
  };
186
186
  exports.withNotificationsAndroid = withNotificationsAndroid;
@@ -6,16 +6,16 @@ const fs_1 = require("fs");
6
6
  const path_1 = require("path");
7
7
  const ERROR_MSG_PREFIX = 'An error occurred while configuring iOS notifications. ';
8
8
  const withNotificationsIOS = (config, { mode = 'development', sounds = [] }) => {
9
- config = config_plugins_1.withEntitlementsPlist(config, (config) => {
9
+ config = (0, config_plugins_1.withEntitlementsPlist)(config, (config) => {
10
10
  config.modResults['aps-environment'] = mode;
11
11
  return config;
12
12
  });
13
- config = exports.withNotificationSounds(config, { sounds });
13
+ config = (0, exports.withNotificationSounds)(config, { sounds });
14
14
  return config;
15
15
  };
16
16
  exports.withNotificationsIOS = withNotificationsIOS;
17
17
  const withNotificationSounds = (config, { sounds }) => {
18
- return config_plugins_1.withXcodeProject(config, (config) => {
18
+ return (0, config_plugins_1.withXcodeProject)(config, (config) => {
19
19
  setNotificationSounds(config.modRequest.projectRoot, {
20
20
  sounds,
21
21
  project: config.modResults,
@@ -38,12 +38,12 @@ function setNotificationSounds(projectRoot, { sounds, project, projectName, }) {
38
38
  }
39
39
  const sourceRoot = config_plugins_1.IOSConfig.Paths.getSourceRoot(projectRoot);
40
40
  for (const soundFileRelativePath of sounds) {
41
- const fileName = path_1.basename(soundFileRelativePath);
42
- const sourceFilepath = path_1.resolve(projectRoot, soundFileRelativePath);
43
- const destinationFilepath = path_1.resolve(sourceRoot, fileName);
41
+ const fileName = (0, path_1.basename)(soundFileRelativePath);
42
+ const sourceFilepath = (0, path_1.resolve)(projectRoot, soundFileRelativePath);
43
+ const destinationFilepath = (0, path_1.resolve)(sourceRoot, fileName);
44
44
  // Since it's possible that the filename is the same, but the
45
45
  // file itself id different, let's copy it regardless
46
- fs_1.copyFileSync(sourceFilepath, destinationFilepath);
46
+ (0, fs_1.copyFileSync)(sourceFilepath, destinationFilepath);
47
47
  if (!project.hasFile(`${projectName}/${fileName}`)) {
48
48
  project = config_plugins_1.IOSConfig.XcodeUtils.addResourceFileToGroup({
49
49
  filepath: `${projectName}/${fileName}`,