mirror of
https://gitlab.futo.org/videostreaming/grayjay.git
synced 2026-05-16 04:52:39 +02:00
Workaround for global lifetime scope unavailable
This commit is contained in:
@@ -1106,6 +1106,7 @@ class Settings : FragmentedStorageFileJson() {
|
||||
@FormField(R.string.relay_server, FieldForm.READONLYTEXT, -1, 6)
|
||||
val syncServer: String get() = if(syncServerUrl?.isBlank() == true) StateSync.RELAY_SERVER else syncServerUrl ?: StateSync.RELAY_SERVER;
|
||||
|
||||
@AdvancedField
|
||||
@FormField(R.string.configure_sync_server, FieldForm.BUTTON, R.string.configure_sync_server_description, 7)
|
||||
fun configureSyncServer() {
|
||||
SettingsActivity.getActivity()?.let { context ->
|
||||
|
||||
@@ -135,8 +135,12 @@ class StateApp {
|
||||
return _scope;
|
||||
}
|
||||
val scope: CoroutineScope get() {
|
||||
val thisScope = scopeOrNull
|
||||
?: throw IllegalStateException("Attempted to use a global lifetime scope while MainActivity is no longer available");
|
||||
val thisScope = scopeOrNull;
|
||||
if(thisScope == null) {
|
||||
//throw IllegalStateException("Attempted to use a global lifetime scope while MainActivity is no longer available");
|
||||
Logger.w(TAG, "Attempted to use a global lifetime scope while MainActivity is no longer available, USING GLOBAL SCOPE");
|
||||
return GlobalScope;
|
||||
}
|
||||
return thisScope;
|
||||
}
|
||||
val scopeGetter: ()->CoroutineScope get() {
|
||||
|
||||
@@ -4,7 +4,7 @@ import com.futo.platformplayer.constructs.Event2
|
||||
import com.futo.platformplayer.constructs.Event3
|
||||
import java.lang.reflect.Field
|
||||
|
||||
@Target(AnnotationTarget.FIELD, AnnotationTarget.PROPERTY)
|
||||
@Target(AnnotationTarget.FIELD, AnnotationTarget.PROPERTY, AnnotationTarget.FUNCTION)
|
||||
@Retention(AnnotationRetention.RUNTIME)
|
||||
annotation class AdvancedField();
|
||||
|
||||
|
||||
Reference in New Issue
Block a user