diff --git a/IceCubesApp.xcodeproj/project.pbxproj b/IceCubesApp.xcodeproj/project.pbxproj index 5df0ea73..431382a9 100644 --- a/IceCubesApp.xcodeproj/project.pbxproj +++ b/IceCubesApp.xcodeproj/project.pbxproj @@ -613,7 +613,7 @@ "@executable_path/Frameworks", "@executable_path/../../Frameworks", ); - MARKETING_VERSION = 1.0; + MARKETING_VERSION = 1.0.1; PRODUCT_BUNDLE_IDENTIFIER = com.thomasricouard.IceCubesApp.IceCubesNotifications; PRODUCT_NAME = "$(TARGET_NAME)"; SDKROOT = iphoneos; @@ -643,7 +643,7 @@ "@executable_path/Frameworks", "@executable_path/../../Frameworks", ); - MARKETING_VERSION = 1.0; + MARKETING_VERSION = 1.0.1; PRODUCT_BUNDLE_IDENTIFIER = com.thomasricouard.IceCubesApp.IceCubesNotifications; PRODUCT_NAME = "$(TARGET_NAME)"; SDKROOT = iphoneos; @@ -674,7 +674,7 @@ "@executable_path/Frameworks", "@executable_path/../../Frameworks", ); - MARKETING_VERSION = 1.0; + MARKETING_VERSION = 1.0.1; PRODUCT_BUNDLE_IDENTIFIER = com.thomasricouard.IceCubesApp.IceCubesShareExtension; PRODUCT_NAME = "$(TARGET_NAME)"; SDKROOT = iphoneos; @@ -704,7 +704,7 @@ "@executable_path/Frameworks", "@executable_path/../../Frameworks", ); - MARKETING_VERSION = 1.0; + MARKETING_VERSION = 1.0.1; PRODUCT_BUNDLE_IDENTIFIER = com.thomasricouard.IceCubesApp.IceCubesShareExtension; PRODUCT_NAME = "$(TARGET_NAME)"; SDKROOT = iphoneos; @@ -866,7 +866,7 @@ LD_RUNPATH_SEARCH_PATHS = "@executable_path/Frameworks"; "LD_RUNPATH_SEARCH_PATHS[sdk=macosx*]" = "@executable_path/../Frameworks"; MACOSX_DEPLOYMENT_TARGET = 13.0; - MARKETING_VERSION = 1.0; + MARKETING_VERSION = 1.0.1; PRODUCT_BUNDLE_IDENTIFIER = com.thomasricouard.IceCubesApp; PRODUCT_NAME = "$(TARGET_NAME)"; SDKROOT = auto; @@ -918,7 +918,7 @@ LD_RUNPATH_SEARCH_PATHS = "@executable_path/Frameworks"; "LD_RUNPATH_SEARCH_PATHS[sdk=macosx*]" = "@executable_path/../Frameworks"; MACOSX_DEPLOYMENT_TARGET = 13.0; - MARKETING_VERSION = 1.0; + MARKETING_VERSION = 1.0.1; PRODUCT_BUNDLE_IDENTIFIER = com.thomasricouard.IceCubesApp; PRODUCT_NAME = "$(TARGET_NAME)"; SDKROOT = auto; diff --git a/IceCubesApp/App/AppRouteur.swift b/IceCubesApp/App/AppRouteur.swift index b11d5d3d..9a35ca7f 100644 --- a/IceCubesApp/App/AppRouteur.swift +++ b/IceCubesApp/App/AppRouteur.swift @@ -66,6 +66,9 @@ extension View { case .addRemoteLocalTimeline: AddRemoteTimelineView() .withEnvironments() + case let .statusEditHistory(status): + StatusEditHistoryView(statusId: status) + .withEnvironments() } } } diff --git a/IceCubesApp/Resources/Localization/en.lproj/Localizable.strings b/IceCubesApp/Resources/Localization/en.lproj/Localizable.strings index 15afb6e7..c0de6a77 100644 --- a/IceCubesApp/Resources/Localization/en.lproj/Localizable.strings +++ b/IceCubesApp/Resources/Localization/en.lproj/Localizable.strings @@ -299,6 +299,7 @@ "status.show-less" = "Show less"; "status.show-more" = "Show more"; "status.summary.at-time" = " at "; +"status.summary.edited-time" = "Last edited: "; "status.summary.n-boosts %lld" = "%lld boosts"; "status.summary.n-favorites %lld" = "%lld favorites"; "status.visibility.direct" = "Private"; diff --git a/IceCubesShareExtension/Info.plist b/IceCubesShareExtension/Info.plist index 56c1137f..e6477ee3 100644 --- a/IceCubesShareExtension/Info.plist +++ b/IceCubesShareExtension/Info.plist @@ -4,8 +4,6 @@ NSExtension - NSExtensionPrincipalClass - $(PRODUCT_MODULE_NAME).ShareViewController NSExtensionAttributes NSExtensionActivationRule @@ -22,6 +20,8 @@ NSExtensionPointIdentifier com.apple.share-services + NSExtensionPrincipalClass + $(PRODUCT_MODULE_NAME).ShareViewController diff --git a/Packages/Env/Sources/Env/Routeur.swift b/Packages/Env/Sources/Env/Routeur.swift index e892be5c..c280574a 100644 --- a/Packages/Env/Sources/Env/Routeur.swift +++ b/Packages/Env/Sources/Env/Routeur.swift @@ -26,6 +26,7 @@ public enum SheetDestinations: Identifiable { case listAddAccount(account: Account) case addAccount case addRemoteLocalTimeline + case statusEditHistory(status: String) public var id: String { switch self { @@ -39,6 +40,8 @@ public enum SheetDestinations: Identifiable { return "addAccount" case .addRemoteLocalTimeline: return "addRemoteLocalTimeline" + case .statusEditHistory: + return "statusEditHistory" } } } diff --git a/Packages/Models/Sources/Models/StatusHistory.swift b/Packages/Models/Sources/Models/StatusHistory.swift new file mode 100644 index 00000000..1404771c --- /dev/null +++ b/Packages/Models/Sources/Models/StatusHistory.swift @@ -0,0 +1,11 @@ +import Foundation + +public struct StatusHistory: Decodable, Identifiable { + public var id: String { + createdAt.description + } + + public let content: HTMLString + public let createdAt: ServerDate + public let emojis: [Emoji] +} diff --git a/Packages/Network/Sources/Network/Endpoint/Statuses.swift b/Packages/Network/Sources/Network/Endpoint/Statuses.swift index 1b5c386e..9600bede 100644 --- a/Packages/Network/Sources/Network/Endpoint/Statuses.swift +++ b/Packages/Network/Sources/Network/Endpoint/Statuses.swift @@ -16,6 +16,7 @@ public enum Statuses: Endpoint { case unpin(id: String) case bookmark(id: String) case unbookmark(id: String) + case history(id: String) public func path() -> String { switch self { @@ -47,6 +48,8 @@ public enum Statuses: Endpoint { return "statuses/\(id)/bookmark" case let .unbookmark(id): return "statuses/\(id)/unbookmark" + case let .history(id): + return "statuses/\(id)/history" } } diff --git a/Packages/Notifications/Sources/Notifications/NotificationsViewModel.swift b/Packages/Notifications/Sources/Notifications/NotificationsViewModel.swift index d1f901ca..13feb414 100644 --- a/Packages/Notifications/Sources/Notifications/NotificationsViewModel.swift +++ b/Packages/Notifications/Sources/Notifications/NotificationsViewModel.swift @@ -110,7 +110,7 @@ class NotificationsViewModel: ObservableObject { { if let selectedType, event.notification.type == selectedType.rawValue { notifications.insert(event.notification, at: 0) - } else { + } else if selectedType == nil { notifications.insert(event.notification, at: 0) } state = .display(notifications: notifications, nextPageState: .hasNextPage) diff --git a/Packages/Status/Sources/Status/History/StatusEditHistoryView.swift b/Packages/Status/Sources/Status/History/StatusEditHistoryView.swift new file mode 100644 index 00000000..0944f7d3 --- /dev/null +++ b/Packages/Status/Sources/Status/History/StatusEditHistoryView.swift @@ -0,0 +1,66 @@ +import SwiftUI +import Models +import Network +import DesignSystem + +public struct StatusEditHistoryView: View { + @Environment(\.dismiss) private var dismiss + + @EnvironmentObject private var client: Client + @EnvironmentObject private var theme: Theme + + private let statusId: String + + @State private var history: [StatusHistory]? + + public init(statusId: String) { + self.statusId = statusId + } + + public var body: some View { + NavigationStack { + List { + Section { + if let history { + ForEach(history) { edit in + VStack(alignment: .leading, spacing: 8){ + EmojiTextApp(edit.content.asMarkdown, emojis: edit.emojis) + .font(.scaledBody) + Group { + Text(edit.createdAt.asDate, style: .date) + + Text("status.summary.at-time") + + Text(edit.createdAt.asDate, style: .time) + } + .font(.footnote) + .foregroundColor(.gray) + } + } + } else { + HStack { + Spacer() + ProgressView() + Spacer() + } + } + }.listRowBackground(theme.primaryBackgroundColor) + } + .toolbar { + ToolbarItem(placement: .navigationBarTrailing) { + Button("action.done", action: { dismiss() }) + } + } + .navigationTitle("Edit History") + .navigationBarTitleDisplayMode(.inline) + .task { + do { + history = try await client.get(endpoint: Statuses.history(id: statusId)) + } catch { + print(error) + } + } + .listStyle(.plain) + .scrollContentBackground(.hidden) + .background(theme.primaryBackgroundColor) + } + } +} diff --git a/Packages/Status/Sources/Status/Row/StatusActionsView.swift b/Packages/Status/Sources/Status/Row/StatusActionsView.swift index 0fd8dd4f..9b166c98 100644 --- a/Packages/Status/Sources/Status/Row/StatusActionsView.swift +++ b/Packages/Status/Sources/Status/Row/StatusActionsView.swift @@ -101,9 +101,9 @@ struct StatusActionsView: View { Divider() HStack { Text(viewModel.status.createdAt.asDate, style: .date) + - Text("status.summary.at-time") + - Text(viewModel.status.createdAt.asDate, style: .time) + - Text(" ·") + Text("status.summary.at-time") + + Text(viewModel.status.createdAt.asDate, style: .time) + + Text(" ·") Image(systemName: viewModel.status.visibility.iconName) Spacer() Text(viewModel.status.application?.name ?? "") @@ -116,6 +116,23 @@ struct StatusActionsView: View { } .font(.scaledCaption) .foregroundColor(.gray) + + if let editedAt = viewModel.status.editedAt { + Divider() + HStack { + Text("status.summary.edited-time") + + Text(editedAt.asDate, style: .date) + + Text("status.summary.at-time") + + Text(editedAt.asDate, style: .time) + Spacer() + } + .onTapGesture { + routerPath.presentedSheet = .statusEditHistory(status: viewModel.status.id) + } + .underline() + .font(.scaledCaption) + .foregroundColor(.gray) + } if viewModel.favouritesCount > 0 { Divider()