refactor: Remove legacy tabItem code and use only modern Tab API
- Remove iOS version checks and legacy .tabItem implementations - Use modern Tab() syntax throughout as app targets iOS 18+ minimum - Simplify code by removing duplicate implementations - Remove @available annotations as they're no longer needed - Clean up code structure while maintaining all functionality
This commit is contained in:
parent
62f2f07f38
commit
58b89d4c86
@ -20,13 +20,6 @@ struct PhoneTabView: View {
|
||||
var body: some View {
|
||||
NavigationStack {
|
||||
GlobalPlayerContainerView {
|
||||
if #available(iOS 18.0, *) {
|
||||
TabView(selection: $selectedTabIndex) {
|
||||
mainTabsContentNew
|
||||
moreTabContentNew
|
||||
}
|
||||
.accentColor(.accentColor)
|
||||
} else {
|
||||
TabView(selection: $selectedTabIndex) {
|
||||
mainTabsContent
|
||||
moreTabContent
|
||||
@ -35,13 +28,11 @@ struct PhoneTabView: View {
|
||||
}
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
// MARK: - Tab Content (iOS 18+)
|
||||
// MARK: - Tab Content
|
||||
|
||||
@available(iOS 18.0, *)
|
||||
@ViewBuilder
|
||||
private var mainTabsContentNew: some View {
|
||||
private var mainTabsContent: some View {
|
||||
ForEach(Array(mainTabs.enumerated()), id: \.element) { idx, tab in
|
||||
Tab(tab.label, systemImage: tab.systemImage, value: idx) {
|
||||
tabView(for: tab)
|
||||
@ -49,9 +40,8 @@ struct PhoneTabView: View {
|
||||
}
|
||||
}
|
||||
|
||||
@available(iOS 18.0, *)
|
||||
@ViewBuilder
|
||||
private var moreTabContentNew: some View {
|
||||
private var moreTabContent: some View {
|
||||
Tab("More", systemImage: "ellipsis", value: mainTabs.count) {
|
||||
VStack(spacing: 0) {
|
||||
moreTabsList
|
||||
@ -66,37 +56,6 @@ struct PhoneTabView: View {
|
||||
.badge(offlineBookmarksViewModel.state.localBookmarkCount > 0 ? offlineBookmarksViewModel.state.localBookmarkCount : 0)
|
||||
}
|
||||
|
||||
// MARK: - Tab Content (Legacy)
|
||||
|
||||
@ViewBuilder
|
||||
private var mainTabsContent: some View {
|
||||
ForEach(Array(mainTabs.enumerated()), id: \.element) { idx, tab in
|
||||
tabView(for: tab)
|
||||
.tabItem {
|
||||
Label(tab.label, systemImage: tab.systemImage)
|
||||
}
|
||||
.tag(idx)
|
||||
}
|
||||
}
|
||||
|
||||
@ViewBuilder
|
||||
private var moreTabContent: some View {
|
||||
VStack(spacing: 0) {
|
||||
moreTabsList
|
||||
moreTabsFooter
|
||||
}
|
||||
.tabItem {
|
||||
Label("More", systemImage: "ellipsis")
|
||||
}
|
||||
.badge(offlineBookmarksViewModel.state.localBookmarkCount > 0 ? offlineBookmarksViewModel.state.localBookmarkCount : 0)
|
||||
.tag(mainTabs.count)
|
||||
.onAppear {
|
||||
if selectedTabIndex == mainTabs.count && selectedMoreTab != nil {
|
||||
selectedMoreTab = nil
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
@ViewBuilder
|
||||
private var moreTabsList: some View {
|
||||
List {
|
||||
|
||||
Loading…
x
Reference in New Issue
Block a user