Refactor.

This commit is contained in:
Marcin Czachursk 2023-01-20 16:57:25 +01:00
parent 72de55b7fd
commit ab08edbe11
89 changed files with 344 additions and 163 deletions

View File

@ -1,3 +1,9 @@
//
// https://mczachurski.dev
// Copyright © 2022 Marcin Czachurski and the repository contributors.
// Licensed under the MIT License.
//
import Foundation
import OAuthSwift

View File

@ -1,3 +1,9 @@
//
// https://mczachurski.dev
// Copyright © 2022 Marcin Czachurski and the repository contributors.
// Licensed under the MIT License.
//
import Foundation
public struct Account: Codable {

View File

@ -1,3 +1,9 @@
//
// https://mczachurski.dev
// Copyright © 2022 Marcin Czachurski and the repository contributors.
// Licensed under the MIT License.
//
import Foundation
public struct App: Codable {

View File

@ -1,3 +1,9 @@
//
// https://mczachurski.dev
// Copyright © 2022 Marcin Czachurski and the repository contributors.
// Licensed under the MIT License.
//
import Foundation
public struct Application: Codable {

View File

@ -1,3 +1,9 @@
//
// https://mczachurski.dev
// Copyright © 2022 Marcin Czachurski and the repository contributors.
// Licensed under the MIT License.
//
import Foundation
public class Attachment: Codable {

View File

@ -1,3 +1,9 @@
//
// https://mczachurski.dev
// Copyright © 2022 Marcin Czachurski and the repository contributors.
// Licensed under the MIT License.
//
import Foundation
public struct Card: Codable {

View File

@ -1,3 +1,9 @@
//
// https://mczachurski.dev
// Copyright © 2022 Marcin Czachurski and the repository contributors.
// Licensed under the MIT License.
//
import Foundation
public struct Context: Codable {

View File

@ -3,7 +3,6 @@
// Copyright © 2023 Marcin Czachurski and the repository contributors.
// Licensed under the MIT License.
//
import Foundation

View File

@ -1,3 +1,9 @@
//
// https://mczachurski.dev
// Copyright © 2022 Marcin Czachurski and the repository contributors.
// Licensed under the MIT License.
//
import Foundation
public struct ErrorMessage: Codable {

View File

@ -1,3 +1,9 @@
//
// https://mczachurski.dev
// Copyright © 2022 Marcin Czachurski and the repository contributors.
// Licensed under the MIT License.
//
import Foundation
public struct Focus: Codable {

View File

@ -1,3 +1,9 @@
//
// https://mczachurski.dev
// Copyright © 2022 Marcin Czachurski and the repository contributors.
// Licensed under the MIT License.
//
import Foundation
public struct ImageInfo: Codable {

View File

@ -1,3 +1,9 @@
//
// https://mczachurski.dev
// Copyright © 2022 Marcin Czachurski and the repository contributors.
// Licensed under the MIT License.
//
import Foundation
public struct ImageMetadata: Metadata {

View File

@ -1,3 +1,9 @@
//
// https://mczachurski.dev
// Copyright © 2022 Marcin Czachurski and the repository contributors.
// Licensed under the MIT License.
//
import Foundation
public struct Instance: Codable {

View File

@ -1,3 +1,9 @@
//
// https://mczachurski.dev
// Copyright © 2022 Marcin Czachurski and the repository contributors.
// Licensed under the MIT License.
//
import Foundation
public struct Marker: Codable {

View File

@ -1,3 +1,9 @@
//
// https://mczachurski.dev
// Copyright © 2022 Marcin Czachurski and the repository contributors.
// Licensed under the MIT License.
//
import Foundation
public struct Mention: Codable {

View File

@ -1,3 +1,9 @@
//
// https://mczachurski.dev
// Copyright © 2022 Marcin Czachurski and the repository contributors.
// Licensed under the MIT License.
//
public protocol Metadata: Codable {
}

View File

@ -1,3 +1,9 @@
//
// https://mczachurski.dev
// Copyright © 2022 Marcin Czachurski and the repository contributors.
// Licensed under the MIT License.
//
import Foundation
public struct Notification: Codable {

View File

@ -1,3 +1,9 @@
//
// https://mczachurski.dev
// Copyright © 2022 Marcin Czachurski and the repository contributors.
// Licensed under the MIT License.
//
import Foundation
public struct Relationship: Codable {

View File

@ -1,3 +1,9 @@
//
// https://mczachurski.dev
// Copyright © 2022 Marcin Czachurski and the repository contributors.
// Licensed under the MIT License.
//
import Foundation
public struct Report: Codable {

View File

@ -1,3 +1,9 @@
//
// https://mczachurski.dev
// Copyright © 2022 Marcin Czachurski and the repository contributors.
// Licensed under the MIT License.
//
import Foundation
public typealias Hashtag = String

View File

@ -1,3 +1,9 @@
//
// https://mczachurski.dev
// Copyright © 2022 Marcin Czachurski and the repository contributors.
// Licensed under the MIT License.
//
import Foundation
public typealias EntityId = String

View File

@ -1,3 +1,9 @@
//
// https://mczachurski.dev
// Copyright © 2022 Marcin Czachurski and the repository contributors.
// Licensed under the MIT License.
//
import Foundation
public struct Tag: Codable {

View File

@ -1,3 +1,9 @@
//
// https://mczachurski.dev
// Copyright © 2022 Marcin Czachurski and the repository contributors.
// Licensed under the MIT License.
//
import Foundation
extension Bool {

View File

@ -1,3 +1,9 @@
//
// https://mczachurski.dev
// Copyright © 2022 Marcin Czachurski and the repository contributors.
// Licensed under the MIT License.
//
import Foundation
extension String {

View File

@ -1,3 +1,9 @@
//
// https://mczachurski.dev
// Copyright © 2022 Marcin Czachurski and the repository contributors.
// Licensed under the MIT License.
//
import Foundation
extension URL {

View File

@ -1,3 +1,9 @@
//
// https://mczachurski.dev
// Copyright © 2022 Marcin Czachurski and the repository contributors.
// Licensed under the MIT License.
//
import Foundation
import OAuthSwift

View File

@ -1,3 +1,9 @@
//
// https://mczachurski.dev
// Copyright © 2022 Marcin Czachurski and the repository contributors.
// Licensed under the MIT License.
//
import Foundation
public extension MastodonClient {

View File

@ -6,7 +6,6 @@
import Foundation
public extension MastodonClientAuthenticated {
func getNotifications(maxId: MaxId? = nil,
sinceId: SinceId? = nil,

View File

@ -1,3 +1,9 @@
//
// https://mczachurski.dev
// Copyright © 2022 Marcin Czachurski and the repository contributors.
// Licensed under the MIT License.
//
import Foundation
public extension MastodonClientAuthenticated {

View File

@ -1,3 +1,9 @@
//
// https://mczachurski.dev
// Copyright © 2022 Marcin Czachurski and the repository contributors.
// Licensed under the MIT License.
//
import Foundation
import OAuthSwift

View File

@ -1,3 +1,9 @@
//
// https://mczachurski.dev
// Copyright © 2022 Marcin Czachurski and the repository contributors.
// Licensed under the MIT License.
//
import Foundation
extension Data {

View File

@ -1,3 +1,9 @@
//
// https://mczachurski.dev
// Copyright © 2022 Marcin Czachurski and the repository contributors.
// Licensed under the MIT License.
//
import Foundation
public enum NetworkingError: String, Swift.Error {

View File

@ -1,3 +1,9 @@
//
// https://mczachurski.dev
// Copyright © 2022 Marcin Czachurski and the repository contributors.
// Licensed under the MIT License.
//
import Foundation
extension Mastodon {

View File

@ -1,3 +1,9 @@
//
// https://mczachurski.dev
// Copyright © 2022 Marcin Czachurski and the repository contributors.
// Licensed under the MIT License.
//
import Foundation
extension Mastodon {

View File

@ -1,3 +1,9 @@
//
// https://mczachurski.dev
// Copyright © 2022 Marcin Czachurski and the repository contributors.
// Licensed under the MIT License.
//
import Foundation
extension Mastodon {

View File

@ -1,3 +1,9 @@
//
// https://mczachurski.dev
// Copyright © 2022 Marcin Czachurski and the repository contributors.
// Licensed under the MIT License.
//
import Foundation
extension Mastodon {

View File

@ -1,3 +1,9 @@
//
// https://mczachurski.dev
// Copyright © 2022 Marcin Czachurski and the repository contributors.
// Licensed under the MIT License.
//
import Foundation
extension Mastodon {

View File

@ -1,3 +1,9 @@
//
// https://mczachurski.dev
// Copyright © 2022 Marcin Czachurski and the repository contributors.
// Licensed under the MIT License.
//
import Foundation
extension Mastodon {

View File

@ -1,3 +1,9 @@
//
// https://mczachurski.dev
// Copyright © 2022 Marcin Czachurski and the repository contributors.
// Licensed under the MIT License.
//
import Foundation
extension Mastodon {

View File

@ -1,3 +1,9 @@
//
// https://mczachurski.dev
// Copyright © 2022 Marcin Czachurski and the repository contributors.
// Licensed under the MIT License.
//
import Foundation
extension Mastodon {

View File

@ -1,3 +1,9 @@
//
// https://mczachurski.dev
// Copyright © 2022 Marcin Czachurski and the repository contributors.
// Licensed under the MIT License.
//
import Foundation
public typealias AccountId = String

View File

@ -1,3 +1,9 @@
//
// https://mczachurski.dev
// Copyright © 2022 Marcin Czachurski and the repository contributors.
// Licensed under the MIT License.
//
import Foundation
fileprivate let multipartBoundary = UUID().uuidString

View File

@ -1,3 +1,9 @@
//
// https://mczachurski.dev
// Copyright © 2022 Marcin Czachurski and the repository contributors.
// Licensed under the MIT License.
//
import Foundation
extension Mastodon {

View File

@ -1,3 +1,9 @@
//
// https://mczachurski.dev
// Copyright © 2022 Marcin Czachurski and the repository contributors.
// Licensed under the MIT License.
//
import Foundation
extension Mastodon {

View File

@ -1,3 +1,9 @@
//
// https://mczachurski.dev
// Copyright © 2022 Marcin Czachurski and the repository contributors.
// Licensed under the MIT License.
//
import Foundation
public typealias ClientId = String

View File

@ -1,3 +1,9 @@
//
// https://mczachurski.dev
// Copyright © 2022 Marcin Czachurski and the repository contributors.
// Licensed under the MIT License.
//
import Foundation
extension Mastodon {

View File

@ -1,3 +1,9 @@
//
// https://mczachurski.dev
// Copyright © 2022 Marcin Czachurski and the repository contributors.
// Licensed under the MIT License.
//
import Foundation
extension Mastodon {

View File

@ -1,3 +1,9 @@
//
// https://mczachurski.dev
// Copyright © 2022 Marcin Czachurski and the repository contributors.
// Licensed under the MIT License.
//
import Foundation
extension Mastodon {

View File

@ -1,3 +1,9 @@
//
// https://mczachurski.dev
// Copyright © 2022 Marcin Czachurski and the repository contributors.
// Licensed under the MIT License.
//
import Foundation
public typealias SinceId = EntityId

View File

@ -13,6 +13,7 @@
F80048062961850500E6868A /* StatusData+CoreDataProperties.swift in Sources */ = {isa = PBXBuildFile; fileRef = F80048022961850500E6868A /* StatusData+CoreDataProperties.swift */; };
F80048082961E6DE00E6868A /* StatusDataHandler.swift in Sources */ = {isa = PBXBuildFile; fileRef = F80048072961E6DE00E6868A /* StatusDataHandler.swift */; };
F800480A2961EA1900E6868A /* AttachmentDataHandler.swift in Sources */ = {isa = PBXBuildFile; fileRef = F80048092961EA1900E6868A /* AttachmentDataHandler.swift */; };
F802884F297AEED5000BDD51 /* DatabaseError.swift in Sources */ = {isa = PBXBuildFile; fileRef = F802884E297AEED5000BDD51 /* DatabaseError.swift */; };
F80864112975537F009F035C /* NotificationService.swift in Sources */ = {isa = PBXBuildFile; fileRef = F80864102975537F009F035C /* NotificationService.swift */; };
F808641429756666009F035C /* NotificationRow.swift in Sources */ = {isa = PBXBuildFile; fileRef = F808641329756666009F035C /* NotificationRow.swift */; };
F8210DCF2966B600001D9973 /* ImageRowAsync.swift in Sources */ = {isa = PBXBuildFile; fileRef = F8210DCE2966B600001D9973 /* ImageRowAsync.swift */; };
@ -111,6 +112,7 @@
F80048022961850500E6868A /* StatusData+CoreDataProperties.swift */ = {isa = PBXFileReference; lastKnownFileType = sourcecode.swift; path = "StatusData+CoreDataProperties.swift"; sourceTree = "<group>"; };
F80048072961E6DE00E6868A /* StatusDataHandler.swift */ = {isa = PBXFileReference; lastKnownFileType = sourcecode.swift; path = StatusDataHandler.swift; sourceTree = "<group>"; };
F80048092961EA1900E6868A /* AttachmentDataHandler.swift */ = {isa = PBXFileReference; lastKnownFileType = sourcecode.swift; path = AttachmentDataHandler.swift; sourceTree = "<group>"; };
F802884E297AEED5000BDD51 /* DatabaseError.swift */ = {isa = PBXFileReference; lastKnownFileType = sourcecode.swift; path = DatabaseError.swift; sourceTree = "<group>"; };
F80864102975537F009F035C /* NotificationService.swift */ = {isa = PBXFileReference; lastKnownFileType = sourcecode.swift; path = NotificationService.swift; sourceTree = "<group>"; };
F808641329756666009F035C /* NotificationRow.swift */ = {isa = PBXFileReference; lastKnownFileType = sourcecode.swift; path = NotificationRow.swift; sourceTree = "<group>"; };
F8210DCE2966B600001D9973 /* ImageRowAsync.swift */ = {isa = PBXFileReference; lastKnownFileType = sourcecode.swift; path = ImageRowAsync.swift; sourceTree = "<group>"; };
@ -219,6 +221,14 @@
/* End PBXFrameworksBuildPhase section */
/* Begin PBXGroup section */
F802884D297AEEAA000BDD51 /* Errors */ = {
isa = PBXGroup;
children = (
F802884E297AEED5000BDD51 /* DatabaseError.swift */,
);
path = Errors;
sourceTree = "<group>";
};
F808641229756583009F035C /* NotificationsView */ = {
isa = PBXGroup;
children = (
@ -377,6 +387,7 @@
isa = PBXGroup;
children = (
F866F6A829604FFF002E8F88 /* Info.plist */,
F802884D297AEEAA000BDD51 /* Errors */,
F89992CA296D9211005994BF /* ViewModels */,
F86B721F296C498B00EE59EC /* Styles */,
F88ABD9029686F00004EF61E /* Cache */,
@ -630,6 +641,7 @@
F8C14392296AF0B3001FE31D /* String+Exif.swift in Sources */,
F85E1320297409CD006A051D /* ErrorsService.swift in Sources */,
F88C246C295C37B80006098B /* VernissageApp.swift in Sources */,
F802884F297AEED5000BDD51 /* DatabaseError.swift in Sources */,
F85D4971296402DC00751DF7 /* AuthorizationService.swift in Sources */,
F88FAD25295F3FF7009B20C9 /* FederatedFeedView.swift in Sources */,
F88FAD32295F5029009B20C9 /* RemoteFileService.swift in Sources */,

View File

@ -3,8 +3,6 @@
// Copyright © 2022 Marcin Czachurski and the repository contributors.
// Licensed under the MIT License.
//
//
import Foundation
import CoreData

View File

@ -3,7 +3,6 @@
// Copyright © 2022 Marcin Czachurski and the repository contributors.
// Licensed under the MIT License.
//
import Foundation
import CoreData

View File

@ -3,8 +3,6 @@
// Copyright © 2022 Marcin Czachurski and the repository contributors.
// Licensed under the MIT License.
//
//
import Foundation
import CoreData

View File

@ -3,7 +3,6 @@
// Copyright © 2022 Marcin Czachurski and the repository contributors.
// Licensed under the MIT License.
//
import Foundation

View File

@ -3,7 +3,6 @@
// Copyright © 2023 Marcin Czachurski and the repository contributors.
// Licensed under the MIT License.
//
import Foundation
import MastodonKit

View File

@ -3,7 +3,6 @@
// Copyright © 2023 Marcin Czachurski and the repository contributors.
// Licensed under the MIT License.
//
import Foundation

View File

@ -3,8 +3,6 @@
// Copyright © 2023 Marcin Czachurski and the repository contributors.
// Licensed under the MIT License.
//
//
import Foundation
import CoreData

View File

@ -3,13 +3,10 @@
// Copyright © 2023 Marcin Czachurski and the repository contributors.
// Licensed under the MIT License.
//
//
import Foundation
import CoreData
extension AttachmentData {
@nonobjc public class func fetchRequest() -> NSFetchRequest<AttachmentData> {

View File

@ -3,7 +3,6 @@
// Copyright © 2023 Marcin Czachurski and the repository contributors.
// Licensed under the MIT License.
//
import Foundation
import CoreData

View File

@ -3,8 +3,6 @@
// Copyright © 2023 Marcin Czachurski and the repository contributors.
// Licensed under the MIT License.
//
//
import Foundation
import CoreData

View File

@ -3,13 +3,10 @@
// Copyright © 2023 Marcin Czachurski and the repository contributors.
// Licensed under the MIT License.
//
//
import Foundation
import CoreData
extension StatusData {
@nonobjc public class func fetchRequest() -> NSFetchRequest<StatusData> {

View File

@ -0,0 +1,9 @@
//
// https://mczachurski.dev
// Copyright © 2023 Marcin Czachurski and the repository contributors.
// Licensed under the MIT License.
//
public enum DatabaseError: Error {
case cannotDownloadAccount
}

View File

@ -3,7 +3,6 @@
// Copyright © 2022 Marcin Czachurski and the repository contributors.
// Licensed under the MIT License.
//
import Foundation
import UIKit

View File

@ -3,7 +3,6 @@
// Copyright © 2023 Marcin Czachurski and the repository contributors.
// Licensed under the MIT License.
//
import Foundation

View File

@ -3,7 +3,6 @@
// Copyright © 2022 Marcin Czachurski and the repository contributors.
// Licensed under the MIT License.
//
import Foundation

View File

@ -4,7 +4,6 @@
// Licensed under the MIT License.
//
import Foundation
import SwiftUI

View File

@ -4,7 +4,6 @@
// Licensed under the MIT License.
//
import Foundation
import SwiftUI

View File

@ -8,10 +8,6 @@ import Foundation
import CoreData
import MastodonKit
public enum DatabaseError: Error {
case cannotDownloadAccount
}
public class TimelineService {
public static let shared = TimelineService()
private init() { }
@ -40,11 +36,11 @@ public class TimelineService {
// Get maximimum downloaded stauts id.
let newestStatus = StatusDataHandler.shared.getMaximumStatus(accountId: accountData.id, viewContext: backgroundContext)
let statuses = try await self.loadData(for: accountData, on: backgroundContext, minId: newestStatus?.id)
try await self.clearOldStatuses(for: accountData, on: backgroundContext)
let newStatuses = try await self.loadData(for: accountData, on: backgroundContext, minId: newestStatus?.id)
try await self.clearOldStatuses(newStatuses: newStatuses, for: accountData, on: backgroundContext)
try backgroundContext.save()
return statuses.count
return newStatuses.count
}
public func getComments(for statusId: String, and accountData: AccountData) async throws -> [CommentViewModel] {
@ -69,7 +65,7 @@ public class TimelineService {
}
}
private func clearOldStatuses(for accountData: AccountData, on backgroundContext: NSManagedObjectContext) async throws {
private func clearOldStatuses(newStatuses: [Status], for accountData: AccountData, on backgroundContext: NSManagedObjectContext) async throws {
guard let accessToken = accountData.accessToken else {
return
}
@ -87,9 +83,24 @@ public class TimelineService {
}
}
// Remove statuses that are not in 40 downloaded once.
if !dbStatusesToRemove.isEmpty {
StatusDataHandler.shared.remove(accountId: accountData.id, statuses: dbStatusesToRemove)
}
// Add statuses which are not existing in database, but has been downloaded via API.
var statusesToAdd: [Status] = []
for status in statuses {
if !dbStatuses.contains(where: { statusData in statusData.id == status.id }) &&
!newStatuses.contains(where: { newStatus in newStatus.id == status.id }) {
statusesToAdd.append(status)
}
}
// Save statuses in database (and download images).
if !statusesToAdd.isEmpty {
try await self.save(statuses: statusesToAdd, accountData: accountData, on: backgroundContext)
}
}
private func loadData(for accountData: AccountData, on backgroundContext: NSManagedObjectContext, minId: String? = nil, maxId: String? = nil) async throws -> [Status] {
@ -100,7 +111,28 @@ public class TimelineService {
// Retrieve statuses from API.
let client = MastodonClient(baseURL: accountData.serverUrl).getAuthenticated(token: accessToken)
let statuses = try await client.getHomeTimeline(maxId: maxId, minId: minId, limit: 20)
// Save statuses in database (and download images).
try await self.save(statuses: statuses, accountData: accountData, on: backgroundContext)
return statuses
}
public func updateStatus(_ statusData: StatusData, accountData: AccountData, basedOn status: Status) async throws -> StatusData? {
// Load data from API and operate on CoreData on background context.
let backgroundContext = CoreDataHandler.shared.newBackgroundContext()
// Download all images from server.
let attachmentsData = await self.fetchAllImages(statuses: [status])
// Update status data in database.
try await self.copy(from: status, to: statusData, attachmentsData: attachmentsData, on: backgroundContext)
try backgroundContext.save()
return statusData
}
private func save(statuses: [Status], accountData: AccountData, on backgroundContext: NSManagedObjectContext) async throws {
// Download all images from server.
let attachmentsData = await self.fetchAllImages(statuses: statuses)
@ -128,22 +160,6 @@ public class TimelineService {
try await self.copy(from: status, to: statusData, attachmentsData: attachmentsData, on: backgroundContext)
}
return statuses
}
public func updateStatus(_ statusData: StatusData, accountData: AccountData, basedOn status: Status) async throws -> StatusData? {
// Load data from API and operate on CoreData on background context.
let backgroundContext = CoreDataHandler.shared.newBackgroundContext()
// Download all images from server.
let attachmentsData = await self.fetchAllImages(statuses: [status])
// Update status data in database.
try await self.copy(from: status, to: statusData, attachmentsData: attachmentsData, on: backgroundContext)
try backgroundContext.save()
return statusData
}
private func copy(from status: Status, to statusData: StatusData, attachmentsData: Dictionary<String, Data>, on backgroundContext: NSManagedObjectContext) async throws {

View File

@ -109,10 +109,3 @@ struct ComposeView: View {
}
}
}
struct ComposeView_Previews: PreviewProvider {
static var previews: some View {
Text("")
// ComposeView(status: .constant(Status(id: "", content: "", application: Application(name: ""))))
}
}

View File

@ -11,9 +11,3 @@ struct FederatedFeedView: View {
Text("Federated feed")
}
}
struct FederatedFeedView_Previews: PreviewProvider {
static var previews: some View {
FederatedFeedView()
}
}

View File

@ -97,9 +97,3 @@ struct FollowersView: View {
}
}
}
struct FollowersView_Previews: PreviewProvider {
static var previews: some View {
FollowersView(accountId: "")
}
}

View File

@ -97,9 +97,3 @@ struct FollowingView: View {
}
}
}
struct FollowingView_Previews: PreviewProvider {
static var previews: some View {
FollowersView(accountId: "")
}
}

View File

@ -100,9 +100,3 @@ struct HomeFeedView: View {
}
}
}
struct HomeFeedView_Previews: PreviewProvider {
static var previews: some View {
HomeFeedView(accountId: "")
}
}

View File

@ -3,7 +3,6 @@
// Copyright © 2023 Marcin Czachurski and the repository contributors.
// Licensed under the MIT License.
//
import SwiftUI
@ -17,9 +16,3 @@ struct LoadingView: View {
}
}
}
struct LoadingView_Previews: PreviewProvider {
static var previews: some View {
LoadingView()
}
}

View File

@ -11,9 +11,3 @@ struct LocalFeedView: View {
Text("Local feed")
}
}
struct LocalFeedView_Previews: PreviewProvider {
static var previews: some View {
LocalFeedView()
}
}

View File

@ -219,9 +219,3 @@ struct MainView: View {
}
}
struct MainView_Previews: PreviewProvider {
static var previews: some View {
MainView().environment(\.managedObjectContext, CoreDataHandler.preview.container.viewContext)
}
}

View File

@ -192,9 +192,3 @@ struct NotificationsView: View {
}
}
}
struct NotificationsView_Previews: PreviewProvider {
static var previews: some View {
FollowersView(accountId: "")
}
}

View File

@ -82,9 +82,3 @@ struct SettingsView: View {
return UITraitCollection.current.userInterfaceStyle == .light ? .light : .dark
}
}
struct SettingsView_Previews: PreviewProvider {
static var previews: some View {
SettingsView()
}
}

View File

@ -47,9 +47,3 @@ struct SignInView: View {
.navigationBarTitleDisplayMode(.inline)
}
}
struct SignInView_Previews: PreviewProvider {
static var previews: some View {
SignInView()
}
}

View File

@ -175,8 +175,3 @@ struct StatusView: View {
}
}
struct StatusView_Previews: PreviewProvider {
static var previews: some View {
StatusView(statusId: "123")
}
}

View File

@ -53,9 +53,3 @@ struct UserProfileView: View {
(self.relationship, self.account) = try await (relationshipTask, accountTask)
}
}
struct UserProfileView_Previews: PreviewProvider {
static var previews: some View {
UserProfileView(accountId: "", accountDisplayName: "", accountUserName: "")
}
}

View File

@ -3,7 +3,6 @@
// Copyright © 2023 Marcin Czachurski and the repository contributors.
// Licensed under the MIT License.
//
import SwiftUI

View File

@ -3,7 +3,6 @@
// Copyright © 2023 Marcin Czachurski and the repository contributors.
// Licensed under the MIT License.
//
import SwiftUI
@ -71,9 +70,3 @@ struct AccentsSection: View {
}
}
}
struct AccentsSection_Previews: PreviewProvider {
static var previews: some View {
AccentsSection()
}
}

View File

@ -31,9 +31,3 @@ struct AccountsSection: View {
}
}
}
struct AccountsSection_Previews: PreviewProvider {
static var previews: some View {
AccountsSection()
}
}

View File

@ -55,9 +55,3 @@ struct ThemeSection: View {
}
}
}
struct ThemeSection_Previews: PreviewProvider {
static var previews: some View {
ThemeSection()
}
}

View File

@ -3,7 +3,6 @@
// Copyright © 2023 Marcin Czachurski and the repository contributors.
// Licensed under the MIT License.
//
import SwiftUI
import MastodonKit

View File

@ -3,7 +3,6 @@
// Copyright © 2023 Marcin Czachurski and the repository contributors.
// Licensed under the MIT License.
//
import SwiftUI

View File

@ -120,9 +120,3 @@ struct UserProfileHeader: View {
}
}
struct UserProfileHeader_Previews: PreviewProvider {
static var previews: some View {
Text("")
// UserProfileHeader(account: Account(), relationship: Relationship())
}
}

View File

@ -106,8 +106,3 @@ struct UserProfileStatuses: View {
}
}
struct UserProfileStatuses_Previews: PreviewProvider {
static var previews: some View {
UserProfileStatuses(accountId: "")
}
}