- minor changes
parent
e7e736c468
commit
ee37ff3cf4
|
@ -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.16:8080/uind/";
|
||||
private final static String BASE_URL = "https://portal.utopiaindustries.pk/uind/";
|
||||
// private final static String BASE_URL = "http://192.168.91.16:8080/uind/";
|
||||
|
||||
private static Retrofit retrofit;
|
||||
|
||||
|
|
|
@ -1,5 +1,6 @@
|
|||
package com.utopiaindustries.qualitychecker.service;
|
||||
|
||||
import android.annotation.SuppressLint;
|
||||
import android.app.Service;
|
||||
import android.content.Intent;
|
||||
import android.net.ConnectivityManager;
|
||||
|
@ -13,6 +14,7 @@ import com.utopiaindustries.qualitychecker.db.ReportRepository;
|
|||
import com.utopiaindustries.qualitychecker.models.InspectionReport;
|
||||
import com.utopiaindustries.qualitychecker.models.InspectionReportWrapper;
|
||||
import com.utopiaindustries.qualitychecker.models.callback.SaveReportCallback;
|
||||
import com.utopiaindustries.qualitychecker.notification.NotificationHelper;
|
||||
import com.utopiaindustries.qualitychecker.utils.FileUtils;
|
||||
|
||||
import java.io.ByteArrayInputStream;
|
||||
|
@ -69,12 +71,20 @@ public class NetworkService extends Service {
|
|||
}
|
||||
}
|
||||
|
||||
@SuppressLint("DefaultLocale")
|
||||
private void pushDataToInternet() {
|
||||
ReportRepository repository = new ReportRepository( this );
|
||||
List<InspectionReportWrapper> reportWrappers = repository.findAllUnsynced();
|
||||
InspectionReportService service = InspectionReportService.getInstance();
|
||||
try {
|
||||
List<InspectionReport> reports = getReports( reportWrappers );
|
||||
int size = reports.size();
|
||||
if( size > 0 ){
|
||||
NotificationHelper.showNotification(
|
||||
this,
|
||||
"Uploading Reports",
|
||||
String.format(" %d report(s) uploading..", reports.size() )
|
||||
);
|
||||
for ( InspectionReport report : reports ){
|
||||
service.saveReport(report, new SaveReportCallback() {
|
||||
@Override
|
||||
|
@ -90,6 +100,12 @@ public class NetworkService extends Service {
|
|||
}
|
||||
});
|
||||
}
|
||||
NotificationHelper.showNotification(
|
||||
this,
|
||||
"Uploading Reports",
|
||||
String.format(" %d report(s) uploaded successfully..", reports.size() )
|
||||
);
|
||||
}
|
||||
} catch ( Exception e ) {
|
||||
e.printStackTrace();
|
||||
}
|
||||
|
|
|
@ -366,7 +366,7 @@ public class FirstStepFragment extends Fragment implements View.OnClickListener
|
|||
if( populateMarketplace ){
|
||||
populateMarketplaces( products );
|
||||
}
|
||||
populateMmodelNumber(products );
|
||||
populateModelNumber(products );
|
||||
populateTitle( products );
|
||||
populateColor( products );
|
||||
populateSize( products );
|
||||
|
@ -451,7 +451,7 @@ public class FirstStepFragment extends Fragment implements View.OnClickListener
|
|||
}
|
||||
|
||||
|
||||
private void populateMmodelNumber( List<Product> products ){
|
||||
private void populateModelNumber( List<Product> products ){
|
||||
List<String> modelNumbers = Collections.singletonList("[Model Number]");
|
||||
if( ! products.isEmpty() ){
|
||||
modelNumbers = products.stream().map( Product::getModelNumber ).distinct().filter(Objects::nonNull).collect(Collectors.toList() ) ;
|
||||
|
@ -461,7 +461,7 @@ public class FirstStepFragment extends Fragment implements View.OnClickListener
|
|||
modelNumber.setAdapter( adapter );
|
||||
|
||||
String modelOption = (String) modelNumber.getSelectedItem();
|
||||
store.getReport().getItems().get(0).setMarketplace( modelOption );
|
||||
store.getReport().getItems().get(0).setModelNumber( modelOption );
|
||||
}
|
||||
}
|
||||
|
||||
|
|
|
@ -9,6 +9,6 @@
|
|||
<color name="success">#20830E</color>
|
||||
<color name="red">#FF0000</color>
|
||||
<color name="light_blue">#29DAF1</color>
|
||||
<color name="light_blue_2">#6DE2F1</color>
|
||||
<color name="light_blue_2">#AFEEF6</color>
|
||||
<color name="cp_bg_color">#FFFFFF</color>
|
||||
</resources>
|
Loading…
Reference in New Issue