@@ -95,36 +95,42 @@ struct IssueReporter: View {
9595
9696 /// Open Amplify iOS issue logging screen on Github
9797 private func reportToGithub( ) {
98- let issueDescriptionMarkdown =
99- IssueInfoHelper . generateMarkdownForIssue (
100- issue: IssueInfo ( issueDescription: issueDescription,
101- includeEnvInfo: includeEnvInfo,
102- includeDeviceInfo: includeDeviceInfo) )
103-
104- let urlString = amplifyIosNewIssueUrl + issueDescriptionMarkdown
105- guard let url = urlString. addingPercentEncoding ( withAllowedCharacters: . urlQueryAllowed) else {
106- showAlertIfInvalidURL = true
107- return
108- }
109- guard let urlToOpen = URL ( string: url) else {
110- showAlertIfInvalidURL = true
111- return
98+ Task {
99+ let issue = await IssueInfo ( issueDescription: issueDescription,
100+ includeEnvInfo: includeEnvInfo,
101+ includeDeviceInfo: includeDeviceInfo)
102+ let issueDescriptionMarkdown =
103+ await IssueInfoHelper . generateMarkdownForIssue (
104+ issue: issue)
105+
106+ let urlString = amplifyIosNewIssueUrl + issueDescriptionMarkdown
107+ guard let url = urlString. addingPercentEncoding ( withAllowedCharacters: . urlQueryAllowed) else {
108+ showAlertIfInvalidURL = true
109+ return
110+ }
111+ guard let urlToOpen = URL ( string: url) else {
112+ showAlertIfInvalidURL = true
113+ return
114+ }
115+
116+ await UIApplication . shared. open ( urlToOpen)
112117 }
113118
114- UIApplication . shared. open ( urlToOpen)
115119 }
116120
117121 /// Copy issue as a markdown string to clipboard
118122 private func copyToClipboard( ) {
119- let issue = IssueInfo ( issueDescription: issueDescription,
120- includeEnvInfo: includeEnvInfo,
121- includeDeviceInfo: includeDeviceInfo)
122- let value = IssueInfoHelper . generateMarkdownForIssue ( issue: issue)
123- #if os(iOS)
124- UIPasteboard . general. string = value
125- #elseif canImport(AppKit)
126- NSPasteboard . general. setString ( value, forType: . string)
127- #endif
123+ Task {
124+ let issue = await IssueInfo ( issueDescription: issueDescription,
125+ includeEnvInfo: includeEnvInfo,
126+ includeDeviceInfo: includeDeviceInfo)
127+ let value = await IssueInfoHelper . generateMarkdownForIssue ( issue: issue)
128+ #if os(iOS)
129+ UIPasteboard . general. string = value
130+ #elseif canImport(AppKit)
131+ NSPasteboard . general. setString ( value, forType: . string)
132+ #endif
133+ }
128134 }
129135}
130136
@@ -166,6 +172,7 @@ final class MultilineTextField: UIViewRepresentable {
166172 return view
167173 }
168174
175+ @MainActor
169176 @objc func dismissKeyboard( ) {
170177 UIApplication . shared. sendAction ( #selector( UIResponder . resignFirstResponder) ,
171178 to: nil , from: nil , for: nil )
0 commit comments