Giter VIP home page Giter VIP logo

crisp_chat_sdk's Introduction

crisp_chat_sdk

Impelemented native Crisp chat sdk on android and ios

Preview

Screen Shot 2022-02-07 at 6 26 09 PM

Simulator.Screen.Recording.-.iPhone.13.mini.-.2022-02-07.at.18.24.56.mp4

Android implementation:

1-Add: implementation 'androidx.multidex:multidex:2.0.1' to dependencies build.gradle like below:

dependencies {
    …
    implementation 'androidx.multidex:multidex:2.0.1'
}

2-Enable multiDexEnabled true in build.gradle like this:

defaultConfig {
    …
    multiDexEnabled true
}

3-Set min sdk on 19 in build.gradle like below:

defaultConfig {
    …
    multiDexEnabled true

	minSdkVersion 19
}

IOS implementation:

1-Run below commands in terminal in root of project:

cd ios
pod install
Property Description
configure configure the Website ID(Go to your Crisp Dashboard, and copy your Website ID:) ** this method must be called and call before other methods
setTokenID Assigns the next session with a tokenID
resetChatSession Reset the session
setUserAvatar Sets the user avatar
setUserCompany Sets the user company
setUserEmail Sets the user email (note: if email is invalid, this method will return false and the value will not be set)
setUserNickname Sets the user name
setUserPhone Sets the user phone (note: if phone is invalid, this method will return false and the value will not be set)
setSessionBool Sets a session data bool
setSessionInt Sets a session data int
setSessionString Sets a session data string
setSessionSegment Sets a session segment
openChat Open chat view (this method open chat page)

Usage

import 'package:flutter/material.dart';
import 'dart:async';

import 'package:crisp_chat_sdk/crisp_chat_sdk.dart';

void main() {
  runApp(const MyApp());
}

class MyApp extends StatefulWidget {
  const MyApp({Key? key}) : super(key: key);

  @override
  State<MyApp> createState() => _MyAppState();
}

class _MyAppState extends State<MyApp> {
  @override
  Widget build(BuildContext context) {
    return MaterialApp(
      home: Scaffold(
        appBar: AppBar(
          title: const Text('Plugin example app'),
        ),
        body: Center(
          child: ElevatedButton(
            onPressed: () {
              initPlatformState();
            },
            child: const Text('Open crisp chat'),
          ),
        ),
      ),
    );
  }

  Future<void> initPlatformState() async {
    final sdk = CrispChatSdk();
    await sdk.configure(websiteId: "Your WebsiteId");
    await sdk.setUserEmail(email: "[email protected]");
    await sdk.setSessionString(key: "f1KEY", value: "f1value");
    await sdk.setSessionString(key: "f2KEY", value: "f2value");
    await CrispChatSdk().openChat();
  }
}

crisp_chat_sdk's People

Contributors

mohammad-mohammady avatar msfstef avatar jesusrp98 avatar

Recommend Projects

  • React photo React

    A declarative, efficient, and flexible JavaScript library for building user interfaces.

  • Vue.js photo Vue.js

    🖖 Vue.js is a progressive, incrementally-adoptable JavaScript framework for building UI on the web.

  • Typescript photo Typescript

    TypeScript is a superset of JavaScript that compiles to clean JavaScript output.

  • TensorFlow photo TensorFlow

    An Open Source Machine Learning Framework for Everyone

  • Django photo Django

    The Web framework for perfectionists with deadlines.

  • D3 photo 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.

  • Game

    Some thing interesting about game, make everyone happy.

Recommend Org

  • Facebook photo Facebook

    We are working to build community through open source technology. NB: members must have two-factor auth.

  • Microsoft photo Microsoft

    Open source projects and samples from Microsoft.

  • Google photo Google

    Google ❤️ Open Source for everyone.

  • D3 photo D3

    Data-Driven Documents codes.