This repository has been archived by the owner on Feb 20, 2023. It is now read-only.
-
Notifications
You must be signed in to change notification settings - Fork 1.3k
Closes #1039: Adds crash reporting #1053
Merged
Merged
Changes from all commits
Commits
Show all changes
5 commits
Select commit
Hold shift + click to select a range
File filter
Filter by extension
Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
There are no files selected for viewing
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
56 changes: 56 additions & 0 deletions
56
app/src/main/java/org/mozilla/fenix/crashes/CrashReporterFragment.kt
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,56 @@ | ||
/* This Source Code Form is subject to the terms of the Mozilla Public | ||
* License, v. 2.0. If a copy of the MPL was not distributed with this | ||
* file, You can obtain one at http://mozilla.org/MPL/2.0/. */ | ||
|
||
package org.mozilla.fenix.crashes | ||
|
||
import android.os.Bundle | ||
import android.view.LayoutInflater | ||
import android.view.View | ||
import android.view.ViewGroup | ||
import androidx.fragment.app.Fragment | ||
import androidx.navigation.Navigation | ||
import kotlinx.android.synthetic.main.fragment_crash_reporter.* | ||
import mozilla.components.lib.crash.Crash | ||
import org.mozilla.fenix.R | ||
import org.mozilla.fenix.ext.requireComponents | ||
|
||
class CrashReporterFragment : Fragment() { | ||
override fun onCreateView( | ||
inflater: LayoutInflater, | ||
container: ViewGroup?, | ||
savedInstanceState: Bundle? | ||
): View? = inflater.inflate(R.layout.fragment_crash_reporter, container, false) | ||
|
||
override fun onViewCreated(view: View, savedInstanceState: Bundle?) { | ||
super.onViewCreated(view, savedInstanceState) | ||
|
||
val crashIntent = CrashReporterFragmentArgs.fromBundle(arguments!!).crashIntent | ||
|
||
val crash = Crash.fromIntent(CrashReporterFragmentArgs.fromBundle(arguments!!).crashIntent) | ||
// TODO TelemetryWrapper.crashReporterOpened() | ||
|
||
closeTabButton.setOnClickListener { | ||
val wantsToSubmitCrashReport = sendCrashCheckbox.isChecked | ||
val selectedSession = requireComponents.core.sessionManager.selectedSession | ||
|
||
selectedSession?.let { session -> requireComponents.useCases.tabsUseCases.removeTab.invoke(session) } | ||
// TODO TelemetryWrapper.crashReporterClosed(wantsSubmitCrashReport) | ||
|
||
if (wantsToSubmitCrashReport) { | ||
requireComponents.analytics.crashReporter.submitReport(crash) | ||
} | ||
|
||
navigateHome(view) | ||
} | ||
} | ||
|
||
fun navigateHome(fromView: View) { | ||
val directions = CrashReporterFragmentDirections.actionCrashReporterFragmentToHomeFragment() | ||
Navigation.findNavController(fromView).navigate(directions) | ||
} | ||
|
||
fun onBackPressed() { | ||
// TODO TelemetryWrapper.crashReporterClosed(false) | ||
} | ||
} |
Loading
Sorry, something went wrong. Reload?
Sorry, we cannot display this file.
Sorry, this file is invalid so it cannot be displayed.
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,99 @@ | ||
<?xml version="1.0" encoding="utf-8"?> | ||
<!-- This Source Code Form is subject to the terms of the Mozilla Public | ||
- License, v. 2.0. If a copy of the MPL was not distributed with this | ||
- file, You can obtain one at http://mozilla.org/MPL/2.0/. --> | ||
<androidx.constraintlayout.widget.ConstraintLayout | ||
xmlns:android="http://schemas.android.com/apk/res/android" | ||
xmlns:app="http://schemas.android.com/apk/res-auto" | ||
xmlns:tools="http://schemas.android.com/tools" | ||
android:layout_width="match_parent" | ||
android:layout_height="match_parent" | ||
android:background="@color/photonGrey10"> | ||
|
||
<ImageView | ||
android:id="@+id/crash_tab_image" | ||
android:layout_width="0dp" | ||
android:layout_height="0dp" | ||
android:layout_marginTop="8dp" | ||
There was a problem hiding this comment. Choose a reason for hiding this commentThe reason will be displayed to describe this comment to others. Learn more. Could we pull any of these values into dimens? |
||
android:src="@drawable/ic_error_session_crashed" | ||
app:layout_constraintEnd_toEndOf="parent" | ||
app:layout_constraintDimensionRatio="1:1" | ||
app:layout_constraintWidth_percent="0.6" | ||
app:layout_constraintStart_toStartOf="parent" | ||
app:layout_constraintTop_toTopOf="parent"/> | ||
|
||
<TextView | ||
android:id="@+id/title" | ||
android:layout_width="300dp" | ||
android:layout_height="wrap_content" | ||
android:layout_marginTop="12dp" | ||
android:lineSpacingExtra="8sp" | ||
android:singleLine="false" | ||
android:text="@string/tab_crash_title" | ||
android:textAlignment="center" | ||
android:textColor="@color/search_text" | ||
android:textSize="20sp" | ||
app:layout_constraintEnd_toEndOf="parent" | ||
app:layout_constraintStart_toStartOf="parent" | ||
app:layout_constraintTop_toBottomOf="@id/crash_tab_image" /> | ||
|
||
<TextView | ||
android:id="@+id/description" | ||
android:layout_width="300dp" | ||
android:layout_height="wrap_content" | ||
android:layout_marginTop="16dp" | ||
android:lineSpacingExtra="7sp" | ||
android:singleLine="false" | ||
android:text="@string/tab_crash_description" | ||
android:textColor="@color/search_text" | ||
android:textSize="15sp" | ||
app:layout_constraintEnd_toEndOf="parent" | ||
app:layout_constraintStart_toStartOf="parent" | ||
app:layout_constraintTop_toBottomOf="@id/title" /> | ||
|
||
<CheckBox | ||
android:id="@+id/sendCrashCheckbox" | ||
android:layout_width="0dp" | ||
android:layout_height="32dp" | ||
android:layout_marginBottom="@dimen/crash_reporter_close_tab_button_bottom_margin" | ||
android:buttonTint="@color/crash_page_accent" | ||
android:checked="true" | ||
android:text="@string/tab_crash_send_report" | ||
android:textColor="@color/search_text" | ||
android:textSize="15sp" | ||
app:layout_constraintBottom_toTopOf="@id/restoreTabButton" | ||
app:layout_constraintEnd_toEndOf="parent" | ||
app:layout_constraintStart_toStartOf="parent" | ||
app:layout_constraintWidth_percent="0.8" | ||
tools:text="@string/tab_crash_send_report" /> | ||
|
||
<Button | ||
android:id="@+id/restoreTabButton" | ||
android:layout_width="0dp" | ||
android:layout_height="wrap_content" | ||
android:layout_marginStart="@dimen/crash_reporter_close_tab_button_horizontal_margin" | ||
android:layout_marginEnd="@dimen/crash_reporter_close_tab_button_horizontal_margin" | ||
android:layout_marginBottom="@dimen/crash_reporter_close_tab_button_bottom_margin" | ||
android:backgroundTint="@color/crash_page_accent" | ||
android:text="@string/tab_crash_restore" | ||
android:textColor="@color/off_white" | ||
android:textSize="14sp" | ||
app:layout_constraintBottom_toBottomOf="parent" | ||
app:layout_constraintEnd_toEndOf="parent" | ||
app:layout_constraintWidth_percent="0.4" /> | ||
|
||
<Button | ||
android:id="@+id/closeTabButton" | ||
android:layout_width="0dp" | ||
android:layout_height="wrap_content" | ||
android:layout_marginStart="@dimen/crash_reporter_close_tab_button_horizontal_margin" | ||
android:layout_marginEnd="@dimen/crash_reporter_close_tab_button_horizontal_margin" | ||
android:layout_marginBottom="@dimen/crash_reporter_close_tab_button_bottom_margin" | ||
android:backgroundTint="@color/crash_page_off_accent" | ||
android:text="@string/tab_crash_close" | ||
android:textColor="@color/search_text" | ||
android:textSize="14sp" | ||
app:layout_constraintBottom_toBottomOf="parent" | ||
app:layout_constraintStart_toStartOf="parent" | ||
app:layout_constraintWidth_percent="0.4" /> | ||
</androidx.constraintlayout.widget.ConstraintLayout> |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Add this suggestion to a batch that can be applied as a single commit.
This suggestion is invalid because no changes were made to the code.
Suggestions cannot be applied while the pull request is closed.
Suggestions cannot be applied while viewing a subset of changes.
Only one suggestion per line can be applied in a batch.
Add this suggestion to a batch that can be applied as a single commit.
Applying suggestions on deleted lines is not supported.
You must change the existing code in this line in order to create a valid suggestion.
Outdated suggestions cannot be applied.
This suggestion has been applied or marked resolved.
Suggestions cannot be applied from pending reviews.
Suggestions cannot be applied on multi-line comments.
Suggestions cannot be applied while the pull request is queued to merge.
Suggestion cannot be applied right now. Please check back later.
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
nit - license