Skip to content

Commit

Permalink
[feat]: open crashes page on startup
Browse files Browse the repository at this point in the history
  • Loading branch information
F0x1d committed Jul 28, 2024
1 parent c613b8e commit f03a23f
Show file tree
Hide file tree
Showing 6 changed files with 19 additions and 0 deletions.
Original file line number Diff line number Diff line change
Expand Up @@ -91,6 +91,10 @@ class MainActivity: BaseViewModelActivity<MainViewModel, ActivityMainBinding>(),

viewModel.askedNotificationsPermission = true
}

if (savedInstanceState == null && viewModel.openCrashesOnStartup) {
navController.navigate(Directions.crashes)
}
}

override fun onPostCreate(savedInstanceState: Bundle?) {
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -24,6 +24,8 @@ class MainViewModel @Inject constructor(
get() = appPreferences.askedNotificationsPermission
set(value) { appPreferences.askedNotificationsPermission = value }

val openCrashesOnStartup get() = appPreferences.openCrashesOnStartup

init {
load()
}
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -51,6 +51,10 @@ class AppPreferences @Inject constructor(
set(value) { put("pref_time_format", value) }
val timeFormatFlow get() = flowSharedPreferences.getString("pref_time_format", TIME_FORMAT_DEFAULT).asFlow()

var openCrashesOnStartup
get() = get("pref_open_crashes_page_on_startup", false)
set(value) { put("pref_open_crashes_page_on_startup", value) }

var logsUpdateInterval
get() = get("pref_logs_update_interval", LOGS_UPDATE_INTERVAL_DEFAULT)
set(value) { put("pref_logs_update_interval", value) }
Expand Down
7 changes: 7 additions & 0 deletions feature/feature-settings/src/main/res/xml/settings_ui.xml
Original file line number Diff line number Diff line change
Expand Up @@ -29,6 +29,13 @@
app:iconSpaceReserved="false"
app:allowDividerAbove="false">

<SwitchPreferenceCompat
android:title="@string/open_crashes_page_on_startup"
android:key="pref_open_crashes_page_on_startup"
app:singleLineTitle="false"
app:widgetLayout="@layout/preference_material_switch"
app:iconSpaceReserved="false" />

<Preference
android:title="@string/logs_format"
android:key="pref_logs_format"
Expand Down
1 change: 1 addition & 0 deletions strings/src/main/res/values-ru/strings.xml
Original file line number Diff line number Diff line change
Expand Up @@ -152,4 +152,5 @@
<string name="sort_by_new">По новизне</string>
<string name="sort_by_count">По количеству сбоев</string>
<string name="use_separate_channels_for_crashes">Использовать разные каналы уведомлений для уведомлений о сбоях</string>
<string name="open_crashes_page_on_startup">Открывать вкладку сбоев при запуске</string>
</resources>
1 change: 1 addition & 0 deletions strings/src/main/res/values/strings.xml
Original file line number Diff line number Diff line change
Expand Up @@ -161,4 +161,5 @@
<string name="sort_by_new">By novelty</string>
<string name="sort_by_count">By crashes count</string>
<string name="use_separate_channels_for_crashes">Use separate notifications channels for crashes notifications</string>
<string name="open_crashes_page_on_startup">Open crashes page on startup</string>
</resources>

0 comments on commit f03a23f

Please sign in to comment.