Commit 9fc4c326 by Kunj Gupta

Added - User id and email for authrozation and each request.

parent 7e1fac5c
......@@ -62,6 +62,9 @@ public class ChatActivity extends HandleNotificationActivity implements OnDSList
private static String NEW_MESSAGE_MESSAGE = "message";
private static String IS_END_OF_INTENT = "is_end_of_intent";
private static String CLIENT_MESSAGE_KEY = "message";
private static String CLIENT_MAIL_KEY = "user_email";
private static final int CHECK_CODE = 102;
private RecyclerView mMessagesView;
......@@ -251,7 +254,16 @@ public class ChatActivity extends HandleNotificationActivity implements OnDSList
addMessage(mLoggedInUsername, message);
// perform the sending message attempt.
mSocket.emit(NEW_MESSAGE, message);
JSONObject jsonObject = new JSONObject();
try {
jsonObject.put(CLIENT_MESSAGE_KEY, message);
jsonObject.put(CLIENT_MAIL_KEY, PrefManager.getSharedPref(this, PrefManager.PREFERENCE_USER_EMAIL_ID));
} catch (JSONException e) {
e.printStackTrace();
}
CatalogueLog.e("jsonObject: "+jsonObject);
mSocket.emit(NEW_MESSAGE, jsonObject);
}
private void scrollToBottom() {
......@@ -397,6 +409,8 @@ public class ChatActivity extends HandleNotificationActivity implements OnDSList
private void userAuthenticateTask() {
String token = "token";
String url = "url";
String userEmail = "user_email";
String userId = "user_id";
String authentication = "authentication";
CatalogueLog.e("USER IS TRYING TO MAKING AUTHORIZED CONNECTION");
......@@ -417,6 +431,8 @@ public class ChatActivity extends HandleNotificationActivity implements OnDSList
try {
jsonObject.put(token, "Bearer " + accessToken);
jsonObject.put(url, userDetailURL);
jsonObject.put(userId, PrefManager.getSharedPref(ChatActivity.this, PrefManager.PREFERENCE_USER_ID));
jsonObject.put(userEmail, PrefManager.getSharedPref(ChatActivity.this, PrefManager.PREFERENCE_USER_EMAIL_ID));
CatalogueLog.e(jsonObject.toString());
} catch(JSONException e) {
CatalogueLog.e("userAuthenticateTask: JSONException: "+e.toString());
......
Markdown is supported
0% or
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or sign in to comment