HapeLee 5 luni în urmă
părinte
comite
d2853244be

+ 4 - 2
.github/workflows/auto-release.yml

@@ -40,8 +40,9 @@ jobs:
       latest_tag: ${{ steps.set-ver.outputs.last_tag }}
       is_release: ${{ steps.set-ver.outputs.is_release }}
     steps:
-      - uses: actions/checkout@v4
+      - uses: actions/checkout@v5
         with:
+          token: ${{ secrets.GITHUB_TOKEN }}
           fetch-depth: 0
 
       - name: 计算版本号和构建号
@@ -248,8 +249,9 @@ jobs:
       success()
     runs-on: ubuntu-latest
     steps:
-      - uses: actions/checkout@v4
+      - uses: actions/checkout@v5
         with:
+          token: ${{ secrets.GITHUB_TOKEN }}
           fetch-depth: 0
 
       # 1. 下载 build 任务上传的所有 APK

+ 28 - 50
app/src/main/java/io/legado/app/ui/main/homepage/HomepageScreen.kt

@@ -104,30 +104,20 @@ fun HomepageScreen(
         uiState.manageState.sets.filter { it.isSelected }
     }
     val pagerState = rememberPagerState(pageCount = {
-        if (layoutMode == 1) selectedSets.size.coerceAtLeast(1) else 1
+        selectedSets.size.coerceAtLeast(1)
     })
 
-    val mixedGridState = rememberLazyStaggeredGridState()
     val homeString = stringResource(R.string.home)
     val currentTitle by remember(
         layoutMode,
         pagerState.currentPage,
         selectedSets,
-        uiState.modules
     ) {
         derivedStateOf {
             if (layoutMode == 1) {
                 homeString
             } else {
-                val firstHeader = mixedGridState.layoutInfo.visibleItemsInfo.firstOrNull {
-                    (it.key as? String)?.startsWith("header_") == true
-                }
-                if (firstHeader != null) {
-                    val id = (firstHeader.key as? String).orEmpty().substringAfter("header_", "")
-                    uiState.modules.find { it.globalId == id }?.setName ?: homeString
-                } else {
-                    homeString
-                }
+                selectedSets.getOrNull(pagerState.currentPage)?.sourceName ?: homeString
             }
         }
     }
@@ -199,48 +189,36 @@ fun HomepageScreen(
                 .fillMaxSize()
                 .padding(paddingValues),
         ) {
-            if (layoutMode == 0) {
-                ModuleList(
-                    modules = uiState.modules,
-                    viewModel = viewModel,
-                    gridState = mixedGridState,
-                    modifier = Modifier.fillMaxSize(),
-                    onErrorClick = { errorMsg = it },
-                    sharedTransitionScope = sharedTransitionScope,
-                    animatedVisibilityScope = animatedVisibilityScope,
-                )
+            if (selectedSets.isEmpty()) {
+                Box(modifier = Modifier.fillMaxSize(), contentAlignment = Alignment.Center) {
+                    AppText(stringResource(R.string.homepage_no_source_sets_selected))
+                }
             } else {
-                if (selectedSets.isEmpty()) {
-                    Box(modifier = Modifier.fillMaxSize(), contentAlignment = Alignment.Center) {
-                        AppText(stringResource(R.string.homepage_no_source_sets_selected))
-                    }
-                } else {
-                    HorizontalPager(
-                        state = pagerState,
-                        modifier = Modifier.fillMaxSize(),
-                        key = { index -> selectedSets.getOrNull(index)?.sourceUrl ?: index }
-                    ) { pageIndex ->
-                        val source = selectedSets.getOrNull(pageIndex)
-                        val sourceModules = remember(uiState.modules, source) {
-                            uiState.modules.filter { module ->
-                                if (source?.isCustomSet == true) {
-                                    val setId =
-                                        HomepageViewModel.customSetIdFromUrl(source.sourceUrl)
-                                    module.customSetId == setId
-                                } else {
-                                    module.sourceUrl == source?.sourceUrl
-                                }
+                HorizontalPager(
+                    state = pagerState,
+                    modifier = Modifier.fillMaxSize(),
+                    key = { index -> selectedSets.getOrNull(index)?.sourceUrl ?: index }
+                ) { pageIndex ->
+                    val source = selectedSets.getOrNull(pageIndex)
+                    val sourceModules = remember(uiState.modules, source) {
+                        uiState.modules.filter { module ->
+                            if (source?.isCustomSet == true) {
+                                val setId =
+                                    HomepageViewModel.customSetIdFromUrl(source.sourceUrl)
+                                module.customSetId == setId
+                            } else {
+                                module.sourceUrl == source?.sourceUrl
                             }
                         }
-                        ModuleList(
-                            modules = sourceModules,
-                            viewModel = viewModel,
-                            modifier = Modifier.fillMaxSize(),
-                            onErrorClick = { errorMsg = it },
-                            sharedTransitionScope = sharedTransitionScope,
-                            animatedVisibilityScope = animatedVisibilityScope,
-                        )
                     }
+                    ModuleList(
+                        modules = sourceModules,
+                        viewModel = viewModel,
+                        modifier = Modifier.fillMaxSize(),
+                        onErrorClick = { errorMsg = it },
+                        sharedTransitionScope = sharedTransitionScope,
+                        animatedVisibilityScope = animatedVisibilityScope,
+                    )
                 }
             }
         }