crisp-im / crisp-sdk-android

:package: Crisp Android SDK, add a chat in any Android app and communicate with your users.
https://docs.crisp.chat/guides/chatbox-sdks/android-sdk/
Other
55 stars 17 forks source link

Stuck on loading #26

Closed cecq closed 3 years ago

cecq commented 4 years ago

Hello, I tried to setup Crisp (v0.1.14) as documented, but the first time it loads the webview everything goes smooth while all the subsequent times it get stuck on loading:

Logcat reports just this warning:

I/chromium: [INFO:CONSOLE(1)] "Uncaught ReferenceError: initialize is not defined", source: (1)

Let me know if you need any additional logs or info to solve the issue. Thanks

hrossi commented 4 years ago

Hi there.

I'm having the same problem.

@cecq did you find any workaround?

gianpaolodn commented 4 years ago

We decided to not integrate crispy in our android app and use just messenger.

mathieudebrito commented 4 years ago

@hrossi Did you find a workaround for this ? Thanks :)

hrossi commented 4 years ago

Hi @mathieudebrito

Sadly, I didn't find any solution :(

mathieudebrito commented 4 years ago

Hi @hrossi, just found a fix that works for me (I hope it helps ;) ) :

My first thoughts were that the webview was just not well deleted. So I tried to ensure the deletion of the fragment (and its webview). I run into several issues including Duplicate ID, tag null, or parent id with another fragment for CrispFragment.

So I managed to create my own fragment that will contain the CrispFragment, and handle the CrispFragment instance's "Lifecycle" :

@EFragment(R.layout.my_useful_crisp_fragment)
public class MyUsefulCrispFragment extends Fragment {

    @Override
    public void onCreate(Bundle savedInstanceState) {
        super.onCreate(savedInstanceState);
        initCrispSDK();
    }

    public void initCrispSDK() {

        //initialize Crisp-SDK
    }

    @Override
    public void onViewCreated(View view, @Nullable Bundle savedInstanceState) {
        super.onViewCreated(view, savedInstanceState);
        FragmentManager fragmentManager = getActivity().getFragmentManager();

        CrispFragment fragment = (CrispFragment) fragmentManager.findFragmentByTag("crispFragment");

        if (fragment == null) {
            fragment = new CrispFragment();
            FragmentTransaction ft = fragmentManager.beginTransaction();
            ft.add(R.id.crispFragmentContainer, fragment, "crispFragment");
            ft.commit();
            fragmentManager.executePendingTransactions();
        } else {
            Logs.debug(this, "Creating new CrispFragment");
        }
    }

    @Override
    public void onDestroyView() {
        super.onDestroyView();

        if (getFragmentManager() != null) {
            FragmentManager fragmentManager = getActivity().getFragmentManager();
            CrispFragment fragment = (CrispFragment) fragmentManager.findFragmentByTag("crispFragment");
            if (fragment != null) {
                fragmentManager.beginTransaction().remove(fragment).commit();
            }
        }
    }
}

(layouts/my_useful_crisp_fragment)

<?xml version="1.0" encoding="utf-8"?>
<FrameLayout xmlns:android="http://schemas.android.com/apk/res/android"
    android:layout_width="match_parent"
    android:layout_height="match_parent"
    android:id="@+id/crispFragmentContainer"
    android:orientation="horizontal">

</FrameLayout>
walterholohan commented 4 years ago

Hey @mathieudebrito do you think it would be possible to use this approach in my React Native library(https://github.com/walterholohan/react-native-crisp-chat-sdk) for this SDK. At the moment I just inflate the Fragment into a linear layout view (https://github.com/walterholohan/react-native-crisp-chat-sdk/blob/master/android/src/main/java/com/reactnativecrispchatsdk/CrispChatView.java) but if I render the screen for a second time I get the Duplicate ID, tag null, or parent id with another fragment for CrispFragment error. Android development wouldn't be my expertise so any help in fixing this would be very grateful. I am using this SDK in a React-Native project of mine.

mbaochaEHA commented 4 years ago

This bug have been on for a year. Why is the crisp team so uninterested in resolving this. we had to abandon crisp for this singular reason. Every other works perfectly for us. Its so annoying. They rarely respond to email or are they out of business? Great product. zero customer service

mathieudebrito commented 4 years ago

@walterholohan No idea :( The main thing to ensure is to delete everything and recreate everything between 2 display of the CrispFragment

baptistejamin commented 4 years ago

We are working on a brand new version of the Crisp SDK. It's currently in development and should be released in the coming weeks.

I do agree this current release is obviously unperfect.

The next version will be fully native

mathieudebrito commented 4 years ago

Thank you @baptistejamin ! Is there an ETA for the new version ? Could you also and in the meanwhile accept merge requests ?

walterholohan commented 4 years ago

Great stuff @baptistejamin. I look forward to the new version. Once it's released I will integrate it into the react-native wrapper.

walterholohan commented 4 years ago

@walterholohan No idea :( The main thing to ensure is to delete everything and recreate everything between 2 display of the CrispFragment

Thanks for the reply @mathieudebrito. I will give it a go and let you know how I get on.

TayyabaAslam3317 commented 4 years ago

Did anyone find a solution for that fragment issue?

kendallshain commented 4 years ago

@baptistejamin Thanks! Do you have an ETA on the release? Re: your comment on May 22

baptistejamin commented 4 years ago

You can expect a beta in 2 weeks

Sent from my iPhone

On 2 Jul 2020, at 19:50, kendallshain notifications@github.com wrote:

 @baptistejamin Thanks! Do you have an ETA on the release? Re: your comment on May 22

— You are receiving this because you were mentioned. Reply to this email directly, view it on GitHub, or unsubscribe.

anjar10 commented 3 years ago

Hello @baptistejamin, is beta version already released?

gardyna commented 3 years ago

It's been well over a year since this has been opened. I'm also getting infinite loading. Is there ANY estimate on when the native version cause the current version is barely useable. or at least something to fix this infinite loading thing

mathieudebrito commented 3 years ago

I'm not 100% sure of what I will tell you, but I still hope it will help : Since they are working on a new SDK, I guess they won't really look at this issue since it may become irrelevant.

walterholohan commented 3 years ago

@baptistejamin any update on when you are going to release the new version of the android SDK?

eliottvincent commented 3 years ago

Hello there. We published the early beta of the Crisp Android native SDK. You can find it here: https://github.com/crisp-im/crisp-sdk-android/tree/beta

walterholohan commented 3 years ago

Hey @eliottvincent. Thank you. I am now using the new beta version in https://github.com/walterholohan/react-native-crisp-chat-sdk and it works great. When do you expect to release a stable version? And will the stable version include the API methods just like the iOS sdk does?

eliottvincent commented 3 years ago

Awesome! I don't have any ETA for the stable version. The goal is indeed to have the same possibilities between Android and iOS versions.