Skip to content

Commit

Permalink
fix #53
Browse files Browse the repository at this point in the history
  • Loading branch information
ramack committed Dec 16, 2018
1 parent 1654368 commit 77c5033
Show file tree
Hide file tree
Showing 4 changed files with 50 additions and 14 deletions.
1 change: 1 addition & 0 deletions .gitignore
Expand Up @@ -11,6 +11,7 @@ build/
# Local configuration file (sdk path, etc)
local.properties
PiwigoSigning.properties
piwigo_android_publish_keystore.jks
piwigo_android_keystore.jks

# Android Studio
Expand Down
18 changes: 10 additions & 8 deletions app/build.gradle
Expand Up @@ -89,14 +89,13 @@ android {

}

ext {
supportVersion = '28.0.0'
lifecycleVersion = '1.1.1'
daggerVersion = '2.19'
okhttpVersion = '3.11.0'
retrofitVersion = '2.4.0'
assertjVersion = '1.2.0'
}
def supportVersion = '28.0.0'
def lifecycleVersion = '1.1.1'
def daggerVersion = '2.19'
def okhttpVersion = '3.11.0'
def retrofitVersion = '2.4.0'
def assertjVersion = '1.2.0'
def acraVersion = '5.1.3'

dependencies {
implementation fileTree(include: ['*.jar'], dir: 'libs')
Expand Down Expand Up @@ -125,6 +124,9 @@ dependencies {
annotationProcessor 'com.google.guava:guava:24.1-jre'
implementation 'org.apache.commons:commons-lang3:3.8.1'

implementation "ch.acra:acra-mail:$acraVersion"
implementation "ch.acra:acra-dialog:$acraVersion"

/* Don't forget to add to string libraries if you add a library here. */

testImplementation 'junit:junit:4.12'
Expand Down
40 changes: 34 additions & 6 deletions app/src/main/java/org/piwigo/PiwigoApplication.java
@@ -1,6 +1,7 @@
/*
* Piwigo for Android
* Copyright (C) 2016-2017 Piwigo Team http://piwigo.org
* Copyright (C) 2018 Raphael Mack http://www.raphael-mack.de
*
* This program is free software: you can redistribute it and/or modify
* it under the terms of the GNU General Public License as published by
Expand All @@ -21,9 +22,15 @@
import android.app.Activity;
import android.app.Application;
import android.app.Service;
import android.content.Context;
import android.databinding.DataBindingUtil;

import org.piwigo.accounts.PiwigoAccountAuthenticator;
import org.acra.ACRA;
import org.acra.ReportField;
import org.acra.annotation.AcraCore;
import org.acra.annotation.AcraDialog;
import org.acra.annotation.AcraMailSender;
import org.acra.data.StringFormat;
import org.piwigo.internal.di.component.ApplicationComponent;
import org.piwigo.internal.di.component.BindingComponent;
import org.piwigo.internal.di.component.DaggerApplicationComponent;
Expand All @@ -37,6 +44,25 @@
import dagger.android.HasActivityInjector;
import dagger.android.HasServiceInjector;

@AcraCore(reportContent = { ReportField.APP_VERSION_CODE,
ReportField.APP_VERSION_NAME,
ReportField.USER_COMMENT,
ReportField.SHARED_PREFERENCES,
ReportField.ANDROID_VERSION,
ReportField.CUSTOM_DATA,
ReportField.STACK_TRACE,
ReportField.BUILD,
ReportField.BUILD_CONFIG,
ReportField.CRASH_CONFIGURATION,
ReportField.DISPLAY
},
buildConfigClass = BuildConfig.class,
alsoReportToAndroidFramework = true,
reportFormat = StringFormat.KEY_VALUE_LIST
)
@AcraMailSender(mailTo = "android@piwigo.org")
@AcraDialog(resCommentPrompt = R.string.crash_dialog_comment_prompt,
resText = R.string.crash_dialog_text)
public class PiwigoApplication extends Application implements HasActivityInjector, HasServiceInjector {

@Inject DispatchingAndroidInjector<Activity> dispatchingAndroidInjector;
Expand All @@ -50,6 +76,13 @@ public class PiwigoApplication extends Application implements HasActivityInjecto
initializeDependancyInjection();
}

@Override
protected void attachBaseContext(Context base) {
super.attachBaseContext(base);

ACRA.init(this);
}

@Override public AndroidInjector<Activity> activityInjector() {
return dispatchingAndroidInjector;
}
Expand All @@ -73,9 +106,4 @@ private void initializeDependancyInjection() {
public AndroidInjector<Service> serviceInjector() {
return dispatchingAndroidServiceInjector;
}
/*
public void inject(PiwigoAccountAuthenticator piwigoAccountAuthenticator) {
applicationComponent.inject(piwigoAccountAuthenticator);
}
*/
}
5 changes: 5 additions & 0 deletions app/src/main/res/values/strings.xml
Expand Up @@ -85,6 +85,7 @@
]]>
</string>
<string name="libraries" translatable="false"><![CDATA[
<p><a href="https://github.com/ACRA/acra">ACRA</a>, license <a href="http://www.apache.org/licenses/LICENSE-2.0">APACHE-2.0</a></p>
<p><a href="http://square.github.io/picasso/">Picasso</a>, license <a href="http://www.apache.org/licenses/LICENSE-2.0">APACHE-2.0</a></p>
<p><a href="http://square.github.io/okhttp3/">Okhttp3</a>, license <a href="http://www.apache.org/licenses/LICENSE-2.0">APACHE-2.0</a></p>
<p><a href="http://square.github.io/retrofit2/">Retrofit2</a>, license <a href="http://www.apache.org/licenses/LICENSE-2.0">APACHE-2.0</a></p>
Expand Down Expand Up @@ -144,4 +145,8 @@
<string name="uploading_toast">Uploading Image</string>
<string name="uploading_not_to_cat_null">Uploading is only possible in an album.</string>
<string name="storage_permission_explaination">Uploading photos is only possible if you give access to the storage.</string>

<!-- ACRA crash reporting -->
<string name="crash_dialog_text">An unexpected error occurred forcing the application to stop. Please help us fix this by sending us error data, all you have to do is click OK and send the email that we prepared.</string>
<string name="crash_dialog_comment_prompt">You might add your comments about the problem below:</string>
</resources>

0 comments on commit 77c5033

Please sign in to comment.