mirror of
https://github.com/Matte23/circolapp.git
synced 2025-12-05 23:19:10 +00:00
Highlight unread circulars on iOS
This commit is contained in:
@@ -163,12 +163,14 @@ class CircularLetterAdapter(
|
||||
}
|
||||
|
||||
holder.viewButton.setOnClickListener {
|
||||
adapterScope.launch {
|
||||
AndroidDatabase.getDaoInstance(context).markRead(
|
||||
circulars[position].id,
|
||||
circulars[position].school,
|
||||
true
|
||||
)
|
||||
if (!circulars[position].read) {
|
||||
adapterScope.launch {
|
||||
AndroidDatabase.getDaoInstance(context).markRead(
|
||||
circulars[position].id,
|
||||
circulars[position].school,
|
||||
true
|
||||
)
|
||||
}
|
||||
}
|
||||
|
||||
FileUtils.viewFile(circulars[position].url, context)
|
||||
|
||||
@@ -32,8 +32,10 @@ struct CircularView: View {
|
||||
HStack {
|
||||
Text("Circular number \(String(circular.id))")
|
||||
.font(.headline)
|
||||
.fontWeight(circular.read ? .regular : .bold)
|
||||
Text(circular.date)
|
||||
.font(.subheadline)
|
||||
.fontWeight(circular.read ? .regular : .bold)
|
||||
Spacer()
|
||||
Button(action: {
|
||||
self.showDetail.toggle()
|
||||
@@ -51,6 +53,10 @@ struct CircularView: View {
|
||||
if showDetail {
|
||||
HStack {
|
||||
Button(action: {
|
||||
if !circular.read {
|
||||
iOSRepository.getCircularDao().markRead(id: circular.id, school: circular.school, read: true, completionHandler: {_,_ in })
|
||||
}
|
||||
|
||||
URLUtils.openUrl(url: circular.url)
|
||||
}) {
|
||||
Image(systemName: "envelope.open.fill")
|
||||
@@ -132,7 +138,7 @@ struct CircularView: View {
|
||||
}
|
||||
|
||||
struct CircularView_Previews: PreviewProvider {
|
||||
static var previewCircular = Circular(id: 1, school: 0, name: "This is a circular", url: "http://example.com", date: "19/11/2020", favourite: false, reminder: false, attachmentsNames: [], attachmentsUrls: [])
|
||||
static var previewCircular = Circular(id: 1, school: 0, name: "This is a circular", url: "http://example.com", date: "19/11/2020", favourite: false, reminder: false, read: false, attachmentsNames: [], attachmentsUrls: [])
|
||||
|
||||
static var previews: some View {
|
||||
CircularView(circular: previewCircular)
|
||||
|
||||
@@ -71,7 +71,7 @@ struct NewReminderView: View {
|
||||
}
|
||||
|
||||
struct NewReminderView_Previews: PreviewProvider {
|
||||
static var previewCircular = Circular(id: 1, school: 0, name: "This is a circular", url: "http://example.com", date: "19/11/2020", favourite: false, reminder: false, attachmentsNames: [], attachmentsUrls: [])
|
||||
static var previewCircular = Circular(id: 1, school: 0, name: "This is a circular", url: "http://example.com", date: "19/11/2020", favourite: false, reminder: false, read: false, attachmentsNames: [], attachmentsUrls: [])
|
||||
|
||||
static var previews: some View {
|
||||
NewReminderView(circular: previewCircular)
|
||||
|
||||
@@ -34,6 +34,11 @@ struct SettingsView: View {
|
||||
Text(serverCompanion.getServerName(server: server))
|
||||
}
|
||||
}
|
||||
Button(action: {
|
||||
iOSRepository.getCircularDao().markAllRead(read: true, completionHandler: {_,_ in })
|
||||
}) {
|
||||
Text("Mark all circulars as read")
|
||||
}
|
||||
}
|
||||
|
||||
Section(header: Text("SCHOOL")) {
|
||||
|
||||
@@ -24,6 +24,7 @@
|
||||
|
||||
"School" = "School";
|
||||
"School website" = "School website";
|
||||
"Mark all circulars as read" = "Mark all circulars as read";
|
||||
"Privacy policy" = "Privacy policy";
|
||||
"Error" = "Error";
|
||||
"Version" = "Version";
|
||||
|
||||
@@ -24,6 +24,7 @@
|
||||
|
||||
"School" = "Scuola";
|
||||
"School website" = "Sito della scuola";
|
||||
"Mark all circulars as read" = "Segna tutte le circolari come già lette";
|
||||
"Privacy policy" = "Privacy policy";
|
||||
"Error" = "Errore";
|
||||
"Version" = "Versione";
|
||||
|
||||
Reference in New Issue
Block a user