Closed benadamstyles closed 6 years ago
Which version of smooch-ios are you using? This issue was supposed to have been fixed in v6.6.1. You should now be able to correctly call login
before init
completes, it just has to have been called first
My Podfile.lock
says 6.6.1
. Ok, so maybe I'm having a different issue? I create a user in smooch v5 and send some messages, I update my app to use v6, and then the message thread is empty and I cannot send any messages. The issue sounds very similar to https://github.com/smooch/smooch-ios/issues/185
I'm going to close this for now until I can investigate further, thanks for your help.
@mspensieri A quick question: can we assume that if smooch.getUserId()
(i.e. [SKTUser currentUser].userId
) returns a user id string, that user is logged in and authorized to send messages? Or is it possible that the [SKTUser currentUser].userId
exists but the user has become unauthorized for some reason or other?
There are some situations where a user can have a userId
and yet still have invalid authorization. For example, if your secret key was revoked since the user logged in, or if you are generating JWTs with an expiry time which has since lapsed.
I believe you can tell the result of the login call by reacting to the promise that is returned by smooch.login()
@mspensieri Thanks for your help.
Hi, I'm having this issue: https://github.com/smooch/smooch-ios/issues/185
The solution is apparently to wait for
init
to complete before callinglogin
, but currently this is not possible inreact-native-smooch
becauseinit
is called in the native realm andlogin
is called in javascript – there is no way that I can find to know in js whetherinit
has completed successfully. I'm ready to submit a PR adding aninit
method callable from js but before I do I want to make sure that it will be accepted? There aren't any security issues with passing theappId
from js?