From e81b06dad0fa3872efad55264b207f4806559edc Mon Sep 17 00:00:00 2001
From: professorDeveloper
<108933534+professorDeveloper@users.noreply.github.com>
Date: Tue, 3 Nov 2026 14:56:38 +0500
Subject: [PATCH 1/6] Android TV: a watch party survives an HDR or HDMI mode
switch
WatchPartyActivity declared no configChanges, so a uiMode, density or screen change recreated it, and onDestroy leaves the room, releases the player and stops the proxy. It now declares the same set as the other players, and the players comment sits above it again.
---
app/src/main/AndroidManifest.xml | 3 ++-
1 file changed, 2 insertions(+), 1 deletion(-)
diff --git a/app/src/main/AndroidManifest.xml b/app/src/main/AndroidManifest.xml
index 9ab00e96..ff1caf39 100644
--- a/app/src/main/AndroidManifest.xml
+++ b/app/src/main/AndroidManifest.xml
@@ -57,9 +57,10 @@
android:supportsRtl="true"
android:theme="@style/Theme.Tv"
android:usesCleartextTraffic="true">
-
+
Date: Tue, 3 Nov 2026 14:56:38 +0500
Subject: [PATCH 2/6] Live TV: drop the Adlt tab, and do not crash on a
bookmarked channel with no stream
The tab played two hard-coded streams whose tokens expired in 2025, and one token carried a third party's peers.tv session. The Bookmarks grid indexed iptvUrls[0] without a check; it now shows the same no-stream toast the Live TV grid does.
---
.../screens/bookmark/BookmarkScreen.kt | 8 ++++++-
.../screens/tv_garden/TvGardenScreen.kt | 23 +++++++------------
.../com/saikou/sozo_tv/utils/LocalData.kt | 19 ---------------
3 files changed, 15 insertions(+), 35 deletions(-)
diff --git a/app/src/main/java/com/saikou/sozo_tv/presentation/screens/bookmark/BookmarkScreen.kt b/app/src/main/java/com/saikou/sozo_tv/presentation/screens/bookmark/BookmarkScreen.kt
index 7a7ae037..5c3a49dc 100644
--- a/app/src/main/java/com/saikou/sozo_tv/presentation/screens/bookmark/BookmarkScreen.kt
+++ b/app/src/main/java/com/saikou/sozo_tv/presentation/screens/bookmark/BookmarkScreen.kt
@@ -5,6 +5,7 @@ import android.os.Bundle
import android.view.LayoutInflater
import android.view.View
import android.view.ViewGroup
+import android.widget.Toast
import androidx.fragment.app.Fragment
import androidx.recyclerview.widget.GridLayoutManager
import androidx.recyclerview.widget.RecyclerView
@@ -48,8 +49,13 @@ class BookmarkScreen : Fragment() {
private var channelCount = 0
private val channelsAdapter by lazy {
ChannelsAdapter {
+ val url = it.iptvUrls.firstOrNull()
+ if (url == null) {
+ Toast.makeText(requireContext(), getString(R.string.no_stream_available), Toast.LENGTH_SHORT).show()
+ return@ChannelsAdapter
+ }
val intent = Intent(requireContext(), LiveTvActivity::class.java)
- intent.putExtra("url", it.iptvUrls[0])
+ intent.putExtra("url", url)
intent.putExtra("title", it.name)
intent.putExtra("data", it)
requireActivity().startActivity(intent)
diff --git a/app/src/main/java/com/saikou/sozo_tv/presentation/screens/tv_garden/TvGardenScreen.kt b/app/src/main/java/com/saikou/sozo_tv/presentation/screens/tv_garden/TvGardenScreen.kt
index 2c8ff894..f7e112c1 100644
--- a/app/src/main/java/com/saikou/sozo_tv/presentation/screens/tv_garden/TvGardenScreen.kt
+++ b/app/src/main/java/com/saikou/sozo_tv/presentation/screens/tv_garden/TvGardenScreen.kt
@@ -131,9 +131,7 @@ class TvGardenScreen : Fragment() {
binding.tabRv.visible()
binding.progressBar.pbIsLoading.gone()
binding.progressBar.root.gone()
- val data = ArrayList(categories.map { it.name })
- data.add("Adlt")
- categoriesAdapter.submitList(data)
+ categoriesAdapter.submitList(ArrayList(categories.map { it.name }))
categoryList.clear()
categoryList.addAll(categories)
val restored = categoryList.getOrNull(selectedPosCat - 1)
@@ -177,19 +175,14 @@ class TvGardenScreen : Fragment() {
}
categoriesAdapter.setFocusedItemListener { s, i ->
if (model.currentSort != "Custom List") {
- if (s != "Adlt") {
- if (model.isCountrySelected) {
- val findCategory = countryList.find { it.name == s }
- selectedPosCount = i
- findCategory?.let { model.loadChannelsByCountry(it) }
- } else {
- selectedPosCat = i
- val findCategory = categoryList.find { it.name == s }
- findCategory?.let { model.loadChannelsByCategory(it) }
- }
+ if (model.isCountrySelected) {
+ val findCategory = countryList.find { it.name == s }
+ selectedPosCount = i
+ findCategory?.let { model.loadChannelsByCountry(it) }
} else {
- channelsAdapter.updateChannels(LocalData.channelsd)
-
+ selectedPosCat = i
+ val findCategory = categoryList.find { it.name == s }
+ findCategory?.let { model.loadChannelsByCategory(it) }
}
} else {
channelsAdapter.updateChannels(
diff --git a/app/src/main/java/com/saikou/sozo_tv/utils/LocalData.kt b/app/src/main/java/com/saikou/sozo_tv/utils/LocalData.kt
index 8ff38350..30137819 100644
--- a/app/src/main/java/com/saikou/sozo_tv/utils/LocalData.kt
+++ b/app/src/main/java/com/saikou/sozo_tv/utils/LocalData.kt
@@ -53,25 +53,6 @@ object LocalData {
)
val preferenceManager = PreferenceManager()
var isAnimeEnabled = preferenceManager.isModeAnimeEnabled()
- val channelsd = arrayListOf(
- Channel(
- "0",
- "Hd Romen",
- arrayListOf("https://live-hls-viasat-secure-flus.cdnvideo.ru/viasat/Romantika_HD.smil/tracks-v1a1/mono.ts.m3u8?filter.tracks=v1v2v3a1&md5=rdVBBlP29FodZn8yAdHzGg&e=1759654086&hls_proxy_host=e2c000defa6aa845b219ba5ca0db8ad5"),
- arrayListOf(),
- "cdn",
- "cdn",
- true
- ), Channel(
- "0",
- "lubimoe-kino",
- arrayListOf("http://api.peers.tv/timeshift/favmovie/16/playlist.m3u8?token=eyJhbGciOiJIUzI1NiIsInR5cCI6IkpXVCJ9.eyJhdWQiOiJhY2Nlc3MiLCJleHAiOjE3NTkyMDU3ODAsImlhdCI6MTc1OTExOTM4MCwiY2lkIjo2LCJ1aWQiOjk0ODcxNzUzOCwicmVnIjpmYWxzZSwiaXAiOjE1NTE3MDQzNTYsImFkdWx0IjpmYWxzZX0.aXpZsmnvRME-UQwL1Sf_KYgJNTk8_DfR3tU--mZb9JI&offset=3"),
- arrayListOf(),
- "lubimoe-kino",
- "lubimoe-kino",
- true
- )
- )
val channelsByCategory: Map> = mapOf(
"NASA" to listOf(
Channel(
From 0d29d52a17fb13393343aea3810e3f20b85c4464 Mon Sep 17 00:00:00 2001
From: professorDeveloper
<108933534+professorDeveloper@users.noreply.github.com>
Date: Tue, 3 Nov 2026 14:56:38 +0500
Subject: [PATCH 3/6] Home: no View All card on a section that has nowhere to
go
A section without viewAll was given the slug "::", so its View All card paged GET /contents/ or getCategory("") and landed on an empty grid. Such sections now carry no slug, and the card is only added when there is one.
---
.../sozo_tv/engine/server/ServerHost.kt | 14 ++++++++----
.../presentation/screens/home/HomeAdapter.kt | 3 ++-
.../sozo_tv/engine/server/ViewAllSlugTest.kt | 22 +++++++++++++++++++
3 files changed, 34 insertions(+), 5 deletions(-)
create mode 100644 app/src/test/java/com/saikou/sozo_tv/engine/server/ViewAllSlugTest.kt
diff --git a/app/src/main/java/com/saikou/sozo_tv/engine/server/ServerHost.kt b/app/src/main/java/com/saikou/sozo_tv/engine/server/ServerHost.kt
index 1516596f..cdc81fde 100644
--- a/app/src/main/java/com/saikou/sozo_tv/engine/server/ServerHost.kt
+++ b/app/src/main/java/com/saikou/sozo_tv/engine/server/ServerHost.kt
@@ -312,13 +312,11 @@ class ServerHost(
val s = sectionsIn.optJSONObject(i) ?: continue
val items = cards(s.optJSONArray("items"), bareProvider)
if (items.length() == 0) continue
- val va = s.optJSONObject("viewAll")
- val type = va?.optString("type").orEmpty()
- val slug = va?.optString("slug").orEmpty()
+ val viewAll = viewAllSlug(s.optJSONObject("viewAll"))
sectionsOut.put(JSONObject().apply {
put("key", s.optString("key"))
put("label", s.optString("label"))
- put("viewAll", JSONObject().put("slug", "$type::$slug"))
+ if (viewAll != null) put("viewAll", JSONObject().put("slug", viewAll))
put("items", items)
})
}
@@ -536,3 +534,11 @@ class ServerHost(
const val EXTRA_LANG_TIMEOUT_MS = 20_000L
}
}
+
+/** A section without a viewAll target would page "/contents/" or getCategory(""), so it gets none. */
+internal fun viewAllSlug(viewAll: JSONObject?): String? {
+ if (viewAll == null) return null
+ val type = if (viewAll.isNull("type")) "" else viewAll.optString("type")
+ val slug = if (viewAll.isNull("slug")) "" else viewAll.optString("slug")
+ return if (type.isEmpty() && slug.isEmpty()) null else "$type::$slug"
+}
diff --git a/app/src/main/java/com/saikou/sozo_tv/presentation/screens/home/HomeAdapter.kt b/app/src/main/java/com/saikou/sozo_tv/presentation/screens/home/HomeAdapter.kt
index 8ba31599..710fd2c3 100644
--- a/app/src/main/java/com/saikou/sozo_tv/presentation/screens/home/HomeAdapter.kt
+++ b/app/src/main/java/com/saikou/sozo_tv/presentation/screens/home/HomeAdapter.kt
@@ -482,7 +482,8 @@ class HomeAdapter :
fun bind(item: Category) {
binding.tvCategoryTitle.text = item.name
- val listWithViewAll: List = item.list + ViewAllData(
+ val listWithViewAll: List = if (item.slug.isNullOrEmpty()) item.list
+ else item.list + ViewAllData(
rowId = item.rowId,
categoryTitle = item.name,
slug = item.slug
diff --git a/app/src/test/java/com/saikou/sozo_tv/engine/server/ViewAllSlugTest.kt b/app/src/test/java/com/saikou/sozo_tv/engine/server/ViewAllSlugTest.kt
new file mode 100644
index 00000000..59bf9fae
--- /dev/null
+++ b/app/src/test/java/com/saikou/sozo_tv/engine/server/ViewAllSlugTest.kt
@@ -0,0 +1,22 @@
+package com.saikou.sozo_tv.engine.server
+
+import org.json.JSONObject
+import org.junit.Assert.assertEquals
+import org.junit.Assert.assertNull
+import org.junit.Test
+
+class ViewAllSlugTest {
+ @Test fun sectionWithoutViewAllHasNoTarget() {
+ assertNull(viewAllSlug(null))
+ assertNull(viewAllSlug(JSONObject()))
+ assertNull(viewAllSlug(JSONObject().put("type", JSONObject.NULL).put("slug", "")))
+ }
+
+ @Test fun typeAloneIsATarget() {
+ assertEquals("latest::", viewAllSlug(JSONObject().put("type", "latest")))
+ }
+
+ @Test fun typeAndSlugAreJoined() {
+ assertEquals("category::ongoing", viewAllSlug(JSONObject().put("type", "category").put("slug", "ongoing")))
+ }
+}
From 5e10d12387ea7a603c43fb0985fa79d0ffcf2466 Mon Sep 17 00:00:00 2001
From: professorDeveloper
<108933534+professorDeveloper@users.noreply.github.com>
Date: Tue, 3 Nov 2026 14:56:38 +0500
Subject: [PATCH 4/6] Trust user-installed CAs in debug builds only
Release builds trusted any user-added CA, so one could intercept the app's own backend traffic, device-auth tokens included. Cleartext stays allowed for http sources.
---
app/src/main/res/xml/network_security_config.xml | 6 +++++-
1 file changed, 5 insertions(+), 1 deletion(-)
diff --git a/app/src/main/res/xml/network_security_config.xml b/app/src/main/res/xml/network_security_config.xml
index 64d3da96..f2102806 100644
--- a/app/src/main/res/xml/network_security_config.xml
+++ b/app/src/main/res/xml/network_security_config.xml
@@ -11,7 +11,11 @@
-
+
+
+
+
+
From d0c5aa289169b46ddf983491148b681d3c2fd475 Mon Sep 17 00:00:00 2001
From: professorDeveloper
<108933534+professorDeveloper@users.noreply.github.com>
Date: Tue, 3 Nov 2026 14:56:38 +0500
Subject: [PATCH 5/6] History: tie the sync and clear jobs to the view, not the
fragment
They ran on the fragment's lifecycleScope and wrote to the binding, so after onDestroyView they could touch a dead view, and a back-stack return started a second job alongside.
---
.../sozo_tv/presentation/screens/history/HistoryPage.kt | 4 ++--
1 file changed, 2 insertions(+), 2 deletions(-)
diff --git a/app/src/main/java/com/saikou/sozo_tv/presentation/screens/history/HistoryPage.kt b/app/src/main/java/com/saikou/sozo_tv/presentation/screens/history/HistoryPage.kt
index 7dc4328d..99b557b6 100644
--- a/app/src/main/java/com/saikou/sozo_tv/presentation/screens/history/HistoryPage.kt
+++ b/app/src/main/java/com/saikou/sozo_tv/presentation/screens/history/HistoryPage.kt
@@ -35,7 +35,7 @@ class HistoryPage : Fragment() {
@SuppressLint("SetTextI18n")
override fun onViewCreated(view: View, savedInstanceState: Bundle?) {
super.onViewCreated(view, savedInstanceState)
- lifecycleScope.launch {
+ viewLifecycleOwner.lifecycleScope.launch {
renderHistory()
if (model.syncHistoryNow()) renderHistory()
}
@@ -111,7 +111,7 @@ class HistoryPage : Fragment() {
}
private fun clearHistory() {
- lifecycleScope.launch {
+ viewLifecycleOwner.lifecycleScope.launch {
model.clearAllHistory()
renderHistory()
}
From 2fe377dc1373ebd78f79d9b51f1fdda70bcef632 Mon Sep 17 00:00:00 2001
From: professorDeveloper
<108933534+professorDeveloper@users.noreply.github.com>
Date: Tue, 3 Nov 2026 14:59:23 +0500
Subject: [PATCH 6/6] History: finish a clear and its sync even if the page
goes away mid-clear
The clear now runs on the page's view scope, so a view torn down between the tombstone and the delete could leave the tombstone without the follow-up sync. Running it on viewModelScope and joining keeps it whole.
---
.../sozo_tv/presentation/viewmodel/PlayAnimeViewModel.kt | 7 ++++---
1 file changed, 4 insertions(+), 3 deletions(-)
diff --git a/app/src/main/java/com/saikou/sozo_tv/presentation/viewmodel/PlayAnimeViewModel.kt b/app/src/main/java/com/saikou/sozo_tv/presentation/viewmodel/PlayAnimeViewModel.kt
index be8f754d..db837822 100644
--- a/app/src/main/java/com/saikou/sozo_tv/presentation/viewmodel/PlayAnimeViewModel.kt
+++ b/app/src/main/java/com/saikou/sozo_tv/presentation/viewmodel/PlayAnimeViewModel.kt
@@ -195,13 +195,14 @@ class PlayAnimeViewModel(
* made clearing look like it had failed. The server push still runs in the background.
*/
suspend fun clearAllHistory() {
- withContext(Dispatchers.IO) {
+ // On viewModelScope so a caller torn down mid-clear cannot leave the tombstone without its sync.
+ viewModelScope.launch(Dispatchers.IO) {
runCatching {
historySync.rememberClearedAll()
watchHistoryRepository.clearAllHistory()
}
- }
- viewModelScope.launch(Dispatchers.IO) { runCatching { historySync.sync() } }
+ viewModelScope.launch(Dispatchers.IO) { runCatching { historySync.sync() } }
+ }.join()
}
fun syncHistory() {