Skip to content

Commit

Permalink
Merge branch 'release/12.4.2'
Browse files Browse the repository at this point in the history
  • Loading branch information
panasetskaya committed Jan 30, 2024
2 parents d754882 + 6e854a4 commit 8c0fd9e
Show file tree
Hide file tree
Showing 71 changed files with 1,013 additions and 259 deletions.
1 change: 0 additions & 1 deletion app/apollo/apollo-octopus-public/build.gradle.kts
Original file line number Diff line number Diff line change
Expand Up @@ -39,7 +39,6 @@ apollo { // Octopus client
mapScalar("Date", "kotlinx.datetime.LocalDate", "com.apollographql.apollo3.adapter.KotlinxLocalDateAdapter")
mapScalar("DateTime", "kotlinx.datetime.LocalDate", "com.apollographql.apollo3.adapter.KotlinxLocalDateTimeAdapter")
mapScalar("Instant", "kotlinx.datetime.Instant", "com.apollographql.apollo3.adapter.KotlinxInstantAdapter")
mapScalarToUpload("Upload")
mapScalarToKotlinString("UUID")
mapScalarToKotlinString("Url")
mapScalarToKotlinString("FlowContext")
Expand Down
7 changes: 5 additions & 2 deletions app/app/build.gradle.kts
Original file line number Diff line number Diff line change
Expand Up @@ -25,7 +25,7 @@ android {
applicationId = "com.hedvig"

versionCode = 43
versionName = "12.4.0"
versionName = "12.4.2"

vectorDrawables.useSupportLibrary = true

Expand Down Expand Up @@ -178,6 +178,7 @@ dependencies {
implementation(projects.dataSettingsDatastorePublic)
implementation(projects.dataTravelCertificatePublic)
implementation(projects.datadogCore)
implementation(projects.dataContractPublic)
implementation(projects.datadogDemoTracking)
implementation(projects.featureChangeaddress)
implementation(projects.featureChat)
Expand All @@ -188,6 +189,7 @@ dependencies {
implementation(projects.featureEditCoinsured)
implementation(projects.featureForever)
implementation(projects.featureHelpCenter)
implementation(projects.featureFlagsPublic)
implementation(projects.featureHome)
implementation(projects.featureInsurances)
implementation(projects.featureLogin)
Expand All @@ -196,13 +198,14 @@ dependencies {
implementation(projects.featureProfile)
implementation(projects.featureTerminateInsurance)
implementation(projects.featureTravelCertificate)
implementation(projects.featureFlagsPublic)
implementation(projects.initializable)
implementation(projects.languageCore)
implementation(projects.languageData)
implementation(projects.languageMigration)
implementation(projects.loggingAndroid)
implementation(projects.loggingPublic)
implementation(projects.marketCore)
implementation(projects.marketSet)
implementation(projects.memberRemindersPublic)
implementation(projects.navigationActivity)
implementation(projects.navigationCore)
Expand Down
2 changes: 1 addition & 1 deletion app/app/src/main/AndroidManifest.xml
Original file line number Diff line number Diff line change
Expand Up @@ -66,7 +66,7 @@
android:windowSoftInputMode="adjustResize" />
<activity
android:name=".feature.marketing.MarketingActivity"
android:configChanges="keyboard|keyboardHidden|orientation|screenSize|locale|layoutDirection"
android:configChanges="keyboard|keyboardHidden|orientation|screenSize|layoutDirection"
android:theme="@style/Hedvig.Theme"
android:windowSoftInputMode="adjustResize" />

Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -34,6 +34,7 @@ import com.hedvig.android.feature.forever.navigation.foreverGraph
import com.hedvig.android.feature.help.center.helpCenterGraph
import com.hedvig.android.feature.help.center.navigation.HelpCenterDestination
import com.hedvig.android.feature.home.home.navigation.homeGraph
import com.hedvig.android.feature.insurances.data.CancelInsuranceData
import com.hedvig.android.feature.insurances.insurance.insuranceGraph
import com.hedvig.android.feature.odyssey.navigation.claimFlowGraph
import com.hedvig.android.feature.odyssey.navigation.navigateToClaimFlowDestination
Expand Down Expand Up @@ -107,7 +108,7 @@ internal fun HedvigNavHost(
hedvigDeepLinkContainer = hedvigDeepLinkContainer,
onStartChat = { backStackEntry ->
with(navigator) {
backStackEntry.navigate(AppDestination.Chat)
backStackEntry.navigate(AppDestination.Chat())
}
},
onStartClaim = { backStackEntry ->
Expand All @@ -132,9 +133,10 @@ internal fun HedvigNavHost(
windowSizeClass = hedvigAppState.windowSizeClass,
navigator = navigator,
navController = hedvigAppState.navController,
imageLoader = imageLoader,
openChat = { backStackEntry ->
with(navigator) {
backStackEntry.navigate(AppDestination.Chat)
backStackEntry.navigate(AppDestination.Chat())
}
},
openPlayStore = { activityNavigator.tryOpenPlayStore(context) },
Expand All @@ -149,29 +151,35 @@ internal fun HedvigNavHost(
},
openChat = { backStackEntry ->
with(navigator) {
backStackEntry.navigate(AppDestination.Chat)
backStackEntry.navigate(AppDestination.Chat())
}
},
startMovingFlow = { backStackEntry ->
with(navigator) {
backStackEntry.navigate(AppDestination.ChangeAddress)
}
},
startTerminationFlow = { backStackEntry: NavBackStackEntry, insuranceId: String, insuranceDisplayName: String ->
startTerminationFlow = { backStackEntry: NavBackStackEntry, data: CancelInsuranceData ->
with(navigator) {
backStackEntry.navigate(AppDestination.TerminateInsurance(insuranceId, insuranceDisplayName))
val destination = AppDestination.TerminateInsurance(
contractId = data.contractId,
insuranceDisplayName = data.contractDisplayName,
exposureName = data.contractExposure,
contractGroup = data.contractGroup,
)
backStackEntry.navigate(destination)
}
},
hedvigDeepLinkContainer = hedvigDeepLinkContainer,
imageLoader = imageLoader,
startEditCoInsured = { backStackEntry: NavBackStackEntry, contractId: String ->
with(navigator) {
backStackEntry.navigate(AppDestination.CoInsuredAddInfo(contractId))
backStackEntry.navigate(AppDestination.CoInsuredAddOrRemove(contractId))
}
},
startEditCoInsuredAddMissingInfo = { backStackEntry: NavBackStackEntry, contractId: String ->
with(navigator) {
backStackEntry.navigate(AppDestination.CoInsuredAddOrRemove(contractId))
backStackEntry.navigate(AppDestination.CoInsuredAddInfo(contractId))
}
},
)
Expand Down Expand Up @@ -231,10 +239,11 @@ internal fun HedvigNavHost(
)
connectAdyenPaymentGraph(navigator)
helpCenterGraph(
hedvigDeepLinkContainer = hedvigDeepLinkContainer,
navigator = navigator,
) { backStackEntry ->
) { backStackEntry, chatContext ->
with(navigator) {
backStackEntry.navigate(AppDestination.Chat)
backStackEntry.navigate(AppDestination.Chat(chatContext))
}
}
}
Expand All @@ -259,15 +268,15 @@ private fun NavGraphBuilder.nestedHomeGraphs(
appPackageId = hedvigBuildConstants.appId,
openChat = { backStackEntry ->
with(navigator) {
backStackEntry.navigate(AppDestination.Chat)
backStackEntry.navigate(AppDestination.Chat())
}
},
)
changeAddressGraph(
navController = hedvigAppState.navController,
openChat = { backStackEntry ->
with(navigator) {
backStackEntry.navigate(AppDestination.Chat)
backStackEntry.navigate(AppDestination.Chat())
}
},
openUrl = { activityNavigator.openWebsite(context, Uri.parse(it)) },
Expand Down Expand Up @@ -304,7 +313,7 @@ private fun NavGraphBuilder.nestedHomeGraphs(
openUrl = { activityNavigator.openWebsite(context, Uri.parse(it)) },
openChat = { backStackEntry ->
with(navigator) {
backStackEntry.navigate(AppDestination.Chat)
backStackEntry.navigate(AppDestination.Chat())
}
},
imageLoader = imageLoader,
Expand All @@ -318,7 +327,7 @@ private fun NavGraphBuilder.nestedHomeGraphs(
},
openChat = { backStackEntry ->
with(navigator) {
backStackEntry.navigate(destination = AppDestination.Chat) {
backStackEntry.navigate(destination = AppDestination.Chat()) {
popUpTo<AppDestination.TopLevelDestination.Home>()
}
}
Expand Down
15 changes: 9 additions & 6 deletions app/app/src/main/kotlin/com/hedvig/app/ApplicationModule.kt
Original file line number Diff line number Diff line change
Expand Up @@ -64,8 +64,10 @@ import com.hedvig.android.feature.terminateinsurance.di.terminateInsuranceModule
import com.hedvig.android.feature.travelcertificate.di.travelCertificateModule
import com.hedvig.android.featureflags.di.featureManagerModule
import com.hedvig.android.language.LanguageService
import com.hedvig.android.language.di.languageMigrationModule
import com.hedvig.android.language.di.languageModule
import com.hedvig.android.market.di.marketManagerModule
import com.hedvig.android.market.di.setMarketModule
import com.hedvig.android.memberreminders.di.memberRemindersModule
import com.hedvig.android.navigation.activity.ActivityNavigator
import com.hedvig.android.navigation.core.HedvigDeepLinkContainer
Expand All @@ -89,7 +91,6 @@ import com.hedvig.app.util.apollo.DeviceIdInterceptor
import com.hedvig.app.util.apollo.NetworkCacheManagerImpl
import com.hedvig.app.util.apollo.SunsettingInterceptor
import java.io.File
import java.util.Locale
import okhttp3.OkHttpClient
import okhttp3.logging.HttpLoggingInterceptor
import org.koin.androidx.viewmodel.dsl.viewModel
Expand All @@ -112,9 +113,9 @@ private val networkModule = module {
chain
.request()
.newBuilder()
.header("User-Agent", makeUserAgent(languageService.getLocale()))
.header("Accept-Language", languageService.getLocale().toLanguageTag())
.header("hedvig-language", languageService.getLocale().toLanguageTag())
.header("User-Agent", makeUserAgent(languageService.getLanguage().toBcp47Format()))
.header("Accept-Language", languageService.getLanguage().toBcp47Format())
.header("hedvig-language", languageService.getLanguage().toBcp47Format())
.header("apollographql-client-name", BuildConfig.APPLICATION_ID)
.header("apollographql-client-version", BuildConfig.VERSION_NAME)
.header("X-Build-Version", BuildConfig.VERSION_CODE.toString())
Expand Down Expand Up @@ -161,7 +162,7 @@ private val networkModule = module {
}
}

fun makeUserAgent(locale: Locale): String = buildString {
fun makeUserAgent(languageBCP47: String): String = buildString {
append(BuildConfig.APPLICATION_ID)
append(" ")
append(BuildConfig.VERSION_NAME)
Expand All @@ -176,7 +177,7 @@ fun makeUserAgent(locale: Locale): String = buildString {
append("; ")
append(Build.DEVICE)
append("; ")
append(locale.language)
append(languageBCP47)
append(")")
}

Expand Down Expand Up @@ -346,6 +347,7 @@ val applicationModule = module {
homeModule,
insurancesModule,
languageAuthListenersModule,
languageMigrationModule,
languageModule,
loginModule,
marketManagerModule,
Expand All @@ -356,6 +358,7 @@ val applicationModule = module {
odysseyModule,
paymentsModule,
profileModule,
setMarketModule,
settingsDatastoreModule,
sharedPreferencesModule,
terminateInsuranceModule,
Expand Down
10 changes: 7 additions & 3 deletions app/app/src/main/kotlin/com/hedvig/app/HedvigApplication.kt
Original file line number Diff line number Diff line change
Expand Up @@ -3,19 +3,23 @@ package com.hedvig.app
import android.app.Application
import androidx.appcompat.app.AppCompatDelegate
import com.hedvig.android.app.AppInitializers
import com.hedvig.android.language.LanguageService
import com.hedvig.android.language.LanguageAndMarketLaunchCheckUseCase
import com.hedvig.app.feature.tracking.ActivityChangeTracker
import kotlinx.coroutines.MainScope
import kotlinx.coroutines.launch
import org.koin.android.ext.android.inject

open class HedvigApplication : Application() {
private val languageService: LanguageService by inject()
private val languageAndMarketLaunchCheckUseCase: LanguageAndMarketLaunchCheckUseCase by inject()
private val appInitializers: AppInitializers by inject()

override fun onCreate() {
super.onCreate()
registerActivityLifecycleCallbacks(ActivityChangeTracker())
AppCompatDelegate.setCompatVectorFromResourcesEnabled(true)
languageService.performOnLaunchLanguageCheck()
appInitializers.initialize()
MainScope().launch {
languageAndMarketLaunchCheckUseCase.invoke()
}
}
}
Original file line number Diff line number Diff line change
Expand Up @@ -18,7 +18,10 @@ class ReplyWorker(
) : CoroutineWorker(context, params) {
override suspend fun doWork(): Result {
val replyText = inputData.getString(ChatMessageNotificationReceiver.REPLY_TEXT) ?: return Result.failure()
val sendChatMessageResponse = chatRepository.sendMessage(replyText)
val sendChatMessageResponse = chatRepository.sendMessage(
text = replyText,
context = null,
)

when (sendChatMessageResponse) {
is Either.Left -> {
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -101,7 +101,7 @@ fun HedvigContainedButton(
onClick()
}
},
enabled = enabled,
enabled = enabled || isLoading,
modifier = modifier,
contentPadding = contentPadding,
colors = colors,
Expand Down
Original file line number Diff line number Diff line change
@@ -1,10 +1,9 @@
package com.hedvig.app.util.compose
package com.hedvig.android.core.ui.compose

import androidx.compose.runtime.Composable
import androidx.compose.runtime.SideEffect
import androidx.compose.runtime.remember
import com.hedvig.android.logger.logcat
import com.hedvig.app.BuildConfig

/**
* Only for use with [LogCompositions], not defined as private because inline [LogCompositions] doesn't allow it.
Expand All @@ -19,9 +18,7 @@ class Ref(var value: Int)
@Suppress("NOTHING_TO_INLINE")
@Composable
inline fun LogCompositions(message: String) {
if (BuildConfig.DEBUG) {
val ref = remember { Ref(0) }
SideEffect { ref.value++ }
logcat { "Debug Log Compositions: $message ${ref.value}" }
}
val ref = remember { Ref(0) }
SideEffect { ref.value++ }
logcat { "Debug Log Compositions: $message ${ref.value}" }
}
Original file line number Diff line number Diff line change
Expand Up @@ -142,6 +142,7 @@ fun ContractType.isTrialContract() = when (this) {
fun ContractType.supportsTravelCertificate(): Boolean = when (this) {
SE_HOUSE,
SE_APARTMENT_BRF,
SE_APARTMENT_RENT,
SE_APARTMENT_STUDENT_BRF,
SE_APARTMENT_STUDENT_RENT,
-> true
Expand Down
2 changes: 2 additions & 0 deletions app/feature/feature-chat/build.gradle.kts
Original file line number Diff line number Diff line change
Expand Up @@ -31,6 +31,8 @@ dependencies {
implementation(libs.kotlinx.serialization.json)
implementation(libs.retrofit)
implementation(libs.retrofitArrow)
implementation(libs.compose.richtext)
implementation(libs.compose.richtextUi)
implementation(libs.retrofitKotlinxSerializationConverter)
implementation(projects.apolloCore)
implementation(projects.apolloOctopusPublic)
Expand Down
Loading

0 comments on commit 8c0fd9e

Please sign in to comment.