Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Callback for starting chat errors #119

Closed
francescogatto opened this issue May 26, 2022 · 3 comments
Closed

Callback for starting chat errors #119

francescogatto opened this issue May 26, 2022 · 3 comments

Comments

@francescogatto
Copy link

In this moment, if the sdk have some problems to connect to the chat, the developer cannot do nothing and user see a bad dialog that ask to retry. In my case, some conversation doesn't work and the unique method is to change the token session for that user. So i ask a callback error from your sdk to the android app, so the developer can manage it

@Doc1faux
Copy link
Collaborator

Doc1faux commented May 27, 2022

Hi @francescogatto and thank you for your feedback.

Upon chat initialization (first 15s), if any error occured until a complete connection to the chat socket, this error dialog appears.

Here, the user is given 2 options:

  • Hit the "TRY AGAIN" button and relaunch the connection process,
  • Hit the "CANCEL" button to exit the Crisp chat and go back to the app.

What you wish from the SDK is to fire a callback when the error occured or before relaunching the whole connection process when the user hits the "TRY AGAIN" button? In both ways, I think the SDK will need the feedback that the hosting app has handled the error (doing something or not) in order to relaunch the connection process knowing that the app has finish handling the error.

As in the future, the Crisp chat should be embeddable as a fragment (#70), all this process should be managed by the Crisp class from the app perspective. We could provide in it a new ConnectionErrorListener which could be set by a new configure call along the existing one (which will set it to null to keep the current behavior) or by its own setter. For the callback itself, it could be either synchrone or asynchrone depending on when we fire the error to the app, when the error occurs or on the "TRY AGAIN" tap. I confess I prefer the 2nd solution as the existing code to try again the chat connection is already async ;)

  public interface ConnectionErrorListener
  {
    // SYNC
    boolean onConnectionError();
    // OR ASYNC
    onConnectionError(@NonNull final Runnable onComplete);
  }

  public static void configure(@NonNull Context context, @NonNull String websiteID, @Nullable ConnectionErrorListener listener);

  public static void setConnectionErrorListener(@Nullable ConnectionErrorListener listener)

Let me know if this is what you expected :)

@Doc1faux Doc1faux changed the title Callback for errors Callback for starting chat errors Jun 9, 2022
@Doc1faux
Copy link
Collaborator

Hi @francescogatto

1.0.13 has just been released and it could fix the issue about the "Starting chat" dialog.
Could you give it a try?

If you want more details about it, I have opened issue #133 especially to explain what has been fixed.

@Doc1faux
Copy link
Collaborator

Doc1faux commented Feb 5, 2024

Without any feedback since more than a year, I consider this issue fixed.
Closing it.

@Doc1faux Doc1faux closed this as completed Feb 5, 2024
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Development

No branches or pull requests

2 participants