mirror of
https://github.com/rhunk/SnapEnhance.git
synced 2025-06-12 13:17:42 +02:00
feat: mark stories as seen locally
This commit is contained in:
@ -351,4 +351,13 @@ class DatabaseAccess(
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
fun markFriendStoriesAsSeen(userId: String) {
|
||||
openLocalDatabase("main", writeMode = true)?.apply {
|
||||
performOperation {
|
||||
execSQL("UPDATE StorySnap SET viewed = 1 WHERE userId = ?", arrayOf(userId))
|
||||
}
|
||||
close()
|
||||
}
|
||||
}
|
||||
}
|
@ -278,9 +278,10 @@ class FriendFeedInfoMenu : AbstractMenu() {
|
||||
|
||||
val (conversationId, targetUser) = getCurrentConversationInfo()
|
||||
|
||||
val translation = context.translation.getCategory("friend_menu_option")
|
||||
if (friendFeedMenuOptions.contains("conversation_info")) {
|
||||
viewConsumer(Button(view.context).apply {
|
||||
text = modContext.translation["friend_menu_option.preview"]
|
||||
text = translation["preview"]
|
||||
applyTheme(view.width, hasRadius = true)
|
||||
setOnClickListener {
|
||||
showPreview(
|
||||
@ -302,9 +303,9 @@ class FriendFeedInfoMenu : AbstractMenu() {
|
||||
)
|
||||
}
|
||||
|
||||
if (friendFeedMenuOptions.contains("mark_as_seen")) {
|
||||
if (friendFeedMenuOptions.contains("mark_snaps_as_seen")) {
|
||||
viewConsumer(Button(view.context).apply {
|
||||
text = modContext.translation["friend_menu_option.mark_as_seen"]
|
||||
text = translation["mark_snaps_as_seen"]
|
||||
applyTheme(view.width, hasRadius = true)
|
||||
setOnClickListener {
|
||||
this@FriendFeedInfoMenu.context.mainActivity?.triggerRootCloseTouchEvent()
|
||||
@ -312,5 +313,18 @@ class FriendFeedInfoMenu : AbstractMenu() {
|
||||
}
|
||||
})
|
||||
}
|
||||
|
||||
if (targetUser != null && friendFeedMenuOptions.contains("mark_stories_as_seen")) {
|
||||
viewConsumer(Button(view.context).apply {
|
||||
text = translation["mark_stories_as_seen"]
|
||||
applyTheme(view.width, hasRadius = true)
|
||||
setOnClickListener {
|
||||
this@FriendFeedInfoMenu.context.apply {
|
||||
mainActivity?.triggerRootCloseTouchEvent()
|
||||
database.markFriendStoriesAsSeen(targetUser)
|
||||
}
|
||||
}
|
||||
})
|
||||
}
|
||||
}
|
||||
}
|
Reference in New Issue
Block a user