mirror of
https://github.com/meshtastic/Meshtastic-Apple.git
synced 2026-04-20 22:13:56 +00:00
Set tapbacks to read as scrolling by in messages
This commit is contained in:
parent
aa2f3c4511
commit
10359784f7
2 changed files with 29 additions and 0 deletions
|
|
@ -190,6 +190,20 @@ struct ChannelMessageList: View {
|
|||
.fixedSize()
|
||||
.padding(.bottom, 1)
|
||||
}
|
||||
.onAppear {
|
||||
if !tapback.read {
|
||||
tapback.read = true
|
||||
do {
|
||||
try context.save()
|
||||
print("📖 Read message \(message.messageId) ")
|
||||
appState.unreadChannelMessages = myInfo.unreadMessages
|
||||
UIApplication.shared.applicationIconBadgeNumber = appState.unreadChannelMessages + appState.unreadDirectMessages
|
||||
context.refresh(myInfo, mergeChanges: true)
|
||||
} catch {
|
||||
print("Failed to read tapback \(tapback.messageId)")
|
||||
}
|
||||
}
|
||||
}
|
||||
}
|
||||
}
|
||||
.padding(10)
|
||||
|
|
@ -199,6 +213,7 @@ struct ChannelMessageList: View {
|
|||
)
|
||||
}
|
||||
}
|
||||
|
||||
HStack {
|
||||
if currentUser && message.receivedACK {
|
||||
// Ack Received
|
||||
|
|
|
|||
|
|
@ -167,6 +167,20 @@ struct UserMessageList: View {
|
|||
.fixedSize()
|
||||
.padding(.bottom, 1)
|
||||
}
|
||||
.onAppear {
|
||||
if !tapback.read {
|
||||
tapback.read = true
|
||||
do {
|
||||
try context.save()
|
||||
print("📖 Read tapback \(tapback.messageId) ")
|
||||
appState.unreadDirectMessages = user.unreadMessages
|
||||
UIApplication.shared.applicationIconBadgeNumber = appState.unreadChannelMessages + appState.unreadDirectMessages
|
||||
|
||||
} catch {
|
||||
print("Failed to read tapback \(tapback.messageId)")
|
||||
}
|
||||
}
|
||||
}
|
||||
}
|
||||
}
|
||||
.padding(10)
|
||||
|
|
|
|||
Loading…
Add table
Add a link
Reference in a new issue