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 @@ -25,9 +25,9 @@ internal class LoggingInterceptor : ApolloInterceptor {
request: ApolloRequest<D>,
chain: ApolloInterceptorChain,
): Flow<ApolloResponse<D>> {
logcat { "GraphQL request for ${request.operation.name()} START." }
logcat(LogPriority.DEBUG) { "GraphQL request for ${request.operation.name()} START." }
return chain.proceed(request).onEach { response ->
logcat { "GraphQL request for ${request.operation.name()} EMISSION. Response data: ${response.data}" }
logcat(LogPriority.DEBUG) { "GraphQL request for ${request.operation.name()} EMISSION. Response data: ${response.data}" }
val data = response.data
val errors = response.errors.orEmpty().map { it.toGraphqlError() }
if (errors.isNotEmpty() && !errors.isUnauthenticated()) {
Expand All @@ -39,7 +39,7 @@ internal class LoggingInterceptor : ApolloInterceptor {
}
}
}.onCompletion {
logcat { "GraphQL request for ${request.operation.name()} END." }
logcat(LogPriority.DEBUG) { "GraphQL request for ${request.operation.name()} END." }
}
}

Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -18,6 +18,7 @@ import androidx.compose.runtime.saveable.Saver
import androidx.compose.runtime.saveable.rememberSaveable
import androidx.compose.runtime.setValue
import androidx.compose.ui.platform.LocalContext
import androidx.compose.ui.platform.LocalInspectionMode
import androidx.core.content.FileProvider
import com.eygraber.uri.toKmpUri
import com.hedvig.android.logger.LogPriority
Expand Down Expand Up @@ -73,6 +74,12 @@ actual fun rememberPhotoCaptureState(
appPackageId: String,
onPhotoCaptured: (uri: com.eygraber.uri.Uri) -> Unit,
): PhotoCaptureState {
if (LocalInspectionMode.current) {
return object : PhotoCaptureState {
override fun launchTakePhotoRequest() {
}
}
}
val context = LocalContext.current
val activity = context.findActivity()
val externalPhotosDirectory = activity.getExternalFilesDir(Environment.DIRECTORY_PICTURES)
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -4,6 +4,7 @@ import androidx.datastore.core.DataStore
import androidx.datastore.preferences.core.Preferences
import androidx.datastore.preferences.core.booleanPreferencesKey
import androidx.datastore.preferences.core.edit
import com.hedvig.android.logger.LogPriority
import com.hedvig.android.logger.logcat
import kotlinx.coroutines.flow.Flow
import kotlinx.coroutines.flow.distinctUntilChanged
Expand All @@ -23,7 +24,7 @@ internal class DataStoreDemoManager(
return dataStore.data.map {
it[demoModeKey] ?: false
}.distinctUntilChanged().onEach {
logcat { "DemoManager: isDemoMode:$it" }
logcat(LogPriority.DEBUG) { "DemoManager: isDemoMode:$it" }
}
}

Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -61,7 +61,7 @@ internal class GetTravelAddonBannerInfoUseCaseImpl(
}
val bannerData = travelAddonBannerQueryResult.bind().currentMember.upsellTravelAddonBanner
if (bannerData == null) {
logcat(LogPriority.DEBUG) { "Got null response from TravelAddonBannerQuery" }
logcat(LogPriority.INFO) { "Got null response from TravelAddonBannerQuery" }
return@either null
}
val nonEmptyContracts = bannerData.contractIds.toNonEmptyListOrNull()
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -6,7 +6,7 @@ internal class DatadogLoggingTree(
private val logger: com.datadog.android.log.Logger,
) : Timber.Tree() {
override fun isLoggable(tag: String?, priority: Int): Boolean {
return priority >= android.util.Log.DEBUG
return priority > android.util.Log.DEBUG
}

override fun log(priority: Int, tag: String?, message: String, t: Throwable?) {
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -3,6 +3,7 @@ package com.hedvig.android.design.system.hedvig.api
import androidx.compose.material3.CalendarLocale
import androidx.compose.runtime.Immutable
import androidx.compose.runtime.Stable
import kotlin.jvm.JvmInline

@Stable
interface HedvigDatePickerState {
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -33,6 +33,7 @@ fun DatePickerWithDialog(
canInteract: Boolean,
startText: String,
modifier: Modifier = Modifier,
onBeforeShow: (() -> Unit)? = null,
) {
var showDatePicker by rememberSaveable { mutableStateOf(false) }
if (showDatePicker) {
Expand Down Expand Up @@ -66,7 +67,10 @@ fun DatePickerWithDialog(
}
}
HedvigBigCard(
onClick = { showDatePicker = true },
onClick = {
onBeforeShow?.invoke()
showDatePicker = true
},
labelText = startText,
inputText = selectedDateText,
enabled = canInteract,
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -37,7 +37,7 @@ internal class SubmitTaskUseCase(
return result
}
val delay = (100 * (2.0.pow(attempt))).milliseconds
logcat(LogPriority.DEBUG) { "SubmitTaskUseCase retrying in $delay" }
logcat(LogPriority.INFO) { "SubmitTaskUseCase retrying in $delay" }
delay(delay)
}

Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -797,7 +797,6 @@ private fun StepBottomContent(
onNavigateToImageViewer = onNavigateToImageViewer,
appPackageId = appPackageId,
imageLoader = imageLoader,
localFiles = stepItem.stepContent.localFiles,
onEvent = onEvent,
canEdit = stepItem.isRegrettable,
continueButtonLoading = currentContinueButtonLoading,
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -387,12 +387,16 @@ internal fun DateSelectBubble(
modifier: Modifier = Modifier,
errorText: String? = null,
) {
val focusManager = LocalFocusManager.current
Column(modifier) {
DatePickerWithDialog(
datePickerState,
canInteract = true,
startText = questionLabel ?: "",
Modifier.fillMaxWidth(),
onBeforeShow = {
focusManager.clearFocus()
},
)
AnimatedVisibility(
// Adding this since datePickerState handles update internally and it's hard to clear the error state as with
Expand Down Expand Up @@ -423,6 +427,7 @@ internal fun SingleSelectBubbleWithDialog(
modifier: Modifier = Modifier,
errorText: String? = null,
) {
val focusManager = LocalFocusManager.current
var showDialog by rememberSaveable { mutableStateOf(false) }
if (showDialog) {
SingleSelectDialog(
Expand All @@ -437,7 +442,10 @@ internal fun SingleSelectBubbleWithDialog(
}
Column(modifier) {
HedvigBigCard(
onClick = { showDialog = true },
onClick = {
focusManager.clearFocus()
showDialog = true
},
labelText = questionLabel,
inputText = options.firstOrNull {
it.id == selectedOptionId
Expand Down Expand Up @@ -470,6 +478,7 @@ internal fun MultiSelectBubbleWithDialog(
modifier: Modifier = Modifier,
errorText: String? = null,
) {
val focusManager = LocalFocusManager.current
var showDialog: Boolean by rememberSaveable { mutableStateOf(false) }
if (showDialog) {
MultiSelectDialog(
Expand All @@ -483,7 +492,10 @@ internal fun MultiSelectBubbleWithDialog(
}
Column(modifier) {
HedvigBigCard(
onClick = { showDialog = true },
onClick = {
focusManager.clearFocus()
showDialog = true
},
labelText = questionLabel,
inputText = when {
selectedOptionIds.isEmpty() -> null
Expand Down
Loading
Loading