Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Release 0.21.14 #7475

Merged
merged 145 commits into from
Dec 11, 2021
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
Show all changes
145 commits
Select commit Hold shift + click to select a range
108af48
Enable Mark as Watched in all the other playlist fragments.
nschulzke Sep 24, 2021
a953aab
Update AndroidX Media to 1.4.x
TacoTheDank Sep 30, 2021
d844e0a
Add a add to playlist option in the share menu.
KalleStruik Oct 2, 2021
87c958b
Rename the "append_playlist" string to "add_to_playlist"
KalleStruik Oct 3, 2021
ceb55d0
Set the theme for PlaylistCreationDialog explicitly.
KalleStruik Oct 3, 2021
4fde62f
Reorder preferred open action menu
KalleStruik Oct 4, 2021
1c9f68b
Fix clicking timestamp shows Toast "Playing in popup mode"
Oct 5, 2021
64d7432
Deduplicated drawer code in MainActivity
litetex Oct 9, 2021
7316409
Cleaned up PlaylistDialog-related code
litetex Oct 9, 2021
d7d8769
Add to playlist - Showing toast that this may take a moment
litetex Oct 9, 2021
12aac09
Fixed typo
litetex Oct 9, 2021
9d7e928
Fix cursor color in PlaylistCreationDialog
KalleStruik Oct 10, 2021
658d988
Simplify code and add annotations
TobiGr Oct 10, 2021
a2ff770
Added the 'Show Channel Details' menu item to the Queue long press menu
ktprograms Oct 11, 2021
08489b8
Merge pull request #7220 from TeamNewPipe/code-improvements
TobiGr Oct 11, 2021
50634eb
Check player type before displaying background player toast
Oct 11, 2021
e9bd293
Merge pull request #7202 from vhouriet/vhouriet_bug_issue-6662
litetex Oct 11, 2021
048743c
Merge pull request #7148 from TacoTheDank/androidxMediaBump
litetex Oct 11, 2021
a2050a5
Merge pull request #7215 from litetex/code-cleanup-drawer-main-activity
litetex Oct 11, 2021
9f7a840
Merge pull request #7224 from vhouriet/vhouriet_fix_check-background-…
litetex Oct 12, 2021
d7b29aa
Merge branch 'master' into dev
TobiGr Oct 12, 2021
4af49ee
Merge pull request #7194 from KalleStruik/add-to-playlist-in-share
litetex Oct 13, 2021
afc8db8
Add reasoning for separate openChannelFragmentUsingIntent method
ktprograms Oct 14, 2021
2271ea4
Improved documentation
litetex Oct 15, 2021
03d2ca9
Fixed format of code
litetex Oct 15, 2021
7edef8d
Merge pull request #7222 from ktprograms/queue-menu-channel-details
litetex Oct 15, 2021
e7773d8
Update plugins
TacoTheDank Oct 15, 2021
a55acd3
Use a custom TextView everywhere to be able to share with ShareUtils …
AudricV Sep 4, 2021
411b312
Use a custom EditText everywhere to be able to share with ShareUtils …
AudricV Sep 4, 2021
c8802fe
Add JavaDocs on created views
AudricV Sep 14, 2021
3ded6fe
Improve code of created views
AudricV Sep 18, 2021
aab09c0
Merge the Share process of the two classes into one
AudricV Sep 24, 2021
50b85a7
Simplify code
AudricV Oct 1, 2021
a744775
Adress requested changes and remove an unused return value in NewPipe…
AudricV Oct 2, 2021
ddaafb6
Adress new requested changes
AudricV Oct 16, 2021
51837ce
Get rid of setUserVisibleHint
TacoTheDank Oct 16, 2021
b4950fc
Clean up .gitignore files
TacoTheDank Oct 16, 2021
231b749
Merge pull request #7265 from TacoTheDank/userVisibleHintBGone
litetex Oct 18, 2021
b6b19b4
Update RecyclerView & Groupie
TacoTheDank Oct 19, 2021
b6c2bad
Update AndroidX Media library
TacoTheDank Oct 19, 2021
ed86b1c
Update pager workaround to Fragment 1.3.6
TacoTheDank Oct 19, 2021
e0b1a6b
Merge pull request #7149 from TacoTheDank/updateFragWorkaround
litetex Oct 20, 2021
44cad27
Merge pull request #7268 from TeamNewPipe/release/0.21.13
TobiGr Oct 21, 2021
5522dc1
Merge branch 'master' into dev
TobiGr Oct 21, 2021
94dfabf
Merge pull request #7263 from TacoTheDank/moreBumps
litetex Oct 22, 2021
d2306b0
Fixed shuffle button opacity bug
0x416c6578 Aug 4, 2021
cf81c37
Removed changes to the intent handler
0x416c6578 Aug 4, 2021
d66f933
Fixing the shuffle button on the UI is enough.
litetex Oct 23, 2021
af936bc
Always create a backup list when shuffling
litetex Oct 23, 2021
6197214
Add support for y2u.be links
triallax Oct 23, 2021
f6efd30
Fix extractor dependency
triallax Oct 23, 2021
7067deb
Merge pull request #7261 from TacoTheDank/bumpRecyclerView
litetex Oct 24, 2021
25e120b
Changed extractor dependency back to TeamNewPipe
litetex Oct 26, 2021
0bcc9bd
Try to fix jitpack not resolving dependency
litetex Oct 26, 2021
85fb582
Add Check for updates button
Oct 22, 2021
5c9705d
Change check for updates button to trigger a version check
Oct 23, 2021
467bd21
Cleanup up some code
litetex Oct 26, 2021
8dc3427
Removed dead code
litetex Oct 26, 2021
e5fd24b
Make naming great again
litetex Oct 26, 2021
403154b
Less indents and code -> better readable
litetex Oct 26, 2021
e9e2afa
Merge pull request #7061 from TiA4f8R/custom-textview-edittext
litetex Oct 27, 2021
c0f7b12
Merge pull request #7296 from vhouriet/vhouriet_feature_issue6049
litetex Nov 1, 2021
c673cb6
Merge pull request #7304 from mhmdanas/add-y2ube-link-support
litetex Nov 1, 2021
acaf92d
Unrevert PR 6824
AudricV Nov 2, 2021
4ea962f
Merge pull request #7348 from TiA4f8R/unrevert-pr6824
litetex Nov 2, 2021
702adb5
Support PeerTube short links
B0pol Nov 3, 2021
ecac897
Fixed typo
litetex Nov 3, 2021
2e862b4
Merge pull request #6844 from 0x416c6578/shuffle-mode-ui-fix
litetex Nov 3, 2021
ad8f791
Changed extractor dependency back to TeamNewPipe
litetex Nov 4, 2021
b5ad24e
Merge pull request #7353 from B0pol/peertube-shortlinks
litetex Nov 4, 2021
cddb9bc
Reworked ``dialog_playback_parameter``
litetex Nov 4, 2021
f933db8
Added a custom title
litetex Nov 4, 2021
272be36
Removed ``e.printStacktrace`` and used an proper logger
litetex Nov 5, 2021
28f167f
Removed dead code
litetex Nov 5, 2021
2b2f1ee
Added some doc
litetex Nov 5, 2021
0764983
Why log double?
litetex Nov 5, 2021
478ad42
De-Duplicated some code
litetex Nov 5, 2021
b0a10f0
Merged extremely similar code together / parity between video and pop…
litetex Nov 5, 2021
a23f941
Simplified some code and added some comments
litetex Nov 5, 2021
203ca9a
Removed unused imports
litetex Nov 6, 2021
62efb58
Removed obvious title from the "Playback Speed Controls"
litetex Nov 7, 2021
63291f8
added show watched items toggle preference
iambaji Nov 8, 2021
c35fe4f
moved preference key from viewmodel to settings_keys.xml
iambaji Nov 10, 2021
adf9bad
Fixed toggle not in sync with list after app restart + refactored the…
litetex Nov 11, 2021
90cc8e2
A feed settings-key better fits there
litetex Nov 11, 2021
53303ac
Replaced deprecated ``with`` with ``using``
litetex Nov 11, 2021
d5f25e0
Merge pull request #7395 from litetex/gradle-replaced-with-with-using
litetex Nov 12, 2021
18ce86c
Merge pull request #7370 from iambaji/issue_7362
litetex Nov 12, 2021
eae1f8b
Update ExoPlayer to 2.14.2
Redirion Aug 28, 2021
1b9c2b3
Use Android11+ extractors
Oct 22, 2021
dd2cde3
De-duplicated PlayerDataSource-code
litetex Nov 12, 2021
48a1ab6
Refactored ``PlaybackResolver``
litetex Nov 12, 2021
dfba10f
Merge pull request #7005 from Redirion/exo14
Redirion Nov 12, 2021
605b8fa
Remove JCenter
TobiGr Oct 15, 2021
e39a816
Merge pull request #5843 from TeamNewPipe/jcenter
litetex Nov 12, 2021
344fbff
Merge pull request #7363 from litetex/playback-speed-ctrls-simple-lan…
Redirion Nov 12, 2021
dee32c3
Factor out shouldAddMarkAsWatched as a shared function
nschulzke Nov 13, 2021
9e44053
Merge pull request #7160 from nschulzke/mark-as-watched-everywhere
Stypox Nov 13, 2021
9c9730b
Use DefaultLoadcontrol
Nov 14, 2021
3e099fb
Fixed Period Transition
Nov 14, 2021
010c607
Prevent automatic replay after returning from background
litetex Nov 8, 2021
316db0e
setRecovery: Remove checks and use Math.min/max
litetex Nov 15, 2021
72dfe97
Merge pull request #7408 from Redirion/fixedautotransition2
Redirion Nov 15, 2021
8b807b0
Enhanced ``View.slideUp``
litetex Sep 3, 2021
676bc02
No more reaction to unnecessary feed db-changes
litetex Sep 3, 2021
0278912
Implemented UI highlighting and "new feed items"-notification
litetex Sep 3, 2021
d11129a
Fixed StackOverflow
litetex Sep 3, 2021
1b2b3a4
Make new feed items bold
litetex Sep 5, 2021
2310e8c
Made ``hideNewItemsLoaded`` more null safe
litetex Sep 5, 2021
38ce800
Fixed feed when animations are off
litetex Sep 8, 2021
4b4337e
Used more understandable kotlin methods
litetex Sep 10, 2021
700c1b4
Removed unnecessary layout
litetex Sep 10, 2021
4eb02f5
Fixed default visibility of "new feed items" button
litetex Sep 12, 2021
1e0c9f4
Improved highlighting in FeedFragment
litetex Sep 28, 2021
a641c5b
Update Groupie to 2.9.0
TacoTheDank Sep 22, 2021
7638d22
Fixed typo
litetex Nov 14, 2021
d5199ea
Merge pull request #7050 from litetex/feed-refactor-new-items-handling
Redirion Nov 15, 2021
bd9dcfb
Merge pull request #7381 from litetex/prevent-automatic-replay-after-…
XiangRongLin Nov 17, 2021
13cac07
Add gradle wrapper Sha256
Redirion Nov 18, 2021
1de21fb
Merge pull request #7418 from TeamNewPipe/add-gradle-wrapper-Sha256
opusforlife2 Nov 21, 2021
d8236bb
Merge pull request #7406 from Redirion/usedefaultloadcontrol
litetex Nov 21, 2021
02d1b98
Removed useless doc
litetex Nov 21, 2021
c8516a0
Formatted code
litetex Nov 21, 2021
c9488eb
Removed useless lines
litetex Nov 22, 2021
6cd25d7
Merge pull request #7412 from litetex/code-cleanup
Stypox Nov 23, 2021
e632fab
Added option to report player errors
litetex Sep 18, 2021
769791a
Added a "Crash the player" debug option
litetex Sep 21, 2021
e5c00a7
Added some doc
litetex Sep 21, 2021
c3f1478
Support for debug option "Crash the player" on TVs
litetex Sep 21, 2021
fb58967
PlayerErrorHandler refactor + docs
litetex Sep 21, 2021
f18ee8e
Added a bit more documentation
litetex Oct 1, 2021
aa28a85
Added a workaround for not serializable exceptions
litetex Oct 24, 2021
0d51eef
Refactoring
litetex Nov 23, 2021
6992b2c
Moved report_player_errors to debug
litetex Nov 23, 2021
2f99a21
Fixed build
litetex Nov 23, 2021
dc09a46
Fix Gradle checksum
triallax Nov 26, 2021
ef91214
Merge pull request #7442 from mhmdanas/fix-gradle-sha256
Redirion Nov 26, 2021
4c8dca5
Fixed NPE + Problems with context
litetex Nov 28, 2021
c7daf32
Merge pull request #7142 from litetex/better-player-error-handling
Stypox Nov 28, 2021
7dc85af
Use latest NewPipeExtractor to fix parsing of YT's dislikes (#7467)
litetex Nov 29, 2021
122b0b0
Translated using Weblate (Norwegian Bokmål)
weblate Nov 30, 2021
4825a0a
Update changelog (#7476)
litetex Dec 1, 2021
2c88e9d
Updated version to 0.21.14
litetex Nov 30, 2021
1ee137b
Updated to NewPipeExtractor to version ``v0.21.12``
litetex Dec 11, 2021
6b02655
Translated using Weblate (French)
weblate Dec 11, 2021
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
The table of contents is too big for display.
Diff view
Diff view
  •  
  •  
  •  
16 changes: 8 additions & 8 deletions .gitignore
Original file line number Diff line number Diff line change
@@ -1,15 +1,15 @@
.gitignore
.gradle
/local.properties
.gradle/
local.properties
.DS_Store
/build
/captures
/app/app.iml
/.idea
/*.iml
build/
captures/
.idea/
*.iml
*~
.weblate
*.class
**/debug/
**/release/

# vscode / eclipse files
*.classpath
Expand Down
3 changes: 0 additions & 3 deletions app/.gitignore

This file was deleted.

17 changes: 10 additions & 7 deletions app/build.gradle
Original file line number Diff line number Diff line change
Expand Up @@ -17,8 +17,8 @@ android {
resValue "string", "app_name", "NewPipe"
minSdkVersion 19
targetSdkVersion 29
versionCode 979
versionName "0.21.13"
versionCode 980
versionName "0.21.14"

multiDexEnabled true

Expand Down Expand Up @@ -105,9 +105,9 @@ ext {
androidxRoomVersion = '2.3.0'

icepickVersion = '3.2.0'
exoPlayerVersion = '2.12.3'
exoPlayerVersion = '2.14.2'
googleAutoServiceVersion = '1.0'
groupieVersion = '2.9.0'
groupieVersion = '2.10.0'
markwonVersion = '4.6.2'

leakCanaryVersion = '2.5'
Expand Down Expand Up @@ -189,7 +189,7 @@ dependencies {
// name and the commit hash with the commit hash of the (pushed) commit you want to test
// This works thanks to JitPack: https://jitpack.io/
implementation 'com.github.TeamNewPipe:nanojson:1d9e1aea9049fc9f85e68b43ba39fe7be1c1f751'
implementation 'com.github.TeamNewPipe:NewPipeExtractor:v0.21.11'
implementation 'com.github.TeamNewPipe:NewPipeExtractor:v0.21.12'

/** Checkstyle **/
checkstyle "com.puppycrawl.tools:checkstyle:${checkstyleVersion}"
Expand All @@ -208,14 +208,17 @@ dependencies {
implementation "androidx.lifecycle:lifecycle-livedata:${androidxLifecycleVersion}"
implementation "androidx.lifecycle:lifecycle-viewmodel:${androidxLifecycleVersion}"
implementation 'androidx.localbroadcastmanager:localbroadcastmanager:1.0.0'
implementation 'androidx.media:media:1.3.1'
implementation 'androidx.media:media:1.4.3'
implementation 'androidx.multidex:multidex:2.0.1'
implementation 'androidx.preference:preference:1.1.1'
implementation 'androidx.recyclerview:recyclerview:1.1.0'
implementation 'androidx.recyclerview:recyclerview:1.2.1'
implementation "androidx.room:room-runtime:${androidxRoomVersion}"
implementation "androidx.room:room-rxjava3:${androidxRoomVersion}"
kapt "androidx.room:room-compiler:${androidxRoomVersion}"
implementation 'androidx.swiperefreshlayout:swiperefreshlayout:1.1.0'
// Newer version specified to prevent accessibility regressions with RecyclerView, see:
// https://developer.android.com/jetpack/androidx/releases/viewpager2#1.1.0-alpha01
implementation 'androidx.viewpager2:viewpager2:1.1.0-beta01'
implementation 'androidx.webkit:webkit:1.4.0'
implementation 'com.google.android.material:material:1.2.1'

Expand Down
19 changes: 19 additions & 0 deletions app/src/main/AndroidManifest.xml
Original file line number Diff line number Diff line change
Expand Up @@ -256,6 +256,21 @@
<data android:pathPrefix="/" />
</intent-filter>

<!-- y2u.be filter -->
<intent-filter>
<action android:name="android.intent.action.VIEW" />
<action android:name="android.media.action.MEDIA_PLAY_FROM_SEARCH" />
<action android:name="android.nfc.action.NDEF_DISCOVERED" />

<category android:name="android.intent.category.DEFAULT" />
<category android:name="android.intent.category.BROWSABLE" />

<data android:scheme="http" />
<data android:scheme="https" />
<data android:host="y2u.be" />
<data android:pathPrefix="/" />
</intent-filter>

<!-- Soundcloud filter -->
<intent-filter>
<action android:name="android.intent.action.VIEW" />
Expand Down Expand Up @@ -325,8 +340,12 @@
<data android:host="skeptikon.fr" />

<data android:pathPrefix="/videos/" /> <!-- it contains playlists -->
<data android:pathPrefix="/w/" /> <!-- short video URLs -->
<data android:pathPrefix="/w/p/" /> <!-- short playlist URLs -->
<data android:pathPrefix="/accounts/" />
<data android:pathPrefix="/a/" /> <!-- short account URLs -->
<data android:pathPrefix="/video-channels/" />
<data android:pathPrefix="/c/" /> <!-- short video-channels URLs -->
</intent-filter>

<!-- Bandcamp filter for tracks, albums and playlists -->
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -51,8 +51,12 @@
* <li>{@link #saveState()}</li>
* <li>{@link #restoreState(Parcelable, ClassLoader)}</li>
* </ul>
*
* @deprecated Switch to {@link androidx.viewpager2.widget.ViewPager2} and use
* {@link androidx.viewpager2.adapter.FragmentStateAdapter} instead.
*/
@SuppressWarnings("deprecation")
@Deprecated
public abstract class FragmentStatePagerAdapterMenuWorkaround extends PagerAdapter {
private static final String TAG = "FragmentStatePagerAdapt";
private static final boolean DEBUG = false;
Expand Down Expand Up @@ -86,9 +90,10 @@ public abstract class FragmentStatePagerAdapterMenuWorkaround extends PagerAdapt
private final int mBehavior;
private FragmentTransaction mCurTransaction = null;

private final ArrayList<Fragment.SavedState> mSavedState = new ArrayList<Fragment.SavedState>();
private final ArrayList<Fragment> mFragments = new ArrayList<Fragment>();
private final ArrayList<Fragment.SavedState> mSavedState = new ArrayList<>();
private final ArrayList<Fragment> mFragments = new ArrayList<>();
private Fragment mCurrentPrimaryItem = null;
private boolean mExecutingFinishUpdate;

/**
* Constructor for {@link FragmentStatePagerAdapterMenuWorkaround}
Expand Down Expand Up @@ -208,7 +213,7 @@ public void destroyItem(@NonNull final ViewGroup container, final int position,
mFragments.set(position, null);

mCurTransaction.remove(fragment);
if (fragment == mCurrentPrimaryItem) {
if (fragment.equals(mCurrentPrimaryItem)) {
mCurrentPrimaryItem = null;
}
}
Expand Down Expand Up @@ -247,7 +252,19 @@ public void setPrimaryItem(@NonNull final ViewGroup container, final int positio
@Override
public void finishUpdate(@NonNull final ViewGroup container) {
if (mCurTransaction != null) {
mCurTransaction.commitNowAllowingStateLoss();
// We drop any transactions that attempt to be committed
// from a re-entrant call to finishUpdate(). We need to
// do this as a workaround for Robolectric running measure/layout
// calls inline rather than allowing them to be posted
// as they would on a real device.
if (!mExecutingFinishUpdate) {
try {
mExecutingFinishUpdate = true;
mCurTransaction.commitNowAllowingStateLoss();
} finally {
mExecutingFinishUpdate = false;
}
}
mCurTransaction = null;
}
}
Expand Down
10 changes: 1 addition & 9 deletions app/src/main/java/org/schabi/newpipe/BaseFragment.java
Original file line number Diff line number Diff line change
Expand Up @@ -21,7 +21,6 @@ public abstract class BaseFragment extends Fragment {
//These values are used for controlling fragments when they are part of the frontpage
@State
protected boolean useAsFrontPage = false;
private boolean mIsVisibleToUser = false;

public void useAsFrontPage(final boolean value) {
useAsFrontPage = value;
Expand Down Expand Up @@ -85,12 +84,6 @@ public void onDestroy() {
AppWatcher.INSTANCE.getObjectWatcher().watch(this);
}

@Override
public void setUserVisibleHint(final boolean isVisibleToUser) {
super.setUserVisibleHint(isVisibleToUser);
mIsVisibleToUser = isVisibleToUser;
}

/*//////////////////////////////////////////////////////////////////////////
// Init
//////////////////////////////////////////////////////////////////////////*/
Expand All @@ -109,8 +102,7 @@ public void setTitle(final String title) {
if (DEBUG) {
Log.d(TAG, "setTitle() called with: title = [" + title + "]");
}
if ((!useAsFrontPage || mIsVisibleToUser)
&& (activity != null && activity.getSupportActionBar() != null)) {
if (!useAsFrontPage && activity != null && activity.getSupportActionBar() != null) {
activity.getSupportActionBar().setDisplayShowTitleEnabled(true);
activity.getSupportActionBar().setTitle(title);
}
Expand Down
70 changes: 31 additions & 39 deletions app/src/main/java/org/schabi/newpipe/CheckForNewAppVersion.java
Original file line number Diff line number Diff line change
Expand Up @@ -7,15 +7,13 @@
import android.content.SharedPreferences;
import android.content.pm.PackageManager;
import android.content.pm.Signature;
import android.net.ConnectivityManager;
import android.net.Uri;
import android.util.Log;

import androidx.annotation.NonNull;
import androidx.annotation.Nullable;
import androidx.core.app.NotificationCompat;
import androidx.core.app.NotificationManagerCompat;
import androidx.core.content.ContextCompat;
import androidx.core.content.pm.PackageInfoCompat;
import androidx.preference.PreferenceManager;

Expand Down Expand Up @@ -48,7 +46,8 @@ public CheckForNewAppVersion() {
private static final boolean DEBUG = MainActivity.DEBUG;
private static final String TAG = CheckForNewAppVersion.class.getSimpleName();

private static final String GITHUB_APK_SHA1
// Public key of the certificate that is used in NewPipe release versions
private static final String RELEASE_CERT_PUBLIC_KEY_SHA1
= "B0:2E:90:7C:1C:D6:FC:57:C3:35:F0:88:D0:8F:50:5F:94:E4:D2:15";
private static final String NEWPIPE_API_URL = "https://newpipe.net/api/data.json";

Expand Down Expand Up @@ -129,44 +128,37 @@ private static void compareAppVersionAndShowNotification(@NonNull final Applicat
final String versionName,
final String apkLocationUrl,
final int versionCode) {
final int notificationId = 2000;

if (BuildConfig.VERSION_CODE < versionCode) {
// A pending intent to open the apk location url in the browser.
final Intent intent = new Intent(Intent.ACTION_VIEW, Uri.parse(apkLocationUrl));
intent.addFlags(Intent.FLAG_ACTIVITY_NEW_TASK);
final PendingIntent pendingIntent
= PendingIntent.getActivity(application, 0, intent, 0);
if (BuildConfig.VERSION_CODE >= versionCode) {
return;
}

final String channelId = application
.getString(R.string.app_update_notification_channel_id);
final NotificationCompat.Builder notificationBuilder
= new NotificationCompat.Builder(application, channelId)
.setSmallIcon(R.drawable.ic_newpipe_update)
.setVisibility(NotificationCompat.VISIBILITY_PUBLIC)
.setContentIntent(pendingIntent)
.setAutoCancel(true)
.setContentTitle(application
.getString(R.string.app_update_notification_content_title))
.setContentText(application
.getString(R.string.app_update_notification_content_text)
+ " " + versionName);
// A pending intent to open the apk location url in the browser.
final Intent intent = new Intent(Intent.ACTION_VIEW, Uri.parse(apkLocationUrl));
intent.addFlags(Intent.FLAG_ACTIVITY_NEW_TASK);
final PendingIntent pendingIntent
= PendingIntent.getActivity(application, 0, intent, 0);

final NotificationManagerCompat notificationManager
= NotificationManagerCompat.from(application);
notificationManager.notify(notificationId, notificationBuilder.build());
}
}
final String channelId = application
.getString(R.string.app_update_notification_channel_id);
final NotificationCompat.Builder notificationBuilder
= new NotificationCompat.Builder(application, channelId)
.setSmallIcon(R.drawable.ic_newpipe_update)
.setVisibility(NotificationCompat.VISIBILITY_PUBLIC)
.setContentIntent(pendingIntent)
.setAutoCancel(true)
.setContentTitle(application
.getString(R.string.app_update_notification_content_title))
.setContentText(application
.getString(R.string.app_update_notification_content_text)
+ " " + versionName);

private static boolean isConnected(@NonNull final App app) {
final ConnectivityManager connectivityManager =
ContextCompat.getSystemService(app, ConnectivityManager.class);
return connectivityManager != null && connectivityManager.getActiveNetworkInfo() != null
&& connectivityManager.getActiveNetworkInfo().isConnected();
final NotificationManagerCompat notificationManager
= NotificationManagerCompat.from(application);
notificationManager.notify(2000, notificationBuilder.build());
}

public static boolean isGithubApk(@NonNull final App app) {
return getCertificateSHA1Fingerprint(app).equals(GITHUB_APK_SHA1);
public static boolean isReleaseApk(@NonNull final App app) {
return getCertificateSHA1Fingerprint(app).equals(RELEASE_CERT_PUBLIC_KEY_SHA1);
}

private void checkNewVersion() throws IOException, ReCaptchaException {
Expand All @@ -175,9 +167,8 @@ private void checkNewVersion() throws IOException, ReCaptchaException {
final SharedPreferences prefs = PreferenceManager.getDefaultSharedPreferences(app);
final NewVersionManager manager = new NewVersionManager();

// Check if user has enabled/disabled update checking
// and if the current apk is a github one or not.
if (!prefs.getBoolean(app.getString(R.string.update_app_key), true) || !isGithubApk(app)) {
// Check if the current apk is a github one or not.
if (!isReleaseApk(app)) {
return;
}

Expand Down Expand Up @@ -213,6 +204,7 @@ private void handleResponse(@NonNull final Response response,

// Parse the json from the response.
try {

final JsonObject githubStableObject = JsonParser.object()
.from(response.responseBody()).getObject("flavors")
.getObject("github").getObject("stable");
Expand Down
Loading