Skip to content

Commit

Permalink
fix: replace unstable parameters #23
Browse files Browse the repository at this point in the history
  • Loading branch information
oxyroid committed Nov 3, 2023
1 parent 426a93a commit 4921267
Show file tree
Hide file tree
Showing 50 changed files with 497 additions and 854 deletions.
Original file line number Diff line number Diff line change
Expand Up @@ -3337,7 +3337,7 @@ HSPLandroidx/compose/runtime/collection/MutableVector$VectorListIterator;->hasNe
PLandroidx/compose/runtime/collection/MutableVector$VectorListIterator;->hasNext()Z
HSPLandroidx/compose/runtime/collection/MutableVector$VectorListIterator;->next()Ljava/lang/Object;
PLandroidx/compose/runtime/collection/MutableVector$VectorListIterator;->next()Ljava/lang/Object;
Landroidx/compose/runtime/external/kotlinx/collections/immutable/ImmutableList;
Landroidx/compose/runtime/external/kotlinx/collections/immutable/List;
Landroidx/compose/runtime/external/kotlinx/collections/immutable/ImmutableSet;
Landroidx/compose/runtime/external/kotlinx/collections/immutable/PersistentList;
Landroidx/compose/runtime/external/kotlinx/collections/immutable/PersistentMap;
Expand Down
5 changes: 2 additions & 3 deletions androidApp/src/main/java/com/m3u/androidApp/MainActivity.kt
Original file line number Diff line number Diff line change
Expand Up @@ -32,7 +32,6 @@ import com.m3u.ui.Helper
import com.m3u.ui.OnPipModeChanged
import com.m3u.ui.OnUserLeaveHint
import dagger.hilt.android.AndroidEntryPoint
import kotlinx.collections.immutable.ImmutableList
import kotlinx.coroutines.launch
import kotlin.reflect.KMutableProperty0

Expand Down Expand Up @@ -74,7 +73,7 @@ class MainActivity : ComponentActivity() {

private fun helper(
title: Method<String>,
actions: Method<ImmutableList<Action>>,
actions: Method<List<Action>>,
fob: Method<Fob?>
): Helper = object : Helper {
override fun enterPipMode(size: Rect) {
Expand All @@ -85,7 +84,7 @@ class MainActivity : ComponentActivity() {
}

override var title: String by title
override var actions: ImmutableList<Action> by actions
override var actions: List<Action> by actions
override var fob: Fob? by fob
override var statusBarsVisibility: UBoolean = UBoolean.Unspecified
set(value) {
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -72,7 +72,7 @@ fun M3UNavHost(
navigateToLive = { id ->
navigate(Destination.Live(id))
},
navigateToPlayList = { ids, initial ->
navigateToPlaylist = { ids, initial ->
navigate(Destination.LivePlayList(ids, initial))
}
)
Expand Down
2 changes: 1 addition & 1 deletion androidApp/src/main/java/com/m3u/androidApp/ui/App.kt
Original file line number Diff line number Diff line change
Expand Up @@ -41,7 +41,7 @@ fun App(
AppScaffold(
title = title,
snacker = snacker,
actions = actions,
actionsFactory = { actions },
rootDestination = rootDestination,
fob = fob,
isSystemBarVisible = isSystemBarVisible,
Expand Down
4 changes: 2 additions & 2 deletions androidApp/src/main/java/com/m3u/androidApp/ui/AppScaffold.kt
Original file line number Diff line number Diff line change
Expand Up @@ -31,7 +31,6 @@ import com.m3u.ui.Fob
import com.m3u.ui.Helper
import com.m3u.ui.M3ULocalProvider
import com.m3u.ui.Navigate
import kotlinx.collections.immutable.ImmutableList
import kotlinx.coroutines.delay
import kotlinx.coroutines.launch
import kotlin.time.Duration.Companion.milliseconds
Expand All @@ -40,7 +39,7 @@ import kotlin.time.Duration.Companion.milliseconds
internal fun AppScaffold(
title: String,
snacker: String,
actions: ImmutableList<Action>,
actionsFactory: () -> List<Action>,
rootDestination: Destination.Root?,
fob: Fob?,
isSystemBarVisible: Boolean,
Expand Down Expand Up @@ -83,6 +82,7 @@ internal fun AppScaffold(
visible = isSystemBarVisible,
scrollable = isSystemBarScrollable,
actions = {
val actions = actionsFactory()
actions.withEach {
IconButton(
icon = icon,
Expand Down
4 changes: 2 additions & 2 deletions androidApp/src/main/java/com/m3u/androidApp/ui/AppState.kt
Original file line number Diff line number Diff line change
Expand Up @@ -24,7 +24,7 @@ import com.m3u.features.feed.navigation.navigateToFeed
import com.m3u.features.live.navigation.LIVE_PLAYLIST_ROUTE
import com.m3u.features.live.navigation.LIVE_ROUTE
import com.m3u.features.live.navigation.navigateToLive
import com.m3u.features.live.navigation.navigateToLivePlayList
import com.m3u.features.live.navigation.navigateToPlaylist
import com.m3u.ui.Destination

@Composable
Expand Down Expand Up @@ -90,7 +90,7 @@ class AppState(
is Destination.Feed -> navController.navigateToFeed(destination.url)
is Destination.Live -> navController.navigateToLive(destination.id)
is Destination.LivePlayList -> with(destination) {
navController.navigateToLivePlayList(ids, initial)
navController.navigateToPlaylist(ids, initial)
}

Destination.Console -> navController.navigateToConsole()
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -14,8 +14,6 @@ import com.m3u.ui.Action
import com.m3u.ui.Destination
import com.m3u.ui.Fob
import dagger.hilt.android.lifecycle.HiltViewModel
import kotlinx.collections.immutable.ImmutableList
import kotlinx.collections.immutable.persistentListOf
import kotlinx.coroutines.flow.MutableStateFlow
import kotlinx.coroutines.flow.update
import javax.inject.Inject
Expand All @@ -38,7 +36,7 @@ class AppViewModel @Inject constructor(
val snacker = uiService.snacker

val title: MutableStateFlow<String> = MutableStateFlow("")
val actions: MutableStateFlow<ImmutableList<Action>> = MutableStateFlow(persistentListOf())
val actions: MutableStateFlow<List<Action>> = MutableStateFlow(emptyList())
val fob: MutableStateFlow<Fob?> = MutableStateFlow(null)

override fun onEvent(event: Unit) {
Expand Down
2 changes: 1 addition & 1 deletion benchmark/build.gradle.kts
Original file line number Diff line number Diff line change
Expand Up @@ -5,7 +5,7 @@ plugins {

android {
namespace = "com.m3u.benchmark"
compileSdk = 33
compileSdk = 34

compileOptions {
sourceCompatibility = JavaVersion.VERSION_1_8
Expand Down
2 changes: 1 addition & 1 deletion core/build.gradle.kts
Original file line number Diff line number Diff line change
Expand Up @@ -7,7 +7,7 @@ plugins {

android {
namespace = "com.m3u.core"
compileSdk = 33
compileSdk = 34
defaultConfig {
minSdk = 26
testInstrumentationRunner = "androidx.test.runner.AndroidJUnitRunner"
Expand Down
3 changes: 0 additions & 3 deletions core/src/main/java/com/m3u/core/util/Collections.kt

This file was deleted.

2 changes: 1 addition & 1 deletion data/build.gradle.kts
Original file line number Diff line number Diff line change
Expand Up @@ -7,7 +7,7 @@ plugins {

android {
namespace = "com.m3u.data"
compileSdk = 33
compileSdk = 34
defaultConfig {
minSdk = 26
testInstrumentationRunner = "androidx.test.runner.AndroidJUnitRunner"
Expand Down
2 changes: 2 additions & 0 deletions data/src/main/java/com/m3u/data/database/entity/Feed.kt
Original file line number Diff line number Diff line change
@@ -1,12 +1,14 @@
package com.m3u.data.database.entity

import androidx.compose.runtime.Immutable
import androidx.room.ColumnInfo
import androidx.room.Entity
import androidx.room.PrimaryKey
import com.m3u.core.util.basic.startsWithAny

// called playlist in user interface
@Entity(tableName = "feeds")
@Immutable
data class Feed(
@ColumnInfo(name = "title")
val title: String,
Expand Down
2 changes: 2 additions & 0 deletions data/src/main/java/com/m3u/data/database/entity/Live.kt
Original file line number Diff line number Diff line change
@@ -1,12 +1,14 @@
package com.m3u.data.database.entity

import androidx.compose.runtime.Immutable
import androidx.room.ColumnInfo
import androidx.room.Entity
import androidx.room.PrimaryKey
import com.m3u.core.util.Likable

// called channel in user interface
@Entity(tableName = "lives")
@Immutable
data class Live(
@ColumnInfo(name = "url")
val url: String,
Expand Down
2 changes: 1 addition & 1 deletion dlna/build.gradle.kts
Original file line number Diff line number Diff line change
Expand Up @@ -5,7 +5,7 @@ plugins {

android {
namespace = "com.m3u.dlna"
compileSdk = 33
compileSdk = 34

defaultConfig {
minSdk = 26
Expand Down
2 changes: 1 addition & 1 deletion features/about/build.gradle.kts
Original file line number Diff line number Diff line change
Expand Up @@ -7,7 +7,7 @@ plugins {

android {
namespace = "com.m3u.features.about"
compileSdk = 33
compileSdk = 34
defaultConfig {
minSdk = 26
testInstrumentationRunner = "androidx.test.runner.AndroidJUnitRunner"
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -20,7 +20,6 @@ import com.m3u.i18n.R.string
import com.m3u.ui.LocalHelper
import com.m3u.ui.MonoText
import com.m3u.ui.repeatOnLifecycle
import kotlinx.collections.immutable.ImmutableList

@Composable
internal fun AboutRoute(
Expand All @@ -45,8 +44,8 @@ internal fun AboutRoute(

@Composable
private fun AboutScreen(
contributors: ImmutableList<Contributor>,
dependencies: ImmutableList<String>,
contributors: List<Contributor>,
dependencies: List<String>,
modifier: Modifier = Modifier
) {
val spacing = LocalSpacing.current
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -11,9 +11,6 @@ import com.m3u.data.api.GithubApi
import com.m3u.features.about.model.Contributor
import com.m3u.features.about.model.toContributor
import dagger.hilt.android.lifecycle.HiltViewModel
import kotlinx.collections.immutable.ImmutableList
import kotlinx.collections.immutable.persistentListOf
import kotlinx.collections.immutable.toPersistentList
import kotlinx.coroutines.Dispatchers
import kotlinx.coroutines.flow.MutableStateFlow
import kotlinx.coroutines.flow.StateFlow
Expand All @@ -32,11 +29,12 @@ class AboutViewModel @Inject constructor(
@Publisher.App private val publisher: Publisher,
private val logger: Logger
) : AndroidViewModel(application) {
private val _contributors: MutableStateFlow<ImmutableList<Contributor>> = MutableStateFlow(persistentListOf())
internal val contributors: StateFlow<ImmutableList<Contributor>> = _contributors.asStateFlow()
private val _contributors: MutableStateFlow<List<Contributor>> =
MutableStateFlow(emptyList())
internal val contributors: StateFlow<List<Contributor>> = _contributors.asStateFlow()

private val _dependencies: MutableStateFlow<ImmutableList<String>> = MutableStateFlow(persistentListOf())
internal val dependencies: StateFlow<ImmutableList<String>> = _dependencies.asStateFlow()
private val _dependencies: MutableStateFlow<List<String>> = MutableStateFlow(emptyList())
internal val dependencies: StateFlow<List<String>> = _dependencies.asStateFlow()

init {
refresh()
Expand All @@ -54,10 +52,9 @@ class AboutViewModel @Inject constructor(
_contributors.value = users
.map { it.toContributor() }
.sortedByDescending { it.contributions }
.toPersistentList()
}
val catalogs = fetchVersionCatalogs()
_dependencies.value = catalogs.readTomlDependencies().toPersistentList()
_dependencies.value = catalogs.readTomlDependencies()
}
}

Expand Down
2 changes: 1 addition & 1 deletion features/console/build.gradle.kts
Original file line number Diff line number Diff line change
Expand Up @@ -7,7 +7,7 @@ plugins {

android {
namespace = "com.m3u.features.console"
compileSdk = 33
compileSdk = 34
defaultConfig {
minSdk = 26
testInstrumentationRunner = "androidx.test.runner.AndroidJUnitRunner"
Expand Down
2 changes: 1 addition & 1 deletion features/crash/build.gradle.kts
Original file line number Diff line number Diff line change
Expand Up @@ -7,7 +7,7 @@ plugins {

android {
namespace = "com.m3u.features.crash"
compileSdk = 33
compileSdk = 34
defaultConfig {
minSdk = 26
testInstrumentationRunner = "androidx.test.runner.AndroidJUnitRunner"
Expand Down
2 changes: 1 addition & 1 deletion features/favorite/build.gradle.kts
Original file line number Diff line number Diff line change
Expand Up @@ -7,7 +7,7 @@ plugins {

android {
namespace = "com.m3u.features.favorite"
compileSdk = 33
compileSdk = 34
defaultConfig {
minSdk = 26
testInstrumentationRunner = "androidx.test.runner.AndroidJUnitRunner"
Expand Down
Loading

0 comments on commit 4921267

Please sign in to comment.