Skip to content

Commit

Permalink
Added more feedback options.
Browse files Browse the repository at this point in the history
Signed-off-by: Stephen <[email protected]>
  • Loading branch information
0-Blu authored and Spidy123222 committed Aug 13, 2024
1 parent 14dc93b commit 19dde69
Showing 1 changed file with 48 additions and 19 deletions.
67 changes: 48 additions & 19 deletions AltStore/Settings/SettingsViewController.swift
Original file line number Diff line number Diff line change
Expand Up @@ -587,29 +587,58 @@ extension SettingsViewController
switch row
{
case .sendFeedback:
if MFMailComposeViewController.canSendMail()
{
let mailViewController = MFMailComposeViewController()
mailViewController.mailComposeDelegate = self
mailViewController.setToRecipients(["[email protected]"])

if let version = Bundle.main.object(forInfoDictionaryKey: "CFBundleShortVersionString") as? String
{
mailViewController.setSubject("SideStore Beta \(version) Feedback")
let alertController = UIAlertController(title: "Send Feedback", message: "Choose a method to send feedback:", preferredStyle: .actionSheet)

// Option 1: GitHub
alertController.addAction(UIAlertAction(title: "GitHub", style: .default) { _ in
if let githubURL = URL(string: "https://github.com/SideStore/SideStore/issues") {
let safariViewController = SFSafariViewController(url: githubURL)
safariViewController.preferredControlTintColor = .altPrimary
self.present(safariViewController, animated: true, completion: nil)
}
else
{
mailViewController.setSubject("SideStore Beta Feedback")
})

// Option 2: Discord
alertController.addAction(UIAlertAction(title: "Discord", style: .default) { _ in
if let discordURL = URL(string: "https://discord.gg/sidestore-949183273383395328") {
let safariViewController = SFSafariViewController(url: discordURL)
safariViewController.preferredControlTintColor = .altPrimary
self.present(safariViewController, animated: true, completion: nil)
}

self.present(mailViewController, animated: true, completion: nil)
}
else
{
let toastView = ToastView(text: NSLocalizedString("Cannot Send Mail", comment: ""), detailText: nil)
toastView.show(in: self)
})

// Option 3: Mail
alertController.addAction(UIAlertAction(title: "Mail", style: .default) { _ in
if MFMailComposeViewController.canSendMail() {
let mailViewController = MFMailComposeViewController()
mailViewController.mailComposeDelegate = self
mailViewController.setToRecipients(["[email protected]"])

if let version = Bundle.main.object(forInfoDictionaryKey: "CFBundleShortVersionString") as? String {
mailViewController.setSubject("SideStore Beta \(version) Feedback")
} else {
mailViewController.setSubject("SideStore Beta Feedback")
}

self.present(mailViewController, animated: true, completion: nil)
} else {
let toastView = ToastView(text: NSLocalizedString("Cannot Send Mail", comment: ""), detailText: nil)
toastView.show(in: self)
}
})

// Cancel action
alertController.addAction(UIAlertAction(title: "Cancel", style: .cancel, handler: nil))

// For iPad: Set the source view if presenting on iPad to avoid crashes
if let popoverController = alertController.popoverPresentationController {
popoverController.sourceView = self.view
popoverController.sourceRect = self.view.bounds
}

// Present the action sheet
self.present(alertController, animated: true, completion: nil)

case .refreshSideJITServer:
if #available(iOS 17, *) {
let alertController = UIAlertController(
Expand Down

0 comments on commit 19dde69

Please sign in to comment.