diff --git a/app/src/main/java/com/futo/platformplayer/activities/MainActivity.kt b/app/src/main/java/com/futo/platformplayer/activities/MainActivity.kt index b919c5c3..294e4fcf 100644 --- a/app/src/main/java/com/futo/platformplayer/activities/MainActivity.kt +++ b/app/src/main/java/com/futo/platformplayer/activities/MainActivity.kt @@ -1,5 +1,6 @@ package com.futo.platformplayer.activities +import android.annotation.SuppressLint import android.content.Context import android.content.Intent import android.content.Intent.FLAG_ACTIVITY_NEW_TASK @@ -852,6 +853,7 @@ class MainActivity : AppCompatActivity, IWithResultLauncher { * Navigate takes a MainFragment, and makes them the current main visible view * A parameter can be provided which becomes available in the onShow of said fragment */ + @SuppressLint("CommitTransaction") fun navigate(segment: MainFragment, parameter: Any? = null, withHistory: Boolean = true, isBack: Boolean = false) { Logger.i(TAG, "Navigate to $segment (parameter=$parameter, withHistory=$withHistory, isBack=$isBack)") @@ -897,11 +899,6 @@ class MainActivity : AppCompatActivity, IWithResultLauncher { } transaction.commitNow(); } else { - //Special cases - if(segment is VideoDetailFragment) { - _fragContainerVideoDetail.visibility = View.VISIBLE; - _fragVideoDetail.maximizeVideoDetail(); - } if(!segment.hasBottomBar) { supportFragmentManager.beginTransaction() diff --git a/app/src/main/java/com/futo/platformplayer/api/http/server/ManagedHttpServer.kt b/app/src/main/java/com/futo/platformplayer/api/http/server/ManagedHttpServer.kt index e4f1cb03..cf4460d7 100644 --- a/app/src/main/java/com/futo/platformplayer/api/http/server/ManagedHttpServer.kt +++ b/app/src/main/java/com/futo/platformplayer/api/http/server/ManagedHttpServer.kt @@ -191,7 +191,7 @@ class ManagedHttpServer(private val _requestedPort: Int = 0) { } } fun addBridgeHandlers(obj: Any, tag: String? = null) { - val tagToUse = tag ?: obj.javaClass.name; + //val tagToUse = tag ?: obj.javaClass.name; val getMethods = obj::class.java.declaredMethods .filter { it.getAnnotation(HttpGET::class.java) != null } .map { Pair(it, it.getAnnotation(HttpGET::class.java)!!) } diff --git a/app/src/main/java/com/futo/platformplayer/api/media/structures/SingleAsyncItemPager.kt b/app/src/main/java/com/futo/platformplayer/api/media/structures/SingleAsyncItemPager.kt index 592ce2e5..fb504ad9 100644 --- a/app/src/main/java/com/futo/platformplayer/api/media/structures/SingleAsyncItemPager.kt +++ b/app/src/main/java/com/futo/platformplayer/api/media/structures/SingleAsyncItemPager.kt @@ -41,7 +41,7 @@ class SingleAsyncItemPager { fun getCurrentItem(scope: CoroutineScope) : Deferred? { synchronized(_requestedPageItems) { if (_currentResultPos >= _requestedPageItems.size) { - val startPos = fillDeferredUntil(_currentResultPos); + fillDeferredUntil(_currentResultPos); if(!_pager.hasMorePages()) { Logger.i("SingleAsyncItemPager", "end of async page reached"); completeRemainder { it?.complete(null) }; @@ -49,7 +49,7 @@ class SingleAsyncItemPager { if(_isRequesting) return _requestedPageItems[_currentResultPos]; _isRequesting = true; - StateApp.instance.scopeOrNull?.launch(Dispatchers.IO) { + scope.launch(Dispatchers.IO) { try { Logger.i("SingleAsyncItemPager", "Started Pager"); val timeForPage = measureTimeMillis { _pager.nextPage() }; diff --git a/app/src/main/java/com/futo/platformplayer/engine/V8Plugin.kt b/app/src/main/java/com/futo/platformplayer/engine/V8Plugin.kt index 7517bddd..95ad1b3a 100644 --- a/app/src/main/java/com/futo/platformplayer/engine/V8Plugin.kt +++ b/app/src/main/java/com/futo/platformplayer/engine/V8Plugin.kt @@ -269,7 +269,7 @@ class V8Plugin { throwExceptionFromV8( config, result.getOrThrow(config, "plugin_type", "V8Plugin"), - result.getOrThrow(config, "message", "V8Plugin"), + context + ":" + result.getOrThrow(config, "message", "V8Plugin"), null, null, codeStripped @@ -280,7 +280,7 @@ class V8Plugin { return result; } catch(scriptEx: JavetCompilationException) { - throw ScriptCompilationException(config, "Compilation: ${scriptEx.message}\n(${scriptEx.scriptingError.lineNumber})[${scriptEx.scriptingError.startColumn}-${scriptEx.scriptingError.endColumn}]: ${scriptEx.scriptingError.sourceLine}", null, codeStripped); + throw ScriptCompilationException(config, "Compilation: [${context}]: ${scriptEx.message}\n(${scriptEx.scriptingError.lineNumber})[${scriptEx.scriptingError.startColumn}-${scriptEx.scriptingError.endColumn}]: ${scriptEx.scriptingError.sourceLine}", null, codeStripped); } catch(executeEx: JavetExecutionException) { if(executeEx.scriptingError?.context?.containsKey("plugin_type") == true) { diff --git a/app/src/main/java/com/futo/platformplayer/states/StateApp.kt b/app/src/main/java/com/futo/platformplayer/states/StateApp.kt index 771c98b0..45e8e069 100644 --- a/app/src/main/java/com/futo/platformplayer/states/StateApp.kt +++ b/app/src/main/java/com/futo/platformplayer/states/StateApp.kt @@ -731,7 +731,6 @@ class StateApp { StatePlatform.instance.reloadClient(context, client.config.id); } catch (e: Throwable) { Logger.e(SourceDetailFragment.TAG, "Failed to reload client.", e) - return@launch; } } } diff --git a/app/src/main/java/com/futo/platformplayer/states/StatePlatform.kt b/app/src/main/java/com/futo/platformplayer/states/StatePlatform.kt index d82d6eff..a9aae85d 100644 --- a/app/src/main/java/com/futo/platformplayer/states/StatePlatform.kt +++ b/app/src/main/java/com/futo/platformplayer/states/StatePlatform.kt @@ -676,7 +676,7 @@ class StatePlatform { } } - fun getChannelContent(baseClient: IPlatformClient, channelUrl: String, isSubscriptionOptimized: Boolean = false, usePooledClients: Int = 0, ignorePlugins: List? = null): IPager { + fun getChannelContent(baseClient: IPlatformClient, channelUrl: String, isSubscriptionOptimized: Boolean = false, usePooledClients: Int = 0): IPager { val clientCapabilities = baseClient.getChannelCapabilities(); val client = if(usePooledClients > 1) _channelClientPool.getClientPooled(baseClient, usePooledClients); @@ -796,7 +796,7 @@ class StatePlatform { fun getChannelContent(channelUrl: String, isSubscriptionOptimized: Boolean = false, usePooledClients: Int = 0, ignorePlugins: List? = null): IPager { Logger.i(TAG, "Platform - getChannelVideos"); val baseClient = getChannelClient(channelUrl, ignorePlugins); - return getChannelContent(baseClient, channelUrl, isSubscriptionOptimized, usePooledClients, ignorePlugins); + return getChannelContent(baseClient, channelUrl, isSubscriptionOptimized, usePooledClients); } fun getChannelContent(channelUrl: String, type: String?, ordering: String = ResultCapabilities.ORDER_CHONOLOGICAL): IPager { val client = getChannelClient(channelUrl); @@ -899,18 +899,13 @@ class StatePlatform { devId = newClient.devID; try { StateDeveloper.instance.initializeDev(devId!!); - var didEnable = false; if (isPrimary) { _primaryClientObj = newClient; _enabledClients.add(0, newClient); newClient.initialize(); - didEnable = true; } else if (isEnabled) { _enabledClients.add(newClient); - if(!didEnable) { - newClient.initialize(); - didEnable = true; - } + newClient.initialize(); } _availableClients.add(newClient); } catch (ex: Exception) { diff --git a/app/src/main/java/com/futo/platformplayer/subscription/SimpleSubscriptionAlgorithm.kt b/app/src/main/java/com/futo/platformplayer/subscription/SimpleSubscriptionAlgorithm.kt index f4a9818e..496dd572 100644 --- a/app/src/main/java/com/futo/platformplayer/subscription/SimpleSubscriptionAlgorithm.kt +++ b/app/src/main/java/com/futo/platformplayer/subscription/SimpleSubscriptionAlgorithm.kt @@ -153,7 +153,7 @@ class SimpleSubscriptionAlgorithm( try { val platformClient = StatePlatform.instance.getChannelClientOrNull(url, toIgnore) ?: continue; val time = measureTimeMillis { - pager = StatePlatform.instance.getChannelContent(platformClient, url, true, threadPool.poolSize, toIgnore); + pager = StatePlatform.instance.getChannelContent(platformClient, url, true, threadPool.poolSize); pager = StateCache.cachePagerResults(scope, pager!!) { onNewCacheHit.emit(sub, it); };