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
Loading
Sorry, something went wrong. Reload?
Sorry, we cannot display this file.
Sorry, this file is invalid so it cannot be displayed.
Loading
Sorry, something went wrong. Reload?
Sorry, we cannot display this file.
Sorry, this file is invalid so it cannot be displayed.
Loading
Sorry, something went wrong. Reload?
Sorry, we cannot display this file.
Sorry, this file is invalid so it cannot be displayed.
Loading
Sorry, something went wrong. Reload?
Sorry, we cannot display this file.
Sorry, this file is invalid so it cannot be displayed.
Loading
Sorry, something went wrong. Reload?
Sorry, we cannot display this file.
Sorry, this file is invalid so it cannot be displayed.
Loading
Sorry, something went wrong. Reload?
Sorry, we cannot display this file.
Sorry, this file is invalid so it cannot be displayed.
Binary file not shown.
Binary file not shown.
Binary file not shown.
Binary file not shown.
Binary file not shown.
Binary file not shown.
Binary file not shown.
Binary file not shown.
Binary file not shown.
Binary file not shown.
Binary file not shown.
Loading
Sorry, something went wrong. Reload?
Sorry, we cannot display this file.
Sorry, this file is invalid so it cannot be displayed.
Loading
Sorry, something went wrong. Reload?
Sorry, we cannot display this file.
Sorry, this file is invalid so it cannot be displayed.
Loading
Sorry, something went wrong. Reload?
Sorry, we cannot display this file.
Sorry, this file is invalid so it cannot be displayed.
Loading
Sorry, something went wrong. Reload?
Sorry, we cannot display this file.
Sorry, this file is invalid so it cannot be displayed.
Loading
Sorry, something went wrong. Reload?
Sorry, we cannot display this file.
Sorry, this file is invalid so it cannot be displayed.
Loading
Sorry, something went wrong. Reload?
Sorry, we cannot display this file.
Sorry, this file is invalid so it cannot be displayed.
Original file line number Diff line number Diff line change
@@ -1,15 +1,16 @@
package com.hedvig.android.data.contract

import hedvigandroid.data_contract.generated.resources.Res
import hedvigandroid.data_contract.generated.resources.ic_pillow_accident
import hedvigandroid.data_contract.generated.resources.ic_pillow_car
import hedvigandroid.data_contract.generated.resources.ic_pillow_cat
import hedvigandroid.data_contract.generated.resources.ic_pillow_countryhome
import hedvigandroid.data_contract.generated.resources.ic_pillow_dog
import hedvigandroid.data_contract.generated.resources.ic_pillow_homeowner
import hedvigandroid.data_contract.generated.resources.ic_pillow_rental
import hedvigandroid.data_contract.generated.resources.ic_pillow_student
import hedvigandroid.data_contract.generated.resources.ic_pillow_villa
import hedvigandroid.data_contract.generated.resources.accident
import hedvigandroid.data_contract.generated.resources.car
import hedvigandroid.data_contract.generated.resources.cat
import hedvigandroid.data_contract.generated.resources.dog
import hedvigandroid.data_contract.generated.resources.home
import hedvigandroid.data_contract.generated.resources.homeowner
import hedvigandroid.data_contract.generated.resources.rental
import hedvigandroid.data_contract.generated.resources.student
import hedvigandroid.data_contract.generated.resources.vacation
import hedvigandroid.data_contract.generated.resources.villa
import org.jetbrains.compose.resources.DrawableResource

enum class ContractGroup {
Expand All @@ -23,102 +24,111 @@ enum class ContractGroup {
DOG,
STUDENT,
COUNTRY_HOME,
QASA_LANDLORD,
UNKNOWN,
}

fun ContractGroup.gradientResource(): DrawableResource = when (this) {
ContractGroup.HOMEOWNER -> Res.drawable.ic_pillow_homeowner
ContractGroup.HOUSE -> Res.drawable.ic_pillow_villa
ContractGroup.RENTAL -> Res.drawable.ic_pillow_rental
ContractGroup.STUDENT -> Res.drawable.ic_pillow_student
ContractGroup.ACCIDENT -> Res.drawable.ic_pillow_accident
ContractGroup.CAR -> Res.drawable.ic_pillow_car
ContractGroup.CAT -> Res.drawable.ic_pillow_cat
ContractGroup.DOG -> Res.drawable.ic_pillow_dog
ContractGroup.TRAVEL -> Res.drawable.ic_pillow_homeowner
ContractGroup.COUNTRY_HOME -> Res.drawable.ic_pillow_countryhome
ContractGroup.UNKNOWN -> Res.drawable.ic_pillow_homeowner
ContractGroup.HOMEOWNER -> Res.drawable.homeowner
ContractGroup.HOUSE -> Res.drawable.villa
ContractGroup.RENTAL -> Res.drawable.rental
ContractGroup.STUDENT -> Res.drawable.student
ContractGroup.ACCIDENT -> Res.drawable.accident
ContractGroup.CAR -> Res.drawable.car
ContractGroup.CAT -> Res.drawable.cat
ContractGroup.DOG -> Res.drawable.dog
ContractGroup.TRAVEL -> Res.drawable.homeowner
ContractGroup.COUNTRY_HOME -> Res.drawable.vacation
ContractGroup.UNKNOWN -> Res.drawable.home
ContractGroup.QASA_LANDLORD -> Res.drawable.home
}

fun ContractGroup.pillowResource(): DrawableResource = when (this) {
ContractGroup.HOMEOWNER -> Res.drawable.ic_pillow_homeowner
ContractGroup.HOUSE -> Res.drawable.ic_pillow_villa
ContractGroup.RENTAL -> Res.drawable.ic_pillow_rental
ContractGroup.STUDENT -> Res.drawable.ic_pillow_student
ContractGroup.ACCIDENT -> Res.drawable.ic_pillow_accident
ContractGroup.CAR -> Res.drawable.ic_pillow_car
ContractGroup.CAT -> Res.drawable.ic_pillow_cat
ContractGroup.DOG -> Res.drawable.ic_pillow_dog
ContractGroup.TRAVEL -> Res.drawable.ic_pillow_homeowner
ContractGroup.COUNTRY_HOME -> Res.drawable.ic_pillow_countryhome
ContractGroup.UNKNOWN -> Res.drawable.ic_pillow_homeowner
ContractGroup.HOMEOWNER -> Res.drawable.homeowner
ContractGroup.HOUSE -> Res.drawable.villa
ContractGroup.RENTAL -> Res.drawable.rental
ContractGroup.STUDENT -> Res.drawable.student
ContractGroup.ACCIDENT -> Res.drawable.accident
ContractGroup.CAR -> Res.drawable.car
ContractGroup.CAT -> Res.drawable.cat
ContractGroup.DOG -> Res.drawable.dog
ContractGroup.TRAVEL -> Res.drawable.homeowner
ContractGroup.COUNTRY_HOME -> Res.drawable.vacation
ContractGroup.UNKNOWN -> Res.drawable.home
ContractGroup.QASA_LANDLORD -> Res.drawable.home
}

fun String.toContractGroup(): ContractGroup = when (this) {
"NO_HOUSE",
"DK_HOUSE",
"SE_HOUSE",
-> ContractGroup.HOUSE
"SE_HOUSE_BAS",
"SE_HOUSE_MAX"
-> ContractGroup.HOUSE

"DK_ACCIDENT",
"NO_ACCIDENT",
"SE_ACCIDENT",
"SE_ACCIDENT_STUDENT",
"DK_ACCIDENT_STUDENT",
-> ContractGroup.ACCIDENT
-> ContractGroup.ACCIDENT

"DK_TRAVEL",
"DK_TRAVEL_STUDENT",
"NO_TRAVEL",
"NO_TRAVEL_STUDENT",
"NO_TRAVEL_YOUTH",
-> ContractGroup.TRAVEL
-> ContractGroup.TRAVEL

"DK_HOME_CONTENT_RENT",
"DK_HOME_CONTENT_STUDENT_RENT",
"NO_HOME_CONTENT_RENT",
"SE_APARTMENT_RENT",
"SE_APARTMENT_RENT_MAX",
"SE_APARTMENT_RENT_BAS",
"SE_GROUP_APARTMENT_RENT",
"SE_QASA_LONG_TERM_RENTAL",
"SE_QASA_SHORT_TERM_RENTAL",
"NO_HOME_CONTENT_YOUTH_RENT",
-> ContractGroup.RENTAL
-> ContractGroup.RENTAL

"NO_HOME_CONTENT_YOUTH_OWN",
"DK_HOME_CONTENT_STUDENT_OWN",
"DK_HOME_CONTENT_OWN",
"NO_HOME_CONTENT_OWN",
"SE_APARTMENT_BRF",
"SE_APARTMENT_BRF_BAS",
"SE_APARTMENT_BRF_MAX",
"SE_GROUP_APARTMENT_BRF",
-> ContractGroup.HOMEOWNER
-> ContractGroup.HOMEOWNER

"NO_HOME_CONTENT_STUDENT_OWN",
"NO_HOME_CONTENT_STUDENT_RENT",
"SE_APARTMENT_STUDENT_BRF",
"SE_APARTMENT_STUDENT_RENT",
-> ContractGroup.STUDENT
-> ContractGroup.STUDENT

"SE_CAR_FULL",
"SE_CAR_HALF",
"SE_CAR_TRAFFIC",
"SE_CAR_TRIAL_HALF",
"SE_CAR_TRIAL_FULL",
"SE_CAR_DECOMMISSIONED",
-> ContractGroup.CAR
-> ContractGroup.CAR

"SE_CAT_BASIC",
"SE_CAT_PREMIUM",
"SE_CAT_STANDARD",
-> ContractGroup.CAT
-> ContractGroup.CAT

"SE_DOG_BASIC",
"SE_DOG_PREMIUM",
"SE_DOG_STANDARD",
-> ContractGroup.DOG
-> ContractGroup.DOG

"SE_VACATION_HOME_BAS",
"SE_VACATION_HOME_STANDARD",
-> ContractGroup.COUNTRY_HOME
-> ContractGroup.COUNTRY_HOME

else -> ContractGroup.UNKNOWN
}
Original file line number Diff line number Diff line change
Expand Up @@ -20,6 +20,7 @@ import com.hedvig.android.data.productvariant.toAddonVariant
import com.hedvig.android.data.productvariant.toProductVariant
import com.hedvig.android.feature.insurances.data.InsuranceContract.EstablishedInsuranceContract
import com.hedvig.android.feature.insurances.data.InsuranceContract.PendingInsuranceContract
import com.hedvig.android.logger.logcat
import dev.zacsweers.metro.ContributesBinding
import dev.zacsweers.metro.Inject
import dev.zacsweers.metro.SingleIn
Expand Down
Loading