Skip to content

Commit

Permalink
Tabbar fix + bump to iOS 18
Browse files Browse the repository at this point in the history
  • Loading branch information
Dimillian committed Jul 9, 2024
1 parent 1008008 commit 3ec5c8c
Show file tree
Hide file tree
Showing 23 changed files with 118 additions and 86 deletions.
24 changes: 12 additions & 12 deletions IceCubesApp.xcodeproj/project.pbxproj
Original file line number Diff line number Diff line change
Expand Up @@ -1187,7 +1187,7 @@
INFOPLIST_FILE = IceCubesNotifications/Info.plist;
INFOPLIST_KEY_CFBundleDisplayName = IceCubesNotifications;
INFOPLIST_KEY_NSHumanReadableCopyright = "";
IPHONEOS_DEPLOYMENT_TARGET = 17.0;
IPHONEOS_DEPLOYMENT_TARGET = 18.0;
LD_RUNPATH_SEARCH_PATHS = (
"$(inherited)",
"@executable_path/Frameworks",
Expand Down Expand Up @@ -1222,7 +1222,7 @@
INFOPLIST_FILE = IceCubesNotifications/Info.plist;
INFOPLIST_KEY_CFBundleDisplayName = IceCubesNotifications;
INFOPLIST_KEY_NSHumanReadableCopyright = "";
IPHONEOS_DEPLOYMENT_TARGET = 17.0;
IPHONEOS_DEPLOYMENT_TARGET = 18.0;
LD_RUNPATH_SEARCH_PATHS = (
"$(inherited)",
"@executable_path/Frameworks",
Expand Down Expand Up @@ -1261,7 +1261,7 @@
INFOPLIST_FILE = IceCubesAppWidgetsExtension/Info.plist;
INFOPLIST_KEY_CFBundleDisplayName = IceCubesAppWidgetsExtension;
INFOPLIST_KEY_NSHumanReadableCopyright = "";
IPHONEOS_DEPLOYMENT_TARGET = 17.4;
IPHONEOS_DEPLOYMENT_TARGET = 18.0;
LD_RUNPATH_SEARCH_PATHS = (
"$(inherited)",
"@executable_path/Frameworks",
Expand Down Expand Up @@ -1297,7 +1297,7 @@
INFOPLIST_FILE = IceCubesAppWidgetsExtension/Info.plist;
INFOPLIST_KEY_CFBundleDisplayName = IceCubesAppWidgetsExtension;
INFOPLIST_KEY_NSHumanReadableCopyright = "";
IPHONEOS_DEPLOYMENT_TARGET = 17.4;
IPHONEOS_DEPLOYMENT_TARGET = 18.0;
LD_RUNPATH_SEARCH_PATHS = (
"$(inherited)",
"@executable_path/Frameworks",
Expand Down Expand Up @@ -1330,7 +1330,7 @@
INFOPLIST_FILE = IceCubesShareExtension/Info.plist;
INFOPLIST_KEY_CFBundleDisplayName = "Ice Cubes";
INFOPLIST_KEY_NSHumanReadableCopyright = "";
IPHONEOS_DEPLOYMENT_TARGET = 17.0;
IPHONEOS_DEPLOYMENT_TARGET = 18.0;
LD_RUNPATH_SEARCH_PATHS = (
"$(inherited)",
"@executable_path/Frameworks",
Expand Down Expand Up @@ -1364,7 +1364,7 @@
INFOPLIST_FILE = IceCubesShareExtension/Info.plist;
INFOPLIST_KEY_CFBundleDisplayName = "Ice Cubes";
INFOPLIST_KEY_NSHumanReadableCopyright = "";
IPHONEOS_DEPLOYMENT_TARGET = 17.0;
IPHONEOS_DEPLOYMENT_TARGET = 18.0;
LD_RUNPATH_SEARCH_PATHS = (
"$(inherited)",
"@executable_path/Frameworks",
Expand Down Expand Up @@ -1548,7 +1548,7 @@
"INFOPLIST_KEY_UIStatusBarStyle[sdk=iphonesimulator*]" = UIStatusBarStyleDefault;
INFOPLIST_KEY_UISupportedInterfaceOrientations = "UIInterfaceOrientationLandscapeLeft UIInterfaceOrientationLandscapeRight UIInterfaceOrientationPortrait";
INFOPLIST_KEY_UISupportedInterfaceOrientations_iPad = "UIInterfaceOrientationLandscapeLeft UIInterfaceOrientationLandscapeRight UIInterfaceOrientationPortrait UIInterfaceOrientationPortraitUpsideDown";
IPHONEOS_DEPLOYMENT_TARGET = 17.0;
IPHONEOS_DEPLOYMENT_TARGET = 18.0;
LD_RUNPATH_SEARCH_PATHS = "@executable_path/Frameworks";
"LD_RUNPATH_SEARCH_PATHS[sdk=macosx*]" = "@executable_path/../Frameworks";
MACOSX_DEPLOYMENT_TARGET = 13.0;
Expand All @@ -1573,7 +1573,7 @@
SWIFT_UPCOMING_FEATURE_REGION_BASED_ISOLATION = YES;
SWIFT_VERSION = 5.0;
TARGETED_DEVICE_FAMILY = "1,2,7";
_EXPERIMENTAL_SWIFT_EXPLICIT_MODULES = YES;
_EXPERIMENTAL_SWIFT_EXPLICIT_MODULES = NO;
};
name = Debug;
};
Expand Down Expand Up @@ -1615,7 +1615,7 @@
"INFOPLIST_KEY_UIStatusBarStyle[sdk=iphonesimulator*]" = UIStatusBarStyleDefault;
INFOPLIST_KEY_UISupportedInterfaceOrientations = "UIInterfaceOrientationLandscapeLeft UIInterfaceOrientationLandscapeRight UIInterfaceOrientationPortrait";
INFOPLIST_KEY_UISupportedInterfaceOrientations_iPad = "UIInterfaceOrientationLandscapeLeft UIInterfaceOrientationLandscapeRight UIInterfaceOrientationPortrait UIInterfaceOrientationPortraitUpsideDown";
IPHONEOS_DEPLOYMENT_TARGET = 17.0;
IPHONEOS_DEPLOYMENT_TARGET = 18.0;
LD_RUNPATH_SEARCH_PATHS = "@executable_path/Frameworks";
"LD_RUNPATH_SEARCH_PATHS[sdk=macosx*]" = "@executable_path/../Frameworks";
MACOSX_DEPLOYMENT_TARGET = 13.0;
Expand All @@ -1640,7 +1640,7 @@
SWIFT_UPCOMING_FEATURE_REGION_BASED_ISOLATION = YES;
SWIFT_VERSION = 5.0;
TARGETED_DEVICE_FAMILY = "1,2,7";
_EXPERIMENTAL_SWIFT_EXPLICIT_MODULES = YES;
_EXPERIMENTAL_SWIFT_EXPLICIT_MODULES = NO;
};
name = Release;
};
Expand All @@ -1659,7 +1659,7 @@
INFOPLIST_FILE = IceCubesActionExtension/Info.plist;
INFOPLIST_KEY_CFBundleDisplayName = "Open in Ice Cube";
INFOPLIST_KEY_NSHumanReadableCopyright = "";
IPHONEOS_DEPLOYMENT_TARGET = 17.0;
IPHONEOS_DEPLOYMENT_TARGET = 18.0;
LD_RUNPATH_SEARCH_PATHS = (
"$(inherited)",
"@executable_path/Frameworks",
Expand Down Expand Up @@ -1694,7 +1694,7 @@
INFOPLIST_FILE = IceCubesActionExtension/Info.plist;
INFOPLIST_KEY_CFBundleDisplayName = "Open in Ice Cube";
INFOPLIST_KEY_NSHumanReadableCopyright = "";
IPHONEOS_DEPLOYMENT_TARGET = 17.0;
IPHONEOS_DEPLOYMENT_TARGET = 18.0;
LD_RUNPATH_SEARCH_PATHS = (
"$(inherited)",
"@executable_path/Frameworks",
Expand Down
25 changes: 13 additions & 12 deletions IceCubesApp/App/Main/AppView.swift
Original file line number Diff line number Diff line change
Expand Up @@ -21,10 +21,10 @@ struct AppView: View {
@Environment(\.openWindow) var openWindow
@Environment(\.horizontalSizeClass) private var horizontalSizeClass

@Binding var selectedTab: Tab
@Binding var selectedTab: AppTab
@Binding var appRouterPath: RouterPath

@State var popToRootTab: Tab = .other
@State var popToRootTab: AppTab = .other
@State var iosTabs = iOSTabs.shared
@State var sidebarTabs = SidebarTabs.shared

Expand All @@ -40,14 +40,14 @@ struct AppView: View {
#endif
}

var availableTabs: [Tab] {
var availableTabs: [AppTab] {
guard appAccountsManager.currentClient.isAuth else {
return Tab.loggedOutTab()
return AppTab.loggedOutTab()
}
if UIDevice.current.userInterfaceIdiom == .phone || horizontalSizeClass == .compact {
return iosTabs.tabs
} else if UIDevice.current.userInterfaceIdiom == .vision {
return Tab.visionOSTab()
return AppTab.visionOSTab()
}
return sidebarTabs.tabs.map { $0.tab }
}
Expand Down Expand Up @@ -96,7 +96,7 @@ struct AppView: View {
.withSheetDestinations(sheetDestinations: $appRouterPath.presentedSheet)
}

private func badgeFor(tab: Tab) -> Int {
private func badgeFor(tab: AppTab) -> Int {
if tab == .notifications, selectedTab != tab,
let token = appAccountsManager.currentAccount.oauthToken
{
Expand All @@ -114,14 +114,15 @@ struct AppView: View {
HStack(spacing: 0) {
TabView(selection: $selectedTab) {
ForEach(availableTabs) { tab in
tab
.makeContentView(selectedTab: $selectedTab, popToRootTab: $popToRootTab)
.tabItem {
tab.label
}
.tag(tab)
Tab(value: tab) {
tab.makeContentView(selectedTab: $selectedTab, popToRootTab: $popToRootTab)
} label: {
tab.label
}
.defaultVisibility(.hidden, for: .automatic)
}
}
.tabViewStyle(.tabBarOnly)
.introspect(.tabView, on: .iOS(.v17, .v18)) { (tabview: UITabBarController) in
tabview.tabBar.isHidden = horizontalSizeClass == .regular
tabview.customizableViewControllers = []
Expand Down
2 changes: 1 addition & 1 deletion IceCubesApp/App/Main/IceCubesApp.swift
Original file line number Diff line number Diff line change
Expand Up @@ -28,7 +28,7 @@ struct IceCubesApp: App {
@State var quickLook = QuickLook.shared
@State var theme = Theme.shared

@State var selectedTab: Tab = .timeline
@State var selectedTab: AppTab = .timeline
@State var appRouterPath = RouterPath()

@State var isSupporter: Bool = false
Expand Down
14 changes: 7 additions & 7 deletions IceCubesApp/App/SideBarView.swift
Original file line number Diff line number Diff line change
Expand Up @@ -18,14 +18,14 @@ struct SideBarView<Content: View>: View {
@Environment(UserPreferences.self) private var userPreferences
@Environment(RouterPath.self) private var routerPath

@Binding var selectedTab: Tab
@Binding var popToRootTab: Tab
var tabs: [Tab]
@Binding var selectedTab: AppTab
@Binding var popToRootTab: AppTab
var tabs: [AppTab]
@ViewBuilder var content: () -> Content

@State private var sidebarTabs = SidebarTabs.shared

private func badgeFor(tab: Tab) -> Int {
private func badgeFor(tab: AppTab) -> Int {
if tab == .notifications, selectedTab != tab,
let token = appAccounts.currentAccount.oauthToken
{
Expand All @@ -34,7 +34,7 @@ struct SideBarView<Content: View>: View {
return 0
}

private func makeIconForTab(tab: Tab) -> some View {
private func makeIconForTab(tab: AppTab) -> some View {
HStack {
ZStack(alignment: .topTrailing) {
SideBarIcon(systemIconName: tab.iconName,
Expand Down Expand Up @@ -83,7 +83,7 @@ struct SideBarView<Content: View>: View {
.offset(x: 2, y: -2)
}
.buttonStyle(.borderedProminent)
.help(Tab.post.title)
.help(AppTab.post.title)
}

private func makeAccountButton(account: AppAccount, showBadge: Bool) -> some View {
Expand Down Expand Up @@ -133,7 +133,7 @@ struct SideBarView<Content: View>: View {
if let accountName {
"tab.profile-account-\(accountName)"
} else {
Tab.profile.title
AppTab.profile.title
}
}

Expand Down
2 changes: 1 addition & 1 deletion IceCubesApp/App/Tabs/ExploreTab.swift
Original file line number Diff line number Diff line change
Expand Up @@ -14,7 +14,7 @@ struct ExploreTab: View {
@Environment(Client.self) private var client
@State private var routerPath = RouterPath()
@State private var scrollToTopSignal: Int = 0
@Binding var popToRootTab: Tab
@Binding var popToRootTab: AppTab

var body: some View {
NavigationStack(path: $routerPath.path) {
Expand Down
2 changes: 1 addition & 1 deletion IceCubesApp/App/Tabs/MessagesTab.swift
Original file line number Diff line number Diff line change
Expand Up @@ -16,7 +16,7 @@ struct MessagesTab: View {
@Environment(AppAccountsManager.self) private var appAccount
@State private var routerPath = RouterPath()
@State private var scrollToTopSignal: Int = 0
@Binding var popToRootTab: Tab
@Binding var popToRootTab: AppTab

var body: some View {
NavigationStack(path: $routerPath.path) {
Expand Down
4 changes: 2 additions & 2 deletions IceCubesApp/App/Tabs/NotificationTab.swift
Original file line number Diff line number Diff line change
Expand Up @@ -22,8 +22,8 @@ struct NotificationsTab: View {
@State private var routerPath = RouterPath()
@State private var scrollToTopSignal: Int = 0

@Binding var selectedTab: Tab
@Binding var popToRootTab: Tab
@Binding var selectedTab: AppTab
@Binding var popToRootTab: AppTab

let lockedType: Models.Notification.NotificationType?

Expand Down
2 changes: 1 addition & 1 deletion IceCubesApp/App/Tabs/ProfileTab.swift
Original file line number Diff line number Diff line change
Expand Up @@ -15,7 +15,7 @@ struct ProfileTab: View {
@Environment(CurrentAccount.self) private var currentAccount
@State private var routerPath = RouterPath()
@State private var scrollToTopSignal: Int = 0
@Binding var popToRootTab: Tab
@Binding var popToRootTab: AppTab

var body: some View {
NavigationStack(path: $routerPath.path) {
Expand Down
2 changes: 1 addition & 1 deletion IceCubesApp/App/Tabs/Settings/SettingsTab.swift
Original file line number Diff line number Diff line change
Expand Up @@ -28,7 +28,7 @@ struct SettingsTabs: View {
@State private var cachedRemoved = false
@State private var timelineCache = TimelineCache()

@Binding var popToRootTab: Tab
@Binding var popToRootTab: AppTab

let isModal: Bool

Expand Down
10 changes: 5 additions & 5 deletions IceCubesApp/App/Tabs/Settings/TabbarEntriesSettingsView.swift
Original file line number Diff line number Diff line change
Expand Up @@ -14,27 +14,27 @@ struct TabbarEntriesSettingsView: View {
Form {
Section {
Picker("settings.tabs.first-tab", selection: $tabs.firstTab) {
ForEach(Tab.allCases) { tab in
ForEach(AppTab.allCases) { tab in
tab.label.tag(tab)
}
}
Picker("settings.tabs.second-tab", selection: $tabs.secondTab) {
ForEach(Tab.allCases) { tab in
ForEach(AppTab.allCases) { tab in
tab.label.tag(tab)
}
}
Picker("settings.tabs.third-tab", selection: $tabs.thirdTab) {
ForEach(Tab.allCases) { tab in
ForEach(AppTab.allCases) { tab in
tab.label.tag(tab)
}
}
Picker("settings.tabs.fourth-tab", selection: $tabs.fourthTab) {
ForEach(Tab.allCases) { tab in
ForEach(AppTab.allCases) { tab in
tab.label.tag(tab)
}
}
Picker("settings.tabs.fifth-tab", selection: $tabs.fifthTab) {
ForEach(Tab.allCases) { tab in
ForEach(AppTab.allCases) { tab in
tab.label.tag(tab)
}
}
Expand Down
Loading

0 comments on commit 3ec5c8c

Please sign in to comment.