Skip to content

Commit

Permalink
Merge branch 'align-screen-and-dialog-composable-names-droid-726'
Browse files Browse the repository at this point in the history
  • Loading branch information
Rawa committed Jul 19, 2024
2 parents feade99 + 7f616dd commit 3a96d56
Show file tree
Hide file tree
Showing 42 changed files with 190 additions and 119 deletions.
Original file line number Diff line number Diff line change
Expand Up @@ -15,12 +15,12 @@ import net.mullvad.mullvadvpn.lib.theme.AppTheme
@Preview
@Composable
private fun PreviewApiAccessMethodInfoDialog() {
AppTheme { ApiAccessMethodInfoDialog(EmptyDestinationsNavigator) }
AppTheme { ApiAccessMethodInfo(EmptyDestinationsNavigator) }
}

@Destination<RootGraph>(style = DestinationStyle.Dialog::class)
@Composable
fun ApiAccessMethodInfoDialog(navigator: DestinationsNavigator) {
fun ApiAccessMethodInfo(navigator: DestinationsNavigator) {
InfoDialog(
message =
buildString {
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -12,7 +12,7 @@ import net.mullvad.mullvadvpn.compose.component.textResource

@Destination<RootGraph>(style = DestinationStyle.Dialog::class)
@Composable
fun ContentBlockersInfoDialog(navigator: DestinationsNavigator) {
fun ContentBlockersInfo(navigator: DestinationsNavigator) {
InfoDialog(
message =
buildString {
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -14,12 +14,12 @@ import net.mullvad.mullvadvpn.R
@Preview
@Composable
private fun PreviewCustomDnsInfoDialog() {
CustomDnsInfoDialog(EmptyDestinationsNavigator)
CustomDnsInfo(EmptyDestinationsNavigator)
}

@Destination<RootGraph>(style = DestinationStyle.Dialog::class)
@Composable
fun CustomDnsInfoDialog(navigator: DestinationsNavigator) {
fun CustomDnsInfo(navigator: DestinationsNavigator) {
InfoDialog(
message = stringResource(id = R.string.settings_changes_effect_warning_content_blocker),
onDismiss = dropUnlessResumed { navigator.navigateUp() }
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -11,7 +11,7 @@ import net.mullvad.mullvadvpn.R

@Destination<RootGraph>(style = DestinationStyle.Dialog::class)
@Composable
fun DeviceNameInfoDialog(navigator: DestinationsNavigator) {
fun DeviceNameInfo(navigator: DestinationsNavigator) {
InfoDialog(
message =
buildString {
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -18,7 +18,7 @@ import net.mullvad.mullvadvpn.compose.button.PrimaryButton

@Destination<RootGraph>(style = DestinationStyle.Dialog::class)
@Composable
fun DiscardChangesDialog(resultBackNavigator: ResultBackNavigator<Boolean>) {
fun DiscardChanges(resultBackNavigator: ResultBackNavigator<Boolean>) {
AlertDialog(
onDismissRequest = dropUnlessResumed { resultBackNavigator.navigateBack() },
title = { Text(text = stringResource(id = R.string.discard_changes)) },
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -58,7 +58,7 @@ data class DnsDialogNavArgs(

@Destination<RootGraph>(style = DestinationStyle.Dialog::class, navArgs = DnsDialogNavArgs::class)
@Composable
fun DnsDialog(
fun Dns(
resultNavigator: ResultBackNavigator<DnsDialogResult>,
) {
val viewModel = koinViewModel<DnsDialogViewModel>()
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -15,12 +15,12 @@ import net.mullvad.mullvadvpn.compose.component.textResource
@Preview
@Composable
private fun PreviewLocalNetworkSharingInfoDialog() {
LocalNetworkSharingInfoDialog(EmptyDestinationsNavigator)
LocalNetworkSharingInfo(EmptyDestinationsNavigator)
}

@Destination<RootGraph>(style = DestinationStyle.Dialog::class)
@Composable
fun LocalNetworkSharingInfoDialog(navigator: DestinationsNavigator) {
fun LocalNetworkSharingInfo(navigator: DestinationsNavigator) {
InfoDialog(
message = stringResource(id = R.string.local_network_sharing_info),
additionalInfo =
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -14,12 +14,12 @@ import net.mullvad.mullvadvpn.R
@Preview
@Composable
private fun PreviewMalwareInfoDialog() {
MalwareInfoDialog(EmptyDestinationsNavigator)
MalwareInfo(EmptyDestinationsNavigator)
}

@Destination<RootGraph>(style = DestinationStyle.Dialog::class)
@Composable
fun MalwareInfoDialog(navigator: DestinationsNavigator) {
fun MalwareInfo(navigator: DestinationsNavigator) {
InfoDialog(
message = stringResource(id = R.string.malware_info),
onDismiss = dropUnlessResumed { navigator.navigateUp() }
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -38,14 +38,14 @@ import org.koin.androidx.compose.koinViewModel
@Preview
@Composable
private fun PreviewMtuDialog() {
AppTheme { MtuDialog(EmptyResultBackNavigator()) }
AppTheme { Mtu(EmptyResultBackNavigator()) }
}

data class MtuNavArgs(val initialMtu: Mtu? = null)

@Destination<RootGraph>(style = DestinationStyle.Dialog::class, navArgs = MtuNavArgs::class)
@Composable
fun MtuDialog(navigator: ResultBackNavigator<Boolean>) {
fun Mtu(navigator: ResultBackNavigator<Boolean>) {
val viewModel = koinViewModel<MtuDialogViewModel>()

val uiState by viewModel.uiState.collectAsStateWithLifecycle()
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -14,12 +14,12 @@ import net.mullvad.mullvadvpn.R
@Preview
@Composable
private fun PreviewObfuscationInfoDialog() {
ObfuscationInfoDialog(EmptyDestinationsNavigator)
ObfuscationInfo(EmptyDestinationsNavigator)
}

@Destination<RootGraph>(style = DestinationStyle.Dialog::class)
@Composable
fun ObfuscationInfoDialog(navigator: DestinationsNavigator) {
fun ObfuscationInfo(navigator: DestinationsNavigator) {
InfoDialog(
message = stringResource(id = R.string.obfuscation_info),
onDismiss = dropUnlessResumed { navigator.navigateUp() }
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -14,12 +14,12 @@ import net.mullvad.mullvadvpn.R
@Preview
@Composable
private fun PreviewQuantumResistanceInfoDialog() {
QuantumResistanceInfoDialog(EmptyDestinationsNavigator)
QuantumResistanceInfo(EmptyDestinationsNavigator)
}

@Destination<RootGraph>(style = DestinationStyle.Dialog::class)
@Composable
fun QuantumResistanceInfoDialog(navigator: DestinationsNavigator) {
fun QuantumResistanceInfo(navigator: DestinationsNavigator) {
InfoDialog(
message = stringResource(id = R.string.quantum_resistant_info_first_paragaph),
additionalInfo = stringResource(id = R.string.quantum_resistant_info_second_paragaph),
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -37,12 +37,12 @@ import net.mullvad.mullvadvpn.lib.theme.Dimens
private fun PreviewRemoveDeviceConfirmationDialog(
@PreviewParameter(DevicePreviewParameterProvider::class) device: Device
) {
AppTheme { RemoveDeviceConfirmationDialog(EmptyResultBackNavigator(), device = device) }
AppTheme { RemoveDeviceConfirmation(EmptyResultBackNavigator(), device = device) }
}

@Destination<RootGraph>(style = DestinationStyle.Dialog::class)
@Composable
fun RemoveDeviceConfirmationDialog(navigator: ResultBackNavigator<DeviceId>, device: Device) {
fun RemoveDeviceConfirmation(navigator: ResultBackNavigator<DeviceId>, device: Device) {
AlertDialog(
onDismissRequest = dropUnlessResumed { navigator.navigateBack() },
icon = {
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -27,12 +27,12 @@ import net.mullvad.mullvadvpn.lib.theme.Dimens
@Preview
@Composable
private fun PreviewReportProblemNoEmailDialog() {
AppTheme { ReportProblemNoEmailDialog(EmptyResultBackNavigator()) }
AppTheme { ReportProblemNoEmail(EmptyResultBackNavigator()) }
}

@Destination<RootGraph>(style = DestinationStyle.Dialog::class)
@Composable
fun ReportProblemNoEmailDialog(resultBackNavigator: ResultBackNavigator<Boolean>) {
fun ReportProblemNoEmail(resultBackNavigator: ResultBackNavigator<Boolean>) {
AlertDialog(
onDismissRequest = dropUnlessResumed { resultBackNavigator.navigateBack() },
icon = {
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -14,12 +14,12 @@ import net.mullvad.mullvadvpn.R
@Preview
@Composable
private fun PreviewServerIpOverridesInfoDialog() {
ServerIpOverridesInfoDialog(EmptyDestinationsNavigator)
ServerIpOverridesInfo(EmptyDestinationsNavigator)
}

@Destination<RootGraph>(style = DestinationStyle.Dialog::class)
@Composable
fun ServerIpOverridesInfoDialog(navigator: DestinationsNavigator) {
fun ServerIpOverridesInfo(navigator: DestinationsNavigator) {
InfoDialog(
message =
buildString {
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -15,12 +15,12 @@ import net.mullvad.mullvadvpn.lib.theme.AppTheme
@Preview
@Composable
private fun PreviewUdpOverTcpPortInfoDialog() {
AppTheme { UdpOverTcpPortInfoDialog(EmptyDestinationsNavigator) }
AppTheme { UdpOverTcpPortInfo(EmptyDestinationsNavigator) }
}

@Destination<RootGraph>(style = DestinationStyle.Dialog::class)
@Composable
fun UdpOverTcpPortInfoDialog(navigator: DestinationsNavigator) {
fun UdpOverTcpPortInfo(navigator: DestinationsNavigator) {
InfoDialog(
message = stringResource(id = R.string.udp_over_tcp_port_info),
onDismiss = dropUnlessResumed { navigator.navigateUp() }
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -39,7 +39,7 @@ import net.mullvad.mullvadvpn.util.inAnyOf
@Composable
private fun PreviewWireguardCustomPortDialog() {
AppTheme {
WireguardCustomPortDialog(
WireguardCustomPort(
WireguardCustomPortNavArgs(
customPort = null,
allowedPortRanges = listOf(PortRange(10..10), PortRange(40..50)),
Expand All @@ -57,7 +57,7 @@ data class WireguardCustomPortNavArgs(

@Destination<RootGraph>(style = DestinationStyle.Dialog::class)
@Composable
fun WireguardCustomPortDialog(
fun WireguardCustomPort(
navArg: WireguardCustomPortNavArgs,
backNavigator: ResultBackNavigator<Port?>,
) {
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -20,7 +20,7 @@ import net.mullvad.mullvadvpn.util.asString
@Composable
private fun PreviewWireguardPortInfoDialog() {
AppTheme {
WireguardPortInfoDialog(
WireguardPortInfo(
EmptyDestinationsNavigator,
argument = WireguardPortInfoDialogArgument(listOf(PortRange(1..2)))
)
Expand All @@ -31,10 +31,7 @@ private fun PreviewWireguardPortInfoDialog() {

@Destination<RootGraph>(style = DestinationStyle.Dialog::class)
@Composable
fun WireguardPortInfoDialog(
navigator: DestinationsNavigator,
argument: WireguardPortInfoDialogArgument
) {
fun WireguardPortInfo(navigator: DestinationsNavigator, argument: WireguardPortInfoDialogArgument) {
InfoDialog(
message = stringResource(id = R.string.wireguard_port_info_description),
additionalInfo =
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -25,7 +25,7 @@ private fun PreviewVerificationPendingDialog() {

@Destination<RootGraph>(style = DestinationStyle.Dialog::class)
@Composable
fun VerificationPendingDialog(navigator: DestinationsNavigator) {
fun VerificationPending(navigator: DestinationsNavigator) {
VerificationPendingDialog(onClose = dropUnlessResumed { navigator.navigateUp() })
}

Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -28,11 +28,11 @@ import androidx.lifecycle.compose.dropUnlessResumed
import com.ramcosta.composedestinations.annotation.Destination
import com.ramcosta.composedestinations.annotation.RootGraph
import com.ramcosta.composedestinations.generated.NavGraphs
import com.ramcosta.composedestinations.generated.destinations.DeviceNameInfoDialogDestination
import com.ramcosta.composedestinations.generated.destinations.DeviceNameInfoDestination
import com.ramcosta.composedestinations.generated.destinations.LoginDestination
import com.ramcosta.composedestinations.generated.destinations.PaymentDestination
import com.ramcosta.composedestinations.generated.destinations.RedeemVoucherDestination
import com.ramcosta.composedestinations.generated.destinations.VerificationPendingDialogDestination
import com.ramcosta.composedestinations.generated.destinations.VerificationPendingDestination
import com.ramcosta.composedestinations.navigation.DestinationsNavigator
import com.ramcosta.composedestinations.result.NavResult
import com.ramcosta.composedestinations.result.ResultRecipient
Expand Down Expand Up @@ -136,12 +136,11 @@ fun Account(
},
onCopyAccountNumber = vm::onCopyAccountNumber,
onBackClick = dropUnlessResumed { navigator.navigateUp() },
navigateToDeviceInfo =
dropUnlessResumed { navigator.navigate(DeviceNameInfoDialogDestination) },
navigateToDeviceInfo = dropUnlessResumed { navigator.navigate(DeviceNameInfoDestination) },
onPurchaseBillingProductClick =
dropUnlessResumed { productId -> navigator.navigate(PaymentDestination(productId)) },
navigateToVerificationPendingDialog =
dropUnlessResumed { navigator.navigate(VerificationPendingDialogDestination) }
dropUnlessResumed { navigator.navigate(VerificationPendingDestination) }
)
}

Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -22,7 +22,7 @@ import androidx.lifecycle.compose.collectAsStateWithLifecycle
import com.ramcosta.composedestinations.annotation.Destination
import com.ramcosta.composedestinations.annotation.RootGraph
import com.ramcosta.composedestinations.generated.destinations.ApiAccessMethodDetailsDestination
import com.ramcosta.composedestinations.generated.destinations.ApiAccessMethodInfoDialogDestination
import com.ramcosta.composedestinations.generated.destinations.ApiAccessMethodInfoDestination
import com.ramcosta.composedestinations.generated.destinations.EditApiAccessMethodDestination
import com.ramcosta.composedestinations.navigation.DestinationsNavigator
import net.mullvad.mullvadvpn.R
Expand Down Expand Up @@ -67,7 +67,7 @@ fun ApiAccessList(navigator: DestinationsNavigator) {
navigator.navigate(ApiAccessMethodDetailsDestination(it.id)) { launchSingleTop = true }
},
onApiAccessInfoClick = {
navigator.navigate(ApiAccessMethodInfoDialogDestination) { launchSingleTop = true }
navigator.navigate(ApiAccessMethodInfoDestination) { launchSingleTop = true }
},
onBackClick = navigator::navigateUp
)
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -29,7 +29,7 @@ import androidx.lifecycle.compose.collectAsStateWithLifecycle
import androidx.lifecycle.compose.dropUnlessResumed
import com.ramcosta.composedestinations.annotation.Destination
import com.ramcosta.composedestinations.annotation.RootGraph
import com.ramcosta.composedestinations.generated.destinations.DiscardChangesDialogDestination
import com.ramcosta.composedestinations.generated.destinations.DiscardChangesDestination
import com.ramcosta.composedestinations.navigation.DestinationsNavigator
import com.ramcosta.composedestinations.result.NavResult
import com.ramcosta.composedestinations.result.ResultBackNavigator
Expand Down Expand Up @@ -80,7 +80,7 @@ data class CustomListLocationsNavArgs(
fun CustomListLocations(
navigator: DestinationsNavigator,
backNavigator: ResultBackNavigator<LocationsChanged>,
discardChangesResultRecipient: ResultRecipient<DiscardChangesDialogDestination, Boolean>,
discardChangesResultRecipient: ResultRecipient<DiscardChangesDestination, Boolean>,
) {
val customListsViewModel = koinViewModel<CustomListLocationsViewModel>()

Expand Down Expand Up @@ -122,7 +122,7 @@ fun CustomListLocations(
onBackClick =
dropUnlessResumed {
if (state.hasUnsavedChanges) {
navigator.navigate(DiscardChangesDialogDestination)
navigator.navigate(DiscardChangesDestination)
} else {
backNavigator.navigateBack()
}
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -35,7 +35,7 @@ import androidx.lifecycle.compose.dropUnlessResumed
import com.ramcosta.composedestinations.annotation.Destination
import com.ramcosta.composedestinations.annotation.RootGraph
import com.ramcosta.composedestinations.generated.destinations.LoginDestination
import com.ramcosta.composedestinations.generated.destinations.RemoveDeviceConfirmationDialogDestination
import com.ramcosta.composedestinations.generated.destinations.RemoveDeviceConfirmationDestination
import com.ramcosta.composedestinations.generated.destinations.SettingsDestination
import com.ramcosta.composedestinations.navigation.DestinationsNavigator
import com.ramcosta.composedestinations.result.NavResult
Expand Down Expand Up @@ -108,8 +108,7 @@ data class DeviceListNavArgs(val accountNumber: AccountNumber)
@Composable
fun DeviceList(
navigator: DestinationsNavigator,
confirmRemoveResultRecipient:
ResultRecipient<RemoveDeviceConfirmationDialogDestination, DeviceId>
confirmRemoveResultRecipient: ResultRecipient<RemoveDeviceConfirmationDestination, DeviceId>
) {
val viewModel = koinViewModel<DeviceListViewModel>()
val state by viewModel.uiState.collectAsStateWithLifecycle()
Expand Down Expand Up @@ -156,7 +155,7 @@ fun DeviceList(
onTryAgainClicked = viewModel::fetchDevices,
navigateToRemoveDeviceConfirmationDialog =
dropUnlessResumed<Device> {
navigator.navigate(RemoveDeviceConfirmationDialogDestination(it))
navigator.navigate(RemoveDeviceConfirmationDestination(it))
}
)
}
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -33,7 +33,7 @@ import androidx.compose.ui.tooling.preview.PreviewParameter
import androidx.lifecycle.compose.collectAsStateWithLifecycle
import com.ramcosta.composedestinations.annotation.Destination
import com.ramcosta.composedestinations.annotation.RootGraph
import com.ramcosta.composedestinations.generated.destinations.DiscardChangesDialogDestination
import com.ramcosta.composedestinations.generated.destinations.DiscardChangesDestination
import com.ramcosta.composedestinations.generated.destinations.SaveApiAccessMethodDestination
import com.ramcosta.composedestinations.navigation.DestinationsNavigator
import com.ramcosta.composedestinations.result.ResultBackNavigator
Expand Down Expand Up @@ -93,7 +93,7 @@ fun EditApiAccessMethod(
navigator: DestinationsNavigator,
backNavigator: ResultBackNavigator<Boolean>,
saveApiAccessMethodResultRecipient: ResultRecipient<SaveApiAccessMethodDestination, Boolean>,
discardChangesResultRecipient: ResultRecipient<DiscardChangesDialogDestination, Boolean>,
discardChangesResultRecipient: ResultRecipient<DiscardChangesDestination, Boolean>,
) {
val viewModel = koinViewModel<EditApiAccessMethodViewModel>()

Expand Down Expand Up @@ -179,7 +179,7 @@ fun EditApiAccessMethod(
onAddMethod = viewModel::trySave,
onNavigateBack = {
if (state.hasChanges()) {
navigator.navigate(DiscardChangesDialogDestination) { launchSingleTop = true }
navigator.navigate(DiscardChangesDestination) { launchSingleTop = true }
} else {
navigator.navigateUp()
}
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -70,7 +70,7 @@ private fun PreviewFilterScreen() {

@Destination<RootGraph>(style = SlideInFromRightTransition::class)
@Composable
fun FilterScreen(navigator: DestinationsNavigator) {
fun Filter(navigator: DestinationsNavigator) {
val viewModel = koinViewModel<FilterViewModel>()
val state by viewModel.uiState.collectAsStateWithLifecycle()

Expand Down
Loading

0 comments on commit 3a96d56

Please sign in to comment.