mirror of
https://github.com/Dimillian/IceCubesApp.git
synced 2024-06-10 09:19:22 +00:00
More wip
This commit is contained in:
parent
da0f87be8e
commit
5c81c9e691
|
@ -156,49 +156,53 @@ struct IceCubesApp: App {
|
||||||
}
|
}
|
||||||
|
|
||||||
private var tabBarView: some View {
|
private var tabBarView: some View {
|
||||||
TabView(selection: .init(get: {
|
HStack(spacing: 0) {
|
||||||
selectedTab
|
TabView(selection: .init(get: {
|
||||||
}, set: { newTab in
|
selectedTab
|
||||||
if newTab == selectedTab {
|
}, set: { newTab in
|
||||||
/// Stupid hack to trigger onChange binding in tab views.
|
if newTab == selectedTab {
|
||||||
popToRootTab = .other
|
/// Stupid hack to trigger onChange binding in tab views.
|
||||||
DispatchQueue.main.asyncAfter(deadline: .now() + 0.01) {
|
popToRootTab = .other
|
||||||
popToRootTab = selectedTab
|
DispatchQueue.main.asyncAfter(deadline: .now() + 0.01) {
|
||||||
}
|
popToRootTab = selectedTab
|
||||||
}
|
|
||||||
|
|
||||||
HapticManager.shared.fireHaptic(of: .tabSelection)
|
|
||||||
SoundEffectManager.shared.playSound(of: .tabSelection)
|
|
||||||
|
|
||||||
selectedTab = newTab
|
|
||||||
|
|
||||||
DispatchQueue.main.async {
|
|
||||||
if selectedTab == .notifications,
|
|
||||||
let token = appAccountsManager.currentAccount.oauthToken
|
|
||||||
{
|
|
||||||
userPreferences.setNotification(count: 0, token: token)
|
|
||||||
watcher.unreadNotificationsCount = 0
|
|
||||||
}
|
|
||||||
}
|
|
||||||
|
|
||||||
})) {
|
|
||||||
ForEach(availableTabs) { tab in
|
|
||||||
tab.makeContentView(popToRootTab: $popToRootTab)
|
|
||||||
.tabItem {
|
|
||||||
if userPreferences.showiPhoneTabLabel {
|
|
||||||
tab.label
|
|
||||||
.labelStyle(TitleAndIconLabelStyle())
|
|
||||||
} else {
|
|
||||||
tab.label
|
|
||||||
.labelStyle(IconOnlyLabelStyle())
|
|
||||||
}
|
|
||||||
}
|
}
|
||||||
.tag(tab)
|
}
|
||||||
.badge(badgeFor(tab: tab))
|
|
||||||
.toolbarBackground(theme.primaryBackgroundColor.opacity(0.50), for: .tabBar)
|
HapticManager.shared.fireHaptic(of: .tabSelection)
|
||||||
|
SoundEffectManager.shared.playSound(of: .tabSelection)
|
||||||
|
|
||||||
|
selectedTab = newTab
|
||||||
|
|
||||||
|
DispatchQueue.main.async {
|
||||||
|
if selectedTab == .notifications,
|
||||||
|
let token = appAccountsManager.currentAccount.oauthToken
|
||||||
|
{
|
||||||
|
userPreferences.setNotification(count: 0, token: token)
|
||||||
|
watcher.unreadNotificationsCount = 0
|
||||||
|
}
|
||||||
|
}
|
||||||
|
|
||||||
|
})) {
|
||||||
|
ForEach(availableTabs) { tab in
|
||||||
|
tab.makeContentView(popToRootTab: $popToRootTab)
|
||||||
|
.tabItem {
|
||||||
|
if userPreferences.showiPhoneTabLabel {
|
||||||
|
tab.label
|
||||||
|
.labelStyle(TitleAndIconLabelStyle())
|
||||||
|
} else {
|
||||||
|
tab.label
|
||||||
|
.labelStyle(IconOnlyLabelStyle())
|
||||||
|
}
|
||||||
|
}
|
||||||
|
.tag(tab)
|
||||||
|
.badge(badgeFor(tab: tab))
|
||||||
|
.toolbarBackground(theme.primaryBackgroundColor.opacity(0.50), for: .tabBar)
|
||||||
|
}
|
||||||
}
|
}
|
||||||
|
.id(appAccountsManager.currentClient.id)
|
||||||
|
Divider().edgesIgnoringSafeArea(.all)
|
||||||
|
notificationsSecondaryColumn
|
||||||
}
|
}
|
||||||
.id(appAccountsManager.currentClient.id)
|
|
||||||
}
|
}
|
||||||
|
|
||||||
private func setNewClientsInEnv(client: Client) {
|
private func setNewClientsInEnv(client: Client) {
|
||||||
|
|
|
@ -169,6 +169,10 @@ public class Theme: ObservableObject {
|
||||||
self?.setColor(withName: colorSetName)
|
self?.setColor(withName: colorSetName)
|
||||||
}
|
}
|
||||||
.store(in: &cancellables)
|
.store(in: &cancellables)
|
||||||
|
|
||||||
|
#if os(visionOS)
|
||||||
|
selectedSet = .iceCubeDark
|
||||||
|
#endif
|
||||||
}
|
}
|
||||||
|
|
||||||
public static var allColorSet: [ColorSet] {
|
public static var allColorSet: [ColorSet] {
|
||||||
|
|
|
@ -72,7 +72,6 @@ public struct NotificationsListView: View {
|
||||||
}
|
}
|
||||||
.navigationBarTitleDisplayMode(.inline)
|
.navigationBarTitleDisplayMode(.inline)
|
||||||
.scrollContentBackground(.hidden)
|
.scrollContentBackground(.hidden)
|
||||||
.background(theme.primaryBackgroundColor)
|
|
||||||
.task {
|
.task {
|
||||||
viewModel.client = client
|
viewModel.client = client
|
||||||
viewModel.currentAccount = account
|
viewModel.currentAccount = account
|
||||||
|
@ -119,7 +118,6 @@ public struct NotificationsListView: View {
|
||||||
leading: .layoutPadding + 4,
|
leading: .layoutPadding + 4,
|
||||||
bottom: 12,
|
bottom: 12,
|
||||||
trailing: .layoutPadding))
|
trailing: .layoutPadding))
|
||||||
.listRowBackground(theme.primaryBackgroundColor)
|
|
||||||
.redacted(reason: .placeholder)
|
.redacted(reason: .placeholder)
|
||||||
}
|
}
|
||||||
|
|
||||||
|
@ -128,7 +126,6 @@ public struct NotificationsListView: View {
|
||||||
EmptyView(iconName: "bell.slash",
|
EmptyView(iconName: "bell.slash",
|
||||||
title: "notifications.empty.title",
|
title: "notifications.empty.title",
|
||||||
message: "notifications.empty.message")
|
message: "notifications.empty.message")
|
||||||
.listRowBackground(theme.primaryBackgroundColor)
|
|
||||||
.listSectionSeparator(.hidden)
|
.listSectionSeparator(.hidden)
|
||||||
} else {
|
} else {
|
||||||
ForEach(notifications) { notification in
|
ForEach(notifications) { notification in
|
||||||
|
@ -140,8 +137,6 @@ public struct NotificationsListView: View {
|
||||||
leading: .layoutPadding + 4,
|
leading: .layoutPadding + 4,
|
||||||
bottom: 12,
|
bottom: 12,
|
||||||
trailing: .layoutPadding))
|
trailing: .layoutPadding))
|
||||||
.listRowBackground(notification.type == .mention && lockedType != .mention ?
|
|
||||||
theme.secondaryBackgroundColor : theme.primaryBackgroundColor)
|
|
||||||
.id(notification.id)
|
.id(notification.id)
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
@ -169,7 +164,6 @@ public struct NotificationsListView: View {
|
||||||
await viewModel.fetchNotifications()
|
await viewModel.fetchNotifications()
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
.listRowBackground(theme.primaryBackgroundColor)
|
|
||||||
.listSectionSeparator(.hidden)
|
.listSectionSeparator(.hidden)
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
@ -184,7 +178,6 @@ public struct NotificationsListView: View {
|
||||||
leading: .layoutPadding + 4,
|
leading: .layoutPadding + 4,
|
||||||
bottom: .layoutPadding,
|
bottom: .layoutPadding,
|
||||||
trailing: .layoutPadding))
|
trailing: .layoutPadding))
|
||||||
.listRowBackground(theme.primaryBackgroundColor)
|
|
||||||
}
|
}
|
||||||
|
|
||||||
private var topPaddingView: some View {
|
private var topPaddingView: some View {
|
||||||
|
|
|
@ -41,7 +41,6 @@ public struct StatusesListView<Fetcher>: View where Fetcher: StatusesFetcher {
|
||||||
await fetcher.fetchNewestStatuses()
|
await fetcher.fetchNewestStatuses()
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
.listRowBackground(theme.primaryBackgroundColor)
|
|
||||||
.listRowSeparator(.hidden)
|
.listRowSeparator(.hidden)
|
||||||
|
|
||||||
case let .display(statuses, nextPageState):
|
case let .display(statuses, nextPageState):
|
||||||
|
@ -83,6 +82,5 @@ public struct StatusesListView<Fetcher>: View where Fetcher: StatusesFetcher {
|
||||||
Spacer()
|
Spacer()
|
||||||
}
|
}
|
||||||
.padding(.horizontal, .layoutPadding)
|
.padding(.horizontal, .layoutPadding)
|
||||||
.listRowBackground(theme.primaryBackgroundColor)
|
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
|
@ -117,7 +117,6 @@ public struct StatusRowView: View {
|
||||||
StatusRowSwipeView(viewModel: viewModel, mode: .leading)
|
StatusRowSwipeView(viewModel: viewModel, mode: .leading)
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
.listRowBackground(viewModel.highlightRowColor)
|
|
||||||
.listRowInsets(.init(top: 12,
|
.listRowInsets(.init(top: 12,
|
||||||
leading: .layoutPadding,
|
leading: .layoutPadding,
|
||||||
bottom: 12,
|
bottom: 12,
|
||||||
|
|
|
@ -91,7 +91,7 @@ public struct StatusRowCardView: View {
|
||||||
}
|
}
|
||||||
.frame(maxWidth: maxWidth)
|
.frame(maxWidth: maxWidth)
|
||||||
.fixedSize(horizontal: false, vertical: true)
|
.fixedSize(horizontal: false, vertical: true)
|
||||||
.background(theme.secondaryBackgroundColor)
|
.background(.ultraThinMaterial)
|
||||||
.cornerRadius(16)
|
.cornerRadius(16)
|
||||||
.overlay(
|
.overlay(
|
||||||
RoundedRectangle(cornerRadius: 16)
|
RoundedRectangle(cornerRadius: 16)
|
||||||
|
|
|
@ -94,7 +94,6 @@ struct StatusRowContextMenu: View {
|
||||||
.environmentObject(viewModel.client)
|
.environmentObject(viewModel.client)
|
||||||
.preferredColorScheme(Theme.shared.selectedScheme == .dark ? .dark : .light)
|
.preferredColorScheme(Theme.shared.selectedScheme == .dark ? .dark : .light)
|
||||||
.foregroundColor(Theme.shared.labelColor)
|
.foregroundColor(Theme.shared.labelColor)
|
||||||
.background(Theme.shared.primaryBackgroundColor)
|
|
||||||
.frame(width: sceneDelegate.windowWidth - 12)
|
.frame(width: sceneDelegate.windowWidth - 12)
|
||||||
.tint(Theme.shared.tintColor)
|
.tint(Theme.shared.tintColor)
|
||||||
let renderer = ImageRenderer(content: view)
|
let renderer = ImageRenderer(content: view)
|
||||||
|
|
|
@ -25,7 +25,7 @@ public struct StatusRowMediaPreviewView: View {
|
||||||
@State private var isHidingMedia: Bool = false
|
@State private var isHidingMedia: Bool = false
|
||||||
|
|
||||||
var availableWidth: CGFloat {
|
var availableWidth: CGFloat {
|
||||||
return sceneDelegate.windowWidth
|
return sceneDelegate.windowWidth * 0.50
|
||||||
}
|
}
|
||||||
|
|
||||||
var appLayoutWidth: CGFloat {
|
var appLayoutWidth: CGFloat {
|
||||||
|
|
|
@ -57,7 +57,6 @@ public struct TimelineView: View {
|
||||||
.environment(\.defaultMinListRowHeight, 1)
|
.environment(\.defaultMinListRowHeight, 1)
|
||||||
.listStyle(.plain)
|
.listStyle(.plain)
|
||||||
.scrollContentBackground(.hidden)
|
.scrollContentBackground(.hidden)
|
||||||
.background(theme.primaryBackgroundColor)
|
|
||||||
.introspect(.list, on: .iOS(.v16, .v17)) { (collectionView: UICollectionView) in
|
.introspect(.list, on: .iOS(.v16, .v17)) { (collectionView: UICollectionView) in
|
||||||
DispatchQueue.main.async {
|
DispatchQueue.main.async {
|
||||||
self.collectionView = collectionView
|
self.collectionView = collectionView
|
||||||
|
@ -257,7 +256,6 @@ public struct TimelineView: View {
|
||||||
|
|
||||||
private var scrollToTopView: some View {
|
private var scrollToTopView: some View {
|
||||||
HStack { EmptyView() }
|
HStack { EmptyView() }
|
||||||
.listRowBackground(theme.primaryBackgroundColor)
|
|
||||||
.listRowSeparator(.hidden)
|
.listRowSeparator(.hidden)
|
||||||
.listRowInsets(.init())
|
.listRowInsets(.init())
|
||||||
.frame(height: .layoutPadding)
|
.frame(height: .layoutPadding)
|
||||||
|
|
Loading…
Reference in a new issue