@firebase/messaging
Advanced tools
Comparing version 0.2.2-canary.9d00c6f to 0.2.2-canary.ab0faeb
@@ -46,4 +46,7 @@ import TokenDetailsModel from '../models/token-details-model'; | ||
requestPermission(): void; | ||
getPushSubscription_(registration: any, publicVapidKey: any): Promise<PushSubscription>; | ||
/** | ||
* Gets a PushSubscription for the current user. | ||
*/ | ||
getPushSubscription(swRegistration: ServiceWorkerRegistration, publicVapidKey: Uint8Array): Promise<PushSubscription>; | ||
/** | ||
* @export | ||
@@ -50,0 +53,0 @@ * @param {!ServiceWorkerRegistration} registration |
@@ -125,3 +125,3 @@ /** | ||
publicVapidKey = publicKey; | ||
return _this.getPushSubscription_(swReg, publicVapidKey); | ||
return _this.getPushSubscription(swReg, publicVapidKey); | ||
}) | ||
@@ -164,3 +164,3 @@ .then(function (pushSubscription) { | ||
publicVapidKey = publicKey; | ||
return _this.getPushSubscription_(swReg, publicVapidKey); | ||
return _this.getPushSubscription(swReg, publicVapidKey); | ||
}) | ||
@@ -230,4 +230,15 @@ .then(function (pushSubscription) { | ||
}; | ||
ControllerInterface.prototype.getPushSubscription_ = function (registration, publicVapidKey) { | ||
throw this.errorFactory_.create(errors_1.default.codes.AVAILABLE_IN_WINDOW); | ||
/** | ||
* Gets a PushSubscription for the current user. | ||
*/ | ||
ControllerInterface.prototype.getPushSubscription = function (swRegistration, publicVapidKey) { | ||
return swRegistration.pushManager.getSubscription().then(function (subscription) { | ||
if (subscription) { | ||
return subscription; | ||
} | ||
return swRegistration.pushManager.subscribe({ | ||
userVisibleOnly: true, | ||
applicationServerKey: publicVapidKey | ||
}); | ||
}); | ||
}; | ||
@@ -234,0 +245,0 @@ /** |
@@ -102,9 +102,2 @@ import { FirebaseMessaging } from '@firebase/messaging-types'; | ||
/** | ||
* Gets a PushSubscription for the current user. | ||
* @private | ||
* @param {ServiceWorkerRegistration} registration | ||
* @return {Promise<PushSubscription>} | ||
*/ | ||
getPushSubscription_(swRegistration: any, publicVapidKey: any): any; | ||
/** | ||
* This method will set up a message listener to handle | ||
@@ -111,0 +104,0 @@ * events from the service worker that should trigger |
@@ -322,22 +322,2 @@ /** | ||
/** | ||
* Gets a PushSubscription for the current user. | ||
* @private | ||
* @param {ServiceWorkerRegistration} registration | ||
* @return {Promise<PushSubscription>} | ||
*/ | ||
WindowController.prototype.getPushSubscription_ = function (swRegistration, publicVapidKey) { | ||
// Check for existing subscription first | ||
var subscription; | ||
var fcmTokenDetails; | ||
return swRegistration.pushManager.getSubscription().then(function (subscription) { | ||
if (subscription) { | ||
return subscription; | ||
} | ||
return swRegistration.pushManager.subscribe({ | ||
userVisibleOnly: true, | ||
applicationServerKey: publicVapidKey | ||
}); | ||
}); | ||
}; | ||
/** | ||
* This method will set up a message listener to handle | ||
@@ -344,0 +324,0 @@ * events from the service worker that should trigger |
@@ -46,4 +46,7 @@ import TokenDetailsModel from '../models/token-details-model'; | ||
requestPermission(): void; | ||
getPushSubscription_(registration: any, publicVapidKey: any): Promise<PushSubscription>; | ||
/** | ||
* Gets a PushSubscription for the current user. | ||
*/ | ||
getPushSubscription(swRegistration: ServiceWorkerRegistration, publicVapidKey: Uint8Array): Promise<PushSubscription>; | ||
/** | ||
* @export | ||
@@ -50,0 +53,0 @@ * @param {!ServiceWorkerRegistration} registration |
@@ -124,3 +124,3 @@ /** | ||
publicVapidKey = publicKey; | ||
return _this.getPushSubscription_(swReg, publicVapidKey); | ||
return _this.getPushSubscription(swReg, publicVapidKey); | ||
}) | ||
@@ -163,3 +163,3 @@ .then(function (pushSubscription) { | ||
publicVapidKey = publicKey; | ||
return _this.getPushSubscription_(swReg, publicVapidKey); | ||
return _this.getPushSubscription(swReg, publicVapidKey); | ||
}) | ||
@@ -229,4 +229,15 @@ .then(function (pushSubscription) { | ||
}; | ||
ControllerInterface.prototype.getPushSubscription_ = function (registration, publicVapidKey) { | ||
throw this.errorFactory_.create(Errors.codes.AVAILABLE_IN_WINDOW); | ||
/** | ||
* Gets a PushSubscription for the current user. | ||
*/ | ||
ControllerInterface.prototype.getPushSubscription = function (swRegistration, publicVapidKey) { | ||
return swRegistration.pushManager.getSubscription().then(function (subscription) { | ||
if (subscription) { | ||
return subscription; | ||
} | ||
return swRegistration.pushManager.subscribe({ | ||
userVisibleOnly: true, | ||
applicationServerKey: publicVapidKey | ||
}); | ||
}); | ||
}; | ||
@@ -233,0 +244,0 @@ /** |
@@ -102,9 +102,2 @@ import { FirebaseMessaging } from '@firebase/messaging-types'; | ||
/** | ||
* Gets a PushSubscription for the current user. | ||
* @private | ||
* @param {ServiceWorkerRegistration} registration | ||
* @return {Promise<PushSubscription>} | ||
*/ | ||
getPushSubscription_(swRegistration: any, publicVapidKey: any): any; | ||
/** | ||
* This method will set up a message listener to handle | ||
@@ -111,0 +104,0 @@ * events from the service worker that should trigger |
@@ -321,22 +321,2 @@ /** | ||
/** | ||
* Gets a PushSubscription for the current user. | ||
* @private | ||
* @param {ServiceWorkerRegistration} registration | ||
* @return {Promise<PushSubscription>} | ||
*/ | ||
WindowController.prototype.getPushSubscription_ = function (swRegistration, publicVapidKey) { | ||
// Check for existing subscription first | ||
var subscription; | ||
var fcmTokenDetails; | ||
return swRegistration.pushManager.getSubscription().then(function (subscription) { | ||
if (subscription) { | ||
return subscription; | ||
} | ||
return swRegistration.pushManager.subscribe({ | ||
userVisibleOnly: true, | ||
applicationServerKey: publicVapidKey | ||
}); | ||
}); | ||
}; | ||
/** | ||
* This method will set up a message listener to handle | ||
@@ -343,0 +323,0 @@ * events from the service worker that should trigger |
{ | ||
"name": "@firebase/messaging", | ||
"version": "0.2.2-canary.9d00c6f", | ||
"version": "0.2.2-canary.ab0faeb", | ||
"description": "", | ||
@@ -16,7 +16,7 @@ "author": "Firebase <firebase-support@google.com> (https://firebase.google.com/)", | ||
"peerDependencies": { | ||
"@firebase/app": "0.1.10-canary.9d00c6f" | ||
"@firebase/app": "0.1.10-canary.ab0faeb" | ||
}, | ||
"dependencies": { | ||
"@firebase/messaging-types": "0.1.2-canary.9d00c6f", | ||
"@firebase/util": "0.1.10-canary.9d00c6f", | ||
"@firebase/messaging-types": "0.1.2-canary.ab0faeb", | ||
"@firebase/util": "0.1.10-canary.ab0faeb", | ||
"tslib": "^1.9.0" | ||
@@ -23,0 +23,0 @@ }, |
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
479234
5372
+ Added@firebase/app@0.1.10-canary.ab0faeb(transitive)
+ Added@firebase/app-types@0.1.2-canary.ab0faeb(transitive)
+ Added@firebase/messaging-types@0.1.2-canary.ab0faeb(transitive)
+ Added@firebase/util@0.1.10-canary.ab0faeb(transitive)
- Removed@firebase/app@0.1.10-canary.9d00c6f(transitive)
- Removed@firebase/app-types@0.1.2-canary.9d00c6f(transitive)
- Removed@firebase/messaging-types@0.1.2-canary.9d00c6f(transitive)
- Removed@firebase/util@0.1.10-canary.9d00c6f(transitive)