Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Cross platform error codes #106

Merged
merged 318 commits into from
Dec 28, 2016
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
Show all changes
318 commits
Select commit Hold shift + click to select a range
b740f4e
Removed mention of .config()
dvassilev Sep 4, 2016
da8e2a9
updated Android side
auser Sep 4, 2016
bfc4f75
Merge branch 'master' into readme
auser Sep 4, 2016
6cb63cc
Added es6-symbol polyfill
auser Sep 4, 2016
e7ac3ae
Hardcode values and really merge bundle plist (if included)
auser Sep 4, 2016
e404fa4
Updated pods
auser Sep 4, 2016
7c593fa
Added StorageRef to track download urls on iOS
auser Sep 4, 2016
72d3f1a
Completed downloadUrl for ios/android
auser Sep 4, 2016
f878bf3
Removed duplicated Firestack linking
auser Sep 6, 2016
51dc8b6
Initial checkin for presence
auser Sep 6, 2016
df82209
Updated README for storage
auser Sep 6, 2016
38a2287
Merge branch 'master' into feature/presence
auser Sep 6, 2016
778a005
Updated presence with README
auser Sep 6, 2016
a20bf67
Updated readme
auser Sep 6, 2016
a2e587e
Updated readme
auser Sep 6, 2016
77bac60
Minor updates to README
auser Sep 6, 2016
fa3c723
Update README.md
auser Sep 7, 2016
07aaee7
Update README.md
auser Sep 7, 2016
d39d1f4
Facebook login fix android
Sep 10, 2016
7e89ddf
Fix listenForAuth using incorrect base class methods
Sep 10, 2016
48462e3
Name and photoUrl in userCallback
Sep 10, 2016
25f74e7
java error fix anroid
Sep 10, 2016
05ede56
Merge pull request #24 from devshackio/master
auser Sep 10, 2016
70f68f2
Merge pull request #23 from saleeh93/master
auser Sep 10, 2016
55fc526
2.2.2
auser Sep 10, 2016
c3c49f0
Added key() method to database ref/DatabaseRef parent class
auser Sep 11, 2016
f6e6d22
Fixed upload progress bug on iOS so percentage complete is now a float
auser Sep 11, 2016
502cf35
2.2.3
auser Sep 11, 2016
7acb21d
Fixed orderBy keys on iOS
auser Sep 12, 2016
ac60127
Initial test setup
auser Sep 12, 2016
8394be0
Added enablePersistence methods in Database and databaseRef
auser Sep 12, 2016
91e2b4e
Documented Offline methods
auser Sep 12, 2016
5cc41b3
Update README.md
auser Sep 13, 2016
5bed61f
Bug fix while accessing direct values
Sep 13, 2016
291f6a2
Merge pull request #29 from saleeh93/master
auser Sep 13, 2016
1108901
add cloud messaging for android
advans Sep 14, 2016
8e0cd5b
Updated messaging for ios side
auser Sep 14, 2016
78b5ae9
Added messaging native client for iOS stubs
auser Sep 14, 2016
f75ecd9
Calling callback with send (WIP)
auser Sep 14, 2016
bd78b4d
Added singleton test
auser Sep 14, 2016
1683c44
Removed debugging comments
auser Sep 14, 2016
5d249ec
Added test-helper
auser Sep 14, 2016
71ff240
Updated singleton test
auser Sep 15, 2016
5fcaf80
Ignore .idea
auser Sep 15, 2016
0fcbadd
Merge branch 'master' into feature/messaging
auser Sep 15, 2016
f1bea9a
WIP: Android not triggering callbacks
auser Sep 15, 2016
585d188
Fixed android database bug
auser Sep 15, 2016
6d408cd
Fixed db bug
auser Sep 15, 2016
710d5ad
WIP: Messaging
auser Sep 16, 2016
5683916
Added blocking whenReady to Base to ensure app is configured before s…
auser Sep 16, 2016
d737b36
Updates to ordering of loading
auser Sep 17, 2016
c9ca92c
Updated README.md with latest config status update
auser Sep 17, 2016
d51fca6
WIP: firestack reloading
auser Sep 17, 2016
a1bcd22
Removed GoogleParsingUtilities
auser Sep 18, 2016
6aceb3b
Updated presence api
auser Sep 18, 2016
18946d1
Fixed datasbase ios off event
auser Sep 18, 2016
bc8793b
Removed AppDelegate for the time being and export a module
auser Sep 21, 2016
5958b8c
Upgraded firebase to 9.6
auser Sep 23, 2016
9ff9537
Correct setStorage docs since the method does not return a Promise an…
yn5 Sep 23, 2016
48c59b4
Correct uploadFile synthax in docs
yn5 Sep 23, 2016
d91ce73
Merge pull request #37 from puhastudio/docs-setstorage
auser Sep 23, 2016
8552fec
Merge pull request #36 from puhastudio/docs-uploadfile
auser Sep 23, 2016
7fb58aa
Dont log out the entire snapshot on debug command
auser Sep 23, 2016
a1d5b8b
Added Pods moduleMap
auser Sep 23, 2016
98832e2
Merge branch 'master' of github.com:fullstackreact/react-native-fires…
auser Sep 23, 2016
4df52ff
Some quick build fixes for ios10
slycoder Sep 24, 2016
b1962d5
Merge pull request #38 from slycoder/notifications-ios10
auser Sep 26, 2016
8de746b
Update README.md
auser Sep 26, 2016
4c32e46
Added serialization for values in database.js
auser Sep 26, 2016
c3b1ed6
Case insensitive search in Auth (ios)
auser Sep 26, 2016
d573cc6
Update README.md
auser Sep 28, 2016
6ef8510
Fix startAt, endAt, equalTo optional 2nd params on Android
BlooJeans Sep 29, 2016
c425444
Changed the setStorageUrl description
Sep 29, 2016
da0a9f8
Merge pull request #46 from devshackio/master
auser Sep 30, 2016
40c868a
Removed cocoapods
auser Sep 30, 2016
8a7fa3c
Updated with client-side pods
auser Sep 30, 2016
a804228
Updates to package, link commands
auser Sep 30, 2016
d7ef632
Merge branch 'master' of github.com:fullstackreact/react-native-fires…
auser Sep 30, 2016
61915bd
WIP: update script
auser Sep 30, 2016
a236df7
Merge pull request #47 from blumanski/master
auser Sep 30, 2016
6a9a8a5
Fixed bug with login with Provider iOS
auser Sep 30, 2016
af25ede
Merge branch 'master' of github.com:fullstackreact/react-native-fires…
auser Sep 30, 2016
af26bde
Update README for new cocoapod description
auser Sep 30, 2016
d6fc9e8
Added config options back in
auser Sep 30, 2016
a941c3d
Removed Firebase module loading in FirebaseAuth.m
auser Sep 30, 2016
f86cf29
Updates for Android (configureWithOptions without firebase setup thro…
auser Oct 1, 2016
c43f96a
Updates for ignore
auser Oct 3, 2016
212f35c
2.2.4
auser Oct 3, 2016
b1726b2
Removed plugin
auser Oct 3, 2016
6203729
2.2.5
auser Oct 3, 2016
bf0c351
Removed prepublish script
auser Oct 3, 2016
35e2ea1
Removed prepublish script
auser Oct 3, 2016
07e193a
2.2.6
auser Oct 3, 2016
4a97bde
2.3.0
auser Oct 3, 2016
dc4b7af
Fix startAt, endAt, equalTo optional 2nd param for Android getDatabas…
BlooJeans Oct 4, 2016
2cfde4a
Merge pull request #48 from devshackio/master
auser Oct 4, 2016
d7f98e4
[Anonymous signin]: Adding anonymously signin on android and IOS fire…
Oct 3, 2016
7733c53
Fix Android Storage, allow config via .json file
BlooJeans Oct 7, 2016
539f385
Update README to include info about google-services.json
BlooJeans Oct 7, 2016
7434da2
Bugfix in configuration using google-services.json
BlooJeans Oct 7, 2016
4af0b53
Remove firebase includes
auser Oct 7, 2016
efdf7fe
Correctly send database_error event
chrisbianca Oct 10, 2016
d6d78fe
Merge pull request #58 from chrisbianca/master
auser Oct 10, 2016
6ef97b8
Support asset-library / camera roll URLs
chrisbianca Oct 10, 2016
167d179
Merge pull request #60 from chrisbianca/master
auser Oct 11, 2016
3dfd285
Merge branch 'master' into anonymous
auser Oct 11, 2016
03ca40b
Change asset upload to use data rather than file
chrisbianca Oct 11, 2016
03b19fd
Implement downloads for iOS
alanhoff Oct 10, 2016
c08b207
Allow modular headers to be included
alanhoff Oct 11, 2016
e754101
Merge pull request #67 from estate/fix/modular-headers
auser Oct 11, 2016
65a2ab5
2.3.1
auser Oct 13, 2016
bb57110
Merge remote-tracking branch 'origin/master' into android-configure-v…
BlooJeans Oct 14, 2016
2276e78
Merge branch 'master' of github.com:fullstackreact/react-native-fires…
auser Oct 15, 2016
9c0c728
Merge pull request #56 from devshackio/android-configure-via-json
auser Oct 15, 2016
fa3c504
Merge branch 'master' of github.com:fullstackreact/react-native-fires…
auser Oct 15, 2016
58e7338
Merge pull request #66 from chrisbianca/master
auser Oct 15, 2016
fbadeda
Merge branch 'master' of github.com:fullstackreact/react-native-fires…
auser Oct 15, 2016
f1e6ff4
Fixeds #62
auser Oct 16, 2016
a2cd599
Merge branch 'master' into anonymous
auser Oct 16, 2016
0303860
Fixed anonymously login on iOS
auser Oct 16, 2016
cd7d421
WIP: download test
auser Oct 16, 2016
7968560
Fixed createUserWithEmail local error
auser Oct 16, 2016
7fc4471
Removed modules from FirestackAnalytics
auser Oct 17, 2016
33057ab
2.3.2
auser Oct 17, 2016
843a6d5
Allow removal of specific callbacks from query listeners
Oct 17, 2016
6a9bf2d
Update Android status
mikelambert Oct 19, 2016
7a8c458
Merge pull request #77 from mikelambert/patch-1
auser Oct 19, 2016
04174af
Update README.md
mikesurowiec Oct 19, 2016
181b8b5
Merge pull request #73 from devshackio/master
auser Oct 19, 2016
de8e5eb
Cast firebase long's to doubles
BlooJeans Oct 20, 2016
887be01
Implement android ServerValue.TIMESTAMP
BlooJeans Oct 20, 2016
a18eb93
Fixed provider google on Android (was missing)
neacsugeorge Oct 20, 2016
df340f1
Merge pull request #80 from neacsugeorge/master
auser Oct 21, 2016
c5092b9
Merge pull request #79 from devshackio/android-fixes
auser Oct 21, 2016
e7a9c8f
Added protection around user on android to ensure it is not null on a…
auser Oct 21, 2016
226bce3
Merge branch 'master' of github.com:fullstackreact/react-native-fires…
auser Oct 21, 2016
b545267
Updates
auser Oct 21, 2016
7914402
added instructions for running on the master branch
auser Oct 21, 2016
b45513d
Formatting updates for README
auser Oct 21, 2016
b451a4c
fixing NPE after Database#off
pedro-ribeiro Oct 25, 2016
9a12d5d
Adding missing user info mapping to getUserMap
pedro-ribeiro Oct 26, 2016
aeb9adc
Updated README with removing build phases (no longer necessary)
auser Oct 26, 2016
90ccb35
Updates to Podfile to include use_frameworks
auser Oct 26, 2016
07aecfb
Merge pull request #85 from pedro-ribeiro/user_mapping
auser Oct 26, 2016
c6c84a8
Updated README installation instructions
auser Oct 26, 2016
418b2c0
Merge branch 'master' of github.com:fullstackreact/react-native-fires…
auser Oct 26, 2016
2c88075
Merge pull request #84 from pedro-ribeiro/fix_database_off
auser Oct 26, 2016
6c2230b
Merge branch 'master' of github.com:fullstackreact/react-native-fires…
auser Oct 26, 2016
423e733
Merge branch 'master' into download
auser Oct 26, 2016
d74e5f1
Updates to include downloading (closes #61)
auser Oct 26, 2016
5ddbd66
Add instruction to update pods to README
yn5 Oct 26, 2016
63b93b4
Merge pull request #88 from puhastudio/docs-updatepods
auser Oct 27, 2016
331f06c
Updates to README and storage
auser Oct 27, 2016
50205af
Merge branch 'master' of github.com:fullstackreact/react-native-fires…
auser Oct 27, 2016
1efb5ba
Stop passing getApplicationContext() in to the constructor. It's not …
mikelambert Oct 27, 2016
beb99cb
Merge pull request #89 from mikelambert/master
auser Oct 27, 2016
d6dc2e6
Updated contributing guide
auser Oct 27, 2016
48e2fcc
Fix passedUser not being used, make it more clear what user is being …
BlooJeans Oct 27, 2016
c5faea9
Prevent race condition with listenForAuth
chrisbianca Oct 28, 2016
e7a8662
Android: fix userMap not being used in userCallback & anonymousUserCa…
BlooJeans Oct 28, 2016
18c94aa
Fixed setPersistence always enabled
chaitanya-bhagavan Oct 30, 2016
7229109
Merge pull request #94 from chrisbianca/master
auser Oct 30, 2016
3c9ce62
Added getRealPathFromURI
auser Oct 31, 2016
583272c
Merge pull request #99 from chaitanya0bhagvan/master
auser Oct 31, 2016
400d7ee
Merge branch 'master' of github.com:fullstackreact/react-native-fires…
auser Oct 31, 2016
899d3c0
Fix enablePersistence should be called before any access to FIRDatabase
chaitanya-bhagavan Oct 31, 2016
045154b
Fix Default app has already been configured
chaitanya-bhagavan Oct 31, 2016
7b3277c
Merge pull request #101 from chaitanya0bhagvan/master
auser Nov 1, 2016
52caf2b
Merge remote-tracking branch 'origin/master' into fix-auth-user
BlooJeans Nov 1, 2016
54a564c
Upgrade google play services and firebase to 9.8.0
BlooJeans Nov 1, 2016
5105ba0
Fixed typo in Storage
auser Nov 1, 2016
aa5e163
Merge branch 'master' of github.com:fullstackreact/react-native-fires…
auser Nov 1, 2016
2bd1545
Add the ranking best practice strategy
Nov 1, 2016
f484cbd
Android: Fix .on() listeners not getting removed / called immediately…
BlooJeans Nov 1, 2016
7c8c0b9
Fix listeners getting called when it's not their turn
BlooJeans Nov 2, 2016
a33cdb5
Merge pull request #104 from jsappme/patch-1
auser Nov 2, 2016
3ef3ce7
2.3.3
auser Nov 3, 2016
c83ccfb
Added childKeys, forEach, map, reverseMap to firebase database snapsh…
auser Nov 3, 2016
c82d9be
Merge branch 'master' of github.com:fullstackreact/react-native-fires…
auser Nov 3, 2016
9c3130c
Merge remote-tracking branch 'origin/master' into fix-android-listeners
BlooJeans Nov 3, 2016
28fdcd0
Fix Java Database Listeners
BlooJeans Nov 3, 2016
3998293
Remove auth methods from instance root & update documentation
Ehesp Nov 4, 2016
eeeacc9
Cleanup listeners and add a little bit of documentation
BlooJeans Nov 4, 2016
49ff5dd
Merge pull request #107 from Ehesp/master
auser Nov 4, 2016
9a05b23
Merge pull request #95 from devshackio/fix-auth-user
auser Nov 4, 2016
4e18f7e
Added url back into firestack storage android
auser Nov 4, 2016
9bb5e5d
Merge branch 'master' of github.com:fullstackreact/react-native-fires…
auser Nov 4, 2016
6713c7e
Change getBinder to get bundle
Sh3rawi Nov 6, 2016
04e369f
Merge pull request #111 from Sh3rawi/fix_getBinder
auser Nov 6, 2016
ed409a2
Implement reauthenticateWithCredentialForProvider for Android
ghuh Nov 8, 2016
972b16d
Catch exception thrown by setPersistenceEnabled which was causing the…
chaitanya-bhagavan Nov 8, 2016
a4a115f
Parity in response format between ios and android
chaitanya-bhagavan Nov 8, 2016
483e15f
Fixed a typo that was causing an error
chaitanya-bhagavan Nov 8, 2016
a85f5fa
Parity in response format between ios and android
chaitanya-bhagavan Nov 9, 2016
e34988b
Reverted changes since it was an error from my end
chaitanya-bhagavan Nov 9, 2016
68396e0
fixing filter value creation
pedro-ribeiro Nov 9, 2016
431f10b
Fix Storage on android
BlooJeans Nov 4, 2016
635f882
Merge pull request #122 from pedro-ribeiro/fixing_equalto
auser Nov 9, 2016
ea5e10c
Merge pull request #119 from chaitanya0bhagvan/master
auser Nov 9, 2016
b55ba69
Merge pull request #117 from ghuh/ghuh-android-reauthenticateWithCred…
auser Nov 9, 2016
c3129fb
Fix Android listenForAuth method to correctly check for user
ghuh Nov 10, 2016
28644a6
WIP: FirebaseAuth
auser Nov 10, 2016
1111617
Added initial handling of android error messages
auser Nov 10, 2016
c811a3a
Merge pull request #124 from ghuh/ghuh-android-listenForAuth
auser Nov 11, 2016
7d09ab4
Parity of response format between ios and android. Added authenticate…
chaitanya-bhagavan Nov 11, 2016
e525569
Remove RCTConvert to work with react-native-fcm
auser Nov 14, 2016
9f9525d
Merge branch 'master' of github.com:fullstackreact/react-native-fires…
auser Nov 14, 2016
ef52467
Merge pull request #126 from chaitanya0bhagvan/master
auser Nov 14, 2016
8306c45
Filter out undefined filters
samer Nov 16, 2016
487ed30
removing trailing comma
pedro-ribeiro Nov 16, 2016
a0a78e5
Merge pull request #137 from pedro-ribeiro/fixing_trailing_comma
auser Nov 16, 2016
da34c79
Merge pull request #136 from samer/filter-fix
auser Nov 16, 2016
6ca78a1
forEach and map method on the DataSnapshot does not retain key
chaitanya-bhagavan Nov 17, 2016
80133de
Fixed error calling length of undefined
chaitanya-bhagavan Nov 17, 2016
0349b61
Merge pull request #139 from chaitanya0bhagvan/master
auser Nov 17, 2016
d005ab2
Use storage url from .plist file if not setStorageUrl() hasn't been c…
janvogt Nov 17, 2016
dfc0bd1
Fix donwloadUrl to use storageUrl from .plist.
janvogt Nov 17, 2016
e214b6d
Merge pull request #143 from janvogt/fix-storage-config
auser Nov 17, 2016
f4bcfea
WIP
auser Nov 18, 2016
29140b6
Merge branch 'master' of github.com:fullstackreact/react-native-fires…
auser Nov 18, 2016
7cb0a08
Don't hard set Android play services version #134
Ehesp Nov 18, 2016
aec484e
fix missing downloadUrl property on ios
Nov 18, 2016
fba26f8
fix missing downloadUrl property on ios
Nov 18, 2016
bbfa974
Analytics parameter variable type fix for quantity, price and value.
Nov 22, 2016
705bd77
Merge pull request #157 from JadoPado/master
auser Nov 22, 2016
64261f1
getToken(true) will try to fetch token from server and fail if offline.
chaitanya-bhagavan Nov 23, 2016
86907d5
Parity of response format
chaitanya-bhagavan Nov 23, 2016
363ff1e
Parity of response format
chaitanya-bhagavan Nov 23, 2016
e8c5db0
Merge pull request #162 from chaitanya0bhagvan/master
auser Nov 24, 2016
6234311
Merge branch 'master' of github.com:fullstackreact/react-native-fires…
auser Nov 25, 2016
03a2c8e
Add `invariant` dependencie
NoelBroda Nov 26, 2016
0f1b49f
Weird typo
auser Nov 26, 2016
17f41c7
Updated with call thread for signInWithProvider
auser Nov 27, 2016
ef4890a
Added Github auth and updated README
auser Nov 27, 2016
ec9bdc6
Merge pull request #166 from NoelBroda/master
auser Nov 28, 2016
49afd2e
2.3.4
auser Dec 1, 2016
dcabc4a
Oops. Fixes #3176
auser Dec 4, 2016
bfa9ed3
Change to Fix breaking window object
chaitanya-bhagavan Dec 5, 2016
f486c93
Merge pull request #179 from chaitanya0bhagvan/patch-1
auser Dec 5, 2016
69f63ca
Readme link to firebase.google.com not firebase.com
yofu1234 Dec 7, 2016
697099b
Merge pull request #180 from yofu1234/patch-1
auser Dec 7, 2016
cf71541
Typo
brianjd Dec 7, 2016
32019d4
Merge pull request #181 from brianjd/foreground-typo-fix
auser Dec 8, 2016
5f74060
Merge pull request #109 from devshackio/fix-storage
auser Dec 8, 2016
919066c
Merge pull request #146 from Ehesp/patch-2
auser Dec 8, 2016
1665947
Added JS syntax highlighting
brianjd Dec 8, 2016
266f9c3
Merge pull request #183 from brianjd/update-readme
auser Dec 13, 2016
5b7de35
Maintain similar response format for getCurrentUser and signInWith*
chaitanya-bhagavan Dec 23, 2016
47cc17e
Remove anonymousUsercallback
chaitanya-bhagavan Dec 23, 2016
03aab39
Merge pull request #197 from chaitanya0bhagvan/master
auser Dec 28, 2016
File filter

Filter by extension

Filter by extension


Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
46 changes: 46 additions & 0 deletions .gitignore
Original file line number Diff line number Diff line change
Expand Up @@ -10,3 +10,49 @@ npm-debug.log
*.xcuserstate
project.xcworkspace/
xcuserdata/

# Android

# Built application files
android/*/build/

# Crashlytics configuations
android/com_crashlytics_export_strings.xml

# Local configuration file (sdk path, etc)
android/local.properties

# Gradle generated files
android/.gradle/

# Signing files
android/.signing/

# User-specific configurations
android/.idea/libraries/
android/.idea/workspace.xml
android/.idea/tasks.xml
android/.idea/.name
android/.idea/compiler.xml
android/.idea/copyright/profiles_settings.xml
android/.idea/encodings.xml
android/.idea/misc.xml
android/.idea/modules.xml
android/.idea/scopes/scope_settings.xml
android/.idea/vcs.xml
android/*.iml

# OS-specific files
.DS_Store
.DS_Store?
._*
.Spotlight-V100
.Trashes
ehthumbs.db
Thumbs.dbandroid/gradle
android/gradlew
android/gradlew.bat
android/gradle/
.idea
.idea
coverage
14 changes: 14 additions & 0 deletions .npmignore
Original file line number Diff line number Diff line change
@@ -0,0 +1,14 @@
*.swp
*~
*.iml
.*.haste_cache.*
.DS_Store
.idea
.babelrc
.eslintrc
npm-debug.log
src/
examples/
public/
scripts/
test/
129 changes: 129 additions & 0 deletions Contributing.md
Original file line number Diff line number Diff line change
@@ -0,0 +1,129 @@
## Contributing guide

This is an in-progress guide to help guide you in understanding how Firestack works with the goal to help on-board your contributions. If you have any questions, comments, or concerns, feel free to leave it here or join the [gitter channel at https://gitter.im/fullstackreact/react-native-firestack](https://gitter.im/fullstackreact/react-native-firestack).

## Contribution methods

Contributing is easy. Make a fork of the project on [github](https://github.com/fullstackreact/react-native-firestack). Clone this repo on your machine and work on the edits there.

```shell
git clone https://github.com/[your_name]/react-native-firestack.git
cd react-native-firestack
npm install
```

We have an [Example app - FirestackApp](https://github.com/fullstackreact/FirestackApp) which we use to demonstrate and test features (until we can get a proper testing environment). Currently, our workflow looks like this:

1. Write JS/native feature
2. `rsync` the local library to your `node_modules` directory (react-native does not play well with symlinks).
For instance, running the following in the firestackApp root directory. Make sure you replace the `~/Development/react-native/mine/react-native-firestack` with the path of your cloned repo on your drive:

```javascript
rsync -avhW --delete \
--exclude='node_modules' \
--exclude='.git' \
--exclude='coverage' \
~/Development/react-native/mine/react-native-firestack/ \
./node_modules/react-native-firestack/
```

3. Test in-app
4. Update README.md with bugfix/feature
5. Create a pull request (PR)

## High level

## How it works technically

Firestack is broken up by functional modules which control/interact with the different features of Firebase. I.e. there is a database module, which maps to the Real-Time Database feature in Firebase, Analytics maps to the Firebase analytics stack.

When the user creates a new instance of Firestack, they are creating an instance of the JS class defined in `lib/firestack.js`.

```javascript
// This creates a JS instance of the
// Firestack class
const firestack = new Firestack({});
```

Each of the modules in Firestack can be accessed through this instance. For instance, when we want to access the real-time database through the `firestack` instance, the JS API exposes a `database` accessor.

For instance, when interacting with the database from the instance above, we would call `.database` to get access to a singleton instance of the JS `Database` class defined in `lib/modules/database.js`.

### Database walk-through

```javascript
const db = firestack.database;
```

The `lib/modules/database.js` file exports two classes, one called `Database` and the other called `DatabaseRef`. Essentially, the `Database` class is a wrapper class that provides a handful of methods to forward off to a `DatabaseRef` instance.

The `DatabaseRef` class defines the actual interaction with the native Firebase SDK. Let's look at the `getAt` method as an example of how the JS side interacts with the native-side and back.

When the user accessess a Firebase ref, the `Database` instance creates a new instance of the `DatabaseRef` JS class.

```javascript
const ref = db.ref('/events');
```

The `DatabaseRef` class is the wrapper that maps to Firebase database points. For efficiency, the `paths` are stored as an array so we can walk up and down the firebase database using the `parent()` and `child()` methods on a database ref.

Calling `getAt()` on the `ref` (an instance of the `DatabaseRef` class) will make a call to the **native** SDK using a method called `promisify()`

```javascript
class DatabaseRef {
// ...
getAt(key) {
let path = this.path;
if (key && typeof(key) == 'string') {
path = `${path}${separator}${key}`
}
return promisify('onOnce', FirestackDatabase)(path);
}
}
```

Ignoring the first few lines (which are helpers to add to the `path`, which we'll look at shortly), the `promisify()` function (defined in `lib/promisify.js`) takes two arguments:

1. The 'string' name of the native function to call
2. The native module we want to call it on

The `promisify()` function returns a function that returns a `Promise` object in JS. This returned function calls the native function with a React-Native callback. When the React Native function calls the callback function, the Promise is resolved.

Getting back to the Database example, the `getAt()` function (which has an alias of `get`) calls the `onOnce` function on the `FirestackDatabase` native module. Each platform has their own native module version for each feature area of Firebase.

Every function on the `DatabaseRef` class is called with the `path` from Firebase as well as it's other options.

Let's look at the `onOnce` function of the iOS version of `FirestackDatabase` implemented in `ios/Firestack/FirestackDatabase.m`:

```
// This might differ from the current code, but
// is implemented this way at the time of the writing
// of this document
RCT_EXPORT_METHOD(onOnce:(NSString *) path
name:(NSString *) name
callback:(RCTResponseSenderBlock) callback)
{
int eventType = [self eventTypeFromName:name];

FIRDatabaseReference *ref = [self getRefAtPath:path];
[ref observeSingleEventOfType:eventType
withBlock:^(FIRDataSnapshot * _Nonnull snapshot) {
callback(@[[NSNull null], [self snapshotToDict:snapshot]]);
}
withCancelBlock:^(NSError * _Nonnull error) {
NSLog(@"Error onDBEventOnce: %@", [error debugDescription]);
callback(@[@{
@"error": @"onceError",
@"msg": [error debugDescription]
}]);
}];
}
```

Every native function (in either iOS or Android) is expected to accept a single callback as the final argument. The `onOnce` function accepts the path (as the first argument) and the name of the event we're interested in (such as `value`) and uses the Native SDK to set up the appropriate functionality. When the function has been called and completed, the callback is called with an error on failure and with success on success.

> An error response is considered one which the first argument is non-null. Therefore, to send a successful response, the first value when calling the callback should be null to indicate success.

## Adding functionality

// TODO
Loading