Update trigger on exception update button pressed

This commit is contained in:
Kelvin 2024-05-16 22:27:53 +02:00
commit 88d687f26e
3 changed files with 11 additions and 2 deletions

View file

@ -300,7 +300,7 @@ class UIDialogs {
if(ex is PluginException) ex.code else null, if(ex is PluginException) ex.code else null,
1, 1,
UIDialogs.Action(context.getString(R.string.update), { UIDialogs.Action(context.getString(R.string.update), {
mainFragment.navigate<SourceDetailFragment>(pluginConfig); mainFragment.navigate<SourceDetailFragment>(SourceDetailFragment.UpdatePluginAction(pluginConfig));
if(mainFragment is VideoDetailFragment) if(mainFragment is VideoDetailFragment)
mainFragment.minimizeVideoDetail(); mainFragment.minimizeVideoDetail();
}, UIDialogs.ActionStyle.ACCENT), }, UIDialogs.ActionStyle.ACCENT),

View file

@ -57,8 +57,8 @@ import com.futo.platformplayer.states.StatePlatform
import com.futo.platformplayer.states.StatePlugins import com.futo.platformplayer.states.StatePlugins
import kotlinx.serialization.encodeToString import kotlinx.serialization.encodeToString
import kotlinx.serialization.json.Json import kotlinx.serialization.json.Json
import java.lang.Exception
import java.time.OffsetDateTime import java.time.OffsetDateTime
import kotlin.Exception
import kotlin.reflect.full.findAnnotations import kotlin.reflect.full.findAnnotations
import kotlin.reflect.jvm.kotlinFunction import kotlin.reflect.jvm.kotlinFunction
import kotlin.streams.asSequence import kotlin.streams.asSequence

View file

@ -101,6 +101,11 @@ class SourceDetailFragment : MainFragment() {
loadConfig(parameter); loadConfig(parameter);
updateSourceViews(); updateSourceViews();
} }
else if(parameter is UpdatePluginAction) {
loadConfig(parameter.config);
updateSourceViews();
checkForUpdatesSource();
}
setLoading(false); setLoading(false);
} }
@ -567,4 +572,8 @@ class SourceDetailFragment : MainFragment() {
const val TAG = "SourceDetailFragment"; const val TAG = "SourceDetailFragment";
fun newInstance() = SourceDetailFragment().apply {} fun newInstance() = SourceDetailFragment().apply {}
} }
class UpdatePluginAction(val config: SourcePluginConfig) {
}
} }