This commit is contained in:
Thomas Ricouard 2024-08-01 08:58:54 +02:00
parent 2a3da72239
commit a72f290038
38 changed files with 209 additions and 207 deletions

View File

@ -1,4 +1,5 @@
import AppAccount
import AuthenticationServices
import Combine
import DesignSystem
import Env
@ -7,7 +8,6 @@ import Network
import NukeUI
import SafariServices
import SwiftUI
import AuthenticationServices
@MainActor
struct AddAccountView: View {

View File

@ -10,12 +10,12 @@ struct AccountWidgetProvider: AppIntentTimelineProvider {
.init(date: Date(), account: .placeholder(), avatar: nil)
}
func snapshot(for configuration: AccountWidgetConfiguration, in context: Context) async -> AccountWidgetEntry {
func snapshot(for configuration: AccountWidgetConfiguration, in _: Context) async -> AccountWidgetEntry {
let account = await fetchAccount(configuration: configuration)
return .init(date: Date(), account: account, avatar: nil)
}
func timeline(for configuration: AccountWidgetConfiguration, in context: Context) async -> Timeline<AccountWidgetEntry> {
func timeline(for configuration: AccountWidgetConfiguration, in _: Context) async -> Timeline<AccountWidgetEntry> {
let account = await fetchAccount(configuration: configuration)
let images = try? await loadImages(urls: [account.avatar])
return .init(entries: [.init(date: Date(), account: account, avatar: images?.first?.value)],

View File

@ -11,7 +11,6 @@ struct AccountWidgetView: View {
@Environment(\.widgetFamily) var family
@Environment(\.redactionReasons) var redacted
var body: some View {
VStack(alignment: .center, spacing: 4) {
if let avatar = entry.avatar {

View File

@ -1,10 +1,10 @@
import SwiftUI
import DesignSystem
import NukeUI
import Env
import MediaUI
import Models
import Network
import NukeUI
import SwiftUI
@MainActor
public struct AccountDetailMediaGridView: View {
@ -18,7 +18,7 @@ public struct AccountDetailMediaGridView: View {
public init(account: Account, initialMediaStatuses: [MediaStatus]) {
self.account = account
self.mediaStatuses = initialMediaStatuses
mediaStatuses = initialMediaStatuses
}
public var body: some View {
@ -26,7 +26,8 @@ public struct AccountDetailMediaGridView: View {
LazyVGrid(columns: [.init(.flexible(minimum: 100), spacing: 4),
.init(.flexible(minimum: 100), spacing: 4),
.init(.flexible(minimum: 100), spacing: 4)],
spacing: 4) {
spacing: 4)
{
ForEach(mediaStatuses) { status in
GeometryReader { proxy in
if let url = status.attachment.url {

View File

@ -3,8 +3,8 @@ import SwiftUI
#if canImport(_Translation_SwiftUI)
import Translation
extension View {
public func addTranslateView(isPresented: Binding<Bool>, text: String) -> some View {
public extension View {
func addTranslateView(isPresented: Binding<Bool>, text: String) -> some View {
if #available(iOS 17.4, *) {
return self.translationPresentation(isPresented: isPresented, text: text)
} else {

View File

@ -137,7 +137,7 @@ public enum SettingsStartingPoint {
public var path: [RouterDestination] = []
public var presentedSheet: SheetDestination?
public static var settingsStartingPoint: SettingsStartingPoint? = nil
public static var settingsStartingPoint: SettingsStartingPoint?
public init() {}

View File

@ -149,8 +149,6 @@ import SwiftUI
case .statuses:
self.results[searchQuery]?.statuses.append(contentsOf: newPageResults.statuses)
}
} catch {
}
} catch {}
}
}

View File

@ -9,6 +9,7 @@ public struct Card: Codable, Identifiable, Equatable, Hashable {
public var id: String {
url
}
public let name: String
public let url: String
public let account: Account?

View File

@ -4,7 +4,6 @@ public enum Profile: Endpoint {
case deleteAvatar
case deleteHeader
public func path() -> String {
switch self {
case .deleteAvatar:

View File

@ -194,7 +194,7 @@ extension StatusEditor {
}
}
private func makeErrorView(error: ServerError) -> some View {
private func makeErrorView(error _: ServerError) -> some View {
ZStack {
placeholderView
Text("status.editor.error.upload")

View File

@ -381,14 +381,16 @@ import SwiftUI
var hasShown = false
#if canImport(_Translation_SwiftUI)
if translation == nil,
#available(iOS 17.4, *) {
#available(iOS 17.4, *)
{
showAppleTranslation = true
hasShown = true
}
#endif
if !hasShown,
translation == nil {
translation == nil
{
if preferredTranslationType == .useDeepl {
deeplTranslationError = true
} else {

View File

@ -313,7 +313,8 @@ extension TimelineViewModel: StatusesFetcher {
guard !newStatuses.isEmpty,
isTimelineVisible,
!Task.isCancelled,
initialTimeline == timeline else {
initialTimeline == timeline
else {
canStreamEvents = true
return
}
@ -347,7 +348,8 @@ extension TimelineViewModel: StatusesFetcher {
if let topStatus = topStatus,
visibileStatuses.contains(where: { $0.id == topStatus.id }),
scrollToTopVisible {
scrollToTopVisible
{
updateTimelineWithScrollToTop(newStatuses: newStatuses, statuses: statuses, nextPageState: nextPageState)
} else {
updateTimelineWithAnimation(statuses: statuses, nextPageState: nextPageState)