Merge branch 'acraReporter' of s416084/find-my-tutor-android into develop
This commit is contained in:
commit
45dac22ec4
@ -29,7 +29,7 @@
|
||||
</value>
|
||||
</option>
|
||||
</component>
|
||||
<component name="ProjectRootManager" version="2" languageLevel="JDK_1_8" project-jdk-name="1.8" project-jdk-type="JavaSDK">
|
||||
<component name="ProjectRootManager" version="2" languageLevel="JDK_1_8" project-jdk-name="1.8 (1)" project-jdk-type="JavaSDK">
|
||||
<output url="file://$PROJECT_DIR$/build/classes" />
|
||||
</component>
|
||||
<component name="ProjectType">
|
||||
|
@ -28,8 +28,14 @@ repositories {
|
||||
url 'http://dl.bintray.com/amulyakhare/maven'
|
||||
}
|
||||
}
|
||||
def acraVersion = '5.2.1'
|
||||
|
||||
dependencies {
|
||||
implementation "ch.acra:acra-http:$acraVersion"
|
||||
implementation "ch.acra:acra-toast:$acraVersion"
|
||||
implementation "ch.acra:acra-notification:$acraVersion"
|
||||
|
||||
|
||||
implementation fileTree(include: ['*.jar'], dir: 'libs')
|
||||
implementation 'com.android.support:preference-v7:27.1.1'
|
||||
implementation 'com.android.support:appcompat-v7:27.1.1'
|
||||
|
@ -17,6 +17,7 @@
|
||||
<uses-feature android:name="android.hardware.location.gps" />
|
||||
|
||||
<application
|
||||
android:name=".FindMyTutor"
|
||||
android:allowBackup="true"
|
||||
android:icon="@mipmap/ic_launcher"
|
||||
android:label="@string/app_name"
|
||||
@ -53,7 +54,7 @@
|
||||
|
||||
<activity
|
||||
android:name=".activity.TutorTab"
|
||||
android:theme="@style/AppTheme"></activity>
|
||||
android:theme="@style/AppTheme"/>
|
||||
</application>
|
||||
|
||||
</manifest>
|
75
app/src/main/java/com/uam/wmi/findmytutor/FindMyTutor.java
Normal file
75
app/src/main/java/com/uam/wmi/findmytutor/FindMyTutor.java
Normal file
@ -0,0 +1,75 @@
|
||||
package com.uam.wmi.findmytutor;
|
||||
|
||||
import android.app.Application;
|
||||
import android.content.Context;
|
||||
import android.content.SharedPreferences;
|
||||
import android.content.res.Configuration;
|
||||
|
||||
import static org.acra.ReportField.*;
|
||||
import org.acra.ACRA;
|
||||
import org.acra.annotation.AcraNotification;
|
||||
import org.acra.config.CoreConfigurationBuilder;
|
||||
import org.acra.config.HttpSenderConfigurationBuilder;
|
||||
import org.acra.config.ToastConfigurationBuilder;
|
||||
import org.acra.data.StringFormat;
|
||||
import org.acra.sender.HttpSender;
|
||||
import java.util.HashMap;
|
||||
import java.util.Map;
|
||||
|
||||
|
||||
@AcraNotification(resText = R.string.notification_text,
|
||||
resTitle = R.string.notification_title,
|
||||
resChannelName = R.string.notification_channel)
|
||||
public class FindMyTutor extends Application {
|
||||
@Override
|
||||
protected void attachBaseContext(Context base) {
|
||||
super.attachBaseContext(base);
|
||||
|
||||
// ACRA core
|
||||
CoreConfigurationBuilder builder = new CoreConfigurationBuilder(this)
|
||||
.setBuildConfigClass(BuildConfig.class)
|
||||
.setReportContent(REPORT_ID, PHONE_MODEL, LOGCAT, USER_APP_START_DATE, USER_CRASH_DATE, SHARED_PREFERENCES,
|
||||
ANDROID_VERSION, STACK_TRACE, CUSTOM_DATA, BUILD_CONFIG)
|
||||
.setReportFormat(StringFormat.JSON);
|
||||
|
||||
// Toast for user
|
||||
builder.setBuildConfigClass(BuildConfig.class)
|
||||
.setReportFormat(StringFormat.JSON);
|
||||
builder.getPluginConfigurationBuilder(
|
||||
ToastConfigurationBuilder.class
|
||||
).setResText(R.string.acra_toast_text);
|
||||
|
||||
SharedPreferences sharedPreferences = base.getSharedPreferences("com.uam.wmi.findmytutor_preferences", Context.MODE_PRIVATE);
|
||||
Map header = new HashMap();
|
||||
String token = sharedPreferences.getString("API_KEY", "KEY_EMPTY");
|
||||
header.put("Authorization","Bearer " + token);
|
||||
|
||||
// Api POST
|
||||
builder.getPluginConfigurationBuilder(
|
||||
HttpSenderConfigurationBuilder.class
|
||||
// ).setUri("http://192.168.0.15:3000/api/acra")
|
||||
).setUri("https://s416084.projektstudencki.pl/develop/api/Feedback/autoFeedback")
|
||||
.setHttpMethod(HttpSender.Method.POST)
|
||||
.setHttpHeaders(header)
|
||||
.setEnabled(true);
|
||||
|
||||
ACRA.init(this, builder);
|
||||
//Shared preferences
|
||||
ACRA.getErrorReporter().putCustomData("USER_ID", sharedPreferences.getString("USER_ID", "no user id"));
|
||||
}
|
||||
|
||||
// Called by the system when the device configuration changes while your component is running.
|
||||
// Overriding this method is totally optional!
|
||||
@Override
|
||||
public void onConfigurationChanged(Configuration newConfig) {
|
||||
super.onConfigurationChanged(newConfig);
|
||||
}
|
||||
|
||||
// This is called when the overall system is running low on memory,
|
||||
// and would like actively running processes to tighten their belts.
|
||||
// Overriding this method is totally optional!
|
||||
@Override
|
||||
public void onLowMemory() {
|
||||
super.onLowMemory();
|
||||
}
|
||||
}
|
@ -149,8 +149,11 @@ public class LoginActivity extends AppCompatActivity {
|
||||
|
||||
private void loginProcess(String email, String password) {
|
||||
ValidateUser user = new ValidateUser(email, password);
|
||||
LdapUser fuser = new LdapUser(email, password, "wmi", "tutor", "henryk", "zdzblo", email);
|
||||
|
||||
// disposable.add(ldapService.validate(user)
|
||||
disposable.add(ldapService.fakeValidate(fuser)
|
||||
|
||||
disposable.add(ldapService.validate(user)
|
||||
.subscribeOn(Schedulers.io())
|
||||
.observeOn(AndroidSchedulers.mainThread())
|
||||
.subscribe(this::handleResponse, this::handleError));
|
||||
|
@ -80,8 +80,6 @@ public class MapActivity extends BaseActivity
|
||||
private int mInterval = 10000;
|
||||
private Handler mHandler = new Handler();
|
||||
private Runnable mStatusChecker;
|
||||
private Handler manualLocHandler = new Handler();
|
||||
private Runnable manualLocStatusChecker;
|
||||
private MapView mapView;
|
||||
private MapboxMap mapboxMap;
|
||||
private Button selectLocationButton;
|
||||
@ -623,8 +621,6 @@ public class MapActivity extends BaseActivity
|
||||
super.onDestroy();
|
||||
mapView.onDestroy();
|
||||
mHandler.removeCallbacks(mStatusChecker);
|
||||
// TODO remove after BG sending
|
||||
manualLocHandler.removeCallbacks(manualLocStatusChecker);
|
||||
disposable.dispose();
|
||||
}
|
||||
|
||||
|
@ -23,26 +23,27 @@ import retrofit2.converter.gson.GsonConverterFactory;
|
||||
|
||||
|
||||
public class ApiClient {
|
||||
private static Retrofit retrofit = null;
|
||||
private static int REQUEST_TIMEOUT = 60;
|
||||
private static OkHttpClient okHttpClient;
|
||||
private static final String BASE_URL = "https://s416084.projektstudencki.pl/master/";
|
||||
private static Retrofit retrofit = null;
|
||||
private static int REQUEST_TIMEOUT = 60;
|
||||
private static OkHttpClient okHttpClient;
|
||||
private static final String BASE_URL = "https://s416084.projektstudencki.pl/develop/";
|
||||
|
||||
public static Retrofit getClient(Context context) {
|
||||
public static Retrofit getClient(Context context) {
|
||||
|
||||
if (okHttpClient == null)
|
||||
initOkHttp(context);
|
||||
if (okHttpClient == null)
|
||||
initOkHttp(context);
|
||||
|
||||
if (retrofit == null) {
|
||||
retrofit = new Retrofit.Builder()
|
||||
.baseUrl(BASE_URL)
|
||||
.client(okHttpClient)
|
||||
.addConverterFactory(GsonConverterFactory.create())
|
||||
.addCallAdapterFactory(RxJava2CallAdapterFactory.create())
|
||||
.build();
|
||||
if (retrofit == null) {
|
||||
retrofit = new Retrofit.Builder()
|
||||
.baseUrl(BASE_URL)
|
||||
.client(okHttpClient)
|
||||
.addConverterFactory(GsonConverterFactory.create())
|
||||
.addCallAdapterFactory(RxJava2CallAdapterFactory.create())
|
||||
.build();
|
||||
}
|
||||
|
||||
return retrofit;
|
||||
}
|
||||
return retrofit;
|
||||
}
|
||||
|
||||
private static void initOkHttp(final Context context) {
|
||||
|
||||
|
@ -159,9 +159,14 @@
|
||||
<string name="network_error">Błąd sieci!</string>
|
||||
<string name="manual_status_error">Błąd podczas pobierania danych.</string>
|
||||
<string name="error_status_fetch">Błąd podczas pobierania statusów.</string>
|
||||
<string name="notification_text">Upss. Coś poszło nie tak. Pracujemy nad tym!</string>
|
||||
<string name="lack_duty_hours">Brak informacji o dyzurze.</string>
|
||||
<string name="lack_note">Brak notatki.</string>
|
||||
<string name="search">Wyszukiwarka</string>
|
||||
<string name="description_notdisturb">Nie przeszkadzać</string>
|
||||
<string name="description_awaiting">Czekam na studentów</string>
|
||||
<string name="description_onholidays">Na wakacjach</string>
|
||||
<string name="title_description">Status</string>
|
||||
</resources>
|
||||
|
||||
|
||||
|
@ -73,11 +73,16 @@
|
||||
<string name="key_location_level">key_location_level</string>
|
||||
|
||||
<string name="status_list_title">Choose status</string>
|
||||
<string name="key_status_value">key_status_value</string>
|
||||
<string name="key_status_value" translatable="false">key_status_value</string>
|
||||
<string name="status_switch_title">Status</string>
|
||||
<string name="description_busy">Busy</string>
|
||||
<string name="description_available">Available</string>
|
||||
<string name="description_consultation">Consultation</string>
|
||||
<string name="description_notdisturb">Do not disturb</string>
|
||||
<string name="description_awaiting">Waiting for students</string>
|
||||
<string name="description_onholidays">On holidays</string>
|
||||
|
||||
<string name="title_description">Status</string>
|
||||
<string name="title_manual_status">Add custom status</string>
|
||||
|
||||
|
||||
@ -228,7 +233,13 @@
|
||||
<string name="network_error">Network Error!</string>
|
||||
<string name="manual_status_error">Error handling status fetch</string>
|
||||
<string name="error_status_fetch">Error handling status fetch</string>
|
||||
|
||||
<string name="acra_toast_text" translatable="false">Sorry, the application crashed. A report will be sent to the developers</string>
|
||||
<string name="notification_text">Sorry, the application crashed. A report will be sent to the developers</string>
|
||||
<string name="notification_title" translatable="false">FMT Crash</string>
|
||||
<string name="notification_channel" translatable="false">FMT</string>
|
||||
<string name="lack_duty_hours">Lack information about duty hours</string>
|
||||
<string name="lack_note">No note.</string>
|
||||
<string name="search">Search</string>
|
||||
<string name="mockup_location_string" translatable="false">mock location string</string>
|
||||
</resources>
|
||||
|
Loading…
Reference in New Issue
Block a user