From 700f8ec66c6bd9c890a9aa58b828c2effc39d372 Mon Sep 17 00:00:00 2001 From: Josh Kasten Date: Sat, 21 Sep 2024 00:06:39 +0000 Subject: [PATCH] move noUnusedParameters=true from IDE to compile --- build/config/tsconfig.base.json | 2 +- src/shared/managers/SubscriptionManager.ts | 10 ++++++++-- src/shared/utils/Encoding.ts | 2 +- tsconfig.json | 1 - 4 files changed, 10 insertions(+), 5 deletions(-) diff --git a/build/config/tsconfig.base.json b/build/config/tsconfig.base.json index c5f767701..48c345695 100644 --- a/build/config/tsconfig.base.json +++ b/build/config/tsconfig.base.json @@ -9,7 +9,7 @@ "noImplicitReturns": true, "noImplicitThis": true, "noUnusedLocals": true, - "noUnusedParameters": false, + "noUnusedParameters": true, "allowSyntheticDefaultImports": true, "allowUnreachableCode": false, "allowUnusedLabels": false, diff --git a/src/shared/managers/SubscriptionManager.ts b/src/shared/managers/SubscriptionManager.ts index 7b37ce256..ab98c4fe7 100644 --- a/src/shared/managers/SubscriptionManager.ts +++ b/src/shared/managers/SubscriptionManager.ts @@ -242,7 +242,9 @@ export class SubscriptionManager { * @param rawPushSubscription The raw push subscription obtained from calling subscribe(). This * can be null, in which case OneSignal's device record is set to unsubscribed. * - * @param subscriptionState Describes whether the device record is subscribed, unsubscribed, or in + * @param subscriptionState TODO: This is no longer used here and needs some refactoring to + * put this back into place. + * Describes whether the device record is subscribed, unsubscribed, or in * another state. By default, this is set from the availability of rawPushSubscription (exists: * Subscribed, null: Unsubscribed). Other use cases may result in creation of a device record that * warrants a special subscription state. For example, a device ID can be retrieved by providing @@ -251,7 +253,7 @@ export class SubscriptionManager { */ public async registerSubscription( pushSubscription: RawPushSubscription, - subscriptionState?: SubscriptionStateKind, + _subscriptionState?: SubscriptionStateKind, ): Promise { /* This may be called after the RawPushSubscription has been serialized across a postMessage @@ -477,6 +479,10 @@ export class SubscriptionManager { await this.context.serviceWorkerManager.installWorker(); } catch (err) { if (err instanceof ServiceWorkerRegistrationError) { + // TODO: This doesn't register the subscription any more, most likely broke + // in some refactoring in the v16 major release. It would be useful if a + // subscription was created so the customer knows this failed by seeing + // subscriptions in this state on the OneSignal dashboard. if (err.status === 403) { await this.context.subscriptionManager.registerFailedSubscription( SubscriptionStateKind.ServiceWorkerStatus403, diff --git a/src/shared/utils/Encoding.ts b/src/shared/utils/Encoding.ts index 7f30d7239..eb900c0c8 100644 --- a/src/shared/utils/Encoding.ts +++ b/src/shared/utils/Encoding.ts @@ -80,7 +80,7 @@ export function base64Encode(str) { return btoa( encodeURIComponent(str).replace( /%([0-9A-F]{2})/g, - function toSolidBytes(match, p1) { + function toSolidBytes(_match, p1) { return String.fromCharCode(('0x' as any) + p1); }, ), diff --git a/tsconfig.json b/tsconfig.json index 5d626af18..e8654add4 100644 --- a/tsconfig.json +++ b/tsconfig.json @@ -10,7 +10,6 @@ "strictNullChecks": true, "checkJs": true, "noImplicitAny": true, - "noUnusedParameters": true, "strictPropertyInitialization": true, "baseUrl": ".", "types": ["jest", "node"]