mirror of
https://gitlab.futo.org/videostreaming/grayjay.git
synced 2025-09-17 06:52:27 +00:00
Fix login dialog
This commit is contained in:
parent
91060faac9
commit
1edc8aabf8
2 changed files with 15 additions and 5 deletions
|
@ -1141,10 +1141,14 @@ class VideoDetailView : ConstraintLayout {
|
||||||
|
|
||||||
|
|
||||||
//Lifecycle
|
//Lifecycle
|
||||||
|
var isLoginStop = false; //TODO: This is a bit jank, but easiest solution for now without reworking flow. (Alternatively, fix MainActivity getting stopped/disposing video)
|
||||||
fun onResume() {
|
fun onResume() {
|
||||||
Logger.v(TAG, "onResume");
|
Logger.v(TAG, "onResume");
|
||||||
_onPauseCalled = false;
|
_onPauseCalled = false;
|
||||||
|
|
||||||
|
val wasLoginCall = isLoginStop;
|
||||||
|
isLoginStop = false;
|
||||||
|
|
||||||
Logger.i(TAG, "_video: ${video?.name ?: "no video"}");
|
Logger.i(TAG, "_video: ${video?.name ?: "no video"}");
|
||||||
Logger.i(TAG, "_didStop: $_didStop");
|
Logger.i(TAG, "_didStop: $_didStop");
|
||||||
|
|
||||||
|
@ -1153,7 +1157,7 @@ class VideoDetailView : ConstraintLayout {
|
||||||
val t = (lastPositionMilliseconds / 1000.0f).roundToLong();
|
val t = (lastPositionMilliseconds / 1000.0f).roundToLong();
|
||||||
if(_searchVideo != null)
|
if(_searchVideo != null)
|
||||||
setVideoOverview(_searchVideo!!, true, t);
|
setVideoOverview(_searchVideo!!, true, t);
|
||||||
else if(_url != null)
|
else if(_url != null && !wasLoginCall)
|
||||||
setVideo(_url!!, t, _playWhenReady);
|
setVideo(_url!!, t, _playWhenReady);
|
||||||
}
|
}
|
||||||
else if(_didStop) {
|
else if(_didStop) {
|
||||||
|
@ -3276,9 +3280,14 @@ class VideoDetailView : ConstraintLayout {
|
||||||
val id = e.config.let { if(it is SourcePluginConfig) it.id else null };
|
val id = e.config.let { if(it is SourcePluginConfig) it.id else null };
|
||||||
val didLogin = if(id == null)
|
val didLogin = if(id == null)
|
||||||
false
|
false
|
||||||
else StatePlugins.instance.loginPlugin(context, id) {
|
else {
|
||||||
|
isLoginStop = true;
|
||||||
|
StatePlugins.instance.loginPlugin(context, id) {
|
||||||
|
fragment.lifecycleScope.launch(Dispatchers.Main) {
|
||||||
fetchVideo();
|
fetchVideo();
|
||||||
}
|
}
|
||||||
|
}
|
||||||
|
}
|
||||||
if(!didLogin)
|
if(!didLogin)
|
||||||
UIDialogs.showDialogOk(context, R.drawable.ic_error_pred, "Failed to login");
|
UIDialogs.showDialogOk(context, R.drawable.ic_error_pred, "Failed to login");
|
||||||
}, UIDialogs.ActionStyle.PRIMARY));
|
}, UIDialogs.ActionStyle.PRIMARY));
|
||||||
|
|
|
@ -179,9 +179,10 @@ class StatePlugins {
|
||||||
}
|
}
|
||||||
|
|
||||||
StateApp.instance.scope.launch(Dispatchers.IO) {
|
StateApp.instance.scope.launch(Dispatchers.IO) {
|
||||||
StatePlatform.instance.reloadClient(context, id);
|
StatePlatform.instance.reloadClient(context, id) {
|
||||||
afterLogin.invoke();
|
afterLogin.invoke();
|
||||||
}
|
}
|
||||||
|
}
|
||||||
};
|
};
|
||||||
return true;
|
return true;
|
||||||
}
|
}
|
||||||
|
|
Loading…
Add table
Add a link
Reference in a new issue