Giter VIP home page Giter VIP logo

react-native-crisp-chat-sdk's Introduction

react-native-crisp-chat-sdk

React-Native bridge for Crisp chat iOS and Android SDK's

Crisp screenshot

Features

  • iOS & Android Support
  • Typescript Support
  • Expo support with custom dev client

Installation

Install the library using either yarn or npm like so:

yarn add react-native-crisp-chat-sdk
npm install --save react-native-crisp-chat-sdk

Expo support

This package is not available in the Expo Go app. Learn how you can use it with custom dev clients.

iOS Installation

If you're using React Native versions > 60.0, it's relatively straightforward.

cd ios && pod install

For versions below 0.60.0, use rnpm links

  • Run react-native link react-native-crisp-chat-sdk
  • If linking fails, follow the manual linking steps

iOS

Update your Info.plist

To enable your users to take and upload photos to the chat as well as download photos to their photo library, add the Privacy - Camera Usage Description (NSCameraUsageDescription) and Privacy - Photo Library Additions Usage Description (NSPhotoLibraryAddUsageDescription) to your app's Info.plist.

Requirements

⚠️ Adding Camera and Photo permissions is mandatory, NSCameraUsageDescription and NSPhotoLibraryUsageDescription in Info.plist, to inform your users that you need to access to the Camera and Photo Library. You also have to enable "iCloud Documents" capability

Get your website ID

Your website ID can be found in the Crisp App URL:

Crisp Website ID is an UUID like e30a04ee-f81c-4935-b8d8-5fa55831b1c0

Usage

You can view the example project for more usage.

import CrispChat, {
  configure,
  setUserEmail,
  setUserNickname,
  setUserPhone,
  resetSession,
} from 'react-native-crisp-chat-sdk';

// ...
export default function App() {
  // You must set your website ID before calling <CrispChat />
  configure("YOUR_WEBSITE_ID");

  // this should be user ID that way app will load previous user chats
  setUserTokenId('abcd12345');

  // Set user's info
  setUserEmail('[email protected]');
  setUserNickname('John Smith');
  setUserPhone('+614430231224');

  // Call session reset when user loggs out
  resetSession();

  return <CrispChat />;
}

Language management

Explicitly setting alternative languages from React is not currently supported. Nevertheless, the underlying SDK is able to select automatically the locale matching the one of device. The locale detection works out-of-the-box on Android. However, for the locale of the device to be detected on iOS apps, it has to be declared and setup in xcode as a supported language.

Here is a suggested method for adding languages support to your app in Xcode 13:

Start by adding support for your particular language in your project info (<yourProject> > Info > Localizations > +). To make it active, you also need to create at least one dummy StringFile (File > New > File...) with a localized version matching the language you wish to add support to. After this step, if the locale of the device matches the language you set up, it will be exposed by the app and chosen by the Crisp SDK. Note that alternative methods may exist, but have not been tested regarding the locale detection of the Crisp SDK.

For iOS apps, debugging the preferred language exposed by your app can be achieved by adding the following line in your AppDelegate.m file : NSLog(@"localeIdentifier: %@", [[NSLocale currentLocale] localeIdentifier]);

If for example, localeIdentifier: en_FR or localeIdentifier: en_US appears in your Xcode logs, then Crisp will be displayed in english. If localeIdentifier: fr_FR appears in your Xcode logs, it will be displayed in french.

Availables APIs:

  • CrispChatSDK.show()
  • CrispChatSDK.setTokenId('userID/GUID')
  • CrispChatSDK.pushSessionEvent(name: "Signup", color: CrispSessionEventColors.blue)
  • CrispChatSDK.setUserEmail('[email protected]')
  • CrispChatSDK.setUserNickname('John Doe')
  • CrispChatSDK.setUserPhone('003370123456789')
  • CrispChatSDK.setUserAvatar('https://pbs.twimg.com/profile_images/782474226020200448/zDo-gAo0_400x400.jpg')
  • CrispChatSDK.setSessionSegment('segment')
  • CrispChatSDK.setSessionString('key', 'value')
  • CrispChatSDK.setSessionBool('key', 'value')
  • CrispChatSDK.setSessionInt('key', 'value')
  • CrispChatSDK.resetSession()
  • CrispChatSDK.configure('YOUR_WEBSITE_ID')

Contributing

See the contributing guide to learn how to contribute to the repository and the development workflow.

License

MIT

react-native-crisp-chat-sdk's People

Contributors

98oktay avatar arcln avatar baptistejamin avatar brpinto avatar dependabot[bot] avatar elpayet avatar luke-lewandowski avatar mitchiemt11 avatar mlecoq avatar moxspoy avatar walterholohan avatar

Stargazers

 avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar

Watchers

 avatar  avatar  avatar

react-native-crisp-chat-sdk's Issues

[Android Only] App crash when close modal crisp chat.

  • My app was crash when i close modal crisp. I am using "react-native-crisp-chat-sdk": "^0.10.2" .
  • Here is crash log:
    FATAL EXCEPTION: main
    Process: vn.com.eatsy, PID: 11421
    java.lang.NoClassDefFoundError: Failed resolution of: Lcom/google/android/exoplayer2/Player$EventListener;
    at im.crisp.client.internal.utils.b.a(Unknown Source:0)
    at im.crisp.client.Crisp.d(Unknown Source:0)
    at im.crisp.client.ChatActivity.onDestroy(Unknown Source:3)
    at android.app.Activity.performDestroy(Activity.java:8203)
    channel 'e3aaa7c vn.com.eatsy/im.crisp.client.ChatActivity (server)' ~ Channel is unrecoverably broken and will be disposed!
    channel 'fc6db7 vn.com.eatsy/vn.com.eatsy.MainActivity (server)' ~ Channel is unrecoverably broken and will be disposed!
    packageMonitor onPackageModified packageName=vn.com.eatsy mIsRecentsWithinLauncher=true
    packageMonitor onPackageModified packageName=vn.com.eatsy mIsRecentsWithinLauncher=true

pushSessionEvent is not a function iOS

Hi all,
I got this error when using pushSessionEvent on iOS

TypeError: _reactNativeCrispChatSdk.default.pushSessionEvent is not a function. (In '_reactNativeCrispChatSdk.default.pushSessionEvent("Login", _reactNativeCrispChatSdk.CrispSessionEventColors.blue)', '_reactNativeCrispChatSdk.default.pushSessionEvent' is undefined)

Any advice? Thanks

Pod install error

I'm trying install package but when i try to install pods i just get this error msg:
CocoaPods could not find compatible versions for pod "react-native-crisp-chat-sdk"

I already tried version 4.0.0 and 5.0.0

Callback when the user closes the modal

Hey,

Thanks for the update, the SDK works great on our side now,

One quick question: how do you know the modal was closed to update the showChat state?

Thanks,

Théo

Error starting chat

error starting chat for android and ios,This happens occasionally. How can I solve it?

use version:
"react": "17.0.2",
"react-native": "0.68.0-rc.3",
"react-native-crisp-chat-sdk": "^0.11.0",

Targeting Sdk version 31 on android

Hello ! I'm trying to install this package. But when adding it to my project.
I'm getting this error on compilation :

FAILURE: Build failed with an exception.

* What went wrong:
Execution failed for task ':app:checkStagingDebugAarMetadata'.
> A failure occurred while executing com.android.build.gradle.internal.tasks.CheckAarMetadataWorkAction
   > The minCompileSdk (31) specified in a
     dependency's AAR metadata (META-INF/com/android/build/gradle/aar-metadata.properties)
     is greater than this module's compileSdkVersion (android-30).
     Dependency: androidx.appcompat:appcompat:1.4.1.
     AAR metadata file: C:\Users\maximedev\.gradle\caches\transforms-3\65490f590e300e64121b2eb11f167879\transformed\appcompat-1.4.1\META-INF\com\android\build\gradle\aar-metadata.properties. 

Not sure from where it come, the project don't seems to target sdk 31.
The only thing I found is that the android sdk sample is targeting 31...
Is anybody got the same issue or has a solution ?

setUserEmail for Android

When trying to use the setUserEmail method on the android platform, I realized that the email was not set. Looking at the dependencies I realized that there is a condition to only set the email if it is in IOS if (Platform.OS === 'ios').
I thought about using CrispChatSDK.setUserEmail, which was already done in the old version. However, I get an error that says "undefined is not a function".
2020-11-18T15_24_55 117Z

Send message with function

Hi ! Thank's for your work !
I'm wondering if there is a way to send a message directly with a function without using the chat (for Android and iOS) ?

Crash due to NumberFormatException on loading chat conversation

We are trying to integrate the Crisp react native sdk within our app. We are using version : "0.7.0" of the SDK. Recently, we encountered that for a few users the crisp sdk crashes when the user tries to open a chat window which has some preloaded text(earlier conversation) in it.
From the log it seems the issue is in parsing the json response and sdk is throwing a NumberFormatException.

Exception thrown:

2021-07-19 17:21:49.730 5136-5396/? E/e.b.h.a: Task threw exception
    com.google.gson.JsonSyntaxException: java.lang.NumberFormatException: Expected a long but was 237.3333282470703 at line 1 column 1067 path $.storage.state.scroll
        at com.google.gson.internal.bind.TypeAdapters$11.read(TypeAdapters.java:5)
        at com.google.gson.internal.bind.TypeAdapters$11.read(TypeAdapters.java:1)
        at com.google.gson.internal.bind.ReflectiveTypeAdapterFactory$1.read(ReflectiveTypeAdapterFactory.java:1)
        at com.google.gson.internal.bind.ReflectiveTypeAdapterFactory$Adapter.read(ReflectiveTypeAdapterFactory.java:9)
        at com.google.gson.internal.bind.ReflectiveTypeAdapterFactory$1.read(ReflectiveTypeAdapterFactory.java:1)
        at com.google.gson.internal.bind.ReflectiveTypeAdapterFactory$Adapter.read(ReflectiveTypeAdapterFactory.java:9)
        at com.google.gson.internal.bind.ReflectiveTypeAdapterFactory$1.read(ReflectiveTypeAdapterFactory.java:1)
        at com.google.gson.internal.bind.ReflectiveTypeAdapterFactory$Adapter.read(ReflectiveTypeAdapterFactory.java:9)
        at com.google.gson.Gson.fromJson(Gson.java:17)
        at com.google.gson.Gson.fromJson(Gson.java:10)
        at com.google.gson.Gson.fromJson(Gson.java:4)
        at com.google.gson.Gson.fromJson(Gson.java:1)
        at im.crisp.client.b.d.c.a.a(Unknown Source:8)
        at im.crisp.client.b.d.a.v(Unknown Source:10)
        at im.crisp.client.b.d.a.r(Unknown Source:0)
        at im.crisp.client.b.d.h.a(Unknown Source:2)
        at e.b.b.a.a(Emitter.java:3)
        at io.socket.client.e.I(Socket.java:10)
        at io.socket.client.e.K(Socket.java:7)
        at io.socket.client.e.i(Socket.java:1)
        at io.socket.client.e$b$b.a(Socket.java:1)
        at e.b.b.a.a(Emitter.java:3)
        at io.socket.client.c.Q(Manager.java:1)
        at io.socket.client.c.p(Manager.java:1)
        at io.socket.client.c$j.a(Manager.java:1)
        at e.b.g.b$b.a(IOParser.java:4)
        at io.socket.client.c.O(Manager.java:1)
        at io.socket.client.c.j(Manager.java:1)
        at io.socket.client.c$e.a(Manager.java:3)
        at e.b.b.a.a(Emitter.java:3)
        at io.socket.engineio.client.b.Q(Socket.java:19)
        at io.socket.engineio.client.b.i(Socket.java:1)
        at io.socket.engineio.client.b$p.a(Socket.java:1)
        at e.b.b.a.a(Emitter.java:3)
        at io.socket.engineio.client.c.p(Transport.java:1)
        at io.socket.engineio.client.c.l(Transport.java:1)
        at io.socket.engineio.client.d.c.u(WebSocket.java:1)
        at io.socket.engineio.client.d.c$a$b.run(WebSocket.java:1)
        at e.b.h.a$b.run(EventThread.java:1)
        at java.util.concurrent.ThreadPoolExecutor.runWorker(ThreadPoolExecutor.java:1162)
        at java.util.concurrent.ThreadPoolExecutor$Worker.run(ThreadPoolExecutor.java:636)
        at java.lang.Thread.run(Thread.java:764)
     Caused by: java.lang.NumberFormatException: Expected a long but was 237.3333282470703 at line 1 column 1067 path $.storage.state.scroll
        at com.google.gson.stream.JsonReader.nextLong(JsonReader.java:19)
        at com.google.gson.internal.bind.TypeAdapters$11.read(TypeAdapters.java:4)
        at com.google.gson.internal.bind.TypeAdapters$11.read(TypeAdapters.java:1) 
        at com.google.gson.internal.bind.ReflectiveTypeAdapterFactory$1.read(ReflectiveTypeAdapterFactory.java:1) 
        at com.google.gson.internal.bind.ReflectiveTypeAdapterFactory$Adapter.read(ReflectiveTypeAdapterFactory.java:9) 
        at com.google.gson.internal.bind.ReflectiveTypeAdapterFactory$1.read(ReflectiveTypeAdapterFactory.java:1) 
        at com.google.gson.internal.bind.ReflectiveTypeAdapterFactory$Adapter.read(ReflectiveTypeAdapterFactory.java:9) 
        at com.google.gson.internal.bind.ReflectiveTypeAdapterFactory$1.read(ReflectiveTypeAdapterFactory.java:1) 
        at com.google.gson.internal.bind.ReflectiveTypeAdapterFactory$Adapter.read(ReflectiveTypeAdapterFactory.java:9) 
        at com.google.gson.Gson.fromJson(Gson.java:17) 
        at com.google.gson.Gson.fromJson(Gson.java:10) 
        at com.google.gson.Gson.fromJson(Gson.java:4) 
        at com.google.gson.Gson.fromJson(Gson.java:1) 
        at im.crisp.client.b.d.c.a.a(Unknown Source:8) 
        at im.crisp.client.b.d.a.v(Unknown Source:10) 
        at im.crisp.client.b.d.a.r(Unknown Source:0) 
        at im.crisp.client.b.d.h.a(Unknown Source:2) 
        at e.b.b.a.a(Emitter.java:3) 
        at io.socket.client.e.I(Socket.java:10) 
        at io.socket.client.e.K(Socket.java:7) 
        at io.socket.client.e.i(Socket.java:1) 
        at io.socket.client.e$b$b.a(Socket.java:1) 
        at e.b.b.a.a(Emitter.java:3) 
        at io.socket.client.c.Q(Manager.java:1) 
        at io.socket.client.c.p(Manager.java:1) 
        at io.socket.client.c$j.a(Manager.java:1) 
        at e.b.g.b$b.a(IOParser.java:4) 
        at io.socket.client.c.O(Manager.java:1) 
        at io.socket.client.c.j(Manager.java:1) 
        at io.socket.client.c$e.a(Manager.java:3) 
        at e.b.b.a.a(Emitter.java:3) 
        at io.socket.engineio.client.b.Q(Socket.java:19) 
        at io.socket.engineio.client.b.i(Socket.java:1) 
        at io.socket.engineio.client.b$p.a(Socket.java:1) 
        at e.b.b.a.a(Emitter.java:3) 
        at io.socket.engineio.client.c.p(Transport.java:1) 
        at io.socket.engineio.client.c.l(Transport.java:1) 
        at io.socket.engineio.client.d.c.u(WebSocket.java:1) 
        at io.socket.engineio.client.d.c$a$b.run(WebSocket.java:1) 
        at e.b.h.a$b.run(EventThread.java:1) 
        at java.util.concurrent.ThreadPoolExecutor.runWorker(ThreadPoolExecutor.java:1162) 
        at java.util.concurrent.ThreadPoolExecutor$Worker.run(ThreadPoolExecutor.java:636) 
        at java.lang.Thread.run(Thread.java:764) 
    

Crisp Android Keyboard

When keyboard show, i can't scroll converstation.
Please help me.
React native 0.63.2
Screenshot_1604205210

onClose event / how to reset visible state?

This module opens up in its own window / view it seems.

The example folder has a state driven solution to showing and hiding the chat window, but with no onClose event what's the proposed solution to resetting the state?

There's an existing closed issue with the same question and an answer here: #17 (comment)

But the answer is nonsensical.

Not working with react native navigation

Hello,

This library does not play well with latest RN navigation. The chat opens in its own view regardless of where you placed the <CrispChat /> component.

That's because the Crisp SDKs are not react-friendly but were wrapped to make us believe so :

The <CrispChat /> component is in fact an empty view that calls .show().

I think this should be stated in the readme. The correct way to use the library with RN navigation is to not use the component and directly call .show() yourself.

Just posting this so it maybe help others.

[iOS only] Error starting chat (50% of the time)

On iOS, I can open the chat the first time it works as expected, then the second time it will hang for a long time on "starting chat" and eventually fail with "error starting chat".

Then I can open the chat again and it works, then it doesn't, etc.

I fixed this problem by updating from iOS SDK 1.6.4 to iOS SDK 2.2.0 (latest at the time of writing).

[RN 0.68] Compilation issue on iOS

Hi,

After migration to RN 0.68, I have a compilation issue:

AppDelegate.mm:35:2: use of undeclared identifier 'CrispSDK'

AppDelegate.m has been replaced with AppDelegate.mm

So I have added #import <Crisp/Crisp.h> and [CrispSDK configureWithWebsiteID:...] AppDelegate.mm as done before in AppDelegate.m

Is there any extra step on RN 0.68 ?

Thanks !

java.lang.Throwable: A WebView method was called on thread 'mqt_native_modules'.

Hallo!
im getting trouble when trying to reopen the chat components.

when i open the app, then i click button navigate to component that contains CrispChatUI, working fine. Then i close/back from that page, and i open again that page, suddenly i get red box in my android (in iOS is working/no problem like this).

Screen shoot

image

Here is my component code:

import {View} from 'react-native';
import React, {useEffect, useState} from "react";
import styles from './styles'

const CrispChatScene = () => {

    useEffect(() => {
        Crisp.setUserEmail("[email protected]");
        Crisp.setUserNickname("eqi");
    }, []);

    return (
        <View style={styles.container}>
            <CrispChatUI style={styles.container}/>
        </View>
    );
}

export default CrispChatScene;

when i trying to remove setUserEmail and setUserNickname, the error is gone, but the screen stuck in loading.

image

Stack trace

java.lang.RuntimeException: java.lang.Throwable: A WebView method was called on thread 'mqt_native_modules'. All WebView methods must be called on the same thread. (Expected Looper Looper (main, tid 2) {858d5cd} called on Looper (mqt_native_modules, tid 1257) {f9fe257}, FYI main Looper is Looper (main, tid 2) {858d5cd})
        at android.webkit.WebView.checkThread(WebView.java:2700)
        at android.webkit.WebView.evaluateJavascript(WebView.java:1112)
        at im.crisp.sdk.ui.CrispFragment.a(SourceFile:17)
        at im.crisp.sdk.ui.CrispFragment.a(SourceFile:22)
        at im.crisp.sdk.ui.CrispFragment.execute(SourceFile:3)
        at im.crisp.sdk.Crisp$User.setEmail(SourceFile:1)
        at com.reactnativecrispchatsdk.CrispChatSdkModule.setUserEmail(CrispChatSdkModule.java:21)
        at java.lang.reflect.Method.invoke(Native Method)
        at com.facebook.react.bridge.JavaMethodWrapper.invoke(JavaMethodWrapper.java:371)
        at com.facebook.react.bridge.JavaModuleWrapper.invoke(JavaModuleWrapper.java:150)
        at com.facebook.react.bridge.queue.NativeRunnable.run(Native Method)
        at android.os.Handler.handleCallback(Handler.java:873)
        at android.os.Handler.dispatchMessage(Handler.java:99)
        at com.facebook.react.bridge.queue.MessageQueueThreadHandler.dispatchMessage(MessageQueueThreadHandler.java:26)
        at android.os.Looper.loop(Looper.java:193)
        at com.facebook.react.bridge.queue.MessageQueueThreadImpl$4.run(MessageQueueThreadImpl.java:225)
        at java.lang.Thread.run(Thread.java:764)
     Caused by: java.lang.Throwable: A WebView method was called on thread 'mqt_native_modules'. All WebView methods must be called on the same thread. (Expected Looper Looper (main, tid 2) {858d5cd} called on Looper (mqt_native_modules, tid 1257) {f9fe257}, FYI main Looper is Looper (main, tid 2) {858d5cd})
        at android.webkit.WebView.checkThread(WebView.java:2695)
        at android.webkit.WebView.evaluateJavascript(WebView.java:1112) 
        at im.crisp.sdk.ui.CrispFragment.a(SourceFile:17) 
        at im.crisp.sdk.ui.CrispFragment.a(SourceFile:22) 
        at im.crisp.sdk.ui.CrispFragment.execute(SourceFile:3) 
        at im.crisp.sdk.Crisp$User.setEmail(SourceFile:1) 
        at com.reactnativecrispchatsdk.CrispChatSdkModule.setUserEmail(CrispChatSdkModule.java:21) 
        at java.lang.reflect.Method.invoke(Native Method) 
        at com.facebook.react.bridge.JavaMethodWrapper.invoke(JavaMethodWrapper.java:371) 
        at com.facebook.react.bridge.JavaModuleWrapper.invoke(JavaModuleWrapper.java:150) 
        at com.facebook.react.bridge.queue.NativeRunnable.run(Native Method) 
        at android.os.Handler.handleCallback(Handler.java:873) 
        at android.os.Handler.dispatchMessage(Handler.java:99) 
        at com.facebook.react.bridge.queue.MessageQueueThreadHandler.dispatchMessage(MessageQueueThreadHandler.java:26) 
        at android.os.Looper.loop(Looper.java:193) 
        at com.facebook.react.bridge.queue.MessageQueueThreadImpl$4.run(MessageQueueThreadImpl.java:225) 
        at java.lang.Thread.run(Thread.java:764) 
2020-08-01 19:11:51.735 27515-27700/id.flip.staging.debug W/WebView: java.lang.Throwable: A WebView method was called on thread 'mqt_native_modules'. All WebView methods must be called on the same thread. (Expected Looper Looper (main, tid 2) {858d5cd} called on Looper (mqt_native_modules, tid 1257) {f9fe257}, FYI main Looper is Looper (main, tid 2) {858d5cd})
        at android.webkit.WebView.checkThread(WebView.java:2695)
        at android.webkit.WebView.evaluateJavascript(WebView.java:1112)
        at im.crisp.sdk.ui.CrispFragment.a(SourceFile:17)
        at im.crisp.sdk.ui.CrispFragment.a(SourceFile:22)
        at im.crisp.sdk.ui.CrispFragment.execute(SourceFile:3)
        at im.crisp.sdk.Crisp$User.setNickname(SourceFile:1)
        at com.reactnativecrispchatsdk.CrispChatSdkModule.setUserNickname(CrispChatSdkModule.java:26)
        at java.lang.reflect.Method.invoke(Native Method)
        at com.facebook.react.bridge.JavaMethodWrapper.invoke(JavaMethodWrapper.java:371)
        at com.facebook.react.bridge.JavaModuleWrapper.invoke(JavaModuleWrapper.java:150)
        at com.facebook.react.bridge.queue.NativeRunnable.run(Native Method)
        at android.os.Handler.handleCallback(Handler.java:873)
        at android.os.Handler.dispatchMessage(Handler.java:99)
        at com.facebook.react.bridge.queue.MessageQueueThreadHandler.dispatchMessage(MessageQueueThreadHandler.java:26)
        at android.os.Looper.loop(Looper.java:193)
        at com.facebook.react.bridge.queue.MessageQueueThreadImpl$4.run(MessageQueueThreadImpl.java:225)
        at java.lang.Thread.run(Thread.java:764)
2020-08-01 19:11:51.736 27515-27700/id.flip.staging.debug D/StrictMode: StrictMode policy violation: android.os.strictmode.WebViewMethodCalledOnWrongThreadViolation
        at android.webkit.WebView.checkThread(WebView.java:2695)
        at android.webkit.WebView.evaluateJavascript(WebView.java:1112)
        at im.crisp.sdk.ui.CrispFragment.a(SourceFile:17)
        at im.crisp.sdk.ui.CrispFragment.a(SourceFile:22)
        at im.crisp.sdk.ui.CrispFragment.execute(SourceFile:3)
        at im.crisp.sdk.Crisp$User.setNickname(SourceFile:1)
        at com.reactnativecrispchatsdk.CrispChatSdkModule.setUserNickname(CrispChatSdkModule.java:26)
        at java.lang.reflect.Method.invoke(Native Method)
        at com.facebook.react.bridge.JavaMethodWrapper.invoke(JavaMethodWrapper.java:371)
        at com.facebook.react.bridge.JavaModuleWrapper.invoke(JavaModuleWrapper.java:150)
        at com.facebook.react.bridge.queue.NativeRunnable.run(Native Method)
        at android.os.Handler.handleCallback(Handler.java:873)
        at android.os.Handler.dispatchMessage(Handler.java:99)
        at com.facebook.react.bridge.queue.MessageQueueThreadHandler.dispatchMessage(MessageQueueThreadHandler.java:26)
        at android.os.Looper.loop(Looper.java:193)
        at com.facebook.react.bridge.queue.MessageQueueThreadImpl$4.run(MessageQueueThreadImpl.java:225)
        at java.lang.Thread.run(Thread.java:764)
2020-08-01 19:11:51.741 27515-27700/id.flip.staging.debug E/unknown:ReactNative: Exception in native call
    java.lang.RuntimeException: java.lang.Throwable: A WebView method was called on thread 'mqt_native_modules'. All WebView methods must be called on the same thread. (Expected Looper Looper (main, tid 2) {858d5cd} called on Looper (mqt_native_modules, tid 1257) {f9fe257}, FYI main Looper is Looper (main, tid 2) {858d5cd})
        at android.webkit.WebView.checkThread(WebView.java:2700)
        at android.webkit.WebView.evaluateJavascript(WebView.java:1112)
        at im.crisp.sdk.ui.CrispFragment.a(SourceFile:17)
        at im.crisp.sdk.ui.CrispFragment.a(SourceFile:22)
        at im.crisp.sdk.ui.CrispFragment.execute(SourceFile:3)
        at im.crisp.sdk.Crisp$User.setNickname(SourceFile:1)
        at com.reactnativecrispchatsdk.CrispChatSdkModule.setUserNickname(CrispChatSdkModule.java:26)
        at java.lang.reflect.Method.invoke(Native Method)
        at com.facebook.react.bridge.JavaMethodWrapper.invoke(JavaMethodWrapper.java:371)
        at com.facebook.react.bridge.JavaModuleWrapper.invoke(JavaModuleWrapper.java:150)
        at com.facebook.react.bridge.queue.NativeRunnable.run(Native Method)
        at android.os.Handler.handleCallback(Handler.java:873)
        at android.os.Handler.dispatchMessage(Handler.java:99)
        at com.facebook.react.bridge.queue.MessageQueueThreadHandler.dispatchMessage(MessageQueueThreadHandler.java:26)
        at android.os.Looper.loop(Looper.java:193)
        at com.facebook.react.bridge.queue.MessageQueueThreadImpl$4.run(MessageQueueThreadImpl.java:225)
        at java.lang.Thread.run(Thread.java:764)
     Caused by: java.lang.Throwable: A WebView method was called on thread 'mqt_native_modules'. All WebView methods must be called on the same thread. (Expected Looper Looper (main, tid 2) {858d5cd} called on Looper (mqt_native_modules, tid 1257) {f9fe257}, FYI main Looper is Looper (main, tid 2) {858d5cd})
        at android.webkit.WebView.checkThread(WebView.java:2695)
        at android.webkit.WebView.evaluateJavascript(WebView.java:1112) 
        at im.crisp.sdk.ui.CrispFragment.a(SourceFile:17) 
        at im.crisp.sdk.ui.CrispFragment.a(SourceFile:22) 
        at im.crisp.sdk.ui.CrispFragment.execute(SourceFile:3) 
        at im.crisp.sdk.Crisp$User.setNickname(SourceFile:1) 
        at com.reactnativecrispchatsdk.CrispChatSdkModule.setUserNickname(CrispChatSdkModule.java:26) 
        at java.lang.reflect.Method.invoke(Native Method) 
        at com.facebook.react.bridge.JavaMethodWrapper.invoke(JavaMethodWrapper.java:371) 
        at com.facebook.react.bridge.JavaModuleWrapper.invoke(JavaModuleWrapper.java:150) 
        at com.facebook.react.bridge.queue.NativeRunnable.run(Native Method) 
        at android.os.Handler.handleCallback(Handler.java:873) 
        at android.os.Handler.dispatchMessage(Handler.java:99) 
        at com.facebook.react.bridge.queue.MessageQueueThreadHandler.dispatchMessage(MessageQueueThreadHandler.java:26) 
        at android.os.Looper.loop(Looper.java:193) 
        at com.facebook.react.bridge.queue.MessageQueueThreadImpl$4.run(MessageQueueThreadImpl.java:225) 
        at java.lang.Thread.run(Thread.java:764) 

Expected result

i could open the app anytime (navigate from other component).
please help me.

Environment

React native 0.61.5
using latest react-native-crisp-chat-sdk

cannot close chat on android

I have implemented Crisp chat with a boolean condition for rendering on an existing page:
I have this function
`const openChat = () => {
setTokenId(authStore.getSetting('crisp_code'));
// Set user's info
setUserEmail(8888);
setUserNickname(authStore.user.name);
setUserPhone(authStore.user.phone);

    // resetSession()
    setShowChat(true)
    show()
}`

I press a button and the chat comes up normally:
on iOS when I close the chat it works ok and the app goes back to normal.
on android when I close the chat the loading screen does not disappear.
image

If I'm not mistaking this didn't happen on earlier versions.

assembleRelease issue

  • What went wrong:
    Execution failed for task ':react-native-crisp-chat-sdk:mergeReleaseResources'.

Could not resolve all files for configuration ':react-native-crisp-chat-sdk:releaseRuntimeClasspath'.
Could not resolve com.facebook.react:react-native:+.
Required by:
project :react-native-crisp-chat-sdk
> Failed to list versions for com.facebook.react:react-native.
> Unable to load Maven meta-data from https://dl.bintray.com/crispim/crisp-maven/com/facebook/react/react-native/maven-metadata.xml.
> Could not get resource 'https://dl.bintray.com/crispim/crisp-maven/com/facebook/react/react-native/maven-metadata.xml'.
> Could not GET 'https://dl.bintray.com/crispim/crisp-maven/com/facebook/react/react-native/maven-metadata.xml'. Received status code 502 from server: Bad Gateway

[IOS] Headers not found

Hello,

I have a problem with version 0.11.0 with the chat opening only 50% of the time.

It has been mentioned here #105 (comment). However after updating to version 0.13.1 which is supposed to fix the problem, I can't build the project anymore.

I have an error "'Crisp/Crisp-Swift.h' file not found" since this update with the iOS SDK 2.2.0.

Here is my environment:

System:
    OS: macOS 13.1
    CPU: (12) x64 Intel(R) Core(TM) i7-9750H CPU @ 2.60GHz
    Memory: 63.39 MB / 16.00 GB
    Shell: 5.8.1 - /bin/zsh
  Binaries:
    Node: 14.18.1 - ~/.nvm/versions/node/v14.18.1/bin/node
    Yarn: 1.22.17 - ~/.nvm/versions/node/v14.18.1/bin/yarn
    npm: 6.14.15 - ~/.nvm/versions/node/v14.18.1/bin/npm
    Watchman: 2022.02.28.00 - /usr/local/bin/watchman
  Managers:
    CocoaPods: 1.11.2 - /usr/local/bin/pod
  SDKs:
    iOS SDK:
      Platforms: DriverKit 22.2, iOS 16.2, macOS 13.1, tvOS 16.1, watchOS 9.1
    Android SDK: Not Found
  IDEs:
    Android Studio: 2020.3 AI-203.7717.56.2031.7784292
    Xcode: 14.2/14C18 - /usr/bin/xcodebuild
  Languages:
    Java: 11.0.14.1 - /usr/bin/javac
  npmPackages:
    @react-native-community/cli: Not Found
    react: 18.2.0 => 18.2.0
    react-native: 0.71.3 => 0.71.3
    react-native-macos: Not Found
  npmGlobalPackages:
    *react-native*: Not Found

Failing build on iOS: Multiple commands produce

Hi,

I am trying to make the package work. After installing the package the build for iOS started failing and I am getting the error stated below. Though when I remove the package, it successfully builds again.

Anyone else encountered this before?

Multiple commands produce '/Library/Developer/Xcode/DerivedData/<project_name>-<omitted>/Build/Products/Debug-iphoneos/cocoapods-artifacts-Debug.txt':

1) That command depends on command in Target '<project_name>' (project '<project_name>'): script phase “[CP] Prepare Artifacts”
2) That command depends on command in Target '<project_name>' (project '<project_name>'): script phase “[CP] Prepare Artifacts”

I'm using RN 0.62.2

Thanks!

Android build issue

Hi everyone,
I've added the Crisp plugin to my app but apparently it has conflict in Kotlin version with other libraries that I have.
Screenshot 2023-03-13 at 19 31 11

Any ideas how I can fix this problem ?

Kotlin version is not compatible with latest Expo SDK v48 when building in EAS

Hi! 👋

Firstly, thanks for your work on this project! 🙂

Today I used patch-package to patch [email protected] for the Expo project I'm working on.

(later versions are even more broke in EAS)

When I run an EAS build, I get the following error :

[stderr] 
FAILURE: Build failed with an exception.
[stderr] 
* What went wrong:
[stderr] 
The Android Gradle plugin supports only Kotlin Gradle plugin version 1.5.20 and higher.
[stderr] 
The following dependencies do not satisfy the required version:
[stderr] 
project ':react-native-crisp-chat-sdk' -> org.jetbrains.kotlin:kotlin-gradle-plugin:1.3.50
[stderr] 
* Try:
[stderr] 
> Run with --stacktrace option to get the stack trace.
[stderr] 
> Run with --info
[stderr] 
or --debug option to get more log output.
[stderr] 
> Run with --scan to get full insights.
[stderr] 
* Get more help at https://help.gradle.org
[stderr] 
BUILD FAILED in 2m 57s 

I have used the Build properties config plugin from Expo, but changing the kotlin version to 1.3.50 is prevented by the plugin (version 1.3.50 is too low, minimum allowed 1.6.10).

Here is the diff that solved my problem:

diff --git a/node_modules/react-native-crisp-chat-sdk/android/build.gradle b/node_modules/react-native-crisp-chat-sdk/android/build.gradle
index 27417aa..38e193c 100644
--- a/node_modules/react-native-crisp-chat-sdk/android/build.gradle
+++ b/node_modules/react-native-crisp-chat-sdk/android/build.gradle
@@ -1,6 +1,4 @@
 buildscript {
-  // Buildscript is evaluated before everything else so we can't use getExtOrDefault
-  def kotlin_version = rootProject.ext.has('kotlinVersion') ? rootProject.ext.get('kotlinVersion') : project.properties['CrispChatSdk_kotlinVersion']
 
   repositories {
     google()
@@ -10,7 +8,7 @@ buildscript {
   dependencies {
     classpath 'com.android.tools.build:gradle:3.2.1'
     // noinspection DifferentKotlinGradleVersion
-    classpath "org.jetbrains.kotlin:kotlin-gradle-plugin:$kotlin_version"
+    classpath "org.jetbrains.kotlin:kotlin-gradle-plugin:1.7.20"
   }
 }
 
@@ -120,11 +118,9 @@ repositories {
   }
 }
 
-def kotlin_version = getExtOrDefault('kotlinVersion')
-
 dependencies {
   // noinspection GradleDynamicVersion
   api 'com.facebook.react:react-native:+'
-  implementation "org.jetbrains.kotlin:kotlin-stdlib:$kotlin_version"
+  implementation "org.jetbrains.kotlin:kotlin-stdlib:1.7.20"
   implementation 'im.crisp:crisp-sdk:1.0.14'
 }
diff --git a/node_modules/react-native-crisp-chat-sdk/android/gradle.properties b/node_modules/react-native-crisp-chat-sdk/android/gradle.properties
index 4a3cd3e..b0cae2c 100644
--- a/node_modules/react-native-crisp-chat-sdk/android/gradle.properties
+++ b/node_modules/react-native-crisp-chat-sdk/android/gradle.properties
@@ -1,4 +1,4 @@
-CrispChatSdk_kotlinVersion=1.3.50
+CrispChatSdk_kotlinVersion=1.7.20
 CrispChatSdk_compileSdkVersion=28
 CrispChatSdk_buildToolsVersion=28.0.3
 CrispChatSdk_targetSdkVersion=28

This issue body was partially generated by patch-package.

My changes are probably inadequates (shortcuts have been taken), but the intented effect is positive.

Do you plan on updating this version in the near future ?

Thanks :)

[iOS] Chat is crashing

It is working perfectly on Android, but when I open it on iOS, it closes the app.
I've done all the documentation installation process, but perhaps I missed something.

Here is my 'package.json'

{
  "name": "easyfarm",
  "version": "0.0.10",
  "private": true,
  "scripts": {
    "android": "react-native run-android",
    "androidClean": "cd android && ./gradlew clean && cd .. && npx react-native run-android",
    "ios": "react-native run-ios",
    "start": "react-native start",
    "test": "jest",
    "lint": "eslint . --ext .js,.jsx,.ts,.tsx",
    "upgrade-version": "npx react-native-version --never-amend"
  },
  "dependencies": {
    "@react-native-community/async-storage": "^1.12.1",
    "@react-native-community/datetimepicker": "^3.4.7",
    "@react-native-community/masked-view": "^0.1.10",
    "@react-native-community/netinfo": "^6.0.0",
    "@react-navigation/drawer": "^5.12.5",
    "@react-navigation/material-bottom-tabs": "^5.3.15",
    "@react-navigation/native": "^5.9.4",
    "@react-navigation/stack": "^5.14.4",
    "axios": "^0.21.1",
    "date-fns": "^2.21.3",
    "intl": "^1.2.5",
    "lottie-react-native": "^4.0.2",
    "react": "16.13.1",
    "react-datepicker": "^4.1.1",
    "react-native": "0.64.0",
    "react-native-canvas": "^0.1.38",
    "react-native-crisp-chat-sdk": "^0.7.0",
    "react-native-datepicker": "^1.7.2",
    "react-native-exception-handler": "^2.10.10",
    "react-native-gesture-handler": "^1.10.3",
    "react-native-modalize": "^2.0.8",
    "react-native-paper": "^4.8.1",
    "react-native-portalize": "^1.0.7",
    "react-native-reanimated": "^2.1.0",
    "react-native-responsive-screen": "^1.4.2",
    "react-native-safe-area-context": "^3.2.0",
    "react-native-screens": "^3.1.1",
    "react-native-vector-icons": "^8.1.0",
    "react-native-webview": "^11.14.0",
    "readme-filename": "^1.0.0",
    "styled-components": "^5.2.0"
  },
  "devDependencies": {
    "@babel/core": "^7.12.9",
    "@babel/runtime": "^7.12.5",
    "@react-native-community/eslint-config": "^2.0.0",
    "@types/jest": "^26.0.20",
    "@types/react-native": "^0.64.0",
    "@types/react-native-canvas": "^0.1.8",
    "@types/react-native-vector-icons": "^6.4.6",
    "@types/react-test-renderer": "^16.9.2",
    "@types/styled-components-react-native": "^5.1.1",
    "babel-jest": "^26.6.3",
    "eslint": "^7.14.0",
    "jest": "^26.6.3",
    "metro-react-native-babel-preset": "^0.64.0",
    "react-test-renderer": "17.0.1",
    "typescript": "^3.8.3"
  },
  "resolutions": {
    "@types/react": "^17"
  },
  "jest": {
    "preset": "react-native",
    "moduleFileExtensions": [
      "ts",
      "tsx",
      "js",
      "jsx",
      "json",
      "node"
    ]
  }
}

Here is my 'ios/easyfarm/AppDelegate.m'

#import "AppDelegate.h"

#import <React/RCTBridge.h>
#import <React/RCTBundleURLProvider.h>
#import <React/RCTRootView.h>

#ifdef FB_SONARKIT_ENABLED
#import <FlipperKit/FlipperClient.h>
#import <FlipperKitLayoutPlugin/FlipperKitLayoutPlugin.h>
#import <FlipperKitUserDefaultsPlugin/FKUserDefaultsPlugin.h>
#import <FlipperKitNetworkPlugin/FlipperKitNetworkPlugin.h>
#import <SKIOSNetworkPlugin/SKIOSNetworkAdapter.h>
#import <FlipperKitReactPlugin/FlipperKitReactPlugin.h>
#import <Crisp/Crisp.h>

[CrispSDK configureWithWebsiteID:@"HereIsEasyFarm-Chat-Id"];

static void InitializeFlipper(UIApplication *application) {
  FlipperClient *client = [FlipperClient sharedClient];
  SKDescriptorMapper *layoutDescriptorMapper = [[SKDescriptorMapper alloc] initWithDefaults];
  [client addPlugin:[[FlipperKitLayoutPlugin alloc] initWithRootNode:application withDescriptorMapper:layoutDescriptorMapper]];
  [client addPlugin:[[FKUserDefaultsPlugin alloc] initWithSuiteName:nil]];
  [client addPlugin:[FlipperKitReactPlugin new]];
  [client addPlugin:[[FlipperKitNetworkPlugin alloc] initWithNetworkAdapter:[SKIOSNetworkAdapter new]]];
  [client start];
}
#endif

@implementation AppDelegate

- (BOOL)application:(UIApplication *)application didFinishLaunchingWithOptions:(NSDictionary *)launchOptions
{
#ifdef FB_SONARKIT_ENABLED
  InitializeFlipper(application);
#endif

  RCTBridge *bridge = [[RCTBridge alloc] initWithDelegate:self launchOptions:launchOptions];
  RCTRootView *rootView = [[RCTRootView alloc] initWithBridge:bridge
                                                   moduleName:@"easyfarm"
                                            initialProperties:nil];

  if (@available(iOS 13.0, *)) {
      rootView.backgroundColor = [UIColor systemBackgroundColor];
  } else {
      rootView.backgroundColor = [UIColor whiteColor];
  }

  self.window = [[UIWindow alloc] initWithFrame:[UIScreen mainScreen].bounds];
  UIViewController *rootViewController = [UIViewController new];
  rootViewController.view = rootView;
  self.window.rootViewController = rootViewController;
  [self.window makeKeyAndVisible];
  return YES;
}

- (NSURL *)sourceURLForBridge:(RCTBridge *)bridge
{
#if DEBUG
  return [[RCTBundleURLProvider sharedSettings] jsBundleURLForBundleRoot:@"index" fallbackResource:nil];
#else
  return [[NSBundle mainBundle] URLForResource:@"main" withExtension:@"jsbundle"];
#endif
}

@end

Here is my 'ios/easyfarm/AppDelegate.h'

#import <React/RCTBridgeDelegate.h>
#import <UIKit/UIKit.h>
#import <Crisp/Crisp.h>

@interface AppDelegate : UIResponder <UIApplicationDelegate, RCTBridgeDelegate>

@property (nonatomic, strong) UIWindow *window;

@end

As you can see, I do have a Swift file, a bridging header, and I added Privacy - Camera Usage Description and Privacy - Photo Library Additions Usage Description into my Info.plist.

Captura de Tela 2021-10-15 às 15 05 42

Android: Exoplayer MultiDex Crash

Following the instructions:

`import im.crisp.client.Crisp;

// Fixes multiDex error
import androidx.multidex.MultiDexApplication;

public class MainApplication extends MultiDexApplication implements ReactApplication {
...
`

results in a crash where Exoplayer path cannot be found at runtime. Using React Native 64. Adding implementation in gradle for Exoplayer 2 13 does nothing to improve the issue.

Caused by: java.lang.ClassNotFoundException: Didn't find class "com.google.android.exoplayer2.drm.DefaultDrmSessionEventListener" on path: DexPathList[[zip file "/data/app/com.<APPNAME>-8zolvrwpAJkqGhXfmrSMxg==/base.apk"],nativeLibraryDirectories=[/data/app/com.<APPNAME>-8zolvrwpAJkqGhXfmrSMxg==/lib/arm64, /data/app/com.<APPNAME>-8zolvrwpAJkqGhXfmrSMxg==/base.apk!/lib/arm64-v8a, /system/lib64]] at dalvik.system.BaseDexClassLoader.findClass(BaseDexClassLoader.java:196) at java.lang.ClassLoader.loadClass(ClassLoader.java:379) at java.lang.ClassLoader.loadClass(ClassLoader.java:312) at com.brentvatne.react.ReactVideoPackage.createViewManagers(ReactVideoPackage.java:42)  at com.facebook.react.ReactInstanceManager.getOrCreateViewManagers(ReactInstanceManager.java:857)  at com.facebook.react.CoreModulesPackage.createUIManager(CoreModulesPackage.java:196)  at com.facebook.react.CoreModulesPackage.getModule(CoreModulesPackage.java:161)  at com.facebook.react.TurboReactPackage$ModuleHolderProvider.get(TurboReactPackage.java:159)  at com.facebook.react.TurboReactPackage$ModuleHolderProvider.get(TurboReactPackage.java:147)  at com.facebook.react.bridge.ModuleHolder.create(ModuleHolder.java:191)  at com.facebook.react.bridge.ModuleHolder.getModule(ModuleHolder.java:156)  at com.facebook.react.bridge.NativeModuleRegistry.getModule(NativeModuleRegistry.java:149)  at com.facebook.react.bridge.CatalystInstanceImpl.getNativeModule(CatalystInstanceImpl.java:488)  at com.facebook.react.bridge.CatalystInstanceImpl.getNativeModule(CatalystInstanceImpl.java:464)  at com.facebook.react.uimanager.UIManagerHelper.getUIManager(UIManagerHelper.java:91)  at com.facebook.react.uimanager.UIManagerHelper.getUIManager(UIManagerHelper.java:46)  at com.facebook.react.ReactInstanceManager.attachRootViewToInstance(ReactInstanceManager.java:1142)  at com.facebook.react.ReactInstanceManager.setupReactContext(ReactInstanceManager.java:1090)  at com.facebook.react.ReactInstanceManager.access$1500(ReactInstanceManager.java:131)  at com.facebook.react.ReactInstanceManager$5$2.run(ReactInstanceManager.java:1044)  at android.os.Handler.handleCallback(Handler.java:883)  at android.os.Handler.dispatchMessage(Handler.java:100)  at com.facebook.react.bridge.queue.MessageQueueThreadHandler.dispatchMessage(MessageQueueThreadHandler.java:27)  at android.os.Looper.loop(Looper.java:237)  at com.facebook.react.bridge.queue.MessageQueueThreadImpl$4.run(MessageQueueThreadImpl.java:226)  at java.lang.Thread.run(Thread.java:919)  2021-11-10 12:13:58.479 13419-13569/com.<APPNAME> E/AndroidRuntime: FATAL EXCEPTION: mqt_native_modules Process: com.<APPNAME>, PID: 13419 java.lang.NoClassDefFoundError: Failed resolution of: Lcom/google/android/exoplayer2/drm/DefaultDrmSessionEventListener; at com.brentvatne.react.ReactVideoPackage.createViewManagers(ReactVideoPackage.java:42) at com.facebook.react.ReactInstanceManager.getOrCreateViewManagers(ReactInstanceManager.java:857) at com.facebook.react.CoreModulesPackage.createUIManager(CoreModulesPackage.java:196) at com.facebook.react.CoreModulesPackage.getModule(CoreModulesPackage.java:161) at com.facebook.react.TurboReactPackage$ModuleHolderProvider.get(TurboReactPackage.java:159) at com.facebook.react.TurboReactPackage$ModuleHolderProvider.get(TurboReactPackage.java:147) at com.facebook.react.bridge.ModuleHolder.create(ModuleHolder.java:191) at com.facebook.react.bridge.ModuleHolder.getModule(ModuleHolder.java:156) at com.facebook.react.bridge.NativeModuleRegistry.getModule(NativeModuleRegistry.java:149) at com.facebook.react.bridge.CatalystInstanceImpl.getNativeModule(CatalystInstanceImpl.java:488) at com.facebook.react.bridge.CatalystInstanceImpl.getNativeModule(CatalystInstanceImpl.java:464) at com.facebook.react.uimanager.UIManagerHelper.getUIManager(UIManagerHelper.java:91) at com.facebook.react.uimanager.UIManagerHelper.getUIManager(UIManagerHelper.java:46) at com.facebook.react.ReactInstanceManager.attachRootViewToInstance(ReactInstanceManager.java:1142) at com.facebook.react.ReactInstanceManager.setupReactContext(ReactInstanceManager.java:1090) at com.facebook.react.ReactInstanceManager.access$1500(ReactInstanceManager.java:131) at com.facebook.react.ReactInstanceManager$5$2.run(ReactInstanceManager.java:1044) at android.os.Handler.handleCallback(Handler.java:883) at android.os.Handler.dispatchMessage(Handler.java:100) at com.facebook.react.bridge.queue.MessageQueueThreadHandler.dispatchMessage(MessageQueueThreadHandler.java:27) at android.os.Looper.loop(Looper.java:237) at com.facebook.react.bridge.queue.MessageQueueThreadImpl$4.run(MessageQueueThreadImpl.java:226) at java.lang.Thread.run(Thread.java:919) Caused by: java.lang.ClassNotFoundException: Didn't find class "com.google.android.exoplayer2.drm.DefaultDrmSessionEventListener" on path: DexPathList[[zip file "/data/app/com.<APPNAME>-8zolvrwpAJkqGhXfmrSMxg==/base.apk"],nativeLibraryDirectories=[/data/app/com.<APPNAME>-8zolvrwpAJkqGhXfmrSMxg==/lib/arm64, /data/app/com.<APPNAME>-8zolvrwpAJkqGhXfmrSMxg==/base.apk!/lib/arm64-v8a, /system/lib64]] at dalvik.system.BaseDexClassLoader.findClass(BaseDexClassLoader.java:196) at java.lang.ClassLoader.loadClass(ClassLoader.java:379) at java.lang.ClassLoader.loadClass(ClassLoader.java:312) at com.brentvatne.react.ReactVideoPackage.createViewManagers(ReactVideoPackage.java:42)  at com.facebook.react.ReactInstanceManager.getOrCreateViewManagers(ReactInstanceManager.java:857)  at com.facebook.react.CoreModulesPackage.createUIManager(CoreModulesPackage.java:196)  at com.facebook.react.CoreModulesPackage.getModule(CoreModulesPackage.java:161)  at com.facebook.react.TurboReactPackage$ModuleHolderProvider.get(TurboReactPackage.java:159)  at com.facebook.react.TurboReactPackage$ModuleHolderProvider.get(TurboReactPackage.java:147)  at com.facebook.react.bridge.ModuleHolder.create(ModuleHolder.java:191)  at com.facebook.react.bridge.ModuleHolder.getModule(ModuleHolder.java:156)  at com.facebook.react.bridge.NativeModuleRegistry.getModule(NativeModuleRegistry.java:149)  at com.facebook.react.bridge.CatalystInstanceImpl.getNativeModule(CatalystInstanceImpl.java:488)  at com.facebook.react.bridge.CatalystInstanceImpl.getNativeModule(CatalystInstanceImpl.java:464)  at com.facebook.react.uimanager.UIManagerHelper.getUIManager(UIManagerHelper.java:91)  at com.facebook.react.uimanager.UIManagerHelper.getUIManager(UIManagerHelper.java:46)  at com.facebook.react.ReactInstanceManager.attachRootViewToInstance(ReactInstanceManager.java:1142)  at com.facebook.react.ReactInstanceManager.setupReactContext(ReactInstanceManager.java:1090)  at com.facebook.react.ReactInstanceManager.access$1500(ReactInstanceManager.java:131)  at com.facebook.react.ReactInstanceManager$5$2.run(ReactInstanceManager.java:1044)  at android.os.Handler.handleCallback(Handler.java:883)  at android.os.Handler.dispatchMessage(Handler.java:100)  at com.facebook.react.bridge.queue.MessageQueueThreadHandler.dispatchMessage(MessageQueueThreadHandler.java:27)  at android.os.Looper.loop(Looper.java:237)  at com.facebook.react.bridge.queue.MessageQueueThreadImpl$4.run(MessageQueueThreadImpl.java:226)  at java.lang.Thread.run(Thread.java:919) 

Any suggestions @walterholohan ?

"No such module 'Crisp'" on iOS

Hi,

When trying to build the app with Xcode I get this error message, it doesn't appear on 1.xx releases but I want the latest one obviously,

Any idea?

Thanks,

Théo

Expo bare minimum template issue with swift compile

Hello, im not sure if im missing something but ive tried to install the npm package following the readme. Im using an expo bare minimum template which should work just like react-native. Im getting the following error when running the react-native ios after following all steps.

** BUILD FAILED **

The following build commands failed:
CompileSwift normal x86_64 /Users/carlosreyes/Zarmada/mobile-app-poc/MobileApp/node_modules/react-native-crisp-chat-sdk/ios/CrispChatSdk.swift
CompileSwift normal x86_64 /Users/carlosreyes/Zarmada/mobile-app-poc/MobileApp/node_modules/react-native-crisp-chat-sdk/ios/CrispChatView.swift
CompileSwiftSources normal x86_64 com.apple.xcode.tools.swift.compiler
(3 failures)

error Command failed with exit code 1.
info Visit https://yarnpkg.com/en/docs/cli/run for documentation about this command.

Fatal Exception: java.lang.NullPointerException

We've received some crash reports via Google Firebase Crashlytics.

Fatal Exception: java.lang.NullPointerException: Attempt to invoke virtual method 'java.lang.Object android.content.Context.getSystemService(java.lang.String)' on a null object reference at im.crisp.client.b.d.d.b.g() at im.crisp.client.b.d.d.b$a.intercept() at okhttp3.internal.http.RealInterceptorChain.proceed(RealInterceptorChain.java:147) at okhttp3.internal.connection.ConnectInterceptor.intercept(ConnectInterceptor.java:45) at okhttp3.internal.http.RealInterceptorChain.proceed(RealInterceptorChain.java:147) at okhttp3.internal.http.RealInterceptorChain.proceed(RealInterceptorChain.java:121) at okhttp3.internal.cache.CacheInterceptor.intercept(CacheInterceptor.java:93) at okhttp3.internal.http.RealInterceptorChain.proceed(RealInterceptorChain.java:147) at okhttp3.internal.http.RealInterceptorChain.proceed(RealInterceptorChain.java:121) at okhttp3.internal.http.BridgeInterceptor.intercept(BridgeInterceptor.java:93) at okhttp3.internal.http.RealInterceptorChain.proceed(RealInterceptorChain.java:147) at okhttp3.internal.http.RetryAndFollowUpInterceptor.intercept(RetryAndFollowUpInterceptor.java:127) at okhttp3.internal.http.RealInterceptorChain.proceed(RealInterceptorChain.java:147) at okhttp3.internal.http.RealInterceptorChain.proceed(RealInterceptorChain.java:121) at okhttp3.RealCall.getResponseWithInterceptorChain(RealCall.java:257) at okhttp3.RealCall$AsyncCall.execute(RealCall.java:201) at okhttp3.internal.NamedRunnable.run(NamedRunnable.java:32) at java.util.concurrent.ThreadPoolExecutor.runWorker(ThreadPoolExecutor.java:1133) at java.util.concurrent.ThreadPoolExecutor$Worker.run(ThreadPoolExecutor.java:607) at java.lang.Thread.run(Thread.java:762)

Device
Brand:samsung
Model:Galaxy A3(2016)
Orientation: Portrait
RAM free: 311.95 MB
Disk free: 1.16 GB

Operating System
Version:Android 7.0
Orientation: Portrait
Rooted:No

[!] CocoaPods could not find compatible versions for pod "Crisp":

I'm trying to install Crisp on a React Native 0.64.0 project

I have tried the last 3 versions of react-native-crisp-chat-sdk without success

Error when I want pod install :

[!] CocoaPods could not find compatible versions for pod "Crisp":
In Podfile:
react-native-crisp-chat-sdk (from ../node_modules/react-native-crisp-chat-sdk) was resolved to 0.11.0, which depends on
Crisp (= 1.6.1)

Specs satisfying the Crisp (= 1.6.1) dependency were found, but they required a higher minimum deployment target.

iOS Archive error

In debug mode, the SDK works fine, but on archive mode don't work.

My configs:
Captura de Tela 2022-08-02 às 16 50 20

Captura de Tela 2022-08-02 às 16 50 41

Captura de Tela 2022-08-02 às 16 51 11

Errors:
Captura de Tela 2022-08-02 às 16 51 54

Remember, this configuration works fine on debug mode.

[Android] from jcenter to maven

In RN 0.65, jcenter is removed in favor of maven

I have the following issue with crisp sdk:

Could not find com.google.android.exoplayer:exoplayer:2.13.0.
     Searched in the following locations:
       - https://repo.maven.apache.org/maven2/com/google/android/exoplayer/exoplayer/2.13.0/exoplayer-2.13.0.pom
       - file:/Users/mlecoq/.m2/repository/com/google/android/exoplayer/exoplayer/2.13.0/exoplayer-2.13.0.pom
       - https://customers.pspdfkit.com/maven/com/google/android/exoplayer/exoplayer/2.13.0/exoplayer-2.13.0.pom
       - file:/Users/mlecoq/Developer/archireport/dev/archireport_mobile/node_modules/react-native/android/com/google/android/exoplayer/exoplayer/2.13.0/exoplayer-2.13.0.pom
       - file:/Users/mlecoq/Developer/archireport/dev/archireport_mobile/node_modules/jsc-android/dist/com/google/android/exoplayer/exoplayer/2.13.0/exoplayer-2.13.0.pom
       - https://dl.google.com/dl/android/maven2/com/google/android/exoplayer/exoplayer/2.13.0/exoplayer-2.13.0.pom
       - https://maven.google.com/com/google/android/exoplayer/exoplayer/2.13.0/exoplayer-2.13.0.pom
       - https://www.jitpack.io/com/google/android/exoplayer/exoplayer/2.13.0/exoplayer-2.13.0.pom
     Required by:
         project :app > im.crisp:crisp-sdk:1.0.4

Android - Chat is not closing properly the first time

The Chat is opening without any problems but once i try to close it the first time, it stuck on loading "Starting chat...".
While debugging, i don't see any errors, and i found out that if i leave the app (let it running in the background) and go back, the chat is open and i can close it without any issues.
Sadly, i need to do those steps every time i start my app to have the chat working properly and it is frustrating.

Btw everything works fine on iOS

we are going to production this month, please i need help with this, thanks in advance

CRISP SDK : im.crisp:crisp-sdk:1.0.12
"react": "17.0.1"
"react-native": "0.64.3"

loading

Android resource linking failed

Hi !

First, thank you for this repository, very nice !

I'm trying to configure Crisp on an RN Android app but when I want to compile I have this error:

Screenshot 2021-06-27 at 12 40 01

My root build.gradle

buildscript {
    ext {
        buildToolsVersion = "29.0.2"
        minSdkVersion = 19
        compileSdkVersion = 29
        targetSdkVersion = 29
    }
    repositories {
        google()
        jcenter()
    }
    dependencies {
        classpath("com.android.tools.build:gradle:3.5.3")
        // NOTE: Do not place your application dependencies here; they belong
        // in the individual module build.gradle files
    }
}

My app/build.gradle

android {
   ...
    defaultConfig {
        ...
        multiDexEnabled true
    }
}

dependencies {
   ...
    implementation 'im.crisp:crisp-sdk:1.0.6'
    implementation 'androidx.multidex:multidex:2.0.1'
}

I'm still new to RN and I must be missing something ... Thank you very much in advance !!

iOS Not Building On React Native 0.68

Followed all the setup steps and working find on debug builds and on the emulator but on release builds get the following errors on compilation:

▸ Compiling CrispChatSdk.swift

❌  /Users/ankur/Documents/Code/company/node_modules/react-native-crisp-chat-sdk/ios/CrispChatSdk.swift:8:18: type 'CrispSDK' has no member 'setTokenID'

        CrispSDK.setTokenID(tokenID: id)
^



❌  /Users/ankur/Documents/Code/company/node_modules/react-native-crisp-chat-sdk/ios/CrispChatSdk.swift:13:18: type 'CrispSDK' has no member 'user'

        CrispSDK.user.email = email
        ~~~~~~~~ ^~~~~~~~~~



❌  /Users/ankur/Documents/Code/company/node_modules/react-native-crisp-chat-sdk/ios/CrispChatSdk.swift:18:18: type 'CrispSDK' has no member 'user'

        CrispSDK.user.nickname = nickname
        ~~~~~~~~ ^~~~



❌  /Users/ankur/Documents/Code/company/node_modules/react-native-crisp-chat-sdk/ios/CrispChatSdk.swift:22:18: type 'CrispSDK' has no member 'user'

        CrispSDK.user.phone = phone
        ~~~~~~~~ ^~~~



❌  /Users/ankur/Documents/Code/company/node_modules/react-native-crisp-chat-sdk/ios/CrispChatSdk.swift:27:18: type 'CrispSDK' has no member 'user'

        CrispSDK.user.avatar = URL(string: url)
        ~~~~~~~~ ^~~~



❌  /Users/ankur/Documents/Code/company/node_modules/react-native-crisp-chat-sdk/ios/CrispChatSdk.swift:32:18: type 'CrispSDK' has no member 'session'

        CrispSDK.session.segment = segment
        ~~~~~~~~ ^~~~



❌  /Users/ankur/Documents/Code/company/node_modules/react-native-crisp-chat-sdk/ios/CrispChatSdk.swift:37:18: type 'CrispSDK' has no member 'session'

        CrispSDK.session.setString(value, forKey: key)
        ~~~~~~~~ ^~~~~~~



❌  /Users/ankur/Documents/Code/company/node_modules/react-native-crisp-chat-sdk/ios/CrispChatSdk.swift:42:18: type 'CrispSDK' has no member 'session'

        CrispSDK.session.setString(String(value), forKey: key)
        ~~~~~~~~ ^~~~~~~



❌  /Users/ankur/Documents/Code/company/node_modules/react-native-crisp-chat-sdk/ios/CrispChatSdk.swift:47:18: type 'CrispSDK' has no member 'session'

        CrispSDK.session.setInt(value, forKey: key)
        ~~~~~~~~ ^~~~~~~



❌  /Users/ankur/Documents/Code/company/node_modules/react-native-crisp-chat-sdk/ios/CrispChatSdk.swift:52:18: type 'CrispSDK' has no member 'session'

        CrispSDK.session.pushEvent(Crisp.SessionEvent(name: eventName, color: color))
        ~~~~~~~~ ^~~~~~~



❌  /Users/ankur/Documents/Code/company/node_modules/react-native-crisp-chat-sdk/ios/CrispChatSdk.swift:52:54: argument passed to call that takes no arguments

        CrispSDK.session.pushEvent(Crisp.SessionEvent(name: eventName, color: color))
        ~~~~~~~~ ^~~~~~~



❌  /Users/ankur/Documents/Code/company/node_modules/react-native-crisp-chat-sdk/ios/CrispChatSdk.swift:57:18: type 'CrispSDK' has no member 'session'

        CrispSDK.session.reset()
                                                     ^~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~



❌  /Users/ankur/Documents/Code/company/node_modules/react-native-crisp-chat-sdk/ios/CrispChatSdk.swift:63:77: 'ChatViewController' is unavailable: cannot find Swift declaration for this class

            UIApplication.shared.windows.first?.rootViewController?.present(ChatViewController(), animated: true)
        ~~~~~~~~ ^~~~~~~


▸ Compiling CrispChatSdk.swift

can't send any custom user data

is there any way to send custom data other than specified fields ?

is there any way to support more for android? i just can send email and user name in android

Chatbox language is always English

Hi there!

First of all, thank you very much for the great work :)

I have an issue with the "example" project : the chatbox language is always English.

Please find hereafter the context to reproduce it:

  • Chatbox language : forced to be French (auto-detect disabled) from my crisp dashboard
  • iPhone / iOS simulator (v14.4) : French region + French language
  • react-native-crisp-chat-sdk : v0.6.0
  • Cocoapods : 1.10.1
  • Xcode : 12.4
  • yarn : 1.22.10

Nonetheless, when I run the example from the library on iOS simulator or a real device, the displayed language is still English. The same issue happens if the chatbox language detection is automatic.

Any clue?

Thanks for your help!

Android: build issue

Here is the logs I have when I want to build my app since today

* What went wrong:
Execution failed for task ':react-native-crisp-chat-sdk:androidDependencies'.
> Could not resolve all artifacts for configuration ':react-native-crisp-chat-sdk:debugRuntimeClasspath'.
   > Could not resolve com.facebook.react:react-native:+.
     Required by:
         project :react-native-crisp-chat-sdk
      > Failed to list versions for com.facebook.react:react-native.
         > Unable to load Maven meta-data from https://dl.bintray.com/crispim/crisp-maven/com/facebook/react/react-native/maven-metadata.xml.
            > Could not get resource 'https://dl.bintray.com/crispim/crisp-maven/com/facebook/react/react-native/maven-metadata.xml'.
               > Could not GET 'https://dl.bintray.com/crispim/crisp-maven/com/facebook/react/react-native/maven-metadata.xml'. Received status code 502 from server: Bad Gateway

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.