Skip to content

Commit

Permalink
feat: detekt
Browse files Browse the repository at this point in the history
  • Loading branch information
yamilmedina committed Jan 20, 2025
1 parent 4647027 commit 291198c
Show file tree
Hide file tree
Showing 6 changed files with 9 additions and 74 deletions.
Original file line number Diff line number Diff line change
Expand Up @@ -212,5 +212,5 @@ interface SwitchAccountActions {

class NavigationSwitchAccountActions(val navigate: (NavigationCommand) -> Unit) : SwitchAccountActions {
override fun switchedToAnotherAccount() = navigate(NavigationCommand(HomeScreenDestination, BackStackMode.CLEAR_WHOLE))
override fun noOtherAccountToSwitch() = navigate(NavigationCommand(WelcomeScreenDestination(), BackStackMode.CLEAR_WHOLE))
override fun noOtherAccountToSwitch() = navigate(NavigationCommand(WelcomeScreenDestination, BackStackMode.CLEAR_WHOLE))
}
Original file line number Diff line number Diff line change
Expand Up @@ -21,7 +21,6 @@ package com.wire.android.ui.authentication.login
import androidx.annotation.StringRes
import androidx.compose.animation.AnimatedContent
import androidx.compose.animation.togetherWith
import androidx.compose.foundation.ExperimentalFoundationApi
import androidx.compose.foundation.layout.Column
import androidx.compose.foundation.layout.fillMaxHeight
import androidx.compose.foundation.layout.fillMaxWidth
Expand All @@ -44,7 +43,6 @@ import com.wire.android.ui.authentication.ServerTitle
import com.wire.android.ui.authentication.login.email.LoginEmailScreen
import com.wire.android.ui.authentication.login.email.LoginEmailVerificationCodeScreen
import com.wire.android.ui.authentication.login.email.LoginEmailViewModel
import com.wire.android.ui.common.TabItem
import com.wire.android.ui.common.WireDialog
import com.wire.android.ui.common.WireDialogButtonProperties
import com.wire.android.ui.common.WireDialogButtonType
Expand All @@ -61,7 +59,6 @@ import com.wire.android.ui.theme.wireTypography
import com.wire.android.util.deeplink.DeepLinkResult
import com.wire.android.util.dialogErrorStrings
import com.wire.android.util.ui.PreviewMultipleThemes
import com.wire.android.util.ui.UIText

@RootNavGraph
@WireDestination(
Expand Down Expand Up @@ -127,7 +124,7 @@ private fun LoginContent(
}
}

@OptIn(ExperimentalFoundationApi::class)
@Suppress("UnusedParameter")
@Composable
private fun MainLoginContent(
onBackPressed: () -> Unit,
Expand All @@ -140,10 +137,6 @@ private fun MainLoginContent(
val ssoDisabledWithProxyDialogState = rememberVisibilityState<FeatureDisabledWithProxyDialogState>()
FeatureDisabledWithProxyDialogContent(dialogState = ssoDisabledWithProxyDialogState)

// var focusedTabIndex: Int by remember { mutableStateOf(initialPageIndex) }
// val keyboardController = LocalSoftwareKeyboardController.current
// val focusManager = LocalFocusManager.current

if (loginEmailViewModel.serverConfig.isOnPremises) {
ServerTitle(
serverLinks = loginEmailViewModel.serverConfig,
Expand All @@ -152,51 +145,6 @@ private fun MainLoginContent(
VerticalSpace.x8()
}
LoginEmailScreen(onSuccess, onRemoveDeviceNeeded, loginEmailViewModel)


// CompositionLocalProvider(LocalOverscrollConfiguration provides null) {
// HorizontalPager(
// state = pagerState,
// modifier = Modifier
// .fillMaxWidth()
// ) { pageIndex ->
// when (LoginTabItem.values()[pageIndex]) {
// LoginTabItem.EMAIL ->
// LoginTabItem.SSO -> LoginSSOScreen(onSuccess, onRemoveDeviceNeeded, ssoLoginResult)
// }
// }
// if (!pagerState.isScrollInProgress && focusedTabIndex != pagerState.currentPage) {
// LaunchedEffect(Unit) {
// keyboardController?.hide()
// focusManager.clearFocus()
// focusedTabIndex = pagerState.currentPage
// }
// }
// }

// WireScaffold(
// topBar = {
// WireCenterAlignedTopAppBar(
// elevation = scrollState.rememberTopBarElevationState().value,
// title = stringResource(R.string.login_title),
// subtitleContent = {
// if (loginEmailViewModel.serverConfig.isOnPremises) {
// ServerTitle(
// serverLinks = loginEmailViewModel.serverConfig,
// style = MaterialTheme.wireTypography.body01
// )
// }
// },
// onNavigationPressed = onBackPressed,
// navigationIconType = NavigationIconType.Back(R.string.content_description_login_back_btn)
// ) {
//
// }
// },
// modifier = Modifier.fillMaxHeight(),
// ) { internalPadding ->
//
// }
}

@Composable
Expand Down Expand Up @@ -320,13 +268,6 @@ data class LoginDialogErrorData(
val dismissOnClickOutside: Boolean = true
)

enum class LoginTabItem(@StringRes val titleResId: Int) : TabItem {
EMAIL(R.string.login_tab_email),
SSO(R.string.login_tab_sso);

override val title: UIText = UIText.StringResource(titleResId)
}

@PreviewMultipleThemes
@Composable
private fun PreviewLoginScreen() = WireTheme {
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -97,7 +97,8 @@ private fun NewLoginContent(
content()
}
}
}) { _ ->
}
) { _ ->
Column {
MainBackgroundComponent()
}
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -73,7 +73,6 @@ import com.wire.android.ui.theme.wireDimensions
import com.wire.android.ui.theme.wireTypography
import com.wire.android.util.CustomTabsHelper
import com.wire.android.util.ui.PreviewMultipleThemes
import com.wire.kalium.logic.configuration.server.ServerConfig

@WireDestination(
style = PopUpNavigationAnimation::class,
Expand All @@ -88,7 +87,6 @@ fun StartLoginScreen(
viewModel.state.isCustomBackend,
viewModel.state.isThereActiveSession,
viewModel.loginState,
viewModel.state.links,
viewModel.userIdentifierTextState,
viewModel::onLoginStarted,
navigator::navigateBack,
Expand All @@ -101,7 +99,6 @@ private fun StartLoginContent(
isCustomBackend: Boolean,
isThereActiveSession: Boolean,
loginEmailState: LoginEmailState,
state: ServerConfig.Links,
userIdentifierState: TextFieldState,
onNextClicked: (() -> Unit) -> Unit,
navigateBack: () -> Unit,
Expand All @@ -114,10 +111,8 @@ private fun StartLoginContent(
if (!isCustomBackend) {
NewWelcomeExperienceContent(
loginEmailState = loginEmailState,
links = state,
userIdentifierState = userIdentifierState,
onNextClicked = onNextClicked,
navigateBack = navigateBack,
navigate = navigate
)
}
Expand All @@ -128,10 +123,8 @@ private fun StartLoginContent(
@Composable
private fun NewWelcomeExperienceContent(
loginEmailState: LoginEmailState,
links: ServerConfig.Links,
userIdentifierState: TextFieldState,
onNextClicked: (() -> Unit) -> Unit,
navigateBack: () -> Unit,
navigate: (NavigationCommand) -> Unit,
) {
val context = LocalContext.current
Expand Down Expand Up @@ -176,7 +169,8 @@ private fun NewWelcomeExperienceContent(
onNextClicked {
navigate(NavigationCommand(LoginScreenDestination(userHandle = userIdentifierState.text.toString())))
}
})
}
)
}

if (LocalCustomUiConfigurationProvider.current.isAccountCreationAllowed) {
Expand Down Expand Up @@ -268,7 +262,6 @@ fun PreviewWelcomeScreen() {
StartLoginContent(
isCustomBackend = false,
isThereActiveSession = false,
state = ServerConfig.DEFAULT,
loginEmailState = LoginEmailState(),
userIdentifierState = TextFieldState(),
onNextClicked = {},
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -74,7 +74,7 @@ class StartLoginViewModel @Inject constructor(
fun onLoginStarted(onSuccess: () -> Unit) {
viewModelScope.launch {
loginState = loginState.copy(flowState = LoginState.Loading)
delay(1000) //TODO(ym): here the call to the use case should be done.
@Suppress("MagicNumber") delay(1000) // TODO(ym): here the call to the use case should be done.
loginState = loginState.copy(flowState = LoginState.Default)
onSuccess()
}
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -94,7 +94,6 @@ private fun WelcomeContent(
StartLoginDestination.CustomBackend -> navigate(NavigationCommand(StartLoginScreenDestination(isCustomBackend = true)))
}
}

}
}
}
Expand All @@ -107,6 +106,7 @@ fun PreviewWelcomeScreen() {
WelcomeContent(
state = WelcomeScreenState(ServerConfig.DEFAULT),
navigateBack = {},
navigate = {})
navigate = {}
)
}
}

0 comments on commit 291198c

Please sign in to comment.