wizpanda / cordova-plugin-firebase-lib

This repository is moving & merging to https://github.com/wizpanda/cordova-plugin-firebase-lib to avoid confusion to developers.
https://www.wizpanda.com/
MIT License
68 stars 38 forks source link

Why does this fork exist? #39

Closed rolinger closed 4 years ago

rolinger commented 4 years ago

What does this fork provide over the original cordova-plugin-firebase plugin? Shouldn't these two be merged back into one? There's too much to weed through but from a 10,000 foot level they look to be pretty much identical.

sagrawal31 commented 4 years ago

You can see stuff here: https://github.com/wizpanda/cordova-plugin-firebase-lib#difference-from-the-fork-repository

Quick update, we created this fork to fix breaking changes released by Google Firebase two times. The original repo is not being maintained so We started maintaining this.

You can see all the changes & release done after we forked, here at https://github.com/wizpanda/cordova-plugin-firebase-lib/blob/master/CHANGELOG.md#v300 or https://github.com/wizpanda/cordova-plugin-firebase-lib/releases

sagrawal31 commented 4 years ago

It's definitely not identical with the original repo. We went far ahead with this repo in terms of performance, code cleanup & much more.

torsorensen commented 4 years ago

This lib just works! Thx much for fixing things up, guys!

rolinger commented 4 years ago

ok, its been a while but I was original using just firebase but it broke, and then I moved over to this one firebase-lib and its worked for a while until it too broke about 3 weeks ago. Then the fix for me was to move to @dpa99c Dave Allen's firebasex plugin and got it working again. So the problem now seems that firebasex and firebase-lib are now different forks. what version of firebase-lib fixes the Google update that broke everything 3 weeks ago?

torsorensen commented 4 years ago

V5.x works for me in combination with androidx and androidx-adapter as referenced in the docs. I'm not using any of the gradle fix packages btw.

JoseGeorges8 commented 4 years ago

Guys greetings, I come from using the original firebase plugin in ionic using the native hook @ionic-native/firebase. How would I go to use this one?

torsorensen commented 4 years ago

Guys greetings, I come from using the original firebase plugin in ionic using the native hook @ionic-native/firebase. How would I go to use this one?

I would start out reading the docs

JoseGeorges8 commented 4 years ago

I tried reading the docs. It says you can use cordova plugins on Ionic using the window object but everybody says to use it in a different way. Nevertheless Ive tried all the cases and they don't work for me (Ionic 4)

Documentations says to do window.FirebasePlugin.pluginMethod but the plugin does not get recognized, in fact none of the plugins show and it won't let me build.

Other forums show other syntax like window['pluginName'] However it gives me undefined

dpa99c commented 4 years ago

Please see my comment as to my reason for the existence of the cordova-plugin-firebasex fork of this plugin.

TL;DR: I'm in the process of rewriting some major sections of the source code (for my own purposes).

After that rewrite is done, I'd be happy to merge my changes into this fork and hand over maintenance. However, since this fork has also diverged, there might be some merge conflicts to overcome to make that happen.

torsorensen commented 4 years ago

I tried reading the docs. It says you can use cordova plugins on Ionic using the window object but everybody says to use it in a different way. Nevertheless Ive tried all the cases and they don't work for me (Ionic 4)

Documentations says to do window.FirebasePlugin.pluginMethod but the plugin does not get recognized, in fact none of the plugins show and it won't let me build.

Other forums show other syntax like window['pluginName'] However it gives me undefined

I see you're using Ionic. Using the window property directly doesn't seem like an Ionic approach, now that you mention having @ionic-native/firebase in place How about

1) Get rid of the old lib ionic cordova plugin remove cordova-plugin-firebase ionic cordova platforms remove ios ionic cordova platforms remove android

2) Install new lib ionic cordova plugin add cordova-plugin-firebase-lib (if v.5.x of the plugin)

3) if you need support libraries of Androidx ionic cordova plugin add cordova-plugin-androidx ionic cordova plugin add cordova-plugin-androidx-adapter

4) If you choose v.5, check section on Cocoa Pods, namely the update command (pod repo update) and the use of xcworkspace

JoseGeorges8 commented 4 years ago

@torsorensen those steps have been done and my project does get recognized by firebase (it shows in the firebase console) however my issue really is I don't know or can't use plugins without the Native hook and this plugin does not have one, at least not atm.

torsorensen commented 4 years ago

By native hook, you mean the @ionic-native/xxxxxx integration? I'm pretty sure you can just use the one you mentioned, as this lib is more or less identical in terms of functionality to the one by arnesson.

JoseGeorges8 commented 4 years ago

No, that is why I came here. After the google versioning break and having to switch to this fork, that native integration does not work. It gives me undefined for methods like getToken() :/

Edit: yes. That is the kind of integration I'm talking about

torsorensen commented 4 years ago

I have a project with this setup. Works.

Package.json:

dependencies: "@ionic-native/firebase": "4.20.0", "cordova-plugin-firebase-lib": "5.1.1", "cordova-ios": "5.0.1", "cordova-android": "8.0.0",

cordova.plugins: "cordova-plugin-androidx": {}, "cordova-plugin-androidx-adapter": {}

App.module.ts

import { Firebase } from '@ionic-native/firebase';
 ...
providers: [
        Firebase,

App.component.ts

import { Firebase } from '@ionic-native/firebase';
...
 private firebase: Firebase,
...
this.platform.ready().then(() => {
   this.firebase.getToken().then((token)=> {
           //do stuff w token
    });
 });
JoseGeorges8 commented 4 years ago

is this an ionic 3 project?

mine's ionic 4 and for that the import becomes import {Firebase} from '@ionic-native/firebase/ngx';

also, my ionic-native/firebase version is ^5.2.0

torsorensen commented 4 years ago

Ahh i see. Yea, this is an ionic 3 project. I don't have any practical exp with ionic 4 yet, but is it possible to use an older version of the ionic-native lib?

Something like npm install --save ionic-native/firebase@4

rolinger commented 4 years ago

Here's my environment: ionic v1 cordova-cli v8.0.0 cordova-android v8.0.0

I do not use the ionic wrapper in my project, at least not while still using Ionic v1 (v1.7.14)

I found two methods to get the different forks of firebase to work:

Step 1:

cordova platforms remove android
cordova plugin remove cordova-plugin-firebase / cordova-plugin-firebase-lib
- I get lots of errors removing platforms and plugins so I must manually edit the config.xml and package.json files to remove all references to platforms and plugins I was trying to remove.

Method 1:

cordova plugin add cordova-plugin-firebasex 
     * dpa99c - Dave Allen's fork
     * also installs cordova-plugin-cocoapod-supportx as dependency
cordova plugin add cordova-plugin-androidx 
cordova plugin add cordova-plugin-androidx-apdater
cordova platform add cordova-android@8.0.0

Method 2:

cordova plugin add cordova-plugin-firebasex-lib@4.1.0 --save 
     * for cordova-cli 8.0.0 & cordova-android 8.0.0
     * **check docs for other versioning**
cordova plugin add cordova-plugin-androidx 
cordova plugin add cordova-plugin-androidx-apdater
cordova platform add cordova-android@8.0.0

I am going with Method #2 based on comments about continued support for these forked plugins - at the moment @dpa99c Dave Allens fork will work, but he indicates he won't be maintaining it.

JoseGeorges8 commented 4 years ago

I just tried that and no success. It'll throw this error which then with the guy's fix compiles the project but it gives me a Uncaught TypeError: Object(...) is not a function inside the native integration of the firebase plugin.

edit: replying to @torsorensen