Skip to content
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
4 changes: 2 additions & 2 deletions app/app/build.gradle.kts
Original file line number Diff line number Diff line change
Expand Up @@ -46,8 +46,8 @@ android {
applicationId = "com.github.livingwithhippos.unchained"
minSdk = 27
targetSdk = 36
versionCode = 57
versionName = "1.6.0"
versionCode = 58
versionName = "1.6.1"

testInstrumentationRunner = "androidx.test.runner.AndroidJUnitRunner"
}
Expand Down
11 changes: 2 additions & 9 deletions app/app/proguard-rules.pro
Original file line number Diff line number Diff line change
Expand Up @@ -39,12 +39,5 @@
-dontwarn org.openjsse.net.ssl.OpenJSSE
-dontwarn aQute.bnd.annotation.spi.ServiceProvider

# Please add these rules to your existing keep rules in order to suppress warnings.
# This is generated automatically by the Android Gradle plugin.
-dontwarn javax.xml.stream.FactoryConfigurationError
-dontwarn javax.xml.stream.Location
-dontwarn javax.xml.stream.XMLEventFactory
-dontwarn javax.xml.stream.XMLInputFactory
-dontwarn javax.xml.stream.XMLOutputFactory
-dontwarn javax.xml.stream.XMLResolver
-dontwarn javax.xml.stream.util.XMLEventAllocator
# Keep Protobuf Lite generated classes
-keep class * extends com.google.protobuf.GeneratedMessageLite { *; }
Original file line number Diff line number Diff line change
Expand Up @@ -56,6 +56,11 @@ interface RepositoryDataDao {
)
suspend fun getEnabledPlugins(): Map<RepositoryInfo, List<RepositoryPlugin>>

@Query("SELECT * FROM plugin WHERE plugin.search_enabled = 1")
suspend fun getEnabledPluginsOnly(): List<RepositoryPlugin>

@Query("SELECT * FROM plugin") suspend fun getAllPlugins(): List<RepositoryPlugin>

@Query(
"SELECT * FROM repository_info JOIN " +
"plugin ON plugin.repository = repository_info.link " +
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -118,7 +118,14 @@ constructor(private val repositoryDataDao: RepositoryDataDao) {
suspend fun getEnabledPlugins(): Map<RepositoryInfo, List<RepositoryPlugin>> =
repositoryDataDao.getEnabledPlugins()

suspend fun getEnabledPluginsOnly(): List<RepositoryPlugin> =
repositoryDataDao.getEnabledPluginsOnly()

suspend fun getAllPlugins(): List<RepositoryPlugin> = repositoryDataDao.getAllPlugins()

suspend fun enablePlugin(name: String, enabled: Boolean) {
repositoryDataDao.enablePlugin(name, enabled)
// since in the db they are stored in lowercase, we need to convert the name to lowercase
// before updating
repositoryDataDao.enablePlugin(name.lowercase(), enabled)
}
}
Original file line number Diff line number Diff line change
Expand Up @@ -99,7 +99,7 @@ constructor(
}

fun getDefaultPlayer(): String? {
return preferences.getString("default_media_player", null)
return preferences.getString("default_media_player", "vlc")
}

fun getButtonVisibilityPreference(buttonKey: String, default: Boolean = true): Boolean {
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -48,13 +48,19 @@ class PluginSearchFragment : UnchainedFragment(), SearchItemListener {

setup(binding)

viewModel.pluginLiveData.observe(viewLifecycleOwner) { parsedPlugins ->
viewModel.pluginLiveData.observe(viewLifecycleOwner) { event ->
val parsedPlugins = event.getContentIfNotHandled() ?: return@observe
setupAndShowSheet(inflater, parsedPlugins)
}

return binding.root
}

override fun onResume() {
context?.let { viewModel.fetchPluginsAndServices(it, show = false) }
super.onResume()
}

override fun onDestroyView() {
super.onDestroyView()
_binding = null
Expand All @@ -68,9 +74,10 @@ class PluginSearchFragment : UnchainedFragment(), SearchItemListener {
sideSheetDialog.setContentView(R.layout.sidesheet_search_plugins_options)

sideSheetDialog.findViewById<Button>(R.id.btnOpenRepositories)?.setOnClickListener {
binding.tiSearch.hideKeyboard()
sideSheetDialog.dismiss()
val action = PluginSearchFragmentDirections.actionPluginSearchToPluginsRepository()
findNavController().navigate(action)
sideSheetDialog.dismiss()
}

sideSheetDialog.findViewById<Button>(R.id.closeButton)?.setOnClickListener {
Expand Down Expand Up @@ -154,7 +161,9 @@ class PluginSearchFragment : UnchainedFragment(), SearchItemListener {
orderPicker.setText(currentOrder, false)
}

sideSheetDialog.show()
if (pluginsAndServices.showSheet) {
sideSheetDialog.show()
}
}

private fun stringToCategory(pickerText: String): String {
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -73,15 +73,16 @@ class SearchFragment : UnchainedFragment(), SearchItemListener {
findNavController().navigate(action)
}

viewModel.pluginLiveData.observe(viewLifecycleOwner) { parsedPlugins ->
val plugins = parsedPlugins.plugins
if (parsedPlugins.errors > 0)
viewModel.pluginLiveData.observe(viewLifecycleOwner) { event ->
val plugins = event.peekContent().plugins
val errors = event.peekContent().errors
if (errors > 0)
requireContext()
.showToast(
resources.getQuantityString(
R.plurals.plugins_version_old_format,
parsedPlugins.errors,
parsedPlugins.errors,
errors,
errors,
)
)

Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -21,7 +21,9 @@ import com.github.livingwithhippos.unchained.plugins.ParserResult
import com.github.livingwithhippos.unchained.plugins.model.Plugin
import com.github.livingwithhippos.unchained.plugins.model.ScrapedItem
import com.github.livingwithhippos.unchained.settings.view.SettingsFragment.Companion.KEY_USE_DOH
import com.github.livingwithhippos.unchained.utilities.Event
import com.github.livingwithhippos.unchained.utilities.extension.cancelIfActive
import com.github.livingwithhippos.unchained.utilities.postEvent
import dagger.hilt.android.lifecycle.HiltViewModel
import javax.inject.Inject
import kotlinx.coroutines.Job
Expand Down Expand Up @@ -49,7 +51,7 @@ constructor(
// used to simulate a debounce effect while typing on the search bar
private var job: Job? = null

val pluginLiveData = MutableLiveData<PluginsAndServices>()
val pluginLiveData = MutableLiveData<Event<PluginsAndServices>>()
private val parsingLiveData = MutableLiveData<ParserResult>()

fun completeSearch(
Expand All @@ -59,7 +61,8 @@ constructor(
page: Int = 1,
): LiveData<ParserResult> {

val plugin = pluginLiveData.value?.plugins?.firstOrNull { it.name == pluginName }
val plugin =
pluginLiveData.value?.peekContent()?.plugins?.firstOrNull { it.name == pluginName }
if (plugin != null) {
val results = mutableListOf<ScrapedItem>()
// empty saved results on new searches
Expand Down Expand Up @@ -112,7 +115,7 @@ constructor(
pluginsResult.first.map { plugin ->
plugin.copy(selected = selectedPlugins.contains(plugin.name))
}
pluginLiveData.postValue(
pluginLiveData.postEvent(
PluginsAndServices(
plugins = pluginsWithSelection,
services = emptyList(),
Expand All @@ -123,22 +126,23 @@ constructor(
}
}

fun fetchPluginsAndServices(context: Context) {
fun fetchPluginsAndServices(context: Context, show: Boolean = true) {
viewModelScope.launch {
val pluginsResult: Pair<List<Plugin>, Int> = pluginRepository.getPlugins(context)
val selectedPlugins =
databasePluginsRepository.getEnabledPlugins().values.flatten().map { it.name }
databasePluginsRepository.getEnabledPluginsOnly().map { it.name.lowercase() }
val pluginsWithSelection =
pluginsResult.first.map { plugin ->
plugin.copy(selected = selectedPlugins.contains(plugin.name))
plugin.copy(selected = selectedPlugins.contains(plugin.name.lowercase()))
}
val services =
serviceRepository.getServicesTypes(types = listOf(RemoteServiceType.JACKETT.value))
pluginLiveData.postValue(
pluginLiveData.postEvent(
PluginsAndServices(
plugins = pluginsWithSelection,
services = services,
errors = pluginsResult.second,
showSheet = show,
)
)
}
Expand Down Expand Up @@ -236,7 +240,9 @@ constructor(
val enabledPlugins: List<Plugin> =
databasePluginsRepository.getEnabledPlugins().values.flatten().mapNotNull {
repoPlugin ->
pluginLiveData.value?.plugins?.firstOrNull { it.name == repoPlugin.name }
pluginLiveData.value?.peekContent()?.plugins?.firstOrNull {
it.name == repoPlugin.name
}
}
// todo add repo with suspend to access the db of complete remote servceis
val enabledServices =
Expand Down Expand Up @@ -337,4 +343,5 @@ data class PluginsAndServices(
val plugins: List<Plugin>,
val services: List<CompleteRemoteService>,
val errors: Int,
val showSheet: Boolean = true,
)
9 changes: 9 additions & 0 deletions fastlane/metadata/android/en-US/changelogs/58.txt
Original file line number Diff line number Diff line change
@@ -0,0 +1,9 @@
What's new in 1.6.1:
- updated links supported by the app
- fixed credentials lost on rotate
- fixed some crashes
- filtering files in folder now case insensitive
- added jackett support for searching
- aadded new plugin search page
- fixed plugins marked as manually installed
- use disabled plugins information