Commit 2d02a6e4 by Prabhu Chaitanya Areti

changed url's through service

parents 6bcc8602 dfab12f6
...@@ -18,28 +18,29 @@ android { ...@@ -18,28 +18,29 @@ android {
flavorDimensions "tier" flavorDimensions "tier"
signingConfigs { signingConfigs {
debug { debug {
// keyAlias 'androiddebugkey'
// keyPassword 'android' keyAlias 'vportal'
// storeFile file('/Users/chaukadev/.android/debug.keystore') keyPassword 'vportal'
// storePassword 'android' storeFile file('vportal.jks')
storePassword 'vportal'
} }
config { config {
// keyAlias 'Uofl' keyAlias 'vportal'
// keyPassword 'Vsoft@123' keyPassword 'vportal'
// storeFile file('/Users/apple/Desktop/uofl_builds/Uofl_keys') storeFile file('vportal.jks')
// storePassword 'Vsoft@123' storePassword 'vportal'
} }
} }
compileSdkVersion 27 compileSdkVersion 27
buildToolsVersion "27.0.0" buildToolsVersion "27.0.3"
defaultConfig { defaultConfig {
applicationId "com.vsoft.servicenow" applicationId "com.vsoft.servicenow"
minSdkVersion 15 minSdkVersion 15
targetSdkVersion 27 targetSdkVersion 27
versionCode 1 versionCode 1
versionName "0.0.33" versionName "0.0.1"
multiDexEnabled true multiDexEnabled true
} }
buildTypes { buildTypes {
...@@ -55,8 +56,8 @@ android { ...@@ -55,8 +56,8 @@ android {
signingConfig signingConfigs.config signingConfig signingConfigs.config
} }
staging { //staging is the UAT environment staging { //staging is the UAT environment
applicationIdSuffix ".staging" //applicationIdSuffix ".staging"
debuggable true debuggable false
buildConfigField "int", "BUILD_TYPE_INT", "3" buildConfigField "int", "BUILD_TYPE_INT", "3"
signingConfig signingConfigs.debug signingConfig signingConfigs.debug
} }
...@@ -93,7 +94,8 @@ dependencies { ...@@ -93,7 +94,8 @@ dependencies {
compile 'com.squareup.retrofit2:converter-gson:2.3.0' compile 'com.squareup.retrofit2:converter-gson:2.3.0'
compile 'com.squareup.okhttp3:logging-interceptor:3.8.1' compile 'com.squareup.okhttp3:logging-interceptor:3.8.1'
compile 'com.jakewharton:butterknife:8.8.1' compile 'com.jakewharton:butterknife:8.8.1'
compile 'com.google.android.gms:play-services-analytics:12.0.1' compile 'com.google.android.gms:play-services-analytics:15.0.0'
compile 'com.googlecode.android-query:android-query:0.25.9'
//compile 'com.google.dagger:dagger:2.0' //compile 'com.google.dagger:dagger:2.0'
//annotationProcessor 'com.google.dagger:dagger-compiler:2.0' //annotationProcessor 'com.google.dagger:dagger-compiler:2.0'
annotationProcessor 'com.jakewharton:butterknife-compiler:8.8.1' annotationProcessor 'com.jakewharton:butterknife-compiler:8.8.1'
...@@ -102,13 +104,13 @@ dependencies { ...@@ -102,13 +104,13 @@ dependencies {
} }
compile 'com.squareup.picasso:picasso:2.5.2' compile 'com.squareup.picasso:picasso:2.5.2'
compile 'com.github.nkzawa:socket.io-client:0.3.0' compile 'com.github.nkzawa:socket.io-client:0.3.0'
compile 'com.android.support:appcompat-v7:27.1.0' compile 'com.android.support:appcompat-v7:27.1.1'
compile 'com.android.support:cardview-v7:27.1.0' compile 'com.android.support:cardview-v7:27.1.1'
compile 'com.android.support:recyclerview-v7:27.1.0' compile 'com.android.support:recyclerview-v7:27.1.1'
compile 'com.android.support:animated-vector-drawable:27.1.0' compile 'com.android.support:animated-vector-drawable:27.1.1'
compile 'com.android.support:support-media-compat:27.1.0' compile 'com.android.support:support-media-compat:27.1.1'
compile 'com.android.support:support-v4:27.1.0' compile 'com.android.support:support-v4:27.1.1'
compile 'com.google.firebase:firebase-messaging:12.0.1' compile 'com.google.firebase:firebase-messaging:15.0.0'
implementation 'com.android.support.constraint:constraint-layout:1.1.0' implementation 'com.android.support.constraint:constraint-layout:1.1.0'
} }
......
...@@ -12,6 +12,8 @@ import android.support.v4.content.LocalBroadcastManager; ...@@ -12,6 +12,8 @@ import android.support.v4.content.LocalBroadcastManager;
import android.util.Log; import android.util.Log;
import android.widget.Toast; import android.widget.Toast;
import com.androidquery.AQuery;
import com.androidquery.callback.AjaxStatus;
import com.crashlytics.android.Crashlytics; import com.crashlytics.android.Crashlytics;
import com.github.nkzawa.socketio.client.IO; import com.github.nkzawa.socketio.client.IO;
import com.github.nkzawa.socketio.client.Socket; import com.github.nkzawa.socketio.client.Socket;
...@@ -25,6 +27,9 @@ import com.vsoft.servicenow.utils.Constants; ...@@ -25,6 +27,9 @@ import com.vsoft.servicenow.utils.Constants;
import com.vsoft.servicenow.utils.PrefManager; import com.vsoft.servicenow.utils.PrefManager;
import com.vsoft.servicenow.utils.Util; import com.vsoft.servicenow.utils.Util;
import org.json.JSONException;
import org.json.JSONObject;
import java.net.URISyntaxException; import java.net.URISyntaxException;
import io.fabric.sdk.android.Fabric; import io.fabric.sdk.android.Fabric;
...@@ -87,15 +92,8 @@ public class CatalogueApplication extends Application { ...@@ -87,15 +92,8 @@ public class CatalogueApplication extends Application {
/*Database is created*/ /*Database is created*/
initializeDatabase(); initializeDatabase();
configureURL();
if(Util.isChatItemEnabled()) {
initializeSocket();
}
IntentFilter intentFilter = new IntentFilter();
intentFilter.addAction(ConnectivityManager.CONNECTIVITY_ACTION);
mNetworkChangeReceiver = new NetworkChangeReceiver();
registerReceiver(mNetworkChangeReceiver, intentFilter);
} }
@Override @Override
...@@ -151,4 +149,28 @@ public class CatalogueApplication extends Application { ...@@ -151,4 +149,28 @@ public class CatalogueApplication extends Application {
public Socket getSocket() { public Socket getSocket() {
return mSocket; return mSocket;
} }
private void configureURL(){
AQuery aq;
aq = new AQuery(this);
aq.ajax("http://ai.test.vsoftconsulting.com:3000/?env=test", JSONObject.class, this, "jsonCallback");
}
public void jsonCallback(String url, JSONObject json, AjaxStatus status) {
//When JSON is not null
try {
if (json != null) {
AppConfig.CHAT_SERVER_URL_STAGING=json.getString("chatbot_url");
if(Util.isChatItemEnabled()) {
initializeSocket();
}
IntentFilter intentFilter = new IntentFilter();
intentFilter.addAction(ConnectivityManager.CONNECTIVITY_ACTION);
mNetworkChangeReceiver = new NetworkChangeReceiver();
registerReceiver(mNetworkChangeReceiver, intentFilter);
}
} catch (JSONException e) {
Log.i("Exception e", e + "");
}
}
} }
...@@ -18,6 +18,7 @@ import com.vsoft.servicenow.R; ...@@ -18,6 +18,7 @@ import com.vsoft.servicenow.R;
import com.vsoft.servicenow.db.managers.NotificationsManager; import com.vsoft.servicenow.db.managers.NotificationsManager;
import com.vsoft.servicenow.db.models.Notifications; import com.vsoft.servicenow.db.models.Notifications;
import com.vsoft.servicenow.ui.NotificationScreen; import com.vsoft.servicenow.ui.NotificationScreen;
import com.vsoft.servicenow.ui.PendingApprovalsActivity;
import com.vsoft.servicenow.utils.Constants; import com.vsoft.servicenow.utils.Constants;
import com.vsoft.servicenow.utils.PrefManager; import com.vsoft.servicenow.utils.PrefManager;
...@@ -33,11 +34,18 @@ import java.util.Map; ...@@ -33,11 +34,18 @@ import java.util.Map;
*/ */
public class NotificationMessagingService extends FirebaseMessagingService { public class NotificationMessagingService extends FirebaseMessagingService {
private static final String MESSAGE_BODY_INCIDENT_TITLE = "Incidents";
private static final String MESSAGE_BODY_HR_CASE_TITLE = "HR Cases";
private static final String MESSAGE_BODY_REQUEST_TITLE = "Order Services";
private static final String MESSAGE_BODY_APPROVALS_TITLE = "My Approvals";
private static final String FCM_KEY_TITLE = "title"; private static final String FCM_KEY_TITLE = "title";
private static final String FCM_KEY_BODY = "body"; private static final String FCM_KEY_BODY = "body";
private static final String FCM_KEY_PRIORITY = "priority"; private static final String FCM_KEY_REQUEST_STATE = "state";
private static final String FCM_KEY_INCIDENT_PRIORITY = "priority";
private static final String FCM_KEY_SHORT_DESCRIPTION = "short_description"; private static final String FCM_KEY_SHORT_DESCRIPTION = "short_description";
private static final String FCM_KEY_CREATED_BY = "created_by"; private static final String FCM_KEY_CREATED_BY = "created_by";
private static final String FCM_KEY_MESSAGE_BODY_TITLE = "title";
private static final String CHANNEL_ID = "sn_channel"; private static final String CHANNEL_ID = "sn_channel";
...@@ -55,47 +63,94 @@ public class NotificationMessagingService extends FirebaseMessagingService { ...@@ -55,47 +63,94 @@ public class NotificationMessagingService extends FirebaseMessagingService {
Map<String, String> dataMap = remoteMessage.getData(); Map<String, String> dataMap = remoteMessage.getData();
String title = dataMap.get(FCM_KEY_TITLE); String title = dataMap.get(FCM_KEY_TITLE);
String messageBody = dataMap.get(FCM_KEY_BODY); String messageBody = dataMap.get(FCM_KEY_BODY);
String priority = null, shortDes = null, createdBy = null; String priority = null, shortDes = null, createdBy = null, messageBodyTitle = null, requestState = null, documentId = null;
try { try {
JSONObject jsonObject = new JSONObject(messageBody); JSONObject jsonObject = new JSONObject(messageBody);
priority = jsonObject.getString(FCM_KEY_PRIORITY); if(!jsonObject.isNull(FCM_KEY_INCIDENT_PRIORITY)) {
shortDes = jsonObject.getString(FCM_KEY_SHORT_DESCRIPTION); priority = jsonObject.getString(FCM_KEY_INCIDENT_PRIORITY);
}
if(!jsonObject.isNull(FCM_KEY_SHORT_DESCRIPTION)) {
shortDes = jsonObject.getString(FCM_KEY_SHORT_DESCRIPTION);
}
if(!jsonObject.isNull(FCM_KEY_REQUEST_STATE)) {
requestState = jsonObject.getString(FCM_KEY_REQUEST_STATE);
}
createdBy = jsonObject.getString(FCM_KEY_CREATED_BY); createdBy = jsonObject.getString(FCM_KEY_CREATED_BY);
messageBodyTitle = jsonObject.getString(FCM_KEY_MESSAGE_BODY_TITLE);
} catch (JSONException e) { } catch (JSONException e) {
e.printStackTrace(); e.printStackTrace();
} }
Notifications newNotification = new Notifications(); Notifications newNotification = null;
newNotification.setTitle(title); if(messageBodyTitle.equals(MESSAGE_BODY_INCIDENT_TITLE)) {
newNotification.setShortDescription(shortDes); newNotification = new Notifications();
newNotification.setPriority(priority); newNotification.setTitle(title);
newNotification.setCreated_by(createdBy); newNotification.setShortDescription(shortDes);
NotificationsManager.save(newNotification); newNotification.setPriority(priority);
newNotification.setCreated_by(createdBy);
NotificationsManager.save(newNotification);
} else if(messageBodyTitle.equals(MESSAGE_BODY_REQUEST_TITLE)) {
newNotification = new Notifications();
newNotification.setTitle(title);
newNotification.setShortDescription(shortDes);
newNotification.setPriority(requestState);
newNotification.setCreated_by(createdBy);
NotificationsManager.save(newNotification);
} else if(messageBodyTitle.equals(MESSAGE_BODY_APPROVALS_TITLE)) {
newNotification = new Notifications();
newNotification.setTitle(title);
newNotification.setShortDescription(shortDes);
newNotification.setPriority(requestState);
newNotification.setCreated_by(createdBy);
}
sendNotification(newNotification, messageBodyTitle, null);
sendNotification(newNotification); if(messageBodyTitle.equals(MESSAGE_BODY_APPROVALS_TITLE)) {
sendLocalMessage(NotificationMessagingService.this, newNotification); sendLocalMessage(NotificationMessagingService.this, newNotification, true);
} else {
sendLocalMessage(NotificationMessagingService.this, newNotification, false);
}
} }
} }
private void sendLocalMessage(Context context, Notifications notifications) { private void sendLocalMessage(Context context, Notifications notifications, boolean isApproval) {
Intent intent = new Intent(Constants.BROADCAST_NOTIFICATION); Intent intent = new Intent(Constants.BROADCAST_NOTIFICATION);
intent.putExtra(Constants.DATA_KEY_NOTIFICATION_TITLE, notifications.getTitle()); intent.putExtra(Constants.DATA_KEY_NOTIFICATION_TITLE, notifications.getTitle());
intent.putExtra(Constants.DATA_KEY_NOTIFICATION_MESSAGE, notifications.getShortDescription()); intent.putExtra(Constants.DATA_KEY_NOTIFICATION_MESSAGE, notifications.getShortDescription());
intent.putExtra(Constants.DATA_KEY_NOTIFICATION_IS_APPROVALS, isApproval);
LocalBroadcastManager.getInstance(context).sendBroadcast(intent); LocalBroadcastManager.getInstance(context).sendBroadcast(intent);
} }
private void sendNotification(Notifications notification) { private void sendNotification(Notifications notification, String messageBodyTitle, String documentId) {
Intent newIntent = new Intent(this, NotificationScreen.class); String title = null;
Intent newIntent = null;
if(messageBodyTitle.equals(MESSAGE_BODY_APPROVALS_TITLE)) {
title = getString(R.string.notification_status_bar_approvals_title_string);
newIntent = new Intent(this, PendingApprovalsActivity.class);
} else if(messageBodyTitle.equals(MESSAGE_BODY_INCIDENT_TITLE)) {
title = getString(R.string.notification_status_bar_incident_title_string);
newIntent = new Intent(this, NotificationScreen.class);
} else if(messageBodyTitle.equals(MESSAGE_BODY_REQUEST_TITLE)) {
title = getString(R.string.notification_status_bar_request_title_string);
newIntent = new Intent(this, NotificationScreen.class);
} else if(messageBodyTitle.equals(MESSAGE_BODY_HR_CASE_TITLE)) {
title = getString(R.string.notification_status_bar_hr_case_title_string);
newIntent = new Intent(this, NotificationScreen.class);
}
newIntent.setFlags(Intent.FLAG_ACTIVITY_SINGLE_TOP); newIntent.setFlags(Intent.FLAG_ACTIVITY_SINGLE_TOP);
PendingIntent pendingIntent = PendingIntent.getActivity(this, 0, newIntent, PendingIntent pendingIntent = PendingIntent.getActivity(this, 0, newIntent,
PendingIntent.FLAG_ONE_SHOT); PendingIntent.FLAG_ONE_SHOT);
Uri defaultSoundUri = RingtoneManager.getDefaultUri(RingtoneManager.TYPE_NOTIFICATION); Uri defaultSoundUri = RingtoneManager.getDefaultUri(RingtoneManager.TYPE_NOTIFICATION);
NotificationCompat.Builder notificationBuilder = new NotificationCompat.Builder(this)
NotificationCompat.Builder notificationBuilder = new NotificationCompat.Builder(this, CHANNEL_ID)
.setSmallIcon(R.drawable.notification_icon) .setSmallIcon(R.drawable.notification_icon)
.setContentTitle(getString(R.string.notification_status_bar_title_string)) .setContentTitle(title)
.setContentText(notification.getShortDescription()) .setContentText(notification != null ? notification.getShortDescription() : documentId)
.setAutoCancel(true) .setAutoCancel(true)
.setContentIntent(pendingIntent) .setContentIntent(pendingIntent)
.setChannelId(CHANNEL_ID) .setChannelId(CHANNEL_ID)
...@@ -111,7 +166,6 @@ public class NotificationMessagingService extends FirebaseMessagingService { ...@@ -111,7 +166,6 @@ public class NotificationMessagingService extends FirebaseMessagingService {
notificationManager.createNotificationChannel(mChannel); notificationManager.createNotificationChannel(mChannel);
} }
notificationManager.notify(1, notificationBuilder.build()); notificationManager.notify(1, notificationBuilder.build());
} }
} }
...@@ -10,10 +10,10 @@ import com.vsoft.servicenow.api.listeners.post.PostHRCaseVariableFormApiListener ...@@ -10,10 +10,10 @@ import com.vsoft.servicenow.api.listeners.post.PostHRCaseVariableFormApiListener
import com.vsoft.servicenow.api.listeners.post.PostIncidentApiListener; import com.vsoft.servicenow.api.listeners.post.PostIncidentApiListener;
import com.vsoft.servicenow.api.listeners.post.PostVariableFormApiListener; import com.vsoft.servicenow.api.listeners.post.PostVariableFormApiListener;
import com.vsoft.servicenow.api.managers.CatalogueVariableApiManager; import com.vsoft.servicenow.api.managers.CatalogueVariableApiManager;
import com.vsoft.servicenow.api.managers.HRCaseItemApiManager;
import com.vsoft.servicenow.api.managers.HRCaseVariableApiManager; import com.vsoft.servicenow.api.managers.HRCaseVariableApiManager;
import com.vsoft.servicenow.api.managers.IncidentApiManager; import com.vsoft.servicenow.api.managers.IncidentApiManager;
import com.vsoft.servicenow.api.pojos.HRCaseVariableSubmitApiResponse; import com.vsoft.servicenow.api.pojos.HRCaseVariableSubmitApiResponse;
import com.vsoft.servicenow.db.DBConstants;
import com.vsoft.servicenow.db.managers.AttachmentManager; import com.vsoft.servicenow.db.managers.AttachmentManager;
import com.vsoft.servicenow.db.managers.CatalogueItemInputManager; import com.vsoft.servicenow.db.managers.CatalogueItemInputManager;
import com.vsoft.servicenow.db.managers.CatalogueItemManager; import com.vsoft.servicenow.db.managers.CatalogueItemManager;
...@@ -31,8 +31,8 @@ import com.vsoft.servicenow.db.models.Incident; ...@@ -31,8 +31,8 @@ import com.vsoft.servicenow.db.models.Incident;
import com.vsoft.servicenow.enums.SyncStatus; import com.vsoft.servicenow.enums.SyncStatus;
import com.vsoft.servicenow.utils.CatalogueLog; import com.vsoft.servicenow.utils.CatalogueLog;
import com.vsoft.servicenow.utils.Constants; import com.vsoft.servicenow.utils.Constants;
import com.vsoft.servicenow.db.DBConstants;
import com.vsoft.servicenow.utils.PrefManager; import com.vsoft.servicenow.utils.PrefManager;
import com.vsoft.servicenow.utils.Util;
import org.json.JSONException; import org.json.JSONException;
import org.json.JSONObject; import org.json.JSONObject;
...@@ -48,10 +48,10 @@ import java.util.List; ...@@ -48,10 +48,10 @@ import java.util.List;
import okhttp3.MediaType; import okhttp3.MediaType;
import okhttp3.RequestBody; import okhttp3.RequestBody;
import static com.vsoft.servicenow.db.managers.CatalogueItemInputManager.getDirtyItemInput;
import static com.vsoft.servicenow.db.DBConstants.CATALOGUE_ITEM_INPUT_SYS_ID; import static com.vsoft.servicenow.db.DBConstants.CATALOGUE_ITEM_INPUT_SYS_ID;
import static com.vsoft.servicenow.db.DBConstants.INCIDENT_INPUT_NUMBER; import static com.vsoft.servicenow.db.DBConstants.INCIDENT_INPUT_NUMBER;
import static com.vsoft.servicenow.db.DBConstants.SYNC_FLAG_NONE; import static com.vsoft.servicenow.db.DBConstants.SYNC_FLAG_NONE;
import static com.vsoft.servicenow.db.managers.CatalogueItemInputManager.getDirtyItemInput;
/** /**
...@@ -62,6 +62,7 @@ import static com.vsoft.servicenow.db.DBConstants.SYNC_FLAG_NONE; ...@@ -62,6 +62,7 @@ import static com.vsoft.servicenow.db.DBConstants.SYNC_FLAG_NONE;
public class SyncService extends IntentService { public class SyncService extends IntentService {
private SyncStatus syncStatus = SyncStatus.FAIL; private SyncStatus syncStatus = SyncStatus.FAIL;
public SyncService() { public SyncService() {
super(SyncService.class.getSimpleName()); super(SyncService.class.getSimpleName());
} }
...@@ -69,7 +70,7 @@ public class SyncService extends IntentService { ...@@ -69,7 +70,7 @@ public class SyncService extends IntentService {
@Override @Override
protected void onHandleIntent(Intent intent) { protected void onHandleIntent(Intent intent) {
CatalogueApplication mApplication = (CatalogueApplication) getApplication(); CatalogueApplication mApplication = (CatalogueApplication) getApplication();
if(!mApplication.isNetConnected()) { if (!mApplication.isNetConnected()) {
CatalogueLog.e("SyncService: onHandleIntent(): Not connected to net. Exit."); CatalogueLog.e("SyncService: onHandleIntent(): Not connected to net. Exit.");
return; return;
} }
...@@ -81,47 +82,59 @@ public class SyncService extends IntentService { ...@@ -81,47 +82,59 @@ public class SyncService extends IntentService {
SyncStatus result; SyncStatus result;
/*First we will work on dirty variable form*/ /*First we will work on dirty variable form*/
List<CatalogueItemInput> catalogueItemInputList = getDirtyItemInput(); List<CatalogueItemInput> catalogueItemInputList = getDirtyItemInput();
if(Constants.DEBUG) CatalogueLog.d("startSync: catalogue form to sync: "+catalogueItemInputList.size()); if (Constants.DEBUG)
CatalogueLog.d("startSync: catalogue form to sync: " + catalogueItemInputList.size());
for (int i = 0; i < catalogueItemInputList.size(); i++) { for (int i = 0; i < catalogueItemInputList.size(); i++) {
CatalogueItemInput catalogueItemInput = catalogueItemInputList.get(i); CatalogueItemInput catalogueItemInput = catalogueItemInputList.get(i);
result = syncVariableForm(catalogueItemInput); result = syncVariableForm(catalogueItemInput);
if(Constants.DEBUG) CatalogueLog.d("startSync: result of syncing catalogueItemInput "+i+": "+result); if (Constants.DEBUG)
CatalogueLog.d("startSync: result of syncing catalogueItemInput " + i + ": " + result);
} }
/*Then we will work on dirty attachment*/ /*Then we will work on dirty attachment*/
List<Attachment> attachmentList = AttachmentManager.getDirtyAttachment(); List<Attachment> attachmentList = AttachmentManager.getDirtyAttachment();
if(Constants.DEBUG) CatalogueLog.d("startSync: attachment to sync: "+attachmentList.size()); if (Constants.DEBUG)
CatalogueLog.d("startSync: attachment to sync: " + attachmentList.size());
for (int i = 0; i < attachmentList.size(); i++) { for (int i = 0; i < attachmentList.size(); i++) {
Attachment attachment = attachmentList.get(i); Attachment attachment = attachmentList.get(i);
result = syncAttachment(attachment); result = syncAttachment(attachment);
if(Constants.DEBUG) CatalogueLog.d("startSync: result of syncing attachment "+i+": "+result); if (Constants.DEBUG)
CatalogueLog.d("startSync: result of syncing attachment " + i + ": " + result);
} }
/*Then we will work on dirty variable form*/ if (Util.isHrCaseEnabled()) {
List<HRCaseItemInput> hrCaseItemInputList = HRCaseItemInputManager.getDirtyItemInput(); /*Then we will work on dirty variable form*/
if(Constants.DEBUG) CatalogueLog.d("startSync: HRCase form to sync: "+hrCaseItemInputList.size()); List<HRCaseItemInput> hrCaseItemInputList = HRCaseItemInputManager.getDirtyItemInput();
for (int i = 0; i < hrCaseItemInputList.size(); i++) { if (Constants.DEBUG)
HRCaseItemInput hrCaseItemInput = hrCaseItemInputList.get(i); CatalogueLog.d("startSync: HRCase form to sync: " + hrCaseItemInputList.size());
result = syncHRCaseVariableForm(hrCaseItemInput); for (int i = 0; i < hrCaseItemInputList.size(); i++) {
if(Constants.DEBUG) CatalogueLog.d("startSync: result of syncing hrCaseItemInput "+i+": "+result); HRCaseItemInput hrCaseItemInput = hrCaseItemInputList.get(i);
} result = syncHRCaseVariableForm(hrCaseItemInput);
if (Constants.DEBUG)
CatalogueLog.d("startSync: result of syncing hrCaseItemInput " + i + ": " + result);
}
/*Then we will work on dirty HRCase attachment*/ /*Then we will work on dirty HRCase attachment*/
List<HRCaseAttachment> hrCaseAttachmentList = HRCaseAttachmentManager.getDirtyHRCaseAttachment(); List<HRCaseAttachment> hrCaseAttachmentList = HRCaseAttachmentManager.getDirtyHRCaseAttachment();
if(Constants.DEBUG) CatalogueLog.d("startSync: HRCaseAttachment to sync: "+hrCaseAttachmentList.size()); if (Constants.DEBUG)
for (int i = 0; i < hrCaseAttachmentList.size(); i++) { CatalogueLog.d("startSync: HRCaseAttachment to sync: " + hrCaseAttachmentList.size());
HRCaseAttachment hrCaseAttachment = hrCaseAttachmentList.get(i); for (int i = 0; i < hrCaseAttachmentList.size(); i++) {
result = syncHRCaseAttachment(hrCaseAttachment); HRCaseAttachment hrCaseAttachment = hrCaseAttachmentList.get(i);
if(Constants.DEBUG) CatalogueLog.d("startSync: result of syncing hrCaseAttachment "+i+": "+result); result = syncHRCaseAttachment(hrCaseAttachment);
if (Constants.DEBUG)
CatalogueLog.d("startSync: result of syncing hrCaseAttachment " + i + ": " + result);
}
} }
/*Then we will work on dirty incident form*/ /*Then we will work on dirty incident form*/
List<Incident> incidentInputList = ReportIncidentValueManager.getDirtyIncident(); List<Incident> incidentInputList = ReportIncidentValueManager.getDirtyIncident();
if(Constants.DEBUG) CatalogueLog.d("startSync: incident form to sync: "+incidentInputList.size()); if (Constants.DEBUG)
CatalogueLog.d("startSync: incident form to sync: " + incidentInputList.size());
for (int i = 0; i < incidentInputList.size(); i++) { for (int i = 0; i < incidentInputList.size(); i++) {
Incident incident = incidentInputList.get(i); Incident incident = incidentInputList.get(i);
result = syncIncidentForm(incident); result = syncIncidentForm(incident);
if(Constants.DEBUG) CatalogueLog.d("startSync: result of syncing incidentInput "+i+": "+result); if (Constants.DEBUG)
CatalogueLog.d("startSync: result of syncing incidentInput " + i + ": " + result);
} }
} }
...@@ -129,26 +142,26 @@ public class SyncService extends IntentService { ...@@ -129,26 +142,26 @@ public class SyncService extends IntentService {
* Sync VariableForm * Sync VariableForm
**/ **/
private SyncStatus syncVariableForm(final CatalogueItemInput catalogueItemInput) { private SyncStatus syncVariableForm(final CatalogueItemInput catalogueItemInput) {
CatalogueLog.d( "syncVariableForm"); CatalogueLog.d("syncVariableForm");
if(catalogueItemInput.getSyncDirty() == DBConstants.SYNC_FLAG_CREATE || catalogueItemInput.getSysId() == null || catalogueItemInput.getSysId().isEmpty()) { if (catalogueItemInput.getSyncDirty() == DBConstants.SYNC_FLAG_CREATE || catalogueItemInput.getSysId() == null || catalogueItemInput.getSysId().isEmpty()) {
final CatalogueItem catalogueItem = CatalogueItemManager.get(catalogueItemInput.getCatalogueItemId()); final CatalogueItem catalogueItem = CatalogueItemManager.get(catalogueItemInput.getCatalogueItemId());
CatalogueVariableApiManager.submitVariableForm(SyncService.this, catalogueItem.getSysId(), CatalogueVariableApiManager.submitVariableForm(SyncService.this, catalogueItem.getSysId(),
catalogueItemInput.getData(), catalogueItemInput.getData(),
new PostVariableFormApiListener() { new PostVariableFormApiListener() {
@Override @Override
public void onDoneApiCall(String variableFromSysId) { public void onDoneApiCall(String variableFromSysId) {
syncStatus = SyncStatus.SUCCESS; syncStatus = SyncStatus.SUCCESS;
CatalogueLog.e("syncVariableForm: saveVariableForm: result is SUCCESS"); CatalogueLog.e("syncVariableForm: saveVariableForm: result is SUCCESS");
catalogueItemInput.setSysId(variableFromSysId); catalogueItemInput.setSysId(variableFromSysId);
CatalogueItemInputManager.handleSaveServerResponse(catalogueItemInput, Collections.singletonList(CATALOGUE_ITEM_INPUT_SYS_ID), SYNC_FLAG_NONE); CatalogueItemInputManager.handleSaveServerResponse(catalogueItemInput, Collections.singletonList(CATALOGUE_ITEM_INPUT_SYS_ID), SYNC_FLAG_NONE);
} }
@Override @Override
public void onFailApiCall() { public void onFailApiCall() {
CatalogueLog.e("syncVariableForm: saveVariableForm: result is FAIL"); CatalogueLog.e("syncVariableForm: saveVariableForm: result is FAIL");
syncStatus = SyncStatus.FAIL; syncStatus = SyncStatus.FAIL;
} }
}); });
} }
return syncStatus; return syncStatus;
} }
...@@ -157,8 +170,8 @@ public class SyncService extends IntentService { ...@@ -157,8 +170,8 @@ public class SyncService extends IntentService {
* Sync Attachment * Sync Attachment
**/ **/
private SyncStatus syncAttachment(final Attachment attachment) { private SyncStatus syncAttachment(final Attachment attachment) {
CatalogueLog.d( "syncAttachment"); CatalogueLog.d("syncAttachment");
if(attachment.getSyncDirty() == DBConstants.SYNC_FLAG_CREATE) { if (attachment.getSyncDirty() == DBConstants.SYNC_FLAG_CREATE) {
if (attachment.getMimeType() != null) { if (attachment.getMimeType() != null) {
InputStream in = null; InputStream in = null;
try { try {
...@@ -201,9 +214,9 @@ public class SyncService extends IntentService { ...@@ -201,9 +214,9 @@ public class SyncService extends IntentService {
* Sync Incident form * Sync Incident form
**/ **/
private SyncStatus syncIncidentForm(final Incident incident) { private SyncStatus syncIncidentForm(final Incident incident) {
CatalogueLog.d( "syncVariableForm"); CatalogueLog.d("syncVariableForm");
String userSysId = PrefManager.getSharedPref(SyncService.this, PrefManager.PREFERENCE_USER_SYS_ID); String userSysId = PrefManager.getSharedPref(SyncService.this, PrefManager.PREFERENCE_USER_SYS_ID);
if(incident.getSyncDirty() == DBConstants.SYNC_FLAG_CREATE || incident.getNumber() == null || incident.getNumber().isEmpty()) { if (incident.getSyncDirty() == DBConstants.SYNC_FLAG_CREATE || incident.getNumber() == null || incident.getNumber().isEmpty()) {
JSONObject incidentJsonObject = new JSONObject(); JSONObject incidentJsonObject = new JSONObject();
try { try {
incidentJsonObject.put(Incident.Json.IMPACT, incident.getImpact().getServerString()); incidentJsonObject.put(Incident.Json.IMPACT, incident.getImpact().getServerString());
...@@ -237,8 +250,8 @@ public class SyncService extends IntentService { ...@@ -237,8 +250,8 @@ public class SyncService extends IntentService {
* Sync HRCase VariableForm * Sync HRCase VariableForm
**/ **/
private SyncStatus syncHRCaseVariableForm(final HRCaseItemInput hrCaseItemInput) { private SyncStatus syncHRCaseVariableForm(final HRCaseItemInput hrCaseItemInput) {
CatalogueLog.d( "syncHRCaseVariableForm"); CatalogueLog.d("syncHRCaseVariableForm");
if(hrCaseItemInput.getSyncDirty() == DBConstants.SYNC_FLAG_CREATE || hrCaseItemInput.getSysId() == null || hrCaseItemInput.getSysId().isEmpty()) { if (hrCaseItemInput.getSyncDirty() == DBConstants.SYNC_FLAG_CREATE || hrCaseItemInput.getSysId() == null || hrCaseItemInput.getSysId().isEmpty()) {
final HRCaseItem hrCaseItem = HRCaseItemManager.get(hrCaseItemInput.getHRCaseItemId()); final HRCaseItem hrCaseItem = HRCaseItemManager.get(hrCaseItemInput.getHRCaseItemId());
HRCaseVariableApiManager.submitHRCaseVariableForm(SyncService.this, hrCaseItem.getSysId(), HRCaseVariableApiManager.submitHRCaseVariableForm(SyncService.this, hrCaseItem.getSysId(),
hrCaseItemInput.getData(), hrCaseItemInput.getData(),
...@@ -254,7 +267,7 @@ public class SyncService extends IntentService { ...@@ -254,7 +267,7 @@ public class SyncService extends IntentService {
String record = hrCaseVariableSubmitApiResponse.getRecord(); String record = hrCaseVariableSubmitApiResponse.getRecord();
String[] recordSpit = record.split("/"); String[] recordSpit = record.split("/");
String submittedFormSysId = null; String submittedFormSysId = null;
if(recordSpit.length > 0) { if (recordSpit.length > 0) {
submittedFormSysId = recordSpit[recordSpit.length - 1]; submittedFormSysId = recordSpit[recordSpit.length - 1];
} }
hrCaseItemInput.setSysId(submittedFormSysId); hrCaseItemInput.setSysId(submittedFormSysId);
...@@ -275,8 +288,8 @@ public class SyncService extends IntentService { ...@@ -275,8 +288,8 @@ public class SyncService extends IntentService {
* Sync HRCase Attachment * Sync HRCase Attachment
**/ **/
private SyncStatus syncHRCaseAttachment(final HRCaseAttachment hrCaseAttachment) { private SyncStatus syncHRCaseAttachment(final HRCaseAttachment hrCaseAttachment) {
CatalogueLog.d( "syncHRCaseAttachment"); CatalogueLog.d("syncHRCaseAttachment");
if(hrCaseAttachment.getSyncDirty() == DBConstants.SYNC_FLAG_CREATE) { if (hrCaseAttachment.getSyncDirty() == DBConstants.SYNC_FLAG_CREATE) {
if (hrCaseAttachment.getMimeType() != null) { if (hrCaseAttachment.getMimeType() != null) {
InputStream in = null; InputStream in = null;
try { try {
......
...@@ -101,7 +101,7 @@ public class DroidSpeech { ...@@ -101,7 +101,7 @@ public class DroidSpeech {
@Override @Override
public void onLanguageDetailsInfo(String defaultLanguage, List<String> otherLanguages) { public void onLanguageDetailsInfo(String defaultLanguage, List<String> otherLanguages) {
dsProperties.currentSpeechLanguage = defaultLanguage; dsProperties.currentSpeechLanguage = "en-UK";
dsProperties.supportedSpeechLanguages = otherLanguages; dsProperties.supportedSpeechLanguages = otherLanguages;
// Initializing the droid speech properties // Initializing the droid speech properties
...@@ -133,6 +133,7 @@ public class DroidSpeech { ...@@ -133,6 +133,7 @@ public class DroidSpeech {
speechIntent.putExtra(RecognizerIntent.EXTRA_MAX_RESULTS, Extensions.MAX_VOICE_RESULTS); speechIntent.putExtra(RecognizerIntent.EXTRA_MAX_RESULTS, Extensions.MAX_VOICE_RESULTS);
if (dsProperties.currentSpeechLanguage != null) { if (dsProperties.currentSpeechLanguage != null) {
// Setting the speech language // Setting the speech language
System.out.println(dsProperties.currentSpeechLanguage);
speechIntent.putExtra(RecognizerIntent.EXTRA_LANGUAGE, dsProperties.currentSpeechLanguage); speechIntent.putExtra(RecognizerIntent.EXTRA_LANGUAGE, dsProperties.currentSpeechLanguage);
speechIntent.putExtra(RecognizerIntent.EXTRA_LANGUAGE_PREFERENCE, dsProperties.currentSpeechLanguage); speechIntent.putExtra(RecognizerIntent.EXTRA_LANGUAGE_PREFERENCE, dsProperties.currentSpeechLanguage);
} }
......
...@@ -184,6 +184,34 @@ public class ChatActivity extends AppCompatActivity implements OnDSListener, OnD ...@@ -184,6 +184,34 @@ public class ChatActivity extends AppCompatActivity implements OnDSListener, OnD
} }
}); });
//Below code for - Last message getting overlapped when virtual keyboard is opened.
mInputMessageView.setOnTouchListener(new View.OnTouchListener() {
@Override
public boolean onTouch(View view, MotionEvent motionEvent) {
if(motionEvent.getAction() == MotionEvent.ACTION_DOWN) {
if(mMessagesView.getAdapter().getItemCount() > 0) {
mMessagesView.addOnLayoutChangeListener(new View.OnLayoutChangeListener() {
@Override
public void onLayoutChange(View v,
int left, int top, int right, int bottom,
int oldLeft, int oldTop, int oldRight, int oldBottom) {
if (bottom < oldBottom) {
mMessagesView.postDelayed(new Runnable() {
@Override
public void run() {
mMessagesView.smoothScrollToPosition(
mMessagesView.getAdapter().getItemCount() - 1);
}
}, 100);
}
}
});
}
}
return false;
}
});
droidSpeech = new DroidSpeech(this, getSupportFragmentManager()); droidSpeech = new DroidSpeech(this, getSupportFragmentManager());
droidSpeech.setOnDroidSpeechListener(this); droidSpeech.setOnDroidSpeechListener(this);
......
...@@ -46,24 +46,46 @@ public class HandleNotificationActivity extends AppCompatActivity { ...@@ -46,24 +46,46 @@ public class HandleNotificationActivity extends AppCompatActivity {
// That's why we need to play explicitly // That's why we need to play explicitly
Util.playNotificationSound(HandleNotificationActivity.this); Util.playNotificationSound(HandleNotificationActivity.this);
AlertDialog.Builder builder = new AlertDialog.Builder(HandleNotificationActivity.this); boolean isApprovalNotification = intent.getBooleanExtra(Constants.DATA_KEY_NOTIFICATION_IS_APPROVALS, false);
builder.setMessage(intent.getStringExtra(Constants.DATA_KEY_NOTIFICATION_MESSAGE)) if(!isApprovalNotification) {
.setTitle(intent.getStringExtra(Constants.DATA_KEY_NOTIFICATION_TITLE)) AlertDialog.Builder builder = new AlertDialog.Builder(HandleNotificationActivity.this);
.setCancelable(false) builder.setMessage(intent.getStringExtra(Constants.DATA_KEY_NOTIFICATION_MESSAGE))
.setPositiveButton(R.string.go_to_notification_string, .setTitle(intent.getStringExtra(Constants.DATA_KEY_NOTIFICATION_TITLE))
new DialogInterface.OnClickListener() { .setCancelable(false)
public void onClick(DialogInterface dialog, int id) { .setPositiveButton(R.string.go_to_notification_string,
startActivity(new Intent(HandleNotificationActivity.this, new DialogInterface.OnClickListener() {
NotificationScreen.class)); public void onClick(DialogInterface dialog, int id) {
} startActivity(new Intent(HandleNotificationActivity.this,
}) NotificationScreen.class));
.setNegativeButton(R.string.ok_string, new DialogInterface.OnClickListener() { }
public void onClick(DialogInterface dialog, int id) { })
dialog.dismiss(); .setNegativeButton(R.string.ok_string, new DialogInterface.OnClickListener() {
} public void onClick(DialogInterface dialog, int id) {
}); dialog.dismiss();
AlertDialog alert = builder.create(); }
alert.show(); });
AlertDialog alert = builder.create();
alert.show();
} else {
AlertDialog.Builder builder = new AlertDialog.Builder(HandleNotificationActivity.this);
builder.setMessage(intent.getStringExtra(Constants.DATA_KEY_NOTIFICATION_MESSAGE))
.setTitle(intent.getStringExtra(Constants.DATA_KEY_NOTIFICATION_TITLE))
.setCancelable(false)
.setPositiveButton(R.string.go_to_approvals_string,
new DialogInterface.OnClickListener() {
public void onClick(DialogInterface dialog, int id) {
startActivity(new Intent(HandleNotificationActivity.this,
PendingApprovalsActivity.class));
}
})
.setNegativeButton(R.string.ok_string, new DialogInterface.OnClickListener() {
public void onClick(DialogInterface dialog, int id) {
dialog.dismiss();
}
});
AlertDialog alert = builder.create();
alert.show();
}
} }
}; };
} }
...@@ -66,19 +66,41 @@ public class NotificationScreen extends AppCompatActivity { ...@@ -66,19 +66,41 @@ public class NotificationScreen extends AppCompatActivity {
// That's why we need to play explicitly // That's why we need to play explicitly
Util.playNotificationSound(NotificationScreen.this); Util.playNotificationSound(NotificationScreen.this);
AlertDialog.Builder builder = new AlertDialog.Builder(NotificationScreen.this); boolean isApprovalNotification = intent.getBooleanExtra(Constants.DATA_KEY_NOTIFICATION_IS_APPROVALS, false);
builder.setMessage(intent.getStringExtra(Constants.DATA_KEY_NOTIFICATION_MESSAGE)) if(!isApprovalNotification) {
.setTitle(intent.getStringExtra(Constants.DATA_KEY_NOTIFICATION_TITLE)) AlertDialog.Builder builder = new AlertDialog.Builder(NotificationScreen.this);
.setCancelable(false) builder.setMessage(intent.getStringExtra(Constants.DATA_KEY_NOTIFICATION_MESSAGE))
.setPositiveButton(R.string.ok_string, .setTitle(intent.getStringExtra(Constants.DATA_KEY_NOTIFICATION_TITLE))
new DialogInterface.OnClickListener() { .setCancelable(false)
public void onClick(DialogInterface dialog, int id) { .setPositiveButton(R.string.ok_string,
dialog.dismiss(); new DialogInterface.OnClickListener() {
updateNotificationList(); public void onClick(DialogInterface dialog, int id) {
} dialog.dismiss();
}); updateNotificationList();
AlertDialog alert = builder.create(); }
alert.show(); });
AlertDialog alert = builder.create();
alert.show();
} else {
AlertDialog.Builder builder = new AlertDialog.Builder(NotificationScreen.this);
builder.setMessage(intent.getStringExtra(Constants.DATA_KEY_NOTIFICATION_MESSAGE))
.setTitle(intent.getStringExtra(Constants.DATA_KEY_NOTIFICATION_TITLE))
.setCancelable(false)
.setPositiveButton(R.string.go_to_approvals_string,
new DialogInterface.OnClickListener() {
public void onClick(DialogInterface dialog, int id) {
startActivity(new Intent(NotificationScreen.this,
PendingApprovalsActivity.class));
}
})
.setNegativeButton(R.string.ok_string, new DialogInterface.OnClickListener() {
public void onClick(DialogInterface dialog, int id) {
dialog.dismiss();
}
});
AlertDialog alert = builder.create();
alert.show();
}
} }
}; };
......
package com.vsoft.servicenow.ui; package com.vsoft.servicenow.ui;
import android.app.NotificationManager;
import android.app.ProgressDialog; import android.app.ProgressDialog;
import android.content.BroadcastReceiver;
import android.content.Context;
import android.content.DialogInterface; import android.content.DialogInterface;
import android.content.Intent;
import android.content.IntentFilter;
import android.os.AsyncTask; import android.os.AsyncTask;
import android.os.Bundle; import android.os.Bundle;
import android.support.v4.content.LocalBroadcastManager;
import android.support.v7.app.ActionBar; import android.support.v7.app.ActionBar;
import android.support.v7.app.AlertDialog; import android.support.v7.app.AlertDialog;
import android.support.v7.app.AppCompatActivity;
import android.support.v7.widget.Toolbar; import android.support.v7.widget.Toolbar;
import android.text.Html; import android.text.Html;
import android.text.TextUtils; import android.text.TextUtils;
...@@ -30,6 +37,7 @@ import com.vsoft.servicenow.api.managers.PendingApprovalsApiManager; ...@@ -30,6 +37,7 @@ import com.vsoft.servicenow.api.managers.PendingApprovalsApiManager;
import com.vsoft.servicenow.db.managers.PendingApprovalsManager; import com.vsoft.servicenow.db.managers.PendingApprovalsManager;
import com.vsoft.servicenow.db.models.PendingApprovals; import com.vsoft.servicenow.db.models.PendingApprovals;
import com.vsoft.servicenow.enums.SyncStatus; import com.vsoft.servicenow.enums.SyncStatus;
import com.vsoft.servicenow.utils.Constants;
import com.vsoft.servicenow.utils.DialogUtils; import com.vsoft.servicenow.utils.DialogUtils;
import com.vsoft.servicenow.utils.Util; import com.vsoft.servicenow.utils.Util;
...@@ -48,7 +56,7 @@ import butterknife.OnItemClick; ...@@ -48,7 +56,7 @@ import butterknife.OnItemClick;
/** /**
* Created by Kunj on 26/04/2018. * Created by Kunj on 26/04/2018.
* */ * */
public class PendingApprovalsActivity extends HandleNotificationActivity { public class PendingApprovalsActivity extends AppCompatActivity {
@BindView(R.id.tool_bar_view) Toolbar mToolbar; @BindView(R.id.tool_bar_view) Toolbar mToolbar;
@BindView(R.id.pending_approvals_screen_list_view) ListView mListView; @BindView(R.id.pending_approvals_screen_list_view) ListView mListView;
...@@ -60,6 +68,55 @@ public class PendingApprovalsActivity extends HandleNotificationActivity { ...@@ -60,6 +68,55 @@ public class PendingApprovalsActivity extends HandleNotificationActivity {
private boolean isProgressRequire; private boolean isProgressRequire;
private CatalogueApplication mApplication; private CatalogueApplication mApplication;
private final BroadcastReceiver mMessageReceiver = new BroadcastReceiver() {
@Override
public void onReceive(Context context, Intent intent) {
//Cancel received notifications
final NotificationManager notificationManager =
(NotificationManager) getSystemService(Context.NOTIFICATION_SERVICE);
notificationManager.cancelAll();
//Play notification sound because Above we already cancel notifications.
// That's why we need to play explicitly
Util.playNotificationSound(PendingApprovalsActivity.this);
boolean isApprovalNotification = intent.getBooleanExtra(Constants.DATA_KEY_NOTIFICATION_IS_APPROVALS, false);
if(isApprovalNotification) {
AlertDialog.Builder builder = new AlertDialog.Builder(PendingApprovalsActivity.this);
builder.setMessage(intent.getStringExtra(Constants.DATA_KEY_NOTIFICATION_MESSAGE))
.setTitle(intent.getStringExtra(Constants.DATA_KEY_NOTIFICATION_TITLE))
.setCancelable(false)
.setPositiveButton(R.string.ok_string,
new DialogInterface.OnClickListener() {
public void onClick(DialogInterface dialog, int id) {
dialog.dismiss();
}
});
AlertDialog alert = builder.create();
alert.show();
} else {
AlertDialog.Builder builder = new AlertDialog.Builder(PendingApprovalsActivity.this);
builder.setMessage(intent.getStringExtra(Constants.DATA_KEY_NOTIFICATION_MESSAGE))
.setTitle(intent.getStringExtra(Constants.DATA_KEY_NOTIFICATION_TITLE))
.setCancelable(false)
.setPositiveButton(R.string.go_to_notification_string,
new DialogInterface.OnClickListener() {
public void onClick(DialogInterface dialog, int id) {
startActivity(new Intent(PendingApprovalsActivity.this,
NotificationScreen.class));
}
})
.setNegativeButton(R.string.ok_string, new DialogInterface.OnClickListener() {
public void onClick(DialogInterface dialog, int id) {
dialog.dismiss();
}
});
AlertDialog alert = builder.create();
alert.show();
}
}
};
@Override @Override
protected void onCreate(Bundle savedInstanceState) { protected void onCreate(Bundle savedInstanceState) {
// TODO Auto-generated method stub // TODO Auto-generated method stub
...@@ -332,4 +389,19 @@ public class PendingApprovalsActivity extends HandleNotificationActivity { ...@@ -332,4 +389,19 @@ public class PendingApprovalsActivity extends HandleNotificationActivity {
} }
} }
} }
@Override
public void onResume() {
super.onResume();
LocalBroadcastManager.getInstance(PendingApprovalsActivity.this)
.registerReceiver(mMessageReceiver,
new IntentFilter(Constants.BROADCAST_NOTIFICATION));
}
@Override
public void onPause() {
LocalBroadcastManager.getInstance(PendingApprovalsActivity.this)
.unregisterReceiver(mMessageReceiver);
super.onPause();
}
} }
...@@ -4,10 +4,17 @@ import android.app.Activity; ...@@ -4,10 +4,17 @@ import android.app.Activity;
import android.content.Intent; import android.content.Intent;
import android.os.Bundle; import android.os.Bundle;
import android.os.Handler; import android.os.Handler;
import android.util.Log;
import android.view.Window; import android.view.Window;
import com.androidquery.AQuery;
import com.androidquery.callback.AjaxStatus;
import com.vsoft.servicenow.AppConfig;
import com.vsoft.servicenow.R; import com.vsoft.servicenow.R;
import org.json.JSONException;
import org.json.JSONObject;
import butterknife.ButterKnife; import butterknife.ButterKnife;
/** /**
...@@ -51,4 +58,5 @@ public class SplashScreen extends Activity { ...@@ -51,4 +58,5 @@ public class SplashScreen extends Activity {
}, SPLASH_TIME_OUT); }, SPLASH_TIME_OUT);
} }
} }
...@@ -32,6 +32,7 @@ public class Constants { ...@@ -32,6 +32,7 @@ public class Constants {
public static final String DATA_KEY_CATALOGUE_ITEM_SHORT_DESCRIPTION = "catalogue_item_short_des"; public static final String DATA_KEY_CATALOGUE_ITEM_SHORT_DESCRIPTION = "catalogue_item_short_des";
public static final String DATA_KEY_NOTIFICATION_TITLE = "notification_title"; public static final String DATA_KEY_NOTIFICATION_TITLE = "notification_title";
public static final String DATA_KEY_NOTIFICATION_MESSAGE = "notification_message"; public static final String DATA_KEY_NOTIFICATION_MESSAGE = "notification_message";
public static final String DATA_KEY_NOTIFICATION_IS_APPROVALS = "notification_is_approvals";
public static final String DATA_KEY_LOGIN_REQUEST_CODE = "login_request_code"; public static final String DATA_KEY_LOGIN_REQUEST_CODE = "login_request_code";
public static final String DATA_KEY_CATEGORY_SYS_ID = "category_sys_id"; public static final String DATA_KEY_CATEGORY_SYS_ID = "category_sys_id";
public static final String DATA_KEY_HR_CASE_TITLE = "hr_case_title"; public static final String DATA_KEY_HR_CASE_TITLE = "hr_case_title";
......
...@@ -85,7 +85,7 @@ ...@@ -85,7 +85,7 @@
<!--Incident screen--> <!--Incident screen-->
<string name="incident_form_report_incident_text_string">Report Incident</string> <string name="incident_form_report_incident_text_string">Report Incident</string>
<string name="incident_form_top_text_string">Create an Incident record to report and request assistance with an issue you are having\n\nRequest assistance with an issue you are having. An incident record will be created and managed through to successful resolution. You will also be notified of progress.</string> <string name="incident_form_top_text_string">Create an Incident record to report and request assistance with an issue you are having\n\n. An incident record will be created and managed through to successful resolution. You will also be notified of progress.</string>
<string name="incident_form_impact_text_string">Impact &lt;font color="#FF0000"&gt;*&lt;/font&gt;</string> <string name="incident_form_impact_text_string">Impact &lt;font color="#FF0000"&gt;*&lt;/font&gt;</string>
<string name="incident_form_incident_successful_submission_string">Incident has been reported successfully</string> <string name="incident_form_incident_successful_submission_string">Incident has been reported successfully</string>
<string name="incident_form_describe_your_issue_text_string">Please Describe Your Issue below &lt;font color="#FF0000"&gt;*&lt;/font&gt;(Max %d)</string> <string name="incident_form_describe_your_issue_text_string">Please Describe Your Issue below &lt;font color="#FF0000"&gt;*&lt;/font&gt;(Max %d)</string>
...@@ -113,7 +113,11 @@ ...@@ -113,7 +113,11 @@
<string name="notification_screen_action_bar_title_string">Notifications</string> <string name="notification_screen_action_bar_title_string">Notifications</string>
<string name="notification_screen_empty_text_string">No Notifications</string> <string name="notification_screen_empty_text_string">No Notifications</string>
<string name="go_to_notification_string">Go to Notification</string> <string name="go_to_notification_string">Go to Notification</string>
<string name="notification_status_bar_title_string">New Incident assigned to you</string> <string name="go_to_approvals_string">Go to Approvals</string>
<string name="notification_status_bar_incident_title_string">New Incident assigned to you</string>
<string name="notification_status_bar_hr_case_title_string">New HR Case assigned to you</string>
<string name="notification_status_bar_request_title_string">New Request assigned to you</string>
<string name="notification_status_bar_approvals_title_string">New Approval assigned to you</string>
<!--Chat Related String--> <!--Chat Related String-->
<string name="chat_activity_label">Vera</string> <string name="chat_activity_label">Vera</string>
......
...@@ -72,7 +72,7 @@ ...@@ -72,7 +72,7 @@
"client_info": { "client_info": {
"mobilesdk_app_id": "1:222593508124:android:ade631ceed1f3560", "mobilesdk_app_id": "1:222593508124:android:ade631ceed1f3560",
"android_client_info": { "android_client_info": {
"package_name": "com.vsoft.servicenow.vportal.staging" "package_name": "com.vsoft.servicenow.vportal"
} }
}, },
"oauth_client": [ "oauth_client": [
......
...@@ -61,5 +61,6 @@ public class AppConfig { ...@@ -61,5 +61,6 @@ public class AppConfig {
* */ * */
public static final String CHAT_SERVER_URL_RELEASE = "http://111.93.6.218:12914/"; public static final String CHAT_SERVER_URL_RELEASE = "http://111.93.6.218:12914/";
public static final String CHAT_SERVER_URL_DEBUG = "http://111.93.6.218:12911/"; public static final String CHAT_SERVER_URL_DEBUG = "http://111.93.6.218:12911/";
public static final String CHAT_SERVER_URL_STAGING = "http://ai.test.vsoftconsulting.com:3000/"; public static String CHAT_SERVER_URL_STAGING = "";
} }
...@@ -57,4 +57,4 @@ public class MenuProvider { ...@@ -57,4 +57,4 @@ public class MenuProvider {
// .setMenuIconResId(R.string.home_screen_approvals_icon) // .setMenuIconResId(R.string.home_screen_approvals_icon)
// .build() // .build()
); );
} }
\ No newline at end of file
No preview for this file type
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