Skip to content

Commit

Permalink
Remove deprecated calls to set Sender class to ACRA
Browse files Browse the repository at this point in the history
setReportSenderFactoryClasses() is deprecated, now extensions (ReportSenderFactory is an extension) should be registered using AutoService: https://github.com/ACRA/acra/wiki/Custom-Extensions#by-annotation
  • Loading branch information
Stypox committed Jul 28, 2020
1 parent 21d1f69 commit a955612
Show file tree
Hide file tree
Showing 3 changed files with 9 additions and 6 deletions.
2 changes: 2 additions & 0 deletions app/build.gradle
Original file line number Diff line number Diff line change
Expand Up @@ -201,6 +201,8 @@ dependencies {
implementation "com.nononsenseapps:filepicker:4.2.1"

implementation "ch.acra:acra-core:5.5.0"
compileOnly "com.google.auto.service:auto-service-annotations:1.0-rc7"
kapt "com.google.auto.service:auto-service:1.0-rc7"

implementation "io.reactivex.rxjava2:rxjava:2.2.19"
implementation "io.reactivex.rxjava2:rxandroid:2.1.1"
Expand Down
6 changes: 0 additions & 6 deletions app/src/main/java/org/schabi/newpipe/App.java
Original file line number Diff line number Diff line change
Expand Up @@ -20,10 +20,8 @@
import org.acra.config.ACRAConfigurationException;
import org.acra.config.CoreConfiguration;
import org.acra.config.CoreConfigurationBuilder;
import org.acra.sender.ReportSenderFactory;
import org.schabi.newpipe.extractor.NewPipe;
import org.schabi.newpipe.extractor.downloader.Downloader;
import org.schabi.newpipe.report.AcraReportSenderFactory;
import org.schabi.newpipe.report.ErrorActivity;
import org.schabi.newpipe.report.UserAction;
import org.schabi.newpipe.settings.SettingsActivity;
Expand Down Expand Up @@ -65,9 +63,6 @@

public class App extends Application {
protected static final String TAG = App.class.toString();
@SuppressWarnings("unchecked")
private static final Class<? extends ReportSenderFactory>[]
REPORT_SENDER_FACTORY_CLASSES = new Class[]{AcraReportSenderFactory.class};
private static App app;

public static App getApp() {
Expand Down Expand Up @@ -210,7 +205,6 @@ protected void initACRA() {

try {
final CoreConfiguration acraConfig = new CoreConfigurationBuilder(this)
.setReportSenderFactoryClasses(REPORT_SENDER_FACTORY_CLASSES)
.setBuildConfigClass(BuildConfig.class)
.build();
ACRA.init(this, acraConfig);
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -4,9 +4,12 @@

import androidx.annotation.NonNull;

import com.google.auto.service.AutoService;

import org.acra.config.CoreConfiguration;
import org.acra.sender.ReportSender;
import org.acra.sender.ReportSenderFactory;
import org.schabi.newpipe.App;

/*
* Created by Christian Schabesberger on 13.09.16.
Expand All @@ -28,6 +31,10 @@
* along with NewPipe. If not, see <http://www.gnu.org/licenses/>.
*/

/**
* Used by ACRA in {@link App}.initAcra() as the factory for report senders.
*/
@AutoService(ReportSenderFactory.class)
public class AcraReportSenderFactory implements ReportSenderFactory {
@NonNull
public ReportSender create(@NonNull final Context context,
Expand Down

0 comments on commit a955612

Please sign in to comment.