After many hours of trial and error, I managed to make my first successful API call to send a group message in Flutter. But I am not sure if I am doing things the right way. Unfortunatly the documentation does not help very much. It could be much less and much more informative imho. I would be very glad if someone can answer all of the questions here as the answers will be useful for many Connecty Cube beginners.
Right now the order I make my calls are as follows:
import 'package:connectycube_sdk/connectycube_chat.dart' as cc;
await cc.init(APP_ID, AUTH_KEY, AUTH_SECRET);
cubesession = await cc.createSession(); //create app session
//registeredUser = await cc.signUp(user); //if necessary
myuser = await cc.signInByLogin(userDocId, password);
cubeSession = await cc.createSession(myuser); //upgrade to user session
createdDialog = await cc.createDialog(newDialog); //is this for one time only? I can set the dialogId in the newDialog object but it is overwritten by a random uuid in the console. We should know what we can set and not clearly.
await cc.CubeChatConnection.instance.login(myuser); //login?? bad choice of a method mate. This starts the xmpp 2 way connection I guess.
subscribe and listen to cc.CubeChatConnection.instance.chatMessagesManager.chatMessagesStream
Tell me if above is the right way/order to call API methods.
Also how and in which order to release resources? CubeUser/CubeSession/CubeDialog/chatMessagesStream/CubeChatConnection
How can we set a custom property to a CubeUser? I want to pass my Firebase user doc id
How can we set a custom property to a CubeDialog? I want to pass my Firebase post doc id. I see there is a String name property but I want to use it for its real purpose.
How to join/leave a CubeDialog? (different than adding and removing an occupants) Do we always have to create a dialog? Or do we need to get the dialogs that we are in and somehow leave them?
An occupant should have the ability to leave a dialog without Admin removing them. How do we do this?
Why are the id's integers?
Why is there no void return types on the high level FLutter API?
Param arguments are not clear. They are just Map<String, String> objects so we don't know what key fields to put in them. For instance;
Future<PagedResult<CubeDialog>> getDialogs([Map<String, dynamic> params]) {
return GetDialogsQuery(params).perform();
}
//What keys should I put in params to fully use pagination?