mirror of
https://github.com/Matte23/circolapp.git
synced 2025-12-05 23:19:10 +00:00
Show circular's date if ID isn't meaningful on iOS
This commit is contained in:
@@ -25,7 +25,7 @@ struct CircularList: View {
|
|||||||
|
|
||||||
var body: some View {
|
var body: some View {
|
||||||
List(circularViewModel.circulars, id: \.id) { circular in
|
List(circularViewModel.circulars, id: \.id) { circular in
|
||||||
CircularView(circular: circular)
|
CircularView(circular: circular, idIsHumanReadable: circularViewModel.idsAreHumanReadable)
|
||||||
}
|
}
|
||||||
.navigationBarTitle(Text("Circulars"), displayMode: .large)
|
.navigationBarTitle(Text("Circulars"), displayMode: .large)
|
||||||
.pullToRefresh() { endRefreshing in circularViewModel.updateCirculars {
|
.pullToRefresh() { endRefreshing in circularViewModel.updateCirculars {
|
||||||
|
|||||||
@@ -27,16 +27,23 @@ struct CircularView: View {
|
|||||||
@State private var loadingRealUrl = false
|
@State private var loadingRealUrl = false
|
||||||
|
|
||||||
var circular: Circular
|
var circular: Circular
|
||||||
|
var idIsHumanReadable = true
|
||||||
|
|
||||||
var body: some View {
|
var body: some View {
|
||||||
VStack(alignment: .leading) {
|
VStack(alignment: .leading) {
|
||||||
HStack {
|
HStack {
|
||||||
|
if idIsHumanReadable {
|
||||||
Text("Circular number \(String(circular.id))")
|
Text("Circular number \(String(circular.id))")
|
||||||
.font(.headline)
|
.font(.headline)
|
||||||
.fontWeight(circular.read ? .regular : .bold)
|
.fontWeight(circular.read ? .regular : .bold)
|
||||||
Text(circular.date)
|
Text(circular.date)
|
||||||
.font(.subheadline)
|
.font(.subheadline)
|
||||||
.fontWeight(circular.read ? .regular : .bold)
|
.fontWeight(circular.read ? .regular : .bold)
|
||||||
|
} else {
|
||||||
|
Text("Circular published on \(String(circular.date))")
|
||||||
|
.font(.headline)
|
||||||
|
.fontWeight(circular.read ? .regular : .bold)
|
||||||
|
}
|
||||||
Spacer()
|
Spacer()
|
||||||
Button(action: {
|
Button(action: {
|
||||||
self.showDetail.toggle()
|
self.showDetail.toggle()
|
||||||
|
|||||||
@@ -24,7 +24,7 @@ struct FavouritesList: View {
|
|||||||
|
|
||||||
var body: some View {
|
var body: some View {
|
||||||
List(favouritesViewModel.circulars, id: \.id) { circular in
|
List(favouritesViewModel.circulars, id: \.id) { circular in
|
||||||
CircularView(circular: circular)
|
CircularView(circular: circular, idIsHumanReadable: favouritesViewModel.idsAreHumanReadable)
|
||||||
}
|
}
|
||||||
.navigationBarTitle(Text("Bookmarks"), displayMode: .large)
|
.navigationBarTitle(Text("Bookmarks"), displayMode: .large)
|
||||||
.addSearchBar(self.searchBar)
|
.addSearchBar(self.searchBar)
|
||||||
|
|||||||
@@ -24,7 +24,7 @@ struct RemindersList: View {
|
|||||||
|
|
||||||
var body: some View {
|
var body: some View {
|
||||||
List(remindersViewModel.circulars, id: \.id) { circular in
|
List(remindersViewModel.circulars, id: \.id) { circular in
|
||||||
CircularView(circular: circular)
|
CircularView(circular: circular, idIsHumanReadable: remindersViewModel.idsAreHumanReadable)
|
||||||
}
|
}
|
||||||
.navigationBarTitle(Text("Reminders"), displayMode: .large)
|
.navigationBarTitle(Text("Reminders"), displayMode: .large)
|
||||||
.addSearchBar(self.searchBar)
|
.addSearchBar(self.searchBar)
|
||||||
|
|||||||
@@ -21,6 +21,7 @@ import Shared
|
|||||||
|
|
||||||
class CircularViewModel: ObservableObject {
|
class CircularViewModel: ObservableObject {
|
||||||
@Published var circulars = Array<Circular>()
|
@Published var circulars = Array<Circular>()
|
||||||
|
public var idsAreHumanReadable = true
|
||||||
|
|
||||||
private var circularWatcher: Ktor_ioCloseable? = nil
|
private var circularWatcher: Ktor_ioCloseable? = nil
|
||||||
private var userDefaultsObserver: NSKeyValueObservation? = nil
|
private var userDefaultsObserver: NSKeyValueObservation? = nil
|
||||||
@@ -55,6 +56,7 @@ class CircularViewModel: ObservableObject {
|
|||||||
func startObservingCirculars() {
|
func startObservingCirculars() {
|
||||||
stopObserving()
|
stopObserving()
|
||||||
circularWatcher = repository.circularDao.getCFlowCirculars(school: Int32(schoolID)).watch { circulars in
|
circularWatcher = repository.circularDao.getCFlowCirculars(school: Int32(schoolID)).watch { circulars in
|
||||||
|
self.idsAreHumanReadable = iOSServerApi.instance.serverAPI.idsAreHumanReadable()
|
||||||
self.circulars = circulars as! Array<Circular>;
|
self.circulars = circulars as! Array<Circular>;
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|||||||
@@ -21,6 +21,7 @@ import Shared
|
|||||||
|
|
||||||
class FavouritesViewModel: ObservableObject {
|
class FavouritesViewModel: ObservableObject {
|
||||||
@Published var circulars = Array<Circular>()
|
@Published var circulars = Array<Circular>()
|
||||||
|
public var idsAreHumanReadable = true
|
||||||
|
|
||||||
private var circularWatcher: Ktor_ioCloseable? = nil
|
private var circularWatcher: Ktor_ioCloseable? = nil
|
||||||
private var userDefaultsObserver: NSKeyValueObservation? = nil
|
private var userDefaultsObserver: NSKeyValueObservation? = nil
|
||||||
@@ -50,6 +51,7 @@ class FavouritesViewModel: ObservableObject {
|
|||||||
func startObservingFavourites() {
|
func startObservingFavourites() {
|
||||||
stopObserving()
|
stopObserving()
|
||||||
circularWatcher = repository.circularDao.getFavouritesC(school: Int32(schoolID)).watch { circulars in
|
circularWatcher = repository.circularDao.getFavouritesC(school: Int32(schoolID)).watch { circulars in
|
||||||
|
self.idsAreHumanReadable = iOSServerApi.instance.serverAPI.idsAreHumanReadable()
|
||||||
self.circulars = circulars as! Array<Circular>;
|
self.circulars = circulars as! Array<Circular>;
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|||||||
@@ -21,6 +21,7 @@ import Shared
|
|||||||
|
|
||||||
class RemindersViewModel: ObservableObject {
|
class RemindersViewModel: ObservableObject {
|
||||||
@Published var circulars = Array<Circular>()
|
@Published var circulars = Array<Circular>()
|
||||||
|
public var idsAreHumanReadable = true
|
||||||
|
|
||||||
private var circularWatcher: Ktor_ioCloseable? = nil
|
private var circularWatcher: Ktor_ioCloseable? = nil
|
||||||
private var userDefaultsObserver: NSKeyValueObservation? = nil
|
private var userDefaultsObserver: NSKeyValueObservation? = nil
|
||||||
@@ -50,6 +51,7 @@ class RemindersViewModel: ObservableObject {
|
|||||||
func startObservingReminders() {
|
func startObservingReminders() {
|
||||||
stopObserving()
|
stopObserving()
|
||||||
circularWatcher = repository.circularDao.getCFlowReminders(school: Int32(schoolID)).watch { circulars in
|
circularWatcher = repository.circularDao.getCFlowReminders(school: Int32(schoolID)).watch { circulars in
|
||||||
|
self.idsAreHumanReadable = iOSServerApi.instance.serverAPI.idsAreHumanReadable()
|
||||||
self.circulars = circulars as! Array<Circular>;
|
self.circulars = circulars as! Array<Circular>;
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|||||||
@@ -46,3 +46,4 @@
|
|||||||
"New reminder" = "New reminder";
|
"New reminder" = "New reminder";
|
||||||
|
|
||||||
"Circular number %@" = "Circular number %@";
|
"Circular number %@" = "Circular number %@";
|
||||||
|
"Circular published on %@" = "Circular published on %@";
|
||||||
|
|||||||
@@ -46,3 +46,4 @@
|
|||||||
"New reminder" = "Nuovo promemoria";
|
"New reminder" = "Nuovo promemoria";
|
||||||
|
|
||||||
"Circular number %@" = "Circolare numero %@";
|
"Circular number %@" = "Circolare numero %@";
|
||||||
|
"Circular published on %@" = "Circolare pubblicata il %@";
|
||||||
|
|||||||
Reference in New Issue
Block a user