From 648000686de76eebc3c0b1a01224dff3c15ebdc4 Mon Sep 17 00:00:00 2001 From: stylianosgakis Date: Thu, 12 Oct 2023 16:34:25 +0200 Subject: [PATCH] Fix breaking GQL changes --- .../graphql/insurance/InsuranceContractsQuery.graphql | 5 +---- .../insurance/QueryGetUpcomingRenewalReminder.graphql | 6 +++--- .../graphql/notifications/MemberDeviceRegister.graphql | 2 +- .../insurances/data/GetInsuranceContractsUseCase.kt | 2 +- .../memberreminders/GetUpcomingRenewalRemindersUseCase.kt | 7 ++++--- 5 files changed, 10 insertions(+), 12 deletions(-) diff --git a/app/apollo/apollo-octopus-public/src/main/graphql/com/hedvig/android/apollo/octopus/graphql/insurance/InsuranceContractsQuery.graphql b/app/apollo/apollo-octopus-public/src/main/graphql/com/hedvig/android/apollo/octopus/graphql/insurance/InsuranceContractsQuery.graphql index c62f1e1de8..ec06ebb685 100644 --- a/app/apollo/apollo-octopus-public/src/main/graphql/com/hedvig/android/apollo/octopus/graphql/insurance/InsuranceContractsQuery.graphql +++ b/app/apollo/apollo-octopus-public/src/main/graphql/com/hedvig/android/apollo/octopus/graphql/insurance/InsuranceContractsQuery.graphql @@ -15,10 +15,7 @@ fragment ContractFragment on Contract { masterInceptionDate terminationDate exposureDisplayName - supportsAddressChange - upcomingRenewal { - renewalDate - } + supportsMoving currentAgreement { ...AgreementFragment } diff --git a/app/apollo/apollo-octopus-public/src/main/graphql/com/hedvig/android/apollo/octopus/graphql/insurance/QueryGetUpcomingRenewalReminder.graphql b/app/apollo/apollo-octopus-public/src/main/graphql/com/hedvig/android/apollo/octopus/graphql/insurance/QueryGetUpcomingRenewalReminder.graphql index 3090bcd3b4..5a554ad64f 100644 --- a/app/apollo/apollo-octopus-public/src/main/graphql/com/hedvig/android/apollo/octopus/graphql/insurance/QueryGetUpcomingRenewalReminder.graphql +++ b/app/apollo/apollo-octopus-public/src/main/graphql/com/hedvig/android/apollo/octopus/graphql/insurance/QueryGetUpcomingRenewalReminder.graphql @@ -6,9 +6,9 @@ query GetUpcomingRenewalReminder { displayName } } - upcomingRenewal { - renewalDate - draftCertificateUrl + upcomingChangedAgreement { + activeFrom + certificateUrl } } } diff --git a/app/apollo/apollo-octopus-public/src/main/graphql/com/hedvig/android/apollo/octopus/graphql/notifications/MemberDeviceRegister.graphql b/app/apollo/apollo-octopus-public/src/main/graphql/com/hedvig/android/apollo/octopus/graphql/notifications/MemberDeviceRegister.graphql index c111d813ac..8cd72a83ae 100644 --- a/app/apollo/apollo-octopus-public/src/main/graphql/com/hedvig/android/apollo/octopus/graphql/notifications/MemberDeviceRegister.graphql +++ b/app/apollo/apollo-octopus-public/src/main/graphql/com/hedvig/android/apollo/octopus/graphql/notifications/MemberDeviceRegister.graphql @@ -1,3 +1,3 @@ mutation MemberDeviceRegister($token: String!) { - memberDeviceRegister(input: {type: "ANDROID", token: $token}) + memberDeviceRegister(input: {platform: ANDROID, token: $token}) } diff --git a/app/feature/feature-insurances/src/main/kotlin/com/hedvig/android/feature/insurances/data/GetInsuranceContractsUseCase.kt b/app/feature/feature-insurances/src/main/kotlin/com/hedvig/android/feature/insurances/data/GetInsuranceContractsUseCase.kt index a5c2d60d79..8e6690e243 100644 --- a/app/feature/feature-insurances/src/main/kotlin/com/hedvig/android/feature/insurances/data/GetInsuranceContractsUseCase.kt +++ b/app/feature/feature-insurances/src/main/kotlin/com/hedvig/android/feature/insurances/data/GetInsuranceContractsUseCase.kt @@ -43,7 +43,7 @@ private fun ContractFragment.toContract(isTerminated: Boolean = false): Insuranc displayName = currentAgreement.productVariant.displayName, exposureDisplayName = exposureDisplayName, inceptionDate = masterInceptionDate, - renewalDate = upcomingRenewal.renewalDate, + renewalDate = upcomingChangedAgreement?.activeFrom, terminationDate = terminationDate, currentAgreement = Agreement( activeFrom = currentAgreement.activeFrom, diff --git a/app/member-reminders/member-reminders-public/src/main/kotlin/com/hedvig/android/memberreminders/GetUpcomingRenewalRemindersUseCase.kt b/app/member-reminders/member-reminders-public/src/main/kotlin/com/hedvig/android/memberreminders/GetUpcomingRenewalRemindersUseCase.kt index 0b6b26845f..221984f468 100644 --- a/app/member-reminders/member-reminders-public/src/main/kotlin/com/hedvig/android/memberreminders/GetUpcomingRenewalRemindersUseCase.kt +++ b/app/member-reminders/member-reminders-public/src/main/kotlin/com/hedvig/android/memberreminders/GetUpcomingRenewalRemindersUseCase.kt @@ -35,11 +35,12 @@ internal class GetUpcomingRenewalRemindersUseCaseImpl( .activeContracts val upcomingRenewals: NonEmptyList? = contracts - .map { contract -> + .mapNotNull { contract -> + val upcomingChangedAgreement = contract.upcomingChangedAgreement ?: return@mapNotNull null UpcomingRenewal( contract.currentAgreement.productVariant.displayName, - contract.upcomingRenewal.renewalDate, - contract.upcomingRenewal.draftCertificateUrl, + upcomingChangedAgreement.activeFrom, + upcomingChangedAgreement.certificateUrl, ) } .filter { upcomingRenewal ->