Comments (3)
Hi @rubengarciam.
Custom user data is a useful feature but it has some limitations. On the Atlas side, it's a collection where each document is linked to a specific user. When a user authenticates in the frontend, the app gets a copy of the document as part of their user token. The frontend copy is read-only, and only gets updated to reflect Atlas when you re-login or after a period of time (30 minutes if I recall).
In O-FISH, the users are registered and setup by an administrator using a web app – so there's no need for the frontend app to modify the user data. That made custom data a good fit.
In RChat, the users register and setup their profile data in the frontend and so the read-only custom data option wouldn't work.
from rchat.
Hi @rubengarciam – that's a good question.
I've another Realm app that I think includes the behavior that you're looking for.
The top-level view checks if the user is already logged in, and if they are it continues as that user:
if settings.realmUser == nil && app.currentUser()?.state == .loggedIn {
print("Using same user as when last running the app")
settings.realmUser = app.currentUser()
}
It also uses face-id to store and retrieve the credentials in the keychain – see the app's LoginView:
...
if let error = self.keychain.addCredentials(Credentials(username: username, password: password)) as? KeychainError {
print(error.localizedDescription)
}
...
private func getStoredCredentials() {
let data = keychain.readCredentials()
if let credentials = data.credentials {
self.login(username: credentials.username, password: credentials.password)
}
if let error = data.error as? KeychainError {
self.errorMessage = error.localizedDescription
}
}
I hope this helps!
If you want to followup further, it would be great if you could create a topic on https://developer.mongodb.com/community/forums/c/realm/9 as it will get more eyeballs there – including from the SDK developers. Just tag me (@Andrew_Morgan
) and add a link to your new topic to this issue.
from rchat.
Thanks @am-MongoDB for sharing! After having a look at them I think that both have different data models and that raises some additional questions on my head, like why you are user a custom User object in RChat
vs Realm.User
in o-fish-ios
? The former seems somewhat cleaner in my eyes, even though AppState
and Settings
serve a similar purpose.
Might be my lack of knowledge in the matter though. Happy to do some further reading if you can point me in the right direction.
I will create the topic in the community forum anyway.
from rchat.
Related Issues (11)
- Unable to save data after login HOT 13
- Query: Adding a default conversation HOT 2
- Tutorial? HOT 5
- Unable to build due to LoginView.swift HOT 1
- Chat integration with task app HOT 1
- ios 14 issue for newest commit HOT 2
- slow loading times when accessing bigger chats HOT 1
- Blank screen on registering a new user but okay on first Login HOT 3
- The flex-sync branch has no podfile to install HOT 1
- Suggestion HOT 1
Recommend Projects
-
React
A declarative, efficient, and flexible JavaScript library for building user interfaces.
-
Vue.js
🖖 Vue.js is a progressive, incrementally-adoptable JavaScript framework for building UI on the web.
-
Typescript
TypeScript is a superset of JavaScript that compiles to clean JavaScript output.
-
TensorFlow
An Open Source Machine Learning Framework for Everyone
-
Django
The Web framework for perfectionists with deadlines.
-
Laravel
A PHP framework for web artisans
-
D3
Bring data to life with SVG, Canvas and HTML. 📊📈🎉
-
Recommend Topics
-
javascript
JavaScript (JS) is a lightweight interpreted programming language with first-class functions.
-
web
Some thing interesting about web. New door for the world.
-
server
A server is a program made to process requests and deliver data to clients.
-
Machine learning
Machine learning is a way of modeling and interpreting data that allows a piece of software to respond intelligently.
-
Visualization
Some thing interesting about visualization, use data art
-
Game
Some thing interesting about game, make everyone happy.
Recommend Org
-
Facebook
We are working to build community through open source technology. NB: members must have two-factor auth.
-
Microsoft
Open source projects and samples from Microsoft.
-
Google
Google ❤️ Open Source for everyone.
-
Alibaba
Alibaba Open Source for everyone
-
D3
Data-Driven Documents codes.
-
Tencent
China tencent open source team.
from rchat.