TeamMaestro / angular-native-seed

Build web apps and NativeScript applications from one codebase using the AngularCLI.
265 stars 71 forks source link

How To: Integrate Firebase for Web & Native #10

Open sean-perkins opened 7 years ago

sean-perkins commented 7 years ago

Demonstrate how to integrate Firebase for both Web and NativeScript.

JaserAkuly commented 7 years ago

@sean-perkins do you think we could use OpaqueToken to put this together? I have been researching a lot about this and the problem I have come across is that there is a UI difference between the Web and Nativescript codebase. Along with the UI, both of the plugins have different API touchpoints so that also requires us to have a different function, rather than sharing that, so I.E. updating a user profile, on the web we would just call firebase.push function and pass in that data. If I am correct, using the Nativescript Firebase plugin its different function, so how could we align that? Please correct me if I am wrong or I am not visible to a completely different issue at hand. These are just some thoughts I have collected together during the research.

sean-perkins commented 7 years ago

@JaserAkuly the implementation strategy that I was envisioning was:

Then in each service, amend the call signatures around the interface. Slurp in the module/service into your feature modules and utilize a common service between your web/native code.

In this strategy, I would most likely have the NativeScript service extend the call signatures of the web service. The reason why is the web project is maintained and determined by Google; the NativeScript plugin is an opinionated implementation, while encompassing the native Pods/Libraries; there could be still naming schema differences and/or functional differences.

Pros of implementation:

Cons of implementation:

Although the con also currently exists with the NativeScript plugin anyways.

I've tested this implementation strategy within our own NS + NGX app, with web cookies/sessions and NativeScript's app settings. It's a flawless implementation that provides a cohesive service to maintain both.

The goal of this task would most likely be creating another library that accomplishes what is mentioned above, as it doesn't make sense for each user to have to maintain their own versions of this.

chrishaff commented 6 years ago

Did this stall or is it in another repo somewhere?