Giter Club home page Giter Club logo

Comments (13)

Rishabh-Raghunath avatar Rishabh-Raghunath commented on June 11, 2024

The process of initializing Mobilisten is asynchronous in nature.
The initWithAppKey API comes with a completion closure within which the status of initialization is provided.

APIs like ZohoSalesIQ.Chat.show() require that Mobilisten is successfully initialized before invocation.
If you wish to open chat immediately after initialization, here is how you can do it;

ZohoSalesIQ.initWithAppKey(appKey, accessKey: accessKey) { (success) in
  if success {
    ZohoSalesIQ.Chat.show()
  }
}

We do have plans to provide an error in return as well in the API. Using the completion closure provided with the initWithAppKey API should resolve your issue.

from salesiq-mobilisten-ios.

ammarmarn avatar ammarmarn commented on June 11, 2024

ok, so do you have any method to check whether SDK is initialized or not? So I can check before calling ZohoSalesIQ.Chat.show(). Incase, I have calling init in AppDelegate for example in order to avoid wait for the user when help button tapped in ViewController.

from salesiq-mobilisten-ios.

Rishabh-Raghunath avatar Rishabh-Raghunath commented on June 11, 2024

Yes we do. ZohoSalesIQ.Chat.isEnabled can be used to check the state.

from salesiq-mobilisten-ios.

ammarmarn avatar ammarmarn commented on June 11, 2024

Right now faced one more issue, the sdk is initialized while Invoking ZohoSalesIQ.Chat.show() I am getting the following error, and no chat window is visible;

"Could not signal service com.apple.WebKit.WebContent: 113: Could not find specified service"

from salesiq-mobilisten-ios.

Rishabh-Raghunath avatar Rishabh-Raghunath commented on June 11, 2024

Hi @ammarmarn, the message shared is not related to the Chat.show() API or the chat window.
Could you share more details on how and where the API is being invoked?

from salesiq-mobilisten-ios.

ammarmarn avatar ammarmarn commented on June 11, 2024

In the ViewController I am initializing the SDK, while when support button is pressed then setting some user info and then showing chat window.

    override func viewDidLoad() {
        ZohoHandler.setupZohoChat()
    }

    @IBAction func supportBtnTapped(_ sender: UIButton) {
        let visitor = VisitorClass.init()
        visitor.setName(userName)
        visitor.setEmail(email)
        ZohoSalesIQ.Chat.show()
   }

from salesiq-mobilisten-ios.

Rishabh-Raghunath avatar Rishabh-Raghunath commented on June 11, 2024

If Mobilisten is initialized at the time of invoking the ZohoSalesIQ.Chat.show() API, everything should work.
Is the button using which the chat is opened made visible only after successful initialization?

I would also like to point out that the visitor information is being incorrectly set in the shared code snippet.
Please set the information as shown below;

ZohoSalesIQ.Visitor.setName(userName)
ZohoSalesIQ.Visitor.setEmail(userEmail)

I would also highly suggest having Mobilisten initialized in the AppDelegate within the application(_:didFinishLaunchingWithOptions:) method. This way, ZohoSalesIQ.initWithAppKey is called only once, and not every time an instance of the view controller loads within the viewDidLoad method.

Could you try applying the above suggestions and let us know if everything works as expected?

from salesiq-mobilisten-ios.

ammarmarn avatar ammarmarn commented on June 11, 2024

Thanks for the suggestions I will incorporate them, one thing want to ask that instead of removing initialization in viewDidLoad() I am thinking to check if SDK is initialized if not then initialize it within the check.

  override func viewDidLoad() {
    if !ZohoSalesIQ.Chat.isEnabled {
          ZohoSalesIQ.initWithAppKey
        }
   }

from salesiq-mobilisten-ios.

Rishabh-Raghunath avatar Rishabh-Raghunath commented on June 11, 2024

This would not be needed since Chat may be disabled for other reasons as well. For example, if you choose to hide the chat option when operators are offline.

Within the viewDidLoad method of a view controller, the value for ZohoSalesIQ.Chat.isEnabled alone can be checked and the chat button can then be made visible if it's true and similarly be hidden if the value is false.

from salesiq-mobilisten-ios.

ammarmarn avatar ammarmarn commented on June 11, 2024

I have splitVC on which Support is an option that's always visible (can't hide it) and can be selected anytime/mulitple times.
Screenshot 2021-09-23 at 7 00 10 PM
And following is simple code when support selected
Screenshot 2021-09-23 at 7 01 50 PM

What do you suggest will be suitable if "ZohoSalesIQ.Chat.isEnabled" returns false. Shall I then call following. But problem is I don't know when it will return and what if user selected any other side menu option meanwhile popping up chat window later on suddenly will make bad user experience.

ZohoSalesIQ.initWithAppKey(appKey, accessKey: accessKey) { (success) in
  if success {
    ZohoSalesIQ.Chat.show()
  } }

from salesiq-mobilisten-ios.

ammarmarn avatar ammarmarn commented on June 11, 2024

Apart from above question I got this crash:
"NSInvalidArgumentException: Application tried to present modally a view controller <Mobilisten.LCNavigationController: 0x14a8f9400> that is already being presented by <Marn.BaseSlidingController: 0x14b525590>."
What do you think can be the cause? (although I think this could be when user multiple tap on support button, but if I am trying to reproduce I am not getting this crash though).

from salesiq-mobilisten-ios.

Rishabh-Raghunath avatar Rishabh-Raghunath commented on June 11, 2024

I have splitVC on which Support is an option that's always visible (can't hide it) and can be selected anytime/mulitple times.
Screenshot 2021-09-23 at 7 00 10 PM
And following is simple code when support selected
Screenshot 2021-09-23 at 7 01 50 PM

What do you suggest will be suitable if "ZohoSalesIQ.Chat.isEnabled" returns false. Shall I then call following. But problem is I don't know when it will return and what if user selected any other side menu option meanwhile popping up chat window later on suddenly will make bad user experience.

ZohoSalesIQ.initWithAppKey(appKey, accessKey: accessKey) { (success) in
  if success {
    ZohoSalesIQ.Chat.show()
  } }

The value for ZohoSalesIQ.Chat.isEnabled is false when the option to open chat is not to be shown.

The value can be false in the following cases:

  1. Mobilisten is not initialized.
  2. The user is IP blocked by an operator.
  3. All departments are offline and you choose to hide chat during the time.
  4. If the current time falls outside the configured business hours and you choose to hide chat during the time.

In this case, you may display the "Support" option as disabled (greyed out) or be hidden.
You may refresh the list once when the init completion closure is executed.

from salesiq-mobilisten-ios.

Rishabh-Raghunath avatar Rishabh-Raghunath commented on June 11, 2024

We hope that the API reference provided answers your question. We are closing this issue since it has had no recent activity.
Please feel free to get back to us through the comments in case you have further queries.
Thanks.

from salesiq-mobilisten-ios.

Related Issues (20)

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.