Add feedback submission sheet

Also fixed a bug where locations with overlapping close and open times would show "Closing Soon" for 30 minutes just to then switch to "Open" when it rolled over.
This commit is contained in:
2026-02-17 00:01:55 -05:00
parent a4e3af3e75
commit 0c07c509f3
8 changed files with 256 additions and 10 deletions

View File

@@ -0,0 +1,56 @@
//
// MailView.swift
// TigerDine
//
// Created by Campbell on 2/16/26.
//
import SwiftUI
import MessageUI
// More gross yucky UIKit code :(
// Unfortunately there's no native SwiftUI MailView.
struct MailView: UIViewControllerRepresentable {
@Environment(\.dismiss) var dismiss
@Binding var result: Result<MFMailComposeResult, Error>?
class Coordinator: NSObject, MFMailComposeViewControllerDelegate {
var parent: MailView
init(_ parent: MailView) {
self.parent = parent
}
func mailComposeController(_ controller: MFMailComposeViewController, didFinishWith result: MFMailComposeResult, error: Error?) {
defer {
parent.dismiss()
}
if let error = error {
parent.result = .failure(error)
} else {
parent.result = .success(result)
}
}
}
func makeCoordinator() -> Coordinator {
Coordinator(self)
}
func makeUIViewController(context: Context) -> MFMailComposeViewController {
let vc = MFMailComposeViewController()
vc.mailComposeDelegate = context.coordinator
vc.setToRecipients(["58050615+NinjaCheetah@users.noreply.github.com"])
vc.setSubject("TigerDine Feedback")
//vc.setMessageBody("", isHTML: false)
return vc
}
func updateUIViewController(_ uiViewController: MFMailComposeViewController, context: Context) {
}
static func canSendMail() -> Bool {
return MFMailComposeViewController.canSendMail()
}
}