taskrabbit / react-native-zendesk-chat

React Native Wrapper around Zendesk Chat v2
MIT License
130 stars 126 forks source link

API to remove ZENDESK instance #145

Open CherukuriSiva opened 1 year ago

CherukuriSiva commented 1 year ago

Dear contributors,

Thank you for maintaining this repo. We are using this library in one of our applications to display Zendesk chat. It is working fine however we observed this library taking large amount of RAM(200+ MB) due to this some of our end users who are using Older android phones facing issues. Our app getting freezes and they are not able to click any of the options.

We believe once we call init() API, Zendesk instance will be created and this instance will stay in the memory entire app life cycle. So we are looking for an API to remove Zendesk instance from the memory when end user close the Chat. Currently we can see below APIs in this library:

class RNZendeskChatModuleImpl {
        /**
         * Must be called before calling startChat/setVisitorInfo
         * - (Advanced users may configure this natively instead of calling this from JS)
         */
        init: (zendeskAccountKey: string, appId?: string) => void;

        /**
         * Presents the Zendesk Chat User Interface
         */
        startChat: (options: StartChatOptions) => void;
        /**
         * Backwards Compatibility!
         * - You can pass all these parameters to RNZendeskChatModule.startChat
         * - So you should probably prefer that method
         */
        setVisitorInfo: (options: VisitorInfoOptions) => void;

        /**
         * Configure the token to start receiving Push Notifications
         */
        registerPushToken: (token: string) => void;

        /**
         * Check if there are available agents
         */
        areAgentsOnline: () => Promise<Boolean>;
    }

We don't have any API to remove instance from the memory. So any guidance will be appreciated.

Please find below screenshot, which shows RAM usage before adding Zendesk library and after adding Zendesk library:

zendesk-ram-usage