File tree Expand file tree Collapse file tree 4 files changed +33
-2
lines changed
java/com/yogeshpaliyal/deepr
sqldelight/com/yogeshpaliyal/deepr Expand file tree Collapse file tree 4 files changed +33
-2
lines changed Original file line number Diff line number Diff line change @@ -12,7 +12,8 @@ You can download the latest version of the application from the [releases page](
1212- ** Save and Organize Deeplinks:** Easily store and manage a list of frequently used deeplinks.
1313- ** Launch Deeplinks:** Test and verify deeplink behavior by launching them directly from the app.
1414- ** Search:** Quickly find specific deeplinks from your saved list.
15- - ** Sort:** Organize your deeplinks by date in either ascending or descending order.
15+ - ** Sort:** Organize your deeplinks by date or open counter in either ascending or descending order.
16+ - ** Open Counter:** Keep track of how many times each deeplink has been opened.
1617- ** Home Screen Shortcuts:** Create shortcuts for your most-used deeplinks on your device's home screen for quick access.
1718
1819## Architecture
Original file line number Diff line number Diff line change @@ -156,6 +156,20 @@ fun FilterMenu(onSortOrderChange: (SortOrder) -> Unit) {
156156 expanded = false
157157 }
158158 )
159+ DropdownMenuItem (
160+ text = { Text (" Sort by Opened Ascending" ) },
161+ onClick = {
162+ onSortOrderChange(SortOrder .OPENED_ASC )
163+ expanded = false
164+ }
165+ )
166+ DropdownMenuItem (
167+ text = { Text (" Sort by Opened Descending" ) },
168+ onClick = {
169+ onSortOrderChange(SortOrder .OPENED_DESC )
170+ expanded = false
171+ }
172+ )
159173 }
160174 }
161175}
Original file line number Diff line number Diff line change @@ -15,7 +15,7 @@ import kotlinx.coroutines.flow.stateIn
1515import kotlinx.coroutines.launch
1616
1717enum class SortOrder {
18- ASC , DESC
18+ ASC , DESC , OPENED_ASC , OPENED_DESC
1919}
2020
2121class AccountViewModel (private val deeprQueries : DeeprQueries ) : ViewModel() {
@@ -31,11 +31,15 @@ class AccountViewModel(private val deeprQueries: DeeprQueries) : ViewModel() {
3131 when (order) {
3232 SortOrder .ASC -> deeprQueries.listDeeprAsc()
3333 SortOrder .DESC -> deeprQueries.listDeeprDesc()
34+ SortOrder .OPENED_ASC -> deeprQueries.listDeeprByOpenedCountAsc()
35+ SortOrder .OPENED_DESC -> deeprQueries.listDeeprByOpenedCountDesc()
3436 }.asFlow().mapToList(viewModelScope.coroutineContext)
3537 } else {
3638 when (order) {
3739 SortOrder .ASC -> deeprQueries.searchDeeprAsc(query)
3840 SortOrder .DESC -> deeprQueries.searchDeeprDesc(query)
41+ SortOrder .OPENED_ASC -> deeprQueries.searchDeeprByOpenedCountAsc(query)
42+ SortOrder .OPENED_DESC -> deeprQueries.searchDeeprByOpenedCountDesc(query)
3943 }.asFlow().mapToList(viewModelScope.coroutineContext)
4044 }
4145 }.stateIn(viewModelScope, SharingStarted .WhileSubscribed (5000 ), emptyList())
Original file line number Diff line number Diff line change @@ -26,5 +26,17 @@ SELECT * FROM Deepr WHERE link LIKE '%' || ? || '%' ORDER BY createdAt DESC;
2626searchDeeprAsc:
2727SELECT * FROM Deepr WHERE link LIKE '%' || ? || '%' ORDER BY createdAt ASC;
2828
29+ listDeeprByOpenedCountDesc:
30+ SELECT * FROM Deepr ORDER BY openedCount DESC;
31+
32+ listDeeprByOpenedCountAsc:
33+ SELECT * FROM Deepr ORDER BY openedCount ASC;
34+
35+ searchDeeprByOpenedCountDesc:
36+ SELECT * FROM Deepr WHERE link LIKE '%' || ? || '%' ORDER BY openedCount DESC;
37+
38+ searchDeeprByOpenedCountAsc:
39+ SELECT * FROM Deepr WHERE link LIKE '%' || ? || '%' ORDER BY openedCount ASC;
40+
2941incrementOpenedCount:
3042UPDATE Deepr SET openedCount = openedCount + 1 WHERE id = ?;
You can’t perform that action at this time.
0 commit comments