mirror of
https://github.com/Dimillian/IceCubesApp.git
synced 2024-11-26 02:01:02 +00:00
Swiftformat
This commit is contained in:
parent
425a4eef4f
commit
ca4e80101f
39 changed files with 168 additions and 160 deletions
|
@ -62,7 +62,8 @@ struct IceCubesApp: App {
|
||||||
pushNotificationsService.handledNotification = nil
|
pushNotificationsService.handledNotification = nil
|
||||||
if appAccountsManager.currentAccount.oauthToken?.accessToken != notification?.account.token.accessToken,
|
if appAccountsManager.currentAccount.oauthToken?.accessToken != notification?.account.token.accessToken,
|
||||||
let account = appAccountsManager.availableAccounts.first(where:
|
let account = appAccountsManager.availableAccounts.first(where:
|
||||||
{ $0.oauthToken?.accessToken == notification?.account.token.accessToken }) {
|
{ $0.oauthToken?.accessToken == notification?.account.token.accessToken })
|
||||||
|
{
|
||||||
appAccountsManager.currentAccount = account
|
appAccountsManager.currentAccount = account
|
||||||
DispatchQueue.main.asyncAfter(deadline: .now() + 0.2) {
|
DispatchQueue.main.asyncAfter(deadline: .now() + 0.2) {
|
||||||
selectedTab = .notifications
|
selectedTab = .notifications
|
||||||
|
|
|
@ -1,9 +1,9 @@
|
||||||
import SwiftUI
|
|
||||||
import Models
|
|
||||||
import Env
|
|
||||||
import DesignSystem
|
import DesignSystem
|
||||||
import Status
|
import Env
|
||||||
|
import Models
|
||||||
import Network
|
import Network
|
||||||
|
import Status
|
||||||
|
import SwiftUI
|
||||||
|
|
||||||
public struct ReportView: View {
|
public struct ReportView: View {
|
||||||
@Environment(\.dismiss) private var dismiss
|
@Environment(\.dismiss) private var dismiss
|
||||||
|
@ -16,7 +16,7 @@ public struct ReportView: View {
|
||||||
@State private var isSendingReport: Bool = false
|
@State private var isSendingReport: Bool = false
|
||||||
|
|
||||||
struct ReportSent: Decodable {
|
struct ReportSent: Decodable {
|
||||||
let id : String
|
let id: String
|
||||||
}
|
}
|
||||||
|
|
||||||
public var body: some View {
|
public var body: some View {
|
||||||
|
|
|
@ -69,7 +69,6 @@ struct ContentSettingsView: View {
|
||||||
}
|
}
|
||||||
|
|
||||||
.listRowBackground(theme.primaryBackgroundColor)
|
.listRowBackground(theme.primaryBackgroundColor)
|
||||||
|
|
||||||
}
|
}
|
||||||
.navigationTitle("settings.content.navigation-title")
|
.navigationTitle("settings.content.navigation-title")
|
||||||
.scrollContentBackground(.hidden)
|
.scrollContentBackground(.hidden)
|
||||||
|
|
|
@ -1,9 +1,9 @@
|
||||||
import DesignSystem
|
import DesignSystem
|
||||||
import Env
|
import Env
|
||||||
import Models
|
import Models
|
||||||
|
import Network
|
||||||
import Status
|
import Status
|
||||||
import SwiftUI
|
import SwiftUI
|
||||||
import Network
|
|
||||||
|
|
||||||
struct DisplaySettingsView: View {
|
struct DisplaySettingsView: View {
|
||||||
typealias FontState = Theme.FontState
|
typealias FontState = Theme.FontState
|
||||||
|
|
|
@ -44,7 +44,7 @@ struct IconSelectorView: View {
|
||||||
let icons: [Icon]
|
let icons: [Icon]
|
||||||
|
|
||||||
static let items = [
|
static let items = [
|
||||||
IconSelector(title:"settings.app.icon.official".localized, icons: [.primary, .alt1, .alt2, .alt3, .alt4, .alt5, .alt6, .alt7, .alt8,
|
IconSelector(title: "settings.app.icon.official".localized, icons: [.primary, .alt1, .alt2, .alt3, .alt4, .alt5, .alt6, .alt7, .alt8,
|
||||||
.alt9, .alt10, .alt11, .alt12, .alt13, .alt14,
|
.alt9, .alt10, .alt11, .alt12, .alt13, .alt14,
|
||||||
.alt15, .alt16, .alt17, .alt18, .alt19, .alt25]),
|
.alt15, .alt16, .alt17, .alt18, .alt19, .alt25]),
|
||||||
IconSelector(title: "\("settings.app.icon.designed-by".localized) Albert Kinng", icons: [.alt20, .alt21, .alt22, .alt23, .alt24]),
|
IconSelector(title: "\("settings.app.icon.designed-by".localized) Albert Kinng", icons: [.alt20, .alt21, .alt22, .alt23, .alt24]),
|
||||||
|
@ -109,6 +109,6 @@ struct IconSelectorView: View {
|
||||||
|
|
||||||
extension String {
|
extension String {
|
||||||
var localized: String {
|
var localized: String {
|
||||||
return NSLocalizedString(self, comment:"")
|
return NSLocalizedString(self, comment: "")
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
|
@ -1,13 +1,13 @@
|
||||||
import AppAccount
|
import AppAccount
|
||||||
import CryptoKit
|
import CryptoKit
|
||||||
import Env
|
import Env
|
||||||
|
import Intents
|
||||||
import KeychainSwift
|
import KeychainSwift
|
||||||
import Models
|
import Models
|
||||||
import UIKit
|
|
||||||
import UserNotifications
|
|
||||||
import Intents
|
|
||||||
import Network
|
import Network
|
||||||
import Notifications
|
import Notifications
|
||||||
|
import UIKit
|
||||||
|
import UserNotifications
|
||||||
|
|
||||||
@MainActor
|
@MainActor
|
||||||
class NotificationService: UNNotificationServiceExtension {
|
class NotificationService: UNNotificationServiceExtension {
|
||||||
|
@ -63,7 +63,6 @@ class NotificationService: UNNotificationServiceExtension {
|
||||||
bestAttemptContent.userInfo["plaintext"] = plaintextData
|
bestAttemptContent.userInfo["plaintext"] = plaintextData
|
||||||
bestAttemptContent.sound = UNNotificationSound(named: UNNotificationSoundName(rawValue: "glass.caf"))
|
bestAttemptContent.sound = UNNotificationSound(named: UNNotificationSoundName(rawValue: "glass.caf"))
|
||||||
|
|
||||||
|
|
||||||
let preferences = UserPreferences.shared
|
let preferences = UserPreferences.shared
|
||||||
preferences.pushNotificationsCount += 1
|
preferences.pushNotificationsCount += 1
|
||||||
|
|
||||||
|
@ -83,7 +82,8 @@ class NotificationService: UNNotificationServiceExtension {
|
||||||
try? image.pngData()?.write(to: fileURL)
|
try? image.pngData()?.write(to: fileURL)
|
||||||
|
|
||||||
if let remoteNotification = await toRemoteNotification(localNotification: notification),
|
if let remoteNotification = await toRemoteNotification(localNotification: notification),
|
||||||
let type = remoteNotification.supportedType {
|
let type = remoteNotification.supportedType
|
||||||
|
{
|
||||||
let intent = buildMessageIntent(remoteNotification: remoteNotification,
|
let intent = buildMessageIntent(remoteNotification: remoteNotification,
|
||||||
currentUser: bestAttemptContent.userInfo["i"] as? String ?? "",
|
currentUser: bestAttemptContent.userInfo["i"] as? String ?? "",
|
||||||
avatarURL: fileURL)
|
avatarURL: fileURL)
|
||||||
|
@ -127,7 +127,8 @@ class NotificationService: UNNotificationServiceExtension {
|
||||||
|
|
||||||
private func buildMessageIntent(remoteNotification: Models.Notification,
|
private func buildMessageIntent(remoteNotification: Models.Notification,
|
||||||
currentUser: String,
|
currentUser: String,
|
||||||
avatarURL: URL) -> INSendMessageIntent {
|
avatarURL: URL) -> INSendMessageIntent
|
||||||
|
{
|
||||||
let handle = INPersonHandle(value: remoteNotification.account.id, type: .unknown)
|
let handle = INPersonHandle(value: remoteNotification.account.id, type: .unknown)
|
||||||
let avatar = INImage(url: avatarURL)
|
let avatar = INImage(url: avatarURL)
|
||||||
let sender = INPerson(personHandle: handle,
|
let sender = INPerson(personHandle: handle,
|
||||||
|
|
|
@ -19,6 +19,7 @@ public class AppAccountViewModel: ObservableObject {
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
@Published var roundedAvatar: UIImage?
|
@Published var roundedAvatar: UIImage?
|
||||||
|
|
||||||
var acct: String {
|
var acct: String {
|
||||||
|
@ -56,12 +57,13 @@ public class AppAccountViewModel: ObservableObject {
|
||||||
appAccount.accountName = "\(account.acct)@\(appAccount.server)"
|
appAccount.accountName = "\(account.acct)@\(appAccount.server)"
|
||||||
try appAccount.save()
|
try appAccount.save()
|
||||||
}
|
}
|
||||||
} catch { }
|
} catch {}
|
||||||
}
|
}
|
||||||
|
|
||||||
private func refreshAvatar(account: Account) async {
|
private func refreshAvatar(account: Account) async {
|
||||||
if let (data, _) = try? await URLSession.shared.data(from: account.avatar),
|
if let (data, _) = try? await URLSession.shared.data(from: account.avatar),
|
||||||
let image = UIImage(data: data)?.roundedImage {
|
let image = UIImage(data: data)?.roundedImage
|
||||||
|
{
|
||||||
roundedAvatar = image
|
roundedAvatar = image
|
||||||
Self.avatarsCache[account.id] = image
|
Self.avatarsCache[account.id] = image
|
||||||
}
|
}
|
||||||
|
|
|
@ -4,7 +4,7 @@ import Network
|
||||||
|
|
||||||
@MainActor
|
@MainActor
|
||||||
public class CurrentAccount: ObservableObject {
|
public class CurrentAccount: ObservableObject {
|
||||||
static private var accountsCache: [String: Account] = [:]
|
private static var accountsCache: [String: Account] = [:]
|
||||||
|
|
||||||
@Published public private(set) var account: Account?
|
@Published public private(set) var account: Account?
|
||||||
@Published public private(set) var lists: [List] = []
|
@Published public private(set) var lists: [List] = []
|
||||||
|
|
|
@ -135,18 +135,19 @@ public class PushNotificationsService: NSObject, ObservableObject {
|
||||||
}
|
}
|
||||||
|
|
||||||
extension PushNotificationsService: UNUserNotificationCenterDelegate {
|
extension PushNotificationsService: UNUserNotificationCenterDelegate {
|
||||||
public func userNotificationCenter(_ center: UNUserNotificationCenter, didReceive response: UNNotificationResponse) async {
|
public func userNotificationCenter(_: UNUserNotificationCenter, didReceive response: UNNotificationResponse) async {
|
||||||
guard let plaintext = response.notification.request.content.userInfo["plaintext"] as? Data,
|
guard let plaintext = response.notification.request.content.userInfo["plaintext"] as? Data,
|
||||||
let mastodonPushNotification = try? JSONDecoder().decode(MastodonPushNotification.self, from: plaintext),
|
let mastodonPushNotification = try? JSONDecoder().decode(MastodonPushNotification.self, from: plaintext),
|
||||||
let account = subscriptions.first(where: { $0.account.token.accessToken == mastodonPushNotification.accessToken }) else {
|
let account = subscriptions.first(where: { $0.account.token.accessToken == mastodonPushNotification.accessToken })
|
||||||
|
else {
|
||||||
return
|
return
|
||||||
}
|
}
|
||||||
do {
|
do {
|
||||||
let client = Client(server: account.account.server, oauthToken: account.account.token)
|
let client = Client(server: account.account.server, oauthToken: account.account.token)
|
||||||
let notification: Models.Notification =
|
let notification: Models.Notification =
|
||||||
try await client.get(endpoint: Notifications.notification(id:String(mastodonPushNotification.notificationID)))
|
try await client.get(endpoint: Notifications.notification(id: String(mastodonPushNotification.notificationID)))
|
||||||
self.handledNotification = .init(account: account.account, notification: notification)
|
handledNotification = .init(account: account.account, notification: notification)
|
||||||
} catch { }
|
} catch {}
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|
|
@ -42,7 +42,7 @@ public enum StatusAction: String, CaseIterable, Identifiable {
|
||||||
}
|
}
|
||||||
|
|
||||||
public func color(themeTintColor: Color, useThemeColor: Bool, outside: Bool) -> Color {
|
public func color(themeTintColor: Color, useThemeColor: Bool, outside: Bool) -> Color {
|
||||||
if (useThemeColor) {
|
if useThemeColor {
|
||||||
return outside ? themeTintColor : .gray
|
return outside ? themeTintColor : .gray
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|
|
@ -55,7 +55,6 @@ public final class Account: Codable, Identifiable, Equatable, Hashable {
|
||||||
return header.lastPathComponent != "missing.png"
|
return header.lastPathComponent != "missing.png"
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|
||||||
public init(id: String, username: String, displayName: String, avatar: URL, header: URL, acct: String, note: HTMLString, createdAt: ServerDate, followersCount: Int, followingCount: Int, statusesCount: Int, lastStatusAt: String? = nil, fields: [Account.Field], locked: Bool, emojis: [Emoji], url: URL? = nil, source: Account.Source? = nil, bot: Bool, discoverable: Bool? = nil) {
|
public init(id: String, username: String, displayName: String, avatar: URL, header: URL, acct: String, note: HTMLString, createdAt: ServerDate, followersCount: Int, followingCount: Int, statusesCount: Int, lastStatusAt: String? = nil, fields: [Account.Field], locked: Bool, emojis: [Emoji], url: URL? = nil, source: Account.Source? = nil, bot: Bool, discoverable: Bool? = nil) {
|
||||||
self.id = id
|
self.id = id
|
||||||
self.username = username
|
self.username = username
|
||||||
|
|
|
@ -1,7 +1,7 @@
|
||||||
import Foundation
|
import Foundation
|
||||||
|
|
||||||
extension String {
|
public extension String {
|
||||||
public func escape() -> String {
|
func escape() -> String {
|
||||||
return replacingOccurrences(of: "&", with: "&")
|
return replacingOccurrences(of: "&", with: "&")
|
||||||
.replacingOccurrences(of: "<", with: "<")
|
.replacingOccurrences(of: "<", with: "<")
|
||||||
.replacingOccurrences(of: ">", with: ">")
|
.replacingOccurrences(of: ">", with: ">")
|
||||||
|
@ -10,7 +10,7 @@ extension String {
|
||||||
.replacingOccurrences(of: "'", with: "’")
|
.replacingOccurrences(of: "'", with: "’")
|
||||||
}
|
}
|
||||||
|
|
||||||
public func URLSafeBase64ToBase64() -> String {
|
func URLSafeBase64ToBase64() -> String {
|
||||||
var base64 = replacingOccurrences(of: "-", with: "+").replacingOccurrences(of: "_", with: "/")
|
var base64 = replacingOccurrences(of: "-", with: "+").replacingOccurrences(of: "_", with: "/")
|
||||||
let countMod4 = count % 4
|
let countMod4 = count % 4
|
||||||
|
|
||||||
|
|
|
@ -5,12 +5,12 @@
|
||||||
// Created by Jérôme Danthinne on 31/01/2023.
|
// Created by Jérôme Danthinne on 31/01/2023.
|
||||||
//
|
//
|
||||||
|
|
||||||
import Models
|
|
||||||
import Foundation
|
import Foundation
|
||||||
|
import Models
|
||||||
|
|
||||||
extension Array where Element == Models.Notification {
|
extension Array where Element == Models.Notification {
|
||||||
func consolidated(selectedType: Models.Notification.NotificationType?) async -> [ConsolidatedNotification] {
|
func consolidated(selectedType: Models.Notification.NotificationType?) async -> [ConsolidatedNotification] {
|
||||||
await withCheckedContinuation({ result in
|
await withCheckedContinuation { result in
|
||||||
DispatchQueue.global().async {
|
DispatchQueue.global().async {
|
||||||
let notifications: [ConsolidatedNotification] =
|
let notifications: [ConsolidatedNotification] =
|
||||||
Dictionary(grouping: self) { $0.consolidationId(selectedType: selectedType) }
|
Dictionary(grouping: self) { $0.consolidationId(selectedType: selectedType) }
|
||||||
|
@ -31,6 +31,6 @@ extension Array where Element == Models.Notification {
|
||||||
}
|
}
|
||||||
result.resume(returning: notifications)
|
result.resume(returning: notifications)
|
||||||
}
|
}
|
||||||
})
|
}
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
|
@ -2,9 +2,9 @@ import DesignSystem
|
||||||
import EmojiText
|
import EmojiText
|
||||||
import Env
|
import Env
|
||||||
import Models
|
import Models
|
||||||
|
import Network
|
||||||
import Status
|
import Status
|
||||||
import SwiftUI
|
import SwiftUI
|
||||||
import Network
|
|
||||||
|
|
||||||
struct NotificationRowView: View {
|
struct NotificationRowView: View {
|
||||||
@EnvironmentObject private var theme: Theme
|
@EnvironmentObject private var theme: Theme
|
||||||
|
@ -28,7 +28,8 @@ struct NotificationRowView: View {
|
||||||
makeMainLabel(type: notification.type)
|
makeMainLabel(type: notification.type)
|
||||||
makeContent(type: notification.type)
|
makeContent(type: notification.type)
|
||||||
if notification.type == .follow_request,
|
if notification.type == .follow_request,
|
||||||
followRequests.map(\.id).contains(notification.accounts[0].id) {
|
followRequests.map(\.id).contains(notification.accounts[0].id)
|
||||||
|
{
|
||||||
FollowRequestButtons(account: notification.accounts[0])
|
FollowRequestButtons(account: notification.accounts[0])
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
|
@ -94,12 +94,13 @@ public struct StatusDetailView: View {
|
||||||
.navigationBarTitleDisplayMode(.inline)
|
.navigationBarTitleDisplayMode(.inline)
|
||||||
}
|
}
|
||||||
|
|
||||||
private func makeStatusesListView(statuses: [Status], date: Date) -> some View {
|
private func makeStatusesListView(statuses: [Status], date _: Date) -> some View {
|
||||||
ForEach(statuses) { status in
|
ForEach(statuses) { status in
|
||||||
var isReplyToPrevious: Bool = false
|
var isReplyToPrevious: Bool = false
|
||||||
if let index = statuses.firstIndex(where: { $0.id == status.id }),
|
if let index = statuses.firstIndex(where: { $0.id == status.id }),
|
||||||
index > 0,
|
index > 0,
|
||||||
statuses[index - 1].id == status.inReplyToId {
|
statuses[index - 1].id == status.inReplyToId
|
||||||
|
{
|
||||||
isReplyToPrevious = true
|
isReplyToPrevious = true
|
||||||
}
|
}
|
||||||
let viewModel: StatusRowViewModel = .init(status: status,
|
let viewModel: StatusRowViewModel = .init(status: status,
|
||||||
|
|
|
@ -7,9 +7,9 @@ import Models
|
||||||
import Network
|
import Network
|
||||||
import NukeUI
|
import NukeUI
|
||||||
import PhotosUI
|
import PhotosUI
|
||||||
|
import StoreKit
|
||||||
import SwiftUI
|
import SwiftUI
|
||||||
import UIKit
|
import UIKit
|
||||||
import StoreKit
|
|
||||||
|
|
||||||
public struct StatusEditorView: View {
|
public struct StatusEditorView: View {
|
||||||
@EnvironmentObject private var appAccounts: AppAccountsManager
|
@EnvironmentObject private var appAccounts: AppAccountsManager
|
||||||
|
|
|
@ -1,9 +1,9 @@
|
||||||
import DesignSystem
|
import DesignSystem
|
||||||
import EmojiText
|
import EmojiText
|
||||||
import Models
|
|
||||||
import SwiftUI
|
|
||||||
import Env
|
import Env
|
||||||
|
import Models
|
||||||
import Network
|
import Network
|
||||||
|
import SwiftUI
|
||||||
|
|
||||||
@MainActor
|
@MainActor
|
||||||
public struct StatusEmbeddedView: View {
|
public struct StatusEmbeddedView: View {
|
||||||
|
|
|
@ -1,9 +1,9 @@
|
||||||
import DesignSystem
|
import DesignSystem
|
||||||
import Env
|
import Env
|
||||||
import Models
|
import Models
|
||||||
|
import Network
|
||||||
import Shimmer
|
import Shimmer
|
||||||
import SwiftUI
|
import SwiftUI
|
||||||
import Network
|
|
||||||
|
|
||||||
public struct StatusesListView<Fetcher>: View where Fetcher: StatusesFetcher {
|
public struct StatusesListView<Fetcher>: View where Fetcher: StatusesFetcher {
|
||||||
@EnvironmentObject private var theme: Theme
|
@EnvironmentObject private var theme: Theme
|
||||||
|
|
|
@ -41,7 +41,8 @@ public struct StatusRowView: View {
|
||||||
}
|
}
|
||||||
HStack(alignment: .top, spacing: .statusColumnsSpacing) {
|
HStack(alignment: .top, spacing: .statusColumnsSpacing) {
|
||||||
if !isCompact,
|
if !isCompact,
|
||||||
theme.avatarPosition == .leading {
|
theme.avatarPosition == .leading
|
||||||
|
{
|
||||||
Button {
|
Button {
|
||||||
viewModel.routerPath.navigate(to: .accountDetailWithAccount(account: status.account))
|
viewModel.routerPath.navigate(to: .accountDetailWithAccount(account: status.account))
|
||||||
} label: {
|
} label: {
|
||||||
|
|
|
@ -344,8 +344,8 @@ public class StatusRowViewModel: ObservableObject {
|
||||||
following: nil),
|
following: nil),
|
||||||
forceVersion: .v2)
|
forceVersion: .v2)
|
||||||
if let status = results?.statuses.first {
|
if let status = results?.statuses.first {
|
||||||
self.localStatusId = status.id
|
localStatusId = status.id
|
||||||
self.localStatus = status
|
localStatus = status
|
||||||
isLoadingRemoteContent = false
|
isLoadingRemoteContent = false
|
||||||
return true
|
return true
|
||||||
} else {
|
} else {
|
||||||
|
|
|
@ -63,7 +63,8 @@ struct StatusRowActionsView: View {
|
||||||
ForEach(Actions.allCases, id: \.self) { action in
|
ForEach(Actions.allCases, id: \.self) { action in
|
||||||
if action == .share {
|
if action == .share {
|
||||||
if let urlString = viewModel.status.reblog?.url ?? viewModel.status.url,
|
if let urlString = viewModel.status.reblog?.url ?? viewModel.status.url,
|
||||||
let url = URL(string: urlString) {
|
let url = URL(string: urlString)
|
||||||
|
{
|
||||||
ShareLink(item: url,
|
ShareLink(item: url,
|
||||||
subject: Text(viewModel.status.reblog?.account.safeDisplayName ?? viewModel.status.account.safeDisplayName),
|
subject: Text(viewModel.status.reblog?.account.safeDisplayName ?? viewModel.status.account.safeDisplayName),
|
||||||
message: Text(viewModel.status.reblog?.content.asRawText ?? viewModel.status.content.asRawText)) {
|
message: Text(viewModel.status.reblog?.content.asRawText ?? viewModel.status.content.asRawText)) {
|
||||||
|
|
|
@ -1,7 +1,7 @@
|
||||||
import SwiftUI
|
|
||||||
import DesignSystem
|
import DesignSystem
|
||||||
import Models
|
|
||||||
import Env
|
import Env
|
||||||
|
import Models
|
||||||
|
import SwiftUI
|
||||||
|
|
||||||
struct StatusRowContentView: View {
|
struct StatusRowContentView: View {
|
||||||
@Environment(\.redactionReasons) private var reasons
|
@Environment(\.redactionReasons) private var reasons
|
||||||
|
@ -26,7 +26,8 @@ struct StatusRowContentView: View {
|
||||||
|
|
||||||
if !reasons.contains(.placeholder),
|
if !reasons.contains(.placeholder),
|
||||||
!isCompact,
|
!isCompact,
|
||||||
(viewModel.isEmbedLoading || viewModel.embeddedStatus != nil) {
|
viewModel.isEmbedLoading || viewModel.embeddedStatus != nil
|
||||||
|
{
|
||||||
StatusEmbeddedView(status: viewModel.embeddedStatus ?? Status.placeholder(),
|
StatusEmbeddedView(status: viewModel.embeddedStatus ?? Status.placeholder(),
|
||||||
client: viewModel.client,
|
client: viewModel.client,
|
||||||
routerPath: viewModel.routerPath)
|
routerPath: viewModel.routerPath)
|
||||||
|
|
|
@ -57,7 +57,8 @@ struct StatusRowContextMenu: View {
|
||||||
Divider()
|
Divider()
|
||||||
|
|
||||||
if let urlString = viewModel.status.reblog?.url ?? viewModel.status.url,
|
if let urlString = viewModel.status.reblog?.url ?? viewModel.status.url,
|
||||||
let url = URL(string: urlString) {
|
let url = URL(string: urlString)
|
||||||
|
{
|
||||||
ShareLink(item: url,
|
ShareLink(item: url,
|
||||||
subject: Text(viewModel.status.reblog?.account.safeDisplayName ?? viewModel.status.account.safeDisplayName),
|
subject: Text(viewModel.status.reblog?.account.safeDisplayName ?? viewModel.status.account.safeDisplayName),
|
||||||
message: Text(viewModel.status.reblog?.content.asRawText ?? viewModel.status.content.asRawText)) {
|
message: Text(viewModel.status.reblog?.content.asRawText ?? viewModel.status.content.asRawText)) {
|
||||||
|
|
|
@ -1,6 +1,6 @@
|
||||||
import SwiftUI
|
|
||||||
import DesignSystem
|
import DesignSystem
|
||||||
import Models
|
import Models
|
||||||
|
import SwiftUI
|
||||||
|
|
||||||
struct StatusRowHeaderView: View {
|
struct StatusRowHeaderView: View {
|
||||||
@EnvironmentObject private var theme: Theme
|
@EnvironmentObject private var theme: Theme
|
||||||
|
|
|
@ -1,5 +1,5 @@
|
||||||
import SwiftUI
|
|
||||||
import DesignSystem
|
import DesignSystem
|
||||||
|
import SwiftUI
|
||||||
|
|
||||||
struct StatusRowReblogView: View {
|
struct StatusRowReblogView: View {
|
||||||
let viewModel: StatusRowViewModel
|
let viewModel: StatusRowViewModel
|
||||||
|
@ -27,4 +27,3 @@ struct StatusRowReblogView: View {
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|
|
@ -1,5 +1,5 @@
|
||||||
import SwiftUI
|
|
||||||
import DesignSystem
|
import DesignSystem
|
||||||
|
import SwiftUI
|
||||||
|
|
||||||
struct StatusRowReplyView: View {
|
struct StatusRowReplyView: View {
|
||||||
let viewModel: StatusRowViewModel
|
let viewModel: StatusRowViewModel
|
||||||
|
|
|
@ -1,6 +1,6 @@
|
||||||
import SwiftUI
|
|
||||||
import DesignSystem
|
import DesignSystem
|
||||||
import Models
|
import Models
|
||||||
|
import SwiftUI
|
||||||
|
|
||||||
struct StatusRowSpoilerView: View {
|
struct StatusRowSpoilerView: View {
|
||||||
let status: AnyStatus
|
let status: AnyStatus
|
||||||
|
|
|
@ -1,7 +1,7 @@
|
||||||
import SwiftUI
|
import DesignSystem
|
||||||
import Env
|
import Env
|
||||||
import Models
|
import Models
|
||||||
import DesignSystem
|
import SwiftUI
|
||||||
|
|
||||||
struct StatusRowSwipeView: View {
|
struct StatusRowSwipeView: View {
|
||||||
@EnvironmentObject private var theme: Theme
|
@EnvironmentObject private var theme: Theme
|
||||||
|
@ -108,7 +108,7 @@ struct StatusRowSwipeView: View {
|
||||||
|
|
||||||
@ViewBuilder
|
@ViewBuilder
|
||||||
private func makeSwipeLabel(action: StatusAction, style: UserPreferences.SwipeActionsIconStyle) -> some View {
|
private func makeSwipeLabel(action: StatusAction, style: UserPreferences.SwipeActionsIconStyle) -> some View {
|
||||||
switch (style) {
|
switch style {
|
||||||
case .iconOnly:
|
case .iconOnly:
|
||||||
Label(action.displayName(isReblogged: viewModel.isReblogged, isFavorited: viewModel.isFavorited, isBookmarked: viewModel.isBookmarked), systemImage: action.iconName(isReblogged: viewModel.isReblogged, isFavorited: viewModel.isFavorited, isBookmarked: viewModel.isBookmarked))
|
Label(action.displayName(isReblogged: viewModel.isReblogged, isFavorited: viewModel.isFavorited, isBookmarked: viewModel.isBookmarked), systemImage: action.iconName(isReblogged: viewModel.isReblogged, isFavorited: viewModel.isFavorited, isBookmarked: viewModel.isBookmarked))
|
||||||
.labelStyle(.iconOnly)
|
.labelStyle(.iconOnly)
|
||||||
|
|
|
@ -1,6 +1,6 @@
|
||||||
import SwiftUI
|
|
||||||
import DesignSystem
|
import DesignSystem
|
||||||
import Models
|
import Models
|
||||||
|
import SwiftUI
|
||||||
|
|
||||||
struct StatusRowTextView: View {
|
struct StatusRowTextView: View {
|
||||||
let status: AnyStatus
|
let status: AnyStatus
|
||||||
|
|
|
@ -1,7 +1,7 @@
|
||||||
import SwiftUI
|
|
||||||
import Models
|
|
||||||
import DesignSystem
|
import DesignSystem
|
||||||
import Env
|
import Env
|
||||||
|
import Models
|
||||||
|
import SwiftUI
|
||||||
|
|
||||||
struct StatusRowTranslateView: View {
|
struct StatusRowTranslateView: View {
|
||||||
@EnvironmentObject private var preferences: UserPreferences
|
@EnvironmentObject private var preferences: UserPreferences
|
||||||
|
|
Loading…
Reference in a new issue