@@ -107,7 +107,7 @@ public class ReportFragment extends Fragment {
107107 private List <Service > services ;
108108
109109 private ProgressDialog progress ;
110-
110+ private File photo ;
111111 private String location ;
112112 private String serviceName ;
113113 private String serviceCode ;
@@ -821,7 +821,7 @@ private void handleCamera() {
821821 Intent cameraIntent = new Intent (MediaStore .ACTION_IMAGE_CAPTURE );
822822 if (cameraIntent .resolveActivity (getContext ().getPackageManager ()) != null ) {
823823 // Create the File where the photo should go
824- File photo ;
824+
825825 try {
826826 photo = createFile (Attachment .AttachmentType .IMAGE );
827827 cameraIntent .putExtra (MediaStore .EXTRA_OUTPUT , Uri .fromFile (photo ));
@@ -968,8 +968,13 @@ public void onActivityResult(int requestCode, int resultCode, Intent data) {
968968
969969 if (requestCode == CAMERA_REQUEST ) {
970970 if (resultCode == Activity .RESULT_OK ) {
971- if (data .getData () == null ) return ;
972- updatePhoto (data .getData (), true );
971+ if (data != null ) {
972+ if (data .getData () == null ) return ;
973+ updatePhoto (data .getData (), true );
974+ } else {
975+ if (photo .length () == 0 ) return ;
976+ updatePhoto (Uri .fromFile (photo ), true );
977+ }
973978 } else {
974979 resetPhoto ();
975980 }
@@ -1212,8 +1217,14 @@ protected List<Service> doInBackground(String... params) {
12121217 Log .d (LOG_TAG , "RetrieveServicesTask - doInBackground" );
12131218 services = null ; //reset services
12141219 APIWrapper wrapper ;
1220+ EndpointType endpointType ;
1221+ Server currentServer = ((MainActivity ) getActivity ()).getCurrentServer ();
1222+ // todo Check if server has a base URL, then check if it has a test Url. determine the EndpointType by that.
1223+ endpointType = EndpointType .PRODUCTION ;
1224+
12151225 try {
1216- wrapper = new APIWrapperFactory (((MainActivity ) getActivity ()).getCurrentServer (), EndpointType .PRODUCTION ).build ();
1226+
1227+ wrapper = new APIWrapperFactory (currentServer , endpointType ).build ();
12171228 publishProgress ();
12181229 return wrapper .getServiceList ();
12191230 } catch (APIWrapperException e ) {
0 commit comments