mirror of
https://github.com/Dimillian/IceCubesApp.git
synced 2025-02-03 16:07:31 +01:00
Added edit history
This commit is contained in:
parent
cbd4b7acef
commit
e05734fe1a
@ -613,7 +613,7 @@
|
|||||||
"@executable_path/Frameworks",
|
"@executable_path/Frameworks",
|
||||||
"@executable_path/../../Frameworks",
|
"@executable_path/../../Frameworks",
|
||||||
);
|
);
|
||||||
MARKETING_VERSION = 1.0;
|
MARKETING_VERSION = 1.0.1;
|
||||||
PRODUCT_BUNDLE_IDENTIFIER = com.thomasricouard.IceCubesApp.IceCubesNotifications;
|
PRODUCT_BUNDLE_IDENTIFIER = com.thomasricouard.IceCubesApp.IceCubesNotifications;
|
||||||
PRODUCT_NAME = "$(TARGET_NAME)";
|
PRODUCT_NAME = "$(TARGET_NAME)";
|
||||||
SDKROOT = iphoneos;
|
SDKROOT = iphoneos;
|
||||||
@ -643,7 +643,7 @@
|
|||||||
"@executable_path/Frameworks",
|
"@executable_path/Frameworks",
|
||||||
"@executable_path/../../Frameworks",
|
"@executable_path/../../Frameworks",
|
||||||
);
|
);
|
||||||
MARKETING_VERSION = 1.0;
|
MARKETING_VERSION = 1.0.1;
|
||||||
PRODUCT_BUNDLE_IDENTIFIER = com.thomasricouard.IceCubesApp.IceCubesNotifications;
|
PRODUCT_BUNDLE_IDENTIFIER = com.thomasricouard.IceCubesApp.IceCubesNotifications;
|
||||||
PRODUCT_NAME = "$(TARGET_NAME)";
|
PRODUCT_NAME = "$(TARGET_NAME)";
|
||||||
SDKROOT = iphoneos;
|
SDKROOT = iphoneos;
|
||||||
@ -674,7 +674,7 @@
|
|||||||
"@executable_path/Frameworks",
|
"@executable_path/Frameworks",
|
||||||
"@executable_path/../../Frameworks",
|
"@executable_path/../../Frameworks",
|
||||||
);
|
);
|
||||||
MARKETING_VERSION = 1.0;
|
MARKETING_VERSION = 1.0.1;
|
||||||
PRODUCT_BUNDLE_IDENTIFIER = com.thomasricouard.IceCubesApp.IceCubesShareExtension;
|
PRODUCT_BUNDLE_IDENTIFIER = com.thomasricouard.IceCubesApp.IceCubesShareExtension;
|
||||||
PRODUCT_NAME = "$(TARGET_NAME)";
|
PRODUCT_NAME = "$(TARGET_NAME)";
|
||||||
SDKROOT = iphoneos;
|
SDKROOT = iphoneos;
|
||||||
@ -704,7 +704,7 @@
|
|||||||
"@executable_path/Frameworks",
|
"@executable_path/Frameworks",
|
||||||
"@executable_path/../../Frameworks",
|
"@executable_path/../../Frameworks",
|
||||||
);
|
);
|
||||||
MARKETING_VERSION = 1.0;
|
MARKETING_VERSION = 1.0.1;
|
||||||
PRODUCT_BUNDLE_IDENTIFIER = com.thomasricouard.IceCubesApp.IceCubesShareExtension;
|
PRODUCT_BUNDLE_IDENTIFIER = com.thomasricouard.IceCubesApp.IceCubesShareExtension;
|
||||||
PRODUCT_NAME = "$(TARGET_NAME)";
|
PRODUCT_NAME = "$(TARGET_NAME)";
|
||||||
SDKROOT = iphoneos;
|
SDKROOT = iphoneos;
|
||||||
@ -866,7 +866,7 @@
|
|||||||
LD_RUNPATH_SEARCH_PATHS = "@executable_path/Frameworks";
|
LD_RUNPATH_SEARCH_PATHS = "@executable_path/Frameworks";
|
||||||
"LD_RUNPATH_SEARCH_PATHS[sdk=macosx*]" = "@executable_path/../Frameworks";
|
"LD_RUNPATH_SEARCH_PATHS[sdk=macosx*]" = "@executable_path/../Frameworks";
|
||||||
MACOSX_DEPLOYMENT_TARGET = 13.0;
|
MACOSX_DEPLOYMENT_TARGET = 13.0;
|
||||||
MARKETING_VERSION = 1.0;
|
MARKETING_VERSION = 1.0.1;
|
||||||
PRODUCT_BUNDLE_IDENTIFIER = com.thomasricouard.IceCubesApp;
|
PRODUCT_BUNDLE_IDENTIFIER = com.thomasricouard.IceCubesApp;
|
||||||
PRODUCT_NAME = "$(TARGET_NAME)";
|
PRODUCT_NAME = "$(TARGET_NAME)";
|
||||||
SDKROOT = auto;
|
SDKROOT = auto;
|
||||||
@ -918,7 +918,7 @@
|
|||||||
LD_RUNPATH_SEARCH_PATHS = "@executable_path/Frameworks";
|
LD_RUNPATH_SEARCH_PATHS = "@executable_path/Frameworks";
|
||||||
"LD_RUNPATH_SEARCH_PATHS[sdk=macosx*]" = "@executable_path/../Frameworks";
|
"LD_RUNPATH_SEARCH_PATHS[sdk=macosx*]" = "@executable_path/../Frameworks";
|
||||||
MACOSX_DEPLOYMENT_TARGET = 13.0;
|
MACOSX_DEPLOYMENT_TARGET = 13.0;
|
||||||
MARKETING_VERSION = 1.0;
|
MARKETING_VERSION = 1.0.1;
|
||||||
PRODUCT_BUNDLE_IDENTIFIER = com.thomasricouard.IceCubesApp;
|
PRODUCT_BUNDLE_IDENTIFIER = com.thomasricouard.IceCubesApp;
|
||||||
PRODUCT_NAME = "$(TARGET_NAME)";
|
PRODUCT_NAME = "$(TARGET_NAME)";
|
||||||
SDKROOT = auto;
|
SDKROOT = auto;
|
||||||
|
@ -66,6 +66,9 @@ extension View {
|
|||||||
case .addRemoteLocalTimeline:
|
case .addRemoteLocalTimeline:
|
||||||
AddRemoteTimelineView()
|
AddRemoteTimelineView()
|
||||||
.withEnvironments()
|
.withEnvironments()
|
||||||
|
case let .statusEditHistory(status):
|
||||||
|
StatusEditHistoryView(statusId: status)
|
||||||
|
.withEnvironments()
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
@ -299,6 +299,7 @@
|
|||||||
"status.show-less" = "Show less";
|
"status.show-less" = "Show less";
|
||||||
"status.show-more" = "Show more";
|
"status.show-more" = "Show more";
|
||||||
"status.summary.at-time" = " at ";
|
"status.summary.at-time" = " at ";
|
||||||
|
"status.summary.edited-time" = "Last edited: ";
|
||||||
"status.summary.n-boosts %lld" = "%lld boosts";
|
"status.summary.n-boosts %lld" = "%lld boosts";
|
||||||
"status.summary.n-favorites %lld" = "%lld favorites";
|
"status.summary.n-favorites %lld" = "%lld favorites";
|
||||||
"status.visibility.direct" = "Private";
|
"status.visibility.direct" = "Private";
|
||||||
|
@ -4,8 +4,6 @@
|
|||||||
<dict>
|
<dict>
|
||||||
<key>NSExtension</key>
|
<key>NSExtension</key>
|
||||||
<dict>
|
<dict>
|
||||||
<key>NSExtensionPrincipalClass</key>
|
|
||||||
<string>$(PRODUCT_MODULE_NAME).ShareViewController</string>
|
|
||||||
<key>NSExtensionAttributes</key>
|
<key>NSExtensionAttributes</key>
|
||||||
<dict>
|
<dict>
|
||||||
<key>NSExtensionActivationRule</key>
|
<key>NSExtensionActivationRule</key>
|
||||||
@ -22,6 +20,8 @@
|
|||||||
</dict>
|
</dict>
|
||||||
<key>NSExtensionPointIdentifier</key>
|
<key>NSExtensionPointIdentifier</key>
|
||||||
<string>com.apple.share-services</string>
|
<string>com.apple.share-services</string>
|
||||||
|
<key>NSExtensionPrincipalClass</key>
|
||||||
|
<string>$(PRODUCT_MODULE_NAME).ShareViewController</string>
|
||||||
</dict>
|
</dict>
|
||||||
</dict>
|
</dict>
|
||||||
</plist>
|
</plist>
|
||||||
|
@ -26,6 +26,7 @@ public enum SheetDestinations: Identifiable {
|
|||||||
case listAddAccount(account: Account)
|
case listAddAccount(account: Account)
|
||||||
case addAccount
|
case addAccount
|
||||||
case addRemoteLocalTimeline
|
case addRemoteLocalTimeline
|
||||||
|
case statusEditHistory(status: String)
|
||||||
|
|
||||||
public var id: String {
|
public var id: String {
|
||||||
switch self {
|
switch self {
|
||||||
@ -39,6 +40,8 @@ public enum SheetDestinations: Identifiable {
|
|||||||
return "addAccount"
|
return "addAccount"
|
||||||
case .addRemoteLocalTimeline:
|
case .addRemoteLocalTimeline:
|
||||||
return "addRemoteLocalTimeline"
|
return "addRemoteLocalTimeline"
|
||||||
|
case .statusEditHistory:
|
||||||
|
return "statusEditHistory"
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
11
Packages/Models/Sources/Models/StatusHistory.swift
Normal file
11
Packages/Models/Sources/Models/StatusHistory.swift
Normal file
@ -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]
|
||||||
|
}
|
@ -16,6 +16,7 @@ public enum Statuses: Endpoint {
|
|||||||
case unpin(id: String)
|
case unpin(id: String)
|
||||||
case bookmark(id: String)
|
case bookmark(id: String)
|
||||||
case unbookmark(id: String)
|
case unbookmark(id: String)
|
||||||
|
case history(id: String)
|
||||||
|
|
||||||
public func path() -> String {
|
public func path() -> String {
|
||||||
switch self {
|
switch self {
|
||||||
@ -47,6 +48,8 @@ public enum Statuses: Endpoint {
|
|||||||
return "statuses/\(id)/bookmark"
|
return "statuses/\(id)/bookmark"
|
||||||
case let .unbookmark(id):
|
case let .unbookmark(id):
|
||||||
return "statuses/\(id)/unbookmark"
|
return "statuses/\(id)/unbookmark"
|
||||||
|
case let .history(id):
|
||||||
|
return "statuses/\(id)/history"
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
|
@ -110,7 +110,7 @@ class NotificationsViewModel: ObservableObject {
|
|||||||
{
|
{
|
||||||
if let selectedType, event.notification.type == selectedType.rawValue {
|
if let selectedType, event.notification.type == selectedType.rawValue {
|
||||||
notifications.insert(event.notification, at: 0)
|
notifications.insert(event.notification, at: 0)
|
||||||
} else {
|
} else if selectedType == nil {
|
||||||
notifications.insert(event.notification, at: 0)
|
notifications.insert(event.notification, at: 0)
|
||||||
}
|
}
|
||||||
state = .display(notifications: notifications, nextPageState: .hasNextPage)
|
state = .display(notifications: notifications, nextPageState: .hasNextPage)
|
||||||
|
@ -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)
|
||||||
|
}
|
||||||
|
}
|
||||||
|
}
|
@ -101,9 +101,9 @@ struct StatusActionsView: View {
|
|||||||
Divider()
|
Divider()
|
||||||
HStack {
|
HStack {
|
||||||
Text(viewModel.status.createdAt.asDate, style: .date) +
|
Text(viewModel.status.createdAt.asDate, style: .date) +
|
||||||
Text("status.summary.at-time") +
|
Text("status.summary.at-time") +
|
||||||
Text(viewModel.status.createdAt.asDate, style: .time) +
|
Text(viewModel.status.createdAt.asDate, style: .time) +
|
||||||
Text(" ·")
|
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 ?? "")
|
||||||
@ -116,6 +116,23 @@ struct StatusActionsView: View {
|
|||||||
}
|
}
|
||||||
.font(.scaledCaption)
|
.font(.scaledCaption)
|
||||||
.foregroundColor(.gray)
|
.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 {
|
if viewModel.favouritesCount > 0 {
|
||||||
Divider()
|
Divider()
|
||||||
|
Loading…
x
Reference in New Issue
Block a user