react-native-notify-kit 10.8.0 → 10.9.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/README.md +34 -17
- package/android/build.gradle +50 -4
- package/android/src/main/AndroidManifest.xml +4 -0
- package/android/src/main/java/app/notifee/core/ForegroundService.java +1002 -58
- package/android/src/main/java/app/notifee/core/ForegroundServiceRunLimitReceiver.java +15 -0
- package/android/src/main/java/app/notifee/core/ForegroundServiceRunLimitScheduler.java +461 -0
- package/android/src/main/java/app/notifee/core/NotificationManager.java +6 -0
- package/android/src/main/java/app/notifee/core/event/NotificationEvent.java +6 -0
- package/android/src/main/java/app/notifee/core/model/NotificationAndroidModel.java +29 -0
- package/android/src/main/kotlin/io/invertase/notifee/NotifeeEventSubscriber.kt +3 -0
- package/android/src/test/java/app/notifee/core/ForegroundServiceRunLimitTest.java +2357 -0
- package/android/src/test/java/app/notifee/core/ForegroundServiceTest.java +3093 -21
- package/android/src/test/java/app/notifee/core/ShadowServiceCompatibilityTest.java +170 -0
- package/android/src/test/resources/robolectric.properties +4 -0
- package/cli/dist/cli.js +0 -1
- package/cli/dist/commands/initNse.js +1 -2
- package/cli/dist/lib/detectProject.js +1 -2
- package/cli/dist/lib/initNseCore.js +0 -1
- package/cli/dist/lib/logger.js +0 -1
- package/cli/dist/lib/patchPodfile.js +0 -1
- package/cli/dist/lib/patchXcodeProject.js +22 -3
- package/cli/dist/lib/writeTemplates.js +0 -1
- package/cli/dist/lib/xcode.js +6 -0
- package/cli/dist/templates/NotificationService.swift.tmpl +74 -6
- package/cli/package.json +1 -0
- package/cli/vendor/xcode/AUTHORS +6 -0
- package/cli/vendor/xcode/LICENSE +202 -0
- package/cli/vendor/xcode/NOTICE +5 -0
- package/cli/vendor/xcode/README.md +32 -0
- package/cli/vendor/xcode/UPSTREAM-SHA256.json +12 -0
- package/cli/vendor/xcode/index.js +18 -0
- package/cli/vendor/xcode/lib/parseJob.js +32 -0
- package/cli/vendor/xcode/lib/parser/pbxproj.js +1904 -0
- package/cli/vendor/xcode/lib/parser/pbxproj.pegjs +280 -0
- package/cli/vendor/xcode/lib/pbxFile.js +233 -0
- package/cli/vendor/xcode/lib/pbxProject.js +2205 -0
- package/cli/vendor/xcode/lib/pbxWriter.js +309 -0
- package/dist/NotifeeNativeModule.web.d.ts +2 -2
- package/dist/types/Notification.d.ts +36 -1
- package/dist/types/Notification.js +13 -0
- package/dist/types/Notification.js.map +1 -1
- package/dist/types/NotificationAndroid.d.ts +9 -0
- package/dist/types/NotificationAndroid.js.map +1 -1
- package/dist/validators/validateAndroidNotification.js +26 -1
- package/dist/validators/validateAndroidNotification.js.map +1 -1
- package/dist/validators/validateAndroidStyle.js +6 -0
- package/dist/validators/validateAndroidStyle.js.map +1 -1
- package/dist/validators/validateIOSAttachment.js +3 -1
- package/dist/validators/validateIOSAttachment.js.map +1 -1
- package/dist/version.d.ts +1 -1
- package/dist/version.js +1 -1
- package/package.json +8 -5
- package/src/NotifeeNativeModule.web.ts +2 -2
- package/src/types/Notification.ts +40 -0
- package/src/types/NotificationAndroid.ts +10 -0
- package/src/validators/validateAndroidNotification.ts +31 -1
- package/src/validators/validateAndroidStyle.ts +10 -2
- package/src/validators/validateIOSAttachment.ts +5 -1
- package/src/version.ts +1 -1
- package/cli/dist/cli.bundle.js +0 -20834
- package/cli/dist/cli.d.ts +0 -2
- package/cli/dist/cli.js.map +0 -1
- package/cli/dist/commands/initNse.d.ts +0 -12
- package/cli/dist/commands/initNse.js.map +0 -1
- package/cli/dist/lib/detectProject.d.ts +0 -12
- package/cli/dist/lib/detectProject.js.map +0 -1
- package/cli/dist/lib/initNseCore.d.ts +0 -8
- package/cli/dist/lib/initNseCore.js.map +0 -1
- package/cli/dist/lib/logger.d.ts +0 -4
- package/cli/dist/lib/logger.js.map +0 -1
- package/cli/dist/lib/patchPodfile.d.ts +0 -23
- package/cli/dist/lib/patchPodfile.js.map +0 -1
- package/cli/dist/lib/patchXcodeProject.d.ts +0 -41
- package/cli/dist/lib/patchXcodeProject.js.map +0 -1
- package/cli/dist/lib/writeTemplates.d.ts +0 -11
- package/cli/dist/lib/writeTemplates.js.map +0 -1
- package/cli/dist/templates/templates/Info.plist.tmpl +0 -29
- package/cli/dist/templates/templates/NotificationService.swift.tmpl +0 -100
- package/cli/dist/templates/templates/NotifyKitNSE.entitlements.tmpl +0 -6
|
@@ -0,0 +1,170 @@
|
|
|
1
|
+
package app.notifee.core;
|
|
2
|
+
|
|
3
|
+
import static org.junit.Assert.assertEquals;
|
|
4
|
+
import static org.junit.Assert.assertSame;
|
|
5
|
+
import static org.junit.Assert.assertThrows;
|
|
6
|
+
import static org.junit.Assert.assertTrue;
|
|
7
|
+
|
|
8
|
+
import android.app.Notification;
|
|
9
|
+
import android.app.NotificationChannel;
|
|
10
|
+
import android.app.NotificationManager;
|
|
11
|
+
import android.app.Service;
|
|
12
|
+
import android.content.Context;
|
|
13
|
+
import android.content.Intent;
|
|
14
|
+
import android.content.pm.ServiceInfo;
|
|
15
|
+
import android.os.Build;
|
|
16
|
+
import android.os.IBinder;
|
|
17
|
+
import org.junit.Test;
|
|
18
|
+
import org.junit.runner.RunWith;
|
|
19
|
+
import org.robolectric.Robolectric;
|
|
20
|
+
import org.robolectric.RobolectricTestRunner;
|
|
21
|
+
import org.robolectric.RuntimeEnvironment;
|
|
22
|
+
import org.robolectric.annotation.Config;
|
|
23
|
+
import org.robolectric.shadows.ShadowService;
|
|
24
|
+
|
|
25
|
+
/** Exercises the real Robolectric superclass calls, including its checked exception contract. */
|
|
26
|
+
@RunWith(RobolectricTestRunner.class)
|
|
27
|
+
public class ShadowServiceCompatibilityTest {
|
|
28
|
+
public static class TestService extends Service {
|
|
29
|
+
@Override
|
|
30
|
+
public IBinder onBind(Intent intent) {
|
|
31
|
+
return null;
|
|
32
|
+
}
|
|
33
|
+
}
|
|
34
|
+
|
|
35
|
+
@Test
|
|
36
|
+
@Config(
|
|
37
|
+
sdk = {29, 35, 36, 37},
|
|
38
|
+
shadows = ForegroundServiceTest.SliceAShadowService.class)
|
|
39
|
+
public void sliceA_typedForwardingPreservesFailures() {
|
|
40
|
+
ForegroundServiceTest.SliceAShadowService.reset();
|
|
41
|
+
assertForwarding(ForegroundServiceTest.SliceAShadowService.class, true);
|
|
42
|
+
}
|
|
43
|
+
|
|
44
|
+
@Test
|
|
45
|
+
@Config(
|
|
46
|
+
sdk = {24, 35, 36, 37},
|
|
47
|
+
shadows = ForegroundServiceTest.Issue81ShadowService.class)
|
|
48
|
+
public void issue81_untypedForwardingPreservesFailures() {
|
|
49
|
+
resetIssue81();
|
|
50
|
+
assertForwarding(ForegroundServiceTest.Issue81ShadowService.class, false);
|
|
51
|
+
}
|
|
52
|
+
|
|
53
|
+
@Test
|
|
54
|
+
@Config(
|
|
55
|
+
sdk = {29, 35, 36, 37},
|
|
56
|
+
shadows = ForegroundServiceTest.Issue81ShadowService.class)
|
|
57
|
+
public void issue81_typedForwardingResetsDelegationAfterFailure() {
|
|
58
|
+
resetIssue81();
|
|
59
|
+
TestService service = assertForwarding(ForegroundServiceTest.Issue81ShadowService.class, true);
|
|
60
|
+
// One record for each outer typed call, including failed attempts, without double counting.
|
|
61
|
+
assertEquals(4, ForegroundServiceTest.Issue81ShadowService.promotions.size());
|
|
62
|
+
service.startForeground(101, notification());
|
|
63
|
+
assertEquals(5, ForegroundServiceTest.Issue81ShadowService.promotions.size());
|
|
64
|
+
assertEquals(
|
|
65
|
+
Integer.valueOf(101), ForegroundServiceTest.Issue81ShadowService.promotions.get(4));
|
|
66
|
+
}
|
|
67
|
+
|
|
68
|
+
@Test
|
|
69
|
+
@Config(
|
|
70
|
+
sdk = {24, 35, 36, 37},
|
|
71
|
+
shadows = ForegroundServiceTest.DenyOldNotificationShadowService.class)
|
|
72
|
+
public void denyOld_untypedForwardingPreservesFailures() {
|
|
73
|
+
assertForwarding(ForegroundServiceTest.DenyOldNotificationShadowService.class, false);
|
|
74
|
+
}
|
|
75
|
+
|
|
76
|
+
@Test
|
|
77
|
+
@Config(
|
|
78
|
+
sdk = {24, 35, 36, 37},
|
|
79
|
+
shadows = ForegroundServiceTest.RejectBStartForegroundShadowService.class)
|
|
80
|
+
public void rejectB_untypedForwardingPreservesFailures() {
|
|
81
|
+
assertForwarding(ForegroundServiceTest.RejectBStartForegroundShadowService.class, false);
|
|
82
|
+
}
|
|
83
|
+
|
|
84
|
+
@Test
|
|
85
|
+
@Config(
|
|
86
|
+
sdk = {29, 35, 36, 37},
|
|
87
|
+
shadows = ForegroundServiceTest.RejectBStartForegroundShadowService.class)
|
|
88
|
+
public void rejectB_typedForwardingPreservesFailures() {
|
|
89
|
+
assertForwarding(ForegroundServiceTest.RejectBStartForegroundShadowService.class, true);
|
|
90
|
+
}
|
|
91
|
+
|
|
92
|
+
private static void resetIssue81() {
|
|
93
|
+
ForegroundServiceTest.Issue81ShadowService.failure = null;
|
|
94
|
+
ForegroundServiceTest.Issue81ShadowService.beforePromotion = null;
|
|
95
|
+
ForegroundServiceTest.Issue81ShadowService.rejectTitle = null;
|
|
96
|
+
ForegroundServiceTest.Issue81ShadowService.promotions.clear();
|
|
97
|
+
ForegroundServiceTest.Issue81ShadowService.types.clear();
|
|
98
|
+
ForegroundServiceTest.Issue81ShadowService.order.clear();
|
|
99
|
+
}
|
|
100
|
+
|
|
101
|
+
private static Notification notification() {
|
|
102
|
+
Context context = RuntimeEnvironment.getApplication();
|
|
103
|
+
if (Build.VERSION.SDK_INT >= 26) {
|
|
104
|
+
context
|
|
105
|
+
.getSystemService(NotificationManager.class)
|
|
106
|
+
.createNotificationChannel(
|
|
107
|
+
new NotificationChannel("compat", "compat", NotificationManager.IMPORTANCE_LOW));
|
|
108
|
+
return new Notification.Builder(context, "compat").setContentTitle("A").build();
|
|
109
|
+
}
|
|
110
|
+
return new Notification.Builder(context).setContentTitle("A").build();
|
|
111
|
+
}
|
|
112
|
+
|
|
113
|
+
private static TestService assertForwarding(
|
|
114
|
+
Class<? extends ShadowService> expected, boolean typed) {
|
|
115
|
+
assertEquals(RuntimeEnvironment.getApiLevel(), Build.VERSION.SDK_INT);
|
|
116
|
+
System.out.println(
|
|
117
|
+
"Shadow compatibility: sdk="
|
|
118
|
+
+ RuntimeEnvironment.getApiLevel()
|
|
119
|
+
+ " java="
|
|
120
|
+
+ System.getProperty("java.specification.version"));
|
|
121
|
+
TestService service = Robolectric.buildService(TestService.class).create().get();
|
|
122
|
+
ShadowService shadow = org.robolectric.Shadows.shadowOf(service);
|
|
123
|
+
assertSame(expected, shadow.getClass());
|
|
124
|
+
Notification notification = notification();
|
|
125
|
+
Runnable promote =
|
|
126
|
+
() -> {
|
|
127
|
+
if (typed) {
|
|
128
|
+
service.startForeground(
|
|
129
|
+
100, notification, ServiceInfo.FOREGROUND_SERVICE_TYPE_DATA_SYNC);
|
|
130
|
+
} else {
|
|
131
|
+
service.startForeground(100, notification);
|
|
132
|
+
}
|
|
133
|
+
};
|
|
134
|
+
promote.run();
|
|
135
|
+
assertSame(notification, shadow.getLastForegroundNotification());
|
|
136
|
+
assertEquals(100, shadow.getLastForegroundNotificationId());
|
|
137
|
+
assertTrue((notification.flags & Notification.FLAG_FOREGROUND_SERVICE) != 0);
|
|
138
|
+
if (typed)
|
|
139
|
+
assertEquals(
|
|
140
|
+
ServiceInfo.FOREGROUND_SERVICE_TYPE_DATA_SYNC, service.getForegroundServiceType());
|
|
141
|
+
// Both a platform-style runtime failure and the newly declared checked failure must escape.
|
|
142
|
+
for (Exception failure :
|
|
143
|
+
new Exception[] {new SecurityException("denied"), new Exception("checked")}) {
|
|
144
|
+
Notification rejected = notification();
|
|
145
|
+
shadow.setThrowInStartForeground(failure);
|
|
146
|
+
assertSame(
|
|
147
|
+
failure,
|
|
148
|
+
assertThrows(
|
|
149
|
+
Exception.class,
|
|
150
|
+
() -> {
|
|
151
|
+
if (typed) {
|
|
152
|
+
service.startForeground(
|
|
153
|
+
200, rejected, ServiceInfo.FOREGROUND_SERVICE_TYPE_DATA_SYNC);
|
|
154
|
+
} else {
|
|
155
|
+
service.startForeground(200, rejected);
|
|
156
|
+
}
|
|
157
|
+
}));
|
|
158
|
+
assertSame(notification, shadow.getLastForegroundNotification());
|
|
159
|
+
assertEquals(100, shadow.getLastForegroundNotificationId());
|
|
160
|
+
assertEquals(0, rejected.flags & Notification.FLAG_FOREGROUND_SERVICE);
|
|
161
|
+
}
|
|
162
|
+
shadow.setThrowInStartForeground(null);
|
|
163
|
+
promote.run();
|
|
164
|
+
assertSame(notification, shadow.getLastForegroundNotification());
|
|
165
|
+
if (typed)
|
|
166
|
+
assertEquals(
|
|
167
|
+
ServiceInfo.FOREGROUND_SERVICE_TYPE_DATA_SYNC, service.getForegroundServiceType());
|
|
168
|
+
return service;
|
|
169
|
+
}
|
|
170
|
+
}
|
package/cli/dist/cli.js
CHANGED
|
@@ -39,7 +39,7 @@ Object.defineProperty(exports, "__esModule", { value: true });
|
|
|
39
39
|
exports.initNse = initNse;
|
|
40
40
|
const fs = __importStar(require("fs"));
|
|
41
41
|
const path = __importStar(require("path"));
|
|
42
|
-
const xcode_1 = __importDefault(require("xcode"));
|
|
42
|
+
const xcode_1 = __importDefault(require("../lib/xcode"));
|
|
43
43
|
const detectProject_1 = require("../lib/detectProject");
|
|
44
44
|
const initNseCore_1 = require("../lib/initNseCore");
|
|
45
45
|
const writeTemplates_1 = require("../lib/writeTemplates");
|
|
@@ -208,4 +208,3 @@ function checkPbxprojTarget(pbxprojPath, targetName) {
|
|
|
208
208
|
}
|
|
209
209
|
return false;
|
|
210
210
|
}
|
|
211
|
-
//# sourceMappingURL=initNse.js.map
|
|
@@ -40,7 +40,7 @@ exports.deriveBundleId = void 0;
|
|
|
40
40
|
exports.detectIosProject = detectIosProject;
|
|
41
41
|
const fs = __importStar(require("fs"));
|
|
42
42
|
const path = __importStar(require("path"));
|
|
43
|
-
const xcode_1 = __importDefault(require("xcode"));
|
|
43
|
+
const xcode_1 = __importDefault(require("./xcode"));
|
|
44
44
|
var initNseCore_1 = require("./initNseCore");
|
|
45
45
|
Object.defineProperty(exports, "deriveBundleId", { enumerable: true, get: function () { return initNseCore_1.deriveNseBundleIdentifier; } });
|
|
46
46
|
/**
|
|
@@ -124,4 +124,3 @@ function readParentTarget(pbxprojPath) {
|
|
|
124
124
|
}
|
|
125
125
|
return { bundleId, targetName };
|
|
126
126
|
}
|
|
127
|
-
//# sourceMappingURL=detectProject.js.map
|
package/cli/dist/lib/logger.js
CHANGED
|
@@ -1,6 +1,6 @@
|
|
|
1
1
|
"use strict";
|
|
2
2
|
/**
|
|
3
|
-
* Xcode project patching via xcode@3.
|
|
3
|
+
* Xcode project patching via the stable vendored xcode@3.0.1 compatibility layer.
|
|
4
4
|
*
|
|
5
5
|
* xcode@3.x has three known bugs that this module works around. See inline
|
|
6
6
|
* comments tagged "xcode@3.x bug" for details. Do NOT remove these
|
|
@@ -53,7 +53,7 @@ exports.patchXcodeProject = patchXcodeProject;
|
|
|
53
53
|
exports.patchXcodeProjectForNotifyKitNse = patchXcodeProjectForNotifyKitNse;
|
|
54
54
|
const crypto = __importStar(require("crypto"));
|
|
55
55
|
const fs = __importStar(require("fs"));
|
|
56
|
-
const xcode_1 = __importDefault(require("xcode"));
|
|
56
|
+
const xcode_1 = __importDefault(require("./xcode"));
|
|
57
57
|
/**
|
|
58
58
|
* Adds an NSE target to the .pbxproj file via the xcode library.
|
|
59
59
|
* Idempotent: if a target with the given name already exists, returns false.
|
|
@@ -102,6 +102,10 @@ function patchXcodeProjectForNotifyKitNse(proj, options) {
|
|
|
102
102
|
proj.addSourceFile(`${targetName}/NotificationService.swift`, {
|
|
103
103
|
target: targetUuid,
|
|
104
104
|
}, group.uuid);
|
|
105
|
+
// The stable writer serializes undefined JS values as the bare word
|
|
106
|
+
// "undefined". addSourceFile also creates an unset explicitFileType;
|
|
107
|
+
// omit it on our new reference, preserving every existing reference.
|
|
108
|
+
fixSourceFileReference(proj, `${targetName}/NotificationService.swift`);
|
|
105
109
|
// xcode@3.x bug: addTargetDependency() adds the dependency to an internal
|
|
106
110
|
// cache but does not serialize it to the project hash, so writeSync()
|
|
107
111
|
// emits a pbxproj with no dependency entry. CocoaPods' host-target
|
|
@@ -199,6 +203,22 @@ function fixProductFileReference(proj, targetName) {
|
|
|
199
203
|
}
|
|
200
204
|
}
|
|
201
205
|
}
|
|
206
|
+
function fixSourceFileReference(proj, sourcePath) {
|
|
207
|
+
const fileRefs = proj.hash.project.objects.PBXFileReference;
|
|
208
|
+
if (!fileRefs)
|
|
209
|
+
return;
|
|
210
|
+
for (const value of Object.values(fileRefs)) {
|
|
211
|
+
if (!value || typeof value !== 'object')
|
|
212
|
+
continue;
|
|
213
|
+
const ref = value;
|
|
214
|
+
if (String(ref.path ?? '').replace(/^"|"$/g, '') !== sourcePath)
|
|
215
|
+
continue;
|
|
216
|
+
for (const key of Object.keys(ref)) {
|
|
217
|
+
if (ref[key] === undefined)
|
|
218
|
+
delete ref[key];
|
|
219
|
+
}
|
|
220
|
+
}
|
|
221
|
+
}
|
|
202
222
|
function genUuid() {
|
|
203
223
|
return crypto.randomBytes(12).toString('hex').toUpperCase().slice(0, 24);
|
|
204
224
|
}
|
|
@@ -264,4 +284,3 @@ function stripRnfbInfoPlistInputPath(proj, hostUuid) {
|
|
|
264
284
|
}
|
|
265
285
|
}
|
|
266
286
|
}
|
|
267
|
-
//# sourceMappingURL=patchXcodeProject.js.map
|
|
@@ -0,0 +1,6 @@
|
|
|
1
|
+
"use strict";
|
|
2
|
+
Object.defineProperty(exports, "__esModule", { value: true });
|
|
3
|
+
// Keeping this relative path works in both src/lib and the compiled dist/lib.
|
|
4
|
+
// eslint-disable-next-line @typescript-eslint/no-require-imports
|
|
5
|
+
const xcode = require('../../vendor/xcode');
|
|
6
|
+
exports.default = xcode;
|
|
@@ -1,32 +1,100 @@
|
|
|
1
|
+
import Foundation
|
|
1
2
|
import UserNotifications
|
|
2
3
|
import RNNotifeeCore
|
|
3
4
|
|
|
5
|
+
private func nseLog(_ message: String) {
|
|
6
|
+
NSLog("[NotifyKitNSE] %@", message)
|
|
7
|
+
}
|
|
8
|
+
|
|
9
|
+
private func requestedAttachmentURLs(from userInfo: [AnyHashable: Any]) -> [String] {
|
|
10
|
+
guard let serializedOptions = userInfo["notifee_options"] as? String,
|
|
11
|
+
let data = serializedOptions.data(using: .utf8),
|
|
12
|
+
let json = try? JSONSerialization.jsonObject(with: data) as? [String: Any],
|
|
13
|
+
let ios = json["ios"] as? [String: Any],
|
|
14
|
+
let attachments = ios["attachments"] as? [[String: Any]] else {
|
|
15
|
+
return []
|
|
16
|
+
}
|
|
17
|
+
|
|
18
|
+
return attachments.compactMap { attachment in
|
|
19
|
+
attachment["url"] as? String
|
|
20
|
+
}
|
|
21
|
+
}
|
|
22
|
+
|
|
4
23
|
class NotificationService: UNNotificationServiceExtension {
|
|
5
24
|
var contentHandler: ((UNNotificationContent) -> Void)?
|
|
6
25
|
var bestAttemptContent: UNMutableNotificationContent?
|
|
26
|
+
private let deliveryLock = NSLock()
|
|
27
|
+
private var didDeliver = false
|
|
7
28
|
|
|
8
29
|
override func didReceive(
|
|
9
30
|
_ request: UNNotificationRequest,
|
|
10
31
|
withContentHandler contentHandler: @escaping (UNNotificationContent) -> Void
|
|
11
32
|
) {
|
|
33
|
+
let mutableContent = request.content.mutableCopy() as? UNMutableNotificationContent
|
|
34
|
+
|
|
35
|
+
deliveryLock.lock()
|
|
36
|
+
didDeliver = false
|
|
12
37
|
self.contentHandler = contentHandler
|
|
13
|
-
self.bestAttemptContent =
|
|
38
|
+
self.bestAttemptContent = mutableContent
|
|
39
|
+
deliveryLock.unlock()
|
|
40
|
+
|
|
41
|
+
let requestedAttachmentUrls = requestedAttachmentURLs(from: request.content.userInfo)
|
|
14
42
|
|
|
15
|
-
|
|
16
|
-
|
|
43
|
+
nseLog(
|
|
44
|
+
"didReceive id=\(request.identifier) title=\(request.content.title) " +
|
|
45
|
+
"hasNotifeeOptions=\(request.content.userInfo["notifee_options"] != nil) " +
|
|
46
|
+
"requestedAttachments=\(requestedAttachmentUrls.count) " +
|
|
47
|
+
"urls=\(requestedAttachmentUrls.joined(separator: ","))"
|
|
48
|
+
)
|
|
49
|
+
|
|
50
|
+
guard let bestAttemptContent = mutableContent else {
|
|
51
|
+
nseLog("mutableCopy failed for id=\(request.identifier); delivering original content")
|
|
52
|
+
deliverOnce(request.content)
|
|
17
53
|
return
|
|
18
54
|
}
|
|
19
55
|
|
|
20
56
|
NotifeeExtensionHelper.populateNotificationContent(
|
|
21
57
|
request,
|
|
22
58
|
with: bestAttemptContent,
|
|
23
|
-
withContentHandler:
|
|
59
|
+
withContentHandler: { [weak self] content in
|
|
60
|
+
let deliveredAttachmentIds = content.attachments.map(\.identifier).joined(separator: ",")
|
|
61
|
+
nseLog(
|
|
62
|
+
"contentHandler id=\(request.identifier) title=\(content.title) " +
|
|
63
|
+
"deliveredAttachments=\(content.attachments.count) " +
|
|
64
|
+
"identifiers=\(deliveredAttachmentIds)"
|
|
65
|
+
)
|
|
66
|
+
self?.deliverOnce(content)
|
|
67
|
+
}
|
|
24
68
|
)
|
|
25
69
|
}
|
|
26
70
|
|
|
71
|
+
private func deliverOnce(_ content: UNNotificationContent) {
|
|
72
|
+
var handler: ((UNNotificationContent) -> Void)?
|
|
73
|
+
|
|
74
|
+
deliveryLock.lock()
|
|
75
|
+
if !didDeliver {
|
|
76
|
+
didDeliver = true
|
|
77
|
+
handler = contentHandler
|
|
78
|
+
contentHandler = nil
|
|
79
|
+
bestAttemptContent = nil
|
|
80
|
+
}
|
|
81
|
+
deliveryLock.unlock()
|
|
82
|
+
|
|
83
|
+
handler?(content)
|
|
84
|
+
}
|
|
85
|
+
|
|
27
86
|
override func serviceExtensionTimeWillExpire() {
|
|
28
|
-
|
|
29
|
-
|
|
87
|
+
deliveryLock.lock()
|
|
88
|
+
let content = bestAttemptContent
|
|
89
|
+
deliveryLock.unlock()
|
|
90
|
+
|
|
91
|
+
if let bestAttemptContent = content {
|
|
92
|
+
nseLog(
|
|
93
|
+
"serviceExtensionTimeWillExpire id=\(bestAttemptContent.userInfo["gcm.message_id"] ?? "n/a") " +
|
|
94
|
+
"title=\(bestAttemptContent.title) " +
|
|
95
|
+
"deliveredAttachments=\(bestAttemptContent.attachments.count)"
|
|
96
|
+
)
|
|
97
|
+
deliverOnce(bestAttemptContent)
|
|
30
98
|
}
|
|
31
99
|
}
|
|
32
100
|
}
|
package/cli/package.json
ADDED
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":"10.9.0"}
|
|
@@ -0,0 +1,202 @@
|
|
|
1
|
+
|
|
2
|
+
Apache License
|
|
3
|
+
Version 2.0, January 2004
|
|
4
|
+
http://www.apache.org/licenses/
|
|
5
|
+
|
|
6
|
+
TERMS AND CONDITIONS FOR USE, REPRODUCTION, AND DISTRIBUTION
|
|
7
|
+
|
|
8
|
+
1. Definitions.
|
|
9
|
+
|
|
10
|
+
"License" shall mean the terms and conditions for use, reproduction,
|
|
11
|
+
and distribution as defined by Sections 1 through 9 of this document.
|
|
12
|
+
|
|
13
|
+
"Licensor" shall mean the copyright owner or entity authorized by
|
|
14
|
+
the copyright owner that is granting the License.
|
|
15
|
+
|
|
16
|
+
"Legal Entity" shall mean the union of the acting entity and all
|
|
17
|
+
other entities that control, are controlled by, or are under common
|
|
18
|
+
control with that entity. For the purposes of this definition,
|
|
19
|
+
"control" means (i) the power, direct or indirect, to cause the
|
|
20
|
+
direction or management of such entity, whether by contract or
|
|
21
|
+
otherwise, or (ii) ownership of fifty percent (50%) or more of the
|
|
22
|
+
outstanding shares, or (iii) beneficial ownership of such entity.
|
|
23
|
+
|
|
24
|
+
"You" (or "Your") shall mean an individual or Legal Entity
|
|
25
|
+
exercising permissions granted by this License.
|
|
26
|
+
|
|
27
|
+
"Source" form shall mean the preferred form for making modifications,
|
|
28
|
+
including but not limited to software source code, documentation
|
|
29
|
+
source, and configuration files.
|
|
30
|
+
|
|
31
|
+
"Object" form shall mean any form resulting from mechanical
|
|
32
|
+
transformation or translation of a Source form, including but
|
|
33
|
+
not limited to compiled object code, generated documentation,
|
|
34
|
+
and conversions to other media types.
|
|
35
|
+
|
|
36
|
+
"Work" shall mean the work of authorship, whether in Source or
|
|
37
|
+
Object form, made available under the License, as indicated by a
|
|
38
|
+
copyright notice that is included in or attached to the work
|
|
39
|
+
(an example is provided in the Appendix below).
|
|
40
|
+
|
|
41
|
+
"Derivative Works" shall mean any work, whether in Source or Object
|
|
42
|
+
form, that is based on (or derived from) the Work and for which the
|
|
43
|
+
editorial revisions, annotations, elaborations, or other modifications
|
|
44
|
+
represent, as a whole, an original work of authorship. For the purposes
|
|
45
|
+
of this License, Derivative Works shall not include works that remain
|
|
46
|
+
separable from, or merely link (or bind by name) to the interfaces of,
|
|
47
|
+
the Work and Derivative Works thereof.
|
|
48
|
+
|
|
49
|
+
"Contribution" shall mean any work of authorship, including
|
|
50
|
+
the original version of the Work and any modifications or additions
|
|
51
|
+
to that Work or Derivative Works thereof, that is intentionally
|
|
52
|
+
submitted to Licensor for inclusion in the Work by the copyright owner
|
|
53
|
+
or by an individual or Legal Entity authorized to submit on behalf of
|
|
54
|
+
the copyright owner. For the purposes of this definition, "submitted"
|
|
55
|
+
means any form of electronic, verbal, or written communication sent
|
|
56
|
+
to the Licensor or its representatives, including but not limited to
|
|
57
|
+
communication on electronic mailing lists, source code control systems,
|
|
58
|
+
and issue tracking systems that are managed by, or on behalf of, the
|
|
59
|
+
Licensor for the purpose of discussing and improving the Work, but
|
|
60
|
+
excluding communication that is conspicuously marked or otherwise
|
|
61
|
+
designated in writing by the copyright owner as "Not a Contribution."
|
|
62
|
+
|
|
63
|
+
"Contributor" shall mean Licensor and any individual or Legal Entity
|
|
64
|
+
on behalf of whom a Contribution has been received by Licensor and
|
|
65
|
+
subsequently incorporated within the Work.
|
|
66
|
+
|
|
67
|
+
2. Grant of Copyright License. Subject to the terms and conditions of
|
|
68
|
+
this License, each Contributor hereby grants to You a perpetual,
|
|
69
|
+
worldwide, non-exclusive, no-charge, royalty-free, irrevocable
|
|
70
|
+
copyright license to reproduce, prepare Derivative Works of,
|
|
71
|
+
publicly display, publicly perform, sublicense, and distribute the
|
|
72
|
+
Work and such Derivative Works in Source or Object form.
|
|
73
|
+
|
|
74
|
+
3. Grant of Patent License. Subject to the terms and conditions of
|
|
75
|
+
this License, each Contributor hereby grants to You a perpetual,
|
|
76
|
+
worldwide, non-exclusive, no-charge, royalty-free, irrevocable
|
|
77
|
+
(except as stated in this section) patent license to make, have made,
|
|
78
|
+
use, offer to sell, sell, import, and otherwise transfer the Work,
|
|
79
|
+
where such license applies only to those patent claims licensable
|
|
80
|
+
by such Contributor that are necessarily infringed by their
|
|
81
|
+
Contribution(s) alone or by combination of their Contribution(s)
|
|
82
|
+
with the Work to which such Contribution(s) was submitted. If You
|
|
83
|
+
institute patent litigation against any entity (including a
|
|
84
|
+
cross-claim or counterclaim in a lawsuit) alleging that the Work
|
|
85
|
+
or a Contribution incorporated within the Work constitutes direct
|
|
86
|
+
or contributory patent infringement, then any patent licenses
|
|
87
|
+
granted to You under this License for that Work shall terminate
|
|
88
|
+
as of the date such litigation is filed.
|
|
89
|
+
|
|
90
|
+
4. Redistribution. You may reproduce and distribute copies of the
|
|
91
|
+
Work or Derivative Works thereof in any medium, with or without
|
|
92
|
+
modifications, and in Source or Object form, provided that You
|
|
93
|
+
meet the following conditions:
|
|
94
|
+
|
|
95
|
+
(a) You must give any other recipients of the Work or
|
|
96
|
+
Derivative Works a copy of this License; and
|
|
97
|
+
|
|
98
|
+
(b) You must cause any modified files to carry prominent notices
|
|
99
|
+
stating that You changed the files; and
|
|
100
|
+
|
|
101
|
+
(c) You must retain, in the Source form of any Derivative Works
|
|
102
|
+
that You distribute, all copyright, patent, trademark, and
|
|
103
|
+
attribution notices from the Source form of the Work,
|
|
104
|
+
excluding those notices that do not pertain to any part of
|
|
105
|
+
the Derivative Works; and
|
|
106
|
+
|
|
107
|
+
(d) If the Work includes a "NOTICE" text file as part of its
|
|
108
|
+
distribution, then any Derivative Works that You distribute must
|
|
109
|
+
include a readable copy of the attribution notices contained
|
|
110
|
+
within such NOTICE file, excluding those notices that do not
|
|
111
|
+
pertain to any part of the Derivative Works, in at least one
|
|
112
|
+
of the following places: within a NOTICE text file distributed
|
|
113
|
+
as part of the Derivative Works; within the Source form or
|
|
114
|
+
documentation, if provided along with the Derivative Works; or,
|
|
115
|
+
within a display generated by the Derivative Works, if and
|
|
116
|
+
wherever such third-party notices normally appear. The contents
|
|
117
|
+
of the NOTICE file are for informational purposes only and
|
|
118
|
+
do not modify the License. You may add Your own attribution
|
|
119
|
+
notices within Derivative Works that You distribute, alongside
|
|
120
|
+
or as an addendum to the NOTICE text from the Work, provided
|
|
121
|
+
that such additional attribution notices cannot be construed
|
|
122
|
+
as modifying the License.
|
|
123
|
+
|
|
124
|
+
You may add Your own copyright statement to Your modifications and
|
|
125
|
+
may provide additional or different license terms and conditions
|
|
126
|
+
for use, reproduction, or distribution of Your modifications, or
|
|
127
|
+
for any such Derivative Works as a whole, provided Your use,
|
|
128
|
+
reproduction, and distribution of the Work otherwise complies with
|
|
129
|
+
the conditions stated in this License.
|
|
130
|
+
|
|
131
|
+
5. Submission of Contributions. Unless You explicitly state otherwise,
|
|
132
|
+
any Contribution intentionally submitted for inclusion in the Work
|
|
133
|
+
by You to the Licensor shall be under the terms and conditions of
|
|
134
|
+
this License, without any additional terms or conditions.
|
|
135
|
+
Notwithstanding the above, nothing herein shall supersede or modify
|
|
136
|
+
the terms of any separate license agreement you may have executed
|
|
137
|
+
with Licensor regarding such Contributions.
|
|
138
|
+
|
|
139
|
+
6. Trademarks. This License does not grant permission to use the trade
|
|
140
|
+
names, trademarks, service marks, or product names of the Licensor,
|
|
141
|
+
except as required for reasonable and customary use in describing the
|
|
142
|
+
origin of the Work and reproducing the content of the NOTICE file.
|
|
143
|
+
|
|
144
|
+
7. Disclaimer of Warranty. Unless required by applicable law or
|
|
145
|
+
agreed to in writing, Licensor provides the Work (and each
|
|
146
|
+
Contributor provides its Contributions) on an "AS IS" BASIS,
|
|
147
|
+
WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or
|
|
148
|
+
implied, including, without limitation, any warranties or conditions
|
|
149
|
+
of TITLE, NON-INFRINGEMENT, MERCHANTABILITY, or FITNESS FOR A
|
|
150
|
+
PARTICULAR PURPOSE. You are solely responsible for determining the
|
|
151
|
+
appropriateness of using or redistributing the Work and assume any
|
|
152
|
+
risks associated with Your exercise of permissions under this License.
|
|
153
|
+
|
|
154
|
+
8. Limitation of Liability. In no event and under no legal theory,
|
|
155
|
+
whether in tort (including negligence), contract, or otherwise,
|
|
156
|
+
unless required by applicable law (such as deliberate and grossly
|
|
157
|
+
negligent acts) or agreed to in writing, shall any Contributor be
|
|
158
|
+
liable to You for damages, including any direct, indirect, special,
|
|
159
|
+
incidental, or consequential damages of any character arising as a
|
|
160
|
+
result of this License or out of the use or inability to use the
|
|
161
|
+
Work (including but not limited to damages for loss of goodwill,
|
|
162
|
+
work stoppage, computer failure or malfunction, or any and all
|
|
163
|
+
other commercial damages or losses), even if such Contributor
|
|
164
|
+
has been advised of the possibility of such damages.
|
|
165
|
+
|
|
166
|
+
9. Accepting Warranty or Additional Liability. While redistributing
|
|
167
|
+
the Work or Derivative Works thereof, You may choose to offer,
|
|
168
|
+
and charge a fee for, acceptance of support, warranty, indemnity,
|
|
169
|
+
or other liability obligations and/or rights consistent with this
|
|
170
|
+
License. However, in accepting such obligations, You may act only
|
|
171
|
+
on Your own behalf and on Your sole responsibility, not on behalf
|
|
172
|
+
of any other Contributor, and only if You agree to indemnify,
|
|
173
|
+
defend, and hold each Contributor harmless for any liability
|
|
174
|
+
incurred by, or claims asserted against, such Contributor by reason
|
|
175
|
+
of your accepting any such warranty or additional liability.
|
|
176
|
+
|
|
177
|
+
END OF TERMS AND CONDITIONS
|
|
178
|
+
|
|
179
|
+
APPENDIX: How to apply the Apache License to your work.
|
|
180
|
+
|
|
181
|
+
To apply the Apache License to your work, attach the following
|
|
182
|
+
boilerplate notice, with the fields enclosed by brackets "[]"
|
|
183
|
+
replaced with your own identifying information. (Don't include
|
|
184
|
+
the brackets!) The text should be enclosed in the appropriate
|
|
185
|
+
comment syntax for the file format. We also recommend that a
|
|
186
|
+
file or class name and description of purpose be included on the
|
|
187
|
+
same "printed page" as the copyright notice for easier
|
|
188
|
+
identification within third-party archives.
|
|
189
|
+
|
|
190
|
+
Copyright [yyyy] [name of copyright owner]
|
|
191
|
+
|
|
192
|
+
Licensed under the Apache License, Version 2.0 (the "License");
|
|
193
|
+
you may not use this file except in compliance with the License.
|
|
194
|
+
You may obtain a copy of the License at
|
|
195
|
+
|
|
196
|
+
http://www.apache.org/licenses/LICENSE-2.0
|
|
197
|
+
|
|
198
|
+
Unless required by applicable law or agreed to in writing, software
|
|
199
|
+
distributed under the License is distributed on an "AS IS" BASIS,
|
|
200
|
+
WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
|
|
201
|
+
See the License for the specific language governing permissions and
|
|
202
|
+
limitations under the License.
|
|
@@ -0,0 +1,32 @@
|
|
|
1
|
+
# Cordova Xcode compatibility layer
|
|
2
|
+
|
|
3
|
+
The runtime parser and project writer are vendored from the published, stable
|
|
4
|
+
`xcode@3.0.1` npm package, Apache Cordova's
|
|
5
|
+
[cordova-node-xcode](https://github.com/apache/cordova-node-xcode). They are not a
|
|
6
|
+
new parser. `lib/parser/pbxproj.js` and its PEG grammar are copied unchanged.
|
|
7
|
+
The worker parser (`parseJob.js`) is retained alongside the synchronous parser.
|
|
8
|
+
|
|
9
|
+
The npm tarball has integrity
|
|
10
|
+
`sha512-kCz5k7J7XbJtjABOvkc5lJmkiDh8VhjVCGNiqdKCscmVpdVUpEAyXv1xmCLkQJ5dsHqx3IPO4XW+NTDhU/fatA==`.
|
|
11
|
+
`UPSTREAM-SHA256.json` records original file hashes, before the local patch.
|
|
12
|
+
Apache's LICENSE, NOTICE, AUTHORS and file headers are preserved and shipped.
|
|
13
|
+
|
|
14
|
+
Only `lib/pbxProject.js` differs from that release: two substitutions change its
|
|
15
|
+
`uuid` import and `v4()` call to `node:crypto` and `randomUUID()`, and an in-file
|
|
16
|
+
modification notice identifies this local change. This is the change already
|
|
17
|
+
merged upstream as
|
|
18
|
+
[`1edf7059d347beb0e339d1cb4741581352b43138`](https://github.com/apache/cordova-node-xcode/commit/1edf7059d347beb0e339d1cb4741581352b43138).
|
|
19
|
+
The UUID formatting and collision check are unchanged. Node >=22 is required by
|
|
20
|
+
this CLI. `simple-plist` remains an explicit dependency: the full compatibility
|
|
21
|
+
layer also supports reading data-model metadata; dropping that dependency while
|
|
22
|
+
retaining those methods would leave a hidden missing import.
|
|
23
|
+
|
|
24
|
+
This avoids shipping the unpublished `xcode/uuid` override as an assumed
|
|
25
|
+
consumer contract. It also avoids migrating real Xcode parsing to an alpha API.
|
|
26
|
+
The three compatibility workarounds in `src/lib/patchXcodeProject.ts` remain.
|
|
27
|
+
|
|
28
|
+
To update, obtain a reviewed stable upstream tarball, verify its registry
|
|
29
|
+
integrity, replace these files and their original hashes, and re-evaluate the
|
|
30
|
+
UUID patch. Run CLI fixture, structural preservation, worker parsing, NSE
|
|
31
|
+
idempotence and consumer tarball tests on Node 22 and 24. Compare the CocoaPods
|
|
32
|
+
project structure before removing existing compatibility workarounds.
|