mirror of
https://github.com/Swiftgram/Telegram-iOS.git
synced 2026-04-07 05:45:53 +00:00
WIP SUI's navbar
This commit is contained in:
@@ -688,51 +688,64 @@ struct MessageFilterView: View {
|
||||
}
|
||||
}
|
||||
|
||||
init() {
|
||||
init(wrapperController: LegacyController?) {
|
||||
self.wrapperController = wrapperController
|
||||
_keywords = State(initialValue: SGSimpleSettings.shared.messageFilterKeywords)
|
||||
}
|
||||
|
||||
var body: some View {
|
||||
List {
|
||||
Section {
|
||||
// Icon and title
|
||||
VStack(spacing: 8) {
|
||||
Image(systemName: "nosign.app.fill")
|
||||
.font(.system(size: 50))
|
||||
.foregroundColor(.secondary)
|
||||
// NavigationView {
|
||||
List {
|
||||
Section {
|
||||
// Icon and title
|
||||
VStack(spacing: 8) {
|
||||
Image(systemName: "nosign.app.fill")
|
||||
.font(.system(size: 50))
|
||||
.foregroundColor(.secondary)
|
||||
|
||||
Text("Message Filter")
|
||||
.font(.title)
|
||||
.bold()
|
||||
|
||||
Text("Remove distraction and reduce visibility of messages containing keywords below.\nKeywords are case-sensitive.")
|
||||
.font(.body)
|
||||
.foregroundColor(.secondary)
|
||||
.multilineTextAlignment(.center)
|
||||
.padding(.horizontal)
|
||||
}
|
||||
.frame(maxWidth: .infinity)
|
||||
.padding(.vertical, 16)
|
||||
.listRowInsets(EdgeInsets())
|
||||
|
||||
Text("Message Filter")
|
||||
.font(.title)
|
||||
.bold()
|
||||
|
||||
Text("Remove distraction and reduce visibility of messages containing keywords below.\nKeywords are case-sensitive.")
|
||||
.font(.body)
|
||||
.foregroundColor(.secondary)
|
||||
.multilineTextAlignment(.center)
|
||||
.padding(.horizontal)
|
||||
}
|
||||
.frame(maxWidth: .infinity)
|
||||
.padding(.vertical, 16)
|
||||
.listRowInsets(EdgeInsets())
|
||||
|
||||
}
|
||||
|
||||
Section {
|
||||
MessageFilterKeywordInputView(newKeyword: $newKeyword, onAdd: addKeyword)
|
||||
}
|
||||
|
||||
Section(header: Text("Keywords")) {
|
||||
ForEach(keywords.reversed(), id: \.self) { keyword in
|
||||
Text(keyword)
|
||||
|
||||
Section {
|
||||
MessageFilterKeywordInputView(newKeyword: $newKeyword, onAdd: addKeyword)
|
||||
}
|
||||
.onDelete { indexSet in
|
||||
let originalIndices = IndexSet(
|
||||
indexSet.map { keywords.count - 1 - $0 }
|
||||
)
|
||||
deleteKeywords(at: originalIndices)
|
||||
|
||||
Section(header: Text("Keywords")) {
|
||||
ForEach(keywords.reversed(), id: \.self) { keyword in
|
||||
Text(keyword)
|
||||
}
|
||||
.onDelete { indexSet in
|
||||
let originalIndices = IndexSet(
|
||||
indexSet.map { keywords.count - 1 - $0 }
|
||||
)
|
||||
deleteKeywords(at: originalIndices)
|
||||
}
|
||||
}
|
||||
}
|
||||
}
|
||||
// .navigationBarBackButtonHidden(true)
|
||||
// .navigationBarItems(leading: Button(action: {
|
||||
// wrapperController?.dismiss(animated: true)
|
||||
// }) {
|
||||
// HStack(spacing: 0) {
|
||||
// Image(systemName: "chevron.left")
|
||||
// .font(Font.body.weight(.bold))
|
||||
// Text("Back")
|
||||
// }
|
||||
// })
|
||||
// }
|
||||
}
|
||||
|
||||
|
||||
@@ -772,6 +785,7 @@ public func sgMessageFilterController(context: AccountContext, presentationData:
|
||||
theme: theme,
|
||||
strings: strings
|
||||
)
|
||||
// legacyController.displayNavigationBar = false
|
||||
legacyController.statusBar.statusBarStyle = theme.rootController
|
||||
.statusBarStyle.style
|
||||
legacyController.title = "Message Filter" //i18n("BackupManager.Title", strings.baseLanguageCode)
|
||||
@@ -780,7 +794,7 @@ public func sgMessageFilterController(context: AccountContext, presentationData:
|
||||
navigationBarHeight: legacyController.navigationBarHeightModel,
|
||||
containerViewLayout: legacyController.containerViewLayoutModel,
|
||||
content: {
|
||||
MessageFilterView(/*wrapperController: legacyController*//*, context: context*/)
|
||||
MessageFilterView(wrapperController: legacyController)
|
||||
}
|
||||
)
|
||||
let controller = UIHostingController(rootView: swiftUIView, ignoreSafeArea: true)
|
||||
|
||||
@@ -45,6 +45,7 @@ public struct CustomSafeAreaPadding: ViewModifier {
|
||||
public func body(content: Content) -> some View {
|
||||
content
|
||||
.edgesIgnoringSafeArea(.all)
|
||||
// .padding(.top, /*totalTopSafeArea > navigationBarHeight.value ? totalTopSafeArea :*/ navigationBarHeight.value)
|
||||
.padding(.top, totalTopSafeArea > navigationBarHeight.value ? totalTopSafeArea : navigationBarHeight.value)
|
||||
.padding(.bottom, (containerViewLayout.value?.safeInsets.bottom ?? 0) /*+ (containerViewLayout.value?.intrinsicInsets.bottom ?? 0)*/)
|
||||
.padding(.leading, containerViewLayout.value?.safeInsets.left ?? 0)
|
||||
@@ -71,7 +72,10 @@ public final class LegacySwiftUIController: LegacyController {
|
||||
override public func containerLayoutUpdated(_ layout: ContainerViewLayout, transition: ContainedViewLayoutTransition) {
|
||||
super.containerLayoutUpdated(layout, transition: transition)
|
||||
|
||||
let newNavigationBarHeight = navigationLayout(layout: layout).navigationFrame.maxY
|
||||
var newNavigationBarHeight = navigationLayout(layout: layout).navigationFrame.maxY
|
||||
if !self.displayNavigationBar {
|
||||
newNavigationBarHeight = 0.0
|
||||
}
|
||||
if navigationBarHeightModel.value != newNavigationBarHeight {
|
||||
navigationBarHeightModel.value = newNavigationBarHeight
|
||||
}
|
||||
|
||||
Reference in New Issue
Block a user