mirror of
https://github.com/Novaloop-AG/element-x-ios.git
synced 2026-11-02 21:33:26 +00:00
Attach Screenshot in Bug Report Screen (#578)
* 127 Attach Screenshot in Bug Report Screen * #127 code improvement * #127 Code improvements, and changed the loading... label to sending... * using a statically defined identifier for the new defined ui element * added the RowLabelStyle and improved the design of the view * code improvement * code improvement * making alignment private * synthesised init
This commit is contained in:
@@ -43,6 +43,8 @@ class BugReportViewModel: BugReportViewModelType, BugReportViewModelProtocol {
|
||||
await submitBugReport()
|
||||
case .removeScreenshot:
|
||||
state.screenshot = nil
|
||||
case let .attachScreenshot(image):
|
||||
state.screenshot = image
|
||||
}
|
||||
}
|
||||
|
||||
@@ -52,11 +54,18 @@ class BugReportViewModel: BugReportViewModelType, BugReportViewModelProtocol {
|
||||
let progressTracker = ProgressTracker()
|
||||
callback?(.submitStarted(progressTracker: progressTracker))
|
||||
do {
|
||||
var files: [URL] = []
|
||||
if let screenshot = context.viewState.screenshot {
|
||||
let imageURL = URL.temporaryDirectory.appendingPathComponent("Screenshot.png")
|
||||
let pngData = screenshot.pngData()
|
||||
try pngData?.write(to: imageURL)
|
||||
files.append(imageURL)
|
||||
}
|
||||
let bugReport = BugReport(text: context.reportText,
|
||||
includeLogs: context.sendingLogsEnabled,
|
||||
includeCrashLog: true,
|
||||
githubLabels: [],
|
||||
files: [])
|
||||
files: files)
|
||||
let result = try await bugReportService.submitBugReport(bugReport,
|
||||
progressListener: progressTracker)
|
||||
MXLog.info("SubmitBugReport succeeded, result: \(result.reportUrl)")
|
||||
|
||||
Reference in New Issue
Block a user