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
a4b21be6
authored
Sep 30, 2019
by
Krishna Vemulawada
Browse files
Options
_('Browse Files')
Download
Email Patches
Plain Diff
logout issue reslove
parent
0b9ca7bc
Show whitespace changes
Inline
Side-by-side
Showing
10 changed files
with
336 additions
and
95 deletions
app/build.gradle
app/src/main/java/com/vsoft/vera/ui/ADALActivity.java
app/src/main/java/com/vsoft/vera/ui/ChatActivity.java
app/src/main/java/com/vsoft/vera/ui/LoginChooseActivity.java
app/src/main/res/drawable/bg_screen.jpg
app/src/main/res/drawable/fulton_app_logo.png
app/src/main/res/layout/activity_login.xml
app/src/main/res/layout/chat_activity.xml
app/vportal/staging/app-vportal-staging.apk
app/vportal/staging/output.json
app/build.gradle
View file @
a4b21be6
...
...
@@ -72,7 +72,7 @@ android {
vportal
{
applicationId
"com.vsoft.vera.vportal"
versionCode
1
versionName
"0.1.
4
"
versionName
"0.1.
5
"
}
}
}
...
...
app/src/main/java/com/vsoft/vera/ui/ADALActivity.java
View file @
a4b21be6
...
...
@@ -83,6 +83,7 @@ public class ADALActivity extends AppCompatActivity {
private
static
final
int
API_SUCCESS_USER_DETAIL
=
3
;
private
static
final
int
API_FAIL_USER_DETAIL
=
4
;
private
List
<
UserApiValues
>
mUserDetails
;
private
ProgressDialog
mProgressDlg
;
/* Azure AD Constants */
/* Authority is in the form of https://login.microsoftonline.com/yourtenant.onmicrosoft.com */
...
...
@@ -140,6 +141,7 @@ public class ADALActivity extends AppCompatActivity {
setContentView
(
R
.
layout
.
adal_main
);
mainLayt
=
(
LinearLayout
)
findViewById
(
R
.
id
.
activity_main
);
logo_banner
=
findViewById
(
R
.
id
.
logo_banner
);
Glide
.
with
(
this
).
load
(
R
.
drawable
.
fulton_bg
).
into
(
new
SimpleTarget
<
Drawable
>()
{
@Override
public
void
onResourceReady
(
Drawable
resource
,
Transition
<?
super
Drawable
>
transition
)
{
...
...
@@ -162,14 +164,16 @@ public class ADALActivity extends AppCompatActivity {
callGraphButton
=
(
Button
)
findViewById
(
R
.
id
.
callGraph
);
signOutButton
=
(
Button
)
findViewById
(
R
.
id
.
clearCache
);
login_with_otp
=
(
Button
)
findViewById
(
R
.
id
.
login_with_otp
);
logo_banner
=
findViewById
(
R
.
id
.
logo_banner
);
callGraphButton
.
setOnClickListener
(
new
View
.
OnClickListener
()
{
public
void
onClick
(
View
v
)
{
if
(
NetworkConnectivity
.
haveNetworkConnection
(
ADALActivity
.
this
))
{
onCallGraphClicked
();
}
else
{
DialogUtils
.
showNoConnectionDialog
(
ADALActivity
.
this
);
}
...
...
@@ -275,6 +279,12 @@ public class ADALActivity extends AppCompatActivity {
}
private
void
callGraphAPI
()
{
mProgressDlg
=
new
ProgressDialog
(
ADALActivity
.
this
);
mProgressDlg
.
setMessage
(
getString
(
R
.
string
.
loading_string
));
mProgressDlg
.
show
();
mProgressDlg
.
setCancelable
(
false
);
Log
.
d
(
TAG
,
"Starting volley request to graph"
);
/* Make sure we have a token to send to graph */
...
...
@@ -292,6 +302,7 @@ public class ADALActivity extends AppCompatActivity {
parameters
,
new
Response
.
Listener
<
JSONObject
>()
{
@Override
public
void
onResponse
(
JSONObject
response
)
{
mProgressDlg
.
dismiss
();
/* Successfully called graph, process data and send to UI */
Log
.
d
(
TAG
,
"Response: "
+
response
.
toString
());
JSONObject
root
=
null
;
...
...
@@ -315,6 +326,7 @@ public class ADALActivity extends AppCompatActivity {
},
new
Response
.
ErrorListener
()
{
@Override
public
void
onErrorResponse
(
VolleyError
error
)
{
mProgressDlg
.
dismiss
();
Log
.
d
(
TAG
,
"Error: "
+
error
.
toString
());
}
})
{
...
...
@@ -361,10 +373,8 @@ public class ADALActivity extends AppCompatActivity {
private
void
updateSuccessUI
()
{
// Called on success from /me endpoint
// Removed call Graph API button and paint Sign out
callGraphButton
.
setVisibility
(
View
.
GONE
);
signOutButton
.
setVisibility
(
View
.
GONE
);
login_with_otp
.
setVisibility
(
View
.
GONE
);
logo_banner
.
setVisibility
(
View
.
GONE
);
findViewById
(
R
.
id
.
welcome
).
setVisibility
(
View
.
GONE
);
((
TextView
)
findViewById
(
R
.
id
.
welcome
)).
setText
(
"Welcome, "
+
mAuthResult
.
getUserInfo
().
getGivenName
());
...
...
@@ -412,10 +422,9 @@ public class ADALActivity extends AppCompatActivity {
}
/* Successfully got a token, call graph now */
Log
.
d
(
TAG
,
"Successfully authenticated"
);
callGraphButton
.
setVisibility
(
View
.
GONE
);
signOutButton
.
setVisibility
(
View
.
GONE
);
login_with_otp
.
setVisibility
(
View
.
GONE
);
logo_banner
.
setVisibility
(
View
.
GONE
);
/* Store the mAuthResult */
mAuthResult
=
authenticationResult
;
...
...
app/src/main/java/com/vsoft/vera/ui/ChatActivity.java
View file @
a4b21be6
...
...
@@ -11,8 +11,10 @@ import android.database.sqlite.SQLiteDatabase;
import
android.graphics.Bitmap
;
import
android.graphics.BitmapFactory
;
import
android.graphics.Color
;
import
android.graphics.drawable.Drawable
;
import
android.net.Uri
;
import
android.os.AsyncTask
;
import
android.os.Build
;
import
android.os.Bundle
;
import
android.os.Environment
;
import
android.os.Handler
;
...
...
@@ -43,9 +45,12 @@ import android.view.inputmethod.EditorInfo;
import
android.widget.EditText
;
import
android.widget.ImageButton
;
import
android.widget.ImageView
;
import
android.widget.LinearLayout
;
import
android.widget.TextView
;
import
android.widget.Toast
;
import
com.bumptech.glide.Glide
;
import
com.bumptech.glide.request.target.SimpleTarget
;
import
com.bumptech.glide.request.transition.Transition
;
import
com.github.nkzawa.emitter.Emitter
;
import
com.github.nkzawa.socketio.client.Socket
;
import
com.vsoft.vera.CatalogueApplication
;
...
...
@@ -174,6 +179,7 @@ public class ChatActivity extends AppCompatActivity implements OnDSListener, OnD
private
static
final
String
HTTPS
=
"https://"
;
private
static
final
String
HTTP
=
"http://"
;
private
LinearLayout
mainLayt
;
@Override
...
...
@@ -181,6 +187,15 @@ public class ChatActivity extends AppCompatActivity implements OnDSListener, OnD
super
.
onCreate
(
savedInstanceState
);
setContentView
(
R
.
layout
.
chat_activity
);
mainLayt
=
(
LinearLayout
)
findViewById
(
R
.
id
.
chat_activity_main
);
Glide
.
with
(
this
).
load
(
R
.
drawable
.
chat_back_bg
).
into
(
new
SimpleTarget
<
Drawable
>()
{
@Override
public
void
onResourceReady
(
Drawable
resource
,
Transition
<?
super
Drawable
>
transition
)
{
if
(
Build
.
VERSION
.
SDK_INT
>=
Build
.
VERSION_CODES
.
JELLY_BEAN
)
{
mainLayt
.
setBackground
(
resource
);
}
}
});
mLoggedInUserSysId
=
PrefManager
.
getSharedPref
(
this
,
PrefManager
.
PREFERENCE_USER_SYS_ID
);
mLoggedInUsername
=
PrefManager
.
getSharedPref
(
this
,
PrefManager
.
PREFERENCE_USER_FIRST_NAME
);
...
...
app/src/main/java/com/vsoft/vera/ui/LoginChooseActivity.java
View file @
a4b21be6
...
...
@@ -2,19 +2,25 @@ package com.vsoft.vera.ui;
import
android.annotation.SuppressLint
;
import
android.app.Activity
;
import
android.app.ProgressDialog
;
import
android.content.Intent
;
import
android.content.SharedPreferences
;
import
android.graphics.drawable.Drawable
;
import
android.os.AsyncTask
;
import
android.os.Build
;
import
android.os.Bundle
;
import
android.os.Handler
;
import
android.os.Looper
;
import
android.os.Message
;
import
android.preference.PreferenceManager
;
import
android.support.v4.content.LocalBroadcastManager
;
import
android.text.TextUtils
;
import
android.util.Log
;
import
android.view.View
;
import
android.widget.Button
;
import
android.widget.EditText
;
import
android.widget.ImageView
;
import
android.widget.LinearLayout
;
import
android.widget.TextView
;
import
com.android.volley.DefaultRetryPolicy
;
...
...
@@ -24,6 +30,9 @@ import com.android.volley.Response;
import
com.android.volley.VolleyError
;
import
com.android.volley.toolbox.JsonObjectRequest
;
import
com.android.volley.toolbox.Volley
;
import
com.bumptech.glide.Glide
;
import
com.bumptech.glide.request.target.SimpleTarget
;
import
com.bumptech.glide.request.transition.Transition
;
import
com.microsoft.aad.adal.ADALError
;
import
com.microsoft.aad.adal.AuthenticationCallback
;
import
com.microsoft.aad.adal.AuthenticationContext
;
...
...
@@ -35,7 +44,22 @@ import com.microsoft.aad.adal.PromptBehavior;
import
com.microsoft.aad.adal.Telemetry
;
import
com.vsoft.vera.CatalogueApplication
;
import
com.vsoft.vera.R
;
import
com.vsoft.vera.api.listeners.get.GetUserDetailApiListener
;
import
com.vsoft.vera.api.listeners.get.GetUserLoginApiListener
;
import
com.vsoft.vera.api.listeners.put.PutDeviceRegistrationApiListener
;
import
com.vsoft.vera.api.managers.LoginApiManager
;
import
com.vsoft.vera.api.managers.UserApiManager
;
import
com.vsoft.vera.api.pojos.LoginApiResponse
;
import
com.vsoft.vera.db.managers.ChatBotHistoryManager
;
import
com.vsoft.vera.db.managers.ChatBotUserManager
;
import
com.vsoft.vera.db.models.ChatBotUser
;
import
com.vsoft.vera.db.models.UserApiValues
;
import
com.vsoft.vera.utils.Constants
;
import
com.vsoft.vera.utils.DialogUtils
;
import
com.vsoft.vera.utils.GenerateRandomString
;
import
com.vsoft.vera.utils.NetworkConnectivity
;
import
com.vsoft.vera.utils.PrefManager
;
import
com.vsoft.vera.utils.Util
;
import
org.json.JSONException
;
import
org.json.JSONObject
;
...
...
@@ -51,10 +75,17 @@ import butterknife.OnClick;
public
class
LoginChooseActivity
extends
Activity
{
TextView
loginSSO
,
loginOTP
;
/* UI & Debugging Variables */
private
static
final
String
TAG
=
ADALActivity
.
class
.
getSimpleName
();
private
static
final
int
API_SUCCESS_USER_LOGIN
=
1
;
private
static
final
int
API_FAIL_USER_LOGIN
=
2
;
private
static
final
int
API_SUCCESS_USER_DETAIL
=
3
;
private
static
final
int
API_FAIL_USER_DETAIL
=
4
;
private
List
<
UserApiValues
>
mUserDetails
;
private
ProgressDialog
mProgressDlg
;
/* Azure AD Constants */
/* Authority is in the form of https://login.microsoftonline.com/yourtenant.onmicrosoft.com */
private
static
final
String
AUTHORITY
=
"https://login.microsoftonline.com/common"
;
...
...
@@ -84,9 +115,13 @@ public class LoginChooseActivity extends Activity {
/* Constant to store user id in shared preferences */
private
static
final
String
USER_ID
=
"user_id"
;
private
boolean
isLogin
=
false
;
private
boolean
sspLogin
=
false
;
/* Telemetry variables */
// Flag to turn event aggregation on/off
private
static
final
boolean
sTelemetryAggregationIsRequired
=
true
;
private
LinearLayout
mainLayt
;
/* Telemetry dispatcher registration */
static
{
...
...
@@ -102,32 +137,23 @@ public class LoginChooseActivity extends Activity {
}
@Override
protected
void
onCreate
(
Bundle
savedInstanceState
)
{
// TODO Auto-generated method stub
super
.
onCreate
(
savedInstanceState
);
setContentView
(
R
.
layout
.
activity_login
);
loginSSO
=
findViewById
(
R
.
id
.
login_with_sso
);
loginOTP
=
findViewById
(
R
.
id
.
login_with_otp
);
loginSSO
.
setOnClickListener
(
new
View
.
OnClickListener
()
{
mainLayt
=
(
LinearLayout
)
findViewById
(
R
.
id
.
activity_main_login
);
Glide
.
with
(
this
).
load
(
R
.
drawable
.
fulton_bg
).
into
(
new
SimpleTarget
<
Drawable
>()
{
@Override
public
void
onClick
(
View
view
)
{
// Intent intent = new Intent(LoginChooseActivity.this,ADALActivity.class);
// startActivity(intent);
onCallGraphClicked
();
public
void
onResourceReady
(
Drawable
resource
,
Transition
<?
super
Drawable
>
transition
)
{
if
(
Build
.
VERSION
.
SDK_INT
>=
Build
.
VERSION_CODES
.
JELLY_BEAN
)
{
mainLayt
.
setBackground
(
resource
);
}
});
loginOTP
.
setOnClickListener
(
new
View
.
OnClickListener
()
{
@Override
public
void
onClick
(
View
view
)
{
}
});
// callGraphButton = (Button) findViewById(R.id.callGraph);
// signOutButton = (Button) findViewById(R.id.clearCache);
...
...
@@ -141,7 +167,7 @@ public class LoginChooseActivity extends Activity {
public
void
handleMessage
(
Message
msg
)
{
if
(
sIntSignInInvoked
.
compareAndSet
(
false
,
true
))
{
if
(
msg
.
what
==
MSG_INTERACTIVE_SIGN_IN_PROMPT_AUTO
){
mAuthContext
.
acquireToken
(
getActivity
(),
RESOURCE_ID
,
CLIENT_ID
,
REDIRECT_URI
,
PromptBehavior
.
A
uto
,
getAuthInteractiveCallback
());
mAuthContext
.
acquireToken
(
getActivity
(),
RESOURCE_ID
,
CLIENT_ID
,
REDIRECT_URI
,
PromptBehavior
.
A
lways
,
getAuthInteractiveCallback
());
}
else
if
(
msg
.
what
==
MSG_INTERACTIVE_SIGN_IN_PROMPT_ALWAYS
){
mAuthContext
.
acquireToken
(
getActivity
(),
RESOURCE_ID
,
CLIENT_ID
,
REDIRECT_URI
,
PromptBehavior
.
Always
,
getAuthInteractiveCallback
());
}
...
...
@@ -164,9 +190,68 @@ public class LoginChooseActivity extends Activity {
String
userId
=
preferences
.
getString
(
USER_ID
,
""
);
if
(!
TextUtils
.
isEmpty
(
userId
)){
mAuthContext
.
acquireTokenSilentAsync
(
RESOURCE_ID
,
CLIENT_ID
,
userId
,
getAuthSilentCallback
());
}
else
{
mAuthContext
.
getCache
().
removeAll
();
}
CheckLoginValues
();
}
private
void
CheckLoginValues
()
{
String
sysId
=
PrefManager
.
getSharedPref
(
LoginChooseActivity
.
this
,
PrefManager
.
PREFERENCE_USER_SYS_ID
);
if
(!
TextUtils
.
isEmpty
(
sysId
))
{
/*Send broadcast to start SyncService*/
Intent
intent
=
new
Intent
(
Constants
.
APPLICATION_BROADCAST_INTENT
);
intent
.
putExtra
(
Constants
.
APPLICATION_BROADCAST_DATA_ACTION
,
Constants
.
ACTION_SYNC
);
LocalBroadcastManager
.
getInstance
(
LoginChooseActivity
.
this
).
sendBroadcast
(
intent
);
Bundle
bundle
=
getIntent
().
getExtras
();
if
(
bundle
!=
null
)
{
int
requestCode
=
bundle
.
getInt
(
Constants
.
DATA_KEY_LOGIN_REQUEST_CODE
);
if
(
requestCode
==
Constants
.
LOGIN_SCREEN_REQUEST_CODE
)
{
setResult
(
Constants
.
LOGIN_SCREEN_REQUEST_CODE
,
new
Intent
());
}
else
{
startActivity
(
new
Intent
(
LoginChooseActivity
.
this
,
HomeScreen
.
class
));
}
}
else
{
startActivity
(
new
Intent
(
LoginChooseActivity
.
this
,
HomeScreen
.
class
));
}
isLogin
=
true
;
finish
();
}
else
{
if
(
NetworkConnectivity
.
haveNetworkConnection
(
LoginChooseActivity
.
this
))
{
onCallGraphClicked
();
}
else
{
DialogUtils
.
showNoConnectionDialog
(
LoginChooseActivity
.
this
);
}
}
}
@Override
public
void
onBackPressed
()
{
super
.
onBackPressed
();
finish
();
}
//
// Core Auth methods used by ADAL
// ==================================
// onActivityResult() - handles redirect from System browser
// onCallGraphClicked() - attempts to get tokens for graph, if it succeeds calls graph & updates UI
// callGraphAPI() - called on successful token acquisition which makes an HTTP request to graph
// onSignOutClicked() - Signs user out of the app & updates UI
//
@Override
protected
void
onActivityResult
(
int
requestCode
,
int
resultCode
,
Intent
data
)
{
super
.
onActivityResult
(
requestCode
,
resultCode
,
data
);
mAuthContext
.
onActivityResult
(
requestCode
,
resultCode
,
data
);
}
/*
* End user clicked call Graph API button, time for Auth
* Use ADAL to get an Access token for the Microsoft Graph API
...
...
@@ -176,6 +261,12 @@ public class LoginChooseActivity extends Activity {
}
private
void
callGraphAPI
()
{
mProgressDlg
=
new
ProgressDialog
(
LoginChooseActivity
.
this
);
mProgressDlg
.
setMessage
(
getString
(
R
.
string
.
loading_string
));
mProgressDlg
.
show
();
mProgressDlg
.
setCancelable
(
false
);
Log
.
d
(
TAG
,
"Starting volley request to graph"
);
/* Make sure we have a token to send to graph */
...
...
@@ -189,28 +280,35 @@ public class LoginChooseActivity extends Activity {
}
catch
(
Exception
e
)
{
Log
.
d
(
TAG
,
"Failed to put parameters: "
+
e
.
toString
());
}
JsonObjectRequest
request
=
new
JsonObjectRequest
(
Request
.
Method
.
GET
,
MSGRAPH_URL
,
final
JsonObjectRequest
request
=
new
JsonObjectRequest
(
Request
.
Method
.
GET
,
MSGRAPH_URL
,
parameters
,
new
Response
.
Listener
<
JSONObject
>()
{
@Override
public
void
onResponse
(
JSONObject
response
)
{
mProgressDlg
.
dismiss
();
/* Successfully called graph, process data and send to UI */
Log
.
d
(
TAG
,
"Response: "
+
response
.
toString
());
updateGraphUI
(
response
);
JSONObject
root
=
null
;
try
{
root
=
new
JSONObject
(
response
.
toString
());
String
userLoginName
=
root
.
getString
(
"givenName"
);
PrefManager
.
setSharedPref
(
LoginChooseActivity
.
this
,
PrefManager
.
PREFERENCE_USER_FULL_NAME
,
userLoginName
);
/*Send broadcast to start SyncService*/
if
(!
isLogin
){
new
LoginDetailsSendToServer
().
execute
();
}
}
catch
(
JSONException
e
)
{
e
.
printStackTrace
();
}
// updateGraphUI(response);
}
},
new
Response
.
ErrorListener
()
{
@Override
public
void
onErrorResponse
(
VolleyError
error
)
{
mProgressDlg
.
dismiss
();
Log
.
d
(
TAG
,
"Error: "
+
error
.
toString
());
}
})
{
...
...
@@ -235,7 +333,7 @@ public class LoginChooseActivity extends Activity {
// Kill the token cache
// Optionally call the signout endpoint to fully sign out the user account
mAuthContext
.
getCache
().
removeAll
();
updateSignedOutUI
();
//
updateSignedOutUI();
}
//
...
...
@@ -249,12 +347,16 @@ public class LoginChooseActivity extends Activity {
private
void
updateGraphUI
(
JSONObject
response
)
{
// Called on success from /me endpoint
// Writes graph data to the UI
//
TextView graphText = (TextView) findViewById(R.id.graphData);
//
graphText.setText(response.toString());
TextView
graphText
=
(
TextView
)
findViewById
(
R
.
id
.
graphData
);
graphText
.
setText
(
response
.
toString
());
}
@SuppressLint
(
"SetTextI18n"
)
private
void
updateSuccessUI
()
{
// Called on success from /me endpoint
// Removed call Graph API button and paint Sign out
}
...
...
@@ -262,6 +364,7 @@ public class LoginChooseActivity extends Activity {
@SuppressLint
(
"SetTextI18n"
)
private
void
updateSignedOutUI
()
{
}
//
...
...
@@ -293,8 +396,12 @@ public class LoginChooseActivity extends Activity {
}
/* Successfully got a token, call graph now */
Log
.
d
(
TAG
,
"Successfully authenticated"
);
/* Store the mAuthResult */
mAuthResult
=
authenticationResult
;
/* call graph */
callGraphAPI
();
...
...
@@ -303,6 +410,7 @@ public class LoginChooseActivity extends Activity {
@Override
public
void
run
()
{
updateSuccessUI
();
}
});
}
...
...
@@ -412,4 +520,165 @@ public class LoginChooseActivity extends Activity {
}
};
}
private
class
LoginDetailsSendToServer
extends
AsyncTask
<
Void
,
Integer
,
Integer
>
{
private
ProgressDialog
progressDialog
;
private
static
final
int
USER_DETAIL
=
1
;
private
int
apiStatus
;
@Override
protected
void
onPreExecute
()
{
super
.
onPreExecute
();
progressDialog
=
new
ProgressDialog
(
LoginChooseActivity
.
this
);
progressDialog
.
setMessage
(
getString
(
R
.
string
.
loading_string
));
progressDialog
.
show
();
progressDialog
.
setCancelable
(
false
);
}
@Override
protected
Integer
doInBackground
(
Void
...
params
)
{
LoginApiManager
.
submitLoginValues
(
LoginApiResponse
.
Json
.
PASSWORD
,
Constants
.
LOGIN_CLIENT_ID
,
Constants
.
LOGIN_CLIENT_SECRET
,
Constants
.
FULTON_LOGIN_USERNAME
,
Constants
.
FULTON_LOGIN_PASSWORD
,
new
GetUserLoginApiListener
()
{
@Override
public
void
onDoneApiCall
(
LoginApiResponse
loginApiResponse
)
{
apiStatus
=
API_SUCCESS_USER_LOGIN
;
publishProgress
(
USER_DETAIL
);
/*Save access token in Preference*/
PrefManager
.
setSharedPref
(
LoginChooseActivity
.
this
,
PrefManager
.
PREFERENCE_ACCESS_TOKEN
,
loginApiResponse
.
getAccessToken
());
PrefManager
.
setSharedPref
(
LoginChooseActivity
.
this
,
PrefManager
.
PREFERENCE_REFRESH_TOKEN
,
loginApiResponse
.
getRefreshToken
());
UserApiManager
.
getUserDetailResponse
(
LoginChooseActivity
.
this
,
Constants
.
FULTON_LOGIN_USERNAME
,
new
GetUserDetailApiListener
()
{
@Override
public
void
onDoneApiCall
(
List
<
UserApiValues
>
userValues
)
{
mUserDetails
=
userValues
;
if
(
Util
.
isNotificationsItemEnabled
())
{
UserApiManager
.
putDeviceRegistration
(
LoginChooseActivity
.
this
,
userValues
.
get
(
0
).
getSysId
(),
new
PutDeviceRegistrationApiListener
()
{
@Override
public
void
onDoneApiCall
()
{
apiStatus
=
API_SUCCESS_USER_DETAIL
;
}
@Override
public
void
onFailApiCall
()
{
apiStatus
=
API_FAIL_USER_DETAIL
;
}
});
}
else
{
apiStatus
=
API_SUCCESS_USER_DETAIL
;
}
}
@Override
public
void
onFailApiCall
()
{
apiStatus
=
API_FAIL_USER_DETAIL
;
}
});
}
@Override
public
void
onFailApiCall
()
{
apiStatus
=
API_FAIL_USER_LOGIN
;
}
});
return
apiStatus
;
}
@Override
protected
void
onProgressUpdate
(
Integer
...
values
)
{
super
.
onProgressUpdate
(
values
);
if
(
values
[
0
]
==
USER_DETAIL
)
{
// progressDialog.setMessage(getString(R.string.login_screen_getting_user_detail_loading_string));
}
}
@Override
protected
void
onPostExecute
(
Integer
syncStatus
)
{
super
.
onPostExecute
(
syncStatus
);
if
(
progressDialog
!=
null
&&
progressDialog
.
isShowing
())
{
progressDialog
.
dismiss
();
}
if
(
syncStatus
==
API_SUCCESS_USER_DETAIL
)
{
if
(
mUserDetails
!=
null
)
{
isLogin
=
true
;
if
(((
CatalogueApplication
)
getApplication
()).
isNetConnected
())
{
ChatBotHistoryManager
.
delete
();
String
generateRandomStrPharma
=
GenerateRandomString
.
randomString
(
30
);
PrefManager
.
setSharedPref
(
LoginChooseActivity
.
this
,
PrefManager
.
SESSION_ID
,
generateRandomStrPharma
);
}
else
{
DialogUtils
.
showNoConnectionDialog
(
LoginChooseActivity
.
this
);
}
String
generateRandoStrPharma
=
GenerateRandomString
.
randomString
(
30
);
PrefManager
.
setSharedPref
(
LoginChooseActivity
.
this
,
PrefManager
.
SESSION_ID
,
generateRandoStrPharma
);
String
firstName
=
mUserDetails
.
get
(
0
).
getFirstName
();
String
lastName
=
mUserDetails
.
get
(
0
).
getLastName
();
String
sysid
=
mUserDetails
.
get
(
0
).
getSysId
();
String
userFullName
=
mUserDetails
.
get
(
0
).
getFullName
();
String
userId
=
mUserDetails
.
get
(
0
).
getUserId
();
String
userEmailId
=
mUserDetails
.
get
(
0
).
getUserEmailId
();
if
(
Util
.
isChatItemEnabled
())
{
/*Start Chat Local DB Part*/
//Here we'll save logged in user detail in local DB for chat history.
ChatBotUser
localChatBotUser
=
ChatBotUserManager
.
getChatBotUsersByUserSysId
(
sysid
);
if
(
localChatBotUser
==
null
)
{
/*Clears all data from CHAT_BOT_HISTORY and CHAT_BOT_USER tables*/
ChatBotHistoryManager
.
deleteAllRows
();
ChatBotUserManager
.
deleteAllRows
();
/*Save Logged in user in local db for chat screen*/
ChatBotUser
chatBotUser
=
ChatBotUser
.
ChatBotUserBuilder
.
aChatBotUser
()
.
setUserSysId
(
sysid
)
.
setName
(
firstName
)
.
build
();
ChatBotUserManager
.
save
(
chatBotUser
);
}
else
{
//Update the name of user
localChatBotUser
.
setName
(
firstName
);
ChatBotUserManager
.
update
(
localChatBotUser
);
}
}
/*End Chat Local DB Part*/
PrefManager
.
setSharedPref
(
LoginChooseActivity
.
this
,
PrefManager
.
PREFERENCE_USER_FIRST_NAME
,
firstName
);
PrefManager
.
setSharedPref
(
LoginChooseActivity
.
this
,
PrefManager
.
PREFERENCE_USER_LAST_NAME
,
lastName
);
PrefManager
.
setSharedPref
(
LoginChooseActivity
.
this
,
PrefManager
.
PREFERENCE_USER_SYS_ID
,
sysid
);
/*For pre fill value in variable form*/
PrefManager
.
setSharedPref
(
LoginChooseActivity
.
this
,
PrefManager
.
PREFERENCE_USER_ID
,
userId
);
PrefManager
.
setSharedPref
(
LoginChooseActivity
.
this
,
PrefManager
.
PREFERENCE_USER_EMAIL_ID
,
userEmailId
);
// /*Send broadcast to start SyncService*/
Intent
intent
=
new
Intent
(
Constants
.
APPLICATION_BROADCAST_INTENT
);
intent
.
putExtra
(
Constants
.
APPLICATION_BROADCAST_DATA_ACTION
,
Constants
.
ACTION_SYNC
);
LocalBroadcastManager
.
getInstance
(
LoginChooseActivity
.
this
).
sendBroadcast
(
intent
);
Bundle
bundle
=
getIntent
().
getExtras
();
if
(
bundle
!=
null
)
{
int
requestCode
=
bundle
.
getInt
(
Constants
.
DATA_KEY_LOGIN_REQUEST_CODE
);
if
(
requestCode
==
Constants
.
LOGIN_SCREEN_REQUEST_CODE
)
{
startActivity
(
new
Intent
(
LoginChooseActivity
.
this
,
ChatActivity
.
class
));
}
else
{
startActivity
(
new
Intent
(
LoginChooseActivity
.
this
,
HomeScreen
.
class
));
}
}
else
{
startActivity
(
new
Intent
(
LoginChooseActivity
.
this
,
HomeScreen
.
class
));
}
//
}
else
{
Util
.
simpleAlert
(
LoginChooseActivity
.
this
,
getResources
().
getString
(
R
.
string
.
user_detail_not_available
));
}
}
else
if
(
syncStatus
==
API_FAIL_USER_LOGIN
)
{
Util
.
simpleAlert
(
LoginChooseActivity
.
this
,
getResources
().
getString
(
R
.
string
.
login_screen_invalid_username_and_password_string
));
}
else
if
(
syncStatus
==
API_FAIL_USER_DETAIL
)
{
Util
.
simpleAlert
(
LoginChooseActivity
.
this
,
getResources
().
getString
(
R
.
string
.
failed_to_fetch_user_detail_string
));
}
}
}
}
app/src/main/res/drawable/bg_screen.jpg
deleted
100755 → 0
View file @
0b9ca7bc
279 KB
app/src/main/res/drawable/fulton_app_logo.png
deleted
100644 → 0
View file @
0b9ca7bc
53.4 KB
app/src/main/res/layout/activity_login.xml
View file @
a4b21be6
<?xml version="1.0" encoding="utf-8"?>
<ScrollView
xmlns:android=
"http://schemas.android.com/apk/res/android"
<LinearLayout
xmlns:android=
"http://schemas.android.com/apk/res/android"
xmlns:tools=
"http://schemas.android.com/tools"
xmlns:app=
"http://schemas.android.com/apk/res-auto"
android:id=
"@+id/activity_main_login"
android:layout_width=
"match_parent"
android:layout_height=
"match_parent"
android:scrollbarStyle=
"insideOverlay"
>
<LinearLayout
android:layout_width=
"match_parent"
android:layout_height=
"wrap_content"
android:gravity=
"center"
android:layout_marginTop=
"@dimen/normal_margin"
android:orientation=
"vertical"
>
<ImageView
android:layout_width=
"wrap_content"
android:layout_height=
"wrap_content"
android:visibility=
"visible"
android:background=
"@drawable/ic_login_banner"
/>
<LinearLayout
android:layout_width=
"match_parent"
android:layout_height=
"match_parent"
android:layout_marginTop=
"100dp"
android:layout_gravity=
"center"
android:gravity=
"center"
android:orientation=
"vertical"
>
<TextView
android:id=
"@+id/login_with_sso"
android:layout_width=
"match_parent"
android:layout_height=
"wrap_content"
android:layout_marginBottom=
"@dimen/normal_margin"
android:layout_marginLeft=
"@dimen/extra_large_margin"
android:layout_marginRight=
"@dimen/extra_large_margin"
android:layout_marginTop=
"30dp"
android:background=
"@drawable/login_bg"
android:gravity=
"center"
android:paddingBottom=
"@dimen/normal_margin"
android:paddingTop=
"@dimen/normal_margin"
android:text=
"Login with ADAL"
android:textColor=
"@android:color/white"
android:textSize=
"@dimen/large_text_size"
/>
<TextView
android:id=
"@+id/login_with_otp"
android:layout_width=
"match_parent"
android:layout_height=
"wrap_content"
android:layout_marginBottom=
"@dimen/normal_margin"
android:layout_marginLeft=
"@dimen/extra_large_margin"
android:layout_marginRight=
"@dimen/extra_large_margin"
android:layout_marginTop=
"30dp"
android:background=
"@drawable/login_bg"
android:gravity=
"center"
android:paddingBottom=
"@dimen/normal_margin"
android:paddingTop=
"@dimen/normal_margin"
android:text=
"Login with otp"
android:textColor=
"@android:color/white"
android:textSize=
"@dimen/large_text_size"
/>
</LinearLayout>
</LinearLayout>
</ScrollView>
\ No newline at end of file
</LinearLayout>
\ No newline at end of file
app/src/main/res/layout/chat_activity.xml
View file @
a4b21be6
...
...
@@ -2,8 +2,8 @@
xmlns:tools=
"http://schemas.android.com/tools"
xmlns:app=
"http://schemas.android.com/apk/res-auto"
style=
"@style/LightBackgroundStyle"
android:id=
"@+id/chat_activity_main"
android:layout_width=
"match_parent"
android:background=
"@drawable/chat_back_bg"
android:layout_height=
"match_parent"
android:orientation=
"vertical"
tools:context=
".ui.ChatActivity"
>
...
...
app/vportal/staging/app-vportal-staging.apk
View file @
a4b21be6
The file could not be displayed because it is too large.
app/vportal/staging/output.json
View file @
a4b21be6
[{
"outputType"
:{
"type"
:
"APK"
},
"apkData"
:{
"type"
:
"MAIN"
,
"splits"
:[],
"versionCode"
:
1
,
"versionName"
:
"0.1.4"
,
"enabled"
:
true
,
"outputFile"
:
"app-vportal-staging.apk"
,
"fullName"
:
"vportalStaging"
,
"baseName"
:
"vportal-staging"
},
"path"
:
"app-vportal-staging.apk"
,
"properties"
:{}}]
\ No newline at end of file
[{
"outputType"
:{
"type"
:
"APK"
},
"apkData"
:{
"type"
:
"MAIN"
,
"splits"
:[],
"versionCode"
:
1
,
"versionName"
:
"0.1.5"
,
"enabled"
:
true
,
"outputFile"
:
"app-vportal-staging.apk"
,
"fullName"
:
"vportalStaging"
,
"baseName"
:
"vportal-staging"
},
"path"
:
"app-vportal-staging.apk"
,
"properties"
:{}}]
\ No newline at end of file
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