Show rename info alert

This commit is contained in:
Alfonso Grillo
2022-10-26 16:41:43 +02:00
parent 733e06479a
commit af2fd6fae6
5 changed files with 18 additions and 5 deletions
@@ -52,6 +52,8 @@ struct UserSessionNameBindings {
var sessionName: String
/// The currently displayed alert's info value otherwise `nil`.
var alertInfo: AlertInfo<Int>?
/// Specifies if the informational bottom sheet is onscreen or not
var showBottomSheet: Bool = false
}
enum UserSessionNameViewAction {
@@ -59,6 +61,4 @@ enum UserSessionNameViewAction {
case done
/// The user tapped the cancel button.
case cancel
/// The user tapped the Learn More link.
case learnMore
}
@@ -34,8 +34,6 @@ class UserSessionNameViewModel: UserSessionNameViewModelType, UserSessionNameVie
completion?(.updateName(state.bindings.sessionName))
case .cancel:
completion?(.cancel)
case .learnMore:
#warning("To be implemented as part of PSG-714.")
}
}
@@ -30,6 +30,11 @@ struct UserSessionName: View {
.navigationBarTitleDisplayMode(.inline)
.toolbar { toolbar }
.accentColor(theme.colors.accent)
.bottomSheet(isPresented: $viewModel.showBottomSheet) {
InfoView(title: VectorL10n.userSessionRenameSessionTitle,
descripion: VectorL10n.userSessionRenameSessionDescription,
action: .init(text: VectorL10n.userSessionGotIt, action: { viewModel.showBottomSheet = false }))
}
}
private var textFieldFooter: some View {
@@ -39,7 +44,7 @@ struct UserSessionName: View {
InlineTextButton(VectorL10n.manageSessionNameInfo("%@"),
tappableText: VectorL10n.manageSessionNameInfoLink) {
viewModel.send(viewAction: .learnMore)
viewModel.showBottomSheet = true
}
.foregroundColor(theme.colors.secondaryContent)
}