diff --git a/ElementX/Sources/Other/AccessibilityIdentifiers.swift b/ElementX/Sources/Other/AccessibilityIdentifiers.swift index 1c9a3bea3..e2637d10b 100644 --- a/ElementX/Sources/Other/AccessibilityIdentifiers.swift +++ b/ElementX/Sources/Other/AccessibilityIdentifiers.swift @@ -45,6 +45,7 @@ struct A11yIdentifiers { struct BugReportScreen { let report = "bug_report-report" let sendLogs = "bug_report-send_logs" + let canContact = "bug_report-can_contact" let screenshot = "bug_report-screenshot" let removeScreenshot = "bug_report-remove_screenshot" let attachScreenshot = "bug-report-attach_screenshot" diff --git a/ElementX/Sources/Screens/BugReportScreen/BugReportScreenModels.swift b/ElementX/Sources/Screens/BugReportScreen/BugReportScreenModels.swift index e07975838..78e27ed6e 100644 --- a/ElementX/Sources/Screens/BugReportScreen/BugReportScreenModels.swift +++ b/ElementX/Sources/Screens/BugReportScreen/BugReportScreenModels.swift @@ -33,6 +33,7 @@ struct BugReportScreenViewState: BindableState { struct BugReportScreenViewStateBindings { var reportText: String var sendingLogsEnabled: Bool + var canContact: Bool } enum BugReportScreenViewAction { diff --git a/ElementX/Sources/Screens/BugReportScreen/BugReportScreenViewModel.swift b/ElementX/Sources/Screens/BugReportScreen/BugReportScreenViewModel.swift index 59f7e0fba..81b8f93cc 100644 --- a/ElementX/Sources/Screens/BugReportScreen/BugReportScreenViewModel.swift +++ b/ElementX/Sources/Screens/BugReportScreen/BugReportScreenViewModel.swift @@ -38,7 +38,7 @@ class BugReportScreenViewModel: BugReportScreenViewModelType, BugReportScreenVie self.userID = userID self.deviceID = deviceID - let bindings = BugReportScreenViewStateBindings(reportText: "", sendingLogsEnabled: true) + let bindings = BugReportScreenViewStateBindings(reportText: "", sendingLogsEnabled: true, canContact: false) super.init(initialViewState: BugReportScreenViewState(screenshot: screenshot, bindings: bindings, isModallyPresented: isModallyPresented)) @@ -84,6 +84,7 @@ class BugReportScreenViewModel: BugReportScreenViewModelType, BugReportScreenVie text: context.reportText, includeLogs: context.sendingLogsEnabled, includeCrashLog: true, + canContact: context.canContact, githubLabels: [], files: files) diff --git a/ElementX/Sources/Screens/BugReportScreen/View/BugReportScreen.swift b/ElementX/Sources/Screens/BugReportScreen/View/BugReportScreen.swift index 2a860b74e..820044363 100644 --- a/ElementX/Sources/Screens/BugReportScreen/View/BugReportScreen.swift +++ b/ElementX/Sources/Screens/BugReportScreen/View/BugReportScreen.swift @@ -26,10 +26,9 @@ struct BugReportScreen: View { var body: some View { Form { textFieldSection - attachScreenshotSection - sendLogsSection + canContactSection } .scrollDismissesKeyboard(.immediately) .compoundForm() @@ -77,6 +76,18 @@ struct BugReportScreen: View { .compoundFormSection() } + private var canContactSection: some View { + Section { + Toggle(L10n.screenBugReportContactMeTitle, isOn: $context.canContact) + .toggleStyle(.compoundForm) + .accessibilityIdentifier(A11yIdentifiers.bugReportScreen.canContact) + } footer: { + Text(L10n.screenBugReportContactMe) + .compoundFormSectionFooter() + } + .compoundFormSection() + } + @ViewBuilder private var attachScreenshotSection: some View { Section { diff --git a/ElementX/Sources/Services/BugReport/BugReportService.swift b/ElementX/Sources/Services/BugReport/BugReportService.swift index b19264067..ac4ff8d63 100644 --- a/ElementX/Sources/Services/BugReport/BugReportService.swift +++ b/ElementX/Sources/Services/BugReport/BugReportService.swift @@ -103,7 +103,8 @@ class BugReportService: NSObject, BugReportServiceProtocol { progressListener: CurrentValueSubject) async -> Result { var params = [ MultipartFormData(key: "user_id", type: .text(value: bugReport.userID)), - MultipartFormData(key: "text", type: .text(value: bugReport.text)) + MultipartFormData(key: "text", type: .text(value: bugReport.text)), + MultipartFormData(key: "can_contact", type: .text(value: "\(bugReport.canContact)")) ] if let deviceID = bugReport.deviceID { diff --git a/ElementX/Sources/Services/BugReport/BugReportServiceProtocol.swift b/ElementX/Sources/Services/BugReport/BugReportServiceProtocol.swift index d48e56b76..802e1e6ed 100644 --- a/ElementX/Sources/Services/BugReport/BugReportServiceProtocol.swift +++ b/ElementX/Sources/Services/BugReport/BugReportServiceProtocol.swift @@ -24,6 +24,7 @@ struct BugReport: Equatable { let text: String let includeLogs: Bool let includeCrashLog: Bool + let canContact: Bool let githubLabels: [String] let files: [URL] } diff --git a/UITests/Sources/BugReportUITests.swift b/UITests/Sources/BugReportUITests.swift index 173f6332f..0be8ff82e 100644 --- a/UITests/Sources/BugReportUITests.swift +++ b/UITests/Sources/BugReportUITests.swift @@ -32,11 +32,13 @@ class BugReportUITests: XCTestCase { // Type 4 characters and the send button should be disabled. app.textViews[A11yIdentifiers.bugReportScreen.report].clearAndTypeText("Text") XCTAssert(app.switches[A11yIdentifiers.bugReportScreen.sendLogs].isOn) + XCTAssert(!app.switches[A11yIdentifiers.bugReportScreen.canContact].isOn) try await app.assertScreenshot(.bugReport, step: 2) // Type more than 4 characters and send the button should become enabled. app.textViews[A11yIdentifiers.bugReportScreen.report].clearAndTypeText("Longer text") XCTAssert(app.switches[A11yIdentifiers.bugReportScreen.sendLogs].isOn) + XCTAssert(!app.switches[A11yIdentifiers.bugReportScreen.canContact].isOn) try await app.assertScreenshot(.bugReport, step: 3) } diff --git a/UITests/Sources/__Snapshots__/Application/en-GB-iPad-9th-generation.bugReport-0.png b/UITests/Sources/__Snapshots__/Application/en-GB-iPad-9th-generation.bugReport-0.png index 942cdc3dd..d42855284 100644 --- a/UITests/Sources/__Snapshots__/Application/en-GB-iPad-9th-generation.bugReport-0.png +++ b/UITests/Sources/__Snapshots__/Application/en-GB-iPad-9th-generation.bugReport-0.png @@ -1,3 +1,3 @@ version https://git-lfs.github.com/spec/v1 -oid sha256:91fa2db4be815bce136476867ba1d0026b4ebd55d2d6a38d2e696b0d5b426376 -size 112889 +oid sha256:70935aa783ef9392f8a1160fb68af5b7bf16dea9709ce1a5f049bcf6276309f1 +size 126496 diff --git a/UITests/Sources/__Snapshots__/Application/en-GB-iPad-9th-generation.bugReport-2.png b/UITests/Sources/__Snapshots__/Application/en-GB-iPad-9th-generation.bugReport-2.png index 365d7fcfd..54aab36cf 100644 --- a/UITests/Sources/__Snapshots__/Application/en-GB-iPad-9th-generation.bugReport-2.png +++ b/UITests/Sources/__Snapshots__/Application/en-GB-iPad-9th-generation.bugReport-2.png @@ -1,3 +1,3 @@ version https://git-lfs.github.com/spec/v1 -oid sha256:a7eef4aaf57e32e59fb8657dc963695297bb96ba2c9c6865965f5bcabc572e4a -size 179988 +oid sha256:16e201d435c12a555bbee2746ebc35f011c6d2bb3a20bacf87c3341f1b5b0229 +size 194229 diff --git a/UITests/Sources/__Snapshots__/Application/en-GB-iPad-9th-generation.bugReport-3.png b/UITests/Sources/__Snapshots__/Application/en-GB-iPad-9th-generation.bugReport-3.png index adbd7c801..b505bb43e 100644 --- a/UITests/Sources/__Snapshots__/Application/en-GB-iPad-9th-generation.bugReport-3.png +++ b/UITests/Sources/__Snapshots__/Application/en-GB-iPad-9th-generation.bugReport-3.png @@ -1,3 +1,3 @@ version https://git-lfs.github.com/spec/v1 -oid sha256:2c650cc5cb2e4d206cdebb9b8c310792f2c75a3e933e33bc6a5d40dcc7299b97 -size 186963 +oid sha256:d1eb3e91e264f86c6e9cded9159bbce88bd4bbe50242a609c37b514fdc2b0590 +size 201099 diff --git a/UITests/Sources/__Snapshots__/Application/en-GB-iPad-9th-generation.bugReportWithScreenshot.png b/UITests/Sources/__Snapshots__/Application/en-GB-iPad-9th-generation.bugReportWithScreenshot.png index b18d52a8d..9a65aef63 100644 --- a/UITests/Sources/__Snapshots__/Application/en-GB-iPad-9th-generation.bugReportWithScreenshot.png +++ b/UITests/Sources/__Snapshots__/Application/en-GB-iPad-9th-generation.bugReportWithScreenshot.png @@ -1,3 +1,3 @@ version https://git-lfs.github.com/spec/v1 -oid sha256:ff279aff4d3506bdd4c22135408e222dd63d6e9844e3f48b5a12addaad8e1006 -size 123928 +oid sha256:6ee871f1bbee6b3b9208880b6d5b5da72422ffde72c6131dbaec96422b576caa +size 137938 diff --git a/UITests/Sources/__Snapshots__/Application/en-GB-iPhone-14.bugReport-0.png b/UITests/Sources/__Snapshots__/Application/en-GB-iPhone-14.bugReport-0.png index 51e1dc608..7bfc52c01 100644 --- a/UITests/Sources/__Snapshots__/Application/en-GB-iPhone-14.bugReport-0.png +++ b/UITests/Sources/__Snapshots__/Application/en-GB-iPhone-14.bugReport-0.png @@ -1,3 +1,3 @@ version https://git-lfs.github.com/spec/v1 -oid sha256:b2f9a2de429cf6a1d090553f92848523208d7d9691069c17e96fab746d5f4372 -size 145973 +oid sha256:75b4447894f5d3b8278c6118dc41f7c99efa5626491894d0ab287ff89af7f9ef +size 166816 diff --git a/UITests/Sources/__Snapshots__/Application/en-GB-iPhone-14.bugReport-2.png b/UITests/Sources/__Snapshots__/Application/en-GB-iPhone-14.bugReport-2.png index d746dd301..fb7af345c 100644 --- a/UITests/Sources/__Snapshots__/Application/en-GB-iPhone-14.bugReport-2.png +++ b/UITests/Sources/__Snapshots__/Application/en-GB-iPhone-14.bugReport-2.png @@ -1,3 +1,3 @@ version https://git-lfs.github.com/spec/v1 -oid sha256:bb24e61058620e4eb0746800805a9250aa219ad02a98b0f6640a583c6050cc68 -size 203891 +oid sha256:6ab050acaee21d58c9afcf68fa7ee861c4d67cd87156aaf46f299ce23c49790d +size 210535 diff --git a/UITests/Sources/__Snapshots__/Application/en-GB-iPhone-14.bugReport-3.png b/UITests/Sources/__Snapshots__/Application/en-GB-iPhone-14.bugReport-3.png index ba9d3b3d1..31db17c50 100644 --- a/UITests/Sources/__Snapshots__/Application/en-GB-iPhone-14.bugReport-3.png +++ b/UITests/Sources/__Snapshots__/Application/en-GB-iPhone-14.bugReport-3.png @@ -1,3 +1,3 @@ version https://git-lfs.github.com/spec/v1 -oid sha256:8c394a15f13a0061b519ed3671ee36621dd641e6f8744a23070c96c94f44916f -size 209242 +oid sha256:e47165276d97ab3f740508db22c7cea02c9de7954eb4d556870242521a8271b3 +size 219096 diff --git a/UITests/Sources/__Snapshots__/Application/en-GB-iPhone-14.bugReportWithScreenshot.png b/UITests/Sources/__Snapshots__/Application/en-GB-iPhone-14.bugReportWithScreenshot.png index 7d79ed6b9..a6b349596 100644 --- a/UITests/Sources/__Snapshots__/Application/en-GB-iPhone-14.bugReportWithScreenshot.png +++ b/UITests/Sources/__Snapshots__/Application/en-GB-iPhone-14.bugReportWithScreenshot.png @@ -1,3 +1,3 @@ version https://git-lfs.github.com/spec/v1 -oid sha256:e58b19c9f9b9b96787c8b016e2ecd3e154a300db9f87425cda2fd356eed9dbdb -size 159723 +oid sha256:55f92756942d4a336258c2b3f46eec47561f1a2e3dd1265756fdeb7c66c54205 +size 181095 diff --git a/UITests/Sources/__Snapshots__/Application/pseudo-iPad-9th-generation.bugReport-0.png b/UITests/Sources/__Snapshots__/Application/pseudo-iPad-9th-generation.bugReport-0.png index 14074bb31..459846b2f 100644 --- a/UITests/Sources/__Snapshots__/Application/pseudo-iPad-9th-generation.bugReport-0.png +++ b/UITests/Sources/__Snapshots__/Application/pseudo-iPad-9th-generation.bugReport-0.png @@ -1,3 +1,3 @@ version https://git-lfs.github.com/spec/v1 -oid sha256:854024a9b590fb08d3b931751581a39ac43c6ea42ac0d70da7d6885a0d1b7dc3 -size 142990 +oid sha256:c807972e64f0977aca1a0db35ecbeda82aaf6452889473a9dcc197b6e976f757 +size 160832 diff --git a/UITests/Sources/__Snapshots__/Application/pseudo-iPad-9th-generation.bugReport-2.png b/UITests/Sources/__Snapshots__/Application/pseudo-iPad-9th-generation.bugReport-2.png index e36d5b562..444173947 100644 --- a/UITests/Sources/__Snapshots__/Application/pseudo-iPad-9th-generation.bugReport-2.png +++ b/UITests/Sources/__Snapshots__/Application/pseudo-iPad-9th-generation.bugReport-2.png @@ -1,3 +1,3 @@ version https://git-lfs.github.com/spec/v1 -oid sha256:d7787d75a219b2dbdd451cce93706f921c798f7f2babfe297ebd12f547b6e959 -size 209561 +oid sha256:fd33425f8f03217992dbe5a9b8f5356c23c6360cabbe880f696d95eb1dd80049 +size 226953 diff --git a/UITests/Sources/__Snapshots__/Application/pseudo-iPad-9th-generation.bugReport-3.png b/UITests/Sources/__Snapshots__/Application/pseudo-iPad-9th-generation.bugReport-3.png index 4ad281a71..82daaa69b 100644 --- a/UITests/Sources/__Snapshots__/Application/pseudo-iPad-9th-generation.bugReport-3.png +++ b/UITests/Sources/__Snapshots__/Application/pseudo-iPad-9th-generation.bugReport-3.png @@ -1,3 +1,3 @@ version https://git-lfs.github.com/spec/v1 -oid sha256:966fe21fd6f8b54bcec71acbf66f073dc40645536ed30080edeab0c6fb9c23b6 -size 215546 +oid sha256:bf757b59634c398a83226d31292c5667c74493434c7e3aea00b6dac73270b1e8 +size 232739 diff --git a/UITests/Sources/__Snapshots__/Application/pseudo-iPad-9th-generation.bugReportWithScreenshot.png b/UITests/Sources/__Snapshots__/Application/pseudo-iPad-9th-generation.bugReportWithScreenshot.png index 7bfe2978a..391244750 100644 --- a/UITests/Sources/__Snapshots__/Application/pseudo-iPad-9th-generation.bugReportWithScreenshot.png +++ b/UITests/Sources/__Snapshots__/Application/pseudo-iPad-9th-generation.bugReportWithScreenshot.png @@ -1,3 +1,3 @@ version https://git-lfs.github.com/spec/v1 -oid sha256:86f359ef40188f70a40345abea9421a4066c7fe0ae9c0e18fa3ec71b6ae12fa2 -size 153047 +oid sha256:05aaadb39c04411e8d6aec7d486e59a22dd2995245fadbe7605faf7288f1daa8 +size 169803 diff --git a/UITests/Sources/__Snapshots__/Application/pseudo-iPhone-14.bugReport-0.png b/UITests/Sources/__Snapshots__/Application/pseudo-iPhone-14.bugReport-0.png index 9ded3c9f9..f4e6ec1d5 100644 --- a/UITests/Sources/__Snapshots__/Application/pseudo-iPhone-14.bugReport-0.png +++ b/UITests/Sources/__Snapshots__/Application/pseudo-iPhone-14.bugReport-0.png @@ -1,3 +1,3 @@ version https://git-lfs.github.com/spec/v1 -oid sha256:9f815b83498f64348db9171f4c188231d5e7baf1f6d6a9b67d77761427073be7 -size 204713 +oid sha256:0a56b27e07517a4492fde3e838ee817f511b05d47c40f98ca9eecc2134735817 +size 235551 diff --git a/UITests/Sources/__Snapshots__/Application/pseudo-iPhone-14.bugReport-2.png b/UITests/Sources/__Snapshots__/Application/pseudo-iPhone-14.bugReport-2.png index a11029e23..067f607cf 100644 --- a/UITests/Sources/__Snapshots__/Application/pseudo-iPhone-14.bugReport-2.png +++ b/UITests/Sources/__Snapshots__/Application/pseudo-iPhone-14.bugReport-2.png @@ -1,3 +1,3 @@ version https://git-lfs.github.com/spec/v1 -oid sha256:c6edbff1d9a1aeef4d1eb24e7a8e8ded8be34e169538f92679f30445533ea2eb -size 215565 +oid sha256:5ded0d89aaaa438e2f7627e01ba763fcce9c5c50323625367f3c1c6807287564 +size 220367 diff --git a/UITests/Sources/__Snapshots__/Application/pseudo-iPhone-14.bugReport-3.png b/UITests/Sources/__Snapshots__/Application/pseudo-iPhone-14.bugReport-3.png index 3ac1e49ac..9619f633f 100644 --- a/UITests/Sources/__Snapshots__/Application/pseudo-iPhone-14.bugReport-3.png +++ b/UITests/Sources/__Snapshots__/Application/pseudo-iPhone-14.bugReport-3.png @@ -1,3 +1,3 @@ version https://git-lfs.github.com/spec/v1 -oid sha256:7cf2c6ee69ac19781a2c56196c4e41c4c7b002726d56cbe272378b6b675c3a79 -size 221016 +oid sha256:e93c55f85674a2698d8d8569dc86b49c2b7a474b4398b480d0188789984b06fb +size 225752 diff --git a/UITests/Sources/__Snapshots__/Application/pseudo-iPhone-14.bugReportWithScreenshot.png b/UITests/Sources/__Snapshots__/Application/pseudo-iPhone-14.bugReportWithScreenshot.png index 22c34487b..d053f356f 100644 --- a/UITests/Sources/__Snapshots__/Application/pseudo-iPhone-14.bugReportWithScreenshot.png +++ b/UITests/Sources/__Snapshots__/Application/pseudo-iPhone-14.bugReportWithScreenshot.png @@ -1,3 +1,3 @@ version https://git-lfs.github.com/spec/v1 -oid sha256:a9ef30447288fadd2b27dfced005d848cd1229ca1ce07a4253f96dbe027fa443 -size 211129 +oid sha256:ef8aaf01bff6866112fa5c34c53cce291811be26a12c6ec16011a92987074cb5 +size 239739 diff --git a/UnitTests/Sources/BugReportServiceTests.swift b/UnitTests/Sources/BugReportServiceTests.swift index d7a28e22c..52a1f1d08 100644 --- a/UnitTests/Sources/BugReportServiceTests.swift +++ b/UnitTests/Sources/BugReportServiceTests.swift @@ -39,6 +39,7 @@ class BugReportServiceTests: XCTestCase { text: "i cannot send message", includeLogs: true, includeCrashLog: true, + canContact: false, githubLabels: [], files: []) let progressSubject = CurrentValueSubject(0.0) @@ -67,6 +68,7 @@ class BugReportServiceTests: XCTestCase { text: "i cannot send message", includeLogs: true, includeCrashLog: true, + canContact: false, githubLabels: [], files: []) let progressSubject = CurrentValueSubject(0.0) diff --git a/UnitTests/Sources/BugReportViewModelTests.swift b/UnitTests/Sources/BugReportViewModelTests.swift index 2ce60b07f..c9ccf4547 100644 --- a/UnitTests/Sources/BugReportViewModelTests.swift +++ b/UnitTests/Sources/BugReportViewModelTests.swift @@ -84,7 +84,7 @@ class BugReportViewModelTests: XCTestCase { } XCTAssert(mockService.submitBugReportProgressListenerCallsCount == 1) - XCTAssert(mockService.submitBugReportProgressListenerReceivedArguments?.bugReport == BugReport(userID: "@mock.client.com", deviceID: nil, text: "", includeLogs: true, includeCrashLog: true, githubLabels: [], files: [])) + XCTAssert(mockService.submitBugReportProgressListenerReceivedArguments?.bugReport == BugReport(userID: "@mock.client.com", deviceID: nil, text: "", includeLogs: true, includeCrashLog: true, canContact: false, githubLabels: [], files: [])) } func testSendReportWithError() async throws { @@ -110,6 +110,6 @@ class BugReportViewModelTests: XCTestCase { } XCTAssert(mockService.submitBugReportProgressListenerCallsCount == 1) - XCTAssert(mockService.submitBugReportProgressListenerReceivedArguments?.bugReport == BugReport(userID: "@mock.client.com", deviceID: nil, text: "", includeLogs: true, includeCrashLog: true, githubLabels: [], files: [])) + XCTAssert(mockService.submitBugReportProgressListenerReceivedArguments?.bugReport == BugReport(userID: "@mock.client.com", deviceID: nil, text: "", includeLogs: true, includeCrashLog: true, canContact: false, githubLabels: [], files: [])) } } diff --git a/changelog.d/1299.feature b/changelog.d/1299.feature new file mode 100644 index 000000000..3f16a3500 --- /dev/null +++ b/changelog.d/1299.feature @@ -0,0 +1 @@ +Contact Me switch added to the Bug Report screen. \ No newline at end of file