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](
12
12
- ** Save and Organize Deeplinks:** Easily store and manage a list of frequently used deeplinks.
13
13
- ** Launch Deeplinks:** Test and verify deeplink behavior by launching them directly from the app.
14
14
- ** 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.
16
17
- ** Home Screen Shortcuts:** Create shortcuts for your most-used deeplinks on your device's home screen for quick access.
17
18
18
19
## Architecture
Original file line number Diff line number Diff line change @@ -156,6 +156,20 @@ fun FilterMenu(onSortOrderChange: (SortOrder) -> Unit) {
156
156
expanded = false
157
157
}
158
158
)
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
+ )
159
173
}
160
174
}
161
175
}
Original file line number Diff line number Diff line change @@ -15,7 +15,7 @@ import kotlinx.coroutines.flow.stateIn
15
15
import kotlinx.coroutines.launch
16
16
17
17
enum class SortOrder {
18
- ASC , DESC
18
+ ASC , DESC , OPENED_ASC , OPENED_DESC
19
19
}
20
20
21
21
class AccountViewModel (private val deeprQueries : DeeprQueries ) : ViewModel() {
@@ -31,11 +31,15 @@ class AccountViewModel(private val deeprQueries: DeeprQueries) : ViewModel() {
31
31
when (order) {
32
32
SortOrder .ASC -> deeprQueries.listDeeprAsc()
33
33
SortOrder .DESC -> deeprQueries.listDeeprDesc()
34
+ SortOrder .OPENED_ASC -> deeprQueries.listDeeprByOpenedCountAsc()
35
+ SortOrder .OPENED_DESC -> deeprQueries.listDeeprByOpenedCountDesc()
34
36
}.asFlow().mapToList(viewModelScope.coroutineContext)
35
37
} else {
36
38
when (order) {
37
39
SortOrder .ASC -> deeprQueries.searchDeeprAsc(query)
38
40
SortOrder .DESC -> deeprQueries.searchDeeprDesc(query)
41
+ SortOrder .OPENED_ASC -> deeprQueries.searchDeeprByOpenedCountAsc(query)
42
+ SortOrder .OPENED_DESC -> deeprQueries.searchDeeprByOpenedCountDesc(query)
39
43
}.asFlow().mapToList(viewModelScope.coroutineContext)
40
44
}
41
45
}.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;
26
26
searchDeeprAsc:
27
27
SELECT * FROM Deepr WHERE link LIKE '%' || ? || '%' ORDER BY createdAt ASC;
28
28
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
+
29
41
incrementOpenedCount:
30
42
UPDATE Deepr SET openedCount = openedCount + 1 WHERE id = ?;
You can’t perform that action at this time.
0 commit comments