mirror of
https://github.com/Dimillian/IceCubesApp.git
synced 2024-11-29 19:51:08 +00:00
Various small UI fixes
This commit is contained in:
parent
5deb928dee
commit
e69fcee9fb
4 changed files with 30 additions and 27 deletions
|
@ -72,8 +72,9 @@ class ExploreViewModel: ObservableObject {
|
||||||
self.trendingLinks = data.trendingLinks
|
self.trendingLinks = data.trendingLinks
|
||||||
|
|
||||||
self.suggestedAccountsRelationShips = try await client.get(endpoint: Accounts.relationships(ids: self.suggestedAccounts.map{ $0.id }))
|
self.suggestedAccountsRelationShips = try await client.get(endpoint: Accounts.relationships(ids: self.suggestedAccounts.map{ $0.id }))
|
||||||
|
withAnimation {
|
||||||
isLoaded = true
|
isLoaded = true
|
||||||
|
}
|
||||||
} catch {
|
} catch {
|
||||||
isLoaded = true
|
isLoaded = true
|
||||||
}
|
}
|
||||||
|
|
|
@ -52,15 +52,20 @@ class NotificationsViewModel: ObservableObject {
|
||||||
types: queryTypes))
|
types: queryTypes))
|
||||||
nextPageState = notifications.count < 15 ? .none : .hasNextPage
|
nextPageState = notifications.count < 15 ? .none : .hasNextPage
|
||||||
} else if let first = notifications.first {
|
} else if let first = notifications.first {
|
||||||
let newNotifications: [Models.Notification] =
|
var newNotifications: [Models.Notification] =
|
||||||
try await client.get(endpoint: Notifications.notifications(sinceId: first.id,
|
try await client.get(endpoint: Notifications.notifications(sinceId: first.id,
|
||||||
maxId: nil,
|
maxId: nil,
|
||||||
types: queryTypes))
|
types: queryTypes))
|
||||||
nextPageState = notifications.count < 15 ? .none : .hasNextPage
|
nextPageState = notifications.count < 15 ? .none : .hasNextPage
|
||||||
|
newNotifications = newNotifications.filter({ notification in
|
||||||
|
!notifications.contains(where: { $0.id == notification.id })
|
||||||
|
})
|
||||||
notifications.insert(contentsOf: newNotifications, at: 0)
|
notifications.insert(contentsOf: newNotifications, at: 0)
|
||||||
}
|
}
|
||||||
state = .display(notifications: notifications,
|
withAnimation {
|
||||||
nextPageState: notifications.isEmpty ? .none : nextPageState)
|
state = .display(notifications: notifications,
|
||||||
|
nextPageState: notifications.isEmpty ? .none : nextPageState)
|
||||||
|
}
|
||||||
} catch {
|
} catch {
|
||||||
state = .error(error: error)
|
state = .error(error: error)
|
||||||
}
|
}
|
||||||
|
|
|
@ -98,10 +98,12 @@ struct StatusActionsView: View {
|
||||||
|
|
||||||
@ViewBuilder
|
@ViewBuilder
|
||||||
private var summaryView: some View {
|
private var summaryView: some View {
|
||||||
|
Divider()
|
||||||
HStack {
|
HStack {
|
||||||
Text(viewModel.status.createdAt.asDate, style: .date)
|
Text(viewModel.status.createdAt.asDate, style: .date) +
|
||||||
Text(viewModel.status.createdAt.asDate, style: .time)
|
Text(" at ") +
|
||||||
Text("·")
|
Text(viewModel.status.createdAt.asDate, style: .time) +
|
||||||
|
Text(" ·")
|
||||||
Image(systemName: viewModel.status.visibility.iconName)
|
Image(systemName: viewModel.status.visibility.iconName)
|
||||||
Spacer()
|
Spacer()
|
||||||
Text(viewModel.status.application?.name ?? "")
|
Text(viewModel.status.application?.name ?? "")
|
||||||
|
@ -114,30 +116,23 @@ struct StatusActionsView: View {
|
||||||
}
|
}
|
||||||
.font(.caption)
|
.font(.caption)
|
||||||
.foregroundColor(.gray)
|
.foregroundColor(.gray)
|
||||||
|
|
||||||
if viewModel.favouritesCount > 0 {
|
if viewModel.favouritesCount > 0 {
|
||||||
Divider()
|
Divider()
|
||||||
Button {
|
NavigationLink(value: RouteurDestinations.favouritedBy(id: viewModel.status.id)) {
|
||||||
routeurPath.navigate(to: .favouritedBy(id: viewModel.status.id))
|
Text("\(viewModel.favouritesCount) favorites")
|
||||||
} label: {
|
.font(.callout)
|
||||||
HStack {
|
Spacer()
|
||||||
Text("\(viewModel.favouritesCount) favorites")
|
Image(systemName: "chevron.right")
|
||||||
Spacer()
|
|
||||||
Image(systemName: "chevron.right")
|
|
||||||
}
|
|
||||||
.font(.callout)
|
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
if viewModel.reblogsCount > 0 {
|
if viewModel.reblogsCount > 0 {
|
||||||
Divider()
|
Divider()
|
||||||
Button {
|
NavigationLink(value: RouteurDestinations.rebloggedBy(id: viewModel.status.id)) {
|
||||||
routeurPath.navigate(to: .rebloggedBy(id: viewModel.status.id))
|
Text("\(viewModel.reblogsCount) boosts")
|
||||||
} label: {
|
.font(.callout)
|
||||||
HStack {
|
Spacer()
|
||||||
Text("\(viewModel.reblogsCount) boosts")
|
Image(systemName: "chevron.right")
|
||||||
Spacer()
|
|
||||||
Image(systemName: "chevron.right")
|
|
||||||
}
|
|
||||||
.font(.callout)
|
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
|
@ -74,7 +74,9 @@ class TimelineViewModel: ObservableObject, StatusesFetcher {
|
||||||
maxId: nil,
|
maxId: nil,
|
||||||
minId: nil,
|
minId: nil,
|
||||||
offset: statuses.count))
|
offset: statuses.count))
|
||||||
statusesState = .display(statuses: statuses, nextPageState: statuses.count < 20 ? .none : .hasNextPage)
|
withAnimation {
|
||||||
|
statusesState = .display(statuses: statuses, nextPageState: statuses.count < 20 ? .none : .hasNextPage)
|
||||||
|
}
|
||||||
} else if let first = pendingStatuses.first ?? statuses.first {
|
} else if let first = pendingStatuses.first ?? statuses.first {
|
||||||
var newStatuses: [Status] = await fetchNewPages(minId: first.id, maxPages: 20)
|
var newStatuses: [Status] = await fetchNewPages(minId: first.id, maxPages: 20)
|
||||||
if userIntent || !pendingStatusesEnabled {
|
if userIntent || !pendingStatusesEnabled {
|
||||||
|
|
Loading…
Reference in a new issue