Skip to content
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
Original file line number Diff line number Diff line change
Expand Up @@ -19,17 +19,36 @@ object OctopusFakeResolver : FakeResolver by delegate {
.rawType()
.name
) {
"Date" ->
"Date" -> {
Clock.System
.now()
.toLocalDateTime(TimeZone.currentSystemDefault())
.date
"UUID" -> UUID.randomUUID().toString()
"Url" -> """www.example.com"""
"Instant" -> kotlin.time.Instant.DISTANT_FUTURE
"DateTime" -> kotlin.time.Instant.DISTANT_FUTURE
"Markdown" -> MarkdownString("test")
else -> delegate.resolveLeaf(context)
}

"UUID" -> {
UUID.randomUUID().toString()
}

"Url" -> {
"""www.example.com"""
}

"Instant" -> {
kotlin.time.Instant.DISTANT_FUTURE
}

"DateTime" -> {
kotlin.time.Instant.DISTANT_FUTURE
}

"Markdown" -> {
MarkdownString("test")
}

else -> {
delegate.resolveLeaf(context)
}
}
}

Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -404,13 +404,33 @@ internal fun HedvigNavHost(
return@onNavigateToQuickLink
}

is QuickLinkCoInsuredAddInfo -> CoInsuredAddInfo(quickLinkDestination.contractId)
is QuickLinkCoInsuredAddOrRemove -> CoInsuredAddOrRemove(quickLinkDestination.contractId)
QuickLinkConnectPayment -> TrustlyDestination
QuickLinkTermination -> TerminateInsuranceGraphDestination(null)
QuickLinkTravelCertificate -> TravelCertificateGraphDestination
QuickLinkChangeTier -> StartTierFlowChooseInsuranceDestination
QuickLinkDestination.OuterDestination.ChooseInsuranceForEditCoInsured -> EditCoInsuredTriage()
is QuickLinkCoInsuredAddInfo -> {
CoInsuredAddInfo(quickLinkDestination.contractId)
}

is QuickLinkCoInsuredAddOrRemove -> {
CoInsuredAddOrRemove(quickLinkDestination.contractId)
}

QuickLinkConnectPayment -> {
TrustlyDestination
}

QuickLinkTermination -> {
TerminateInsuranceGraphDestination(null)
}

QuickLinkTravelCertificate -> {
TravelCertificateGraphDestination
}

QuickLinkChangeTier -> {
StartTierFlowChooseInsuranceDestination
}

QuickLinkDestination.OuterDestination.ChooseInsuranceForEditCoInsured -> {
EditCoInsuredTriage()
}
}
with(navigator) {
backStackEntry.navigate(destination)
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -107,7 +107,10 @@ internal class HedvigAppState(
get() {
if (!shouldShowNavBars) return NavigationSuiteType.None
return when (windowSizeClass.widthSizeClass) {
WindowWidthSizeClass.Compact -> NavigationSuiteType.NavigationBar
WindowWidthSizeClass.Compact -> {
NavigationSuiteType.NavigationBar
}

else -> {
when (windowSizeClass.heightSizeClass) {
WindowHeightSizeClass.Expanded -> NavigationSuiteType.NavigationRailXLarge
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -120,17 +120,26 @@ internal fun HedvigAppUi(
private fun Modifier.animatedNavigationBarInsetsConsumption(hedvigAppState: HedvigAppState) = composed {
val density = LocalDensity.current
val insetsToConsume = when (hedvigAppState.navigationSuiteType) {
NavigationSuiteType.NavigationBar -> WindowInsets.systemBars.only(WindowInsetsSides.Bottom).asPaddingValues(density)
NavigationSuiteType.None -> PaddingValues(0.dp)
NavigationSuiteType.NavigationBar -> {
WindowInsets.systemBars.only(WindowInsetsSides.Bottom).asPaddingValues(density)
}

NavigationSuiteType.None -> {
PaddingValues(0.dp)
}

NavigationSuiteType.NavigationRail,
NavigationSuiteType.NavigationRailXLarge,
->
-> {
WindowInsets.systemBars
.union(WindowInsets.displayCutout)
.only(WindowInsetsSides.Left)
.asPaddingValues(density)
}

else -> PaddingValues(0.dp)
else -> {
PaddingValues(0.dp)
}
}

val paddingValuesVectorConverter: TwoWayConverter<PaddingValues, AnimationVector4D> = TwoWayConverter(
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -208,7 +208,9 @@ private fun ActionOrLoadingIcon(
}
}

is AudioPlayerState.Failed -> error("Impossible")
is AudioPlayerState.Failed -> {
error("Impossible")
}
}
}
}
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -47,6 +47,7 @@ internal class AuthTokenServiceImpl(
logoutAndInvalidateTokens()
null
}

is AuthTokenResult.Success -> {
logcat(LogPriority.VERBOSE) { "Refreshing token success. Updating tokens" }
authTokenStorage.updateTokens(result.accessToken, result.refreshToken)
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -78,6 +78,7 @@ public class NetworkAuthRepository(
}
when (otpResponse) {
is LoginOtpResponse.Error -> AuthAttemptResult.Error.Localised(otpResponse.reason)

is LoginOtpResponse.Success -> AuthAttemptResult.OtpProperties(
id = otpResponse.id,
statusUrl = StatusUrl(otpResponse.statusUrl.url),
Expand All @@ -91,7 +92,9 @@ public class NetworkAuthRepository(
} catch (e: Throwable) {
when (e) {
is CancellationException -> throw e

is IOException -> AuthAttemptResult.Error.IOError("IO Error with message: ${e.message ?: "unknown message"}")

is NoTransformationFoundException -> AuthAttemptResult.Error.BackendErrorResponse(
e.message ?: "unknown error",
)
Expand All @@ -105,18 +108,23 @@ public class NetworkAuthRepository(
return try {
val response = authService.loginStatus(LoginStatusUrl(statusUrl.url))
when (response.status) {
LoginStatusResponse.LoginStatus.PENDING -> LoginStatusResult.Pending(
response.statusText,
response.seBankIdProperties?.let { bankIdProperties ->
LoginStatusResult.Pending.BankIdProperties(
bankIdProperties.autoStartToken,
bankIdProperties.liveQrCodeData,
bankIdProperties.bankIdAppOpened,
)
},
)
LoginStatusResponse.LoginStatus.PENDING -> {
LoginStatusResult.Pending(
response.statusText,
response.seBankIdProperties?.let { bankIdProperties ->
LoginStatusResult.Pending.BankIdProperties(
bankIdProperties.autoStartToken,
bankIdProperties.liveQrCodeData,
bankIdProperties.bankIdAppOpened,
)
},
)
}

LoginStatusResponse.LoginStatus.FAILED -> {
LoginStatusResult.Failed(response.statusText)
}

LoginStatusResponse.LoginStatus.FAILED -> LoginStatusResult.Failed(response.statusText)
LoginStatusResponse.LoginStatus.COMPLETED -> {
require(response.authorizationCode != null) {
"Login status completed but did not receive authorization code"
Expand Down Expand Up @@ -196,7 +204,9 @@ public class NetworkAuthRepository(
} catch (e: Throwable) {
when (e) {
is CancellationException -> throw e

is IOException -> AuthTokenResult.Error.IOError("IO Error with message: ${e.message ?: "unknown message"}")

is NoTransformationFoundException -> AuthTokenResult.Error.BackendErrorResponse(
e.message ?: "unknown error",
)
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -9,6 +9,7 @@ fun <T : Either<Left, *>, Left> Assert<T>.isLeft(): Assert<Left> = transform { a
@Suppress("UNCHECKED_CAST")
when (actual) {
is Either.Left<*> -> actual.value as Left

is Either.Right<*> -> expected(
"to be instance of:${show(Either.Left::class)} but was instance of:${show(Either.Right::class)}",
)
Expand All @@ -25,6 +26,7 @@ fun <T : Either<*, Right>, Right> Assert<T>.isRight(): Assert<Right> = transform
)

is Either.Right<*> -> actual.value as Right

else -> error("Impossible")
}
}
Original file line number Diff line number Diff line change
Expand Up @@ -402,7 +402,9 @@ data class IdProtectionDeflectPartner(
url = partner.url,
urlButtonTitle = urlButtonTitle,
)

partner.phoneNumber != null -> ButtonsState.PhoneNumber(partner.phoneNumber)

else -> ButtonsState.None
}

Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -500,65 +500,88 @@ private suspend fun ClaimFlowStepFragment.CurrentStep.toClaimFlowStep(
)
}

is ClaimFlowStepFragment.FlowClaimFailedStepCurrentStep -> ClaimFlowStep.ClaimFailedStep(flowId)
is ClaimFlowStepFragment.FlowClaimFailedStepCurrentStep -> {
ClaimFlowStep.ClaimFailedStep(flowId)
}

is ClaimFlowStepFragment.FlowClaimSuccessStepCurrentStep -> {
selfServiceCompletedEventManager.completedSelfServiceSuccessfully()
ClaimFlowStep.ClaimSuccessStep(flowId)
}

is ClaimFlowStepFragment.FlowClaimContractSelectStepCurrentStep -> ClaimFlowStep.ClaimSelectContractStep(
flowId,
options,
selectedOptionId,
)
is ClaimFlowStepFragment.FlowClaimContractSelectStepCurrentStep -> {
ClaimFlowStep.ClaimSelectContractStep(
flowId,
options,
selectedOptionId,
)
}

is ClaimFlowStepFragment.FlowClaimDeflectGlassDamageStepCurrentStep -> ClaimFlowStep.ClaimDeflectGlassDamageStep(
flowId,
partners,
)
is ClaimFlowStepFragment.FlowClaimDeflectGlassDamageStepCurrentStep -> {
ClaimFlowStep.ClaimDeflectGlassDamageStep(
flowId,
partners,
)
}

is ClaimFlowStepFragment.FlowClaimDeflectTowingStepCurrentStep -> ClaimFlowStep.ClaimDeflectTowingStep(
flowId,
partners,
)
is ClaimFlowStepFragment.FlowClaimDeflectTowingStepCurrentStep -> {
ClaimFlowStep.ClaimDeflectTowingStep(
flowId,
partners,
)
}

is ClaimFlowStepFragment.FlowClaimDeflectEirStepCurrentStep -> ClaimFlowStep.ClaimDeflectEirStep(
flowId,
partners,
)
is ClaimFlowStepFragment.FlowClaimDeflectEirStepCurrentStep -> {
ClaimFlowStep.ClaimDeflectEirStep(
flowId,
partners,
)
}

is ClaimFlowStepFragment.FlowClaimConfirmEmergencyStepCurrentStep -> ClaimFlowStep.ClaimConfirmEmergencyStep(
flowId,
text,
confirmEmergency,
options,
)
is ClaimFlowStepFragment.FlowClaimConfirmEmergencyStepCurrentStep -> {
ClaimFlowStep.ClaimConfirmEmergencyStep(
flowId,
text,
confirmEmergency,
options,
)
}

is ClaimFlowStepFragment.FlowClaimDeflectEmergencyStepCurrentStep -> ClaimFlowStep.ClaimDeflectEmergencyStep(
flowId,
partners,
)
is ClaimFlowStepFragment.FlowClaimDeflectEmergencyStepCurrentStep -> {
ClaimFlowStep.ClaimDeflectEmergencyStep(
flowId,
partners,
)
}

is ClaimFlowStepFragment.FlowClaimDeflectPestsStepCurrentStep -> ClaimFlowStep.ClaimDeflectPestsStep(
flowId,
partners,
)
is ClaimFlowStepFragment.FlowClaimDeflectPestsStepCurrentStep -> {
ClaimFlowStep.ClaimDeflectPestsStep(
flowId,
partners,
)
}

is ClaimFlowStepFragment.FlowClaimFileUploadStepCurrentStep -> ClaimFlowStep.ClaimFileUploadStep(
flowId,
title,
targetUploadUrl,
uploads,
)
is ClaimFlowStepFragment.FlowClaimFileUploadStepCurrentStep -> {
ClaimFlowStep.ClaimFileUploadStep(
flowId,
title,
targetUploadUrl,
uploads,
)
}

is ClaimFlowStepFragment.FlowClaimDeflectIDProtectionStepCurrentStep -> ClaimFlowStep.ClaimDeflectIdProtectionStep(
flowId,
title,
description,
partners,
)
is ClaimFlowStepFragment.FlowClaimDeflectIDProtectionStepCurrentStep -> {
ClaimFlowStep.ClaimDeflectIdProtectionStep(
flowId,
title,
description,
partners,
)
}

else -> ClaimFlowStep.UnknownStep(flowId)
else -> {
ClaimFlowStep.UnknownStep(flowId)
}
}
}

Expand Down
Loading
Loading