-
Notifications
You must be signed in to change notification settings - Fork 53
Conversation
1566ff5
to
77e60bc
Compare
@npomfret Can you try to run the sample project on android and ios to see if it works on your setup?There's a link to the instructions to the sample project readme above. |
77e60bc
to
7034d17
Compare
This is what the usage & documentation section of the README would then look like https://github.com/couchbaselabs/react-native-couchbase-lite/tree/feature/swagger#usage It's much easier to maintain but we need to make sure it doesn't make it harder. |
- add swagger-client and spec - update readme - update .gitignore - update ReactNativeCouchbaseLiteExample for iOS and Android
7034d17
to
0a53169
Compare
I'm getting 401s back. I can't see where the auth stuff is done? (Also, I made a couple of minor changes - hope that's ok) |
Thanks for the additional commits! About the auth stuff, the username/password gets passed to the manager on this line. However, as you pointed out it still returns a |
For some reason auth works fine when I tested it just now. Did you run it on simulator or device? What iOS version? |
9a352b5
to
0006153
Compare
0006153
to
8ddc435
Compare
@npomfret I updated the example proj and readme. Added a method to use a pre-built database in the process. With regards to the API, the
I think we could combine those into one. Then it would look like: const Couchbase = require('react-native-couchbase-lite');
// Native module method
Couchbase.installPrebuiltDatabase("todo");
// HTTP client
Couchbase.initRESTClient(manager => {
// Send HTTP requests...
manager.get_all_dbs()
.then(res => {
// Process response
});
}); |
Weird, I don't understand what this error is about. Did you follow the steps in https://github.com/couchbaselabs/react-native-couchbase-lite/tree/feature/swagger/ReactNativeCouchbaseLiteExample#getting-started? Oh yes I overwrote your changes by mistake when copying my changes from the example project to |
Don't worry about my changes, I can do them again easily enough. Can't see what I've done wrong but will give it another go. |
Ok thanks. It'd be great if you could try on android too. |
ok, got it working on iOS. Android is failing, getting a 401 from the |
I see the same error on Android, we have to pass the credentials in the Authorization header instead of inlined (like we do currently). Let me take a look. Replacing this line with |
Can you try running it on android again? You'll have to run I haven't figured out why a URL of type |
Enhancement idea: it would be nice to check in the init method if there is already a listener running so we don't restart a listener on every reload. |
Arf, I don't think it's that easy to determine if the listener is already running because the ObjC/Java also gets reloaded (I was hoping to have a |
ok, cool. it's working on android, but without images as you mentioned. Once this facebook/react-native#7791 (comment) get's added to RN they should start working. In the mean time, I added a work around into the android API. If you use null/null for the credentials it turns off authentication and also binds the listener to localhost only as a security precaution to prevent off-device access (so I think it works in a similar way to the iOS native listener). Can we merge it? Here's a brain dump of things we could add - sorry its a bit unstructured. And not sure if any of this would prevent a release.
|
Sure, I think it's mergeable now. I'll create separate tickets off of your feedback. Thanks! |
FOR REVIEW ONLY - DO NOT MERGE (WIP)
Example project instructions: https://github.com/couchbaselabs/react-native-couchbase-lite/tree/feature/swagger/ReactNativeCouchbaseLiteExample#getting-started-tested-on-ios-only
Todos:
Optional: