Skip to content

Commit

Permalink
Merge pull request #798 from Infomaniak/toolbar-keyboard
Browse files Browse the repository at this point in the history
fix(BottomBar): Ignore keyboard safe area
  • Loading branch information
PhilippeWeidmann committed Jun 13, 2023
2 parents 56d22b0 + a7e6382 commit 0e09228
Show file tree
Hide file tree
Showing 5 changed files with 18 additions and 25 deletions.
2 changes: 1 addition & 1 deletion .package.resolved
Original file line number Diff line number Diff line change
Expand Up @@ -41,7 +41,7 @@
"kind" : "remoteSourceControl",
"location" : "https://github.com/Infomaniak/ios-core",
"state" : {
"revision" : "cf001ba55dbf5f152353d66b55cd46350bd4b895"
"revision" : "e5fe8e03aa06375f20c8e40f4fae3a6af6e4d75e"
}
},
{
Expand Down
13 changes: 7 additions & 6 deletions Mail/Components/BottomBarView.swift
Original file line number Diff line number Diff line change
Expand Up @@ -25,13 +25,14 @@ struct BottomBar<Items: View>: ViewModifier {
@ViewBuilder var items: () -> Items

func body(content: Content) -> some View {
content
.safeAreaInset(edge: .bottom) {
if isVisible {
BottomBarView(items: items)
.transition(.opacity)
}
VStack(spacing: 0) {
content
Spacer(minLength: 0)
if isVisible {
BottomBarView(items: items)
}
}
.ignoresSafeArea(.keyboard, edges: .bottom)
}
}

Expand Down
16 changes: 7 additions & 9 deletions Mail/Views/Thread List/ThreadListCell.swift
Original file line number Diff line number Diff line change
Expand Up @@ -83,15 +83,13 @@ struct ThreadListCell: View {
}

private func didLongPressCell() {
withAnimation {
multipleSelectionViewModel.feedbackGenerator.prepare()
multipleSelectionViewModel.isEnabled.toggle()
if multipleSelectionViewModel.isEnabled {
@InjectService var matomo: MatomoUtils
matomo.track(eventWithCategory: .multiSelection, action: .longPress, name: "enable")
multipleSelectionViewModel.feedbackGenerator.impactOccurred()
multipleSelectionViewModel.toggleSelection(of: thread)
}
multipleSelectionViewModel.feedbackGenerator.prepare()
multipleSelectionViewModel.isEnabled.toggle()
if multipleSelectionViewModel.isEnabled {
@InjectService var matomo: MatomoUtils
matomo.track(eventWithCategory: .multiSelection, action: .longPress, name: "enable")
multipleSelectionViewModel.feedbackGenerator.impactOccurred()
multipleSelectionViewModel.toggleSelection(of: thread)
}
}
}
Expand Down
8 changes: 2 additions & 6 deletions Mail/Views/Thread List/ThreadListModifiers.swift
Original file line number Diff line number Diff line change
Expand Up @@ -76,9 +76,7 @@ struct ThreadListToolbar: ViewModifier {
if multipleSelectionViewModel.isEnabled {
Button(MailResourcesStrings.Localizable.buttonCancel) {
matomo.track(eventWithCategory: .multiSelection, name: "cancel")
withAnimation {
multipleSelectionViewModel.isEnabled = false
}
multipleSelectionViewModel.isEnabled = false
}
} else {
if isCompactWindow {
Expand Down Expand Up @@ -160,9 +158,7 @@ struct ThreadListToolbar: ViewModifier {
.disabled(multipleSelectionViewModel.selectedItems.isEmpty)
}
.actionsPanel(actionsTarget: $multipleSelectionActionsTarget) {
withAnimation {
multipleSelectionViewModel.isEnabled = false
}
multipleSelectionViewModel.isEnabled = false
}
.navigationTitle(
multipleSelectionViewModel.isEnabled
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -100,9 +100,7 @@ import SwiftUI
default:
break
}
withAnimation {
isEnabled = false
}
isEnabled = false
}

private func setActions() {
Expand Down

0 comments on commit 0e09228

Please sign in to comment.