Skip to content

Commit

Permalink
chore: Remove unused Annotations
Browse files Browse the repository at this point in the history
  • Loading branch information
khaled-0 committed Jul 5, 2024
1 parent 78a7d92 commit c88a7b7
Show file tree
Hide file tree
Showing 8 changed files with 11 additions and 24 deletions.
7 changes: 2 additions & 5 deletions .idea/misc.xml

Some generated files are not rendered by default. Learn more about how customized files appear on GitHub.

2 changes: 1 addition & 1 deletion README.md
Original file line number Diff line number Diff line change
@@ -1,4 +1,4 @@
<img src="https://raw.githubusercontent.com/khaled-0/LeanStream/main/play_hi_res_512.png" height="128px" align="left">
<img src="https://raw.githubusercontent.com/khaled-0/LeanStream/main/play_hi_res_512.png" height="128px" align="left" alt="logo">

# LeanStream

Expand Down
6 changes: 3 additions & 3 deletions app/build.gradle.kts
Original file line number Diff line number Diff line change
Expand Up @@ -87,9 +87,6 @@ android {
dependencies {
implementation("androidx.core:core-ktx:1.13.1")

implementation("org.jetbrains.kotlinx:kotlinx-serialization-core:1.6.3")
implementation("org.jetbrains.kotlinx:kotlinx-serialization-cbor:1.6.3")

implementation("androidx.core:core-splashscreen:1.0.1")

implementation(platform("androidx.compose:compose-bom:2024.06.00"))
Expand All @@ -108,6 +105,9 @@ dependencies {
implementation("com.github.anilbeesetti.nextlib:nextlib-media3ext:0.7.1")
implementation("com.github.anilbeesetti.nextlib:nextlib-mediainfo:0.7.1")

implementation("org.jetbrains.kotlinx:kotlinx-serialization-core:1.6.3")
implementation("org.jetbrains.kotlinx:kotlinx-serialization-cbor:1.6.3")


implementation("com.github.bjoernpetersen:m3u-parser:1.4.0")
coreLibraryDesugaring("com.android.tools:desugar_jdk_libs_nio:2.0.4")
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -41,7 +41,6 @@ import dev.khaled.leanstream.channels.item.ChannelsGrid
import dev.khaled.leanstream.isRunningOnTV
import dev.khaled.leanstream.playSoundEffectOnFocus
import dev.khaled.leanstream.ui.Branding
import kotlinx.serialization.ExperimentalSerializationApi


@OptIn(ExperimentalMaterial3Api::class)
Expand Down Expand Up @@ -133,12 +132,11 @@ fun ChannelPickerScreen(
}
}

@OptIn(ExperimentalSerializationApi::class)
fun resetChannelsListConfirmation(context: Context, viewModel: ChannelViewModel) {
AlertDialog.Builder(context).setTitle("Reset Channels")
.setMessage("Do you really want to remove imported channels?")
.setPositiveButton("Yes") { _, _ ->
viewModel.savePlaylistToDisk(context, emptyList());
viewModel.savePlaylistToDisk(context, emptyList())
Toast.makeText(context, "Restart Application To Take Effect", Toast.LENGTH_SHORT).show()
}.setNegativeButton("No", null).show()
}
Original file line number Diff line number Diff line change
Expand Up @@ -8,7 +8,6 @@ import androidx.compose.runtime.mutableStateOf
import androidx.compose.runtime.setValue
import androidx.lifecycle.AndroidViewModel
import androidx.lifecycle.viewModelScope
import androidx.media3.common.util.UnstableApi
import kotlinx.coroutines.launch
import kotlinx.serialization.ExperimentalSerializationApi
import kotlinx.serialization.Serializable
Expand All @@ -19,9 +18,6 @@ import net.bjoernpetersen.m3u.M3uParser
import net.bjoernpetersen.m3u.model.M3uEntry
import java.io.File
import java.net.URL
import kotlin.OptIn
import androidx.annotation.OptIn as AndroidxAnnotationOptIn


@Serializable
data class Channel(val title: String?, val url: String, val icon: String?, val category: String?)
Expand Down Expand Up @@ -71,7 +67,6 @@ class ChannelViewModel(application: Application) : AndroidViewModel(application)
viewModelScope.launch { load(application.applicationContext) }
}

@OptIn(ExperimentalSerializationApi::class)
fun load(context: Context) {
_isLoading = true

Expand All @@ -87,7 +82,7 @@ class ChannelViewModel(application: Application) : AndroidViewModel(application)
_isLoading = false
}

@ExperimentalSerializationApi
@OptIn(ExperimentalSerializationApi::class)
fun savePlaylistToDisk(context: Context, channels: List<Channel> = _channels) {
if (!channelFile(context).exists()) channelFile(context).createNewFile()
val outputStream = context.openFileOutput(
Expand All @@ -97,8 +92,8 @@ class ChannelViewModel(application: Application) : AndroidViewModel(application)
outputStream.close()
}

@ExperimentalSerializationApi
fun loadPlaylistFromDisk(context: Context) {
@OptIn(ExperimentalSerializationApi::class)
private fun loadPlaylistFromDisk(context: Context) {
if (!channelFile(context).exists()) channelFile(context).createNewFile()
val fileInputStream = context.openFileInput(channelFile(context).name)
val bytes = fileInputStream.readBytes()
Expand All @@ -108,7 +103,6 @@ class ChannelViewModel(application: Application) : AndroidViewModel(application)
_channels.addAll(Cbor.decodeFromByteArray<List<Channel>>(bytes))
}

@AndroidxAnnotationOptIn(UnstableApi::class)
fun parsePlaylist(playlistUrl: String): List<Channel> {
val input = URL(playlistUrl).openStream().reader()
val streamEntries: List<M3uEntry> = M3uParser.parse(input)
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -24,7 +24,6 @@ import androidx.compose.ui.unit.dp
import dev.khaled.leanstream.channels.ChannelCategory
import dev.khaled.leanstream.playSoundEffectOnFocus

@OptIn(ExperimentalComposeUiApi::class)
@Composable
fun CategoryFilterRow(
channelCategories: List<ChannelCategory>,
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -32,7 +32,7 @@ import kotlinx.coroutines.Dispatchers
import kotlinx.coroutines.launch
import kotlinx.serialization.ExperimentalSerializationApi

@OptIn(ExperimentalSerializationApi::class, ExperimentalMaterial3Api::class)
@OptIn(ExperimentalSerializationApi::class)
@Composable
fun ImportPlaylistDialog(
onDismiss: (success: Boolean) -> Unit,
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -39,7 +39,6 @@ import dev.khaled.leanstream.conditional
import dev.khaled.leanstream.isRunningOnTV
import dev.khaled.leanstream.playSoundEffectOnFocus

@OptIn(ExperimentalTvMaterial3Api::class)
@Composable
fun GridItem(
channel: Channel,
Expand Down

0 comments on commit c88a7b7

Please sign in to comment.