expo-notifications 0.13.0 → 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 +10 -0
- package/README.md +1 -1
- package/android/build.gradle +2 -2
- package/ios/EXNotifications/EXServerRegistrationModule.m +6 -3
- package/ios/EXNotifications.xcframework/Info.plist +5 -5
- package/ios/EXNotifications.xcframework/ios-arm64/EXNotifications.framework/EXNotifications +0 -0
- package/ios/EXNotifications.xcframework/ios-arm64/EXNotifications.framework/Info.plist +0 -0
- package/ios/EXNotifications.xcframework/ios-arm64_x86_64-simulator/EXNotifications.framework/EXNotifications +0 -0
- package/ios/EXNotifications.xcframework/ios-arm64_x86_64-simulator/EXNotifications.framework/Info.plist +0 -0
- package/package.json +10 -8
- package/plugin/build/withNotifications.js +3 -3
- package/plugin/build/withNotificationsAndroid.js +24 -24
- package/plugin/build/withNotificationsIOS.js +7 -7
package/CHANGELOG.md
CHANGED
|
@@ -10,6 +10,16 @@
|
|
|
10
10
|
|
|
11
11
|
### 💡 Others
|
|
12
12
|
|
|
13
|
+
## 0.14.0 — 2021-12-03
|
|
14
|
+
|
|
15
|
+
### 💡 Others
|
|
16
|
+
|
|
17
|
+
- Update `fs-extra` dependency. ([#15069](https://github.com/expo/expo/pull/15069) by [@Simek](https://github.com/Simek))
|
|
18
|
+
|
|
19
|
+
## 0.13.1 — 2021-10-01
|
|
20
|
+
|
|
21
|
+
_This version does not introduce any user-facing changes._
|
|
22
|
+
|
|
13
23
|
## 0.13.0 — 2021-09-28
|
|
14
24
|
|
|
15
25
|
### 🛠 Breaking changes
|
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 `
|
|
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
|
|
package/android/build.gradle
CHANGED
|
@@ -3,7 +3,7 @@ apply plugin: 'kotlin-android'
|
|
|
3
3
|
apply plugin: 'maven'
|
|
4
4
|
|
|
5
5
|
group = 'host.exp.exponent'
|
|
6
|
-
version = '0.
|
|
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.
|
|
64
|
+
versionName '0.14.0'
|
|
65
65
|
}
|
|
66
66
|
|
|
67
67
|
lintOptions {
|
|
@@ -2,10 +2,13 @@
|
|
|
2
2
|
|
|
3
3
|
#import <EXNotifications/EXServerRegistrationModule.h>
|
|
4
4
|
|
|
5
|
-
|
|
6
|
-
|
|
5
|
+
// noop (used by code transform to ensure the versioning isn't applied)
|
|
6
|
+
#define EX_UNVERSIONED(symbol) symbol
|
|
7
7
|
|
|
8
|
-
static NSString * const
|
|
8
|
+
static NSString * const kEXDeviceInstallationUUIDKey = EX_UNVERSIONED(@"EXDeviceInstallationUUIDKey");
|
|
9
|
+
static NSString * const kEXDeviceInstallationUUIDLegacyKey = EX_UNVERSIONED(@"EXDeviceInstallUUIDKey");
|
|
10
|
+
|
|
11
|
+
static NSString * const kEXRegistrationInfoKey = EX_UNVERSIONED(@"EXNotificationRegistrationInfoKey");
|
|
9
12
|
|
|
10
13
|
@implementation EXServerRegistrationModule
|
|
11
14
|
|
|
@@ -6,30 +6,30 @@
|
|
|
6
6
|
<array>
|
|
7
7
|
<dict>
|
|
8
8
|
<key>LibraryIdentifier</key>
|
|
9
|
-
<string>ios-
|
|
9
|
+
<string>ios-arm64_x86_64-simulator</string>
|
|
10
10
|
<key>LibraryPath</key>
|
|
11
11
|
<string>EXNotifications.framework</string>
|
|
12
12
|
<key>SupportedArchitectures</key>
|
|
13
13
|
<array>
|
|
14
14
|
<string>arm64</string>
|
|
15
|
+
<string>x86_64</string>
|
|
15
16
|
</array>
|
|
16
17
|
<key>SupportedPlatform</key>
|
|
17
18
|
<string>ios</string>
|
|
19
|
+
<key>SupportedPlatformVariant</key>
|
|
20
|
+
<string>simulator</string>
|
|
18
21
|
</dict>
|
|
19
22
|
<dict>
|
|
20
23
|
<key>LibraryIdentifier</key>
|
|
21
|
-
<string>ios-
|
|
24
|
+
<string>ios-arm64</string>
|
|
22
25
|
<key>LibraryPath</key>
|
|
23
26
|
<string>EXNotifications.framework</string>
|
|
24
27
|
<key>SupportedArchitectures</key>
|
|
25
28
|
<array>
|
|
26
29
|
<string>arm64</string>
|
|
27
|
-
<string>x86_64</string>
|
|
28
30
|
</array>
|
|
29
31
|
<key>SupportedPlatform</key>
|
|
30
32
|
<string>ios</string>
|
|
31
|
-
<key>SupportedPlatformVariant</key>
|
|
32
|
-
<string>simulator</string>
|
|
33
33
|
</dict>
|
|
34
34
|
</array>
|
|
35
35
|
<key>CFBundlePackageType</key>
|
|
Binary file
|
|
Binary file
|
|
Binary file
|
|
Binary file
|
package/package.json
CHANGED
|
@@ -1,6 +1,6 @@
|
|
|
1
1
|
{
|
|
2
2
|
"name": "expo-notifications",
|
|
3
|
-
"version": "0.
|
|
3
|
+
"version": "0.14.0",
|
|
4
4
|
"description": "Notifications module",
|
|
5
5
|
"main": "build/index.js",
|
|
6
6
|
"types": "build/index.d.ts",
|
|
@@ -37,25 +37,27 @@
|
|
|
37
37
|
"preset": "expo-module-scripts/ios"
|
|
38
38
|
},
|
|
39
39
|
"dependencies": {
|
|
40
|
-
"@expo/config-plugins": "^
|
|
40
|
+
"@expo/config-plugins": "^4.0.2",
|
|
41
41
|
"@expo/image-utils": "^0.3.16",
|
|
42
42
|
"@ide/backoff": "^1.0.0",
|
|
43
43
|
"abort-controller": "^3.0.0",
|
|
44
44
|
"assert": "^2.0.0",
|
|
45
45
|
"badgin": "^1.1.5",
|
|
46
46
|
"expo-application": "~4.0.0",
|
|
47
|
-
"expo-constants": "~
|
|
48
|
-
"
|
|
49
|
-
"
|
|
50
|
-
"unimodules-task-manager-interface": "~7.0.0",
|
|
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.
|
|
56
|
+
"memfs": "^3.2.0",
|
|
58
57
|
"node-fetch": "^2.6.1"
|
|
59
58
|
},
|
|
60
|
-
"
|
|
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}`,
|