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 {
flavorDimensions "tier"
signingConfigs {
debug {
keyAlias 'androiddebugkey'
keyPassword 'android'
storeFile file('/Users/chaukadev/.android/debug.keystore')
storePassword 'android'
keyAlias 'vportal'
keyPassword 'vportal'
storeFile file('vportal.jks')
storePassword 'vportal'
}
config {
keyAlias 'Uofl'
keyPassword 'Vsoft@123'
storeFile file('/Users/apple/Desktop/uofl_builds/Uofl_keys')
storePassword 'Vsoft@123'
keyAlias 'vportal'
keyPassword 'vportal'
storeFile file('vportal.jks')
storePassword 'vportal'
}
}
......@@ -39,7 +39,7 @@ android {
minSdkVersion 15
targetSdkVersion 27
versionCode 1
versionName "0.0.33"
versionName "0.0.1"
multiDexEnabled true
}
buildTypes {
......
......@@ -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.PostVariableFormApiListener;
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.IncidentApiManager;
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.CatalogueItemInputManager;
import com.vsoft.servicenow.db.managers.CatalogueItemManager;
......@@ -31,7 +31,6 @@ import com.vsoft.servicenow.db.models.Incident;
import com.vsoft.servicenow.enums.SyncStatus;
import com.vsoft.servicenow.utils.CatalogueLog;
import com.vsoft.servicenow.utils.Constants;
import com.vsoft.servicenow.db.DBConstants;
import com.vsoft.servicenow.utils.PrefManager;
import com.vsoft.servicenow.utils.Util;
......@@ -49,10 +48,10 @@ import java.util.List;
import okhttp3.MediaType;
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.INCIDENT_INPUT_NUMBER;
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;
public class SyncService extends IntentService {
private SyncStatus syncStatus = SyncStatus.FAIL;
public SyncService() {
super(SyncService.class.getSimpleName());
}
......@@ -70,7 +70,7 @@ public class SyncService extends IntentService {
@Override
protected void onHandleIntent(Intent intent) {
CatalogueApplication mApplication = (CatalogueApplication) getApplication();
if(!mApplication.isNetConnected()) {
if (!mApplication.isNetConnected()) {
CatalogueLog.e("SyncService: onHandleIntent(): Not connected to net. Exit.");
return;
}
......@@ -82,24 +82,28 @@ public class SyncService extends IntentService {
SyncStatus result;
/*First we will work on dirty variable form*/
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++) {
CatalogueItemInput catalogueItemInput = catalogueItemInputList.get(i);
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*/
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++) {
Attachment attachment = attachmentList.get(i);
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()) {
/*Then we will work on dirty variable form*/
if (Util.isHrCaseEnabled()) {
/*Then we will work on dirty variable form*/
List<HRCaseItemInput> hrCaseItemInputList = HRCaseItemInputManager.getDirtyItemInput();
if (Constants.DEBUG)
CatalogueLog.d("startSync: HRCase form to sync: " + hrCaseItemInputList.size());
......@@ -124,11 +128,13 @@ public class SyncService extends IntentService {
/*Then we will work on dirty incident form*/
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++) {
Incident incident = incidentInputList.get(i);
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,26 +142,26 @@ public class SyncService extends IntentService {
* Sync VariableForm
**/
private SyncStatus syncVariableForm(final CatalogueItemInput catalogueItemInput) {
CatalogueLog.d( "syncVariableForm");
if(catalogueItemInput.getSyncDirty() == DBConstants.SYNC_FLAG_CREATE || catalogueItemInput.getSysId() == null || catalogueItemInput.getSysId().isEmpty()) {
CatalogueLog.d("syncVariableForm");
if (catalogueItemInput.getSyncDirty() == DBConstants.SYNC_FLAG_CREATE || catalogueItemInput.getSysId() == null || catalogueItemInput.getSysId().isEmpty()) {
final CatalogueItem catalogueItem = CatalogueItemManager.get(catalogueItemInput.getCatalogueItemId());
CatalogueVariableApiManager.submitVariableForm(SyncService.this, catalogueItem.getSysId(),
catalogueItemInput.getData(),
new PostVariableFormApiListener() {
@Override
public void onDoneApiCall(String variableFromSysId) {
syncStatus = SyncStatus.SUCCESS;
CatalogueLog.e("syncVariableForm: saveVariableForm: result is SUCCESS");
catalogueItemInput.setSysId(variableFromSysId);
CatalogueItemInputManager.handleSaveServerResponse(catalogueItemInput, Collections.singletonList(CATALOGUE_ITEM_INPUT_SYS_ID), SYNC_FLAG_NONE);
}
@Override
public void onDoneApiCall(String variableFromSysId) {
syncStatus = SyncStatus.SUCCESS;
CatalogueLog.e("syncVariableForm: saveVariableForm: result is SUCCESS");
catalogueItemInput.setSysId(variableFromSysId);
CatalogueItemInputManager.handleSaveServerResponse(catalogueItemInput, Collections.singletonList(CATALOGUE_ITEM_INPUT_SYS_ID), SYNC_FLAG_NONE);
}
@Override
public void onFailApiCall() {
CatalogueLog.e("syncVariableForm: saveVariableForm: result is FAIL");
syncStatus = SyncStatus.FAIL;
}
});
@Override
public void onFailApiCall() {
CatalogueLog.e("syncVariableForm: saveVariableForm: result is FAIL");
syncStatus = SyncStatus.FAIL;
}
});
}
return syncStatus;
}
......@@ -164,8 +170,8 @@ public class SyncService extends IntentService {
* Sync Attachment
**/
private SyncStatus syncAttachment(final Attachment attachment) {
CatalogueLog.d( "syncAttachment");
if(attachment.getSyncDirty() == DBConstants.SYNC_FLAG_CREATE) {
CatalogueLog.d("syncAttachment");
if (attachment.getSyncDirty() == DBConstants.SYNC_FLAG_CREATE) {
if (attachment.getMimeType() != null) {
InputStream in = null;
try {
......@@ -208,9 +214,9 @@ public class SyncService extends IntentService {
* Sync Incident form
**/
private SyncStatus syncIncidentForm(final Incident incident) {
CatalogueLog.d( "syncVariableForm");
CatalogueLog.d("syncVariableForm");
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();
try {
incidentJsonObject.put(Incident.Json.IMPACT, incident.getImpact().getServerString());
......@@ -244,8 +250,8 @@ public class SyncService extends IntentService {
* Sync HRCase VariableForm
**/
private SyncStatus syncHRCaseVariableForm(final HRCaseItemInput hrCaseItemInput) {
CatalogueLog.d( "syncHRCaseVariableForm");
if(hrCaseItemInput.getSyncDirty() == DBConstants.SYNC_FLAG_CREATE || hrCaseItemInput.getSysId() == null || hrCaseItemInput.getSysId().isEmpty()) {
CatalogueLog.d("syncHRCaseVariableForm");
if (hrCaseItemInput.getSyncDirty() == DBConstants.SYNC_FLAG_CREATE || hrCaseItemInput.getSysId() == null || hrCaseItemInput.getSysId().isEmpty()) {
final HRCaseItem hrCaseItem = HRCaseItemManager.get(hrCaseItemInput.getHRCaseItemId());
HRCaseVariableApiManager.submitHRCaseVariableForm(SyncService.this, hrCaseItem.getSysId(),
hrCaseItemInput.getData(),
......@@ -261,7 +267,7 @@ public class SyncService extends IntentService {
String record = hrCaseVariableSubmitApiResponse.getRecord();
String[] recordSpit = record.split("/");
String submittedFormSysId = null;
if(recordSpit.length > 0) {
if (recordSpit.length > 0) {
submittedFormSysId = recordSpit[recordSpit.length - 1];
}
hrCaseItemInput.setSysId(submittedFormSysId);
......@@ -282,8 +288,8 @@ public class SyncService extends IntentService {
* Sync HRCase Attachment
**/
private SyncStatus syncHRCaseAttachment(final HRCaseAttachment hrCaseAttachment) {
CatalogueLog.d( "syncHRCaseAttachment");
if(hrCaseAttachment.getSyncDirty() == DBConstants.SYNC_FLAG_CREATE) {
CatalogueLog.d("syncHRCaseAttachment");
if (hrCaseAttachment.getSyncDirty() == DBConstants.SYNC_FLAG_CREATE) {
if (hrCaseAttachment.getMimeType() != null) {
InputStream in = null;
try {
......
......@@ -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_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 {
.setTitle(R.string.home_screen_report_incident_title)
.setMenuIconResId(R.string.home_screen_my_request_icon)
.build(),
new CreateHRCaseMenuItemData.Builder()
.setTitle(R.string.home_screen_create_hr_case_title)
.setMenuIconResId(R.string.home_screen_create_hr_case_icon)
.build(),
new ViewHRCaseMenuItemData.Builder()
.setTitle(R.string.home_screen_view_hr_case_title)
.setMenuIconResId(R.string.home_screen_view_hr_case_icon)
.build(),
// new CreateHRCaseMenuItemData.Builder()
// .setTitle(R.string.home_screen_create_hr_case_title)
// .setMenuIconResId(R.string.home_screen_create_hr_case_icon)
// .build(),
// new ViewHRCaseMenuItemData.Builder()
// .setTitle(R.string.home_screen_view_hr_case_title)
// .setMenuIconResId(R.string.home_screen_view_hr_case_icon)
// .build(),
new ChatMenuItemData.Builder()
.setTitle(R.string.home_screen_chat_title)
.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()
// 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