Skip to content

Commit

Permalink
Use new Localization and Downloader implementations from extractor
Browse files Browse the repository at this point in the history
  • Loading branch information
mauriciocolli committed Oct 11, 2019
1 parent e64a780 commit 063bd33
Show file tree
Hide file tree
Showing 20 changed files with 294 additions and 373 deletions.
2 changes: 1 addition & 1 deletion app/build.gradle
Original file line number Diff line number Diff line change
Expand Up @@ -57,7 +57,7 @@ dependencies {
exclude module: 'support-annotations'
})

implementation 'com.github.teamnewpipe:NewPipeExtractor:06f2144e4daa10'
implementation 'com.github.teamnewpipe:NewPipeExtractor:6c5af3f774877'
testImplementation 'junit:junit:4.12'
testImplementation 'org.mockito:mockito-core:2.23.0'

Expand Down
2 changes: 2 additions & 0 deletions app/proguard-rules.pro
Original file line number Diff line number Diff line change
Expand Up @@ -17,6 +17,8 @@
#}

-dontobfuscate
-keep class org.schabi.newpipe.extractor.timeago.patterns.** { *; }

-keep class org.mozilla.javascript.** { *; }

-keep class org.mozilla.classfile.ClassFileWriter
Expand Down
4 changes: 2 additions & 2 deletions app/src/debug/java/org/schabi/newpipe/DebugApp.java
Original file line number Diff line number Diff line change
Expand Up @@ -15,7 +15,7 @@
import com.squareup.leakcanary.LeakDirectoryProvider;
import com.squareup.leakcanary.RefWatcher;

import org.schabi.newpipe.extractor.Downloader;
import org.schabi.newpipe.extractor.downloader.Downloader;

import java.io.File;
import java.util.concurrent.TimeUnit;
Expand All @@ -39,7 +39,7 @@ public void onCreate() {

@Override
protected Downloader getDownloader() {
return org.schabi.newpipe.Downloader.init(new OkHttpClient.Builder()
return DownloaderImpl.init(new OkHttpClient.Builder()
.addNetworkInterceptor(new StethoInterceptor()));
}

Expand Down
14 changes: 9 additions & 5 deletions app/src/main/java/org/schabi/newpipe/App.java
Original file line number Diff line number Diff line change
Expand Up @@ -21,13 +21,14 @@
import org.acra.config.ACRAConfigurationException;
import org.acra.config.ConfigurationBuilder;
import org.acra.sender.ReportSenderFactory;
import org.schabi.newpipe.extractor.Downloader;
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;
import org.schabi.newpipe.util.ExtractorHelper;
import org.schabi.newpipe.util.Localization;
import org.schabi.newpipe.util.StateSaver;

import java.io.IOException;
Expand All @@ -44,6 +45,7 @@
import io.reactivex.functions.Consumer;
import io.reactivex.plugins.RxJavaPlugins;


/*
* Copyright (C) Hans-Christoph Steiner 2016 <hans@eds.org>
* App.java is part of NewPipe.
Expand Down Expand Up @@ -95,7 +97,9 @@ public void onCreate() {
SettingsActivity.initSettings(this);

NewPipe.init(getDownloader(),
org.schabi.newpipe.util.Localization.getPreferredExtractorLocal(this));
Localization.getPreferredLocalization(this),
Localization.getPreferredContentCountry(this));

StateSaver.init(this);
initNotificationChannel();

Expand All @@ -109,7 +113,7 @@ public void onCreate() {
}

protected Downloader getDownloader() {
return org.schabi.newpipe.Downloader.init(null);
return DownloaderImpl.init(null);
}

private void configureRxJavaErrorHandler() {
Expand Down Expand Up @@ -195,12 +199,12 @@ private void initACRA() {
null,
null,
ErrorActivity.ErrorInfo.make(UserAction.SOMETHING_ELSE, "none",
"Could not initialize ACRA crash report", R.string.app_ui_crash));
"Could not initialize ACRA crash report", R.string.app_ui_crash));
}
}

public void initNotificationChannel() {
if (Build.VERSION.SDK_INT < android.os.Build.VERSION_CODES.O) {
if (Build.VERSION.SDK_INT < Build.VERSION_CODES.O) {
return;
}

Expand Down
280 changes: 0 additions & 280 deletions app/src/main/java/org/schabi/newpipe/Downloader.java

This file was deleted.

Loading

0 comments on commit 063bd33

Please sign in to comment.