mirror of
https://gitlab.futo.org/videostreaming/grayjay.git
synced 2025-04-20 03:24:50 +00:00
Fix for hanging app if logging is enabled
This commit is contained in:
parent
959c192762
commit
53f74c4b6e
5 changed files with 9 additions and 3 deletions
|
@ -549,6 +549,8 @@ class Settings : FragmentedStorageFileJson() {
|
|||
@DropdownFieldOptionsId(R.array.log_levels)
|
||||
var logLevel: Int = 0;
|
||||
|
||||
fun isVerbose() = logLevel >= 4;
|
||||
|
||||
@FormField(R.string.submit_logs, FieldForm.BUTTON, R.string.submit_logs_to_help_us_narrow_down_issues, 1)
|
||||
fun submitLogs() {
|
||||
StateApp.instance.scopeOrNull?.launch(Dispatchers.IO) {
|
||||
|
|
|
@ -192,6 +192,7 @@ class MainActivity : AppCompatActivity, IWithResultLauncher {
|
|||
}
|
||||
|
||||
override fun onCreate(savedInstanceState: Bundle?) {
|
||||
Logger.i(TAG, "MainActivity Starting");
|
||||
StateApp.instance.setGlobalContext(this, lifecycleScope);
|
||||
StateApp.instance.mainAppStarting(this);
|
||||
|
||||
|
|
|
@ -43,7 +43,8 @@ class FileLogConsumer : ILogConsumer, Closeable {
|
|||
}
|
||||
|
||||
while (_linesToWrite.isNotEmpty()) {
|
||||
_writer?.appendLine(_linesToWrite.remove());
|
||||
val todo = _linesToWrite.remove()
|
||||
_writer?.appendLine(todo);
|
||||
}
|
||||
|
||||
_writer?.flush();
|
||||
|
@ -85,7 +86,7 @@ class FileLogConsumer : ILogConsumer, Closeable {
|
|||
_running = false;
|
||||
_writer?.close();
|
||||
_writer = null;
|
||||
_logThread?.join();
|
||||
//_logThread?.join();
|
||||
_logThread = null;
|
||||
}
|
||||
|
||||
|
|
|
@ -333,7 +333,7 @@ class StateApp {
|
|||
suspend fun backgroundStarting(context: Context, scope: CoroutineScope, withFiles: Boolean, withPlugins: Boolean) {
|
||||
if(contextOrNull == null) {
|
||||
Logger.i(TAG, "BACKGROUND STATE: Starting");
|
||||
if(!Logger.hasConsumers && BuildConfig.DEBUG) {
|
||||
if(!Logger.hasConsumers && (BuildConfig.DEBUG)) {
|
||||
Logger.i(TAG, "BACKGROUND STATE: Initialize logger");
|
||||
Logger.setLogConsumers(listOf(AndroidLogConsumer()));
|
||||
}
|
||||
|
|
|
@ -14,6 +14,7 @@ import com.futo.platformplayer.api.media.models.video.IPlatformVideo
|
|||
import com.futo.platformplayer.api.media.models.video.IPlatformVideoDetails
|
||||
import com.futo.platformplayer.constructs.Event0
|
||||
import com.futo.platformplayer.constructs.Event1
|
||||
import com.futo.platformplayer.logging.Logger
|
||||
import com.futo.platformplayer.models.Playlist
|
||||
import com.futo.platformplayer.services.MediaPlaybackService
|
||||
import com.futo.platformplayer.video.PlayerManager
|
||||
|
@ -633,6 +634,7 @@ class StatePlayer {
|
|||
val instance = _instance;
|
||||
_instance = null;
|
||||
instance?.dispose();
|
||||
Logger.i(TAG, "Disposed StatePlayer");
|
||||
}
|
||||
}
|
||||
}
|
Loading…
Add table
Reference in a new issue