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