ServiceWorker: offline-plugin and Firebase - firebase

i'm working with offline-plugin and i'm trying to enable background notifications using Firebase
I've noticed that firebase setBackgroundMessageHandler method need to run in a ServiceWorker. I have an auto generated service worker by the offline-plugin and i don't know how to add that method to the existent ServiceWorker or if i can create a new one for Firebase.
Thanks you!

Finally i've managed to do it. You can add a bootstrap service worker using ServiceWorker entry option in the OfflinePlugin initialization this way:
plugins: [
...,
new OfflinePlugin({
...,
ServiceWorker: {
...,
entry: 'my-sw.js'
}
})
]
Then i put my firebase-sw.js code in the my-sw.js file
Cheers

Related

Generating dynamic routes in Nuxt with Cloud Firestore using #nuxtjs/firebase

I need some help.
I'm trying to build out my static site on Nuxt which has a bunch of dynamic routes.
So far in my nuxt.config.js I've got
generate: {
async routes() {
const queryDb = await app.$fire.firestore.collection("schools").get()
return queryDb.docs.map(x => `/performance/${x.schoolId}`);
}
}
However, when using Nuxt generate, it fails because it can't read property '$fire' which is how I've been accessing firebase throughout my application (using https://firebase.nuxtjs.org). Is there some way I can require it before creating the routes?
Any help would be appreciated! Thanks.
I also encountered the error:
TypeError: Cannot read property '$fire' of undefined
After following this demo of Nuxt and Firebase, it fixed by adding '#nuxtjs/firebase' inside the buildModules that didn't mention from the tutorial:
nuxt.config.js
buildModules: [
'#nuxtjs/firebase'
],

Remove all cordova-sqlite-storage values when logging out the ionic3 app?

I'm currently working on ionic 3 app and used https://ionicframework.com/docs/building/storage plugin. Now I'm working on the log out. I couldn't found how to remove all data that are stored in the database while logging out the app.
After importing and injecting storage I needed to use the following method by using the clear method.
logOut() {
this.storage.clear().then((data) => {
console.log('In promise of clear the data ', data);
this.navCtrl.push(SignInPage);
});

How I can bypass "angular-in-memory-web-api" for a specific url

I was using "angular-in-memory-web-api" to mock my REST web api, however now I am have started writing the actual web api and I want to replace the "angular-in-memory-web-api" step by step.
Example:
I have written following asp.net web api
/api/values
however when I issue http.get() request using above api url angular tries to serve it using "angular-in-memory-web-api", however in this case I want to bypass "angular-in-memory-web-api" so that request is entertained by my actual web api controller.
you can set passThruUnknownUrl to forward to real backend for un-matching endpoints
e.g.,
InMemoryWebApiModule.forRoot(InMemoryDataService, {
passThruUnknownUrl: true
}),
You can try by removing InMemoryWebApiModule.forRoot(InMemoryDataService) from your app.module. If you have done so already, showing some code would be helpful.
Also, consider using Postman to verify your new service
in app.module.ts
import { HttpClientInMemoryWebApiModule } from 'angular-in-memory-web-api';
import { InMemoryDataService } from './my-module/services/in-memory-data.service';
in app.module.ts imports array
HttpClientInMemoryWebApiModule.forRoot(InMemoryDataService, { dataEncapsulation: false, passThruUnknownUrl: true })
passThruUnknownUrl related doc

which package is advisable to implemet Oauth for stripe connect in meteor. Any example demos out there?

I am looking to implememt stripe connect in meteor. I understand that the first step is to able to link the user account to platform accout. I believ this is done via the Oauth process. I am aware of this package( https://github.com/chadokruse/meteor-accounts-stripe-connect)
I am getting a type error "Cannot call method 'insert' of undefined" for the following code.
Accounts.loginServiceConfiguration.insert({
service: 'stripe',
appId: Meteor.settings.client_id,
secret: Meteor.settings.stripe,
scope: 'read_write', //or read_only
});
Any other way for going about this without the package?
Based on this tutorial, you can use mrgalaxy:stripe. You might be getting that error you're seeing because you haven't added the service-configuration package. Do meteor add service-configuration.

PushNotifications doesn't work after close App - FirefoxOS

I'm developing an app in FirefoxOS that use PushNotifications
I followed the instructions in:
https://wiki.mozilla.org/WebAPI/SimplePush
and
https://developer.mozilla.org/en-US/docs/WebAPI/Simple_Push
And All si OK, but just for the time I register the app, the moment I close the App and send a notification nothing happen, and never works again.
Why could this happen and how can I avoid it?
Without any code, I I would guess that it may have a problem with the manifest. Did you add
"messages": [
{ "push": "/index.html"},
{ "push-register": "/index.html"}
]
to it?

Resources