Email Support Template

This commit is contained in:
Beingpax 2025-05-01 22:31:21 +05:45
parent a3418ff2c0
commit cf4eac4098
4 changed files with 89 additions and 51 deletions

View File

@ -0,0 +1,56 @@
import Foundation
import SwiftUI
import AppKit
struct EmailSupport {
static func generateSupportEmailURL() -> URL? {
let subject = "VoiceInk Support Request"
let systemInfo = """
App Version: \(Bundle.main.infoDictionary?["CFBundleShortVersionString"] as? String ?? "Unknown")
macOS Version: \(ProcessInfo.processInfo.operatingSystemVersionString)
Device: \(getMacModel())
"""
let body = """
------------------------
**SCREEN RECORDING HIGHLY RECOMMENDED**
Create a quick screen recording showing the issue!
It helps me understand and fix the problem much faster.
📝 ISSUE DETAILS:
- What steps did you take before the issue occurred?
- What did you expect to happen?
- What actually happened instead?
## 📋 COMMON ISSUES:
Check out our Common Issues page before sending an email: https://tryvoiceink.com/common-issues
------------------------
System Information:
\(systemInfo)
"""
let encodedSubject = subject.addingPercentEncoding(withAllowedCharacters: .urlQueryAllowed) ?? ""
let encodedBody = body.addingPercentEncoding(withAllowedCharacters: .urlQueryAllowed) ?? ""
return URL(string: "mailto:prakashjoshipax@gmail.com?subject=\(encodedSubject)&body=\(encodedBody)")
}
static func openSupportEmail() {
if let emailURL = generateSupportEmailURL() {
NSWorkspace.shared.open(emailURL)
}
}
private static func getMacModel() -> String {
var size = 0
sysctlbyname("hw.model", nil, &size, nil, 0)
var machine = [CChar](repeating: 0, count: size)
sysctlbyname("hw.model", &machine, &size, nil, 0)
return String(cString: machine)
}
}

View File

@ -83,9 +83,7 @@ struct LicenseManagementView: View {
.buttonStyle(.plain)
Button {
if let url = URL(string: "mailto:prakashjoshipax@gmail.com") {
NSWorkspace.shared.open(url)
}
EmailSupport.openSupportEmail()
} label: {
featureItem(icon: "envelope.fill", title: "Email Support", color: .orange)
}

View File

@ -188,7 +188,7 @@ struct MenuBarView: View {
.disabled(!updaterViewModel.canCheckForUpdates)
Button("Help and Support") {
openMailForSupport()
EmailSupport.openSupportEmail()
}
Divider()
@ -198,11 +198,4 @@ struct MenuBarView: View {
}
}
}
private func openMailForSupport() {
let subject = "VoiceInk Help & Support"
let encodedSubject = subject.addingPercentEncoding(withAllowedCharacters: .urlQueryAllowed) ?? ""
let mailtoURL = URL(string: "mailto:prakashjoshipax@gmail.com?subject=\(encodedSubject)")!
NSWorkspace.shared.open(mailtoURL)
}
}

View File

@ -94,7 +94,7 @@ struct TimeEfficiencyView: View {
HStack {
timeSavedView
Spacer()
discordCommunityLink
reportIssueButton
}
.padding(.horizontal, 24)
}
@ -112,48 +112,39 @@ struct TimeEfficiencyView: View {
}
}
private var discordCommunityLink: some View {
Link(destination: URL(string: "https://discord.gg/xryDy57nYD")!) {
VStack(alignment: .leading, spacing: 10) {
HStack(spacing: 12) {
Image(systemName: "ellipsis.message.fill")
.foregroundStyle(accentGradient)
.font(.system(size: 36))
VStack(alignment: .leading, spacing: 4) {
Text("Need Support?")
.font(.headline)
.fontWeight(.bold)
Text("Got Feature Ideas? We're Listening!")
.font(.subheadline)
.foregroundColor(.secondary)
}
}
private var reportIssueButton: some View {
Button(action: {
EmailSupport.openSupportEmail()
}) {
HStack(alignment: .center, spacing: 12) {
// Left icon
Image(systemName: "exclamationmark.bubble.fill")
.font(.system(size: 20, weight: .medium))
.foregroundStyle(.white)
HStack {
Text("JOIN DISCORD")
.font(.system(size: 14, weight: .bold))
.foregroundColor(.white)
.padding(.horizontal, 16)
.padding(.vertical, 8)
.background(Color.blue)
.cornerRadius(6)
Image(systemName: "chevron.right")
.foregroundColor(Color.blue.opacity(0.7))
}
// Center text
Text("Feedback or Issues?")
.font(.system(size: 13, weight: .medium))
.foregroundStyle(.white)
Spacer(minLength: 8)
// Right button
Text("Report")
.font(.system(size: 12, weight: .medium))
.foregroundColor(Color.accentColor)
.padding(.horizontal, 12)
.padding(.vertical, 4)
.background(Capsule().fill(.white))
}
.padding(14)
.background(
RoundedRectangle(cornerRadius: 8)
.fill(Color(nsColor: .controlBackgroundColor))
)
.overlay(
RoundedRectangle(cornerRadius: 8)
.stroke(Color.blue.opacity(0.2), lineWidth: 1)
)
.padding(.vertical, 10)
.padding(.horizontal, 12)
.background(accentGradient)
.cornerRadius(10)
}
.buttonStyle(.plain)
.shadow(color: Color.accentColor.opacity(0.2), radius: 3, y: 1)
.frame(maxWidth: 280)
}
private var efficiencyGradient: LinearGradient {