mirror of
https://github.com/lumaa-dev/BubbleApp.git
synced 2025-01-31 18:55:43 +01:00
Leave when deleting
This commit is contained in:
parent
c99f185205
commit
44ad8975b6
@ -135,13 +135,13 @@ struct CompactPostView: View {
|
||||
ScrollView(.horizontal, showsIndicators: false) {
|
||||
HStack(alignment: .firstTextBaseline, spacing: 5) {
|
||||
ForEach(status.mediaAttachments) { attachment in
|
||||
PostAttachment(attachment: attachment, isFeatured: false)
|
||||
PostAttachment(attachment: attachment, isFeatured: false, isImaging: imaging)
|
||||
}
|
||||
}
|
||||
}
|
||||
.scrollClipDisabled()
|
||||
} else {
|
||||
PostAttachment(attachment: status.mediaAttachments.first!)
|
||||
PostAttachment(attachment: status.mediaAttachments.first!, isImaging: imaging)
|
||||
}
|
||||
}
|
||||
|
||||
@ -164,11 +164,11 @@ struct CompactPostView: View {
|
||||
stats.padding(.top, 5)
|
||||
}
|
||||
|
||||
if !imaging {
|
||||
PostMenu(status: status)
|
||||
.padding([.trailing, .top])
|
||||
.contentShape(Rectangle())
|
||||
}
|
||||
// if !imaging {
|
||||
// PostMenu(status: status)
|
||||
// .padding([.trailing, .top])
|
||||
// .contentShape(Rectangle())
|
||||
// }
|
||||
}
|
||||
}
|
||||
|
||||
|
@ -6,6 +6,7 @@ import UniformTypeIdentifiers
|
||||
struct PostMenu: View {
|
||||
@Environment(Navigator.self) private var navigator
|
||||
@Environment(AccountManager.self) private var accountManager
|
||||
@Environment(\.dismiss) private var dismiss
|
||||
@Environment(\.colorScheme) private var colorScheme
|
||||
@Environment(\.displayScale) private var displayScale
|
||||
|
||||
@ -92,6 +93,9 @@ struct PostMenu: View {
|
||||
private func deleteStatus() async {
|
||||
if let client = accountManager.getClient() {
|
||||
_ = try? await client.delete(endpoint: Statuses.status(id: status.id))
|
||||
if navigator.path.last == .post(status: status) {
|
||||
dismiss()
|
||||
}
|
||||
}
|
||||
}
|
||||
}
|
||||
|
@ -13,6 +13,10 @@ public class Navigator: ObservableObject {
|
||||
path.append(to)
|
||||
print("appended view")
|
||||
}
|
||||
|
||||
public func removeSettingsOfPath() {
|
||||
self.path = self.path.filter({ !RouterDestination.allSettings.contains($0) })
|
||||
}
|
||||
}
|
||||
|
||||
public enum TabDestination: Identifiable {
|
||||
@ -90,6 +94,10 @@ public enum RouterDestination: Hashable {
|
||||
case about
|
||||
}
|
||||
|
||||
extension RouterDestination {
|
||||
static let allSettings: [RouterDestination] = [.settings, .privacy, .about, .appearence]
|
||||
}
|
||||
|
||||
extension View {
|
||||
func withAppRouter(_ navigator: Navigator) -> some View {
|
||||
navigationDestination(for: RouterDestination.self) { destination in
|
||||
@ -158,10 +166,11 @@ extension View {
|
||||
|
||||
private struct EmptySheetView: View {
|
||||
var destId: String = "???"
|
||||
let str: String = .init(localized: "about.version-\(AppInfo.appVersion)")
|
||||
|
||||
var body: some View {
|
||||
ZStack {
|
||||
ContentUnavailableView(String("Missing view for \"\(destId.isEmpty ? "[EMPTY_DEST_ID]" : destId)\""), systemImage: "exclamationmark.triangle.fill", description: Text(String("Please notify Lumaa as soon as possible!\n\nThreadedApp v\(AppInfo.appVersion)")))
|
||||
ContentUnavailableView(String("Missing view for \"\(destId.isEmpty ? "[EMPTY_DEST_ID]" : destId)\""), systemImage: "exclamationmark.triangle.fill", description: Text(String("Please notify Lumaa as soon as possible!\n\n\(str)")))
|
||||
.ignoresSafeArea()
|
||||
.background(Color.red.gradient)
|
||||
.foregroundStyle(.white)
|
||||
|
Loading…
x
Reference in New Issue
Block a user