mirror of
https://github.com/yuliskov/SmartTube.git
synced 2026-01-05 13:30:30 -06:00
persist incognito flag upon app reboot
This commit is contained in:
Submodule MediaServiceCore updated: 67ef34d82a...58e585e7ac
Submodule SharedModules updated: e3b0e4409c...33050d7233
@@ -65,8 +65,8 @@ public class VideoLoaderController extends BasePlayerController {
|
||||
|
||||
private final Runnable mRebootApp = () -> {
|
||||
Video video = getVideo();
|
||||
if (getPlayer() != null && video != null && video.hasVideo()) {
|
||||
Utils.restartTheApp(getContext(), video.videoId, getPlayer().getPositionMs());
|
||||
if (getPlayer() != null) {
|
||||
Utils.restartTheApp(getContext(), video, getPlayer().getPositionMs());
|
||||
}
|
||||
};
|
||||
private final Runnable mOnApplyPlaybackMode = () -> {
|
||||
|
||||
@@ -90,13 +90,13 @@ public class PlaybackPresenter extends BasePresenter<PlaybackView> implements Pl
|
||||
}
|
||||
|
||||
public void openVideo(String videoId) {
|
||||
openVideo(videoId, false, -1);
|
||||
openVideo(videoId, false, -1, false);
|
||||
}
|
||||
|
||||
/**
|
||||
* Opens video item from splash view
|
||||
*/
|
||||
public void openVideo(String videoId, boolean finishOnEnded, long timeMs) {
|
||||
public void openVideo(String videoId, boolean finishOnEnded, long timeMs, boolean incognito) {
|
||||
if (videoId == null) {
|
||||
return;
|
||||
}
|
||||
@@ -104,6 +104,7 @@ public class PlaybackPresenter extends BasePresenter<PlaybackView> implements Pl
|
||||
Video video = Video.from(videoId);
|
||||
video.finishOnEnded = finishOnEnded;
|
||||
video.pendingPosMs = timeMs;
|
||||
video.incognito = incognito;
|
||||
openVideo(video);
|
||||
}
|
||||
|
||||
|
||||
@@ -6,7 +6,7 @@ import android.content.Intent;
|
||||
|
||||
import com.liskovsoft.mediaserviceinterfaces.oauth.Account;
|
||||
import com.liskovsoft.mediaserviceinterfaces.data.MediaGroup;
|
||||
import com.liskovsoft.sharedutils.GlobalConstants;
|
||||
import com.liskovsoft.sharedutils.helpers.GlobalConstants;
|
||||
import com.liskovsoft.sharedutils.helpers.Helpers;
|
||||
import com.liskovsoft.sharedutils.helpers.MessageHelpers;
|
||||
import com.liskovsoft.sharedutils.mylogger.Log;
|
||||
@@ -276,7 +276,9 @@ public class SplashPresenter extends BasePresenter<SplashView> {
|
||||
if (videoId != null) {
|
||||
long timeMs = IntentExtractor.extractVideoTimeMs(intent);
|
||||
PlaybackPresenter playbackPresenter = PlaybackPresenter.instance(getContext());
|
||||
playbackPresenter.openVideo(videoId, IntentExtractor.hasFinishOnEndedFlag(intent), timeMs);
|
||||
boolean finishOnEnded = IntentExtractor.hasFinishOnEndedFlag(intent);
|
||||
boolean incognito = intent.getBooleanExtra(GlobalConstants.INCOGNITO_INTENT, false);
|
||||
playbackPresenter.openVideo(videoId, finishOnEnded, timeMs, incognito);
|
||||
|
||||
enablePlayerOnlyModeIfNeeded(intent);
|
||||
|
||||
|
||||
@@ -54,13 +54,14 @@ import androidx.work.PeriodicWorkRequest;
|
||||
import androidx.work.WorkManager;
|
||||
|
||||
import com.jakewharton.processphoenix.ProcessPhoenix;
|
||||
import com.liskovsoft.sharedutils.GlobalConstants;
|
||||
import com.liskovsoft.sharedutils.helpers.GlobalConstants;
|
||||
import com.liskovsoft.sharedutils.helpers.Helpers;
|
||||
import com.liskovsoft.sharedutils.helpers.MessageHelpers;
|
||||
import com.liskovsoft.sharedutils.misc.WeakHashSet;
|
||||
import com.liskovsoft.sharedutils.mylogger.Log;
|
||||
import com.liskovsoft.smartyoutubetv2.common.BuildConfig;
|
||||
import com.liskovsoft.smartyoutubetv2.common.R;
|
||||
import com.liskovsoft.smartyoutubetv2.common.app.models.data.Video;
|
||||
import com.liskovsoft.smartyoutubetv2.common.app.models.playback.manager.PlayerConstants;
|
||||
import com.liskovsoft.smartyoutubetv2.common.app.models.playback.manager.PlayerManager;
|
||||
import com.liskovsoft.smartyoutubetv2.common.app.models.playback.service.VideoStateService;
|
||||
@@ -907,15 +908,20 @@ public class Utils {
|
||||
}
|
||||
}
|
||||
|
||||
public static void restartTheApp(Context context, String videoId, long posMs) {
|
||||
public static void restartTheApp(Context context, Video video, long posMs) {
|
||||
if (video == null || !video.hasVideo()) {
|
||||
return;
|
||||
}
|
||||
|
||||
try {
|
||||
Intent intent = new Intent(
|
||||
Intent.ACTION_VIEW,
|
||||
Uri.parse(String.format("https://www.youtube.com/watch?v=%s&t=%ss", videoId, posMs / 1_000)),
|
||||
Uri.parse(String.format("https://www.youtube.com/watch?v=%s&t=%ss", video.videoId, posMs / 1_000)),
|
||||
context,
|
||||
Class.forName(BOOTSTRAP_ACTIVITY_CLASS_NAME)
|
||||
);
|
||||
intent.putExtra(GlobalConstants.RESTART_INTENT, true);
|
||||
intent.putExtra(GlobalConstants.INCOGNITO_INTENT, video.incognito);
|
||||
ProcessPhoenix.triggerRebirth(context, intent);
|
||||
} catch (ClassNotFoundException e) {
|
||||
e.printStackTrace();
|
||||
|
||||
@@ -7,10 +7,11 @@ import android.content.Context;
|
||||
import android.content.Intent;
|
||||
import android.net.Uri;
|
||||
import android.os.Build;
|
||||
import com.liskovsoft.sharedutils.GlobalConstants;
|
||||
|
||||
import com.liskovsoft.sharedutils.configparser.AssetPropertyParser2;
|
||||
import com.liskovsoft.sharedutils.configparser.ConfigParser;
|
||||
import com.liskovsoft.sharedutils.helpers.AppInfoHelpers;
|
||||
import com.liskovsoft.sharedutils.helpers.GlobalConstants;
|
||||
|
||||
public class AppUtil {
|
||||
private final Context mContext;
|
||||
|
||||
Reference in New Issue
Block a user