couchbaselabs / ToDoLite-iOS

To-Do list sample app for Couchbase Lite, native iOS version
85 stars 41 forks source link

Seeing <null> user when disabling WIFI #76

Closed sethrosetter closed 8 years ago

sethrosetter commented 8 years ago

Using 1.3.0 Android SQLite and 1.3.0 iOS

{
  "name": null,
  "type": "profile",
  "user_id": "102664883425143",
  "_rev": "1-b3acf652f7d8902617127a480a62da1e",
  "_id": "p:102664883425143"
}
pasin commented 8 years ago

It turns out this is not the issue. What happened during the test was:

  1. Started ToDoLite Android with ForestDB from Android Studio. Logged in with Facebook and use the app.
  2. Closed the app from Android Studio. Change Storage Engine in Application.java to use SQLite.
  3. In build.gradle, commented out the dependency to couchbase-lite-android-forestdb.
  4. Rerun the app WITHOUT uninstalling the app (so facebook token still exists).
  5. When reran the app, the app did auto-login with the existing facebook token. As the token was still valid, the login process will not ask for the user's name from the facebook so the user's name will be null. Also we could assume that the user profile document should have already been created from the previous login.
  6. When the database was first open, as there was no forestdb library linked to the app, the upgrading from ForestDB -> SQLite (which should throw exception) process was skipped. Hence the new database with SQLite storage is newly created. Then the new user profile was recreated with null user's name.
pasin commented 8 years ago

ToDoLite-Android can prevent this scenario by always checking if the user profile document exists or not, if not, it will need to request to facebook to get the user's name.

As of now, we can close this issue as no issue.