JivoChat / JivoSDK-Android

The Jivo Mobile SDK allows you to embed the Jivo chat into your Android mobile applications to receive customer requests
https://www.jivochat.com
10 stars 5 forks source link

Documentation for react native #68

Closed Art114 closed 3 months ago

Art114 commented 1 year ago

Нету документации для React Native на вызав метод Jivo.setClientInfo() и Jivo.setContactInfo()

AndrewNes commented 1 year ago

Вам следует изменить в модуле: import com.jivosite.sdk.support.builders.ClientInfo; на import com.jivosite.sdk.support.builders.ContactInfo; (+ добавить import android.os.Handler;) и изменить

@ReactMethod
 public void setClientInfo(String phone, String description) {
        Jivo.setClientInfo(
            new ClientInfo.Builder()
                .setPhone(phone)
                .setDescription(description)
                .build());
   }

на

@ReactMethod
   public void setClientInfo(String name, String email, String phone, String description) {
        ReactApplicationContext context = getReactApplicationContext();
        ContactInfo info = new ContactInfo(name, email, phone, description);
        Handler handler = new Handler(context.getMainLooper());
        handler.post(new Runnable() {
            public void run() {
                Jivo.setContactInfo(info);
            }
        });
   }

также следует добавить в .../android/app/build.gradle

android {
   // ...
   buildFeatures {
      dataBinding = true
   }
   // ....
}