mirror of
				https://github.com/TeamNewPipe/NewPipe
				synced 2025-10-31 07:13:00 +00:00 
			
		
		
		
	Merge pull request #7268 from TeamNewPipe/release/0.21.13
Release 0.21.13 - Fix playback resume - Ensure that the service for new version checks is not started in background
This commit is contained in:
		| @@ -17,8 +17,8 @@ android { | |||||||
|         resValue "string", "app_name", "NewPipe" |         resValue "string", "app_name", "NewPipe" | ||||||
|         minSdkVersion 19 |         minSdkVersion 19 | ||||||
|         targetSdkVersion 29 |         targetSdkVersion 29 | ||||||
|         versionCode 978 |         versionCode 979 | ||||||
|         versionName "0.21.12" |         versionName "0.21.13" | ||||||
|  |  | ||||||
|         multiDexEnabled true |         multiDexEnabled true | ||||||
|  |  | ||||||
|   | |||||||
| @@ -254,4 +254,5 @@ public class App extends MultiDexApplication { | |||||||
|     protected boolean isDisposedRxExceptionsReported() { |     protected boolean isDisposedRxExceptionsReported() { | ||||||
|         return false; |         return false; | ||||||
|     } |     } | ||||||
|  |  | ||||||
| } | } | ||||||
|   | |||||||
| @@ -235,6 +235,23 @@ public final class CheckForNewAppVersion extends IntentService { | |||||||
|         } |         } | ||||||
|     } |     } | ||||||
|  |  | ||||||
|  |     /** | ||||||
|  |      * Start a new service which | ||||||
|  |      * checks if all conditions for performing a version check are met, | ||||||
|  |      * fetches the API endpoint {@link #NEWPIPE_API_URL} containing info | ||||||
|  |      * about the latest NewPipe version | ||||||
|  |      * and displays a notification about ana available update. | ||||||
|  |      * <br> | ||||||
|  |      * Following conditions need to be met, before data is request from the server: | ||||||
|  |      * <ul> | ||||||
|  |      * <li> The app is signed with the correct signing key (by TeamNewPipe / schabi). | ||||||
|  |      * If the signing key differs from the one used upstream, the update cannot be installed.</li> | ||||||
|  |      * <li>The user enabled searching for and notifying about updates in the settings.</li> | ||||||
|  |      * <li>The app did not recently check for updates. | ||||||
|  |      * We do not want to make unnecessary connections and DOS our servers.</li> | ||||||
|  |      * </ul> | ||||||
|  |      * <b>Must not be executed</b> when the app is in background. | ||||||
|  |      */ | ||||||
|     public static void startNewVersionCheckService() { |     public static void startNewVersionCheckService() { | ||||||
|         final Intent intent = new Intent(App.getApp().getApplicationContext(), |         final Intent intent = new Intent(App.getApp().getApplicationContext(), | ||||||
|                 CheckForNewAppVersion.class); |                 CheckForNewAppVersion.class); | ||||||
|   | |||||||
| @@ -164,8 +164,14 @@ public class MainActivity extends AppCompatActivity { | |||||||
|             FocusOverlayView.setupFocusObserver(this); |             FocusOverlayView.setupFocusObserver(this); | ||||||
|         } |         } | ||||||
|         openMiniPlayerUponPlayerStarted(); |         openMiniPlayerUponPlayerStarted(); | ||||||
|  |     } | ||||||
|  |  | ||||||
|         // Check for new version |     @Override | ||||||
|  |     protected void onPostCreate(final Bundle savedInstanceState) { | ||||||
|  |         super.onPostCreate(savedInstanceState); | ||||||
|  |         // Start the service which is checking all conditions | ||||||
|  |         // and eventually searching for a new version. | ||||||
|  |         // The service searching for a new NewPipe version must not be started in background. | ||||||
|         startNewVersionCheckService(); |         startNewVersionCheckService(); | ||||||
|     } |     } | ||||||
|  |  | ||||||
|   | |||||||
| @@ -1181,7 +1181,7 @@ public final class VideoDetailFragment | |||||||
|         addVideoPlayerView(); |         addVideoPlayerView(); | ||||||
|  |  | ||||||
|         final Intent playerIntent = NavigationHelper.getPlayerIntent(requireContext(), |         final Intent playerIntent = NavigationHelper.getPlayerIntent(requireContext(), | ||||||
|                 MainPlayer.class, queue, autoPlayEnabled); |                 MainPlayer.class, queue, true, autoPlayEnabled); | ||||||
|         ContextCompat.startForegroundService(activity, playerIntent); |         ContextCompat.startForegroundService(activity, playerIntent); | ||||||
|     } |     } | ||||||
|  |  | ||||||
|   | |||||||
| @@ -77,7 +77,8 @@ public final class NavigationHelper { | |||||||
|     @NonNull |     @NonNull | ||||||
|     public static <T> Intent getPlayerIntent(@NonNull final Context context, |     public static <T> Intent getPlayerIntent(@NonNull final Context context, | ||||||
|                                              @NonNull final Class<T> targetClazz, |                                              @NonNull final Class<T> targetClazz, | ||||||
|                                              @Nullable final PlayQueue playQueue) { |                                              @Nullable final PlayQueue playQueue, | ||||||
|  |                                              final boolean resumePlayback) { | ||||||
|         final Intent intent = new Intent(context, targetClazz); |         final Intent intent = new Intent(context, targetClazz); | ||||||
|  |  | ||||||
|         if (playQueue != null) { |         if (playQueue != null) { | ||||||
| @@ -87,6 +88,7 @@ public final class NavigationHelper { | |||||||
|             } |             } | ||||||
|         } |         } | ||||||
|         intent.putExtra(Player.PLAYER_TYPE, MainPlayer.PlayerType.VIDEO.ordinal()); |         intent.putExtra(Player.PLAYER_TYPE, MainPlayer.PlayerType.VIDEO.ordinal()); | ||||||
|  |         intent.putExtra(Player.RESUME_PLAYBACK, resumePlayback); | ||||||
|  |  | ||||||
|         return intent; |         return intent; | ||||||
|     } |     } | ||||||
| @@ -95,8 +97,9 @@ public final class NavigationHelper { | |||||||
|     public static <T> Intent getPlayerIntent(@NonNull final Context context, |     public static <T> Intent getPlayerIntent(@NonNull final Context context, | ||||||
|                                              @NonNull final Class<T> targetClazz, |                                              @NonNull final Class<T> targetClazz, | ||||||
|                                              @Nullable final PlayQueue playQueue, |                                              @Nullable final PlayQueue playQueue, | ||||||
|  |                                              final boolean resumePlayback, | ||||||
|                                              final boolean playWhenReady) { |                                              final boolean playWhenReady) { | ||||||
|         return getPlayerIntent(context, targetClazz, playQueue) |         return getPlayerIntent(context, targetClazz, playQueue, resumePlayback) | ||||||
|                 .putExtra(Player.PLAY_WHEN_READY, playWhenReady); |                 .putExtra(Player.PLAY_WHEN_READY, playWhenReady); | ||||||
|     } |     } | ||||||
|  |  | ||||||
| @@ -104,7 +107,14 @@ public final class NavigationHelper { | |||||||
|     public static <T> Intent getPlayerEnqueueIntent(@NonNull final Context context, |     public static <T> Intent getPlayerEnqueueIntent(@NonNull final Context context, | ||||||
|                                                     @NonNull final Class<T> targetClazz, |                                                     @NonNull final Class<T> targetClazz, | ||||||
|                                                     @Nullable final PlayQueue playQueue) { |                                                     @Nullable final PlayQueue playQueue) { | ||||||
|         return getPlayerIntent(context, targetClazz, playQueue) |         // when enqueueing `resumePlayback` is always `false` since: | ||||||
|  |         // - if there is a video already playing, the value of `resumePlayback` just doesn't make | ||||||
|  |         //   any difference. | ||||||
|  |         // - if there is nothing already playing, it is useful for the enqueue action to have a | ||||||
|  |         //   slightly different behaviour than the normal play action: the latter resumes playback, | ||||||
|  |         //   the former doesn't. (note that enqueue can be triggered when nothing is playing only | ||||||
|  |         //   by long pressing the video detail fragment, playlist or channel controls | ||||||
|  |         return getPlayerIntent(context, targetClazz, playQueue, false) | ||||||
|                 .putExtra(Player.ENQUEUE, true); |                 .putExtra(Player.ENQUEUE, true); | ||||||
|     } |     } | ||||||
|  |  | ||||||
| @@ -112,7 +122,8 @@ public final class NavigationHelper { | |||||||
|     public static <T> Intent getPlayerEnqueueNextIntent(@NonNull final Context context, |     public static <T> Intent getPlayerEnqueueNextIntent(@NonNull final Context context, | ||||||
|                                                         @NonNull final Class<T> targetClazz, |                                                         @NonNull final Class<T> targetClazz, | ||||||
|                                                         @Nullable final PlayQueue playQueue) { |                                                         @Nullable final PlayQueue playQueue) { | ||||||
|         return getPlayerIntent(context, targetClazz, playQueue) |         // see comment in `getPlayerEnqueueIntent` as to why `resumePlayback` is false | ||||||
|  |         return getPlayerIntent(context, targetClazz, playQueue, false) | ||||||
|                 .putExtra(Player.ENQUEUE_NEXT, true); |                 .putExtra(Player.ENQUEUE_NEXT, true); | ||||||
|     } |     } | ||||||
|  |  | ||||||
|   | |||||||
							
								
								
									
										2
									
								
								fastlane/metadata/android/en-US/changelogs/979.txt
									
									
									
									
									
										Normal file
									
								
							
							
						
						
									
										2
									
								
								fastlane/metadata/android/en-US/changelogs/979.txt
									
									
									
									
									
										Normal file
									
								
							| @@ -0,0 +1,2 @@ | |||||||
|  | - Fixed resuming playback | ||||||
|  | - Improvements to ensure that the service which determines if NewPipe should check for a new version checks is not started in background | ||||||
		Reference in New Issue
	
	Block a user
	 Tobi
					Tobi