@@ -95,36 +95,42 @@ struct IssueReporter: View {
95
95
96
96
/// Open Amplify iOS issue logging screen on Github
97
97
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)
112
117
}
113
118
114
- UIApplication . shared. open ( urlToOpen)
115
119
}
116
120
117
121
/// Copy issue as a markdown string to clipboard
118
122
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
+ }
128
134
}
129
135
}
130
136
@@ -166,6 +172,7 @@ final class MultilineTextField: UIViewRepresentable {
166
172
return view
167
173
}
168
174
175
+ @MainActor
169
176
@objc func dismissKeyboard( ) {
170
177
UIApplication . shared. sendAction ( #selector( UIResponder . resignFirstResponder) ,
171
178
to: nil , from: nil , for: nil )
0 commit comments