mirror of
				https://github.com/mihonapp/mihon.git
				synced 2025-11-04 08:08:55 +01:00 
			
		
		
		
	Relay extension changes to sources controller (fixes #3002)
This commit is contained in:
		@@ -12,6 +12,7 @@ import com.bluelinelabs.conductor.RouterTransaction
 | 
			
		||||
import com.bluelinelabs.conductor.support.RouterPagerAdapter
 | 
			
		||||
import com.google.android.material.badge.BadgeDrawable
 | 
			
		||||
import com.google.android.material.tabs.TabLayout
 | 
			
		||||
import com.jakewharton.rxrelay.PublishRelay
 | 
			
		||||
import eu.kanade.tachiyomi.R
 | 
			
		||||
import eu.kanade.tachiyomi.data.preference.PreferencesHelper
 | 
			
		||||
import eu.kanade.tachiyomi.databinding.PagerControllerBinding
 | 
			
		||||
@@ -41,6 +42,8 @@ class BrowseController :
 | 
			
		||||
 | 
			
		||||
    private val toExtensions = args.getBoolean(TO_EXTENSIONS_EXTRA, false)
 | 
			
		||||
 | 
			
		||||
    val extensionListUpdateRelay: PublishRelay<Boolean> = PublishRelay.create()
 | 
			
		||||
 | 
			
		||||
    private var adapter: BrowseAdapter? = null
 | 
			
		||||
 | 
			
		||||
    override fun getTitle(): String? {
 | 
			
		||||
 
 | 
			
		||||
@@ -181,7 +181,9 @@ open class ExtensionController :
 | 
			
		||||
        drawExtensions()
 | 
			
		||||
 | 
			
		||||
        // Update badge on parent controller tab
 | 
			
		||||
        (parentController as BrowseController).setExtensionUpdateBadge()
 | 
			
		||||
        val ctrl = parentController as BrowseController
 | 
			
		||||
        ctrl.setExtensionUpdateBadge()
 | 
			
		||||
        ctrl.extensionListUpdateRelay.call(true)
 | 
			
		||||
    }
 | 
			
		||||
 | 
			
		||||
    private fun drawExtensions() {
 | 
			
		||||
 
 | 
			
		||||
@@ -92,6 +92,12 @@ class SourceController :
 | 
			
		||||
        adapter?.fastScroller = binding.fastScroller
 | 
			
		||||
 | 
			
		||||
        requestPermissionsSafe(arrayOf(WRITE_EXTERNAL_STORAGE), 301)
 | 
			
		||||
 | 
			
		||||
        // Update list on extension changes (e.g. new installation)
 | 
			
		||||
        (parentController as BrowseController).extensionListUpdateRelay
 | 
			
		||||
            .subscribeUntilDestroy {
 | 
			
		||||
                presenter.updateSources()
 | 
			
		||||
            }
 | 
			
		||||
    }
 | 
			
		||||
 | 
			
		||||
    override fun onDestroyView(view: View) {
 | 
			
		||||
 
 | 
			
		||||
		Reference in New Issue
	
	Block a user