Skip to content
This repository has been archived by the owner on Jul 5, 2022. It is now read-only.

Commit

Permalink
Merge from upstream and apply legacy patches
Browse files Browse the repository at this point in the history
  • Loading branch information
friendlyanon committed Jun 6, 2020
1 parent ad711a7 commit 273390e
Show file tree
Hide file tree
Showing 21 changed files with 62 additions and 35 deletions.
6 changes: 3 additions & 3 deletions app/build.gradle
Original file line number Diff line number Diff line change
Expand Up @@ -9,9 +9,9 @@ android {
buildToolsVersion '29.0.3'

defaultConfig {
applicationId "org.schabi.newpipe"
resValue "string", "app_name", "NewPipe"
minSdkVersion 19
applicationId 'org.schabi.newpipelegacy'
resValue "string", "app_name", "NewPipe Legacy"
minSdkVersion 16
targetSdkVersion 29
versionCode 80
versionName "0.19.5"
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -48,6 +48,7 @@ public class CheckForNewAppVersionTask extends AsyncTask<Void, Void, String> {
private static final String GITHUB_APK_SHA1
= "C7:A4:55:67:6C:34:97:42:10:CE:3B:02:8F:D4:11:E5:10:FB:01:17";
private static final String NEWPIPE_API_URL = "https://newpipe.schabi.org/api/data.json";
private static final String FLAVOR = "github_legacy";

/**
* Method to get the apk's SHA1 key. See https://stackoverflow.com/questions/9293019/#22506133.
Expand Down Expand Up @@ -159,7 +160,7 @@ protected void onPostExecute(final String response) {

try {
final JsonObject githubStableObject = JsonParser.object().from(response)
.getObject("flavors").getObject("github").getObject("stable");
.getObject("flavors").getObject(FLAVOR).getObject("stable");

final String versionName = githubStableObject.getString("version");
final int versionCode = githubStableObject.getInt("version_code");
Expand Down
3 changes: 2 additions & 1 deletion app/src/main/java/org/schabi/newpipelegacy/MainActivity.java
Original file line number Diff line number Diff line change
Expand Up @@ -117,7 +117,8 @@ protected void onCreate(final Bundle savedInstanceState) {
+ "savedInstanceState = [" + savedInstanceState + "]");
}

// enable TLS1.1/1.2 for jelly bean and kitkat devices, to fix download and play for mediaCCC sources
// enable TLS1.1/1.2 for jelly bean and kitkat devices, to fix download and play for
// mediaCCC sources
if (Build.VERSION.SDK_INT <= Build.VERSION_CODES.KITKAT) {
TLSSocketFactoryCompat.setAsDefault();
}
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -23,8 +23,8 @@
import org.schabi.newpipelegacy.R;
import org.schabi.newpipelegacy.util.ThemeHelper;

import static org.schabi.newpipe.util.Localization.assureCorrectAppLanguage;
import static org.schabi.newpipe.util.ShareUtils.openUrlInBrowser;
import static org.schabi.newpipelegacy.util.Localization.assureCorrectAppLanguage;
import static org.schabi.newpipelegacy.util.ShareUtils.openUrlInBrowser;

public class AboutActivity extends AppCompatActivity {
/**
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -2,10 +2,10 @@ package org.schabi.newpipelegacy.database.playlist

import androidx.room.ColumnInfo
import androidx.room.Embedded
import org.schabi.newpipe.extractor.stream.StreamInfoItem
import org.schabi.newpipelegacy.database.LocalItem
import org.schabi.newpipelegacy.database.playlist.model.PlaylistStreamEntity
import org.schabi.newpipelegacy.database.stream.model.StreamEntity
import org.schabi.newpipe.extractor.stream.StreamInfoItem

class PlaylistStreamEntry(
@Embedded
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -3,10 +3,10 @@ package org.schabi.newpipelegacy.database.stream
import androidx.room.ColumnInfo
import androidx.room.Embedded
import java.util.Date
import org.schabi.newpipe.extractor.stream.StreamInfoItem
import org.schabi.newpipelegacy.database.LocalItem
import org.schabi.newpipelegacy.database.history.model.StreamHistoryEntity
import org.schabi.newpipelegacy.database.stream.model.StreamEntity
import org.schabi.newpipe.extractor.stream.StreamInfoItem

class StreamStatisticsEntry(
@Embedded
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -8,12 +8,12 @@ import androidx.room.Query
import androidx.room.Transaction
import io.reactivex.Flowable
import java.util.Date
import org.schabi.newpipelegacy.database.BasicDAO
import org.schabi.newpipelegacy.database.stream.model.StreamEntity
import org.schabi.newpipelegacy.database.stream.model.StreamEntity.Companion.STREAM_ID
import org.schabi.newpipe.extractor.stream.StreamType
import org.schabi.newpipe.extractor.stream.StreamType.AUDIO_LIVE_STREAM
import org.schabi.newpipe.extractor.stream.StreamType.LIVE_STREAM
import org.schabi.newpipelegacy.database.BasicDAO
import org.schabi.newpipelegacy.database.stream.model.StreamEntity
import org.schabi.newpipelegacy.database.stream.model.StreamEntity.Companion.STREAM_ID

@Dao
abstract class StreamDAO : BasicDAO<StreamEntity> {
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -8,13 +8,13 @@ import androidx.room.PrimaryKey
import java.io.Serializable
import java.util.Calendar
import java.util.Date
import org.schabi.newpipelegacy.database.stream.model.StreamEntity.Companion.STREAM_SERVICE_ID
import org.schabi.newpipelegacy.database.stream.model.StreamEntity.Companion.STREAM_TABLE
import org.schabi.newpipelegacy.database.stream.model.StreamEntity.Companion.STREAM_URL
import org.schabi.newpipe.extractor.localization.DateWrapper
import org.schabi.newpipe.extractor.stream.StreamInfo
import org.schabi.newpipe.extractor.stream.StreamInfoItem
import org.schabi.newpipe.extractor.stream.StreamType
import org.schabi.newpipelegacy.database.stream.model.StreamEntity.Companion.STREAM_SERVICE_ID
import org.schabi.newpipelegacy.database.stream.model.StreamEntity.Companion.STREAM_TABLE
import org.schabi.newpipelegacy.database.stream.model.StreamEntity.Companion.STREAM_URL
import org.schabi.newpipelegacy.player.playqueue.PlayQueueItem

@Entity(tableName = STREAM_TABLE,
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -106,7 +106,8 @@ protected void doInitialLoadLogic() {

/**
* Implement the logic to load the info from the network.<br/>
* You can use the default implementations from {@link org.schabi.newpipelegacy.util.ExtractorHelper}.
* You can use the default implementations from
* {@link org.schabi.newpipelegacy.util.ExtractorHelper}.
*
* @param forceLoad allow or disallow the result to come from the cache
* @return Rx {@link Single} containing the {@link ListInfo}
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -9,14 +9,14 @@ import io.reactivex.android.schedulers.AndroidSchedulers
import io.reactivex.schedulers.Schedulers
import java.util.Calendar
import java.util.Date
import org.schabi.newpipe.extractor.stream.StreamInfoItem
import org.schabi.newpipe.extractor.stream.StreamType
import org.schabi.newpipelegacy.MainActivity.DEBUG
import org.schabi.newpipelegacy.NewPipeDatabase
import org.schabi.newpipelegacy.database.feed.model.FeedEntity
import org.schabi.newpipelegacy.database.feed.model.FeedGroupEntity
import org.schabi.newpipelegacy.database.feed.model.FeedLastUpdatedEntity
import org.schabi.newpipelegacy.database.stream.model.StreamEntity
import org.schabi.newpipe.extractor.stream.StreamInfoItem
import org.schabi.newpipe.extractor.stream.StreamType
import org.schabi.newpipelegacy.local.subscription.FeedGroupIcon

class FeedDatabaseManager(context: Context) {
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -12,8 +12,8 @@ import io.reactivex.schedulers.Schedulers
import java.util.Calendar
import java.util.Date
import java.util.concurrent.TimeUnit
import org.schabi.newpipelegacy.database.feed.model.FeedGroupEntity
import org.schabi.newpipe.extractor.stream.StreamInfoItem
import org.schabi.newpipelegacy.database.feed.model.FeedGroupEntity
import org.schabi.newpipelegacy.local.feed.service.FeedEventManager
import org.schabi.newpipelegacy.local.feed.service.FeedEventManager.Event.ErrorResultEvent
import org.schabi.newpipelegacy.local.feed.service.FeedEventManager.Event.IdleEvent
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -47,12 +47,12 @@ import java.util.concurrent.atomic.AtomicBoolean
import java.util.concurrent.atomic.AtomicInteger
import org.reactivestreams.Subscriber
import org.reactivestreams.Subscription
import org.schabi.newpipelegacy.MainActivity.DEBUG
import org.schabi.newpipelegacy.R
import org.schabi.newpipelegacy.database.feed.model.FeedGroupEntity
import org.schabi.newpipe.extractor.ListInfo
import org.schabi.newpipe.extractor.exceptions.ReCaptchaException
import org.schabi.newpipe.extractor.stream.StreamInfoItem
import org.schabi.newpipelegacy.MainActivity.DEBUG
import org.schabi.newpipelegacy.R
import org.schabi.newpipelegacy.database.feed.model.FeedGroupEntity
import org.schabi.newpipelegacy.local.feed.FeedDatabaseManager
import org.schabi.newpipelegacy.local.feed.service.FeedEventManager.Event.ErrorResultEvent
import org.schabi.newpipelegacy.local.feed.service.FeedEventManager.Event.IdleEvent
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -38,9 +38,9 @@ import kotlin.math.max
import kotlinx.android.synthetic.main.dialog_title.view.itemAdditionalDetails
import kotlinx.android.synthetic.main.dialog_title.view.itemTitleView
import kotlinx.android.synthetic.main.fragment_subscription.items_list
import org.schabi.newpipe.extractor.channel.ChannelInfoItem
import org.schabi.newpipelegacy.R
import org.schabi.newpipelegacy.database.feed.model.FeedGroupEntity
import org.schabi.newpipe.extractor.channel.ChannelInfoItem
import org.schabi.newpipelegacy.fragments.BaseStateFragment
import org.schabi.newpipelegacy.local.subscription.SubscriptionViewModel.SubscriptionState
import org.schabi.newpipelegacy.local.subscription.dialog.FeedGroupDialog
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -4,13 +4,13 @@ import android.content.Context
import io.reactivex.Completable
import io.reactivex.android.schedulers.AndroidSchedulers
import io.reactivex.schedulers.Schedulers
import org.schabi.newpipelegacy.NewPipeDatabase
import org.schabi.newpipelegacy.database.subscription.SubscriptionDAO
import org.schabi.newpipelegacy.database.subscription.SubscriptionEntity
import org.schabi.newpipe.extractor.ListInfo
import org.schabi.newpipe.extractor.channel.ChannelInfo
import org.schabi.newpipe.extractor.feed.FeedInfo
import org.schabi.newpipe.extractor.stream.StreamInfoItem
import org.schabi.newpipelegacy.NewPipeDatabase
import org.schabi.newpipelegacy.database.subscription.SubscriptionDAO
import org.schabi.newpipelegacy.database.subscription.SubscriptionEntity
import org.schabi.newpipelegacy.local.feed.FeedDatabaseManager

class SubscriptionManager(context: Context) {
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -8,8 +8,8 @@ import kotlinx.android.synthetic.main.list_channel_item.itemAdditionalDetails
import kotlinx.android.synthetic.main.list_channel_item.itemChannelDescriptionView
import kotlinx.android.synthetic.main.list_channel_item.itemThumbnailView
import kotlinx.android.synthetic.main.list_channel_item.itemTitleView
import org.schabi.newpipelegacy.R
import org.schabi.newpipe.extractor.channel.ChannelInfoItem
import org.schabi.newpipelegacy.R
import org.schabi.newpipelegacy.util.ImageDisplayConstants
import org.schabi.newpipelegacy.util.Localization
import org.schabi.newpipelegacy.util.OnClickGesture
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -14,9 +14,9 @@ import kotlinx.android.synthetic.main.feed_import_export_group.import_export
import kotlinx.android.synthetic.main.feed_import_export_group.import_export_expand_icon
import kotlinx.android.synthetic.main.feed_import_export_group.import_export_options
import kotlinx.android.synthetic.main.feed_import_export_group.import_from_options
import org.schabi.newpipelegacy.R
import org.schabi.newpipe.extractor.NewPipe
import org.schabi.newpipe.extractor.exceptions.ExtractionException
import org.schabi.newpipelegacy.R
import org.schabi.newpipelegacy.util.AnimationUtils
import org.schabi.newpipelegacy.util.ServiceHelper
import org.schabi.newpipelegacy.util.ThemeHelper
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -26,7 +26,6 @@
import java.io.UnsupportedEncodingException;
import java.net.URI;
import java.net.URLDecoder;
import java.nio.charset.StandardCharsets;

import us.shandian.giga.io.StoredDirectoryHelper;

Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -11,8 +11,6 @@

import java.io.ByteArrayInputStream;
import java.io.IOException;
import java.nio.charset.Charset;
import java.nio.charset.StandardCharsets;

/**
* @author kapodamy
Expand Down Expand Up @@ -49,6 +47,7 @@ private void writeFrame(final String begin, final String end, final StringBuilde
writeString(NEW_LINE);
}

@SuppressWarnings("CharsetObjectCanBeUsed")
private void writeString(final String text) throws IOException {
out.write(text.getBytes("utf-8"));
}
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -5,7 +5,6 @@
import java.io.EOFException;
import java.io.IOException;
import java.io.InputStream;
import java.nio.charset.StandardCharsets;
import java.util.ArrayList;
import java.util.NoSuchElementException;

Expand Down Expand Up @@ -122,8 +121,9 @@ private long readNumber(final Element parent) throws IOException {
return value;
}

@SuppressWarnings("CharsetObjectCanBeUsed")
private String readString(final Element parent) throws IOException {
return new String(readBlob(parent), "utf-8");// or use "utf-8"
return new String(readBlob(parent), "utf-8");
}

private byte[] readBlob(final Element parent) throws IOException {
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -13,7 +13,6 @@
import java.io.InputStream;
import java.io.UnsupportedEncodingException;
import java.nio.ByteBuffer;
import java.nio.charset.StandardCharsets;
import java.util.ArrayList;

/**
Expand Down Expand Up @@ -671,6 +670,7 @@ private byte[] encode(final long number, final boolean withLength) {
return buffer;
}

@SuppressWarnings("CharsetObjectCanBeUsed")
private ArrayList<byte[]> encode(final String value) {
byte[] str = null;
try {
Expand All @@ -680,6 +680,7 @@ private ArrayList<byte[]> encode(final String value) {
}

ArrayList<byte[]> buffer = new ArrayList<>(2);
// noinspection ConstantConditions
buffer.add(encode(str.length, false));
buffer.add(str);

Expand Down
27 changes: 26 additions & 1 deletion checkstyle-suppressions.xml
Original file line number Diff line number Diff line change
Expand Up @@ -15,7 +15,7 @@
files="ListHelper.java"
lines="278,310"/>

<!-- org.schabi.newpipe.streams -->
<!-- org.schabi.newpipelegacy.streams -->
<suppress checks="FinalParameters"
files="DataReader.java"
lines="46,93"/>
Expand All @@ -24,14 +24,39 @@
files="Mp4FromDashWriter.java"
lines="643"/>

<suppress checks="MethodLength"
files="Mp4FromDashWriter.java"
lines="145"/>

<suppress checks="FinalParameters"
files="OggFromWebMWriter.java"
lines="380,422"/>

<suppress checks="FinalParameters"
files="WebMWriter.java"
lines="419,591"/>

<suppress checks="LineLength"
files="WebMWriter.java"
lines="156,158"/>

<suppress checks="MethodLength"
files="WebMWriter.java"
lines="124"/>

<suppress checks="MethodLength"
files="VideoDetailFragment.java"
lines="1140"/>

<suppress checks="ParameterNumber"
files="PopupVideoPlayer.java"
lines="618"/>

<suppress checks="EqualsHashCode"
files="Tab.java"
lines="106,351,425"/>

<suppress checks="EqualsHashCode"
files="StreamStateEntity.java"
lines="69"/>
</suppressions>

0 comments on commit 273390e

Please sign in to comment.