Commit ff5bd4bd by Kunj Gupta

Merge branch 'devOfflineCapability' of…

Merge branch 'devOfflineCapability' of https://gitlab.vsoftconsulting.com/ssinangaram/uofl-android into devOfflineCapability
parents 567bfc19 dfab12f6
...@@ -18,16 +18,16 @@ android { ...@@ -18,16 +18,16 @@ android {
flavorDimensions "tier" flavorDimensions "tier"
signingConfigs { signingConfigs {
debug { debug {
keyAlias 'androiddebugkey' keyAlias 'vportal'
keyPassword 'android' keyPassword 'vportal'
storeFile file('/Users/chaukadev/.android/debug.keystore') storeFile file('vportal.jks')
storePassword 'android' 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'
} }
} }
...@@ -39,7 +39,7 @@ android { ...@@ -39,7 +39,7 @@ android {
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 {
......
...@@ -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,7 +31,6 @@ import com.vsoft.servicenow.db.models.Incident; ...@@ -31,7 +31,6 @@ 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 com.vsoft.servicenow.utils.Util;
...@@ -49,10 +48,10 @@ import java.util.List; ...@@ -49,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;
/** /**
...@@ -63,6 +62,7 @@ import static com.vsoft.servicenow.db.DBConstants.SYNC_FLAG_NONE; ...@@ -63,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());
} }
...@@ -70,7 +70,7 @@ public class SyncService extends IntentService { ...@@ -70,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;
} }
...@@ -82,23 +82,27 @@ public class SyncService extends IntentService { ...@@ -82,23 +82,27 @@ 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);
} }
if(Util.isHrCaseEnabled()) { if (Util.isHrCaseEnabled()) {
/*Then we will work on dirty variable form*/ /*Then we will work on dirty variable form*/
List<HRCaseItemInput> hrCaseItemInputList = HRCaseItemInputManager.getDirtyItemInput(); List<HRCaseItemInput> hrCaseItemInputList = HRCaseItemInputManager.getDirtyItemInput();
if (Constants.DEBUG) if (Constants.DEBUG)
...@@ -124,11 +128,13 @@ public class SyncService extends IntentService { ...@@ -124,11 +128,13 @@ public class SyncService extends IntentService {
/*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);
} }
} }
...@@ -136,8 +142,8 @@ public class SyncService extends IntentService { ...@@ -136,8 +142,8 @@ 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(),
...@@ -164,8 +170,8 @@ public class SyncService extends IntentService { ...@@ -164,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 {
...@@ -208,9 +214,9 @@ public class SyncService extends IntentService { ...@@ -208,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());
...@@ -244,8 +250,8 @@ public class SyncService extends IntentService { ...@@ -244,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(),
...@@ -261,7 +267,7 @@ public class SyncService extends IntentService { ...@@ -261,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);
...@@ -282,8 +288,8 @@ public class SyncService extends IntentService { ...@@ -282,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 {
......
...@@ -61,5 +61,5 @@ public class AppConfig { ...@@ -61,5 +61,5 @@ 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://111.93.6.218:12912/"; public static final String CHAT_SERVER_URL_STAGING = "http://test.vera.ai.vsoftconsulting.com/";
} }
...@@ -36,25 +36,25 @@ public class MenuProvider { ...@@ -36,25 +36,25 @@ public class MenuProvider {
.setTitle(R.string.home_screen_report_incident_title) .setTitle(R.string.home_screen_report_incident_title)
.setMenuIconResId(R.string.home_screen_my_request_icon) .setMenuIconResId(R.string.home_screen_my_request_icon)
.build(), .build(),
new CreateHRCaseMenuItemData.Builder() // new CreateHRCaseMenuItemData.Builder()
.setTitle(R.string.home_screen_create_hr_case_title) // .setTitle(R.string.home_screen_create_hr_case_title)
.setMenuIconResId(R.string.home_screen_create_hr_case_icon) // .setMenuIconResId(R.string.home_screen_create_hr_case_icon)
.build(), // .build(),
new ViewHRCaseMenuItemData.Builder() // new ViewHRCaseMenuItemData.Builder()
.setTitle(R.string.home_screen_view_hr_case_title) // .setTitle(R.string.home_screen_view_hr_case_title)
.setMenuIconResId(R.string.home_screen_view_hr_case_icon) // .setMenuIconResId(R.string.home_screen_view_hr_case_icon)
.build(), // .build(),
new ChatMenuItemData.Builder() new ChatMenuItemData.Builder()
.setTitle(R.string.home_screen_chat_title) .setTitle(R.string.home_screen_chat_title)
.setMenuIconResId(R.string.home_screen_chat_icon) .setMenuIconResId(R.string.home_screen_chat_icon)
.build(),
new NotificationMenuItemData.Builder()
.setTitle(R.string.home_screen_notification_title)
.setMenuIconResId(R.string.home_screen_notification_icon)
.build(),
new ApprovalsMenuItemData.Builder()
.setTitle(R.string.home_screen_approvals_title)
.setMenuIconResId(R.string.home_screen_approvals_icon)
.build() .build()
// new NotificationMenuItemData.Builder()
// .setTitle(R.string.home_screen_notification_title)
// .setMenuIconResId(R.string.home_screen_notification_icon)
// .build(),
// new ApprovalsMenuItemData.Builder()
// .setTitle(R.string.home_screen_approvals_title)
// .setMenuIconResId(R.string.home_screen_approvals_icon)
// .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