ttdatt / react-native-video-quickblox

Quickblox video calling React Native package
MIT License
12 stars 5 forks source link

Fix callerId Android when receiving a call #2

Closed tiendn closed 6 years ago

tiendn commented 6 years ago

There is no "userId" in getUserInfo(), replace by function getCallerID()

@Override
public void onReceiveNewSession(QBRTCSession qbrtcSession) {

                if (session != null && qbrtcSession.getSessionID().equals(session.getSessionID())) {
                    session.rejectCall(new HashMap<String, String>() {{
                        put("key", "value");
                    }});
                    return;
                }

                setSession(qbrtcSession);
                //[self.localViewManager attachLocalCameraStream:self.session];

// --> Change this line
                quickbloxClient.receiveCallSession(session, qbrtcSession.getCallerID());
}
ttdatt commented 6 years ago

Thank you for the fix

tiendn commented 6 years ago

After reading iOS module, I think, we don't need change getCallerID() above. The problem with this code below, you forgot to add userId in NSDictionary then Android receive no userId:

NSString* userId = [NSString stringWithFormat:@"%lu", self.currentUser.ID]; // <-- Add this line
NSDictionary *userInfo = @{ @"callRequestId": callRequestId,
                                @"sessionId": self.session.ID,
                                @"realName": realName,
                                @"avatar": avatar,
                                @"userId": userId};  // <-- Here.