Skip to content

Commit

Permalink
Merge remote-tracking branch 'origin/ds/insurances' into new-design/f…
Browse files Browse the repository at this point in the history
…orever-feature-shared
  • Loading branch information
panasetskaya committed Nov 15, 2024
2 parents 27151ee + 35b97a0 commit 4bf4a25
Show file tree
Hide file tree
Showing 58 changed files with 1,205 additions and 1,134 deletions.
1 change: 1 addition & 0 deletions .github/ci-gradle.properties
Original file line number Diff line number Diff line change
@@ -1,6 +1,7 @@
org.gradle.daemon=false
org.gradle.parallel=true
org.gradle.workers.max=2
org.gradle.configuration-cache.parallel=true

kotlin.incremental=false
kotlin.compiler.execution.strategy=in-process
1 change: 1 addition & 0 deletions .idea/codeInsightSettings.xml

Some generated files are not rendered by default. Learn more about how customized files appear on GitHub.

2 changes: 1 addition & 1 deletion app/app/build.gradle.kts
Original file line number Diff line number Diff line change
Expand Up @@ -26,7 +26,7 @@ android {
applicationId = "com.hedvig"

versionCode = 43
versionName = "12.8.6"
versionName = "12.9.1"

vectorDrawables.useSupportLibrary = true

Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -66,7 +66,6 @@ import com.hedvig.android.navigation.activity.ExternalNavigator
import com.hedvig.android.navigation.compose.Destination
import com.hedvig.android.navigation.compose.typedPopUpTo
import com.hedvig.android.navigation.core.AppDestination
import com.hedvig.android.navigation.core.AppDestination.ChangeAddress
import com.hedvig.android.navigation.core.AppDestination.ClaimDetails
import com.hedvig.android.navigation.core.AppDestination.CoInsuredAddInfo
import com.hedvig.android.navigation.core.AppDestination.CoInsuredAddOrRemove
Expand Down Expand Up @@ -172,7 +171,7 @@ internal fun HedvigNavHost(
navigateToClaimDetails = { backStackEntry, claimId ->
with(navigator) { backStackEntry.navigate(AppDestination.ClaimDetails(claimId)) }
},
navigateToPayinScreen = navigateToConnectPayment,
navigateToConnectPayment = navigateToConnectPayment,
navigateToMissingInfo = { backStackEntry: NavBackStackEntry, contractId: String ->
with(navigator) { backStackEntry.navigate(AppDestination.CoInsuredAddInfo(contractId)) }
},
Expand Down Expand Up @@ -330,6 +329,7 @@ internal fun HedvigNavHost(
connectPaymentGraph(
navigator = navigator,
market = market,
onNavigateToNewConversation = { navigateToNewConversation() },
hedvigDeepLinkContainer = hedvigDeepLinkContainer,
)
editCoInsuredGraph(navigator)
Expand Down

This file was deleted.

Empty file.

This file was deleted.

Original file line number Diff line number Diff line change
Expand Up @@ -72,6 +72,7 @@ data class ColorScheme(
val borderPrimary: Color,
val borderSecondary: Color,
val borderHighlight: Color,
val shadowLightOnly: Color,
val signalRedFill: Color,
val signalRedHighlight: Color,
val signalRedElement: Color,
Expand Down Expand Up @@ -176,6 +177,7 @@ internal val lightColorScheme: ColorScheme = ColorScheme(
borderPrimary = ColorLightTokens.BorderPrimary,
borderSecondary = ColorLightTokens.BorderSecondary,
borderHighlight = ColorLightTokens.BorderHighlight,
shadowLightOnly = ColorLightTokens.ShadowLightOnly,
signalRedFill = ColorLightTokens.SignalRedFill,
signalRedHighlight = ColorLightTokens.SignalRedHighlight,
signalRedElement = ColorLightTokens.SignalRedElement,
Expand Down Expand Up @@ -280,6 +282,7 @@ internal val darkColorScheme: ColorScheme = ColorScheme(
borderPrimary = ColorDarkTokens.BorderPrimary,
borderSecondary = ColorDarkTokens.BorderSecondary,
borderHighlight = ColorDarkTokens.BorderHighlight,
shadowLightOnly = ColorDarkTokens.ShadowLightOnly,
signalRedFill = ColorDarkTokens.SignalRedFill,
signalRedHighlight = ColorDarkTokens.SignalRedHighlight,
signalRedElement = ColorDarkTokens.SignalRedElement,
Expand Down Expand Up @@ -410,6 +413,7 @@ internal fun ColorScheme.fromToken(value: ColorSchemeKeyTokens): Color {
ColorSchemeKeyTokens.BorderPrimary -> borderPrimary
ColorSchemeKeyTokens.BorderSecondary -> borderSecondary
ColorSchemeKeyTokens.BorderHighlight -> borderHighlight
ColorSchemeKeyTokens.ShadowLightOnly -> shadowLightOnly
ColorSchemeKeyTokens.SignalRedFill -> signalRedFill
ColorSchemeKeyTokens.SignalRedHighlight -> signalRedHighlight
ColorSchemeKeyTokens.SignalRedElement -> signalRedElement
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -187,7 +187,7 @@ private val emptyStateColors: EmptyStateColors

@Preview
@Composable
fun EmptyStatePreview() {
private fun EmptyStatePreview() {
HedvigTheme {
Surface(color = Color.White) {
EmptyState(
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -20,7 +20,12 @@ import com.hedvig.android.placeholder.fade
import com.hedvig.android.placeholder.placeholder

@Composable
fun FileContainer(model: Any, imageLoader: ImageLoader, modifier: Modifier = Modifier, cacheKey: String? = null) {
internal fun FileContainer(
model: Any,
imageLoader: ImageLoader,
modifier: Modifier = Modifier,
cacheKey: String? = null,
) {
val loadedImageIntrinsicSize = remember { mutableStateOf<IntSize?>(null) }
val placeholderPainter: Painter = rememberShapedColorPainter(HedvigTheme.colorScheme.textSecondary)
AsyncImage(
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -9,9 +9,12 @@ import androidx.compose.foundation.layout.PaddingValues
import androidx.compose.foundation.layout.Row
import androidx.compose.foundation.layout.Spacer
import androidx.compose.foundation.layout.WindowInsets
import androidx.compose.foundation.layout.WindowInsetsSides
import androidx.compose.foundation.layout.WindowInsetsSides.Companion
import androidx.compose.foundation.layout.asPaddingValues
import androidx.compose.foundation.layout.fillMaxWidth
import androidx.compose.foundation.layout.height
import androidx.compose.foundation.layout.only
import androidx.compose.foundation.layout.padding
import androidx.compose.foundation.layout.safeDrawing
import androidx.compose.foundation.layout.width
Expand All @@ -21,6 +24,7 @@ import androidx.compose.foundation.verticalScroll
import androidx.compose.runtime.Composable
import androidx.compose.runtime.Immutable
import androidx.compose.runtime.LaunchedEffect
import androidx.compose.runtime.Stable
import androidx.compose.runtime.getValue
import androidx.compose.runtime.mutableStateOf
import androidx.compose.runtime.remember
Expand Down Expand Up @@ -92,6 +96,60 @@ fun HedvigBottomSheet(
}
}

@Composable
fun <T> rememberHedvigBottomSheetState(): HedvigBottomSheetState<T> {
return remember { HedvigBottomSheetStateImpl() }
}

@Stable
interface HedvigBottomSheetState<T> {
val isVisible: Boolean
val data: T?

fun show(data: T)

fun dismiss()
}

private class HedvigBottomSheetStateImpl<T>() : HedvigBottomSheetState<T> {
override var isVisible: Boolean by mutableStateOf(false)
private set
override var data: T? by mutableStateOf(null)
private set

override fun dismiss() {
isVisible = false
}

override fun show(data: T) {
this.data = data
isVisible = true
}
}

@OptIn(ExperimentalSheetApi::class)
@Composable
fun <T> HedvigBottomSheet(
hedvigBottomSheetState: HedvigBottomSheetState<T>,
content: @Composable ColumnScope.(T) -> Unit,
) {
InternalHedvigBottomSheet(
isVisible = hedvigBottomSheetState.isVisible,
onVisibleChange = {
if (!it) {
hedvigBottomSheetState.dismiss()
}
},
onSystemBack = {
hedvigBottomSheetState.dismiss()
},
) {
if (hedvigBottomSheetState.data != null) {
content(hedvigBottomSheetState.data!!)
}
}
}

@OptIn(ExperimentalSheetApi::class)
@Composable
private fun InternalHedvigBottomSheet(
Expand All @@ -110,8 +168,8 @@ private fun InternalHedvigBottomSheet(
scrollState.animateScrollTo(scrollState.maxValue)
}
}
val defaultPadding = WindowInsets.safeDrawing.asPaddingValues()
val finalSheetPadding = sheetPadding ?: defaultPadding
val finalSheetPadding =
sheetPadding ?: WindowInsets.safeDrawing.only(WindowInsetsSides.Top + Companion.Horizontal).asPaddingValues()
ModalSheet(
visible = isVisible,
onVisibleChange = onVisibleChange,
Expand Down
Loading

0 comments on commit 4bf4a25

Please sign in to comment.