Skip to content
This repository has been archived by the owner on Jun 2, 2022. It is now read-only.

await FlutterFreshchat.identifyUser() is returning empty string when restoreId is not passed #11

Open
daadu opened this issue Jul 25, 2019 · 18 comments

Comments

@daadu
Copy link
Contributor

daadu commented Jul 25, 2019

await FlutterFreshchat.identifyUser(
    externalID: accountId,
    restoreID: null,
  );

returns an empty string every time instead of restoreId generated by Freshchat.

PS: I am using the free plan of FreshChat

@daadu
Copy link
Contributor Author

daadu commented Jul 25, 2019

This was tested on Android

@fayeed
Copy link
Owner

fayeed commented Jul 25, 2019

@daadu try passing an empty string rather than null to restoreId

@daadu
Copy link
Contributor Author

daadu commented Jul 25, 2019

Strange. The Activity gets killed or something at times. Anyways, still, the same issue returning an empty string.

@fayeed
Copy link
Owner

fayeed commented Jul 25, 2019

@daadu I looked through the issue it doesn't generate a restoreId unless you start a conversation after that if you identify the user you should get a restoreId. I think this has to with Freshchat, not with this plugin as it is stated in the Freshchat Android docs: "Restore Id for a user is typically generated only when the user has sent a message."

@fayeed
Copy link
Owner

fayeed commented Jul 25, 2019

Also, you can pass null to the identifyUser method that should work too.

@daadu
Copy link
Contributor Author

daadu commented Jul 25, 2019

Strange! anyways I will implement that way and test.Till then keep this issue open.

@daadu
Copy link
Contributor Author

daadu commented Jul 25, 2019

In my current flow, I identify -> then add user detail -> then start conversation. I guess I should add user detail -> then start conversation -> then identify.

@fayeed
Copy link
Owner

fayeed commented Jul 25, 2019

This will also wont work if you are trying to sync conversations so I think the best way would be to check if the user has a restoreId stored locally or the server if he has identify the user or if not start the conversation and then identify.

@fayeed
Copy link
Owner

fayeed commented Jul 30, 2019

@daadu going to close this issue if the problem persists feel free to open the issue again

@fayeed fayeed closed this as completed Jul 30, 2019
@daadu
Copy link
Contributor Author

daadu commented Nov 3, 2019

@fayeed Not working. Sorry for responding late.

Empty string returned by FlutterFreshchat.identifyUser even after a conversation is initiated and responded.

@fayeed fayeed reopened this Nov 8, 2019
@fayeed
Copy link
Owner

fayeed commented Nov 8, 2019

I have re-opened this issue again but I don't have time to work on it if you can fix this please do create a pull request or wait till someone else or I fix this.

@fayeed fayeed added the bug Something isn't working label Nov 8, 2019
@fayeed
Copy link
Owner

fayeed commented Nov 13, 2019

@daadu I just checked this issue I see no problem, It might be because you also need to update the user info.

Here I tested it and its working:
Simulator Screen Shot - iPhone 11 Pro Max - 2019-11-13 at 21 39 17

@daadu
Copy link
Contributor Author

daadu commented Dec 9, 2019

getting an empty string from identifyUser for my credentials. My freshchat account is on the free plan (not trial). I am guessing the issue could be related to this.

@deebhasin
Copy link

I am also facing the same issue...did you find a fix?

@daadu
Copy link
Contributor Author

daadu commented Feb 7, 2020

No, it looks like the issue because of free plan. Although not sure.

@rahuldange09
Copy link

As per docs. Restore Id is asynchronous and typically only initiated when conversion starts for first time.
So as per their sample app and docs. We have to create Broadcast receiver on android so when it's created for first time. It will be passed by broadcast receiver. (I'm not sure of ios though)
And then from native android we can call a flutter method which will give restore id when it becomes available.

@ashim-ux
Copy link

ashim-ux commented Nov 2, 2020

by changing restoreId == "" to restoreId.equals("") in FlutterFreshchatPlugin in android module, empty restoreId issue will be resolved

@phil10xs
Copy link

by changing restoreId == "" to restoreId.equals("") in FlutterFreshchatPlugin in android module, empty restoreId issue will be resolved

How about iOS?? I am having issues with the FlutterFreshchat.identifyUser. Prints this error Could not cast value of type 'NSNull' (0x7fff86b92b38) to 'NSString' (0x7fff86bb7bb0). And crashes when it tries to identify user. What values do I use for externalID and restoreID to prevent crash..

Sign up for free to subscribe to this conversation on GitHub. Already have an account? Sign in.
Labels
None yet
Projects
None yet
Development

No branches or pull requests

6 participants