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

How to retrieve user(s) details using getUserBy* and getUsersBy* ? #21

Closed
vaima75 opened this issue Aug 17, 2020 · 9 comments
Closed

How to retrieve user(s) details using getUserBy* and getUsersBy* ? #21

vaima75 opened this issue Aug 17, 2020 · 9 comments

Comments

@vaima75
Copy link

vaima75 commented Aug 17, 2020

Specify the sample to which the issue belongs (use [x]):
[ x] P2P Call sample

Platform (use [x])
[x ] Android
[x ] iOS

I referred ur documentation on getUserBy* and getUsersBy* to retrieve user details for CCApp. But failed to retrieve values from it as it creates Future instances while I require CubeUser Instances from these methods.
Ur demo app works fine when static CubeUser List is called and not from the CCApp Database on realtime bases.

@TatankaConCube
Copy link
Contributor

hello @vaima75, for resolving your issue just provide access on retrieving users via API. For it go to your admin panel by path Admin panel -> Your app -> Users -> Setting and in the section 'PRIVACY AND SAFETY' tick needed checkboxes.

@vaima75
Copy link
Author

vaima75 commented Aug 20, 2020

Hi @TatankaConCube, I've enabled both of them but my issue isn't with the system but to convert Future CubeUser instances while I require CubeUser Instances from getUserBy* and getUsersBy* methods using createSession() [which itself is future instance].

@vaima75
Copy link
Author

vaima75 commented Aug 20, 2020

In your demo, you are using "configs.dart" which has alias records from demo app database. For this app to work properly, I've to add user records in my app database and create an alias record [list user = [ CubeUser(), CubeUser(), .... ]] in "configs.dart". This file is used to create sessions to perform certain operations. My query is "how to get user data dynamically and perform those operations?". Every time I try to implement get* methods or when I create a session (app session not user) I don't know how to use that session to fetch user data as it shows 401 error.

@vaima75
Copy link
Author

vaima75 commented Aug 20, 2020

If possible, kindly provide implementation sample for reference.

@TatankaConCube
Copy link
Contributor

here is a simple example, how to create an empty session, then get the user by login, then create a session with this got user:

createSession().then((value) {
    return getUserByLogin("marvin188").then((userFromServer) {
        userFromServer.password = "supersecurepwd";
        return createSession(user).then((session) {
            log(value.toString());
        });
    }).catchError((error) {
        log(error.toString());
   });
});

Now we are developing a simple Chat sample and it will contain sign up logic for using chat options.

@vaima75
Copy link
Author

vaima75 commented Aug 20, 2020

Hi @TatankaConCube, thanks for sharing the sample. I'm able to get the CubeUser and list of CubeUsers with get* methods. One small favor, how to display such values on Widget or access them through a variable. I tried one sample here

'vcinfo.dart'

var name;
void foo(){
  createSession().then((value) {
    return getUsersByTags({'Doc'}).then((userFromServer) {
      name = userFromServer;
    }).catchError((error) {
      log(error.toString());
    });
  });
}

Accessing the variable in main.dart

import 'vcinfo.dart' as vcinfo;

  @override
  void initState() {
    super.initState();
    init(
      vcinfo.appId,
      vcinfo.authKey,
      vcinfo.authSecret,
    );
    vcinfo.foo();
  }
......
    return Scaffold(
      appBar: AppBar(
        title: Text(widget.title),
      ),
      body: Center(
        child: Column(
          mainAxisAlignment: MainAxisAlignment.center,
          children: <Widget>[
            **Text(vcinfo.name),**
            Text(
              'You have pushed the button this many times:',
            ),

I tried the same with Id and Login get methods but the return value is null.

@vaima75
Copy link
Author

vaima75 commented Aug 22, 2020

Is it Holiday going!!!

@TatankaConCube
Copy link
Contributor

sorry @vaima75, but your latest questions not related to ConnectyCube API or SDK. Please search how to add items to flutter widgets on Flutter cookbook or other sources.

@TatankaConCube
Copy link
Contributor

@vaima75 happy to inform you, today we released our realization of a simple example of a Chatting app which demonstrates, how to use ConnectyCube Flutter SDK for the implementation chat functionality in your app.

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

No branches or pull requests

2 participants