Skip to content

Commit ec17d19

Browse files
committed
remove setting to show calendar button on the records tab
1 parent ed0cfec commit ec17d19

File tree

36 files changed

+11
-115
lines changed

36 files changed

+11
-115
lines changed

app/src/androidTest/java/com/example/util/simpletimetracker/RecordsOptionsTest.kt

Lines changed: 0 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -16,7 +16,6 @@ import com.example.util.simpletimetracker.utils.clickOnViewWithId
1616
import com.example.util.simpletimetracker.utils.clickOnViewWithText
1717
import com.example.util.simpletimetracker.utils.tryAction
1818
import dagger.hilt.android.testing.HiltAndroidTest
19-
import kotlinx.coroutines.runBlocking
2019
import org.hamcrest.CoreMatchers.allOf
2120
import org.junit.Test
2221
import org.junit.runner.RunWith
@@ -326,7 +325,6 @@ class RecordsOptionsTest : BaseUiTest() {
326325
val name = "Test"
327326

328327
// Add data
329-
runBlocking { prefsInteractor.setShowCalendarButtonOnRecordsTab(true) }
330328
testUtils.addActivity(name = name)
331329
testUtils.addRecord(name)
332330

app/src/androidTest/java/com/example/util/simpletimetracker/SettingsTest.kt

Lines changed: 0 additions & 38 deletions
Original file line numberDiff line numberDiff line change
@@ -2322,44 +2322,6 @@ class SettingsTest : BaseUiTest() {
23222322
checkViewIsDisplayed(allOf(withText(coreR.string.title_today), isCompletelyDisplayed()))
23232323
}
23242324

2325-
@Test
2326-
fun showCalendarSwitchOnTheSameTab() {
2327-
// Check setting
2328-
NavUtils.openSettingsScreen()
2329-
NavUtils.openSettingsDisplay()
2330-
scrollSettingsRecyclerToText(coreR.string.settings_show_calendar_button_on_records_tab)
2331-
checkCheckboxIsNotChecked(settingsCheckboxBesideText(coreR.string.settings_show_calendar_button_on_records_tab))
2332-
2333-
// Check not shown
2334-
NavUtils.openRecordsScreen()
2335-
clickOnViewWithId(recordsR.id.btnRecordAdd)
2336-
checkViewDoesNotExist(withText(R.string.records_switch_to_calendar))
2337-
pressBack()
2338-
2339-
// Change settings
2340-
NavUtils.openSettingsScreen()
2341-
scrollSettingsRecyclerToText(coreR.string.settings_show_calendar_button_on_records_tab)
2342-
clickOnSettingsCheckboxBesideText(coreR.string.settings_show_calendar_button_on_records_tab)
2343-
checkCheckboxIsChecked(settingsCheckboxBesideText(coreR.string.settings_show_calendar_button_on_records_tab))
2344-
2345-
// Check shown
2346-
NavUtils.openRecordsScreen()
2347-
clickOnViewWithId(recordsR.id.btnRecordAdd)
2348-
checkViewIsDisplayed(withText(R.string.records_switch_to_calendar))
2349-
pressBack()
2350-
2351-
// Change back
2352-
NavUtils.openSettingsScreen()
2353-
scrollSettingsRecyclerToText(coreR.string.settings_show_calendar_button_on_records_tab)
2354-
clickOnSettingsCheckboxBesideText(coreR.string.settings_show_calendar_button_on_records_tab)
2355-
checkCheckboxIsNotChecked(settingsCheckboxBesideText(coreR.string.settings_show_calendar_button_on_records_tab))
2356-
2357-
// Check not shown
2358-
NavUtils.openRecordsScreen()
2359-
clickOnViewWithId(recordsR.id.btnRecordAdd)
2360-
checkViewDoesNotExist(withText(R.string.records_switch_to_calendar))
2361-
}
2362-
23632325
@Test
23642326
fun keepStatisticsRange() {
23652327
val name = "Test"

data_local/src/main/java/com/example/util/simpletimetracker/data_local/backup/BackupPrefsRepo.kt

Lines changed: 0 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -57,7 +57,6 @@ import com.example.util.simpletimetracker.data_local.prefs.PrefsRepoImpl.Compani
5757
import com.example.util.simpletimetracker.data_local.prefs.PrefsRepoImpl.Companion.KEY_REVERSE_ORDER_IN_CALENDAR
5858
import com.example.util.simpletimetracker.data_local.prefs.PrefsRepoImpl.Companion.KEY_SELECTED_PREDEFINED_FILTERS
5959
import com.example.util.simpletimetracker.data_local.prefs.PrefsRepoImpl.Companion.KEY_SHOW_ACTIVITY_FILTERS
60-
import com.example.util.simpletimetracker.data_local.prefs.PrefsRepoImpl.Companion.KEY_SHOW_CALENDAR_BUTTON_ON_RECORDS_TAB
6160
import com.example.util.simpletimetracker.data_local.prefs.PrefsRepoImpl.Companion.KEY_SHOW_CATEGORIES_AS_PREDEFINED_FILTERS
6261
import com.example.util.simpletimetracker.data_local.prefs.PrefsRepoImpl.Companion.KEY_SHOW_COMMENT_INPUT
6362
import com.example.util.simpletimetracker.data_local.prefs.PrefsRepoImpl.Companion.KEY_SHOW_COMMENT_INPUT_EXCLUDE_ACTIVITIES
@@ -180,7 +179,6 @@ class BackupPrefsRepo @Inject constructor(
180179
PrefsProcessor(KEY_SHOW_UNTRACKED_IN_RECORDS, ::showUntrackedInRecords),
181180
PrefsProcessor(KEY_SHOW_UNTRACKED_IN_STATISTICS, ::showUntrackedInStatistics),
182181
PrefsProcessor(KEY_SHOW_RECORDS_CALENDAR, ::showRecordsCalendar),
183-
PrefsProcessor(KEY_SHOW_CALENDAR_BUTTON_ON_RECORDS_TAB, ::showCalendarButtonOnRecordsTab),
184182
PrefsProcessor(KEY_REVERSE_ORDER_IN_CALENDAR, ::reverseOrderInCalendar),
185183
PrefsProcessor(KEY_DAYS_IN_CALENDAR, ::daysInCalendar),
186184
PrefsProcessor(KEY_SHOW_ACTIVITY_FILTERS, ::showActivityFilters),

data_local/src/main/java/com/example/util/simpletimetracker/data_local/prefs/PrefsRepoImpl.kt

Lines changed: 1 addition & 5 deletions
Original file line numberDiff line numberDiff line change
@@ -169,10 +169,6 @@ class PrefsRepoImpl @Inject constructor(
169169
KEY_SHOW_RECORDS_CALENDAR, false,
170170
)
171171

172-
override var showCalendarButtonOnRecordsTab: Boolean by prefs.delegate(
173-
KEY_SHOW_CALENDAR_BUTTON_ON_RECORDS_TAB, false,
174-
)
175-
176172
override var reverseOrderInCalendar: Boolean by prefs.delegate(
177173
KEY_REVERSE_ORDER_IN_CALENDAR, false,
178174
)
@@ -646,7 +642,6 @@ class PrefsRepoImpl @Inject constructor(
646642
const val KEY_SHOW_UNTRACKED_IN_RECORDS = "showUntrackedInRecords"
647643
const val KEY_SHOW_UNTRACKED_IN_STATISTICS = "showUntrackedInStatistics"
648644
const val KEY_SHOW_RECORDS_CALENDAR = "showRecordsCalendar"
649-
const val KEY_SHOW_CALENDAR_BUTTON_ON_RECORDS_TAB = "showCalendarButtonOnRecordsTab"
650645
const val KEY_REVERSE_ORDER_IN_CALENDAR = "reverseOrderInCalendar"
651646
const val KEY_DAYS_IN_CALENDAR = "daysInCalendar"
652647
const val KEY_SHOW_ACTIVITY_FILTERS = "showActivityFilters"
@@ -731,5 +726,6 @@ class PrefsRepoImpl @Inject constructor(
731726
private const val KEY_RECORD_TAG_SELECTION_EVEN_FOR_GENERAL_TAGS = "recordTagSelectionEvenForGeneralTags"
732727
private const val KEY_SHOW_NOTIFICATION_WITH_SWITCH = "showNotificationWithSwitch" // Boolean
733728
private const val KEY_SHOW_NOTIFICATION_WITH_SWITCH_HIDE = "showNotificationWithSwitchHide" // Boolean
729+
private const val KEY_SHOW_CALENDAR_BUTTON_ON_RECORDS_TAB = "showCalendarButtonOnRecordsTab" // Boolean
734730
}
735731
}

domain/src/main/java/com/example/util/simpletimetracker/domain/prefs/interactor/PrefsInteractor.kt

Lines changed: 0 additions & 8 deletions
Original file line numberDiff line numberDiff line change
@@ -318,14 +318,6 @@ class PrefsInteractor @Inject constructor(
318318
prefsRepo.showRecordsCalendar = isEnabled
319319
}
320320

321-
suspend fun getShowCalendarButtonOnRecordsTab(): Boolean = withContext(Dispatchers.IO) {
322-
prefsRepo.showCalendarButtonOnRecordsTab
323-
}
324-
325-
suspend fun setShowCalendarButtonOnRecordsTab(isEnabled: Boolean) = withContext(Dispatchers.IO) {
326-
prefsRepo.showCalendarButtonOnRecordsTab = isEnabled
327-
}
328-
329321
suspend fun getReverseOrderInCalendar(): Boolean = withContext(Dispatchers.IO) {
330322
prefsRepo.reverseOrderInCalendar
331323
}

domain/src/main/java/com/example/util/simpletimetracker/domain/prefs/repo/PrefsRepo.kt

Lines changed: 0 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -58,8 +58,6 @@ interface PrefsRepo {
5858

5959
var showRecordsCalendar: Boolean
6060

61-
var showCalendarButtonOnRecordsTab: Boolean
62-
6361
var reverseOrderInCalendar: Boolean
6462

6563
var daysInCalendar: Int

features/feature_records/src/main/java/com/example/util/simpletimetracker/feature_records/mapper/RecordsContainerOptionsListMapper.kt

Lines changed: 10 additions & 14 deletions
Original file line numberDiff line numberDiff line change
@@ -20,20 +20,16 @@ class RecordsContainerOptionsListMapper @Inject constructor(
2020
val isCalendar = prefsInteractor.getShowRecordsCalendar()
2121
val filterType = prefsInteractor.getListFilterType()
2222

23-
result += if (prefsInteractor.getShowCalendarButtonOnRecordsTab()) {
24-
OptionsListParams.Item(
25-
id = RecordsContainerOptionsListItem.CalendarView,
26-
text = if (isCalendar) {
27-
R.string.records_switch_to_list
28-
} else {
29-
R.string.records_switch_to_calendar
30-
}.let(resourceRepo::getString),
31-
icon = if (isCalendar) R.drawable.list else R.drawable.calendar,
32-
isIconCheckVisible = false,
33-
)
34-
} else {
35-
null
36-
}
23+
result += OptionsListParams.Item(
24+
id = RecordsContainerOptionsListItem.CalendarView,
25+
text = if (isCalendar) {
26+
R.string.records_switch_to_list
27+
} else {
28+
R.string.records_switch_to_calendar
29+
}.let(resourceRepo::getString),
30+
icon = if (isCalendar) R.drawable.list else R.drawable.calendar,
31+
isIconCheckVisible = false,
32+
)
3733

3834
result += OptionsListParams.Item(
3935
id = RecordsContainerOptionsListItem.Share,

features/feature_settings/api/src/main/java/com/example/util/simpletimetracker/feature_settings/api/SettingsBlock.kt

Lines changed: 0 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -43,7 +43,6 @@ enum class SettingsBlock {
4343
DisplayUntrackedRangeStart,
4444
DisplayUntrackedRangeEnd,
4545
DisplayCalendarView,
46-
DisplayCalendarButtonOnRecordsTab,
4746
DisplayReverseOrder,
4847
DisplayDaysInCalendar,
4948
DisplayShowActivityFilters,

features/feature_settings/src/main/java/com/example/util/simpletimetracker/feature_settings/interactor/SettingsDisplayViewDataInteractor.kt

Lines changed: 0 additions & 8 deletions
Original file line numberDiff line numberDiff line change
@@ -99,14 +99,6 @@ class SettingsDisplayViewDataInteractor @Inject constructor(
9999
title = resourceRepo.getString(R.string.settings_show_records_calendar),
100100
subtitle = "",
101101
isChecked = showRecordsCalendar,
102-
bottomSpaceIsVisible = false,
103-
dividerIsVisible = false,
104-
)
105-
result += SettingsCheckboxViewData(
106-
block = SettingsBlock.DisplayCalendarButtonOnRecordsTab,
107-
title = resourceRepo.getString(R.string.settings_show_calendar_button_on_records_tab),
108-
subtitle = "",
109-
isChecked = prefsInteractor.getShowCalendarButtonOnRecordsTab(),
110102
bottomSpaceIsVisible = !showRecordsCalendar,
111103
dividerIsVisible = !showRecordsCalendar,
112104
)

features/feature_settings/src/main/java/com/example/util/simpletimetracker/feature_settings/viewModel/delegate/SettingsDisplayViewModelDelegate.kt

Lines changed: 0 additions & 9 deletions
Original file line numberDiff line numberDiff line change
@@ -62,7 +62,6 @@ class SettingsDisplayViewModelDelegate @Inject constructor(
6262
SettingsBlock.DisplayUntrackedInStatistics -> onShowUntrackedInStatisticsClicked()
6363
SettingsBlock.DisplayUntrackedRangeCheckbox -> onUntrackedRangeClicked()
6464
SettingsBlock.DisplayCalendarView -> onShowRecordsCalendarClicked()
65-
SettingsBlock.DisplayCalendarButtonOnRecordsTab -> onShowCalendarButtonOnRecordsTabClicked()
6665
SettingsBlock.DisplayReverseOrder -> onReverseOrderInCalendarClicked()
6766
SettingsBlock.DisplayShowActivityFilters -> onShowActivityFiltersClicked()
6867
SettingsBlock.DisplayEnablePomodoroMode -> onEnablePomodoroModeClicked()
@@ -256,14 +255,6 @@ class SettingsDisplayViewModelDelegate @Inject constructor(
256255
}
257256
}
258257

259-
private fun onShowCalendarButtonOnRecordsTabClicked() {
260-
delegateScope.launch {
261-
val newValue = !prefsInteractor.getShowCalendarButtonOnRecordsTab()
262-
prefsInteractor.setShowCalendarButtonOnRecordsTab(newValue)
263-
parent?.updateContent()
264-
}
265-
}
266-
267258
private fun onReverseOrderInCalendarClicked() {
268259
delegateScope.launch {
269260
val newValue = !prefsInteractor.getReverseOrderInCalendar()

0 commit comments

Comments
 (0)