mirror of
https://github.com/Dimillian/IceCubesApp.git
synced 2025-01-11 08:35:26 +00:00
Report status
This commit is contained in:
parent
1883e0eef9
commit
50f6f1b007
22 changed files with 206 additions and 0 deletions
|
@ -47,6 +47,7 @@
|
|||
9F55C68D2955968700F94077 /* ExploreTab.swift in Sources */ = {isa = PBXBuildFile; fileRef = 9F55C68C2955968700F94077 /* ExploreTab.swift */; };
|
||||
9F55C6902955993C00F94077 /* Explore in Frameworks */ = {isa = PBXBuildFile; productRef = 9F55C68F2955993C00F94077 /* Explore */; };
|
||||
9F5E581929545BE700A53960 /* Env in Frameworks */ = {isa = PBXBuildFile; productRef = 9F5E581829545BE700A53960 /* Env */; };
|
||||
9F654BEF299AC45B00D27FA5 /* ReportView.swift in Sources */ = {isa = PBXBuildFile; fileRef = 9F654BEE299AC45B00D27FA5 /* ReportView.swift */; };
|
||||
9F7335EA2966B3F800AFF0BA /* Conversations in Frameworks */ = {isa = PBXBuildFile; productRef = 9F7335E92966B3F800AFF0BA /* Conversations */; };
|
||||
9F7335ED2967463400AFF0BA /* AVKit.framework in Frameworks */ = {isa = PBXBuildFile; fileRef = 9F7335EB2967461B00AFF0BA /* AVKit.framework */; };
|
||||
9F7335EF29674F7100AFF0BA /* QuickLook.framework in Frameworks */ = {isa = PBXBuildFile; fileRef = 9F7335EE29674F7100AFF0BA /* QuickLook.framework */; };
|
||||
|
@ -184,6 +185,7 @@
|
|||
9F55C68C2955968700F94077 /* ExploreTab.swift */ = {isa = PBXFileReference; lastKnownFileType = sourcecode.swift; path = ExploreTab.swift; sourceTree = "<group>"; };
|
||||
9F55C68E295598F900F94077 /* Explore */ = {isa = PBXFileReference; lastKnownFileType = wrapper; name = Explore; path = Packages/Explore; sourceTree = "<group>"; };
|
||||
9F5E581729545B5500A53960 /* Env */ = {isa = PBXFileReference; lastKnownFileType = wrapper; name = Env; path = Packages/Env; sourceTree = "<group>"; };
|
||||
9F654BEE299AC45B00D27FA5 /* ReportView.swift */ = {isa = PBXFileReference; lastKnownFileType = sourcecode.swift; path = ReportView.swift; sourceTree = "<group>"; };
|
||||
9F7335E82966B3DC00AFF0BA /* Conversations */ = {isa = PBXFileReference; lastKnownFileType = wrapper; name = Conversations; path = Packages/Conversations; sourceTree = "<group>"; };
|
||||
9F7335EB2967461B00AFF0BA /* AVKit.framework */ = {isa = PBXFileReference; lastKnownFileType = wrapper.framework; name = AVKit.framework; path = Platforms/iPhoneOS.platform/Developer/SDKs/iPhoneOS16.2.sdk/System/Library/Frameworks/AVKit.framework; sourceTree = DEVELOPER_DIR; };
|
||||
9F7335EE29674F7100AFF0BA /* QuickLook.framework */ = {isa = PBXFileReference; lastKnownFileType = wrapper.framework; name = QuickLook.framework; path = Platforms/iPhoneOS.platform/Developer/SDKs/iPhoneOS16.2.sdk/System/Library/Frameworks/QuickLook.framework; sourceTree = DEVELOPER_DIR; };
|
||||
|
@ -328,6 +330,7 @@
|
|||
9F398AB429360A5800A889F2 /* App */ = {
|
||||
isa = PBXGroup;
|
||||
children = (
|
||||
9F654BF0299AC46200D27FA5 /* Report */,
|
||||
9FAE4AC9293783A200772766 /* Tabs */,
|
||||
9FBFE63C292A715500C250E9 /* IceCubesApp.swift */,
|
||||
9F398AA52935FE8A00A889F2 /* AppRouter.swift */,
|
||||
|
@ -347,6 +350,14 @@
|
|||
path = Resources;
|
||||
sourceTree = "<group>";
|
||||
};
|
||||
9F654BF0299AC46200D27FA5 /* Report */ = {
|
||||
isa = PBXGroup;
|
||||
children = (
|
||||
9F654BEE299AC45B00D27FA5 /* ReportView.swift */,
|
||||
);
|
||||
path = Report;
|
||||
sourceTree = "<group>";
|
||||
};
|
||||
9F7335F02967607A00AFF0BA /* Timeline */ = {
|
||||
isa = PBXGroup;
|
||||
children = (
|
||||
|
@ -761,6 +772,7 @@
|
|||
9F2B92FA295DA7D700DE16D0 /* AddAccountsView.swift in Sources */,
|
||||
639CDF9C296AC82F00C35E58 /* SafariRouter.swift in Sources */,
|
||||
9F35DB4729506F6600B3281A /* NotificationTab.swift in Sources */,
|
||||
9F654BEF299AC45B00D27FA5 /* ReportView.swift in Sources */,
|
||||
D08A9C3529956CFA00204A4A /* SwipeActionsSettingsView.swift in Sources */,
|
||||
9F7335F22967608F00AFF0BA /* AddRemoteTimelineView.swift in Sources */,
|
||||
9F55C68D2955968700F94077 /* ExploreTab.swift in Sources */,
|
||||
|
|
|
@ -89,6 +89,9 @@ extension View {
|
|||
} else {
|
||||
EmptyView()
|
||||
}
|
||||
case let .report(status):
|
||||
ReportView(status: status)
|
||||
.withEnvironments()
|
||||
}
|
||||
}
|
||||
}
|
||||
|
|
76
IceCubesApp/App/Report/ReportView.swift
Normal file
76
IceCubesApp/App/Report/ReportView.swift
Normal file
|
@ -0,0 +1,76 @@
|
|||
import SwiftUI
|
||||
import Models
|
||||
import Env
|
||||
import DesignSystem
|
||||
import Status
|
||||
import Network
|
||||
|
||||
public struct ReportView: View {
|
||||
@Environment(\.dismiss) private var dismiss
|
||||
|
||||
@EnvironmentObject private var theme: Theme
|
||||
@EnvironmentObject private var client: Client
|
||||
|
||||
let status: Status
|
||||
@State private var commentText: String = ""
|
||||
@State private var isSendingReport: Bool = false
|
||||
|
||||
struct ReportSent: Decodable {
|
||||
let id : String
|
||||
}
|
||||
|
||||
public var body: some View {
|
||||
NavigationStack {
|
||||
Form {
|
||||
Section {
|
||||
TextField("report.comment.placeholder",
|
||||
text: $commentText,
|
||||
axis: .vertical)
|
||||
}
|
||||
.listRowBackground(theme.primaryBackgroundColor)
|
||||
|
||||
StatusEmbeddedView(status: status)
|
||||
.allowsHitTesting(false)
|
||||
.listRowBackground(theme.primaryBackgroundColor)
|
||||
}
|
||||
.navigationTitle("report.title")
|
||||
.navigationBarTitleDisplayMode(.inline)
|
||||
.scrollContentBackground(.hidden)
|
||||
.background(theme.secondaryBackgroundColor)
|
||||
.scrollDismissesKeyboard(.immediately)
|
||||
.toolbar {
|
||||
ToolbarItem(placement: .navigationBarTrailing) {
|
||||
Button {
|
||||
isSendingReport = true
|
||||
Task {
|
||||
do {
|
||||
let _: ReportSent =
|
||||
try await client.post(endpoint: Statuses.report(accountId: status.account.id,
|
||||
statusId: status.id,
|
||||
comment: commentText))
|
||||
dismiss()
|
||||
isSendingReport = false
|
||||
} catch {
|
||||
isSendingReport = false
|
||||
}
|
||||
}
|
||||
} label: {
|
||||
if isSendingReport {
|
||||
ProgressView()
|
||||
} else {
|
||||
Text("report.action.send")
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
ToolbarItem(placement: .navigationBarLeading) {
|
||||
Button {
|
||||
dismiss()
|
||||
} label: {
|
||||
Text("action.cancel")
|
||||
}
|
||||
}
|
||||
}
|
||||
}
|
||||
}
|
||||
}
|
|
@ -445,3 +445,9 @@
|
|||
"accessibility.editor.button.drafts" = "Drafts";
|
||||
"accessibility.editor.button.custom-emojis" = "Custom emojis";
|
||||
"accessibility.editor.button.language" = "Language";
|
||||
|
||||
// MARK: Report
|
||||
"report.comment.placeholder" = "Additional Info";
|
||||
"report.title" = "Report Post";
|
||||
"report.action.send" = "Send";
|
||||
"status.action.report" = "Report Post";
|
||||
|
|
|
@ -441,3 +441,9 @@
|
|||
"accessibility.editor.button.drafts" = "Entwürfe";
|
||||
"accessibility.editor.button.custom-emojis" = "Eigene Emojis";
|
||||
"accessibility.editor.button.language" = "Sprache";
|
||||
|
||||
// MARK: Report
|
||||
"report.comment.placeholder" = "Additional Info";
|
||||
"report.title" = "Report Post";
|
||||
"report.action.send" = "Send";
|
||||
"status.action.report" = "Report Post";
|
||||
|
|
|
@ -446,3 +446,9 @@
|
|||
"accessibility.editor.button.drafts" = "Drafts";
|
||||
"accessibility.editor.button.custom-emojis" = "Custom emojis";
|
||||
"accessibility.editor.button.language" = "Language";
|
||||
|
||||
// MARK: Report
|
||||
"report.comment.placeholder" = "Additional Info";
|
||||
"report.title" = "Report Post";
|
||||
"report.action.send" = "Send";
|
||||
"status.action.report" = "Report Post";
|
||||
|
|
|
@ -447,3 +447,10 @@
|
|||
"accessibility.editor.button.drafts" = "Drafts";
|
||||
"accessibility.editor.button.custom-emojis" = "Custom emojis";
|
||||
"accessibility.editor.button.language" = "Language";
|
||||
|
||||
// MARK: Report
|
||||
"report.comment.placeholder" = "Additional Info";
|
||||
"report.title" = "Report Post";
|
||||
"report.action.send" = "Send";
|
||||
"status.action.report" = "Report Post";
|
||||
|
||||
|
|
|
@ -447,3 +447,9 @@
|
|||
"accessibility.editor.button.drafts" = "Drafts";
|
||||
"accessibility.editor.button.custom-emojis" = "Custom emojis";
|
||||
"accessibility.editor.button.language" = "Language";
|
||||
|
||||
// MARK: Report
|
||||
"report.comment.placeholder" = "Additional Info";
|
||||
"report.title" = "Report Post";
|
||||
"report.action.send" = "Send";
|
||||
"status.action.report" = "Report Post";
|
||||
|
|
|
@ -447,3 +447,9 @@
|
|||
"accessibility.editor.button.drafts" = "Zirriborroak";
|
||||
"accessibility.editor.button.custom-emojis" = "Instantziaren emojiak";
|
||||
"accessibility.editor.button.language" = "Hizkuntza";
|
||||
|
||||
// MARK: Report
|
||||
"report.comment.placeholder" = "Additional Info";
|
||||
"report.title" = "Report Post";
|
||||
"report.action.send" = "Send";
|
||||
"status.action.report" = "Report Post";
|
||||
|
|
|
@ -442,3 +442,9 @@
|
|||
"accessibility.editor.button.drafts" = "Drafts";
|
||||
"accessibility.editor.button.custom-emojis" = "Custom emojis";
|
||||
"accessibility.editor.button.language" = "Language";
|
||||
|
||||
// MARK: Report
|
||||
"report.comment.placeholder" = "Additional Info";
|
||||
"report.title" = "Report Post";
|
||||
"report.action.send" = "Send";
|
||||
"status.action.report" = "Report Post";
|
||||
|
|
|
@ -447,3 +447,9 @@
|
|||
"accessibility.editor.button.drafts" = "Bozze";
|
||||
"accessibility.editor.button.custom-emojis" = "Emoji personalizzate";
|
||||
"accessibility.editor.button.language" = "Lingua";
|
||||
|
||||
// MARK: Report
|
||||
"report.comment.placeholder" = "Additional Info";
|
||||
"report.title" = "Report Post";
|
||||
"report.action.send" = "Send";
|
||||
"status.action.report" = "Report Post";
|
||||
|
|
|
@ -446,3 +446,9 @@
|
|||
"accessibility.editor.button.drafts" = "下書き";
|
||||
"accessibility.editor.button.custom-emojis" = "カスタム絵文字";
|
||||
"accessibility.editor.button.language" = "言語";
|
||||
|
||||
// MARK: Report
|
||||
"report.comment.placeholder" = "Additional Info";
|
||||
"report.title" = "Report Post";
|
||||
"report.action.send" = "Send";
|
||||
"status.action.report" = "Report Post";
|
||||
|
|
|
@ -448,3 +448,9 @@
|
|||
"accessibility.editor.button.drafts" = "임시 보관함";
|
||||
"accessibility.editor.button.custom-emojis" = "커스텀 이모지";
|
||||
"accessibility.editor.button.language" = "언어";
|
||||
|
||||
// MARK: Report
|
||||
"report.comment.placeholder" = "Additional Info";
|
||||
"report.title" = "Report Post";
|
||||
"report.action.send" = "Send";
|
||||
"status.action.report" = "Report Post";
|
||||
|
|
|
@ -446,3 +446,9 @@
|
|||
"accessibility.editor.button.drafts" = "Drafts";
|
||||
"accessibility.editor.button.custom-emojis" = "Custom emojis";
|
||||
"accessibility.editor.button.language" = "Language";
|
||||
|
||||
// MARK: Report
|
||||
"report.comment.placeholder" = "Additional Info";
|
||||
"report.title" = "Report Post";
|
||||
"report.action.send" = "Send";
|
||||
"status.action.report" = "Report Post";
|
||||
|
|
|
@ -443,3 +443,9 @@
|
|||
"accessibility.editor.button.drafts" = "Concepten";
|
||||
"accessibility.editor.button.custom-emojis" = "Aangepaste emoji’s";
|
||||
"accessibility.editor.button.language" = "Taal";
|
||||
|
||||
// MARK: Report
|
||||
"report.comment.placeholder" = "Additional Info";
|
||||
"report.title" = "Report Post";
|
||||
"report.action.send" = "Send";
|
||||
"status.action.report" = "Report Post";
|
||||
|
|
|
@ -439,3 +439,9 @@
|
|||
"accessibility.editor.button.drafts" = "Wersje robocze";
|
||||
"accessibility.editor.button.custom-emojis" = "Emotikony własne";
|
||||
"accessibility.editor.button.language" = "Język";
|
||||
|
||||
// MARK: Report
|
||||
"report.comment.placeholder" = "Additional Info";
|
||||
"report.title" = "Report Post";
|
||||
"report.action.send" = "Send";
|
||||
"status.action.report" = "Report Post";
|
||||
|
|
|
@ -446,3 +446,9 @@
|
|||
"accessibility.editor.button.drafts" = "Drafts";
|
||||
"accessibility.editor.button.custom-emojis" = "Custom emojis";
|
||||
"accessibility.editor.button.language" = "Language";
|
||||
|
||||
// MARK: Report
|
||||
"report.comment.placeholder" = "Additional Info";
|
||||
"report.title" = "Report Post";
|
||||
"report.action.send" = "Send";
|
||||
"status.action.report" = "Report Post";
|
||||
|
|
|
@ -446,3 +446,9 @@
|
|||
"accessibility.editor.button.drafts" = "Drafts";
|
||||
"accessibility.editor.button.custom-emojis" = "Custom emojis";
|
||||
"accessibility.editor.button.language" = "Language";
|
||||
|
||||
// MARK: Report
|
||||
"report.comment.placeholder" = "Additional Info";
|
||||
"report.title" = "Report Post";
|
||||
"report.action.send" = "Send";
|
||||
"status.action.report" = "Report Post";
|
||||
|
|
|
@ -450,3 +450,9 @@
|
|||
"accessibility.editor.button.drafts" = "草稿";
|
||||
"accessibility.editor.button.custom-emojis" = "自定义表情";
|
||||
"accessibility.editor.button.language" = "选择语言";
|
||||
|
||||
// MARK: Report
|
||||
"report.comment.placeholder" = "Additional Info";
|
||||
"report.title" = "Report Post";
|
||||
"report.action.send" = "Send";
|
||||
"status.action.report" = "Report Post";
|
||||
|
|
|
@ -33,6 +33,7 @@ public enum SheetDestinations: Identifiable {
|
|||
case statusEditHistory(status: String)
|
||||
case settings
|
||||
case accountPushNotficationsSettings
|
||||
case report(status: Status)
|
||||
|
||||
public var id: String {
|
||||
switch self {
|
||||
|
@ -49,6 +50,8 @@ public enum SheetDestinations: Identifiable {
|
|||
return "addRemoteLocalTimeline"
|
||||
case .statusEditHistory:
|
||||
return "statusEditHistory"
|
||||
case .report:
|
||||
return "report"
|
||||
}
|
||||
}
|
||||
}
|
||||
|
|
|
@ -18,6 +18,7 @@ public enum Statuses: Endpoint {
|
|||
case unbookmark(id: String)
|
||||
case history(id: String)
|
||||
case translate(id: String, lang: String?)
|
||||
case report(accountId: String, statusId: String, comment: String)
|
||||
|
||||
public func path() -> String {
|
||||
switch self {
|
||||
|
@ -53,6 +54,8 @@ public enum Statuses: Endpoint {
|
|||
return "statuses/\(id)/history"
|
||||
case let .translate(id, _):
|
||||
return "statuses/\(id)/translate"
|
||||
case .report:
|
||||
return "reports"
|
||||
}
|
||||
}
|
||||
|
||||
|
@ -67,6 +70,10 @@ public enum Statuses: Endpoint {
|
|||
return [.init(name: "lang", value: lang)]
|
||||
}
|
||||
return nil
|
||||
case let .report(accountId, statusId, comment):
|
||||
return [.init(name: "account_id", value: accountId),
|
||||
.init(name: "status_ids[]", value: statusId),
|
||||
.init(name: "comment", value: comment)]
|
||||
default:
|
||||
return nil
|
||||
}
|
||||
|
|
|
@ -129,6 +129,14 @@ struct StatusRowContextMenu: View {
|
|||
Label("status.action.message", systemImage: "tray.full")
|
||||
}
|
||||
}
|
||||
|
||||
Section {
|
||||
Button(role: .destructive) {
|
||||
routerPath.presentedSheet = .report(status: viewModel.status.reblogAsAsStatus ?? viewModel.status)
|
||||
} label: {
|
||||
Label("status.action.report", systemImage: "exclamationmark.bubble")
|
||||
}
|
||||
}
|
||||
}
|
||||
}
|
||||
}
|
||||
|
|
Loading…
Reference in a new issue