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
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
Browse files
Browse the repository at this point in the history
* For #1039: Small cleanup * Closes #1039: Adds crash reporting * Add images * Adds build settings back * Fix nits
- Loading branch information
Showing
10 changed files
with
230 additions
and
7 deletions.
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" | ||
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