Compare commits
| Author | SHA1 | Date | |
|---|---|---|---|
|
|
4f85f70d3e | ||
|
|
5bb2e6fee6 | ||
|
|
d577cadf39 | ||
|
|
cb4b3331f4 | ||
|
|
12c5d79686 |
@@ -27,10 +27,13 @@ android {
|
||||
applicationId "com.maptology.android.app"
|
||||
minSdkVersion 14
|
||||
targetSdkVersion 28
|
||||
versionCode 5
|
||||
versionName "1.0.1"
|
||||
versionCode 6
|
||||
versionName "${version}"
|
||||
buildConfigField "long", "BUILD_TIME", System.currentTimeMillis() + "L"
|
||||
testInstrumentationRunner "androidx.test.runner.AndroidJUnitRunner"
|
||||
resValue "string", "application_long", "Maptology"
|
||||
resValue "string", "application_short", "Maptology"
|
||||
|
||||
}
|
||||
|
||||
signingConfigs {
|
||||
@@ -50,8 +53,16 @@ android {
|
||||
// add signing config if key is provided via system property
|
||||
if (System.properties['android.keystore.password'] != null) signingConfig signingConfigs.release
|
||||
}
|
||||
|
||||
debug {
|
||||
applicationIdSuffix ".debug"
|
||||
versionNameSuffix "-dbg"
|
||||
resValue "string", "application_long", "Maptology (Debug)"
|
||||
resValue "string", "application_short", "M (Debug)"
|
||||
}
|
||||
}
|
||||
|
||||
|
||||
testOptions {
|
||||
unitTests {
|
||||
includeAndroidResources = true
|
||||
|
||||
@@ -267,7 +267,6 @@ public class LocationService extends Service {
|
||||
}
|
||||
|
||||
@Override
|
||||
@SuppressLint("InlinedApi")
|
||||
public void onCreate() {
|
||||
Log.d(TAG, "Creating location service.");
|
||||
super.onCreate();
|
||||
@@ -323,21 +322,19 @@ public class LocationService extends Service {
|
||||
stopSelf();
|
||||
return START_NOT_STICKY;
|
||||
}
|
||||
if (!isPeriodicExecution(intent)) {
|
||||
Log.d(TAG, "Scheduling periodic execution.");
|
||||
scheduleExecution(this, localizationTime);
|
||||
}
|
||||
// ensure that localization is only running, if it is not
|
||||
// running already or has been run only seconds ago
|
||||
// start localization, if we are not running one already
|
||||
long now = SystemClock.elapsedRealtime();
|
||||
if (currentState == LocationState.IDLE) {
|
||||
if (isDeviceIdle()) {
|
||||
onDeviceIdle();
|
||||
} else if (now - localizationTime > LOCALIZATION_TIMEOUT - 1000) {
|
||||
if (now - localizationTime > LOCALIZATION_TIMEOUT / 2) {
|
||||
Log.d(TAG, "Starting localization state machine.");
|
||||
changeState();
|
||||
} else {
|
||||
Log.d(TAG, "Ignoring start request while timeout has not expired.");
|
||||
if (isDeviceIdle()) {
|
||||
onDeviceIdle();
|
||||
}
|
||||
Log.d(TAG, "Scheduling periodic execution.");
|
||||
scheduleExecution(this, localizationTime);
|
||||
}
|
||||
} else {
|
||||
Log.d(TAG, "Ignoring start request while service is " + currentState + ".");
|
||||
@@ -617,7 +614,7 @@ public class LocationService extends Service {
|
||||
// otherwise create idle update
|
||||
ReleasedLocation update = createLocation();
|
||||
update.setAvailability(ReleasedLocation.AvailabilityEnum.IDLE);
|
||||
update.setTimestamp(System.currentTimeMillis());
|
||||
update.setTimestamp(localizationTime);
|
||||
update.setAccuracy(previous.getAccuracy());
|
||||
update.setCoordinate(previous.getCoordinate());
|
||||
update.setProvider(previous.getProvider());
|
||||
@@ -940,7 +937,7 @@ public class LocationService extends Service {
|
||||
}
|
||||
|
||||
/**
|
||||
* Schedules the service for periodic execution.
|
||||
* Schedules the service for the next execution.
|
||||
*
|
||||
* @param context The context used to schedule this.
|
||||
*/
|
||||
@@ -950,7 +947,13 @@ public class LocationService extends Service {
|
||||
long now = SystemClock.elapsedRealtime();
|
||||
long next = Math.max(0, (lastTime + LOCALIZATION_TIMEOUT) - now);
|
||||
Log.d(TAG, "Updating alarm to execute in " + next + " ms.");
|
||||
manager.setRepeating(AlarmManager.ELAPSED_REALTIME_WAKEUP, SystemClock.elapsedRealtime() + next, LOCALIZATION_TIMEOUT, pending);
|
||||
// this is too imprecise on Android 9
|
||||
//manager.setRepeating(AlarmManager.ELAPSED_REALTIME_WAKEUP, SystemClock.elapsedRealtime() + next, LOCALIZATION_TIMEOUT, pending);
|
||||
if (Build.VERSION.SDK_INT < Build.VERSION_CODES.KITKAT) {
|
||||
manager.set(AlarmManager.ELAPSED_REALTIME_WAKEUP, SystemClock.elapsedRealtime() + next, pending);
|
||||
} else {
|
||||
manager.setWindow(AlarmManager.ELAPSED_REALTIME_WAKEUP, SystemClock.elapsedRealtime() + next, 10000, pending);
|
||||
}
|
||||
}
|
||||
|
||||
/**
|
||||
|
||||
+14
-10
@@ -41,6 +41,7 @@ public abstract class AbstractLoginFragment extends AbstractFragment {
|
||||
private int title;
|
||||
private int explanation;
|
||||
private int login;
|
||||
private boolean passwordVisible = false;
|
||||
|
||||
/**
|
||||
* The listener that listens to changes announced by the async task.
|
||||
@@ -86,7 +87,6 @@ public abstract class AbstractLoginFragment extends AbstractFragment {
|
||||
public void onClick(View v) {
|
||||
String username = usernameText.getText().toString();
|
||||
String password = passwordText.getText().toString();
|
||||
|
||||
username = analyzeInput(username);
|
||||
password = analyzeInput(password);
|
||||
if (username == null || password == null) {
|
||||
@@ -101,17 +101,9 @@ public abstract class AbstractLoginFragment extends AbstractFragment {
|
||||
});
|
||||
passwordButton = (ImageButton) view.findViewById(R.id.button_password);
|
||||
passwordButton.setOnClickListener(new View.OnClickListener() {
|
||||
private boolean visible = false;
|
||||
@Override
|
||||
public void onClick(View v) {
|
||||
visible = !visible;
|
||||
if (visible) {
|
||||
passwordButton.setImageResource(R.drawable.ic_visibility_off_black_24dp);
|
||||
passwordText.setTransformationMethod(null);
|
||||
} else {
|
||||
passwordButton.setImageResource(R.drawable.ic_visibility_black_24dp);
|
||||
passwordText.setTransformationMethod(new PasswordTransformationMethod());
|
||||
}
|
||||
setPasswordVisible(!passwordVisible);
|
||||
}
|
||||
});
|
||||
noLoginButton.setOnClickListener(new View.OnClickListener() {
|
||||
@@ -175,6 +167,17 @@ public abstract class AbstractLoginFragment extends AbstractFragment {
|
||||
}
|
||||
}
|
||||
|
||||
private void setPasswordVisible(boolean visible) {
|
||||
if (visible) {
|
||||
passwordButton.setImageResource(R.drawable.ic_visibility_off_black_24dp);
|
||||
passwordText.setTransformationMethod(null);
|
||||
} else {
|
||||
passwordButton.setImageResource(R.drawable.ic_visibility_black_24dp);
|
||||
passwordText.setTransformationMethod(new PasswordTransformationMethod());
|
||||
}
|
||||
this.passwordVisible = visible;
|
||||
}
|
||||
|
||||
private void setEnabled(boolean enabled) {
|
||||
loginButton.setEnabled(enabled);
|
||||
noLoginButton.setEnabled(enabled);
|
||||
@@ -182,6 +185,7 @@ public abstract class AbstractLoginFragment extends AbstractFragment {
|
||||
usernameText.setEnabled(enabled);
|
||||
passwordText.setEnabled(enabled);
|
||||
progressBar.setVisibility(enabled?View.GONE:View.VISIBLE);
|
||||
if (!enabled) setPasswordVisible(false);
|
||||
}
|
||||
|
||||
private String analyzeInput(String input) {
|
||||
|
||||
@@ -4,13 +4,9 @@
|
||||
android:layout_width="match_parent"
|
||||
android:layout_height="match_parent">
|
||||
|
||||
<LinearLayout android:orientation="vertical"
|
||||
android:layout_centerHorizontal="true"
|
||||
android:gravity="center"
|
||||
android:layout_width="@dimen/max_view_width"
|
||||
android:layout_height="match_parent">
|
||||
|
||||
<ScrollView android:layout_width="match_parent"
|
||||
<ScrollView android:layout_width="@dimen/max_view_width"
|
||||
android:fillViewport="true"
|
||||
android:layout_centerHorizontal="true"
|
||||
android:layout_height="wrap_content">
|
||||
|
||||
<LinearLayout android:layout_width="match_parent"
|
||||
@@ -50,6 +46,7 @@
|
||||
<LinearLayout
|
||||
android:layout_width="match_parent"
|
||||
android:layout_height="wrap_content"
|
||||
android:layout_marginBottom="@dimen/space_large"
|
||||
android:orientation="horizontal">
|
||||
<androidx.appcompat.widget.AppCompatEditText
|
||||
android:id="@+id/input_password"
|
||||
@@ -69,7 +66,7 @@
|
||||
android:layout_width="wrap_content"
|
||||
android:layout_height="wrap_content"
|
||||
android:padding="@dimen/space_medium"
|
||||
android:background="@color/white"
|
||||
android:background="@android:color/transparent"
|
||||
android:src="@drawable/ic_visibility_black_24dp" />
|
||||
</LinearLayout>
|
||||
|
||||
@@ -106,7 +103,6 @@
|
||||
|
||||
</ScrollView>
|
||||
|
||||
</LinearLayout>
|
||||
<ProgressBar
|
||||
android:id="@+id/progressBar"
|
||||
android:layout_width="wrap_content"
|
||||
|
||||
@@ -1,7 +1,9 @@
|
||||
<?xml version="1.0" encoding="utf-8"?>
|
||||
<resources>
|
||||
<!--
|
||||
<string name="application_long" translatable="false">Maptology</string>
|
||||
<string name="application_short" translatable="false">Maptology</string>
|
||||
-->
|
||||
|
||||
<string name="maptology_url_default" translatable="false">https://www.maptology.com/api</string>
|
||||
<string name="maptology_url_share" translatable="false">https://www.maptology.com/app/shares/</string>
|
||||
|
||||
+1
-1
@@ -25,7 +25,7 @@ buildscript {
|
||||
allprojects {
|
||||
// set version for our project
|
||||
group = 'com.maptology'
|
||||
version = '1.0.1'
|
||||
version = '1.0.2'
|
||||
|
||||
// set versions for our libraries
|
||||
ext {
|
||||
|
||||
@@ -51,13 +51,13 @@ public class LoginManager {
|
||||
public User login(String login, String password) {
|
||||
UserEntity entity = UserEntity.findByLogin(em, login);
|
||||
if (entity == null) {
|
||||
log.log(Level.INFO, "User '" + login + "' does not exist.");
|
||||
log.log(Level.SEVERE, "User '" + login + "' does not exist.");
|
||||
} else if (entity.isDeleted()) {
|
||||
log.log(Level.INFO, "User '" + login + "' is deleted.");
|
||||
log.log(Level.SEVERE, "User '" + login + "' is deleted.");
|
||||
} else if (entity.isSuspended()) {
|
||||
log.log(Level.INFO, "User '" + login + "' is suspended.");
|
||||
log.log(Level.SEVERE, "User '" + login + "' is suspended.");
|
||||
} else if(!isEmailVerified(entity)){
|
||||
log.log(Level.INFO, "User '" + login + "' has no verified email.");
|
||||
log.log(Level.SEVERE, "User '" + login + "' has no verified email.");
|
||||
}
|
||||
else {
|
||||
SecureHash hash = new SecureHash(entity.getIterations(), entity.getSalt(), entity.getHash());
|
||||
@@ -66,7 +66,7 @@ public class LoginManager {
|
||||
UserConverter c = new UserConverter(true);
|
||||
return c.convert(entity);
|
||||
} else {
|
||||
log.log(Level.INFO, "User '" + login + "' provided wrong password.");
|
||||
log.log(Level.SEVERE, "User '" + login + "' provided wrong password.");
|
||||
}
|
||||
}
|
||||
return null;
|
||||
@@ -96,15 +96,15 @@ public class LoginManager {
|
||||
log.log(Level.INFO, "Validating device token");
|
||||
DeviceEntity entity = DeviceEntity.findByToken(em, token);
|
||||
if (entity == null) {
|
||||
log.log(Level.INFO, "Device '" + token + "' does not exist.");
|
||||
log.log(Level.SEVERE, "Device '" + token + "' does not exist.");
|
||||
} else if (entity.isDeleted()) {
|
||||
log.log(Level.INFO, "Device '" + token + "' is deleted.");
|
||||
log.log(Level.SEVERE, "Device '" + entity.getId() + "' is deleted.");
|
||||
} else if (entity.getUser() != null && entity.getUser().isDeleted()) {
|
||||
log.log(Level.INFO, "User '" + entity.getUser().getLogin() + "' is deleted.");
|
||||
log.log(Level.SEVERE, "User '" + entity.getUser().getLogin() + "' is deleted.");
|
||||
} else if (entity.getUser() != null && entity.getUser().isSuspended()) {
|
||||
log.log(Level.INFO, "User '" + entity.getUser().getLogin() + "' is suspended.");
|
||||
log.log(Level.SEVERE, "User '" + entity.getUser().getLogin() + "' is suspended.");
|
||||
} else {
|
||||
log.log(Level.INFO, "Device '" + token + "' authenticated.");
|
||||
log.log(Level.INFO, "Device '" + entity.getId() + "' authenticated.");
|
||||
DeviceConverter c = new DeviceConverter(true);
|
||||
return c.convert(entity);
|
||||
}
|
||||
|
||||
@@ -47,6 +47,11 @@ public class DebugPositionSessionBean implements IPositionSessionBean {
|
||||
return empty;
|
||||
}
|
||||
|
||||
@Override
|
||||
public long getPositionCount() {
|
||||
return 0;
|
||||
}
|
||||
|
||||
@Override
|
||||
@RolesAllowed(Roles.ADMIN)
|
||||
public long getLastModifiedPosition() {
|
||||
|
||||
@@ -30,11 +30,17 @@ public interface IPositionSessionBean {
|
||||
*/
|
||||
PositionPage getPositions(PageConfig pageConfig);
|
||||
|
||||
/**
|
||||
* Returns the total number of positions.
|
||||
*
|
||||
* @return The total number of positions.
|
||||
*/
|
||||
long getPositionCount();
|
||||
|
||||
/**
|
||||
* Returns the highest creation time stamp of the positions.
|
||||
*
|
||||
* @return The highest creaton time stamp.
|
||||
* @return The highest creation time stamp.
|
||||
*/
|
||||
long getLastModifiedPosition();
|
||||
|
||||
|
||||
@@ -85,6 +85,12 @@ public class PositionSessionBean implements IPositionSessionBean {
|
||||
return PositionEntity.getLast(em);
|
||||
}
|
||||
|
||||
@Override
|
||||
@RolesAllowed(Roles.ADMIN)
|
||||
public long getPositionCount() {
|
||||
return PositionEntity.getCount(em);
|
||||
}
|
||||
|
||||
@Override
|
||||
@RolesAllowed(Roles.ADMIN)
|
||||
public PositionPage getPositions(PageConfig pageConfig) {
|
||||
|
||||
@@ -12,6 +12,7 @@ import javax.annotation.security.DeclareRoles;
|
||||
import javax.annotation.security.RolesAllowed;
|
||||
import javax.ejb.Stateful;
|
||||
import javax.enterprise.context.RequestScoped;
|
||||
import javax.inject.Inject;
|
||||
|
||||
import com.maptology.api.access.Roles;
|
||||
import com.maptology.api.log.EntityStatistic;
|
||||
@@ -24,6 +25,7 @@ import com.maptology.service.entity.EmailEntity;
|
||||
import com.maptology.service.entity.LocationEntity;
|
||||
import com.maptology.service.entity.NoticeEntity;
|
||||
import com.maptology.service.entity.PlaceEntity;
|
||||
import com.maptology.service.entity.PositionEntity;
|
||||
import com.maptology.service.entity.PrivilegeEntity;
|
||||
import com.maptology.service.entity.RoleEntity;
|
||||
import com.maptology.service.entity.ShareEntity;
|
||||
@@ -50,6 +52,12 @@ public class StatisticsSessionBean extends AbstractSessionBean {
|
||||
*/
|
||||
private static final int NUMBER_NOT_AVAILABLE = -1;
|
||||
|
||||
/**
|
||||
* The position session to retrieve position related statistics.
|
||||
*/
|
||||
@Inject
|
||||
protected IPositionSessionBean positionSession;
|
||||
|
||||
/**
|
||||
* The list of entities.
|
||||
*/
|
||||
@@ -77,6 +85,12 @@ public class StatisticsSessionBean extends AbstractSessionBean {
|
||||
s.setTotal(total);
|
||||
result.add(s);
|
||||
}
|
||||
// add position statistics
|
||||
EntityStatistic positionStatistic = new EntityStatistic();
|
||||
positionStatistic.setName(PositionEntity.class.getSimpleName());
|
||||
positionStatistic.setDeleted(0);
|
||||
positionStatistic.setTotal(positionSession.getPositionCount());
|
||||
result.add(positionStatistic);
|
||||
return result;
|
||||
}
|
||||
|
||||
|
||||
@@ -65,7 +65,6 @@ public class MaptologyAuthModule extends AbstractHttpServletAuthModule {
|
||||
if (headers != null) {
|
||||
while (headers.hasMoreElements()) {
|
||||
String header = headers.nextElement();
|
||||
log.log(Level.SEVERE, "Found auth header: " + header);
|
||||
String[] subHeaders = header.split(",");
|
||||
for (String subHeader: subHeaders) {
|
||||
subHeader = subHeader.trim();
|
||||
@@ -101,7 +100,7 @@ public class MaptologyAuthModule extends AbstractHttpServletAuthModule {
|
||||
LoginManager manager = new LoginManager(em);
|
||||
ta.begin();
|
||||
if (deviceCredential != null) device = manager.login(deviceCredential.getToken());
|
||||
if (userCredential != null) user = manager.login(userCredential.getUsername(), userCredential.getPassword());
|
||||
if (userCredential != null) user = manager.login(userCredential.getUsername(), userCredential.getPassword());
|
||||
} finally {
|
||||
ta.commit();
|
||||
}
|
||||
@@ -129,7 +128,7 @@ public class MaptologyAuthModule extends AbstractHttpServletAuthModule {
|
||||
}
|
||||
try {
|
||||
MaptologyPrincipal principal = new MaptologyPrincipal(username + ":" + devicename, userId, deviceId);
|
||||
log.log(Level.INFO, "Creating principal: " + principal);
|
||||
log.log(Level.INFO, "Successful login for device(" + principal.getDevice() + ") and user(" + principal.getUser() + ").");
|
||||
callbackHandler.handle(new Callback[]{
|
||||
new CallerPrincipalCallback(clientSubject, principal),
|
||||
new GroupPrincipalCallback(clientSubject, roles.toArray(new String[roles.size()]))
|
||||
|
||||
@@ -2,9 +2,9 @@
|
||||
<mat-toolbar>
|
||||
<mat-icon>pie_chart_outlined</mat-icon>
|
||||
<span style="margin-left: 10px">{{ res.strings('places_title') }}</span>
|
||||
<div style="padding-top:5px;" flexLayout="row" fxLayoutAlign="end center" fxFlex="1 1 auto" fxLayoutGap="10px">
|
||||
<div style="padding-top:20px;" flexLayout="row" fxLayoutAlign="end center" fxFlex="1 1 auto" fxLayoutGap="10px">
|
||||
<form style="font-size: 12px;" fxLayoutAlign="center center" flexLayout="row">
|
||||
<mat-form-field fxFlex="1 1 200px">
|
||||
<mat-form-field fxFlex="1 1 180px">
|
||||
<mat-select [placeholder]="res.strings('places_order_placeholder')" [value]="order.getValue()" (selectionChange)="order.next($event.source.value)">
|
||||
<mat-option *ngFor="let o of getOrders()" [value]="o">
|
||||
<span>{{ getOrderName(o) }}</span>
|
||||
|
||||
Reference in New Issue
Block a user