Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Add support for uploading crash reports to Sentry #2720

Merged
merged 40 commits into from
Apr 18, 2024
Merged

Conversation

ayoy
Copy link
Contributor

@ayoy ayoy commented Apr 11, 2024

Task/Issue URL: https://app.asana.com/0/72649045549333/1205862129634403/f

Description:
This change introduces uploading crash reports to DDG's Sentry instance. Users are prompted
to opt in to crash collection upon launching the app after it crashed. A user can decide either
to always send reports or never send them. A switch is added to Settings to control their preference.

Steps to test this PR:

  1. Install the ipa file uploaded to this Asana task.
  2. Identify as internal user.
  3. Go to Debug Menu -> Crash (fatal error)
  4. Relaunch the app
  5. Verify that you're being presented with a crash reporting dialog
  6. Verify that expanding and collapsing the dialog works as expected (note that there may be a delay/lag when rendering crash report data).
  7. Verify that if you close the dialog and crash the app again, the dialog reappears on the next app launch.
  8. Verify that if you choose "Always Send" or "Never Send", the dialog won't appear again after a subsequent crash.
  9. Select Debug Menu -> Reset Upload Crash Logs Prompt to have the dialog appear again as needed.

Copy Testing:

  • Use of correct apostrophes in new copy, ie rather than '

Orientation Testing:

  • Portrait
  • Landscape

Device Testing:

  • iPhone SE (1st Gen)
  • iPhone 8
  • iPhone X
  • iPhone 14 Pro
  • iPad

OS Testing:

  • iOS 14
  • iOS 15
  • iOS 16

Theme Testing:

  • Light theme
  • Dark theme

Internal references:

Software Engineering Expectations
Technical Design Template

@ayoy ayoy self-assigned this Apr 11, 2024
@github-actions github-actions bot added the bot: not in app board Added by automation for pull requests with tasks not added to iOS App Board Asana project label Apr 11, 2024
@ayoy ayoy removed the bot: not in app board Added by automation for pull requests with tasks not added to iOS App Board Asana project label Apr 11, 2024
Copy link

github-actions bot commented Apr 12, 2024

Warnings
⚠️ PR has more than 500 lines of code changing. Consider splitting into smaller PRs if possible.

Generated by 🚫 dangerJS against ec37502

@ayoy ayoy requested a review from samsymons April 12, 2024 14:25
@ayoy ayoy assigned samsymons and unassigned ayoy Apr 12, 2024
@ayoy ayoy marked this pull request as ready for review April 12, 2024 14:25
Comment on lines +64 to +75
ZStack {
Rectangle()
.foregroundColor(Color(designSystemColor: .container))
.frame(maxWidth: .infinity, maxHeight: .infinity)
.cornerRadius(4.0)

Text(reportDetails)
.multilineTextAlignment(.leading)
.font(.crashReport)
.foregroundColor(Color(designSystemColor: .textSecondary))
.padding(24)
}
Copy link
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

I was wondering whether it would make sense to put this in a scroll view which is horizontally scrollable since text wrapping can make it awkward to read, but TBH there's no right approach here – happy to leave this as-is.

Copy link
Contributor Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

That was my first idea and implementation, but we agreed with Bryan that it actually shouldn't be scrolled horizontally (see the discussion).

That said, the scroll view approach makes rendering faster (not fast, but faster) 🤷

VStack(spacing: 0) {
ScrollView {
VStack(spacing: 24) {
Image("Breakage-128")
Copy link
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

We could use Image(decorative:) here to make sure that VoiceOver API doesn't read the image name (it does this in the current implementation).

Copy link
Contributor Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Of course :) thanks for pointing that out :) I'll fix it right away.

Copy link
Contributor

@samsymons samsymons left a comment

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

LGTM, no blocking comments. The expansion of the crash report details was pretty slow on my iPhone X, but I don't think it's a blocker since this isn't a core flow and is only presented to the user once.

Nice work on this, really excited for it to ship!

CrashCollection.start {
Pixel.fire(pixel: .dbCrashDetected, withAdditionalParameters: $0, includedParameters: [])
crashCollection.start { pixelParameters, payloads, sendReport in
pixelParameters.forEach { params in
Copy link
Contributor Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Previously the callback was called for every crash report found. Now we have a single callback that can contain multiple crash reports. We still send pixels for all crash reports, and we present onboarding for Sentry as needed using the most recent crash report (this is the same behavior as on macOS for both DMG and App Store builds).

Comment on lines +64 to +75
ZStack {
Rectangle()
.foregroundColor(Color(designSystemColor: .container))
.frame(maxWidth: .infinity, maxHeight: .infinity)
.cornerRadius(4.0)

Text(reportDetails)
.multilineTextAlignment(.leading)
.font(.crashReport)
.foregroundColor(Color(designSystemColor: .textSecondary))
.padding(24)
}
Copy link
Contributor Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

That was my first idea and implementation, but we agreed with Bryan that it actually shouldn't be scrolled horizontally (see the discussion).

That said, the scroll view approach makes rendering faster (not fast, but faster) 🤷

@ayoy
Copy link
Contributor Author

ayoy commented Apr 16, 2024

Thanks for the review @samsymons! Yes, the crash report is very slow to load (also relatively slow on a modern device), but there's not much we can do about it. The slowness comes from the UI rendering, not from processing crash report payload – so it can't be offloaded to a background thread. Showing a spinner wouldn't really work either (or the spinner wouldn't spin).

The working solution would be to break the text into lines and load in a list with reusable cells but that's too much :) But as you said, it's only presented once to the user and also it's not a core flow.

@ayoy ayoy assigned ayoy and unassigned samsymons Apr 16, 2024
@ayoy ayoy merged commit 884e6dd into main Apr 18, 2024
13 checks passed
@ayoy ayoy deleted the dominik/sentry-appstore branch April 18, 2024 10:50
samsymons added a commit that referenced this pull request Apr 20, 2024
# By Daniel Bernal (11) and others
# Via Mariusz Śpiewak (3) and others
* main: (63 commits)
  Release 7.115.1-1 (#2770)
  Fix iOS auto-clearing fails to remove cookies (#2769)
  Release 7.115.1-0 (#2768)
  Fix iOS auto-clearing fails to remove cookies (#2767)
  iOS: VPN screen improvements (#2721)
  Release 7.116.0-2 (#2763)
  Remove "Thank You" prompt (#2762)
  Test to ensure that page refresh doesn't affect url bar focus (#2749)
  Add support for uploading crash reports to Sentry (#2720)
  Replace SwiftLintPlugin with SwiftLintTool (#2710)
  Release 7.116.0-1 (#2761)
  Remove validator app (#2754)
  Fix crash when quickly adding/removing tabs in switcher (#2760)
  Fix settings navigation bar colors after reopening (#2758)
  Alpha ad-hoc lane (#2492)
  Keep a weak reference to UserScriptMessageBroker (#2755)
  Add refresh config cell to top of debug (#2735)
  VPN: Replace available interfaces in VPN metadata (#2750)
  Require device auth to be set in order to use Sync (#2722)
  Add new iOS pixels for measuring navigation  (#2730)
  ...

# Conflicts:
#	DuckDuckGo.xcodeproj/project.pbxproj
#	DuckDuckGo/AppDelegate.swift
#	DuckDuckGo/MainViewController.swift
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

Successfully merging this pull request may close these issues.

None yet

3 participants