connectycube_sdk 0.1.0-beta5

  • Readme
  • Changelog
  • Example
  • Installing
  • new59

Flutter Getting Started #

ConnectyCube helps you implement real-time chat, video chat, push notifications and user authorization to any app with ease - no server side implementation required.
You can concentrate fully on your mobile app development. Our Flutter SDK provides you with many helpful methods to build the chat and video chat from the client side.

This page presents a quick overview of the SDK’s functionalities and logic, then let you go through the easy steps of implementing ConnectyCube in your own app.

ConnectyCube Flutter SDK can be used on the following OS:

  • Android
  • iOS

Create ConnectyCube app #

Register a FREE ConnectyCube account at https://connectycube.com/signup, then create your 1st app and obtain an app credentials.
These credentials will be used to identify your app.

All users within the same ConnectyCube app can communicate by chat or video chat with each other, across all platforms - iOS, Android, Web, etc.

When building a new app #

If you are just starting your app and developing it from scratch, we recommend to use our Code Samples projects.

Download Code Samples (coming soon)

These code samples are ready-to-go apps with an appropriate functionality and simple enough that even novice developers will be able to understand them.

When integrating SDK into existing app #

If you already have an app, do the following for integration.

Connect SDK #

Navigate to Installing tab to find out detailed guide.

Initialize #

Initialize framework with your ConnectyCube application credentials. You can access your application credentials
in ConnectyCube Dashboard:

String appId = "";
String authKey = "";
String authSecret = "";

init(appId, authKey, authSecret);

Configuration #

An additional configs can be passed via CubeSettings:

CubeSettings.instance.isDebugEnabled = true; // to enable ConnectyCube SDK logs; 
CubeSettings.instance.setEndpoints(customApiEndpoint, customChatEndpoint); // to set custom endpoints

Now integrate messaging & calling capabilities #

Follow the API guides on how to integrate chat and calling features into your app:

SDK Changelog #

The complete SDK changelog is available on ConnectyCube pub.dev page

0.1.0-beta5 #

  • Update documentation link

0.1.0-beta4 #

This is a 1st public release.

The following features are covered:

  • Authentication and Users;
  • Messaging;
  • Address Book;
  • Push Notifications.

0.1.0-beta3 #

  • Add minimal examples.

0.1.0-beta2 #

  • Updates by pub.dev recommendations.

0.1.0-beta1 #

  • Initial release.

example/example.md

Init ConnectyCube SDK #

String appId = "";
String authKey = "";
String authSecret = "";

init(appId, authKey, authSecret);

Create session #

CubeUser user = CubeUser(login: "user_login", password: "super_sequre_password");

createSession(user).then((cubeSession){
  print("Session was created");
}).catchError((error){
  print("Error was occured during create sessin");
});

Login to the chat #

CubeUser user = CubeUser(id: 123456, login: "user_login", password: "super_sequre_password");
    
CubeChatConnection.instance.login(user).then((user){
  print("Success login to the chat");
}).catchError((error){
  print("Error was occured during login to the chat");
});

Dialogs #

All chats between users are organized in dialogs. The are 3 types of dialogs:

  • 1-1 chat - a dialog between 2 users.
  • group chat - a dialog between specified list of users.
  • public group chat - an open dialog. Any user from your app can chat there.
  • broadcast - chat where a message is sent to all users within application at once. All the users from the application are able to join this group. Broadcast dialogs can be created only via Admin panel.

You need to create a new dialog and then use it to chat with other users. You also can obtain a list of your existing dialogs.

Create new dialog #

Create 1-1 chat #

You need to pass type = CubeDialogType.PRIVATE and an id of an opponent you want to create a chat with:

CubeDialog newDialog = CubeDialog(
    CubeDialogType.PRIVATE,
    occupantsIds: [56]);

createDialog(newDialog)
    .then((createdDialog) {})
    .catchError((error) {});

Create group chat #

You need to pass type = CubeDialogType.GROUP and ids of opponents you want to create a chat with:

CubeDialog newDialog = CubeDialog(
    CubeDialogType.GROUP,
    name: "Hawaii relax team",
    description: "Some description",
    occupantsIds: [56, 98, 34],
    photo: "https://some.url/to/avatar.jpeg");

  createDialog(newDialog)
      .then((createdDialog) {})
      .catchError((error) {});

Create public group chat #

It's possible to create a public group chat, so any user from you application can join it. There is no a list with occupants,
this chat is just open for everybody.

You need to pass type = CubeDialogType.PUBLIC and ids of opponents you want to create a chat with:

CubeDialog newDialog = CubeDialog(
    CubeDialogType.PUBLIC,
    name: "Blockchain trends",
    description: "Public dialog Description",
    photo: "https://some.url/to/avatar.jpeg");

createDialog(newDialog)
    .then((createdDialog) {})
    .catchError((error) {});

Send/Receive chat messages #

CubeDialog cubeDialog;  // some dialog, which must contains opponent's id in 'occupantsIds' for CubeDialogType.PRIVATE and
                        // 'dialogId' for other types of dialogs
CubeMessage message = CubeMessage();
message.body = "How are you today?";
message.dateSent = DateTime.now().millisecondsSinceEpoch;
message.markable = true;
message.saveToHistory = true;
      
cubeDialog.sendMessage(message)
    .then((cubeMessage) {})
    .catchError((error) {});

// to listen messages
ChatMessagesManager chatMessagesManager = CubeChatConnection.instance.chatMessagesManager;
chatMessagesManager.chatMessagesStream.listen((newMessage) {
    // new message received
}).onError((error) {
    // error received
});

Use this package as a library

1. Depend on it

Add this to your package's pubspec.yaml file:


dependencies:
  connectycube_sdk: ^0.1.0-beta5

2. Install it

You can install packages from the command line:

with Flutter:


$ flutter pub get

Alternatively, your editor might support flutter pub get. Check the docs for your editor to learn more.

3. Import it

Now in your Dart code, you can use:


import 'package:connectycube_sdk/connectycube_sdk.dart';
  
Popularity:
Describes how popular the package is relative to other packages. [more]
25
Health:
Code health derived from static analysis. [more]
92
Maintenance:
Reflects how tidy and up-to-date the package is. [more]
95
Overall:
Weighted score of the above. [more]
59
Learn more about scoring.

We analyzed this package on Mar 31, 2020, and provided a score, details, and suggestions below. Analysis was completed with status completed using:

  • Dart: 2.7.1
  • pana: 0.13.6
  • Flutter: 1.12.13+hotfix.8

Health issues and suggestions

Document public APIs. (-0.79 points)

1274 out of 1283 API elements have no dartdoc comment.Providing good documentation for libraries, classes, functions, and other API elements improves code readability and helps developers find and use your API.

Fix lib/src/chat/chat_connection_service.dart. (-1.49 points)

Analysis of lib/src/chat/chat_connection_service.dart reported 3 hints:

line 42 col 22: The value of the field '_rosterManager' isn't used.

line 43 col 23: The value of the field '_messageHandler' isn't used.

line 45 col 21: The value of the field '_vCardManager' isn't used.

Fix lib/src/chat/realtime/extentions.dart. (-1.49 points)

Analysis of lib/src/chat/realtime/extentions.dart reported 3 hints:

line 2 col 8: Don't import implementation files from another package.

line 3 col 8: Don't import implementation files from another package.

line 4 col 8: Don't import implementation files from another package.

Fix lib/src/chat/models/cube_error_packet.dart. (-1 points)

Analysis of lib/src/chat/models/cube_error_packet.dart reported 2 hints:

line 1 col 8: Don't import implementation files from another package.

line 2 col 8: Don't import implementation files from another package.

Fix additional 9 files with analysis or formatting issues. (-4 points)

Additional issues in the following files:

  • lib/src/chat/realtime/managers/last_activity_manager.dart (2 hints)
  • lib/src/chat/realtime/utils/async_stanza_sender.dart (2 hints)
  • lib/src/chat/realtime/managers/chat_managers.dart (1 hint)
  • lib/src/chat/realtime/managers/messages-statuses-manager.dart (1 hint)
  • lib/src/chat/realtime/managers/typing_statuses_manager.dart (1 hint)
  • lib/src/core/models/cube_settings.dart (1 hint)
  • lib/connectycube_pushnotifications.dart (Run flutter format to format lib/connectycube_pushnotifications.dart.)
  • lib/src/chat/realtime/managers/messages_manager.dart (Run flutter format to format lib/src/chat/realtime/managers/messages_manager.dart.)
  • lib/src/storage/utils/storage_utils.dart (Run flutter format to format lib/src/storage/utils/storage_utils.dart.)

Maintenance suggestions

Package is pre-release. (-5 points)

Pre-release versions should be used with caution; their API can change in breaking ways.

Dependencies

Package Constraint Resolved Available
Direct dependencies
Dart SDK >=2.2.0 <3.0.0
crossplat_objectid ^2.1.4 2.1.4
crypto ^2.1.3 2.1.4
device_id ^0.2.0 0.2.0
flutter 0.0.0
http ^0.12.0+4 0.12.0+4
http_parser ^3.1.3 3.1.4
intl ^0.16.1 0.16.1
mime ^0.9.6+3 0.9.6+3
package_info ^0.4.0+14 0.4.0+16
path ^1.6.4 1.6.4
uuid ^2.0.4 2.0.4
xmpp_stone ^0.1.4 0.1.4
Transitive dependencies
archive 2.0.13
args 1.6.0
async 2.4.1
charcode 1.1.3
collection 1.14.11 1.14.12
console 3.1.0
convert 2.1.1
cryptoutils 0.4.0
image 2.1.12
matcher 0.12.6
meta 1.1.8
pedantic 1.9.0
petitparser 3.0.2
quiver 2.1.3
sky_engine 0.0.99
source_span 1.7.0
stack_trace 1.9.3
string_scanner 1.0.5
synchronized 2.2.0
term_glyph 1.1.0
tuple 1.0.3
typed_data 1.1.6
unorm_dart 0.1.2
vector_math 2.0.8
xml 3.7.0 4.1.0
Dev dependencies
flutter_test