Merge branch 'develop' of ssh://git.wmi.amu.edu.pl/s416084/find-my-tutor-android into develop
This commit is contained in:
commit
ba73d08cd4
@ -20,9 +20,6 @@ public class Coordinate extends BaseResponse {
|
|||||||
private Range<Double> longtitudeRange = Const.buildingLongitudeRange;
|
private Range<Double> longtitudeRange = Const.buildingLongitudeRange;
|
||||||
private List<String> allowedApproximatedLocations = Const.validApproximatedLocations;
|
private List<String> allowedApproximatedLocations = Const.validApproximatedLocations;
|
||||||
|
|
||||||
@SerializedName("coordinateId")
|
|
||||||
private UUID coordinateId = null;
|
|
||||||
|
|
||||||
@SerializedName("latitude")
|
@SerializedName("latitude")
|
||||||
private Double latitude;
|
private Double latitude;
|
||||||
|
|
||||||
@ -66,23 +63,9 @@ public class Coordinate extends BaseResponse {
|
|||||||
}
|
}
|
||||||
|
|
||||||
public Coordinate coordinateId(UUID coordinateId) {
|
public Coordinate coordinateId(UUID coordinateId) {
|
||||||
this.coordinateId = coordinateId;
|
|
||||||
return this;
|
return this;
|
||||||
}
|
}
|
||||||
|
|
||||||
/**
|
|
||||||
* Get coordinateId
|
|
||||||
* @return coordinateId
|
|
||||||
**/
|
|
||||||
@ApiModelProperty(required = true, value = "")
|
|
||||||
public UUID getCoordinateId() {
|
|
||||||
return coordinateId;
|
|
||||||
}
|
|
||||||
|
|
||||||
public void setCoordinateId(UUID coordinateId) {
|
|
||||||
this.coordinateId = coordinateId;
|
|
||||||
}
|
|
||||||
|
|
||||||
public Coordinate latitude(Double latitude) {
|
public Coordinate latitude(Double latitude) {
|
||||||
this.latitude = latitude;
|
this.latitude = latitude;
|
||||||
return this;
|
return this;
|
||||||
@ -236,8 +219,7 @@ public class Coordinate extends BaseResponse {
|
|||||||
return false;
|
return false;
|
||||||
}
|
}
|
||||||
Coordinate coordinate = (Coordinate) o;
|
Coordinate coordinate = (Coordinate) o;
|
||||||
return Objects.equals(this.coordinateId, coordinate.coordinateId) &&
|
return Objects.equals(this.latitude, coordinate.latitude) &&
|
||||||
Objects.equals(this.latitude, coordinate.latitude) &&
|
|
||||||
Objects.equals(this.longitude, coordinate.longitude) &&
|
Objects.equals(this.longitude, coordinate.longitude) &&
|
||||||
Objects.equals(this.altitude, coordinate.altitude) &&
|
Objects.equals(this.altitude, coordinate.altitude) &&
|
||||||
Objects.equals(this.userId, coordinate.userId) &&
|
Objects.equals(this.userId, coordinate.userId) &&
|
||||||
@ -249,7 +231,7 @@ public class Coordinate extends BaseResponse {
|
|||||||
|
|
||||||
@Override
|
@Override
|
||||||
public int hashCode() {
|
public int hashCode() {
|
||||||
return Objects.hash(coordinateId, latitude, longitude, altitude, userId, approximatedLocation, displayMode, timeStamp, label);
|
return Objects.hash( latitude, longitude, altitude, userId, approximatedLocation, displayMode, timeStamp, label);
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|
||||||
@ -258,7 +240,6 @@ public class Coordinate extends BaseResponse {
|
|||||||
StringBuilder sb = new StringBuilder();
|
StringBuilder sb = new StringBuilder();
|
||||||
sb.append("class Coordinate {\n");
|
sb.append("class Coordinate {\n");
|
||||||
|
|
||||||
sb.append(" coordinateId: ").append(toIndentedString(coordinateId)).append("\n");
|
|
||||||
sb.append(" latitude: ").append(toIndentedString(latitude)).append("\n");
|
sb.append(" latitude: ").append(toIndentedString(latitude)).append("\n");
|
||||||
sb.append(" longitude: ").append(toIndentedString(longitude)).append("\n");
|
sb.append(" longitude: ").append(toIndentedString(longitude)).append("\n");
|
||||||
sb.append(" altitude: ").append(toIndentedString(altitude)).append("\n");
|
sb.append(" altitude: ").append(toIndentedString(altitude)).append("\n");
|
||||||
|
@ -26,7 +26,7 @@ public class ApiClient {
|
|||||||
private static Retrofit retrofit = null;
|
private static Retrofit retrofit = null;
|
||||||
private static int REQUEST_TIMEOUT = 60;
|
private static int REQUEST_TIMEOUT = 60;
|
||||||
private static OkHttpClient okHttpClient;
|
private static OkHttpClient okHttpClient;
|
||||||
private static final String BASE_URL = "https://s416084.projektstudencki.pl/master/";
|
private static final String BASE_URL = "https://s416084.projektstudencki.pl/develop/";
|
||||||
|
|
||||||
public static Retrofit getClient(Context context) {
|
public static Retrofit getClient(Context context) {
|
||||||
|
|
||||||
|
@ -25,6 +25,7 @@ import android.util.Log;
|
|||||||
import com.annimon.stream.Stream;
|
import com.annimon.stream.Stream;
|
||||||
import com.google.android.gms.location.FusedLocationProviderClient;
|
import com.google.android.gms.location.FusedLocationProviderClient;
|
||||||
import com.google.android.gms.location.LocationServices;
|
import com.google.android.gms.location.LocationServices;
|
||||||
|
import com.jakewharton.retrofit2.adapter.rxjava2.HttpException;
|
||||||
import com.mapbox.geojson.Point;
|
import com.mapbox.geojson.Point;
|
||||||
import com.mapbox.mapboxsdk.geometry.LatLng;
|
import com.mapbox.mapboxsdk.geometry.LatLng;
|
||||||
import com.uam.wmi.findmytutor.model.Coordinate;
|
import com.uam.wmi.findmytutor.model.Coordinate;
|
||||||
@ -32,6 +33,7 @@ import com.uam.wmi.findmytutor.network.ApiClient;
|
|||||||
import com.uam.wmi.findmytutor.utils.ApproximatedLocalization;
|
import com.uam.wmi.findmytutor.utils.ApproximatedLocalization;
|
||||||
import com.uam.wmi.findmytutor.utils.MapUtils;
|
import com.uam.wmi.findmytutor.utils.MapUtils;
|
||||||
import com.uam.wmi.findmytutor.utils.PrefUtils;
|
import com.uam.wmi.findmytutor.utils.PrefUtils;
|
||||||
|
import com.uam.wmi.findmytutor.utils.RestApiHelper;
|
||||||
import com.uam.wmi.findmytutor.utils.SharingLevel;
|
import com.uam.wmi.findmytutor.utils.SharingLevel;
|
||||||
|
|
||||||
import org.apache.commons.collections4.queue.CircularFifoQueue;
|
import org.apache.commons.collections4.queue.CircularFifoQueue;
|
||||||
@ -42,8 +44,10 @@ import java.util.concurrent.atomic.AtomicReference;
|
|||||||
|
|
||||||
import io.reactivex.android.schedulers.AndroidSchedulers;
|
import io.reactivex.android.schedulers.AndroidSchedulers;
|
||||||
import io.reactivex.disposables.CompositeDisposable;
|
import io.reactivex.disposables.CompositeDisposable;
|
||||||
|
import io.reactivex.observers.DisposableCompletableObserver;
|
||||||
import io.reactivex.observers.DisposableSingleObserver;
|
import io.reactivex.observers.DisposableSingleObserver;
|
||||||
import io.reactivex.schedulers.Schedulers;
|
import io.reactivex.schedulers.Schedulers;
|
||||||
|
import okhttp3.ResponseBody;
|
||||||
|
|
||||||
import static com.uam.wmi.findmytutor.utils.Const.offlineBackgroundLocationInterval;
|
import static com.uam.wmi.findmytutor.utils.Const.offlineBackgroundLocationInterval;
|
||||||
import static com.uam.wmi.findmytutor.utils.Const.onlineBackgroundLocationInterval;
|
import static com.uam.wmi.findmytutor.utils.Const.onlineBackgroundLocationInterval;
|
||||||
@ -51,6 +55,7 @@ import static com.uam.wmi.findmytutor.utils.Const.presenceApproximatedName;
|
|||||||
import static com.uam.wmi.findmytutor.utils.Const.presenceLatitude;
|
import static com.uam.wmi.findmytutor.utils.Const.presenceLatitude;
|
||||||
import static com.uam.wmi.findmytutor.utils.Const.presenceLongitude;
|
import static com.uam.wmi.findmytutor.utils.Const.presenceLongitude;
|
||||||
import static com.uam.wmi.findmytutor.utils.PrefUtils.storeBackgroundLocationStatus;
|
import static com.uam.wmi.findmytutor.utils.PrefUtils.storeBackgroundLocationStatus;
|
||||||
|
import static java.lang.String.valueOf;
|
||||||
|
|
||||||
public class BackgroundLocalizationService extends Service {
|
public class BackgroundLocalizationService extends Service {
|
||||||
|
|
||||||
@ -353,18 +358,21 @@ public class BackgroundLocalizationService extends Service {
|
|||||||
|
|
||||||
disposable.add(
|
disposable.add(
|
||||||
coordinateService
|
coordinateService
|
||||||
.postCoordinate(coordinate)
|
.putCoordinate(coordinate, PrefUtils.getUserId(getApplicationContext()))
|
||||||
.subscribeOn(Schedulers.io())
|
.subscribeOn(Schedulers.io())
|
||||||
.observeOn(AndroidSchedulers.mainThread())
|
.observeOn(AndroidSchedulers.mainThread())
|
||||||
.subscribeWith(new DisposableSingleObserver<Coordinate>() {
|
.subscribeWith(new DisposableCompletableObserver() {
|
||||||
|
|
||||||
@Override
|
@Override
|
||||||
public void onSuccess(Coordinate coordinate) {
|
public void onComplete() {
|
||||||
Log.e(TAG, String.valueOf(coordinate));
|
Log.e(TAG, "CoordinateSuccess");
|
||||||
}
|
}
|
||||||
|
|
||||||
@Override
|
@Override
|
||||||
public void onError(Throwable e) {
|
public void onError(Throwable e) {
|
||||||
Log.e(TAG, e.getMessage());
|
|
||||||
|
Log.e(TAG,"onErr" + valueOf(e));
|
||||||
|
|
||||||
}
|
}
|
||||||
}));
|
}));
|
||||||
} catch (IllegalArgumentException e) {
|
} catch (IllegalArgumentException e) {
|
||||||
|
@ -3,6 +3,7 @@ package com.uam.wmi.findmytutor.service;
|
|||||||
import com.uam.wmi.findmytutor.model.Coordinate;
|
import com.uam.wmi.findmytutor.model.Coordinate;
|
||||||
import java.util.List;
|
import java.util.List;
|
||||||
|
|
||||||
|
import io.reactivex.Completable;
|
||||||
import io.reactivex.Single;
|
import io.reactivex.Single;
|
||||||
import retrofit2.http.Body;
|
import retrofit2.http.Body;
|
||||||
import retrofit2.http.DELETE;
|
import retrofit2.http.DELETE;
|
||||||
@ -36,9 +37,9 @@ public interface CoordinateService {
|
|||||||
Single <Coordinate> postCoordinate(@Body Coordinate coordinate);
|
Single <Coordinate> postCoordinate(@Body Coordinate coordinate);
|
||||||
|
|
||||||
@PUT("api/coordinates/{id}")
|
@PUT("api/coordinates/{id}")
|
||||||
Single<Coordinate> putCoordinatesById(@Path("id") String id);
|
Completable putCoordinate(@Body Coordinate coordinate, @Path("id") String id);
|
||||||
|
|
||||||
@DELETE("api/coordinates/{id}")
|
@DELETE("api/coordinates/{id}")
|
||||||
Single<Coordinate> deleteCoordinatesById(@Path("id") String id);
|
Completable deleteCoordinatesById(@Path("id") String id);
|
||||||
|
|
||||||
}
|
}
|
||||||
|
Loading…
Reference in New Issue
Block a user