Skip to content

Commit

Permalink
[1.126.*] Pre-release merge (#563)
Browse files Browse the repository at this point in the history
  • Loading branch information
tramline-github[bot] authored May 20, 2024
2 parents 25c4c33 + 7862b4b commit 3cd5b7c
Show file tree
Hide file tree
Showing 13 changed files with 47 additions and 17 deletions.
2 changes: 1 addition & 1 deletion .github/reusable-workflows/setup-gradle/action.yml
Original file line number Diff line number Diff line change
Expand Up @@ -21,7 +21,7 @@ runs:
using: "composite"
steps:
- name: Checkout repository
uses: actions/checkout@44c2b7a8a4ea60a981eaca3cf939b5f4305c123b # v4.1.5
uses: actions/checkout@a5ac7e51b41094c92402da3b24376905380afc29 # v4.1.6
with:
fetch-depth: ${{ inputs.fetch-depth }}
token: ${{ inputs.token }}
Expand Down
2 changes: 1 addition & 1 deletion .github/workflows/ci.yml
Original file line number Diff line number Diff line change
Expand Up @@ -48,7 +48,7 @@ jobs:
- check
steps:
- name: Checkout repository
uses: actions/checkout@44c2b7a8a4ea60a981eaca3cf939b5f4305c123b # v4.1.5
uses: actions/checkout@a5ac7e51b41094c92402da3b24376905380afc29 # v4.1.6

- name: Dependency Review
uses: actions/dependency-review-action@0c155c5e8556a497adf53f2c18edabf945ed8e70 # v4
Expand Down
2 changes: 1 addition & 1 deletion .github/workflows/code_quality_analysis.yml
Original file line number Diff line number Diff line change
Expand Up @@ -49,7 +49,7 @@ jobs:
runs-on: ubuntu-latest
steps:
- name: Checkout repository
uses: actions/checkout@44c2b7a8a4ea60a981eaca3cf939b5f4305c123b # v4.1.5
uses: actions/checkout@a5ac7e51b41094c92402da3b24376905380afc29 # v4.1.6

- name: Setup python
uses: actions/setup-python@82c7e631bb3cdc910f68e0081d67478d79c6982d # v5
Expand Down
4 changes: 4 additions & 0 deletions CHANGELOG.md
Original file line number Diff line number Diff line change
Expand Up @@ -7,6 +7,10 @@ and this project adheres to [Semantic Versioning](https://semver.org/spec/v2.0.0

## [Unreleased]

### Added

- Swiping a post from left to right now offers a share action

## [1.47.0] - 2024-05-14

### Changed
Expand Down
14 changes: 14 additions & 0 deletions android/src/main/kotlin/dev/msfjarvis/claw/android/ui/ext.kt
Original file line number Diff line number Diff line change
Expand Up @@ -8,6 +8,7 @@ package dev.msfjarvis.claw.android.ui

import android.content.Context
import android.content.ContextWrapper
import android.content.Intent
import androidx.activity.ComponentActivity
import androidx.compose.runtime.Composable
import androidx.compose.runtime.remember
Expand All @@ -29,6 +30,7 @@ fun Context.getActivity(): ComponentActivity? {

@Composable
fun rememberPostActions(
context: Context,
urlLauncher: UrlLauncher,
navController: NavController,
viewModel: ClawViewModel,
Expand Down Expand Up @@ -56,6 +58,18 @@ fun rememberPostActions(
viewModel.toggleSave(post)
}

override fun share(post: UIPost) {
val sendIntent: Intent =
Intent().apply {
action = Intent.ACTION_SEND
putExtra(Intent.EXTRA_TEXT, post.url.ifEmpty { post.commentsUrl })
putExtra(Intent.EXTRA_TITLE, post.title)
type = "text/plain"
}
val shareIntent = Intent.createChooser(sendIntent, null)
context.startActivity(shareIntent)
}

override suspend fun getComments(postId: String): UIPost {
return viewModel.getPostComments(postId)
}
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -8,6 +8,7 @@ package dev.msfjarvis.claw.android.ui.lists

import androidx.compose.material.icons.Icons
import androidx.compose.material.icons.automirrored.filled.Reply
import androidx.compose.material.icons.filled.Share
import androidx.compose.material3.MaterialTheme
import androidx.compose.runtime.Composable
import androidx.compose.ui.Modifier
Expand All @@ -31,7 +32,13 @@ fun LobstersListItem(
background = MaterialTheme.colorScheme.tertiary,
onSwipe = { postActions.viewCommentsPage(item) },
)
SwipeableActionsBox(endActions = listOf(commentsAction)) {
val shareAction =
SwipeAction(
icon = rememberVectorPainter(Icons.Filled.Share),
background = MaterialTheme.colorScheme.tertiary,
onSwipe = { postActions.share(item) },
)
SwipeableActionsBox(startActions = listOf(shareAction), endActions = listOf(commentsAction)) {
LobstersCard(post = item, postActions = postActions, refresh = refresh, modifier = modifier)
}
}
Original file line number Diff line number Diff line change
Expand Up @@ -91,16 +91,16 @@ fun LobstersPostsScreen(
modifier: Modifier = Modifier,
viewModel: ClawViewModel = injectedViewModel(),
) {
val context = LocalContext.current
val hottestListState = rememberLazyListState()
val newestListState = rememberLazyListState()
val savedListState = rememberLazyListState()
val navController = rememberNavController()
val coroutineScope = rememberCoroutineScope()
val snackbarHostState = remember { SnackbarHostState() }
val postActions = rememberPostActions(urlLauncher, navController, viewModel)
val postActions = rememberPostActions(context, urlLauncher, navController, viewModel)
val backStackEntry by navController.currentBackStackEntryAsState()
val currentDestination = backStackEntry?.destination?.route
val context = LocalContext.current

val hottestPosts = viewModel.hottestPosts.collectAsLazyPagingItems()
val newestPosts = viewModel.newestPosts.collectAsLazyPagingItems()
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -11,6 +11,7 @@ import androidx.compose.foundation.lazy.rememberLazyListState
import androidx.compose.material3.Scaffold
import androidx.compose.runtime.Composable
import androidx.compose.ui.Modifier
import androidx.compose.ui.platform.LocalContext
import androidx.navigation.NavType
import androidx.navigation.compose.NavHost
import androidx.navigation.compose.composable
Expand All @@ -35,7 +36,7 @@ fun SearchScreen(
viewModel: ClawViewModel = injectedViewModel(),
) {
val navController = rememberNavController()
val postActions = rememberPostActions(urlLauncher, navController, viewModel)
val postActions = rememberPostActions(LocalContext.current, urlLauncher, navController, viewModel)
val listState = rememberLazyListState()
Scaffold(modifier = modifier) { paddingValues ->
NavHost(
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -33,7 +33,7 @@ class KotlinAndroidPlugin : Plugin<Project> {
project.tasks.withType<KotlinCompile>().configureEach {
compilerOptions.freeCompilerArgs.addAll(
"-P",
"plugin:androidx.compose.compiler.plugins.kotlin:featureFlag=StrongSkipping",
"plugin:androidx.compose.compiler.plugins.kotlin:strongSkipping=true",
)
if (matches != null) {
val (compilerKotlinVersion) = matches.destructured
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -265,6 +265,8 @@ val TEST_POST_ACTIONS =

override fun toggleSave(post: UIPost) {}

override fun share(post: UIPost) {}

override suspend fun getComments(postId: String): UIPost {
return UIPost(
shortId = "ooga",
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -20,6 +20,8 @@ interface PostActions {

fun toggleSave(post: UIPost)

fun share(post: UIPost)

suspend fun getComments(postId: String): UIPost

suspend fun getLinkMetadata(url: String): LinkMetadata
Expand Down
16 changes: 8 additions & 8 deletions gradle/libs.versions.toml
Original file line number Diff line number Diff line change
@@ -1,6 +1,6 @@
[versions]
aboutLibraries = "11.1.4"
agp = "8.5.0-beta01"
agp = "8.4.0"
android-junit5 = "1.10.0.0"
benchmark = "1.3.0-alpha05"
coil = "2.6.0"
Expand Down Expand Up @@ -52,18 +52,18 @@ androidx-lint = "androidx.lint:lint-gradle:1.0.0-alpha01"
androidx-navigation-compose = "androidx.navigation:navigation-compose:2.8.0-beta01"
androidx-paging-compose = "androidx.paging:paging-compose:3.3.0"
androidx-profileinstaller = "androidx.profileinstaller:profileinstaller:1.4.0-alpha01"
androidx-test-core = "androidx.test:core:1.6.0-alpha06"
androidx-test-espresso-core = "androidx.test.espresso:espresso-core:3.6.0-alpha04"
androidx-test-ext-junit = "androidx.test.ext:junit:1.2.0-alpha04"
androidx-test-rules = "androidx.test:rules:1.6.0-alpha04"
androidx-test-runner = "androidx.test:runner:1.6.0-alpha07"
androidx-test-core = "androidx.test:core:1.6.0-beta01"
androidx-test-espresso-core = "androidx.test.espresso:espresso-core:3.6.0-beta01"
androidx-test-ext-junit = "androidx.test.ext:junit:1.2.0-beta01"
androidx-test-rules = "androidx.test:rules:1.6.0-beta01"
androidx-test-runner = "androidx.test:runner:1.6.0-beta01"
androidx-test-uiautomator = "androidx.test.uiautomator:uiautomator:2.3.0"
androidx-work-runtime = { module = "androidx.work:work-runtime", version.ref = "workmanager" }
build-agp = { module = "com.android.tools.build:gradle", version.ref = "agp" }
build-cachefix = "org.gradle.android.cache-fix:org.gradle.android.cache-fix.gradle.plugin:3.0.1"
build-kotlin-gradle = { module = "org.jetbrains.kotlin:kotlin-gradle-plugin", version.ref = "kotlin" }
build-semver = "com.github.zafarkhaja:java-semver:0.10.2"
build-sentry = "io.sentry.android.gradle:io.sentry.android.gradle.gradle.plugin:4.5.1"
build-sentry = "io.sentry.android.gradle:io.sentry.android.gradle.gradle.plugin:4.6.0"
build-spotless = "com.diffplug.spotless:spotless-plugin-gradle:6.25.0"
build-vcu = "nl.littlerobots.version-catalog-update:nl.littlerobots.version-catalog-update.gradle.plugin:0.8.4"
coil = { module = "io.coil-kt:coil", version.ref = "coil" }
Expand Down Expand Up @@ -126,7 +126,7 @@ kotlin-serialization = { id = "org.jetbrains.kotlin.plugin.serialization", versi
ksp = "com.google.devtools.ksp:1.9.24-1.0.20"
licensee = "app.cash.licensee:1.11.0"
modulegraphassert = "com.jraska.module.graph.assertion:2.5.0"
poko = "dev.drewhamilton.poko:0.15.2"
poko = "dev.drewhamilton.poko:0.15.3"
sqldelight = { id = "app.cash.sqldelight", version.ref = "sqldelight" }
tracelog = "dev.msfjarvis.tracelog:0.1.3"
whetstone = { id = "dev.msfjarvis.whetstone", version.ref = "whetstone" }
2 changes: 1 addition & 1 deletion settings.gradle.kts
Original file line number Diff line number Diff line change
Expand Up @@ -57,7 +57,7 @@ pluginManagement {

plugins {
id("org.gradle.toolchains.foojay-resolver-convention") version "0.8.0"
id("com.gradle.develocity") version "3.17.3"
id("com.gradle.develocity") version "3.17.4"
}

develocity {
Expand Down

0 comments on commit 3cd5b7c

Please sign in to comment.