Skip to content

Commit 0ae04b8

Browse files
authored
Merge pull request #7291 from TeamNewPipe/release/0.21.13
Release/0.21.13
2 parents 7eb13a9 + 5d59025 commit 0ae04b8

7 files changed

Lines changed: 46 additions & 10 deletions

File tree

app/build.gradle

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -17,8 +17,8 @@ android {
1717
resValue "string", "app_name", "NewPipe"
1818
minSdkVersion 19
1919
targetSdkVersion 29
20-
versionCode 978
21-
versionName "0.21.12"
20+
versionCode 979
21+
versionName "0.21.13"
2222

2323
multiDexEnabled true
2424

app/src/main/java/org/schabi/newpipe/App.java

Lines changed: 1 addition & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -254,4 +254,5 @@ private void initNotificationChannels() {
254254
protected boolean isDisposedRxExceptionsReported() {
255255
return false;
256256
}
257+
257258
}

app/src/main/java/org/schabi/newpipe/CheckForNewAppVersion.java

Lines changed: 17 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -235,6 +235,23 @@ private void handleResponse(@NonNull final Response response,
235235
}
236236
}
237237

238+
/**
239+
* Start a new service which
240+
* checks if all conditions for performing a version check are met,
241+
* fetches the API endpoint {@link #NEWPIPE_API_URL} containing info
242+
* about the latest NewPipe version
243+
* and displays a notification about ana available update.
244+
* <br>
245+
* Following conditions need to be met, before data is request from the server:
246+
* <ul>
247+
* <li> The app is signed with the correct signing key (by TeamNewPipe / schabi).
248+
* If the signing key differs from the one used upstream, the update cannot be installed.</li>
249+
* <li>The user enabled searching for and notifying about updates in the settings.</li>
250+
* <li>The app did not recently check for updates.
251+
* We do not want to make unnecessary connections and DOS our servers.</li>
252+
* </ul>
253+
* <b>Must not be executed</b> when the app is in background.
254+
*/
238255
public static void startNewVersionCheckService() {
239256
final Intent intent = new Intent(App.getApp().getApplicationContext(),
240257
CheckForNewAppVersion.class);

app/src/main/java/org/schabi/newpipe/MainActivity.java

Lines changed: 8 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -21,6 +21,7 @@
2121
package org.schabi.newpipe;
2222

2323
import static org.schabi.newpipe.CheckForNewAppVersion.startNewVersionCheckService;
24+
import static org.schabi.newpipe.util.Localization.assureCorrectAppLanguage;
2425

2526
import android.content.BroadcastReceiver;
2627
import android.content.Context;
@@ -93,8 +94,6 @@
9394
import java.util.List;
9495
import java.util.Objects;
9596

96-
import static org.schabi.newpipe.util.Localization.assureCorrectAppLanguage;
97-
9897
public class MainActivity extends AppCompatActivity {
9998
private static final String TAG = "MainActivity";
10099
@SuppressWarnings("ConstantConditions")
@@ -165,8 +164,14 @@ protected void onCreate(final Bundle savedInstanceState) {
165164
FocusOverlayView.setupFocusObserver(this);
166165
}
167166
openMiniPlayerUponPlayerStarted();
167+
}
168168

169-
// Check for new version
169+
@Override
170+
protected void onPostCreate(final Bundle savedInstanceState) {
171+
super.onPostCreate(savedInstanceState);
172+
// Start the service which is checking all conditions
173+
// and eventually searching for a new version.
174+
// The service searching for a new NewPipe version must not be started in background.
170175
startNewVersionCheckService();
171176
}
172177

app/src/main/java/org/schabi/newpipe/fragments/detail/VideoDetailFragment.java

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -1181,7 +1181,7 @@ private void openMainPlayer() {
11811181
addVideoPlayerView();
11821182

11831183
final Intent playerIntent = NavigationHelper.getPlayerIntent(requireContext(),
1184-
MainPlayer.class, queue, autoPlayEnabled);
1184+
MainPlayer.class, queue, true, autoPlayEnabled);
11851185
ContextCompat.startForegroundService(activity, playerIntent);
11861186
}
11871187

app/src/main/java/org/schabi/newpipe/util/NavigationHelper.java

Lines changed: 15 additions & 4 deletions
Original file line numberDiff line numberDiff line change
@@ -77,7 +77,8 @@ private NavigationHelper() {
7777
@NonNull
7878
public static <T> Intent getPlayerIntent(@NonNull final Context context,
7979
@NonNull final Class<T> targetClazz,
80-
@Nullable final PlayQueue playQueue) {
80+
@Nullable final PlayQueue playQueue,
81+
final boolean resumePlayback) {
8182
final Intent intent = new Intent(context, targetClazz);
8283

8384
if (playQueue != null) {
@@ -87,6 +88,7 @@ public static <T> Intent getPlayerIntent(@NonNull final Context context,
8788
}
8889
}
8990
intent.putExtra(Player.PLAYER_TYPE, MainPlayer.PlayerType.VIDEO.ordinal());
91+
intent.putExtra(Player.RESUME_PLAYBACK, resumePlayback);
9092

9193
return intent;
9294
}
@@ -95,24 +97,33 @@ public static <T> Intent getPlayerIntent(@NonNull final Context context,
9597
public static <T> Intent getPlayerIntent(@NonNull final Context context,
9698
@NonNull final Class<T> targetClazz,
9799
@Nullable final PlayQueue playQueue,
100+
final boolean resumePlayback,
98101
final boolean playWhenReady) {
99-
return getPlayerIntent(context, targetClazz, playQueue)
102+
return getPlayerIntent(context, targetClazz, playQueue, resumePlayback)
100103
.putExtra(Player.PLAY_WHEN_READY, playWhenReady);
101104
}
102105

103106
@NonNull
104107
public static <T> Intent getPlayerEnqueueIntent(@NonNull final Context context,
105108
@NonNull final Class<T> targetClazz,
106109
@Nullable final PlayQueue playQueue) {
107-
return getPlayerIntent(context, targetClazz, playQueue)
110+
// when enqueueing `resumePlayback` is always `false` since:
111+
// - if there is a video already playing, the value of `resumePlayback` just doesn't make
112+
// any difference.
113+
// - if there is nothing already playing, it is useful for the enqueue action to have a
114+
// slightly different behaviour than the normal play action: the latter resumes playback,
115+
// the former doesn't. (note that enqueue can be triggered when nothing is playing only
116+
// by long pressing the video detail fragment, playlist or channel controls
117+
return getPlayerIntent(context, targetClazz, playQueue, false)
108118
.putExtra(Player.ENQUEUE, true);
109119
}
110120

111121
@NonNull
112122
public static <T> Intent getPlayerEnqueueNextIntent(@NonNull final Context context,
113123
@NonNull final Class<T> targetClazz,
114124
@Nullable final PlayQueue playQueue) {
115-
return getPlayerIntent(context, targetClazz, playQueue)
125+
// see comment in `getPlayerEnqueueIntent` as to why `resumePlayback` is false
126+
return getPlayerIntent(context, targetClazz, playQueue, false)
116127
.putExtra(Player.ENQUEUE_NEXT, true);
117128
}
118129

Lines changed: 2 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,2 @@
1+
- Fixed resuming playback
2+
- Improvements to ensure that the service which determines if NewPipe should check for a new version checks is not started in background

0 commit comments

Comments
 (0)