Commit 906939d6 by Krishna Vemulawada

get incidents validation

parents 35ad6637 aa91bb6f
......@@ -36,7 +36,7 @@ android {
defaultConfig {
applicationId "com.vsoft.vera"
minSdkVersion 21
minSdkVersion 23
targetSdkVersion 28
versionCode 1
versionName "0.0.1"
......@@ -72,24 +72,20 @@ android {
vportal {
applicationId "com.vsoft.vera.vportal"
versionCode 1
versionName "1.1.0"
versionName "0.2.4"
}
}
}
dependencies {
def appCenterSdkVersion = '2.3.0'
implementation fileTree(include: ['*.jar'], dir: 'libs')
implementation 'com.android.volley:volley:1.1.+'
implementation('com.microsoft.aad:adal:1.14.+') {
exclude group: 'com.android.support'
}
implementation "com.microsoft.appcenter:appcenter-analytics:${appCenterSdkVersion}"
implementation "com.microsoft.appcenter:appcenter-crashes:${appCenterSdkVersion}"
implementation 'com.android.support:design:28.0.0'
implementation 'com.android.support:support-annotations:28.0.0'
implementation 'android.arch.lifecycle:extensions:1.1.1'
......@@ -101,7 +97,6 @@ dependencies {
implementation('com.google.android.gms:play-services-analytics:16.0.8') {
exclude group: 'com.google.firebase', module: 'firebase-iid'
}
implementation 'com.googlecode.android-query:android-query:0.25.9'
annotationProcessor 'com.jakewharton:butterknife-compiler:8.8.1'
implementation('com.crashlytics.sdk.android:crashlytics:2.9.0@aar') {
......@@ -124,14 +119,14 @@ dependencies {
implementation 'de.hdodenhof:circleimageview:3.0.0'
implementation 'com.github.bumptech.glide:glide:4.8.0'
annotationProcessor 'com.github.bumptech.glide:compiler:4.8.0'
implementation 'com.quickbirdstudios:opencv:4.1.0'
// implementation 'com.quickbirdstudios:opencv:4.1.0'
implementation 'org.jsoup:jsoup:1.11.3'
//static Reports Screen
implementation 'com.numetriclabz.numandroidcharts:numandroidcharts:1.0.9'
implementation 'info.hoang8f:android-segmented:1.0.6'
implementation 'com.github.PhilJay:MPAndroidChart:v2.1.6'
implementation 'com.android.support:multidex:1.0.3'
implementation files('libs/opencsv-4.6.jar')
}
apply plugin: 'com.google.gms.google-services'
No preview for this file type
......@@ -88,7 +88,8 @@
android:screenOrientation="portrait" />
<activity android:name=".ui.InAppWebViewActivity" />
<service android:name=".service.SyncService" />
<service android:name=".service.SyncService"
android:permission="android.permission.BIND_JOB_SERVICE" />
<provider
android:name="android.support.v4.content.FileProvider"
......
package com.vsoft.vera;
import android.app.job.JobInfo;
import android.app.job.JobScheduler;
import android.content.BroadcastReceiver;
import android.content.ComponentName;
import android.content.Context;
import android.content.Intent;
import android.content.IntentFilter;
......@@ -45,10 +48,11 @@ public class CatalogueApplication extends MultiDexApplication {
String action = intent.getStringExtra(Constants.APPLICATION_BROADCAST_DATA_ACTION);
Log.d(Constants.TAG, "CatalogueApplication: onReceive: action: " + action);
if (Constants.ACTION_SYNC.equals(action)) {
Intent syncMatchSummaryIntentIntent = new Intent(context, SyncService.class);
//Intent syncMatchSummaryIntentIntent = new Intent(context, SyncService.class);
if (Constants.DEBUG)
Log.d(Constants.TAG, "CatalogueApplication: Start SyncService");
context.startService(syncMatchSummaryIntentIntent);
//context.startService(syncMatchSummaryIntentIntent);
scheduleJob(context);
}
}
};
......@@ -75,6 +79,20 @@ public class CatalogueApplication extends MultiDexApplication {
}
};
// schedule the start of the service every 10 - 30 seconds
public static void scheduleJob(Context context) {
ComponentName serviceComponent = new ComponentName(context, SyncService.class);
JobInfo.Builder builder = new JobInfo.Builder(0, serviceComponent);
builder.setMinimumLatency(1 * 1000); // wait at least
builder.setOverrideDeadline(3 * 1000); // maximum delay
//builder.setRequiredNetworkType(JobInfo.NETWORK_TYPE_UNMETERED); // require unmetered network
//builder.setRequiresDeviceIdle(true); // device should be idle
//builder.setRequiresCharging(false); // we don't care if the device is charging or not
JobScheduler jobScheduler = context.getSystemService(JobScheduler.class);
jobScheduler.schedule(builder.build());
}
@Override
public void onCreate() {
super.onCreate();
......@@ -156,11 +174,8 @@ public class CatalogueApplication extends MultiDexApplication {
options.upgrade = true;
mSocket = IO.socket(Constants.CHAT_SERVER_URL,options);
// mSocket = IO.socket("http://10.1.8.229:12811",options);
mSocket.io().timeout(-1);
mSocket.io().reconnection(true);
mSocket.io().reconnectionDelay(0);
mSocket.io().reconnectionAttempts(2000);
} catch (URISyntaxException e) {
throw new RuntimeException(e);
}
......
package com.vsoft.vera.adapters;
import android.app.Activity;
import android.content.Context;
import android.content.Intent;
import android.net.Uri;
......@@ -10,6 +11,7 @@ import android.text.method.LinkMovementMethod;
import android.view.LayoutInflater;
import android.view.View;
import android.view.ViewGroup;
import android.view.inputmethod.InputMethodManager;
import android.webkit.JavascriptInterface;
import android.webkit.WebView;
import android.widget.Button;
......@@ -37,6 +39,7 @@ import org.jsoup.select.Elements;
import java.io.File;
import java.util.ArrayList;
import java.util.List;
import java.util.regex.Pattern;
public class ChatMessageAdapter extends RecyclerView.Adapter<ChatMessageAdapter.ViewHolder> {
......@@ -135,6 +138,8 @@ public class ChatMessageAdapter extends RecyclerView.Adapter<ChatMessageAdapter.
viewAllBT.setOnClickListener(new View.OnClickListener() {
@Override
public void onClick(View view) {
InputMethodManager imm = (InputMethodManager)mContext.getSystemService(Activity.INPUT_METHOD_SERVICE);
imm.hideSoftInputFromWindow(view.getWindowToken(), 0);
Intent intent = new Intent(mContext, MyIncidentScreen.class);
mContext.startActivity(intent);
......@@ -466,19 +471,28 @@ public class ChatMessageAdapter extends RecyclerView.Adapter<ChatMessageAdapter.
webView.getSettings().setJavaScriptEnabled(true);
webView.addJavascriptInterface(new WebAppInterface(mContext),"android");
webView.loadData(message, "text/html", "utf-8");
}else if( message.contains("I could find following 1") && message.contains("I could find following 2") && message.contains("I could find following 3")&&message.contains("I could find following 4")&&message.contains("I could find following 5") ){
hr_text_layt.setVisibility(View.VISIBLE);
mHRMessageView.setVisibility(View.VISIBLE);
viewAllBT.setVisibility(View.GONE);
mHRMessageView.setMovementMethod(LinkMovementMethod.getInstance());
mHRMessageView.setText(Util.fromHtml(message));
}else if(message.contains("I could find following ")) {
}else if( message.contains("I could find following ")){
String[] stringArray = message.split("I could find following ");
String textMessage = stringArray[1];
String splitMessage = textMessage;
String[] stringArray1 = splitMessage.split(" ");
int incidentNumber = Integer.parseInt(stringArray1[0]);
if(incidentNumber <= 6 ){
hr_text_layt.setVisibility(View.VISIBLE);
mHRMessageView.setVisibility(View.VISIBLE);
viewAllBT.setVisibility(View.GONE);
mHRMessageView.setMovementMethod(LinkMovementMethod.getInstance());
mHRMessageView.setText(Util.fromHtml(message));
}else {
hr_text_layt.setVisibility(View.VISIBLE);
mHRMessageView.setVisibility(View.VISIBLE);
viewAllBT.setVisibility(View.VISIBLE);
mHRMessageView.setMovementMethod(LinkMovementMethod.getInstance());
mHRMessageView.setText(Util.fromHtml(message));
}
hr_text_layt.setVisibility(View.VISIBLE);
mHRMessageView.setVisibility(View.VISIBLE);
viewAllBT.setVisibility(View.VISIBLE);
mHRMessageView.setMovementMethod(LinkMovementMethod.getInstance());
mHRMessageView.setText(Util.fromHtml(message));
}else if(message.contains("Ok, here's the link to the live agent:")) {
......
......@@ -40,12 +40,14 @@ import retrofit2.Retrofit;
public class IncidentApiManager {
public static void getIncident(Context context, GetIncidentApiListener listener) {
String sysId = PrefManager.getSharedPref(context, PrefManager.PREFERENCE_DYNAMIC_USER_SYS_ID);
CatalogueLog.d("IncidentApiManager: getIncident: ");
StringBuilder stringBuilder = new StringBuilder();
stringBuilder.append("caller_id=javascript:gs.getUserID()");
stringBuilder.append("caller_id="+sysId);
CatalogueLog.d("IncidentApiManager: getIncident: request parameter: "+stringBuilder.toString());
String accessToken = PrefManager.getSharedPref(context, PrefManager.PREFERENCE_ACCESS_TOKEN);
if(accessToken.isEmpty()) {
listener.onFailApiCall();
return;
......
......@@ -2,6 +2,7 @@ package com.vsoft.vera.db;
public interface DBConstants {
//Tables
String TABLE_CHAT_LOG = "chat_log";
String TABLE_CATALOGUE = "catalogue_category";
String TABLE_CATALOGUE_ITEM = "catalogue_category_item";
String TABLE_CATALOGUE_VARIABLES = "catalogue_variable";
......@@ -41,6 +42,16 @@ public interface DBConstants {
int SYNC_FLAG_DELETE = 3;
/**
* Chat log table
*/
String CHAT_ID = "chat_id";
String CHAT_CLIENT_MESSAGE = "client_message";
String CHAT_SERVER__RESPONSE = "server_response";
String CHAT_TIMESTAMP = "timestamp";
String CHAT_CONN_STATUS= "conn_status";
String CHAT_SOCKET_ID= "socket_id";
/**
* Catalogue table
*/
String CATALOGUE_ID = ID;
......@@ -405,6 +416,8 @@ public interface DBConstants {
*/
int CHAT_BOT_HISTORY_COLUMN_COUNT = 5;
int CHAT_LOG__COLUMN_COUNT = 5;
/**
* ChatBot User table
*/
......
......@@ -40,6 +40,7 @@ public class DBManager extends SQLiteOpenHelper implements DBConstants {
createCatalogueItemInputTable(db);
createAttachmentTable(db);
createIncidentInputTable(db);
createChatLogTable(db);
// if(Util.isNotificationsItemEnabled()) {
// createNotificationsTable(db);
......@@ -76,6 +77,17 @@ public class DBManager extends SQLiteOpenHelper implements DBConstants {
onCreate(db);
}
private void createChatLogTable(SQLiteDatabase db) {
db.execSQL("create table " + TABLE_CHAT_LOG + "("
+ CHAT_ID + " integer primary key autoincrement, "
+ CHAT_CLIENT_MESSAGE + " text, "
+ CHAT_SERVER__RESPONSE + " text, "
+ CHAT_TIMESTAMP + " text, "
+ CHAT_CONN_STATUS + " text, "
+ CHAT_SOCKET_ID + " text"
+ ");");
}
private void createCatalogueTable(SQLiteDatabase db) {
db.execSQL("create table " + TABLE_CATALOGUE + "("
+ CATALOGUE_ID + " integer primary key autoincrement, "
......
package com.vsoft.vera.db.managers;
import android.content.ContentValues;
import android.database.Cursor;
import android.database.sqlite.SQLiteDatabase;
import com.vsoft.vera.CatalogueApplication;
import com.vsoft.vera.db.DBConstants;
import com.vsoft.vera.db.models.ChatBotHistory;
import com.vsoft.vera.utils.ChatLog;
import com.vsoft.vera.utils.Util;
import java.util.ArrayList;
import java.util.Date;
import java.util.List;
/**
*
* @author Kunj on 05-04-2018.
*/
public class ChatLogManager implements DBConstants {
public static long save(ChatLog chatLog) {
SQLiteDatabase db = CatalogueApplication.getDatabase();
if (db != null) {
long id = db.insert(TABLE_CHAT_LOG, null, getChatLogContentValues(chatLog));
chatLog.setChatId(id);
return id;
} else {
return -1;
}
}
public static List<ChatLog> getAllChatLogHistory() {
SQLiteDatabase db = CatalogueApplication.getDatabase();
if (db != null) {
String queryString = "select * from " + TABLE_CHAT_LOG +";";
Cursor c = db.rawQuery(queryString, null);
ArrayList<ChatLog> chatLogList;
if (c.getCount() > 0) {
chatLogList = new ArrayList<>(c.getCount());
while (c.moveToNext()) {
ChatLog chatLog = new ChatLog();
chatLog.setChatId(c.getLong(0));
chatLog.setClientMessage(c.getString(1));
chatLog.setServerResponse(c.getString(2));
chatLog.setTimestamp(c.getString(3));
chatLog.setConnStatus(c.getString(4));
chatLog.setSocketConnId(c.getString(5));
chatLogList.add(chatLog);
}
} else {
chatLogList = new ArrayList<>(0);
}
c.close();
return chatLogList;
} else {
return new ArrayList<>(0);
}
}
public static int deleteAllRows() {
SQLiteDatabase db = CatalogueApplication.getDatabase();
if (db != null) {
return db.delete(TABLE_CHAT_LOG, null, null);
}
return -1;
}
public static void saveLogEvent(String clientMsg, String serverMsg, String connStatus, String connId, Date timestamp){
ChatLog chatLog = new ChatLog();
chatLog.setTimestamp(Util.getDateTime(timestamp.getTime()));
chatLog.setServerResponse(serverMsg);
chatLog.setClientMessage(clientMsg);
chatLog.setConnStatus(connStatus);
chatLog.setSocketConnId(connId);
ChatLogManager.save(chatLog);
}
private static ContentValues getChatLogContentValues(ChatLog chatLog) {
ContentValues cv = new ContentValues(CHAT_LOG__COLUMN_COUNT - 1);
cv.put(CHAT_CLIENT_MESSAGE, chatLog.getClientMessage());
cv.put(CHAT_SERVER__RESPONSE, chatLog.getServerResponse());
cv.put(CHAT_TIMESTAMP, chatLog.getTimestamp());
cv.put(CHAT_CONN_STATUS, chatLog.getConnStatus());
cv.put(CHAT_SOCKET_ID, chatLog.getSocketConnId());
return cv;
}
}
\ No newline at end of file
package com.vsoft.vera.service;
import android.app.IntentService;
import android.app.job.JobParameters;
import android.app.job.JobService;
import android.content.Intent;
import android.os.AsyncTask;
import com.vsoft.vera.CatalogueApplication;
import com.vsoft.vera.api.listeners.get.GetChatServerApiListener;
......@@ -62,29 +65,45 @@ import static com.vsoft.vera.db.managers.CatalogueItemInputManager.getDirtyItemI
*/
public class SyncService extends IntentService {
public class SyncService extends JobService {
private SyncStatus syncStatus = SyncStatus.FAIL;
public SyncService() {
super(SyncService.class.getSimpleName());
@Override
public boolean onStartJob(JobParameters params) {
BackgroundQueueAsync backgroundQueueAsync = new BackgroundQueueAsync();
backgroundQueueAsync.execute();
return false;
}
@Override
protected void onHandleIntent(Intent intent) {
CatalogueApplication application = (CatalogueApplication) getApplication();
if (!application.isNetConnected()) {
CatalogueLog.e("SyncService: onHandleIntent(): Not connected to net. Exit.");
return;
public boolean onStopJob(JobParameters params) {
return false;
}
public class BackgroundQueueAsync extends AsyncTask<Void, Void, Void> {
public BackgroundQueueAsync() {
}
if(Util.isChatItemEnabled()) {
if (application.getSocket() == null) {
getChatServerUrl();
@Override
protected Void doInBackground(Void... voids) {
CatalogueApplication application = (CatalogueApplication) getApplication();
if (!application.isNetConnected()) {
CatalogueLog.e("SyncService: onHandleIntent(): Not connected to net. Exit.");
}else{
if(Util.isChatItemEnabled()) {
if (application.getSocket() == null) {
getChatServerUrl();
}
}
startSync();
}
}
startSync();
return null;
}
}
/**
......
......@@ -15,10 +15,8 @@ import android.os.Handler;
import android.os.Looper;
import android.os.Message;
import android.preference.PreferenceManager;
import android.support.annotation.Nullable;
import android.support.v4.content.LocalBroadcastManager;
import android.support.v7.app.AppCompatActivity;
import android.telephony.TelephonyManager;
import android.text.TextUtils;
import android.util.Log;
import android.view.View;
......@@ -74,7 +72,6 @@ import org.json.JSONObject;
import java.util.HashMap;
import java.util.List;
import java.util.Locale;
import java.util.Map;
import java.util.concurrent.atomic.AtomicBoolean;
......@@ -172,9 +169,7 @@ public class ADALActivity extends AppCompatActivity {
}
});
getCountryCode();
// CheckLoginValues();
// CheckLoginValues();
callGraphButton = (Button) findViewById(R.id.callGraph);
signOutButton = (Button) findViewById(R.id.clearCache);
login_with_otp = (Button) findViewById(R.id.login_with_otp);
......@@ -194,6 +189,7 @@ public class ADALActivity extends AppCompatActivity {
});
login_with_otp.setOnClickListener(new View.OnClickListener() {
public void onClick(View v) {
// onSignOutClicked();
......@@ -334,10 +330,10 @@ public class ADALActivity extends AppCompatActivity {
try {
root = new JSONObject(response.toString());
String userLoginName = root.getString("givenName");
/*Send broadcast to start SyncService*/
String mail = root.getString("mail");
PrefManager.setSharedPref(ADALActivity.this, PrefManager.PREFERENCE_USER_FULL_NAME, userLoginName);
PrefManager.setSharedPref(ADALActivity.this, PrefManager.PREFERENCE_USER_EMAIL_ID, mail);
/*Send broadcast to start SyncService*/
if(!isLogin){
new LoginDetailsSendToServer().execute();
......@@ -664,32 +660,49 @@ public class ADALActivity extends AppCompatActivity {
DialogUtils.showNoConnectionDialog(ADALActivity.this);
}
String generateRandoStrPharma = GenerateRandomString.randomString(30);
PrefManager.setSharedPref(ADALActivity.this, PrefManager.SESSION_ID, generateRandoStrPharma);
String firstName = mUserDetails.get(0).getFirstName();
String lastName = mUserDetails.get(0).getLastName();
// String sysid = mUserDetails.get(0).getSysId();
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(ADALActivity.this, PrefManager.PREFERENCE_USER_FIRST_NAME, firstName);
PrefManager.setSharedPref(ADALActivity.this, PrefManager.PREFERENCE_USER_LAST_NAME, lastName);
PrefManager.setSharedPref(ADALActivity.this, PrefManager.PREFERENCE_USER_SYS_ID, sysid);
/*For pre fill value in variable form*/
PrefManager.setSharedPref(ADALActivity.this, PrefManager.PREFERENCE_USER_ID, userId);
new GetyUserSysIDAsync().execute();
//
//
} else {
Util.simpleAlert(ADALActivity.this,getResources().getString(R.string.user_detail_not_available));
}
......@@ -701,7 +714,6 @@ public class ADALActivity extends AppCompatActivity {
}
}
private class GetyUserSysIDAsync extends AsyncTask<Void, Void, SyncStatus> {
private ProgressDialog progressDialog;
private SyncStatus syncStatus = SyncStatus.FAIL;
......@@ -732,6 +744,7 @@ public class ADALActivity extends AppCompatActivity {
public void onDoneApiCall(String url) {
userSysId = url;
PrefManager.setSharedPref(ADALActivity.this, PrefManager.PREFERENCE_DYNAMIC_USER_SYS_ID, userSysId);
syncStatus = SyncStatus.SUCCESS;
}
......@@ -754,28 +767,8 @@ public class ADALActivity extends AppCompatActivity {
if (syncStatus == SyncStatus.SUCCESS) {
if(userSysId != null){
PrefManager.setSharedPref(ADALActivity.this, PrefManager.PREFERENCE_USER_SYS_ID, userSysId);
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(userSysId);
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(userSysId)
.setName(userFullName)
.build();
ChatBotUserManager.save(chatBotUser);
} else {//Update the name of user
localChatBotUser.setName(userFullName);
ChatBotUserManager.update(localChatBotUser);
}
}
/*Send broadcast to start SyncService*/
Intent intent = new Intent(Constants.APPLICATION_BROADCAST_INTENT);
intent.putExtra(Constants.APPLICATION_BROADCAST_DATA_ACTION, Constants.ACTION_SYNC);
......@@ -809,27 +802,4 @@ public class ADALActivity extends AppCompatActivity {
}
}
/*
* getCountryCode - To get the Country mobile code dynamically.
*
* @return void
* */
public void getCountryCode() {
try {
TelephonyManager telephonyManager =
(TelephonyManager) this.getSystemService(Context.TELEPHONY_SERVICE);
if (telephonyManager != null) {
String countryName = telephonyManager.getNetworkCountryIso();
if(countryName.equalsIgnoreCase("us")) {
Constants.TWILIO_COUNTRY_CODE = "+1";
}
if(countryName.equalsIgnoreCase("in")) {
Constants.TWILIO_COUNTRY_CODE = "+91";
}
}
} catch (Exception e) {
Constants.TWILIO_COUNTRY_CODE = "+1";
}
}
}
......@@ -366,6 +366,27 @@ public class OtpValidationActivity extends Activity {
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*/
......@@ -443,28 +464,8 @@ public class OtpValidationActivity extends Activity {
if (syncStatus == SyncStatus.SUCCESS) {
if(userSysId != null){
PrefManager.setSharedPref(OtpValidationActivity.this, PrefManager.PREFERENCE_USER_SYS_ID, userSysId);
PrefManager.setSharedPref(OtpValidationActivity.this, PrefManager.PREFERENCE_DYNAMIC_USER_SYS_ID, userSysId);
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(userSysId);
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(userSysId)
.setName(userFullName)
.build();
ChatBotUserManager.save(chatBotUser);
} else {//Update the name of user
localChatBotUser.setName(userFullName);
ChatBotUserManager.update(localChatBotUser);
}
}
/*Send broadcast to start SyncService*/
Intent intent = new Intent(Constants.APPLICATION_BROADCAST_INTENT);
intent.putExtra(Constants.APPLICATION_BROADCAST_DATA_ACTION, Constants.ACTION_SYNC);
......
package com.vsoft.vera.utils;
public class ChatLog {
private Long chatId;
/**
* socket connection id
*/
private String socketConnId;
private String serverResponse;
private String timestamp;
/**
* socket connection status
* true or false
*/
private String connStatus;
private String clientMessage;
public String getSocketConnId() {
return socketConnId;
}
public void setSocketConnId(String socketConnId) {
this.socketConnId = socketConnId;
}
public Long getChatId() {
return chatId;
}
public void setChatId(Long chatId) {
this.chatId = chatId;
}
public String getClientMessage() {
return clientMessage;
}
public void setClientMessage(String clientMessage) {
this.clientMessage = clientMessage;
}
public String getServerResponse() {
return serverResponse;
}
public void setServerResponse(String serverResponse) {
this.serverResponse = serverResponse;
}
public String getTimestamp() {
return timestamp;
}
public void setTimestamp(String timestamp) {
this.timestamp = timestamp;
}
public String getConnStatus() {
return connStatus;
}
public void setConnStatus(String connStatus) {
this.connStatus = connStatus;
}
}
......@@ -11,7 +11,8 @@ import com.vsoft.vera.api.interfaces.PendingApprovalsApi;
public class Constants {
public static final String TAG = AppConfig.APP_INTERNAL_NAME;
public static String TWILIO_COUNTRY_CODE;// = "+91";
//default set to us
public static String TWILIO_COUNTRY_CODE = "+1";
public static final String[] month = {"Jan", "Feb", "Mar", "Apr", "May", "Jun", "Jul", "Aug", "Sep", "Oct", "Nov", "Dec"};
/**
......
......@@ -11,6 +11,7 @@ public class PrefManager {
public static final String PREFERENCE_USER_FIRST_NAME = "firstName";
public static final String PREFERENCE_USER_LAST_NAME = "lastName";
public static final String PREFERENCE_USER_SYS_ID = "sysId";
public static final String PREFERENCE_DYNAMIC_USER_SYS_ID = "dynamic_sysId";
public static final String PREFERENCE_USER_FULL_NAME = "full_name";
public static final String PREFERENCE_USER_ID = "user_id";
public static final String PREFERENCE_USER_EMAIL_ID = "user_email_id";
......
......@@ -7,5 +7,9 @@
android:id="@+id/more_menu_clear"
android:icon="@drawable/ic_clear_black"
android:title="Clear Chat" />
<item
android:id="@+id/export_log"
android:title="Export Log" />
</menu>
[{"outputType":{"type":"APK"},"apkData":{"type":"MAIN","splits":[],"versionCode":1,"versionName":"0.1.8","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.2.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
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