Skip to content
Toggle navigation
P
Projects
G
Groups
S
Snippets
Help
Krishna Vemulavada
/
vera_2.1_app
This project
Loading...
Sign in
Toggle navigation
Go to a project
Project
Repository
Issues
0
Merge Requests
0
Pipelines
Wiki
Snippets
Settings
Activity
Graph
Charts
Create a new issue
Jobs
Commits
Issue Boards
Files
Commits
Branches
Tags
Contributors
Graph
Compare
Charts
Commit
b4ea5dd4
authored
Mar 19, 2018
by
Kunj Gupta
Browse files
Options
_('Browse Files')
Download
Email Patches
Plain Diff
Added authorized user for chat, but is not done.
parent
064686d9
Expand all
Hide whitespace changes
Inline
Side-by-side
Showing
8 changed files
with
11 additions
and
1 deletions
app/src/arrow/java/com/vsoft/servicenow/chat/ChatActivity.java
app/src/arrow/java/com/vsoft/servicenow/ui/HomeScreen.java
app/src/arrow/res/values/strings.xml
app/src/main/java/com/vsoft/servicenow/CatalogueApplication.java
app/src/main/java/com/vsoft/servicenow/api/managers/LoginApiManager.java
app/src/main/java/com/vsoft/servicenow/ui/LoginScreen.java
app/src/main/java/com/vsoft/servicenow/utils/Constants.java
app/src/main/java/com/vsoft/servicenow/utils/PrefManager.java
app/src/arrow/java/com/vsoft/servicenow/chat/ChatActivity.java
View file @
b4ea5dd4
This diff is collapsed.
Click to expand it.
app/src/arrow/java/com/vsoft/servicenow/ui/HomeScreen.java
View file @
b4ea5dd4
...
...
@@ -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
);
}
}
...
...
app/src/arrow/res/values/strings.xml
View file @
b4ea5dd4
...
...
@@ -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>
...
...
app/src/main/java/com/vsoft/servicenow/CatalogueApplication.java
View file @
b4ea5dd4
...
...
@@ -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
);
...
...
app/src/main/java/com/vsoft/servicenow/api/managers/LoginApiManager.java
View file @
b4ea5dd4
...
...
@@ -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
);
...
...
app/src/main/java/com/vsoft/servicenow/ui/LoginScreen.java
View file @
b4ea5dd4
...
...
@@ -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
);
...
...
app/src/main/java/com/vsoft/servicenow/utils/Constants.java
View file @
b4ea5dd4
...
...
@@ -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
);
}
app/src/main/java/com/vsoft/servicenow/utils/PrefManager.java
View file @
b4ea5dd4
...
...
@@ -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
();
...
...
Write
Preview
Markdown
is supported
0%
Try again
or
attach a new file
Attach a file
Cancel
You are about to add
0
people
to the discussion. Proceed with caution.
Finish editing this message first!
Cancel
Please
register
or
sign in
to comment