Commit b4ea5dd4 by Kunj Gupta

Added authorized user for chat, but is not done.

parent 064686d9
......@@ -13,6 +13,7 @@ import com.github.nkzawa.emitter.Emitter;
import com.github.nkzawa.socketio.client.Socket;
import com.google.android.gms.analytics.Tracker;
import com.vsoft.servicenow.chat.ChatActivity;
import com.vsoft.servicenow.utils.Constants;
import com.vsoft.servicenow.utils.Util;
import com.vsoft.servicenow.CatalogueApplication;
import com.vsoft.servicenow.R;
......@@ -70,7 +71,7 @@ public class HomeScreen extends AppCompatActivity {
// perform the user login attempt.
String userFirstName = PrefManager.getSharedPref(HomeScreen.this, PrefManager.PREFERENCE_FIRST_NAME);
Intent intent = new Intent(HomeScreen.this, ChatActivity.class);
intent.putExtra("username", userFirstName);
intent.putExtra(Constants.DATA_KEY_CHAT_USER_NAME, userFirstName);
startActivity(intent);
}
}
......
......@@ -9,6 +9,7 @@
<string name="connect">Connected</string>
<string name="disconnect">Disconnected, Please check your internet connection</string>
<string name="error_connect">Failed to connect</string>
<string name="unauthorized_user">Unauthorized User</string>
<!-- messages -->
<string name="message_welcome">Chat with HR Bot</string>
......
......@@ -73,6 +73,7 @@ public class CatalogueApplication extends Application {
PrefManager.setSharedPref(CatalogueApplication.this, PrefManager.PREFERENCE_USER_ID, "");
PrefManager.setSharedPref(CatalogueApplication.this, PrefManager.PREFERENCE_USER_FULL_NAME, "");
PrefManager.setSharedPref(CatalogueApplication.this, PrefManager.PREFERENCE_USER_EMAIL_ID, "");
PrefManager.setSharedPref(CatalogueApplication.this, PrefManager.PREFERENCE_LOGIN_USER_NAME, "");
Intent loginIntent = new Intent(CatalogueApplication.this, LoginScreen.class);
loginIntent.addFlags(Intent.FLAG_ACTIVITY_NEW_TASK | Intent.FLAG_ACTIVITY_CLEAR_TASK);
startActivity(loginIntent);
......
......@@ -135,6 +135,7 @@ public class LoginApiManager {
CatalogueLog.d("---- 401, unSetting access and refresh token, prompt user to login again");
PrefManager.setSharedPref(context, PrefManager.PREFERENCE_ACCESS_TOKEN, "");
PrefManager.setSharedPref(context, PrefManager.PREFERENCE_REFRESH_TOKEN, "");
PrefManager.setSharedPref(context, PrefManager.PREFERENCE_LOGIN_USER_NAME, "");
Intent intent = new Intent(Constants.APPLICATION_BROADCAST_INTENT);
intent.putExtra(Constants.APPLICATION_BROADCAST_DATA_ACTION, Constants.ACTION_PROMPT_LOGIN);
......
......@@ -144,6 +144,7 @@ public class LoginScreen extends Activity {
/*Save access token in Preference*/
PrefManager.setSharedPref(LoginScreen.this, PrefManager.PREFERENCE_ACCESS_TOKEN, loginApiResponse.getAccessToken());
PrefManager.setSharedPref(LoginScreen.this, PrefManager.PREFERENCE_REFRESH_TOKEN, loginApiResponse.getRefreshToken());
PrefManager.setSharedPref(LoginScreen.this, PrefManager.PREFERENCE_LOGIN_USER_NAME, userName);
apiStatus = API_SUCCESS_USER_LOGIN;
publishProgress(USER_DETAIL);
......
......@@ -29,6 +29,7 @@ public class Constants {
public static final String DATA_KEY_CATALOGUE_TITLE = "catalogue_title";
public static final String DATA_KEY_CATALOGUE_ITEM_DESCRIPTION = "catalogue_item_des";
public static final String DATA_KEY_CATALOGUE_ITEM_SHORT_DESCRIPTION = "catalogue_item_short_des";
public static final String DATA_KEY_CHAT_USER_NAME = "username";
/**
* Broadcast custom intent
......@@ -162,4 +163,7 @@ public class Constants {
/*Incident API */
public static final String URL_GET_INCIDENTS = API_PATH + "incident";
public static final String URL_POST_INCIDENT = API_PATH + "incident";
/*Chat Activity*/
public static final String CHAT_USER_API_URL = DOMAIN + URL_GET_USERDETAILS.substring(1);
}
......@@ -21,6 +21,7 @@ public class PrefManager {
public static final String PREFERENCE_LOGIN_VALUES_KEY = "LoginPrefs";
public static final String PREFERENCE_ACCESS_TOKEN = "access_token";
public static final String PREFERENCE_REFRESH_TOKEN = "refresh_token";
public static final String PREFERENCE_LOGIN_USER_NAME = "login_user_name";
private static final String SHARED_PREFERENCE_NAME = PrefManager.class.getSimpleName();
......
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