Skip to content

Commit

Permalink
Merge pull request #1877 from HedvigInsurance/cleanup/octopus_payment…
Browse files Browse the repository at this point in the history
…_screen

Make payments use octopus
  • Loading branch information
StylianosGakis authored Nov 12, 2023
2 parents 69bd3b5 + c471261 commit cf94d48
Show file tree
Hide file tree
Showing 132 changed files with 1,524 additions and 1,486 deletions.
2 changes: 0 additions & 2 deletions app/apollo/apollo-core/build.gradle.kts
Original file line number Diff line number Diff line change
Expand Up @@ -12,7 +12,5 @@ dependencies {
api(libs.okhttp.core)

implementation(libs.apollo.normalizedCache)
implementation(libs.moneta)
implementation(projects.apolloGiraffePublic)
implementation(projects.coreCommonPublic)
}

This file was deleted.

This file was deleted.

2 changes: 1 addition & 1 deletion app/apollo/apollo-octopus-public/build.gradle.kts
Original file line number Diff line number Diff line change
Expand Up @@ -32,7 +32,7 @@ apollo { // Octopus client
generateApolloMetadata.set(true)
generateDataBuilders.set(true)
// https://slack-chats.kotlinlang.org/t/16051277/so-speaking-of-more-multi-module-stuff-i-got-a-query-like-th#976bd846-3cb0-4815-80a1-f73a853fe962
alwaysGenerateTypesMatching.set(listOf("CrossSell", "CrossSellType"))
alwaysGenerateTypesMatching.set(listOf("CrossSell", "CrossSellType", "MemberMutationOutput"))

// https://www.apollographql.com/docs/android/advanced/operation-variables/#make-nullable-variables-non-optional
generateOptionalOperationVariables.set(false)
Expand Down
3 changes: 1 addition & 2 deletions app/app/build.gradle.kts
Original file line number Diff line number Diff line change
Expand Up @@ -208,8 +208,6 @@ dependencies {
implementation(projects.coreUi)
implementation(projects.dataClaimFlow)
implementation(projects.dataClaimTriaging)
implementation(projects.dataForever)
implementation(projects.dataPayment)
implementation(projects.dataSettingsDatastorePublic)
implementation(projects.dataTravelCertificatePublic)
implementation(projects.datadogCore)
Expand All @@ -225,6 +223,7 @@ dependencies {
implementation(projects.featureInsurances)
implementation(projects.featureLogin)
implementation(projects.featureOdyssey)
implementation(projects.featurePayments)
implementation(projects.featureProfile)
implementation(projects.featureTerminateInsurance)
implementation(projects.featureTravelCertificate)
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -36,6 +36,7 @@ import com.hedvig.android.feature.insurances.insurance.insuranceGraph
import com.hedvig.android.feature.odyssey.navigation.claimFlowGraph
import com.hedvig.android.feature.odyssey.navigation.navigateToClaimFlowDestination
import com.hedvig.android.feature.odyssey.navigation.terminalClaimFlowStepDestinations
import com.hedvig.android.feature.payments.navigation.paymentsGraph
import com.hedvig.android.feature.profile.tab.profileGraph
import com.hedvig.android.feature.terminateinsurance.navigation.terminateInsuranceGraph
import com.hedvig.android.feature.travelcertificate.navigation.generateTravelCertificateGraph
Expand Down Expand Up @@ -170,10 +171,19 @@ internal fun HedvigNavHost(
hedvigBuildConstants = hedvigBuildConstants,
)
profileGraph(
nestedGraphs = {},
nestedGraphs = {
paymentsGraph(
navigator = navigator,
hedvigDeepLinkContainer = hedvigDeepLinkContainer,
navigateToConnectPayment = navigateToConnectPayment,
)
},
navigator = navigator,
hedvigDeepLinkContainer = hedvigDeepLinkContainer,
hedvigBuildConstants = hedvigBuildConstants,
navigateToPaymentInfo = { backStackEntry ->
with(navigator) { backStackEntry.navigate(AppDestination.PaymentInfo) }
},
navigateToConnectPayment = navigateToConnectPayment,
openAppSettings = { activityNavigator.openAppSettings(context) },
openUrl = ::openUrl,
Expand Down
6 changes: 2 additions & 4 deletions app/app/src/main/kotlin/com/hedvig/app/ApplicationModule.kt
Original file line number Diff line number Diff line change
Expand Up @@ -38,8 +38,6 @@ import com.hedvig.android.core.common.di.datastoreFileQualifier
import com.hedvig.android.core.datastore.di.dataStoreModule
import com.hedvig.android.core.demomode.DemoManager
import com.hedvig.android.core.demomode.di.demoModule
import com.hedvig.android.data.forever.di.foreverDataModule
import com.hedvig.android.data.payment.di.paymentModule
import com.hedvig.android.data.settings.datastore.di.settingsDatastoreModule
import com.hedvig.android.data.travelcertificate.di.claimFlowDataModule
import com.hedvig.android.data.travelcertificate.di.travelCertificateDataModule
Expand All @@ -59,6 +57,7 @@ import com.hedvig.android.feature.home.di.homeModule
import com.hedvig.android.feature.insurances.di.insurancesModule
import com.hedvig.android.feature.login.di.loginModule
import com.hedvig.android.feature.odyssey.di.odysseyModule
import com.hedvig.android.feature.payments.di.paymentsModule
import com.hedvig.android.feature.profile.di.profileModule
import com.hedvig.android.feature.terminateinsurance.di.terminateInsuranceModule
import com.hedvig.android.feature.travelcertificate.di.travelCertificateModule
Expand Down Expand Up @@ -365,7 +364,6 @@ val applicationModule = module {
demoModule,
featureManagerModule,
firebaseNotificationModule,
foreverDataModule,
foreverModule,
hAnalyticsAndroidModule,
hAnalyticsModule,
Expand All @@ -380,7 +378,7 @@ val applicationModule = module {
notificationBadgeModule,
notificationModule,
odysseyModule,
paymentModule,
paymentsModule,
profileModule,
settingsDatastoreModule,
sharedPreferencesModule,
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -17,14 +17,14 @@ import androidx.compose.foundation.layout.Row
import androidx.compose.foundation.layout.padding
import androidx.compose.foundation.layout.size
import androidx.compose.foundation.shape.CircleShape
import androidx.compose.material3.LocalContentColor
import androidx.compose.material3.MaterialTheme
import androidx.compose.material3.Surface
import androidx.compose.runtime.Composable
import androidx.compose.runtime.Stable
import androidx.compose.runtime.getValue
import androidx.compose.ui.Modifier
import androidx.compose.ui.graphics.Color
import androidx.compose.ui.graphics.compositeOver
import androidx.compose.ui.graphics.graphicsLayer
import androidx.compose.ui.unit.Dp
import androidx.compose.ui.unit.dp
Expand All @@ -33,12 +33,10 @@ import com.hedvig.android.core.designsystem.preview.HedvigPreview
import com.hedvig.android.core.designsystem.theme.HedvigTheme

@Composable
internal fun ThreeDotsLoading(
fun ThreeDotsLoading(
modifier: Modifier = Modifier,
stableColor: Color = MaterialTheme.colorScheme.onPrimary,
temporaryColor: Color = MaterialTheme.colorScheme.onPrimary
.copy(alpha = DisabledAlpha)
.compositeOver(MaterialTheme.colorScheme.primary),
stableColor: Color = LocalContentColor.current,
temporaryColor: Color = LocalContentColor.current.copy(alpha = DisabledAlpha),
stableScale: Float = 1f,
temporaryScale: Float = 0.9f,
circleRadius: Dp = 6.dp,
Expand Down
Original file line number Diff line number Diff line change
@@ -1,5 +1,12 @@
package com.hedvig.android.core.designsystem.component.button

import androidx.compose.animation.AnimatedContent
import androidx.compose.animation.core.tween
import androidx.compose.animation.core.updateTransition
import androidx.compose.animation.fadeIn
import androidx.compose.animation.fadeOut
import androidx.compose.animation.togetherWith
import androidx.compose.foundation.layout.Box
import androidx.compose.foundation.layout.PaddingValues
import androidx.compose.foundation.layout.RowScope
import androidx.compose.material3.Button
Expand All @@ -9,9 +16,12 @@ import androidx.compose.material3.ButtonElevation
import androidx.compose.material3.MaterialTheme
import androidx.compose.material3.Text
import androidx.compose.runtime.Composable
import androidx.compose.ui.Alignment
import androidx.compose.ui.Modifier
import androidx.compose.ui.draw.alpha
import androidx.compose.ui.text.TextStyle
import androidx.compose.ui.unit.dp
import com.hedvig.android.core.designsystem.animation.ThreeDotsLoading
import com.hedvig.android.core.designsystem.material3.squircleMedium

@Composable
Expand Down Expand Up @@ -42,14 +52,61 @@ fun HedvigContainedSmallButton(
}
}

@Composable
fun HedvigContainedSmallButton(
text: String,
onClick: () -> Unit,
isLoading: Boolean,
modifier: Modifier = Modifier,
textStyle: TextStyle = MaterialTheme.typography.bodyLarge,
enabled: Boolean = true,
colors: ButtonColors = ButtonDefaults.buttonColors(
containerColor = MaterialTheme.colorScheme.primary,
contentColor = MaterialTheme.colorScheme.onPrimary,
disabledContainerColor = MaterialTheme.colorScheme.primary.copy(alpha = 0.12f),
disabledContentColor = MaterialTheme.colorScheme.onPrimary.copy(alpha = 0.38f),
),
elevation: ButtonElevation? = ButtonDefaults.buttonElevation(),
contentPadding: PaddingValues = PaddingValues(horizontal = 16.dp, vertical = 8.dp),
) {
HedvigContainedSmallButton(
onClick = onClick,
enabled = enabled,
elevation = elevation,
contentPadding = contentPadding,
colors = colors,
modifier = modifier,
) {
val loadingTransition = updateTransition(isLoading)
loadingTransition.AnimatedContent(
transitionSpec = {
fadeIn(tween(durationMillis = 220, delayMillis = 90)) togetherWith fadeOut(tween(90))
},
contentAlignment = Alignment.Center,
) { isLoading ->
if (isLoading) {
Box(
contentAlignment = Alignment.Center,
) {
// render the text too so that the same space is taken in all cases
ButtonText(text, Modifier.alpha(0f), textStyle = textStyle)
ThreeDotsLoading()
}
} else {
ButtonText(text, textStyle = textStyle)
}
}
}
}

@Composable
private fun HedvigContainedSmallButton(
onClick: () -> Unit,
enabled: Boolean,
colors: ButtonColors,
elevation: ButtonElevation?,
contentPadding: PaddingValues,
modifier: Modifier = Modifier,
elevation: ButtonElevation? = ButtonDefaults.buttonElevation(),
contentPadding: PaddingValues = PaddingValues(horizontal = 16.dp, vertical = 8.dp),
content: @Composable RowScope.() -> Unit,
) {
Button(
Expand Down
Loading

0 comments on commit cf94d48

Please sign in to comment.