From 73058f357428d6038325ed17b1a1359636935bd4 Mon Sep 17 00:00:00 2001 From: Vinith Reddy Banda <116493221+vinithreddybanda@users.noreply.github.com> Date: Mon, 9 Nov 2026 01:23:59 +0530 Subject: [PATCH 01/12] Point Core submodule to Vinith's fork --- .gitmodules | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/.gitmodules b/.gitmodules index f2e7e9ad69..db9d5d1323 100644 --- a/.gitmodules +++ b/.gitmodules @@ -1,3 +1,3 @@ [submodule "core"] path = core - url = https://github.com/maxrave-dev/core \ No newline at end of file + url = https://github.com/vinithreddybanda/core.git From c70ce08d714925c8f065f294e3f86e46cac27668 Mon Sep 17 00:00:00 2001 From: Vinith Reddy Banda <116493221+vinithreddybanda@users.noreply.github.com> Date: Mon, 9 Nov 2026 01:24:24 +0530 Subject: [PATCH 02/12] Update Core submodule to Vinith fork --- core | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/core b/core index 920a610c54..1318452e20 160000 --- a/core +++ b/core @@ -1 +1 @@ -Subproject commit 920a610c54910b42416a731b52f384e328830035 +Subproject commit 1318452e206abc1e48b2d8c52c14df23d9e5176a From 1487cb1640e93b7dcfb60c70dc05b387dc75dd19 Mon Sep 17 00:00:00 2001 From: Vinith Reddy Banda <116493221+vinithreddybanda@users.noreply.github.com> Date: Mon, 9 Nov 2026 01:26:32 +0530 Subject: [PATCH 03/12] Add Cloudflare music status settings --- .../simpmusic/ui/screen/home/SettingScreen.kt | 76 +++++++++++++++++++ 1 file changed, 76 insertions(+) diff --git a/composeApp/src/commonMain/kotlin/com/maxrave/simpmusic/ui/screen/home/SettingScreen.kt b/composeApp/src/commonMain/kotlin/com/maxrave/simpmusic/ui/screen/home/SettingScreen.kt index f5de7582ed..34e304ec90 100644 --- a/composeApp/src/commonMain/kotlin/com/maxrave/simpmusic/ui/screen/home/SettingScreen.kt +++ b/composeApp/src/commonMain/kotlin/com/maxrave/simpmusic/ui/screen/home/SettingScreen.kt @@ -163,6 +163,7 @@ import dev.chrisbanes.haze.blur.hazeBlur import dev.chrisbanes.haze.hazeSource import dev.chrisbanes.haze.rememberHazeState import kotlinx.collections.immutable.toImmutableList +import kotlinx.coroutines.flow.first import kotlinx.coroutines.flow.map import kotlinx.coroutines.launch import kotlinx.coroutines.runBlocking @@ -471,6 +472,16 @@ fun SettingScreen( val uriHandler = LocalUriHandler.current val coroutineScope = rememberCoroutineScope() + val musicStatusStore: DataStoreManager = koinInject() + var showMusicStatusDialog by rememberSaveable { mutableStateOf(false) } + var musicStatusWorkerUrl by rememberSaveable { mutableStateOf("https://vinith-music-status.vinithreddy08-123.workers.dev") } + var musicStatusToken by rememberSaveable { mutableStateOf("") } + LaunchedEffect(Unit) { + musicStatusWorkerUrl = musicStatusStore.getString("cloudflare_music_status_worker_url").first() + ?: "https://vinith-music-status.vinithreddy08-123.workers.dev" + musicStatusToken = musicStatusStore.getString("cloudflare_music_status_worker_token").first().orEmpty() + } + var width by rememberSaveable { mutableIntStateOf(0) } // Backup and restore @@ -2175,6 +2186,71 @@ fun SettingScreen( } } } + item(key = "music_status") { + SettingGroup(title = "Website music status") { + SettingItem( + title = "Cloudflare Worker", + subtitle = if (musicStatusToken.isBlank()) { + "Add your Worker token to enable portfolio playback status" + } else { + "Worker configured. Track and playback status will be published." + }, + onClick = { + showMusicStatusDialog = true + }, + ) + } + if (showMusicStatusDialog) { + AlertDialog( + onDismissRequest = { showMusicStatusDialog = false }, + title = { Text("Website music status") }, + text = { + Column(verticalArrangement = Arrangement.spacedBy(12.dp)) { + Text( + "Send your SimpMusic playback state to your Cloudflare Worker. The token is stored in app settings.", + style = MaterialTheme.typography.bodySmall, + ) + TextField( + value = musicStatusWorkerUrl, + onValueChange = { musicStatusWorkerUrl = it }, + label = { Text("Worker URL") }, + singleLine = true, + ) + TextField( + value = musicStatusToken, + onValueChange = { musicStatusToken = it }, + label = { Text("Worker secret") }, + singleLine = true, + ) + } + }, + confirmButton = { + TextButton( + onClick = { + coroutineScope.launch { + musicStatusStore.putString( + "cloudflare_music_status_worker_url", + musicStatusWorkerUrl.trim(), + ) + musicStatusStore.putString( + "cloudflare_music_status_worker_token", + musicStatusToken.trim(), + ) + showMusicStatusDialog = false + } + }, + ) { + Text("Save") + } + }, + dismissButton = { + TextButton(onClick = { showMusicStatusDialog = false }) { + Text("Cancel") + } + }, + ) + } + } item(key = "sponsor_block") { SettingGroup( title = stringResource(Res.string.sponsorBlock), From 0974e35367a6f9a334ce91f630b06c59deb0c12a Mon Sep 17 00:00:00 2001 From: Vinith Reddy Banda <116493221+vinithreddybanda@users.noreply.github.com> Date: Mon, 9 Nov 2026 01:27:41 +0530 Subject: [PATCH 04/12] Advance Core submodule to heartbeat fix --- core | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/core b/core index 1318452e20..9c6f7b80fb 160000 --- a/core +++ b/core @@ -1 +1 @@ -Subproject commit 1318452e206abc1e48b2d8c52c14df23d9e5176a +Subproject commit 9c6f7b80fb3cdfc1e5d71c4a496050c453be693d From 9d8309d7bd64cd5ab658dd6943926312a0c06590 Mon Sep 17 00:00:00 2001 From: Vinith Reddy Banda <116493221+vinithreddybanda@users.noreply.github.com> Date: Mon, 9 Nov 2026 02:04:04 +0530 Subject: [PATCH 05/12] Simplify Android workflow to build one installable APK --- .github/workflows/android.yml | 171 +++++----------------------------- 1 file changed, 23 insertions(+), 148 deletions(-) diff --git a/.github/workflows/android.yml b/.github/workflows/android.yml index a5cf3a9b1f..6c166b1d3a 100644 --- a/.github/workflows/android.yml +++ b/.github/workflows/android.yml @@ -1,166 +1,41 @@ -name: Build release APK (FOSS) +name: Build APK + on: workflow_dispatch: push: branches: - - 'dev' - paths-ignore: - - 'README.md' - - 'fastlane/**' - - 'assets/**' - - '.github/**/*.md' - - '.github/FUNDING.yml' - - '.github/ISSUE_TEMPLATE/**' - pull_request: - branches: [ dev ] - paths-ignore: - - 'README.md' - - 'fastlane/**' - - 'assets/**' - - '.github/**/*.md' - - '.github/FUNDING.yml' - - '.github/ISSUE_TEMPLATE/**' + - dev + paths: + - '**' + - '.github/workflows/android.yml' + +permissions: + contents: read jobs: build: + name: Build Android APK runs-on: ubuntu-latest steps: - - uses: actions/checkout@v6 - with: - submodules: 'recursive' - - - name: set up JDK 21 - uses: actions/setup-java@v4 - with: - java-version: 21 - distribution: "microsoft" - cache: 'gradle' - - - name: Update build product flavor - run: | - echo "" >> ./gradle.properties - echo "isFullBuild=true" >> ./gradle.properties - - - name: Update Sentry Secrets - env: - SENTRY_DSN: ${{ secrets.SENTRY_DSN }} - SENTRY_AUTH_TOKEN: ${{ secrets.SENTRY_AUTH_TOKEN }} - run: | - echo 'SENTRY_DSN=${{ secrets.SENTRY_DSN }}' > ./local.properties - echo "SENTRY_AUTH_TOKEN=${{ secrets.SENTRY_AUTH_TOKEN }}" >> ./local.properties - - - name: Update Last.fm secrets - env: - LASTFM_API_KEY: ${{ secrets.LASTFM_API_KEY }} - LASTFM_SECRET: ${{ secrets.LASTFM_SECRET }} - DISCORD_CLIENT_ID: ${{ secrets.DISCORD_CLIENT_ID }} - run: | - echo "LASTFM_API_KEY=${{ secrets.LASTFM_API_KEY }}" >> ./local.properties - echo "LASTFM_SECRET=${{ secrets.LASTFM_SECRET }}" >> ./local.properties - echo "DISCORD_CLIENT_ID=${{ secrets.DISCORD_CLIENT_ID }}" >> ./local.properties - - - name: Generate aboutLibraries.json - run: ./gradlew exportLibraryDefinitions - - - name: Build release APK - run: ./gradlew androidApp:assembleRelease - - - name: Check build-tools version - shell: bash - run: | - BUILD_TOOL_VERSION=$(ls /usr/local/lib/android/sdk/build-tools/ | tail -n 1) - echo "BUILD_TOOL_VERSION=$BUILD_TOOL_VERSION" >> $GITHUB_ENV - echo Last build tool version is: $BUILD_TOOL_VERSION - - # A pull request from a fork gets no secrets, so it only checks that the APK builds. - - uses: kevin-david/zipalign-sign-android-release@v2 - id: sign_app - if: github.event_name != 'pull_request' || github.event.pull_request.head.repo.full_name == github.repository - with: - releaseDirectory: androidApp/build/outputs/apk/release - signingKeyBase64: ${{ secrets.SIGNING_KEY }} - alias: ${{ secrets.ALIAS }} - keyStorePassword: ${{ secrets.KEY_STORE_PASSWORD }} - keyPassword: ${{ secrets.KEY_PASSWORD }} - zipAlign: true - env: - BUILD_TOOLS_VERSION: ${{ env.BUILD_TOOL_VERSION }} - - - name: Upload APK - if: steps.sign_app.outcome == 'success' - uses: actions/upload-artifact@v4 - with: - name: app - path: androidApp/build/outputs/apk/release/*-signed.apk - - # SimpMusic for vivo (vivoAndroidApp, com.spotify.music), same Full build as above. - build-vivo: - runs-on: ubuntu-latest - steps: - - uses: actions/checkout@v6 + - name: Checkout source + uses: actions/checkout@v6 with: - submodules: 'recursive' + submodules: recursive - - name: set up JDK 21 + - name: Set up Java 21 uses: actions/setup-java@v4 with: - java-version: 21 - distribution: "microsoft" - cache: 'gradle' + distribution: microsoft + java-version: '21' + cache: gradle - - name: Update build product flavor - run: | - echo "" >> ./gradle.properties - echo "isFullBuild=true" >> ./gradle.properties - - - name: Update Sentry Secrets - env: - SENTRY_DSN: ${{ secrets.SENTRY_DSN }} - SENTRY_AUTH_TOKEN: ${{ secrets.SENTRY_AUTH_TOKEN }} - run: | - echo 'SENTRY_DSN=${{ secrets.SENTRY_DSN }}' > ./local.properties - echo "SENTRY_AUTH_TOKEN=${{ secrets.SENTRY_AUTH_TOKEN }}" >> ./local.properties - - - name: Update Last.fm secrets - env: - LASTFM_API_KEY: ${{ secrets.LASTFM_API_KEY }} - LASTFM_SECRET: ${{ secrets.LASTFM_SECRET }} - DISCORD_CLIENT_ID: ${{ secrets.DISCORD_CLIENT_ID }} - run: | - echo "LASTFM_API_KEY=${{ secrets.LASTFM_API_KEY }}" >> ./local.properties - echo "LASTFM_SECRET=${{ secrets.LASTFM_SECRET }}" >> ./local.properties - echo "DISCORD_CLIENT_ID=${{ secrets.DISCORD_CLIENT_ID }}" >> ./local.properties - - - name: Generate aboutLibraries.json - run: ./gradlew exportLibraryDefinitions - - - name: Build vivo release APK - run: ./gradlew vivoAndroidApp:assembleRelease - - - name: Check build-tools version - shell: bash - run: | - BUILD_TOOL_VERSION=$(ls /usr/local/lib/android/sdk/build-tools/ | tail -n 1) - echo "BUILD_TOOL_VERSION=$BUILD_TOOL_VERSION" >> $GITHUB_ENV - echo Last build tool version is: $BUILD_TOOL_VERSION - - # A pull request from a fork gets no secrets, so it only checks that the APK builds. - - uses: kevin-david/zipalign-sign-android-release@v2 - id: sign_app - if: github.event_name != 'pull_request' || github.event.pull_request.head.repo.full_name == github.repository - with: - releaseDirectory: vivoAndroidApp/build/outputs/apk/release - signingKeyBase64: ${{ secrets.SIGNING_KEY }} - alias: ${{ secrets.ALIAS }} - keyStorePassword: ${{ secrets.KEY_STORE_PASSWORD }} - keyPassword: ${{ secrets.KEY_PASSWORD }} - zipAlign: true - env: - BUILD_TOOLS_VERSION: ${{ env.BUILD_TOOL_VERSION }} + - name: Build installable APK + run: ./gradlew --no-daemon androidApp:assembleDebug - name: Upload APK - if: steps.sign_app.outcome == 'success' uses: actions/upload-artifact@v4 with: - name: app-vivo - path: vivoAndroidApp/build/outputs/apk/release/*-signed.apk + name: SimpMusic-APK + path: androidApp/build/outputs/apk/debug/*.apk + if-no-files-found: error + retention-days: 7 From 1e814e6952d47522ef64ac789c41e078f06cded0 Mon Sep 17 00:00:00 2001 From: Vinith Reddy Banda <116493221+vinithreddybanda@users.noreply.github.com> Date: Sun, 15 Nov 2026 09:38:18 +0530 Subject: [PATCH 06/12] Remove promotional interruptions and reuse Home artwork client --- .../simpmusic/ui/screen/home/HomeScreen.kt | 254 +----------------- 1 file changed, 7 insertions(+), 247 deletions(-) diff --git a/composeApp/src/commonMain/kotlin/com/maxrave/simpmusic/ui/screen/home/HomeScreen.kt b/composeApp/src/commonMain/kotlin/com/maxrave/simpmusic/ui/screen/home/HomeScreen.kt index 6ed66f6042..5441d60456 100644 --- a/composeApp/src/commonMain/kotlin/com/maxrave/simpmusic/ui/screen/home/HomeScreen.kt +++ b/composeApp/src/commonMain/kotlin/com/maxrave/simpmusic/ui/screen/home/HomeScreen.kt @@ -62,6 +62,7 @@ import androidx.compose.material3.pulltorefresh.PullToRefreshBox import androidx.compose.material3.pulltorefresh.PullToRefreshDefaults import androidx.compose.material3.pulltorefresh.rememberPullToRefreshState import androidx.compose.runtime.Composable +import androidx.compose.runtime.DisposableEffect import androidx.compose.runtime.LaunchedEffect import androidx.compose.runtime.derivedStateOf import androidx.compose.runtime.getValue @@ -91,17 +92,13 @@ import androidx.compose.ui.platform.LocalDensity import androidx.compose.ui.text.intl.Locale import androidx.compose.ui.unit.Dp import androidx.compose.ui.unit.dp -import androidx.lifecycle.Lifecycle -import androidx.lifecycle.compose.LocalLifecycleOwner import androidx.lifecycle.compose.collectAsStateWithLifecycle -import androidx.lifecycle.compose.currentStateAsState import androidx.navigation.NavController import coil3.compose.AsyncImage import coil3.compose.LocalPlatformContext import coil3.request.CachePolicy import coil3.request.ImageRequest import coil3.request.crossfade -import com.eygraber.uri.Uri import com.kmpalette.loader.rememberNetworkLoader import com.kmpalette.rememberDominantColorState import com.maxrave.common.CHART_SUPPORTED_COUNTRY @@ -109,7 +106,6 @@ import com.maxrave.common.Config import com.maxrave.domain.data.model.browse.album.Track import com.maxrave.domain.data.model.home.HomeItem import com.maxrave.domain.data.model.home.chart.Chart -import com.maxrave.domain.data.model.intent.GenericIntent import com.maxrave.domain.data.model.mood.Mood import com.maxrave.domain.extension.now import com.maxrave.domain.manager.DataStoreManager.Values.TRUE @@ -119,7 +115,6 @@ import com.maxrave.domain.utils.toSongEntity import com.maxrave.domain.utils.toTrack import com.maxrave.logger.Logger import com.maxrave.simpmusic.Platform -import com.maxrave.simpmusic.expect.openUrl import com.maxrave.simpmusic.expect.ui.HorizontalScrollBar import com.maxrave.simpmusic.expect.ui.layerBackdrop import com.maxrave.simpmusic.expect.ui.rememberBackdrop @@ -131,29 +126,21 @@ import com.maxrave.simpmusic.extension.mouseDragScroll import com.maxrave.simpmusic.extension.rgbFactor import com.maxrave.simpmusic.extension.ultraThinBarStyle import com.maxrave.simpmusic.getPlatform -import com.maxrave.simpmusic.ui.component.BlogPromoDialog import com.maxrave.simpmusic.ui.component.CenterLoadingBox import com.maxrave.simpmusic.ui.component.Chip import com.maxrave.simpmusic.ui.component.CreateActions import com.maxrave.simpmusic.ui.component.DropdownButton import com.maxrave.simpmusic.ui.component.EndOfPage import com.maxrave.simpmusic.ui.component.ExpandableChip -import com.maxrave.simpmusic.ui.component.FootgunsStarDialog import com.maxrave.simpmusic.ui.component.HomeDiscoverSection import com.maxrave.simpmusic.ui.component.HomeItem import com.maxrave.simpmusic.ui.component.HomeItemContentPlaylist import com.maxrave.simpmusic.ui.component.HomeShimmer import com.maxrave.simpmusic.ui.component.ItemArtistChart -import com.maxrave.simpmusic.ui.component.LocalAppDialogOpen -import com.maxrave.simpmusic.ui.component.LocalNowPlayingOpen -import com.maxrave.simpmusic.ui.component.LocalUserStarted import com.maxrave.simpmusic.ui.component.MoodMomentAndGenreHomeItem import com.maxrave.simpmusic.ui.component.NowPlayingBottomSheet import com.maxrave.simpmusic.ui.component.OfflineErrorState -import com.maxrave.simpmusic.ui.component.PromoBanner -import com.maxrave.simpmusic.ui.component.PromoBannerData import com.maxrave.simpmusic.ui.component.QuickPicksItem -import com.maxrave.simpmusic.ui.component.ReviewDialog import com.maxrave.simpmusic.ui.component.SectionHeaderButton import com.maxrave.simpmusic.ui.component.ShareSavedLyricsDialog import com.maxrave.simpmusic.ui.component.homeCardAspectRatio @@ -174,10 +161,6 @@ import com.maxrave.simpmusic.ui.screen.library.LibraryDynamicPlaylistType import com.maxrave.simpmusic.ui.theme.LocalLiquidGlassEnabled import com.maxrave.simpmusic.ui.theme.desktopPanelDark import com.maxrave.simpmusic.ui.theme.typo -import com.maxrave.simpmusic.utils.VersionManager -import com.maxrave.simpmusic.utils.eligiblePromos -import com.maxrave.simpmusic.utils.osRequirementOf -import com.maxrave.simpmusic.viewModel.FOOTGUNS_STAR_KEY import com.maxrave.simpmusic.viewModel.HomeViewModel import com.maxrave.simpmusic.viewModel.HomeViewModel.Companion.HOME_PARAMS_COMMUTE import com.maxrave.simpmusic.viewModel.HomeViewModel.Companion.HOME_PARAMS_ENERGIZE @@ -198,8 +181,6 @@ import dev.chrisbanes.haze.rememberHazeState import io.ktor.client.HttpClient import io.ktor.client.engine.cio.CIO import io.ktor.http.Url -import kotlinx.coroutines.delay -import kotlinx.coroutines.flow.first import kotlinx.coroutines.launch import org.jetbrains.compose.resources.painterResource import org.jetbrains.compose.resources.stringResource @@ -238,14 +219,6 @@ import simpmusic.composeapp.generated.resources.warning import simpmusic.composeapp.generated.resources.what_is_best_choice_today import simpmusic.composeapp.generated.resources.workout -// DataStore key for blog-promo one-shot dialog. Bump the suffix (v2, v3, …) to re-promote. -private const val BLOG_PROMO_KEY = "blog_promo_v1_seen" - -// Launch banner timing: how long Home's own launch dialogs get to settle, and how long the screen must -// stay free of other dialogs before the banner draws. -private const val PROMO_SETTLE_MS = 1_000L -private const val PROMO_CLEAR_MS = 400L - // The height the first item lost with the old app bar (64dp + the 50dp chip row, now one 56dp row) and // the Welcome back row (81dp), which Home's top glow still has to cover. private val HomeGlowOverflow = 140.dp @@ -311,17 +284,7 @@ fun HomeScreen( val shouldShowLogInAlert by viewModel.showLogInAlert.collectAsStateWithLifecycle() - val openAppTime by sharedViewModel.openAppTime.collectAsStateWithLifecycle() - val shareLyricsPermissions by sharedViewModel.shareSavedLyrics.collectAsStateWithLifecycle() - // Launch banner inputs. App.kt's own dialogs, its Now Playing sheet and whether the user has - // started using the app come down from App.kt; Home's dialogs are read where the banner is drawn. - val appDialogOpen = LocalAppDialogOpen.current - val nowPlayingOpen = LocalNowPlayingOpen.current - val userStarted by rememberUpdatedState(LocalUserStarted.current) - // Home's own lifecycle: RESUMED only while it is the screen in front (not mid-transition to another - // tab, not behind a system prompt). On Desktop STARTED means its window is showing. - val homeLifecycle by LocalLifecycleOwner.current.lifecycle.currentStateAsState() // The language part of the BCP 47 tag: Android's Locale.language still reports the legacy "in" // for Indonesian and "iw" for Hebrew, while the config is keyed "id" and "he". val language = Locale.current.toLanguageTag().substringBefore('-') @@ -349,7 +312,11 @@ fun HomeScreen( // leaving the tint as it was. val headerImage by viewModel.homeBackground.collectAsStateWithLifecycle() var headerImageFailed by remember(headerImage) { mutableStateOf(false) } - val networkLoader = rememberNetworkLoader(HttpClient(CIO)) + val imageHttpClient = remember { HttpClient(CIO) } + DisposableEffect(imageHttpClient) { + onDispose { imageHttpClient.close() } + } + val networkLoader = rememberNetworkLoader(imageHttpClient) val dominantColorState = rememberDominantColorState( defaultColor = backgroundColor, @@ -371,30 +338,6 @@ fun HomeScreen( } } - var showReviewDialog by rememberSaveable { - mutableStateOf(false) - } - var showRequestShareLyricsPermissions by rememberSaveable { - mutableStateOf(false) - } - var showBlogPromoDialog by rememberSaveable { - mutableStateOf(false) - } - var showFootgunsDialog by rememberSaveable { - mutableStateOf(false) - } - // Decided once per launch (saveable, so a rotation does not count as a new launch). - var promoLaunchDecided by rememberSaveable { - mutableStateOf(false) - } - var promoBanner by remember { - mutableStateOf(null) - } - // The banner that has gone a moment with nothing keeping it off screen; see where it is drawn. - var promoClearFor by remember { - mutableStateOf(null) - } - var topAppBarHeightPx by rememberSaveable { mutableIntStateOf(0) } @@ -449,30 +392,7 @@ fun HomeScreen( } } } - LaunchedEffect(openAppTime, shareLyricsPermissions) { - Logger.w("HomeScreen", "openAppTime: $openAppTime, shareLyricsPermissions: $shareLyricsPermissions") - if (openAppTime >= 10 && openAppTime % 10 == 0 && openAppTime <= 50) { - showReviewDialog = true - } else if ((openAppTime == 1 || openAppTime % 15 == 0) && openAppTime <= 60 && !shareLyricsPermissions) { - showRequestShareLyricsPermissions = true - } else if (openAppTime == 5) { - // Blog promo: one-shot after 5 app opens, bump key suffix to re-promote later - if (sharedViewModel.getString(BLOG_PROMO_KEY) != "true") { - showBlogPromoDialog = true - } - } else if (openAppTime % 10 == 6 && - openAppTime <= 46 && - sharedViewModel.getString(FOOTGUNS_STAR_KEY) != "true" - ) { - // kotlin-footguns star prompt: 6, 16, 26, 36, 46 - one open after each review milestone, - // and clear of the share-lyrics (15, 45) and blog-promo (5) milestones - showFootgunsDialog = true - } else { - showReviewDialog = false - showFootgunsDialog = false - showRequestShareLyricsPermissions = false - } - } + // Promotional and review prompts are intentionally absent; opening Home stays quiet. val shouldStartPaginate = remember { @@ -506,53 +426,6 @@ fun HomeScreen( // ) // } - if (showReviewDialog) { - ReviewDialog( - onDismissRequest = { - sharedViewModel.onDoneReview( - isDismissOnly = true, - ) - showReviewDialog = false - }, - onDoneReview = { - sharedViewModel.onDoneReview( - isDismissOnly = false, - ) - showReviewDialog = false - }, - ) - } - - if (showFootgunsDialog) { - FootgunsStarDialog( - onDismissRequest = { - // "Later" advances OPEN_APP_TIME, the same way the review and share-lyrics dialogs do. - // Home's launch effect runs again every time Home re-enters composition, reading the - // stored count; leaving it untouched kept the milestone condition true, so the prompt - // came back on every return to Home until the app was restarted. - showFootgunsDialog = false - sharedViewModel.onDoneReview(isDismissOnly = true) - }, - onDoneStar = { - sharedViewModel.putString(FOOTGUNS_STAR_KEY, "true") - showFootgunsDialog = false - }, - ) - } - - if (showBlogPromoDialog) { - BlogPromoDialog( - onDismissRequest = { - sharedViewModel.putString(BLOG_PROMO_KEY, "true") - showBlogPromoDialog = false - }, - onVisitBlog = { - sharedViewModel.putString(BLOG_PROMO_KEY, "true") - showBlogPromoDialog = false - }, - ) - } - if (showRequestShareLyricsPermissions) { ShareSavedLyricsDialog( onDismissRequest = { @@ -569,119 +442,6 @@ fun HomeScreen( ) } - val otherDialogOpen = - appDialogOpen || showReviewDialog || showRequestShareLyricsPermissions || showBlogPromoDialog || - showFootgunsDialog || shouldShowLogInAlert - // The launch banner, decided once per launch. It waits for Home to settle on its own dialogs (the - // open count and the lyrics-sharing flag load just after the first frame) and for the update check - // started at launch, however long that takes, so an update dialog comes first. Then it takes the - // first banner this version has not shown yet. - LaunchedEffect(Unit) { - if (promoLaunchDecided) return@LaunchedEffect - // Marked at the start, not the end: leaving Home cancels this for good (by then the user is - // busy elsewhere), and a value written while Home is being left would not be saved. - promoLaunchDecided = true - snapshotFlow { openAppTime }.first { it > 0 } - delay(PROMO_SETTLE_MS) - sharedViewModel.isCheckingUpdate.first { !it } - if (userStarted) { - Logger.i("Promo", "Skipped: the user started before the banner's turn") - return@LaunchedEffect - } - val localTracking = sharedViewModel.getLocalTrackingEnabled().first() == TRUE - val youTubeLoggedIn = sharedViewModel.getYouTubeLoggedIn().first() == TRUE - val shown = sharedViewModel.shownPromos() - val promos = sharedViewModel.cachedPromos().first() - val os = osRequirementOf(getPlatform().osName()) - val eligible = eligiblePromos(promos, VersionManager.getVersionName(), language, localTracking, youTubeLoggedIn, os) - val banner = - eligible - .firstOrNull { (promo, _) -> promo.id.orEmpty() !in shown } - ?.let { (promo, url) -> PromoBannerData(id = promo.id.orEmpty(), imageUrl = url, link = promo.link.orEmpty()) } - when { - banner == null -> - Logger.i( - "Promo", - "Nothing to show: ${eligible.size} of ${promos.size} banners usable here " + - "(local tracking ${if (localTracking) "on" else "off"}, " + - "YouTube ${if (youTubeLoggedIn) "signed in" else "signed out"}), " + - "already shown in ${VersionManager.getVersionName()}: $shown", - ) - - userStarted -> Logger.i("Promo", "Skipped ${banner.id}: the user started before its turn") - - else -> { - Logger.i("Promo", "Picked ${banner.id}, waiting for its turn") - promoBanner = banner - } - } - } - // Everything that keeps the banner off screen: any other dialog (it waits its turn behind them), - // Now Playing, and Home not being in front. On Desktop that only asks for a showing window: one - // opened from a terminal or an IDE may start without focus, and the click that focuses it would - // count as the user starting, so the banner would never get its turn. - val homeInFront = - homeLifecycle.isAtLeast( - if (getPlatform() == Platform.Desktop) Lifecycle.State.STARTED else Lifecycle.State.RESUMED, - ) - val promoBlocked = otherDialogOpen || nowPlayingOpen || !homeInFront - // It draws only once the banner has gone a moment unblocked since it was decided. The wait belongs - // to that banner, so nothing left over from before it arrived can let it through early: it never - // flashes in the gap between two dialogs, and the update dialog, raised a frame after its check - // ends, still gets there first. - LaunchedEffect(promoBlocked, promoBanner) { - val banner = promoBanner - promoClearFor = null - if (!promoBlocked && banner != null) { - delay(PROMO_CLEAR_MS) - promoClearFor = banner - } - } - // Whatever the user starts before the banner's turn puts it off to a later launch, uncounted. - LaunchedEffect(userStarted) { - val pending = promoBanner - if (userStarted && pending != null) { - Logger.i("Promo", "Put off ${pending.id}: the user started before its turn") - promoBanner = null - } - } - promoBanner?.takeIf { it == promoClearFor && !promoBlocked }?.let { banner -> - LaunchedEffect(banner.id) { Logger.i("Promo", "On screen: ${banner.id}") } - PromoBanner( - banner = banner, - onOpen = { - Logger.i("Promo", "Opened ${banner.id}: ${banner.link}") - promoBanner = null - sharedViewModel.markPromoShown(banner.id) - val link = banner.link - when { - // The same router as links from the web and the widgets. - link.startsWith("simpmusic://") -> { - runCatching { Uri.parse(link) }.getOrNull()?.let { - sharedViewModel.setIntent(GenericIntent(data = it)) - } - } - - // openUrl rather than LocalUriHandler, which throws where no browser answers. - link.startsWith("https://", ignoreCase = true) -> { - runCatching { openUrl(link) } - } - // Anything else is a mistake in the config: ignoring it beats crashing on a tap. - } - }, - onClose = { - Logger.i("Promo", "Closed ${banner.id}") - promoBanner = null - sharedViewModel.markPromoShown(banner.id) - }, - // No picture, no banner: closed without counting, so a later launch tries again. - onFailed = { - Logger.w("Promo", "Picture failed to load for ${banner.id}; closed without counting it") - promoBanner = null - }, - ) - } - if (shouldShowLogInAlert) { var doNotShowAgain by rememberSaveable { mutableStateOf(false) From 52298e47502fe38485201896cabf0e322f37a768 Mon Sep 17 00:00:00 2001 From: Vinith Reddy Banda <116493221+vinithreddybanda@users.noreply.github.com> Date: Sun, 15 Nov 2026 09:39:02 +0530 Subject: [PATCH 07/12] Trim unused Home screen imports --- .../kotlin/com/maxrave/simpmusic/ui/screen/home/HomeScreen.kt | 3 --- 1 file changed, 3 deletions(-) diff --git a/composeApp/src/commonMain/kotlin/com/maxrave/simpmusic/ui/screen/home/HomeScreen.kt b/composeApp/src/commonMain/kotlin/com/maxrave/simpmusic/ui/screen/home/HomeScreen.kt index 5441d60456..f7632b0e67 100644 --- a/composeApp/src/commonMain/kotlin/com/maxrave/simpmusic/ui/screen/home/HomeScreen.kt +++ b/composeApp/src/commonMain/kotlin/com/maxrave/simpmusic/ui/screen/home/HomeScreen.kt @@ -70,7 +70,6 @@ import androidx.compose.runtime.mutableIntStateOf import androidx.compose.runtime.mutableStateOf import androidx.compose.runtime.remember import androidx.compose.runtime.rememberCoroutineScope -import androidx.compose.runtime.rememberUpdatedState import androidx.compose.runtime.saveable.rememberSaveable import androidx.compose.runtime.setValue import androidx.compose.runtime.snapshotFlow @@ -108,7 +107,6 @@ import com.maxrave.domain.data.model.home.HomeItem import com.maxrave.domain.data.model.home.chart.Chart import com.maxrave.domain.data.model.mood.Mood import com.maxrave.domain.extension.now -import com.maxrave.domain.manager.DataStoreManager.Values.TRUE import com.maxrave.domain.mediaservice.handler.PlaylistType import com.maxrave.domain.mediaservice.handler.QueueData import com.maxrave.domain.utils.toSongEntity @@ -182,7 +180,6 @@ import io.ktor.client.HttpClient import io.ktor.client.engine.cio.CIO import io.ktor.http.Url import kotlinx.coroutines.launch -import org.jetbrains.compose.resources.painterResource import org.jetbrains.compose.resources.stringResource import org.koin.compose.koinInject import org.koin.compose.viewmodel.koinViewModel From 426652a37ec399056f28b7cc226d6a1437165037 Mon Sep 17 00:00:00 2001 From: Vinith Reddy Banda <116493221+vinithreddybanda@users.noreply.github.com> Date: Sun, 15 Nov 2026 09:39:04 +0530 Subject: [PATCH 08/12] Move Home DataStore reads off the UI thread --- .../simpmusic/viewModel/HomeViewModel.kt | 61 +++++++------------ 1 file changed, 23 insertions(+), 38 deletions(-) diff --git a/composeApp/src/commonMain/kotlin/com/maxrave/simpmusic/viewModel/HomeViewModel.kt b/composeApp/src/commonMain/kotlin/com/maxrave/simpmusic/viewModel/HomeViewModel.kt index b40a304136..dfd0ca4cf2 100644 --- a/composeApp/src/commonMain/kotlin/com/maxrave/simpmusic/viewModel/HomeViewModel.kt +++ b/composeApp/src/commonMain/kotlin/com/maxrave/simpmusic/viewModel/HomeViewModel.kt @@ -1,8 +1,6 @@ package com.maxrave.simpmusic.viewModel import androidx.lifecycle.viewModelScope -import com.maxrave.common.SELECTED_LANGUAGE -import com.maxrave.common.SUPPORTED_LANGUAGE import com.maxrave.domain.data.entities.SongEntity import com.maxrave.domain.data.model.home.HomeDataCombine import com.maxrave.domain.data.model.home.HomeItem @@ -27,7 +25,6 @@ import kotlinx.coroutines.flow.first import kotlinx.coroutines.flow.stateIn import kotlinx.coroutines.flow.update import kotlinx.coroutines.launch -import kotlinx.coroutines.runBlocking import simpmusic.composeapp.generated.resources.Res import simpmusic.composeapp.generated.resources.music_video import simpmusic.composeapp.generated.resources.new_release @@ -65,8 +62,6 @@ class HomeViewModel( val loading = MutableStateFlow(true) val loadingChart = MutableStateFlow(true) - private var regionCode: String = "" - private var language: String = "" private val _songEntity: MutableStateFlow = MutableStateFlow(null) val songEntity: StateFlow = _songEntity @@ -91,45 +86,43 @@ class HomeViewModel( val homeBackground: StateFlow = _homeBackground init { - if (runBlocking { dataStoreManager.cookie.first() }.isEmpty() && - runBlocking { + viewModelScope.launch { + // DataStore reads are suspending; never block the UI thread during ViewModel creation. + if (dataStoreManager.cookie.first().isEmpty() && dataStoreManager.shouldShowLogInRequiredAlert.first() == TRUE + ) { + _showLogInAlert.update { true } } - ) { - _showLogInAlert.update { true } - } - homeJob = Job() - viewModelScope.launch { + regionCodeChart.value = dataStoreManager.chartKey.first() exploreChart(regionCodeChart.value ?: "ZZ") - language = dataStoreManager.getString(SELECTED_LANGUAGE).first() - ?: SUPPORTED_LANGUAGE.codes.first() - // refresh when region change + + // Refresh when region changes. val job1 = launch { dataStoreManager.location.distinctUntilChanged().collect { - regionCode = it getHomeItemList(params.value) } } - // refresh when language change + // Refresh when language changes. val job2 = launch { dataStoreManager.language.distinctUntilChanged().collect { - language = it getHomeItemList(params.value) } } + // Keep account state in sync. A logged-out transition refreshes immediately; sign-in + // refresh is handled by job5 after the cookie has finished persisting. val job3 = launch { - dataStoreManager.cookie.distinctUntilChanged().collect { - getHomeItemList(params.value) + dataStoreManager.cookie.distinctUntilChanged().collect { cookie -> _accountInfo.emit( Pair( dataStoreManager.getString("AccountName").first(), dataStoreManager.getString("AccountThumbUrl").first(), ), ) + if (cookie.isEmpty()) getHomeItemList(params.value) } } val job4 = @@ -140,17 +133,14 @@ class HomeViewModel( } val job5 = launch { - dataStoreManager - .cookie - .distinctUntilChanged() - .collectLatest { - if (it.isNotEmpty()) { - Logger.w(tag, "Cookie changed, refreshing home") - loading.value = true - delay(1000) // To wait for the cookie to be saved properly - getHomeItemList(params.value) - } + dataStoreManager.cookie.distinctUntilChanged().collectLatest { cookie -> + if (cookie.isNotEmpty()) { + Logger.w(tag, "Cookie changed, refreshing home") + loading.value = true + delay(1000) // Wait for the cookie to finish persisting. + getHomeItemList(params.value) } + } } val job6 = launch { @@ -184,17 +174,12 @@ class HomeViewModel( } fun getHomeItemList(params: String? = null) { - loading.value = true - _homeListState.value = ListState.LOADING - language = - runBlocking { - dataStoreManager.getString(SELECTED_LANGUAGE).first() - ?: SUPPORTED_LANGUAGE.codes.first() - } - regionCode = runBlocking { dataStoreManager.location.first() } + // Cancel the previous request before starting another, without synchronous DataStore I/O. homeJob?.cancel() homeJob = viewModelScope.launch { + loading.value = true + _homeListState.value = ListState.LOADING combine( homeRepository.getHomeData( params, From bec41c9424dd4e3a1286444c935a510055e103d9 Mon Sep 17 00:00:00 2001 From: Vinith Reddy Banda <116493221+vinithreddybanda@users.noreply.github.com> Date: Sun, 15 Nov 2026 09:40:24 +0530 Subject: [PATCH 09/12] Enable liquid glass by default for new installs --- core | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/core b/core index 9c6f7b80fb..2f2d5f4784 160000 --- a/core +++ b/core @@ -1 +1 @@ -Subproject commit 9c6f7b80fb3cdfc1e5d71c4a496050c453be693d +Subproject commit 2f2d5f4784a1c19ea06cba17af1894e6a58ad243 From c9d7e7cda1f17deeda94a94549734fd339726508 Mon Sep 17 00:00:00 2001 From: Vinith Reddy Banda <116493221+vinithreddybanda@users.noreply.github.com> Date: Sun, 15 Nov 2026 09:40:57 +0530 Subject: [PATCH 10/12] Stabilize Home shelf keys and tighten section spacing --- .../simpmusic/ui/screen/home/HomeScreen.kt | 18 ++++++++++++++---- 1 file changed, 14 insertions(+), 4 deletions(-) diff --git a/composeApp/src/commonMain/kotlin/com/maxrave/simpmusic/ui/screen/home/HomeScreen.kt b/composeApp/src/commonMain/kotlin/com/maxrave/simpmusic/ui/screen/home/HomeScreen.kt index f7632b0e67..d9cc246cf4 100644 --- a/composeApp/src/commonMain/kotlin/com/maxrave/simpmusic/ui/screen/home/HomeScreen.kt +++ b/composeApp/src/commonMain/kotlin/com/maxrave/simpmusic/ui/screen/home/HomeScreen.kt @@ -537,11 +537,21 @@ fun HomeScreen( } LazyColumn( state = scrollState, - verticalArrangement = Arrangement.spacedBy(8.dp), + verticalArrangement = Arrangement.spacedBy(6.dp), ) { - itemsIndexed(homeShelves, key = { _, item -> - item.hashCode().toString() + (mainHomeThumbnail ?: "nothumb") - }) { index, item -> + itemsIndexed( + homeShelves, + key = { _, item -> + // Keep shelf identity independent of artwork/state updates. Including + // mainHomeThumbnail here invalidated every visible LazyColumn key + // whenever the palette image changed, causing avoidable item resets. + val firstContentId = + item.contents.firstNotNullOfOrNull { content -> + content?.videoId ?: content?.browseId ?: content?.playlistId + }.orEmpty() + "${item.title}:${item.moreEndpoint?.browseId.orEmpty()}:${item.channelId.orEmpty()}:$firstContentId" + }, + ) { index, item -> Box { if (index == 0) { Box( From e0096ca921fe2339ca15ac398c690f34f40f857e Mon Sep 17 00:00:00 2001 From: Vinith Reddy Banda <116493221+vinithreddybanda@users.noreply.github.com> Date: Sun, 15 Nov 2026 09:41:42 +0530 Subject: [PATCH 11/12] Start with liquid glass while stored preference loads --- composeApp/src/commonMain/kotlin/com/maxrave/simpmusic/App.kt | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/composeApp/src/commonMain/kotlin/com/maxrave/simpmusic/App.kt b/composeApp/src/commonMain/kotlin/com/maxrave/simpmusic/App.kt index 1dba3cac8b..2f45fb0383 100644 --- a/composeApp/src/commonMain/kotlin/com/maxrave/simpmusic/App.kt +++ b/composeApp/src/commonMain/kotlin/com/maxrave/simpmusic/App.kt @@ -161,7 +161,7 @@ fun App( val intent by viewModel.intent.collectAsStateWithLifecycle() val showNotificationPermissionDialog by viewModel.showNotificationPermissionDialog.collectAsStateWithLifecycle() - val isLiquidGlassEnabled by viewModel.getEnableLiquidGlass().collectAsStateWithLifecycle(DataStoreManager.FALSE) + val isLiquidGlassEnabled by viewModel.getEnableLiquidGlass().collectAsStateWithLifecycle(DataStoreManager.TRUE) // Analytics only makes sense with local tracking on, so its tab follows that setting. val isLocalTrackingEnabled by viewModel.getLocalTrackingEnabled().collectAsStateWithLifecycle(DataStoreManager.FALSE) val showAnalyticsTab = isLocalTrackingEnabled == TRUE From dc6d7fde10158502038e0ae0141befd9495135ab Mon Sep 17 00:00:00 2001 From: Vinith Reddy Banda <116493221+vinithreddybanda@users.noreply.github.com> Date: Sun, 15 Nov 2026 09:41:46 +0530 Subject: [PATCH 12/12] Default liquid glass setting state to enabled --- .../kotlin/com/maxrave/simpmusic/viewModel/SettingsViewModel.kt | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/composeApp/src/commonMain/kotlin/com/maxrave/simpmusic/viewModel/SettingsViewModel.kt b/composeApp/src/commonMain/kotlin/com/maxrave/simpmusic/viewModel/SettingsViewModel.kt index f1c67be76b..9c8130e24b 100644 --- a/composeApp/src/commonMain/kotlin/com/maxrave/simpmusic/viewModel/SettingsViewModel.kt +++ b/composeApp/src/commonMain/kotlin/com/maxrave/simpmusic/viewModel/SettingsViewModel.kt @@ -189,7 +189,7 @@ class SettingsViewModel( private var _backupDownloaded: MutableStateFlow = MutableStateFlow(false) val backupDownloaded: StateFlow = _backupDownloaded - private var _enableLiquidGlass: MutableStateFlow = MutableStateFlow(false) + private var _enableLiquidGlass: MutableStateFlow = MutableStateFlow(true) val enableLiquidGlass: StateFlow = _enableLiquidGlass private val _explicitContentEnabled = MutableStateFlow(false)