Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Update core libs, add API checks, expose contentWidnowsInsets on BottomSheetHost #31

Merged
merged 5 commits into from
Sep 29, 2024
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension


Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
9 changes: 9 additions & 0 deletions .github/renovate.json5
Original file line number Diff line number Diff line change
Expand Up @@ -9,6 +9,15 @@
"skip-changelog",
],
"rebaseWhen": "conflicted",
// deps that shouldn't be forced on users to be the latest ones
"ignoreDeps": [
"org.jetbrains.kotlinx:kotlinx-serialization-core",
"org.jetbrains.kotlinx:kotlinx-serialization-json",
"androidx.appcompat:appcompat",
"androidx.compose.foundation:foundation",
"androidx.compose.material3:material3",
"androidx.lifecycle:lifecycle-runtime",
],
"packageRules": [
{
"groupName": "GitHub Actions",
Expand Down
2 changes: 1 addition & 1 deletion .github/workflows/build.yml
Original file line number Diff line number Diff line change
Expand Up @@ -20,7 +20,7 @@ jobs:
- name: Assemble & Linters
run: |
./gradlew :bottomsheet:testDebugUnitTest :modalsheet:testDebugUnitTest
./gradlew lintDebug lintKotlin :demo:assembleDebug
./gradlew lintDebug lintKotlin :demo:assembleDebug apiCheck
- uses: yutailang0119/action-android-lint@v4.0.0
name: App Lint errors to annotations
if: ${{ failure() }}
Expand Down
1 change: 1 addition & 0 deletions .github/workflows/release.yml
Original file line number Diff line number Diff line change
Expand Up @@ -22,6 +22,7 @@ jobs:
echo ${{ secrets.ENCRYPT_KEY }} | release/signing-unpack.sh
- name: Deploy to Sonatype
run: |
./gradlew apiCheck
./gradlew :publishAggregatedPublicationToCentralPortal --no-configuration-cache
- name: Build APK
run: |
Expand Down
50 changes: 50 additions & 0 deletions bottomsheet/api/bottomsheet.api
Original file line number Diff line number Diff line change
@@ -0,0 +1,50 @@
public final class dev/hrach/navigation/bottomsheet/BottomSheetHostKt {
public static final fun BottomSheetHost-u5qS3lI (Ldev/hrach/navigation/bottomsheet/BottomSheetNavigator;Landroidx/compose/ui/Modifier;FLandroidx/compose/ui/graphics/Shape;JJFJLkotlin/jvm/functions/Function2;Lkotlin/jvm/functions/Function2;Landroidx/compose/runtime/Composer;II)V
}

public final class dev/hrach/navigation/bottomsheet/BottomSheetNavigator : androidx/navigation/Navigator {
public static final field $stable I
public fun <init> ()V
public synthetic fun createDestination ()Landroidx/navigation/NavDestination;
public fun createDestination ()Ldev/hrach/navigation/bottomsheet/BottomSheetNavigator$Destination;
public fun navigate (Ljava/util/List;Landroidx/navigation/NavOptions;Landroidx/navigation/Navigator$Extras;)V
public fun popBackStack (Landroidx/navigation/NavBackStackEntry;Z)V
}

public final class dev/hrach/navigation/bottomsheet/BottomSheetNavigator$Destination : androidx/navigation/NavDestination, androidx/navigation/FloatingWindow {
public static final field $stable I
public fun <init> (Ldev/hrach/navigation/bottomsheet/BottomSheetNavigator;Lkotlin/jvm/functions/Function3;)V
}

public final class dev/hrach/navigation/bottomsheet/BottomSheetNavigatorDestinationBuilder : androidx/navigation/NavDestinationBuilder {
public static final field $stable I
public fun <init> (Ldev/hrach/navigation/bottomsheet/BottomSheetNavigator;Ljava/lang/String;Lkotlin/jvm/functions/Function3;)V
public fun <init> (Ldev/hrach/navigation/bottomsheet/BottomSheetNavigator;Lkotlin/reflect/KClass;Ljava/util/Map;Lkotlin/jvm/functions/Function3;)V
public synthetic fun build ()Landroidx/navigation/NavDestination;
public fun build ()Ldev/hrach/navigation/bottomsheet/BottomSheetNavigator$Destination;
public final fun getSecurePolicy ()Landroidx/compose/ui/window/SecureFlagPolicy;
public final fun getSkipPartiallyExpanded ()Z
public synthetic fun instantiateDestination ()Landroidx/navigation/NavDestination;
public final fun setSecurePolicy (Landroidx/compose/ui/window/SecureFlagPolicy;)V
public final fun setSkipPartiallyExpanded (Z)V
}

public final class dev/hrach/navigation/bottomsheet/ComposableSingletons$BottomSheetHostKt {
public static final field INSTANCE Ldev/hrach/navigation/bottomsheet/ComposableSingletons$BottomSheetHostKt;
public static field lambda-1 Lkotlin/jvm/functions/Function2;
public fun <init> ()V
public final fun getLambda-1$bottomsheet_release ()Lkotlin/jvm/functions/Function2;
}

public final class dev/hrach/navigation/bottomsheet/ComposableSingletons$BottomSheetNavigatorKt {
public static final field INSTANCE Ldev/hrach/navigation/bottomsheet/ComposableSingletons$BottomSheetNavigatorKt;
public static field lambda-1 Lkotlin/jvm/functions/Function3;
public fun <init> ()V
public final fun getLambda-1$bottomsheet_release ()Lkotlin/jvm/functions/Function3;
}

public final class dev/hrach/navigation/bottomsheet/NavGraphBuilderKt {
public static final fun bottomSheet (Landroidx/navigation/NavGraphBuilder;Ljava/lang/String;Ljava/util/List;Ljava/util/List;Landroidx/compose/ui/window/SecureFlagPolicy;ZLkotlin/jvm/functions/Function3;)V
public static synthetic fun bottomSheet$default (Landroidx/navigation/NavGraphBuilder;Ljava/lang/String;Ljava/util/List;Ljava/util/List;Landroidx/compose/ui/window/SecureFlagPolicy;ZLkotlin/jvm/functions/Function3;ILjava/lang/Object;)V
}

Original file line number Diff line number Diff line change
@@ -1,6 +1,6 @@
package dev.hrach.navigation.bottomsheet

import androidx.compose.foundation.layout.ExperimentalLayoutApi
import androidx.compose.foundation.layout.WindowInsets
import androidx.compose.material3.BottomSheetDefaults
import androidx.compose.material3.ExperimentalMaterial3Api
import androidx.compose.material3.ModalBottomSheet
Expand Down Expand Up @@ -29,7 +29,7 @@ import kotlinx.coroutines.CancellationException
import kotlinx.coroutines.flow.Flow
import kotlinx.coroutines.flow.flow

@OptIn(ExperimentalMaterial3Api::class)
@ExperimentalMaterial3Api
@Composable
public fun BottomSheetHost(
navigator: BottomSheetNavigator,
Expand All @@ -40,9 +40,8 @@ public fun BottomSheetHost(
contentColor: Color = contentColorFor(containerColor),
tonalElevation: Dp = 0.dp,
scrimColor: Color = BottomSheetDefaults.ScrimColor,
dragHandle:
@Composable()
(() -> Unit)? = { BottomSheetDefaults.DragHandle() },
dragHandle: @Composable (() -> Unit)? = { BottomSheetDefaults.DragHandle() },
contentWindowInsets: @Composable () -> WindowInsets = { BottomSheetDefaults.windowInsets },
) {
val saveableStateHolder = rememberSaveableStateHolder()

Expand Down Expand Up @@ -71,6 +70,7 @@ public fun BottomSheetHost(
tonalElevation = tonalElevation,
scrimColor = scrimColor,
dragHandle = dragHandle,
contentWindowInsets = contentWindowInsets,
saveableStateHolder = saveableStateHolder,
targetBackStackEntry = backStackEntry,
)
Expand All @@ -97,16 +97,16 @@ private fun BottomSheetHost(
contentColor: Color,
tonalElevation: Dp,
scrimColor: Color,
dragHandle:
@Composable()
(() -> Unit)?,
dragHandle: @Composable (() -> Unit)?,
contentWindowInsets: @Composable () -> WindowInsets,
saveableStateHolder: SaveableStateHolder,
targetBackStackEntry: NavBackStackEntry?,
) {
val destination = targetBackStackEntry?.destination as? BottomSheetNavigator.Destination
val sheetState = rememberModalBottomSheetState(
skipPartiallyExpanded = destination?.skipPartiallyExpanded ?: true,
)

@Suppress("ProduceStateDoesNotAssignValue") // false positive
val backStackEntry by produceState<NavBackStackEntry?>(
initialValue = null,
Expand All @@ -133,12 +133,13 @@ private fun BottomSheetHost(
scrimColor = scrimColor,
dragHandle = dragHandle,
sheetState = sheetState,
contentWindowInsets = contentWindowInsets,
saveableStateHolder = saveableStateHolder,
backStackEntry = backStackEntry ?: return,
)
}

@OptIn(ExperimentalMaterial3Api::class, ExperimentalLayoutApi::class)
@OptIn(ExperimentalMaterial3Api::class)
@Composable
private fun BottomSheetHost(
navigator: BottomSheetNavigator,
Expand All @@ -149,9 +150,8 @@ private fun BottomSheetHost(
contentColor: Color,
tonalElevation: Dp,
scrimColor: Color,
dragHandle:
@Composable()
(() -> Unit)?,
dragHandle: @Composable (() -> Unit)?,
contentWindowInsets: @Composable () -> WindowInsets,
sheetState: SheetState,
saveableStateHolder: SaveableStateHolder,
backStackEntry: NavBackStackEntry,
Expand All @@ -174,6 +174,7 @@ private fun BottomSheetHost(
tonalElevation = tonalElevation,
scrimColor = scrimColor,
dragHandle = dragHandle,
contentWindowInsets = contentWindowInsets,
properties = ModalBottomSheetProperties(securePolicy = destination.securePolicy),
) {
LaunchedEffect(backStackEntry) {
Expand Down
8 changes: 4 additions & 4 deletions build.gradle.kts
Original file line number Diff line number Diff line change
Expand Up @@ -3,10 +3,10 @@ import org.jetbrains.kotlin.gradle.dsl.JvmTarget
import org.jetbrains.kotlin.gradle.tasks.KotlinJvmCompile

plugins {
id("org.jetbrains.kotlin.android") version "2.0.0" apply false
id("org.jetbrains.kotlin.plugin.serialization") version "2.0.0" apply false
id("org.jetbrains.kotlin.plugin.compose") version "2.0.0" apply false
id("org.jetbrains.kotlinx.binary-compatibility-validator") version "0.14.0" apply false
id("org.jetbrains.kotlin.android") version "2.0.20" apply false
id("org.jetbrains.kotlin.plugin.serialization") version "2.0.20" apply false
id("org.jetbrains.kotlin.plugin.compose") version "2.0.20" apply false
id("org.jetbrains.kotlinx.binary-compatibility-validator") version "0.16.3" apply false
id("org.jmailen.kotlinter") version "4.4.1" apply false
id("com.android.application") version "8.6.1" apply false
id("com.vanniktech.maven.publish") version "0.29.0" apply false
Expand Down
2 changes: 2 additions & 0 deletions demo/src/main/kotlin/dev/hrach/navigation/demo/NavHost.kt
Original file line number Diff line number Diff line change
Expand Up @@ -2,6 +2,7 @@ package dev.hrach.navigation.demo

import androidx.compose.foundation.shape.CornerSize
import androidx.compose.foundation.shape.RoundedCornerShape
import androidx.compose.material3.ExperimentalMaterial3Api
import androidx.compose.material3.MaterialTheme
import androidx.compose.runtime.Composable
import androidx.compose.ui.unit.dp
Expand All @@ -21,6 +22,7 @@ import dev.hrach.navigation.modalsheet.ModalSheetHost
import dev.hrach.navigation.modalsheet.ModalSheetNavigator
import dev.hrach.navigation.modalsheet.modalSheet

@OptIn(ExperimentalMaterial3Api::class)
@Composable
internal fun NavHost(
navController: NavHostController,
Expand Down
59 changes: 59 additions & 0 deletions modalsheet/api/modalsheet.api
Original file line number Diff line number Diff line change
@@ -0,0 +1,59 @@
public final class dev/hrach/navigation/modalsheet/ComposableSingletons$ModalSheetDialogKt {
public static final field INSTANCE Ldev/hrach/navigation/modalsheet/ComposableSingletons$ModalSheetDialogKt;
public static field lambda-1 Lkotlin/jvm/functions/Function2;
public fun <init> ()V
public final fun getLambda-1$modalsheet_release ()Lkotlin/jvm/functions/Function2;
}

public final class dev/hrach/navigation/modalsheet/ComposableSingletons$ModalSheetNavigatorKt {
public static final field INSTANCE Ldev/hrach/navigation/modalsheet/ComposableSingletons$ModalSheetNavigatorKt;
public static field lambda-1 Lkotlin/jvm/functions/Function4;
public fun <init> ()V
public final fun getLambda-1$modalsheet_release ()Lkotlin/jvm/functions/Function4;
}

public final class dev/hrach/navigation/modalsheet/ModalSheetHostKt {
public static final fun ModalSheetHost-Y2L_72g (Ldev/hrach/navigation/modalsheet/ModalSheetNavigator;JLandroidx/compose/ui/Modifier;Lkotlin/jvm/functions/Function1;Lkotlin/jvm/functions/Function1;Lkotlin/jvm/functions/Function1;Lkotlin/jvm/functions/Function1;Lkotlin/jvm/functions/Function1;Landroidx/compose/runtime/Composer;II)V
}

public final class dev/hrach/navigation/modalsheet/ModalSheetNavigator : androidx/navigation/Navigator {
public static final field $stable I
public fun <init> ()V
public synthetic fun createDestination ()Landroidx/navigation/NavDestination;
public fun createDestination ()Ldev/hrach/navigation/modalsheet/ModalSheetNavigator$Destination;
public fun navigate (Ljava/util/List;Landroidx/navigation/NavOptions;Landroidx/navigation/Navigator$Extras;)V
public fun popBackStack (Landroidx/navigation/NavBackStackEntry;Z)V
public final fun prepareForTransition (Landroidx/navigation/NavBackStackEntry;)V
}

public final class dev/hrach/navigation/modalsheet/ModalSheetNavigator$Destination : androidx/navigation/NavDestination, androidx/navigation/FloatingWindow {
public static final field $stable I
public fun <init> (Ldev/hrach/navigation/modalsheet/ModalSheetNavigator;Lkotlin/jvm/functions/Function4;)V
}

public final class dev/hrach/navigation/modalsheet/ModalSheetNavigatorDestinationBuilder : androidx/navigation/NavDestinationBuilder {
public static final field $stable I
public fun <init> (Ldev/hrach/navigation/modalsheet/ModalSheetNavigator;Ljava/lang/String;Lkotlin/jvm/functions/Function4;)V
public fun <init> (Ldev/hrach/navigation/modalsheet/ModalSheetNavigator;Lkotlin/reflect/KClass;Ljava/util/Map;Lkotlin/jvm/functions/Function4;)V
public synthetic fun build ()Landroidx/navigation/NavDestination;
public fun build ()Ldev/hrach/navigation/modalsheet/ModalSheetNavigator$Destination;
public final fun getEnterTransition ()Lkotlin/jvm/functions/Function1;
public final fun getExitTransition ()Lkotlin/jvm/functions/Function1;
public final fun getPopEnterTransition ()Lkotlin/jvm/functions/Function1;
public final fun getPopExitTransition ()Lkotlin/jvm/functions/Function1;
public final fun getSecurePolicy ()Landroidx/compose/ui/window/SecureFlagPolicy;
public final fun getSizeTransform ()Lkotlin/jvm/functions/Function1;
public synthetic fun instantiateDestination ()Landroidx/navigation/NavDestination;
public final fun setEnterTransition (Lkotlin/jvm/functions/Function1;)V
public final fun setExitTransition (Lkotlin/jvm/functions/Function1;)V
public final fun setPopEnterTransition (Lkotlin/jvm/functions/Function1;)V
public final fun setPopExitTransition (Lkotlin/jvm/functions/Function1;)V
public final fun setSecurePolicy (Landroidx/compose/ui/window/SecureFlagPolicy;)V
public final fun setSizeTransform (Lkotlin/jvm/functions/Function1;)V
}

public final class dev/hrach/navigation/modalsheet/NavGraphBuilderKt {
public static final fun modalSheet (Landroidx/navigation/NavGraphBuilder;Ljava/lang/String;Ljava/util/List;Ljava/util/List;Landroidx/compose/ui/window/SecureFlagPolicy;Lkotlin/jvm/functions/Function1;Lkotlin/jvm/functions/Function1;Lkotlin/jvm/functions/Function1;Lkotlin/jvm/functions/Function1;Lkotlin/jvm/functions/Function1;Lkotlin/jvm/functions/Function4;)V
public static synthetic fun modalSheet$default (Landroidx/navigation/NavGraphBuilder;Ljava/lang/String;Ljava/util/List;Ljava/util/List;Landroidx/compose/ui/window/SecureFlagPolicy;Lkotlin/jvm/functions/Function1;Lkotlin/jvm/functions/Function1;Lkotlin/jvm/functions/Function1;Lkotlin/jvm/functions/Function1;Lkotlin/jvm/functions/Function1;Lkotlin/jvm/functions/Function4;ILjava/lang/Object;)V
}

5 changes: 5 additions & 0 deletions results/api/results.api
Original file line number Diff line number Diff line change
@@ -0,0 +1,5 @@
public final class dev/hrach/navigation/results/ResultsKt {
public static final fun NavigationResultEffectImpl (Landroidx/navigation/NavBackStackEntry;Landroidx/navigation/NavController;Lkotlinx/serialization/KSerializer;Lkotlin/jvm/functions/Function1;Landroidx/compose/runtime/Composer;I)V
public static final fun setResultImpl (Landroidx/navigation/NavController;Ljava/lang/Object;Lkotlinx/serialization/KSerializer;)V
}