hansemannn / titanium-firebase-core

Use the Firebase Core SDK in the Titanium SDK 🚀
Other
31 stars 23 forks source link

Default config file path set as absolute #33

Closed cr0ybot closed 5 years ago

cr0ybot commented 5 years ago

The KrollProxy.resolveUrl() method "Resolves the passed in scheme / path, and uses the Proxy's creationUrl if the path is relative." Setting the default filename to an absolute path will search for the file in the root of Resources/ (app/assets/android/) instead of a firebase.core/ subfolder.

Should resolve issue #32.

hansemannn commented 5 years ago

Do you use SDK 8? I noticed this on that version as well and could not reproduce it on SDK 7.x. @jquick-axway, was there a change regarding file handling in SDK 8?

I am happy to merge this, but it may break SDK 7.x then.

cr0ybot commented 5 years ago

I am using SDK 8 right now, but v2.3.0 works without issue. Was the 3.0.0 module built using 8?

jquick-axway commented 5 years ago

Titanium 7.5.0 fixed several path handling bugs on Android. See... https://github.com/appcelerator/titanium_mobile/pull/10304

So, I'm guessing this module was depending on broken behavior? If the config file is always in root "assets/Resources" directory, then using an absolute path /google-services.json is the correct solution.

Currently, Android and iOS handle relative paths differently. On iOS, paths are always relative to the "Resources" directory. On Android, paths are always relative to the currently executing JS file (like node.js).

iOS works the way a native app developers expects. Android works the way a web developer expects. Neither way is technically wrong, but it is a parity issue that the team hasn't settled on yet.

hansemannn commented 5 years ago

If I remember correctly, iOS handles both relative anr absolute, using fallbacks. At least for images, this works good. Lets use absolute paths then

hansemannn commented 5 years ago

I just pushed a fix that also fixes this for existing file arguments, so those are migrated as well. Thanks for the @cr0ybot in any case! 3.0.1 has just been released.