parent
b2cf9380a0
commit
7288259ce9
|
@ -10,8 +10,8 @@ android {
|
|||
applicationId "com.utopiaindustries.qualitychecker"
|
||||
minSdk 24
|
||||
targetSdk 34
|
||||
versionCode 9
|
||||
versionName "1.8"
|
||||
versionCode 10
|
||||
versionName "1.9"
|
||||
|
||||
testInstrumentationRunner "androidx.test.runner.AndroidJUnitRunner"
|
||||
}
|
||||
|
|
|
@ -19,8 +19,8 @@ import retrofit2.Retrofit;
|
|||
import retrofit2.converter.gson.GsonConverterFactory;
|
||||
|
||||
public class RetrofitClient {
|
||||
private final static String BASE_URL = "https://portal.utopiaindustries.pk/uind/";
|
||||
//private final static String BASE_URL = "http://192.168.91.44:8081/uind/";
|
||||
//private final static String BASE_URL = "https://portal.utopiaindustries.pk/uind/";
|
||||
private final static String BASE_URL = "http://192.168.91.44:8081/uind/";
|
||||
|
||||
private static Retrofit retrofit;
|
||||
|
||||
|
|
|
@ -27,7 +27,7 @@ public class InspectionReport implements Serializable {
|
|||
private String auditDate;
|
||||
private String appVersion;
|
||||
private String sku;
|
||||
|
||||
private String reportSavedTime;
|
||||
|
||||
// wrapper
|
||||
List<InspectionReportItem> items;
|
||||
|
@ -207,6 +207,14 @@ public class InspectionReport implements Serializable {
|
|||
this.sku = sku;
|
||||
}
|
||||
|
||||
public String getReportSavedTime() {
|
||||
return reportSavedTime;
|
||||
}
|
||||
|
||||
public void setReportSavedTime(String reportSavedTime) {
|
||||
this.reportSavedTime = reportSavedTime;
|
||||
}
|
||||
|
||||
@Override
|
||||
public String toString() {
|
||||
return "InspectionReport{" +
|
||||
|
|
|
@ -139,7 +139,15 @@ public class InspectionReportService {
|
|||
callback.onFailure(new Exception("Error on submitting report"));
|
||||
}
|
||||
} else {
|
||||
callback.onFailure(new Exception("API call failed with status code: " + response.code()));
|
||||
//callback.onFailure(new Exception("API call failed with status code: " + response.code()));
|
||||
try {
|
||||
String errorBody = response.errorBody() != null ? response.errorBody().string() : "null";
|
||||
callback.onFailure(new Exception("API call failed with status code: "
|
||||
+ response.code() + ", body: " + errorBody));
|
||||
} catch (Exception e) {
|
||||
e.printStackTrace();
|
||||
callback.onFailure(new Exception("API call failed with status code: " + response.code()));
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
|
|
|
@ -3,7 +3,6 @@ package com.utopiaindustries.qualitychecker.ui.activities;
|
|||
import android.annotation.SuppressLint;
|
||||
import android.content.Context;
|
||||
import android.content.Intent;
|
||||
import android.content.IntentFilter;
|
||||
import android.content.SharedPreferences;
|
||||
import android.content.pm.ActivityInfo;
|
||||
import android.content.pm.PackageInfo;
|
||||
|
@ -25,8 +24,6 @@ import androidx.appcompat.app.AppCompatActivity;
|
|||
import androidx.core.graphics.Insets;
|
||||
import androidx.core.view.ViewCompat;
|
||||
import androidx.core.view.WindowInsetsCompat;
|
||||
import androidx.recyclerview.widget.LinearLayoutManager;
|
||||
import androidx.recyclerview.widget.RecyclerView;
|
||||
import androidx.viewpager.widget.ViewPager;
|
||||
|
||||
import com.bumptech.glide.Glide;
|
||||
|
@ -57,12 +54,9 @@ import com.utopiaindustries.qualitychecker.models.callback.SaveReportCallback;
|
|||
import com.utopiaindustries.qualitychecker.notification.NotificationHelper;
|
||||
import com.utopiaindustries.qualitychecker.receiver.NetworkReceiver;
|
||||
import com.utopiaindustries.qualitychecker.service.InspectionReportService;
|
||||
import com.utopiaindustries.qualitychecker.service.NetworkService;
|
||||
import com.utopiaindustries.qualitychecker.store.Store;
|
||||
import com.utopiaindustries.qualitychecker.ui.activities.fragments.ReportsFragment;
|
||||
import com.utopiaindustries.qualitychecker.ui.adapter.PagerAdapter;
|
||||
import com.utopiaindustries.qualitychecker.ui.adapter.ReportAdapter;
|
||||
import com.utopiaindustries.qualitychecker.ui.fragments.FirstStepFragment;
|
||||
import com.utopiaindustries.qualitychecker.utils.FileUtils;
|
||||
import com.utopiaindustries.qualitychecker.utils.PropertyReader;
|
||||
import com.utopiaindustries.qualitychecker.utils.Release;
|
||||
|
@ -76,7 +70,6 @@ import java.io.PrintWriter;
|
|||
import java.io.StringWriter;
|
||||
import java.util.ArrayList;
|
||||
import java.util.List;
|
||||
import java.util.Objects;
|
||||
import java.util.Properties;
|
||||
|
||||
import retrofit2.Call;
|
||||
|
@ -608,11 +601,6 @@ private int generateRandomNumber(int min, int max) {
|
|||
|
||||
uploadedCount[0]++;
|
||||
|
||||
/*NotificationHelper.showNotification(
|
||||
HomeActivity.this,
|
||||
"Report Uploading",
|
||||
"Uploaded " + uploadedCount[0] + " of " + size + " reports");*/
|
||||
|
||||
NotificationHelper.showNotificationForReportUpload(
|
||||
HomeActivity.this,
|
||||
currentNotificationId,
|
||||
|
@ -627,7 +615,7 @@ private int generateRandomNumber(int min, int max) {
|
|||
}
|
||||
@Override
|
||||
public void onFailure(Throwable throwable) {
|
||||
Log.e("Message: ",""+throwable.getMessage());
|
||||
//Log.e("Message: ",""+throwable.getMessage());
|
||||
uploadedCount[0]++;
|
||||
// Even on failure, increment the counter to avoid locking the button forever
|
||||
//logErrorToFile(throwable);
|
||||
|
@ -635,18 +623,24 @@ private int generateRandomNumber(int min, int max) {
|
|||
HomeActivity.this,
|
||||
"Report Uploading",
|
||||
"Uploaded " + uploadedCount[0] + " of " + size + " reports (with some errors)");*/
|
||||
if (throwable.getMessage() != null && throwable.getMessage().toString().contains("Duplicated")) {
|
||||
Log.e("Request: ","Duplicated");
|
||||
// update status
|
||||
repository.updateSyncStatus( report.getWrapperId() );
|
||||
// remove file
|
||||
FileUtils.deleteFile( report.getFilePath() );
|
||||
}
|
||||
else{
|
||||
NotificationHelper.showNotificationForReportUpload(
|
||||
HomeActivity.this,
|
||||
currentNotificationId,
|
||||
"Upload Failed",
|
||||
"SKU: " + report.getItems().get(0).getSku() + " failed.\nReason: " + throwable.getMessage());
|
||||
|
||||
NotificationHelper.showNotificationForReportUpload(
|
||||
HomeActivity.this,
|
||||
currentNotificationId,
|
||||
"Upload Failed",
|
||||
"SKU: " + report.getItems().get(0).getSku() + " failed.\nReason: " + throwable.getMessage());
|
||||
|
||||
|
||||
}
|
||||
|
||||
if (uploadedCount[0] == size) {
|
||||
reportsUploadBtn.setEnabled(true);
|
||||
//Toast.makeText(HomeActivity.this, "Finished uploading with some errors", Toast.LENGTH_SHORT).show();
|
||||
}
|
||||
}
|
||||
});
|
||||
|
|
|
@ -1279,7 +1279,7 @@ public class FirstStepFragment extends Fragment implements View.OnClickListener
|
|||
label.getMinLotSize() <= itemPresentedPieces &&
|
||||
label.getMaxLotSize() >= itemPresentedPieces) {
|
||||
sampleCode = label.getSampleCode();
|
||||
//Log.e("sampleCode: ",""+sampleCode);
|
||||
Log.e("sampleCode: ",""+sampleCode);
|
||||
break;
|
||||
}
|
||||
}
|
||||
|
|
|
@ -72,6 +72,8 @@ import com.utopiaindustries.qualitychecker.utils.ImageUriHolder;
|
|||
import java.io.File;
|
||||
import java.text.SimpleDateFormat;
|
||||
import java.time.LocalDate;
|
||||
import java.time.LocalDateTime;
|
||||
import java.time.format.DateTimeFormatter;
|
||||
import java.util.ArrayList;
|
||||
import java.util.Arrays;
|
||||
import java.util.Calendar;
|
||||
|
@ -487,6 +489,11 @@ public class ThirdStepFragment extends Fragment implements View.OnClickListener
|
|||
builder.setView(dialogView)
|
||||
.setTitle("So you want to save report?")
|
||||
.setPositiveButton("Save", (dialog, which) -> {
|
||||
LocalDateTime now = LocalDateTime.now(); // Get current date and time
|
||||
DateTimeFormatter formatter = DateTimeFormatter.ofPattern("yyyy-MM-dd'T'HH:mm:ss");
|
||||
String currentTime = now.format(formatter);
|
||||
//Log.e("Current-Time: ",""+currentTime);
|
||||
store.getReport().setReportSavedTime(currentTime);
|
||||
progressBar.setVisibility(View.VISIBLE);
|
||||
NotificationHelper.showNotification(Objects.requireNonNull(getContext()),
|
||||
"Utopia QA App",
|
||||
|
@ -704,11 +711,11 @@ public class ThirdStepFragment extends Fragment implements View.OnClickListener
|
|||
long draftReportId = Long.parseLong(sharedPreferences.getString("draftReportId", null));
|
||||
|
||||
if (draftReportId > 0) {
|
||||
Log.e("draft-Report-ID: ",""+draftReportId);
|
||||
//Log.e("draft-Report-ID: ",""+draftReportId);
|
||||
String selectedString = store.getReport().getItems().get(0).getSectionForDraft();
|
||||
Log.e("draft-Report-selected: ",""+selectedString);
|
||||
//Log.e("draft-Report-selected: ",""+selectedString);
|
||||
int index = sectionArrayList.indexOf(selectedString);
|
||||
Log.e("draft-index: ",""+index);
|
||||
//Log.e("draft-index: ",""+index);
|
||||
sectionSpinner.setSelection(index);
|
||||
|
||||
etHandFeelNotOk.setText(String.valueOf(store.getReport().getItems().get(0).getHandFeelNotOkay()));
|
||||
|
|
Loading…
Reference in New Issue